Rev 3593: Fetch into stacked branches works correctly (abentley, jml) in file:///home/pqm/archives/thelove/bzr/%2Btrunk/

Canonical.com Patch Queue Manager pqm at pqm.ubuntu.com
Wed Jul 30 02:30:01 BST 2008


At file:///home/pqm/archives/thelove/bzr/%2Btrunk/

------------------------------------------------------------
revno: 3593
revision-id:pqm at pqm.ubuntu.com-20080730012945-o1jetsqxklmxzgt2
parent: pqm at pqm.ubuntu.com-20080730010050-yt2pf2kmm4x4c033
parent: aaron at aaronbentley.com-20080730003048-xwfaeb2toqq9njsj
committer: Canonical.com Patch Queue Manager <pqm at pqm.ubuntu.com>
branch nick: +trunk
timestamp: Wed 2008-07-30 02:29:45 +0100
message:
  Fetch into stacked branches works correctly (abentley, jml)
modified:
  bzrlib/repository.py           rev_storage.py-20051111201905-119e9401e46257e3
  bzrlib/tests/branch_implementations/test_stacking.py test_stacking.py-20080214020755-msjlkb7urobwly0f-1
    ------------------------------------------------------------
    revno: 3590.2.1
    revision-id:aaron at aaronbentley.com-20080730003048-xwfaeb2toqq9njsj
    parent: pqm at pqm.ubuntu.com-20080729170343-hy20k9g6euzsz04s
    parent: jml at canonical.com-20080728053833-ijynofxsv9pmqedi
    committer: Aaron Bentley <aaron at aaronbentley.com>
    branch nick: bzr.ab.integration
    timestamp: Wed 2008-07-30 12:30:48 +1200
    message:
      Merge stacking fix
    modified:
      bzrlib/repository.py           rev_storage.py-20051111201905-119e9401e46257e3
      bzrlib/tests/branch_implementations/test_stacking.py test_stacking.py-20080214020755-msjlkb7urobwly0f-1
    ------------------------------------------------------------
    revno: 3582.2.1
    revision-id:jml at canonical.com-20080728053833-ijynofxsv9pmqedi
    parent: pqm at pqm.ubuntu.com-20080728024856-nbikndmfq06firuo
    committer: Jonathan Lange <jml at canonical.com>
    branch nick: reference-check
    timestamp: Mon 2008-07-28 17:38:33 +1200
    message:
      Fix up problems with fetching revisions. Almost entirely abentley's work.
    modified:
      bzrlib/repository.py           rev_storage.py-20051111201905-119e9401e46257e3
      bzrlib/tests/branch_implementations/test_stacking.py test_stacking.py-20080214020755-msjlkb7urobwly0f-1
=== modified file 'bzrlib/repository.py'
--- a/bzrlib/repository.py	2008-07-29 15:51:45 +0000
+++ b/bzrlib/repository.py	2008-07-30 00:30:48 +0000
@@ -2751,7 +2751,8 @@
     @needs_write_lock
     def fetch(self, revision_id=None, pb=None, find_ghosts=False):
         """See InterRepository.fetch()."""
-        if len(self.source._fallback_repositories) > 0:
+        if (len(self.source._fallback_repositories) > 0 or
+            len(self.target._fallback_repositories) > 0):
             from bzrlib.fetch import RepoFetcher
             fetcher = RepoFetcher(self.target, self.source, revision_id,
                                       pb, find_ghosts)

=== modified file 'bzrlib/tests/branch_implementations/test_stacking.py'
--- a/bzrlib/tests/branch_implementations/test_stacking.py	2008-07-23 21:11:09 +0000
+++ b/bzrlib/tests/branch_implementations/test_stacking.py	2008-07-28 05:38:33 +0000
@@ -258,3 +258,34 @@
         unstacked.fetch(stacked.branch.repository, 'rev2')
         unstacked.get_revision('rev1')
         unstacked.get_revision('rev2')
+
+    def test_fetch_revisions_with_file_changes(self):
+        # Fetching revisions including file changes into a stacked branch
+        # works without error.
+        # Make the source tree.
+        src_tree = self.make_branch_and_tree('src')
+        self.build_tree_contents([('src/a', 'content')])
+        src_tree.add('a')
+        src_tree.commit('first commit')
+
+        # Make the stacked-on branch.
+        src_tree.bzrdir.sprout('stacked-on')
+
+        # Make a branch stacked on it.
+        target = self.make_branch('target')
+        try:
+            target.set_stacked_on_url('../stacked-on')
+        except (errors.UnstackableRepositoryFormat,
+                errors.UnstackableBranchFormat):
+            raise TestNotApplicable('Format does not support stacking.')
+
+        # Change the source branch.
+        self.build_tree_contents([('src/a', 'new content')])
+        src_tree.commit('second commit', rev_id='rev2')
+
+        # Fetch changes to the target.
+        target.fetch(src_tree.branch)
+        rtree = target.repository.revision_tree('rev2')
+        rtree.lock_read()
+        self.addCleanup(rtree.unlock)
+        self.assertEqual('new content', rtree.get_file_by_path('a').read())




More information about the bazaar-commits mailing list