Maybe bug, pull reports -1 revisions pulled.

Michael Ellerman michael at ellerman.id.au
Mon Mar 13 07:54:11 GMT 2006


On 3/13/06, Aaron Bentley <aaron.bentley at utoronto.ca> wrote:
> Jan Hudec wrote:
> | Yes. If you pull from some branch and than pull --overwrite from another
> | branch that has less changesets, than it reports (correctly, though I
> | agree it looks confusing) negative number of revisions pulled.
>
> So there are at least three numbers here:
> 1. the revno offset; this is what's currently being reported.
> 2. the number of revisions pulled (0 or greater)
> 3. the number of mainline revisions pulled (0 or greater).
>
> We're reporting 1 and claiming it's 3.  I would prefer to report and
> claim 2, but we can do 3 instead, if people prefer.

Hmm, I just tried 2 and although it's correct, it's a little
disconcerting for the 0 case because it gives the impression that
nothing happened. I think we need to report 2, but along with a more
descriptive message for --overwrite.

=== modified file 'a/bzrlib/branch.py'
--- a/bzrlib/branch.py
+++ b/bzrlib/branch.py
@@ -1023,6 +1023,7 @@
         pullable_revs = self.pullable_revisions(other, stop_revision)
         if len(pullable_revs) > 0:
             self.append_revision(*pullable_revs)
+        return len(pullable_revs)

     def pullable_revisions(self, other, stop_revision):
         other_revno = other.revision_id_to_revno(stop_revision)
@@ -1060,16 +1061,15 @@
         """See Branch.pull."""
         source.lock_read()
         try:
-            old_count = len(self.revision_history())
+            count = 0
             try:
-                self.update_revisions(source,stop_revision)
+                count = self.update_revisions(source,stop_revision)
             except DivergedBranches:
                 if not overwrite:
                     raise
             if overwrite:
                 self.set_revision_history(source.revision_history())
-            new_count = len(self.revision_history())
-            return new_count - old_count
+            return count
         finally:
             source.unlock()




More information about the bazaar mailing list