Support custom revision ids. True push is now just an hour or two away.............
authorJelmer Vernooij <jelmer@samba.org>
Fri, 18 May 2007 02:01:15 +0000 (03:01 +0100)
committerJelmer Vernooij <jelmer@samba.org>
Fri, 18 May 2007 02:01:15 +0000 (03:01 +0100)
.bzrignore
BRANCH.TODO
repository.py
tests/test_branch.py

index ac744b56e3c2bea96046f6a4732c85020a936f33..31e431aa2e7f02617833de7140c334e033230464 100644 (file)
@@ -2,3 +2,4 @@ build
 *.pyc
 test????.tmp
 tags
+apidocs
index cba908ca7dd225864eedffeca8a4405a5065c34c..cbeda6b093e26c1bde420c031ef2135213c006e2 100644 (file)
@@ -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
index ab9dede960152ca4abb4a91fb6196a477ae74d08..d7434980f7601cd7583f4fa9c6cbe9483421686e 100644 (file)
@@ -412,7 +412,8 @@ class SvnRepository(Repository):
 
         # 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 @@ class SvnRepository(Repository):
         # 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")
 
index 8b641dcc69785c000bbd22ac338ca4f2bcb81f26..c7e7aff86d5dbbbd7536ac87ed6dc118efde665f 100644 (file)
@@ -28,7 +28,7 @@ from unittest import TestCase
 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 @@ class WorkingSubversionBranch(TestCaseWithSubversionRepository):
 
         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 @@ class WorkingSubversionBranch(TestCaseWithSubversionRepository):
 
         self.assertEqual([
             repos.generate_revision_id(0, ""),
-            repos.generate_revision_id(1, ""),
+            "mycommit",
             repos.generate_revision_id(2, "")],
             branch.revision_history())