[PATCH 2 of 3] rebase: allow rebase even if some revisions need no rebase (BC) (issue5422)

Martin von Zweigbergk martinvonz at google.com
Thu May 11 14:34:48 EDT 2017


On Fri, May 5, 2017 at 11:14 PM, Martin von Zweigbergk
<martinvonz at google.com> wrote:
> On Fri, May 5, 2017 at 7:19 PM, Yuya Nishihara <yuya at tcha.org> wrote:
>> On Thu, 04 May 2017 13:20:11 -0700, Martin von Zweigbergk via Mercurial-devel wrote:
>>> # HG changeset patch
>>> # User Martin von Zweigbergk <martinvonz at google.com>
>>> # Date 1489219466 28800
>>> #      Sat Mar 11 00:04:26 2017 -0800
>>> # Node ID 2765672140ea50f5587be486b25af10509a3d35b
>>> # Parent  5af88edb7a0bbafad999a2cef8968efbfd64becf
>>> rebase: allow rebase even if some revisions need no rebase (BC) (issue5422)
>>>
>>> This allows you to do e.g. "hg rebase -d @ -r 'draft()'" even if some
>>> drafts are already based off of @. You'd still need to exclude
>>> obsolete and troubled revisions, though. We will deal with those cases
>>> later.
>>>
>>> Implemented by treating state[rev]==rev as "no need to rebase". I
>>> considered adding another fake revision number like revdone=-6. That
>>> would make the code clearer in a few places, but would add extra code
>>> in other places.
>>
>> Perhaps updatebookmarks() will need a guard to not flag
>> tr.hookargs['bookmark_moved'] by null move.
>
> Ah, good catch! I will also try to add more tests.

I couldn't actually find any concrete effect of this. The only
difference if we don't consider bookmarks "moves" from X to X is that
deletedivergent() does not get called. I can't see how that would make
a difference in practice either. I'll still change it in v2 because it
makes sense to not include the un-moved nodes in the 'nstates' dict
used for bookmarks.

>
>>
>> I'm not sure if the fake revision is better. Using 'state[rev] = rev' makes
>> sense, but we'll have to check all places where state[rev] are used anyway.
>
> I'm not sure which I prefer either, so I'll just pick the 'state[rev]
> = rev' version for v2, but let me know if you change you mind.


More information about the Mercurial-devel mailing list