Rev 330: Add specialized version of follow_branch_history() that returns in http://people.samba.org/bzr/jelmer/bzr-svn/bzr.dev

Jelmer Vernooij jelmer at samba.org
Fri Dec 29 20:17:04 GMT 2006


------------------------------------------------------------
revno: 330
revision-id: jelmer at samba.org-20061229201444-jmgaaquygfp4ty6n
parent: jelmer at samba.org-20061229192154-oql5chqxnki9xvs1
committer: Jelmer Vernooij <jelmer at samba.org>
branch nick: main
timestamp: Fri 2006-12-29 21:14:44 +0100
message:
  Add specialized version of follow_branch_history() that returns 
  less data (will allow more efficient implementation later).
modified:
  branch.py                      svnbranch.py-20051017135706-11c749eb0dab04a7
  fetch.py                       fetch.py-20060625004942-x2lfaib8ra707a8p-1
  repository.py                  repository.py-20060306123302-1f8c5069b3fe0265
=== modified file 'branch.py'
--- a/branch.py	2006-12-26 22:25:29 +0000
+++ b/branch.py	2006-12-29 20:14:44 +0000
@@ -112,7 +112,7 @@
        
     def _generate_revision_history(self, last_revnum):
         self._revision_history = []
-        for (branch, _, rev) in self.repository.follow_branch_history(
+        for (branch, rev) in self.repository.follow_branch(
                 self.branch_path, last_revnum):
             self._revision_history.append(
                     self.repository.generate_revision_id(rev, branch))

=== modified file 'fetch.py'
--- a/fetch.py	2006-12-29 18:46:47 +0000
+++ b/fetch.py	2006-12-29 20:14:44 +0000
@@ -317,7 +317,7 @@
             prev_revid = revid
 
             if not self.target.has_revision(revid):
-                needed.append((branch, revnum, revid, changes))
+                needed.append((branch, revnum, revid))
 
         parents[prev_revid] = None
 
@@ -325,7 +325,7 @@
         needed.reverse()
         prev_revid = None
         transport = self.source.transport
-        for (branch, revnum, revid, changes) in needed:
+        for (branch, revnum, revid) in needed:
             if pb is not None:
                 pb.update('copying revision', num+1, len(needed)+1)
             num += 1
@@ -345,6 +345,7 @@
             else:
                 parent_inv = prev_inv
 
+            changes = self.source._log.get_revision_paths(revnum, branch)
             id_map = self.source.transform_fileid_map(self.source.uuid, 
                                         revnum, branch, changes)
 

=== modified file 'repository.py'
--- a/repository.py	2006-12-29 18:46:47 +0000
+++ b/repository.py	2006-12-29 20:14:44 +0000
@@ -257,7 +257,6 @@
 
     def transform_fileid_map(self, uuid, revnum, branch, changes):
         return self.fileid_map.apply_changes(uuid, revnum, branch, changes)
-                #find_children=self._log.find_children)
 
     def path_to_file_id(self, revnum, path):
         """Generate a bzr file id from a Subversion file name. 
@@ -305,7 +304,7 @@
                                     SVN_PROP_BZR_MERGE, "").splitlines():
             ancestry.extend(l.split("\n"))
 
-        for (branch, _, rev) in self.follow_branch_history(path, revnum - 1):
+        for (branch, rev) in self.follow_branch(path, revnum - 1):
             ancestry.append(self.generate_revision_id(rev, branch))
 
         ancestry.append(None)
@@ -350,7 +349,7 @@
 
         parent_path = None
         parent_ids = []
-        for (branch, _, rev) in self.follow_branch_history(path, revnum):
+        for (branch, rev) in self.follow_branch(path, revnum):
             if rev < revnum:
                 parent_revnum = rev
                 parent_path = branch
@@ -515,6 +514,14 @@
 
             revnum-=1
 
+    def follow_branch(self, branch_path, revnum):
+        assert branch_path is not None
+        assert isinstance(revnum, int) and revnum >= 0
+        if not self.scheme.is_branch(branch_path):
+            raise errors.NotSvnBranchPath(branch_path, revnum)
+        for (revnum, _, bp) in self.follow_branch_history(branch_path, revnum):
+            yield (revnum, bp)
+
     def follow_branch_history(self, branch_path, revnum):
         assert branch_path is not None
         if not self.scheme.is_branch(branch_path):
@@ -556,7 +563,7 @@
         self._previous = revision_id
         self._ancestry = {}
         
-        for (branch, _, rev) in self.follow_branch_history(path, revnum - 1):
+        for (branch, rev) in self.follow_branch(path, revnum - 1):
             revid = self.generate_revision_id(rev, branch)
             self._ancestry[self._previous] = [revid]
             self._previous = revid




More information about the bazaar-commits mailing list