[PATCH STABLE] rebase: fix rebase aborts when tip^ is public (issue4082)
Pierre-Yves David
pierre-yves.david at ens-lyon.org
Tue Nov 5 16:27:16 UTC 2013
On 5 nov. 2013, at 07:40, Martin Geisler wrote:
> Durham Goode <durham at fb.com> writes:
>
>> # HG changeset patch
>> # User Durham Goode <durham at fb.com>
>> # Date 1383623940 28800
>> # Mon Nov 04 19:59:00 2013 -0800
>> # Branch stable
>> # Node ID f3a3d9b9243ccdc3fdcf07f76547098863ae83c3
>> # Parent 7c4cf8367673e3100cda62927b096cdd9497a409
>> rebase: fix rebase aborts when tip^ is public (issue4082)
>>
>> When aborting a rebase where tip^ is public, rebase would fail to undo
>> the merge state. This caused unexpected dirstate parents and also
>> caused unshelve to become unabortable (since it uses rebase under the
>> hood).
>>
>> The problem was that rebase uses -2 as a marker rev, and when it
>> checked for immutableness during the abort, -2 got resolved to the
>> second to last entry in the phase cache.
>>
>> Adds a test for the fix. Add exception to phase code to prevent this
>> in the future.
>>
>> diff --git a/hgext/rebase.py b/hgext/rebase.py
>> --- a/hgext/rebase.py
>> +++ b/hgext/rebase.py
>> @@ -692,7 +692,7 @@
>>
>> def abort(repo, originalwd, target, state):
>> 'Restore the repository to its original state'
>> - dstates = [s for s in state.values() if s != nullrev]
>> + dstates = [s for s in state.values() if s != nullrev and s != nullmerge]
>> immutable = [d for d in dstates if not repo[d].mutable()]
>> cleanup = True
>> if immutable:
>> diff --git a/mercurial/phases.py b/mercurial/phases.py
>> --- a/mercurial/phases.py
>> +++ b/mercurial/phases.py
>> @@ -185,6 +185,8 @@
>> # be replaced without us being notified.
>> if rev == nullrev:
>> return public
>> + if rev < nullrev:
>> + raise error.RepoLookupError(_('cannot lookup negative revision'))
>
> Will some earlier part of the code turn -2 into a positive revision
> number before we hit this? I would like 'hg phase -r -2' to keep
> working.
This function already check for -1 so it takes strict revision number only.
--
Pierre-Yves David
More information about the Mercurial-devel
mailing list