[PATCH 2 of 2 fix] rebase: properly handle chain of marker with missing node
Augie Fackler
raf at durin42.com
Thu Oct 15 08:06:32 CDT 2015
On Thu, Oct 15, 2015 at 12:57:36AM +0100, Pierre-Yves David wrote:
> # HG changeset patch
> # User Pierre-Yves David <pierre-yves.david at fb.com>
> # Date 1444865540 -3600
> # Thu Oct 15 00:32:20 2015 +0100
> # Node ID a53d0a524cf14db2ce63b8376020e22dd4f2e636
> # Parent d2dd179568f5aa46ffc597a393f2df663a4893af
> # EXP-Topic reb.skip
> # Available At http://hg.netv6.net/marmoute-wip/mercurial/
> # hg pull http://hg.netv6.net/marmoute-wip/mercurial/ -r a53d0a524cf1
> rebase: properly handle chain of marker with missing node
queued, thanks
>
> As obsolescence markers can contains unknown nodes and 'allsuccessors' returns
> them, we have to protect again that when looking for successors of the rebase
> set in the destination.
>
> Test have been expanded to catch that.
>
> diff --git a/hgext/rebase.py b/hgext/rebase.py
> --- a/hgext/rebase.py
> +++ b/hgext/rebase.py
> @@ -1162,11 +1162,14 @@ def _computeobsoletenotrebased(repo, reb
> for r in rebasesetrevs:
> n = repo[r]
> if n.obsolete():
> node = cl.node(r)
> for s in obsolete.allsuccessors(repo.obsstore, [node]):
> - allsuccessors[cl.rev(s)] = cl.rev(node)
> + try:
> + allsuccessors[cl.rev(s)] = cl.rev(node)
> + except LookupError:
> + pass
>
> if allsuccessors:
> # Look for successors of obsolete nodes to be rebased among
> # the ancestors of dest
> ancs = cl.ancestors([repo[dest].rev()],
> diff --git a/tests/test-rebase-obsolete.t b/tests/test-rebase-obsolete.t
> --- a/tests/test-rebase-obsolete.t
> +++ b/tests/test-rebase-obsolete.t
> @@ -588,5 +588,53 @@ Test hidden changesets in the rebase set
>
> $ hg rebase -s 14 -d 18 --config experimental.rebaseskipobsolete=True
> note: not rebasing 14:9ad579b4a5de "I", already in destination as 17:fc37a630c901 "K"
> rebasing 15:5ae8a643467b "J"
>
> + $ cd ..
> +
> +Skip obsolete changeset even with multiple hope
> +-----------------------------------------------
> +
> +setup
> +
> + $ hg init obsskip
> + $ cd obsskip
> + $ cat << EOF >> .hg/hgrc
> + > [experimental]
> + > rebaseskipobsolete = True
> + > [extensions]
> + > strip =
> + > EOF
> + $ echo A > A
> + $ hg add A
> + $ hg commit -m A
> + $ echo B > B
> + $ hg add B
> + $ hg commit -m B0
> + $ hg commit --amend -m B1
> + $ hg commit --amend -m B2
> + $ hg up --hidden 'desc(B0)'
> + 0 files updated, 0 files merged, 0 files removed, 0 files unresolved
> + $ echo C > C
> + $ hg add C
> + $ hg commit -m C
> +
> +Rebase finds its way in a chain of marker
> +
> + $ hg rebase -d 'desc(B2)'
> + note: not rebasing 1:a8b11f55fb19 "B0", already in destination as 3:261e70097290 "B2"
> + rebasing 4:212cb178bcbb "C" (tip)
> +
> +Even when the chain include missing node
> +
> + $ hg up --hidden 'desc(B0)'
> + 0 files updated, 0 files merged, 1 files removed, 0 files unresolved
> + $ echo D > D
> + $ hg add D
> + $ hg commit -m D
> + $ hg --hidden strip -r 'desc(B1)'
> + saved backup bundle to $TESTTMP/obsskip/.hg/strip-backup/86f6414ccda7-b1c452ee-backup.hg (glob)
> +
> + $ hg rebase -d 'desc(B2)'
> + note: not rebasing 1:a8b11f55fb19 "B0", already in destination as 2:261e70097290 "B2"
> + rebasing 5:1a79b7535141 "D" (tip)
> _______________________________________________
> Mercurial-devel mailing list
> Mercurial-devel at selenic.com
> https://selenic.com/mailman/listinfo/mercurial-devel
More information about the Mercurial-devel
mailing list