Rev 1557: Support proper text revids during fetch. in http://people.samba.org/bzr/jelmer/bzr-svn/trunk

Jelmer Vernooij jelmer at samba.org
Wed Aug 6 03:51:50 BST 2008


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

------------------------------------------------------------
revno: 1557
revision-id: jelmer at samba.org-20080806025147-0m02ta5f1omi36fh
parent: jelmer at samba.org-20080806015822-d1bdcgeytqfyw1ff
committer: Jelmer Vernooij <jelmer at samba.org>
branch nick: 0.4
timestamp: Wed 2008-08-06 04:51:47 +0200
message:
  Support proper text revids during fetch.
modified:
  fetch.py                       fetch.py-20060625004942-x2lfaib8ra707a8p-1
  tests/test_push.py             test_push.py-20070201165715-g2ievcdfqi33wqsy-1
=== modified file 'fetch.py'
--- a/fetch.py	2008-08-02 21:19:27 +0000
+++ b/fetch.py	2008-08-06 02:51:47 +0000
@@ -30,12 +30,7 @@
 from bzrlib.plugins.svn.delta import apply_txdelta_handler
 from bzrlib.plugins.svn.errors import InvalidFileName
 from bzrlib.plugins.svn.logwalker import lazy_dict
-from bzrlib.plugins.svn.mapping import (SVN_PROP_BZR_MERGE, 
-                     SVN_PROP_BZR_PREFIX, SVN_PROP_BZR_REVISION_INFO, 
-                     SVN_PROP_BZR_REVISION_ID,
-                     SVN_PROP_BZR_FILEIDS, SVN_REVPROP_BZR_SIGNATURE,
-                     parse_merge_property,
-                     parse_revision_metadata)
+from bzrlib.plugins.svn.mapping import (SVN_PROP_BZR_PREFIX, SVN_REVPROP_BZR_SIGNATURE)
 from bzrlib.plugins.svn.properties import parse_externals_description
 from bzrlib.plugins.svn.repository import SvnRepository, SvnRepositoryFormat
 from bzrlib.plugins.svn.svk import SVN_PROP_SVK_MERGE
@@ -424,6 +419,9 @@
     def _finish_commit(self):
         (rev, signature) = self._get_revision(self.revid)
         self.inventory.revision_id = self.revid
+        for path, textrevid in self.mapping.import_text_parents(self.revmeta.revprops, 
+                                                                self.revmeta.fileprops).items():
+            self.inventory[self.inventory.path2id(path)].revision = textrevid
         # Escaping the commit message is really the task of the serialiser
         rev.message = _escape_commit_message(rev.message)
         rev.inventory_sha1 = None

=== modified file 'tests/test_push.py'
--- a/tests/test_push.py	2008-08-05 03:16:29 +0000
+++ b/tests/test_push.py	2008-08-06 02:51:47 +0000
@@ -579,6 +579,9 @@
         wt.branch.push(Branch.open(repos_url+"/trunk"))
 
     def test_push_merge_unchanged_file(self):
+        def check_tree(t):
+            self.assertEquals(base_revid, t.inventory[t.path2id("bar.txt")].revision)
+            self.assertEquals(other_revid, t.inventory[t.path2id("bar2.txt")].revision)
         repos_url = self.make_repository("test")
 
         dc = self.get_commit_editor(repos_url)
@@ -612,16 +615,23 @@
             merge.set_pending()
             self.assertEquals([wt1.last_revision(), other_revid], wt1.get_parent_ids())
             mergingrevid = wt1.commit("merge", rev_id="side2")
+            check_tree(wt1.branch.repository.revision_tree(mergingrevid))
         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)
+
+        os.mkdir("cpy")
+        cpy = BzrDir.create("cpy", format.get_rich_root_format())
+        cpyrepos = cpy.create_repository()
+        r.copy_content_into(cpyrepos)
+        check_tree(cpyrepos.revision_tree(mergingrevid))
+
+        t = r.revision_tree(mergingrevid)
+        check_tree(t)
 
     def test_missing_prefix_error(self):
         repos_url = self.make_repository("a")




More information about the bazaar-commits mailing list