Rev 1663: Fix progress bar, cope with odd revision numbers. in http://people.samba.org/bzr/jelmer/bzr-svn/trunk

Jelmer Vernooij jelmer at samba.org
Tue Aug 26 05:04:25 BST 2008


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

------------------------------------------------------------
revno: 1663
revision-id: jelmer at samba.org-20080826040423-yo4zpfzodinmpkta
parent: jelmer at samba.org-20080826040217-mm29rx1pikjg4bav
committer: Jelmer Vernooij <jelmer at samba.org>
branch nick: 0.4
timestamp: Tue 2008-08-26 06:04:23 +0200
message:
  Fix progress bar, cope with odd revision numbers.
modified:
  repository.py                  repository.py-20060306123302-1f8c5069b3fe0265
=== modified file 'repository.py'
--- a/repository.py	2008-08-26 03:32:23 +0000
+++ b/repository.py	2008-08-26 04:04:23 +0000
@@ -827,34 +827,41 @@
         return branches
 
     @needs_read_lock
-    def find_tags_between(self, project, layout, mapping, from_revnum, to_revnum, tags={}):
-        for (paths, revnum, revprops) in self._log.iter_changes(None, from_revnum, to_revnum):
-            for p in sorted(paths):
-                (action, cf, cr) = paths[p]
-                if layout.is_tag_parent(p, project) and cf is not None:
-                    pass # FIXME
-                else:
-                    try:
-                        (pt, proj, bp, rp) = layout.parse(p)
-                    except errors.InvalidSvnBranchPath:
-                        continue
-                    if pt != "tag" or (project is not None and proj != project):
-                        continue
-                    if action == "D" and rp == "":
-                        tags[p] = None
-                    elif rp == "" and cf is not None:
-                        # This tag was (recreated) here, so unless anything else under this 
-                        # tag changed
-                        tp = p
-                        tr = revnum
-                        newpaths = copy(paths)
-                        del newpaths[p]
-                        if not changes.changes_path(newpaths, p, False):
-                            tp = cf
-                            tr = cr
-                        tags[p] = self.generate_revision_id(tr, tp, mapping)
+    def find_tags_between(self, project, layout, mapping, from_revnum, to_revnum, tags=None):
+        if tags is None:
+            tags = {}
+        assert from_revnum <= to_revnum
+        pb = ui.ui_factory.nested_progress_bar()
+        try:
+            for (paths, revnum, revprops) in self._log.iter_changes(None, from_revnum, to_revnum, pb=pb):
+                for p in sorted(paths):
+                    (action, cf, cr) = paths[p]
+                    if layout.is_tag_parent(p, project) and cf is not None:
+                        pass # FIXME
                     else:
-                        tags[bp] = self.generate_revision_id(revnum, bp, mapping, revprops=revprops)
+                        try:
+                            (pt, proj, bp, rp) = layout.parse(p)
+                        except errors.InvalidSvnBranchPath:
+                            continue
+                        if pt != "tag" or (project is not None and proj != project):
+                            continue
+                        if action == "D" and rp == "":
+                            tags[p] = None
+                        elif rp == "" and cf is not None:
+                            # This tag was (recreated) here, so unless anything else under this 
+                            # tag changed
+                            tp = p
+                            tr = revnum
+                            newpaths = copy(paths)
+                            del newpaths[p]
+                            if not changes.changes_path(newpaths, p, False) and layout.is_branch(cf):
+                                tp = cf
+                                tr = int(self.transport.get_dir(cf, cr)[2][properties.PROP_ENTRY_COMMITTED_REV])
+                            tags[p] = self.generate_revision_id(tr, tp, mapping)
+                        else:
+                            tags[bp] = self.generate_revision_id(revnum, bp, mapping, revprops=revprops)
+        finally:
+            pb.finished()
 
         return dict([(layout.get_tag_name(p, project), revid) for (p, revid) in tags.items() if revid is not None])
 




More information about the bazaar-commits mailing list