[PATCH stable] rebase: add return codes

Martin Geisler mg at aragost.com
Thu May 20 08:41:28 CDT 2010


Dirk Hasselbalch <dirk.hasselbalch at edlund.dk> writes:

> # HG changeset patch
> # User Dirk Hasselbalch <dirk.hasselbalch at edlund.dk>
> # Date 1274347380 -7200
> # Branch stable
> # Node ID 71ba9e6d27b0a1956297036dffc154b0bb3f2818
> # Parent  46bb491344988abb22a93d7570852d532d7df74f
> rebase: add return codes

Nice, but could you please also update the help text to document this?

> diff -r 46bb49134498 -r 71ba9e6d27b0 hgext/rebase.py
> --- a/hgext/rebase.py	Wed May 19 22:09:58 2010 +0200
> +++ b/hgext/rebase.py	Thu May 20 11:23:00 2010 +0200
> @@ -113,7 +113,7 @@
>                                  keepbranchesf, external) = restorestatus(repo)
>              if abortf:
>                  abort(repo, originalwd, target, state)
> -                return
> +                return 0

I think it would be better to let abort return the exit code (I saw that
the abort function can warn about not stripping changesets and that may
warrent a non-zero exit code).

>          else:
>              if srcf and basef:
>                  raise error.ParseError('rebase', _('cannot specify both a '
> @@ -131,7 +131,7 @@
>              if not result:
>                  # Empty state built, nothing to rebase
>                  ui.status(_('nothing to rebase\n'))
> -                return
> +                return 1

If there is nothing to do, then I think that should count as a succesful
rebase.

>              else:
>                  originalwd, target, state = result
>                  if collapsef:
> @@ -213,6 +213,8 @@
>              util.unlink(repo.sjoin('undo'))
>          if skipped:
>              ui.note(_("%d revisions have been skipped\n") % len(skipped))
> +
> +        return 0
>      finally:
>          release(lock, wlock)


-- 
Martin Geisler

aragost Trifork
Professional Mercurial support
http://aragost.com/mercurial/


More information about the Mercurial-devel mailing list