Rev 438: Support custom revision ids. True push is now just an hour or two away................. in file:///home/jelmer/bzr-svn/customrevids/

Jelmer Vernooij jelmer at samba.org
Fri May 18 03:01:16 BST 2007


At file:///home/jelmer/bzr-svn/customrevids/

------------------------------------------------------------
revno: 438
revision-id: jelmer at samba.org-20070518020115-f6opp2673mhvc9sg
parent: jelmer at samba.org-20070518014626-kjicpl6y6qi5kad0
committer: Jelmer Vernooij <jelmer at samba.org>
branch nick: customrevids
timestamp: Fri 2007-05-18 03:01:15 +0100
message:
  Support custom revision ids. True push is now just an hour or two away.................
modified:
  .bzrignore                     bzrignore-20060516185138-862ea098064007af
  BRANCH.TODO                    branch.todo-20070516183134-f9xjfbsv6x6u6x2t-1
  repository.py                  repository.py-20060306123302-1f8c5069b3fe0265
  tests/test_branch.py           test_branch.py-20060508162215-74ffeb5d608f8e20
=== modified file '.bzrignore'
--- a/.bzrignore	2007-01-06 23:23:57 +0000
+++ b/.bzrignore	2007-05-18 02:01:15 +0000
@@ -2,3 +2,4 @@
 *.pyc
 test????.tmp
 tags
+apidocs

=== modified file 'BRANCH.TODO'
--- a/BRANCH.TODO	2007-05-16 23:01:20 +0000
+++ b/BRANCH.TODO	2007-05-18 02:01:15 +0000
@@ -1,14 +1,3 @@
-- keep revision id cache:
-(revid, path, revnum, scheme)
-
-- Repository.generate_revision_id() should return
-- Branch.generate_revision_id()
-- Repository.parse_revision_id() looks up custom revision ids
-- Branch.parse_revision_id() looks up custom revision ids
- - Try to parse revision id. If:
-  - UUID matches
-  - path,revnum combination is in the branches' history
-    return path,revnum combination
- - Check the bzr:revision-id-vX property in the 
-   the latest revision in which this branch existed. If it 
-   contains the revision, return it
+- keep revision ids when doing true pushes
+- add tests to make sure a revision is still 100% the same after being pushed 
+  to subversion

=== modified file 'repository.py'
--- a/repository.py	2007-05-18 01:46:26 +0000
+++ b/repository.py	2007-05-18 02:01:15 +0000
@@ -412,7 +412,8 @@
 
         # Check the record out of the revmap, if it exists
         try:
-            (branch_path, min_revnum, max_revnum, scheme) = self.revmap.lookup_revid(revid)
+            (branch_path, min_revnum, max_revnum, \
+                    scheme) = self.revmap.lookup_revid(revid)
             assert isinstance(branch_path, str)
             # Entry already complete?
             if min_revnum == max_revnum:
@@ -439,11 +440,10 @@
         # Find the branch property between min_revnum and max_revnum that 
         # added revid
         i = min_revnum
-        while i <= max_revnum:
-            if self.branchprop_list.get_property_diff(branch_path, i, SVN_PROP_BZR_REVISION_ID).strip("\n") == revid:
-                self.revmap.insert_revid(revid, branch_path, i, i, "undefined")
-                return (branch_path, i)
-            i+=1
+        for (bp, rev) in self.follow_branch(branch_path, max_revnum):
+            if self.branchprop_list.get_property_diff(bp, rev, SVN_PROP_BZR_REVISION_ID).strip("\n") == revid:
+                self.revmap.insert_revid(revid, bp, rev, rev, "undefined")
+                return (bp, rev)
 
         raise AssertionError("Revision id was added incorrectly")
 

=== modified file 'tests/test_branch.py'
--- a/tests/test_branch.py	2007-05-17 19:04:30 +0000
+++ b/tests/test_branch.py	2007-05-18 02:01:15 +0000
@@ -28,7 +28,7 @@
 from branch import FakeControlFiles, SvnBranchFormat
 from convert import load_dumpfile
 from fileids import generate_svn_file_id
-from repository import MAPPING_VERSION, generate_svn_revision_id
+from repository import MAPPING_VERSION, generate_svn_revision_id, SVN_PROP_BZR_REVISION_ID
 from tests import TestCaseWithSubversionRepository
 
 class WorkingSubversionBranch(TestCaseWithSubversionRepository):
@@ -143,6 +143,7 @@
 
         self.build_tree({'dc/foo': "data"})
         self.client_add("dc/foo")
+        self.client_set_prop("dc", SVN_PROP_BZR_REVISION_ID, "mycommit\n")
         self.client_commit("dc", "My Message")
         
         branch = Branch.open("svn+"+repos_url)
@@ -160,7 +161,7 @@
 
         self.assertEqual([
             repos.generate_revision_id(0, ""),
-            repos.generate_revision_id(1, ""),
+            "mycommit",
             repos.generate_revision_id(2, "")],
             branch.revision_history())
 




More information about the bazaar-commits mailing list