Maybe bug, pull reports -1 revisions pulled.

Robey Pointer robey at lag.net
Thu Mar 16 02:40:41 GMT 2006


On 14 Mar 2006, at 4:32, Michael Ellerman wrote:

> On 3/14/06, Martin Pool <mbp at sourcefrog.net> wrote:
>> Robey Pointer wrote:
>>>> 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.
>>>
>>> I'd prefer to see something like
>>>
>>>     Pulled 14 revision(s); now at revno 2439.
>
> How about:

A belated +1 from me!

robey



> === modified file 'a/bzrlib/branch.py'
> --- a/bzrlib/branch.py
> +++ b/bzrlib/branch.py
> @@ -1012,11 +1012,12 @@
>          ### Should this be checking is_ancestor instead of  
> revision_history?
>          if (stop_revision is not None and
>              stop_revision in self.revision_history()):
> -            return
> +            return 0
>          self.fetch(other, stop_revision)
>          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)
> @@ -1052,20 +1053,19 @@
>      @needs_write_lock
>      def pull(self, source, overwrite=False, stop_revision=None):
>          """See Branch.pull."""
> +        count = 0
>          source.lock_read()
>          try:
> -            old_count = len(self.revision_history())
>              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
>          finally:
>              source.unlock()
> +        return count
>
>      def get_parent(self):
>          """See Branch.get_parent."""
>
> === modified file 'a/bzrlib/builtins.py'
> --- a/bzrlib/builtins.py
> +++ b/bzrlib/builtins.py
> @@ -427,7 +427,8 @@
>
>          if br_to.get_parent() is None or remember:
>              br_to.set_parent(location)
> -        note('%d revision(s) pulled.' % (count,))
> +
> +        note('Pulled %s revision(s), now at revno %s.' % (count,
> br_to.revno()))
>
>          if verbose:
>              new_rh = tree_to.branch.revision_history()





More information about the bazaar mailing list