[PATCH 1 of 2] rebase: add returning value from pullrebase function

Yuya Nishihara yuya at tcha.org
Mon Nov 16 06:08:02 CST 2015


On Sun, 15 Nov 2015 23:05:58 +0100, liscju wrote:
> # HG changeset patch
> # User liscju <piotr.listkiewicz at gmail.com>
> # Date 1447622328 -3600
> #      Sun Nov 15 22:18:48 2015 +0100
> # Node ID 893a8b3e5a71e33fd003982dbb3b549fc4b04ef1
> # Parent  2da6a2dbfc42bdec4bcaf47da947c64ff959a59c
> rebase: add returning value from pullrebase function
> 
> So far pullrebase function has always returned None value,no matter
> what orig function returned. This behaviour made impossible for
> pull to change returned value from mercurial process(it has always
> ended with 0 value by default). This patch makes pullrebase returning
> with returned value from orig.
> 
> diff -r 2da6a2dbfc42 -r 893a8b3e5a71 hgext/rebase.py
> --- a/hgext/rebase.py	Mon Nov 09 17:20:50 2015 -0500
> +++ b/hgext/rebase.py	Sun Nov 15 22:18:48 2015 +0100
> @@ -1104,6 +1104,7 @@
>  
>  def pullrebase(orig, ui, repo, *args, **opts):
>      'Call rebase after pull if the latter has been invoked with --rebase'
> +    ret = None
>      if opts.get('rebase'):
>          wlock = lock = None
>          try:
> @@ -1121,7 +1122,7 @@
>                  pass
>              commands.postincoming = _dummy
>              try:
> -                orig(ui, repo, *args, **opts)
> +                ret = orig(ui, repo, *args, **opts)
>              finally:
>                  commands.postincoming = origpostincoming
>              revspostpull = len(repo)
> @@ -1148,7 +1149,9 @@
>      else:
>          if opts.get('tool'):
>              raise error.Abort(_('--tool can only be used with --rebase'))
> -        orig(ui, repo, *args, **opts)
> +        ret = orig(ui, repo, *args, **opts)
> +
> +    return ret

This patch itself seems worth for stable. Without this patch, the return code
of "hg pull" can be wrong if the rebase extension is enabled.

I'll push this to the clowncopter, thanks.


More information about the Mercurial-devel mailing list