Rev 1553: Add test for bug 250480. in http://people.samba.org/bzr/jelmer/bzr-svn/trunk

Jelmer Vernooij jelmer at samba.org
Tue Aug 5 04:16:30 BST 2008


At http://people.samba.org/bzr/jelmer/bzr-svn/trunk

------------------------------------------------------------
revno: 1553
revision-id: jelmer at samba.org-20080805031629-hg6jpr7vzvbyxu7q
parent: jelmer at samba.org-20080805003901-rsefqwyhuoorn66x
committer: Jelmer Vernooij <jelmer at samba.org>
branch nick: 0.4
timestamp: Tue 2008-08-05 05:16:29 +0200
message:
  Add test for bug 250480.
modified:
  tests/test_push.py             test_push.py-20070201165715-g2ievcdfqi33wqsy-1
=== modified file 'tests/test_push.py'
--- a/tests/test_push.py	2008-08-04 16:23:24 +0000
+++ b/tests/test_push.py	2008-08-05 03:16:29 +0000
@@ -578,6 +578,51 @@
         self.assertTrue(os.path.exists("bzrco/baz.txt"))
         wt.branch.push(Branch.open(repos_url+"/trunk"))
 
+    def test_push_merge_unchanged_file(self):
+        repos_url = self.make_repository("test")
+
+        dc = self.get_commit_editor(repos_url)
+        trunk = dc.add_dir("trunk")
+        trunk.add_file("trunk/foo.txt").modify("add file")
+        dc.close()
+
+        os.mkdir('bzrco1')
+        dir1 = BzrDir.open(repos_url+"/trunk").sprout("bzrco1")
+
+        os.mkdir('bzrco2')
+        dir2 = BzrDir.open(repos_url+"/trunk").sprout("bzrco2")
+
+        wt1 = dir1.open_workingtree()
+        self.build_tree({'bzrco1/bar.txt': 'bar'})
+        wt1.add("bar.txt")
+        base_revid = wt1.commit("add another file", rev_id="mybase")
+        wt1.branch.push(Branch.open(repos_url+"/trunk"))
+
+        wt2 = dir2.open_workingtree()
+        self.build_tree({'bzrco2/bar2.txt': 'bar'})
+        wt2.add("bar2.txt")
+        other_revid = wt2.commit("add yet another file", rev_id="side1")
+
+        wt1.lock_write()
+        try:
+            wt1.branch.repository.fetch(wt2.branch.repository)
+            merge = Merger.from_revision_ids(DummyProgress(), wt1, other=other_revid)
+            merge.merge_type = Merge3Merger
+            merge.do_merge()
+            merge.set_pending()
+            self.assertEquals([wt1.last_revision(), other_revid], wt1.get_parent_ids())
+            mergingrevid = wt1.commit("merge", rev_id="side2")
+        finally:
+            wt1.unlock()
+        self.assertTrue(os.path.exists("bzrco1/bar2.txt"))
+        wt1.branch.push(Branch.open(repos_url+"/trunk"))
+        r = Repository.open(repos_url)
+        t = r.revision_tree(mergingrevid)
+        props = r.branchprop_list.get_changed_properties("trunk", 3)
+        self.assertEquals(props['bzr:text-parents'], 'bar2.txt\tside1\n')
+        self.assertEquals(base_revid, t.inventory[t.path2id("bar.txt")].revision)
+        self.assertEquals(other_revid, t.inventory[t.path2id("bar2.txt")].revision)
+
     def test_missing_prefix_error(self):
         repos_url = self.make_repository("a")
         bzrwt = BzrDir.create_standalone_workingtree("c", 




More information about the bazaar-commits mailing list