[PATCH] rebase: don't rebase obsolete commits with no successor

Pierre-Yves David pierre-yves.david at ens-lyon.org
Wed Nov 18 16:10:21 CST 2015



On 11/18/2015 01:46 PM, Laurent Charignon wrote:
> # HG changeset patch
> # User Laurent Charignon <lcharignon at fb.com>
> # Date 1447883069 28800
> #      Wed Nov 18 13:44:29 2015 -0800
> # Node ID aa8771a01f32c86b4f9df8c45386bfe880a4e9dd
> # Parent  2da6a2dbfc42bdec4bcaf47da947c64ff959a59c
> rebase: don't rebase obsolete commits with no successor

Pushed to the clowncopter, thanks.

> This patch avoids unnecessary conflicts to resolve during rebase for the users
> of changeset evolution.
>
> This patch modifies rebase to skip obsolete commits with no successor.
> It introduces a new rebase state 'revpruned' for these revisions that are
> being skipped and a new message to inform the user of what is happening.
> This feature is gated behind the config flag experimental.rebaseskipobsolete
>
> When an obsolete commit is skipped, the output is:
> note: not rebasing 7:360bbaa7d3ce "O", it has no successor
>
> diff --git a/hgext/rebase.py b/hgext/rebase.py
> --- a/hgext/rebase.py
> +++ b/hgext/rebase.py
> @@ -32,6 +32,7 @@
>   revignored = -3
>   # To do with obsolescence
>   revprecursor = -4
> +revpruned = -5
>
>   cmdtable = {}
>   command = cmdutil.command(cmdtable)
> @@ -487,6 +488,9 @@
>                                targetctx.description().split('\n', 1)[0])
>                   msg = _('note: not rebasing %s, already in destination as %s\n')
>                   ui.status(msg % (desc, desctarget))
> +            elif state[rev] == revpruned:
> +                msg = _('note: not rebasing %s, it has no successor\n')
> +                ui.status(msg % desc)
>               else:
>                   ui.status(_('already rebased %s as %s\n') %
>                             (desc, repo[state[rev]]))
> @@ -676,7 +680,7 @@
>       elif p1n in state:
>           if state[p1n] == nullmerge:
>               p1 = target
> -        elif state[p1n] in (revignored, revprecursor):
> +        elif state[p1n] in (revignored, revprecursor, revpruned):

Given how often this appears, It seems like we need some kind of generic 
constant defined once at the top of the file. Can you follow up with 
such cleanup?

-- 
Pierre-Yves David


More information about the Mercurial-devel mailing list