/brz/remove-bazaar

To get this branch, use:
bzr branch http://gegoxaren.bato24.eu/bzr/brz/remove-bazaar

« back to all changes in this revision

Viewing changes to bzrlib/workingtree_4.py

Merge Martins 0.15rc2 release branch.

Show diffs side-by-side

added added

removed removed

Lines of Context:
353
353
                inv_entry = factory[kind](file_id, name_unicode,
354
354
                                          parent_ie.file_id)
355
355
                if kind == 'file':
 
356
                    # This is only needed on win32, where this is the only way
 
357
                    # we know the executable bit.
 
358
                    inv_entry.executable = executable
356
359
                    # not strictly needed: working tree
357
 
                    #entry.executable = executable
358
 
                    #entry.text_size = size
359
 
                    #entry.text_sha1 = sha1
360
 
                    pass
 
360
                    #inv_entry.text_size = size
 
361
                    #inv_entry.text_sha1 = sha1
361
362
                elif kind == 'directory':
362
363
                    # add this entry to the parent map.
363
364
                    parent_ies[(dirname + '/' + name).strip('/')] = inv_entry
364
365
                elif kind == 'tree-reference':
365
 
                    assert self._repo_supports_tree_reference
 
366
                    assert self._repo_supports_tree_reference, \
 
367
                        "repository of %r " \
 
368
                        "doesn't support tree references " \
 
369
                        "required by entry %r" \
 
370
                        % (self, name)
366
371
                    inv_entry.reference_revision = link_or_sha1 or None
367
 
                else:
368
 
                    assert 'unknown kind'
 
372
                elif kind != 'symlink':
 
373
                    raise AssertionError("unknown kind %r" % kind)
369
374
                # These checks cost us around 40ms on a 55k entry tree
370
375
                assert file_id not in inv_byid, ('file_id %s already in'
371
376
                    ' inventory as %s' % (file_id, inv_byid[file_id]))
460
465
        path_utf8 = osutils.pathjoin(entry[0][0], entry[0][1])
461
466
        return path_utf8.decode('utf8')
462
467
 
 
468
    if not osutils.supports_executable():
 
469
        @needs_read_lock
 
470
        def is_executable(self, file_id, path=None):
 
471
            file_id = osutils.safe_file_id(file_id)
 
472
            entry = self._get_entry(file_id=file_id, path=path)
 
473
            if entry == (None, None):
 
474
                return False
 
475
            return entry[1][0][3]
 
476
    else:
 
477
        @needs_read_lock
 
478
        def is_executable(self, file_id, path=None):
 
479
            if not path:
 
480
                file_id = osutils.safe_file_id(file_id)
 
481
                path = self.id2path(file_id)
 
482
            mode = os.lstat(self.abspath(path)).st_mode
 
483
            return bool(stat.S_ISREG(mode) and stat.S_IEXEC & mode)
 
484
 
463
485
    @needs_read_lock
464
486
    def __iter__(self):
465
487
        """Iterate through file_ids for this tree.
1400
1422
                    parent_ies[(dirname + '/' + name).strip('/')] = inv_entry
1401
1423
                elif kind == 'symlink':
1402
1424
                    inv_entry.executable = False
1403
 
                    inv_entry.text_size = size
 
1425
                    inv_entry.text_size = None
1404
1426
                    inv_entry.symlink_target = utf8_decode(fingerprint)[0]
1405
1427
                elif kind == 'tree-reference':
1406
1428
                    inv_entry.reference_revision = fingerprint or None
1945
1967
                # implementation will do.
1946
1968
                if not osutils.is_inside_any(searched_specific_files, target_details[1]):
1947
1969
                    search_specific_files.add(target_details[1])
1948
 
            elif source_minikind in 'r' and target_minikind in 'r':
 
1970
            elif source_minikind in 'ra' and target_minikind in 'ra':
1949
1971
                # neither of the selected trees contain this file,
1950
1972
                # so skip over it. This is not currently directly tested, but
1951
1973
                # is indirectly via test_too_much.TestCommands.test_conflicts.