Patchwork rebase: don't rebase obsolete commits with no successor

login
register
mail settings
Submitter Laurent Charignon
Date Nov. 18, 2015, 10:36 p.m.
Message ID <59149636-D9D4-4991-8DEB-246AC61B5751@fb.com>
Download mbox | patch
Permalink /patch/11493/
State Superseded
Commit 5eac7ab59b95e5c2dc8dd6a268a51c49540fcbeb
Delegated to: Pierre-Yves David
Headers show

Comments

Laurent Charignon - Nov. 18, 2015, 10:36 p.m.
On Nov 18, 2015, at 2:10 PM, Pierre-Yves David <pierre-yves.david@ens-lyon.org<mailto:pierre-yves.david@ens-lyon.org>> wrote:



On 11/18/2015 01:46 PM, Laurent Charignon wrote:
# HG changeset patch
# User Laurent Charignon <lcharignon@fb.com<mailto:lcharignon@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

Sure.

Thanks,

Laurent

--
Pierre-Yves David

Patch

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?