Read about our upcoming Code of Conduct on this issue

Commit e9f1ffd3 authored by Anton Shestakov's avatar Anton Shestakov
Browse files

prune: update to the successor of wdir also with --pair/--biject (issue6142)

When prune is used with --pair flag, we can also update to the successor of
working directory parent.

No need to check len(sucs) or len(precs) here because there's a check for that
earlier in the code (it's a requirement of biject).

The tests are now demonstrate the correct behavior: when rev 14 was pruned with
12 as its successor, the bookmark that was on 14 was moved to 12. That bookmark
was also activated (even before this patch).

--HG--
branch : stable
parent b89495215c6e
......@@ -1066,6 +1066,9 @@ def cmdprune(ui, repo, *revs, **opts):
if len(sucs) == 1 and len(precs) == 1 and wdp in precs:
# '.' killed, so update to the successor
newnode = sucs[0]
elif biject and wdp in precs:
# find the exact successor of '.'
newnode = sucs[precs.index(wdp)]
else:
# update to an unkilled parent
newnode = wdp
......
......@@ -239,8 +239,8 @@ two old, two new with --pair (also test bookmark move)
$ mkcommit n2
$ hg prune 'desc("add n1")::desc("add n2")' -s 'desc("add nD")::desc("add nE")' --pair
0 files updated, 0 files merged, 2 files removed, 0 files unresolved
working directory is now at 1f0dee641bb7
4 files updated, 0 files merged, 2 files removed, 0 files unresolved
working directory is now at 6e8148413dd5
2 changesets pruned
$ hg debugobsolete
9d206ffc875e1bc304590549be293be36821e66c 0 {47d2a3944de8b013de3be9578e8e344ea2e6c097} (Sat Dec 15 00:00:00 1979 +0000) {'ef1': '0', 'operation': 'prune', 'user': 'blah'}
......@@ -255,13 +255,12 @@ two old, two new with --pair (also test bookmark move)
21b6f2f1cece8c10326e575dd38239189d467190 6e8148413dd541855b72a920a90c06fca127c7e7 0 (Thu Jan 01 00:00:00 1970 +0000) {'ef1': '13', 'operation': 'prune', 'user': 'test'}
$ hg log --hidden -r 'desc("add n2") + desc("add nE") + bookmark("prune-pair-book")'
14:21b6f2f1cece[] (obsolete/draft) add n2
12:6e8148413dd5[] (draft) add nE
0:1f0dee641bb7[BABAR prune-pair-book] (public) add a
12:6e8148413dd5[prune-pair-book] (draft) add nE
test hg strip replacement
$ hg up 10
2 files updated, 0 files merged, 0 files removed, 0 files unresolved
0 files updated, 0 files merged, 2 files removed, 0 files unresolved
(leaving bookmark prune-pair-book)
$ mkcommit n1
created new head
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment