Mercurial > hg
changeset 40656:3bc2e550f2bd stable
graft: do not try to skip rev derived from ancestor more than once (issue6024)
We check 'x in revs' in other cases, so let's do the same.
The test case credits to Tom Prince.
author | Yuya Nishihara <yuya@tcha.org> |
---|---|
date | Thu, 15 Nov 2018 22:59:38 +0900 |
parents | 69d4c8c5c25e |
children | bd0874977a5e |
files | mercurial/commands.py tests/test-graft.t |
diffstat | 2 files changed, 51 insertions(+), 4 deletions(-) [+] |
line wrap: on
line diff
--- a/mercurial/commands.py Fri Nov 16 18:37:26 2018 -0500 +++ b/mercurial/commands.py Thu Nov 15 22:59:38 2018 +0900 @@ -2478,10 +2478,11 @@ revs.remove(ids[n]) elif ctx.hex() in ids: r = ids[ctx.hex()] - ui.warn(_('skipping already grafted revision %d:%s ' - '(was grafted from %d:%s)\n') % - (r, repo[r], rev, ctx)) - revs.remove(r) + if r in revs: + ui.warn(_('skipping already grafted revision %d:%s ' + '(was grafted from %d:%s)\n') % + (r, repo[r], rev, ctx)) + revs.remove(r) if not revs: return -1
--- a/tests/test-graft.t Fri Nov 16 18:37:26 2018 -0500 +++ b/tests/test-graft.t Thu Nov 15 22:59:38 2018 +0900 @@ -1390,6 +1390,52 @@ $ cd .. +Grafted revision should be warned and skipped only once. (issue6024) + + $ mkdir issue6024 + $ cd issue6024 + + $ hg init base + $ cd base + $ touch x + $ hg commit -qAminit + $ echo a > x + $ hg commit -mchange + $ hg update -q 0 + $ hg graft -r 1 + grafting 1:a0b923c546aa "change" (tip) + $ cd .. + + $ hg clone -qr 2 base clone + $ cd clone + $ hg pull -q + $ hg merge -q 2 + $ hg commit -mmerge + $ hg update -q 0 + $ hg graft -r 1 + grafting 1:04fc6d444368 "change" + $ hg update -q 3 + $ hg log -G -T '{rev}:{node|shortest} <- {extras.source|shortest}\n' + o 4:4e16 <- a0b9 + | + | @ 3:f0ac <- + | |\ + +---o 2:a0b9 <- + | | + | o 1:04fc <- a0b9 + |/ + o 0:7848 <- + + + the source of rev 4 is an ancestor of the working parent, and was also + grafted as rev 1. it should be stripped from the target revisions only once. + + $ hg graft -r 4 + skipping already grafted revision 4:4e16bab40c9c (1:04fc6d444368 also has origin 2:a0b923c546aa) + [255] + + $ cd ../.. + Testing the reading of old format graftstate file with newer mercurial $ hg init oldgraft