[PATCH STABLE] rebase: fix rebase aborts when tip^ is public (issue4082)
Martin Geisler
martin at geisler.net
Tue Nov 5 06:40:02 UTC 2013
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.
--
Martin Geisler
Python expert for hire: http://careers.stackoverflow.com/mg
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 835 bytes
Desc: not available
URL: <http://lists.mercurial-scm.org/pipermail/mercurial-devel/attachments/20131105/cd5f8c9a/attachment.asc>
More information about the Mercurial-devel
mailing list