~bzr-pqm/bzr/bzr.dev

« back to all changes in this revision

Viewing changes to bzrlib/workingtree_4.py

  • Committer: Martin Pool
  • Date: 2008-06-25 10:06:48 UTC
  • mfrom: (3509 +trunk)
  • mto: This revision was merged to the branch mainline in revision 3510.
  • Revision ID: mbp@sourcefrog.net-20080625100648-ac20jxcm3ojucuby
merge trunk; remove RemoteToOtherFetcher

Show diffs side-by-side

added added

removed removed

Lines of Context:
528
528
        return iter(result)
529
529
 
530
530
    def iter_references(self):
 
531
        if not self._repo_supports_tree_reference:
 
532
            # When the repo doesn't support references, we will have nothing to
 
533
            # return
 
534
            return
531
535
        for key, tree_details in self.current_dirstate()._iter_entries():
532
536
            if tree_details[0][0] in ('a', 'r'): # absent, relocated
533
537
                # not relevant to the working tree
535
539
            if not key[1]:
536
540
                # the root is not a reference.
537
541
                continue
538
 
            path = pathjoin(self.basedir, key[0].decode('utf8'), key[1].decode('utf8'))
 
542
            relpath = pathjoin(key[0].decode('utf8'), key[1].decode('utf8'))
539
543
            try:
540
 
                if self._kind(path) == 'tree-reference':
541
 
                    yield path, key[2]
 
544
                if self._kind(relpath) == 'tree-reference':
 
545
                    yield relpath, key[2]
542
546
            except errors.NoSuchFile:
543
547
                # path is missing on disk.
544
548
                continue
1415
1419
        self._inventory = None
1416
1420
        self._locked = 0
1417
1421
        self._dirstate_locked = False
 
1422
        self._repo_supports_tree_reference = getattr(
 
1423
            repository._format, "supports_tree_reference",
 
1424
            False)
1418
1425
 
1419
1426
    def __repr__(self):
1420
1427
        return "<%s of %s in %s>" % \
1460
1467
        path_utf8 = osutils.pathjoin(entry[0][0], entry[0][1])
1461
1468
        return path_utf8.decode('utf8')
1462
1469
 
 
1470
    def iter_references(self):
 
1471
        if not self._repo_supports_tree_reference:
 
1472
            # When the repo doesn't support references, we will have nothing to
 
1473
            # return
 
1474
            return iter([])
 
1475
        # Otherwise, fall back to the default implementation
 
1476
        return super(DirStateRevisionTree, self).iter_references()
 
1477
 
1463
1478
    def _get_parent_index(self):
1464
1479
        """Return the index in the dirstate referenced by this tree."""
1465
1480
        return self._dirstate.get_parent_ids().index(self._revision_id) + 1
1719
1734
                self._dirstate_locked = False
1720
1735
            self._repository.unlock()
1721
1736
 
 
1737
    @needs_read_lock
 
1738
    def supports_tree_reference(self):
 
1739
        return self._repo_supports_tree_reference
 
1740
 
1722
1741
    def walkdirs(self, prefix=""):
1723
1742
        # TODO: jam 20070215 This is the lazy way by using the RevisionTree
1724
1743
        # implementation based on an inventory.