rebase: do not always use real strip on --abort

Summary:
The real strip was used on purpose [1] as a workaround of the old obsstore
design where commits cannot be revived.

Since reviving commits is now possible. Let's avoid dangerous strip here.

This makes `rebase --abort` safer, faster, undo-able, and also solves an
issue where clindex crashes with real strip reported by @[839419353:jeroenv] at
https://fburl.com/uqfglmu5.

[1]: https://www.mercurial-scm.org/pipermail/mercurial-devel/2017-March/095572.html

Reviewed By: DurhamG

Differential Revision: D9236658

fbshipit-source-id: 9ae7089a8991d8d21ddc5e107c15b8374c7d7339
This commit is contained in:
Jun Wu 2018-08-18 10:40:40 -07:00 committed by Facebook Github Bot
parent 51c92b569d
commit c601e242af
4 changed files with 4 additions and 7 deletions

View File

@ -1865,8 +1865,6 @@ def abort(repo, originalwd, destmap, state, activebookmark=None):
if cleanup:
shouldupdate = False
if rebased:
strippoints = [c.node() for c in repo.set("roots(%ld)", rebased)]
updateifonnodes = set(rebased)
updateifonnodes.update(destmap.values())
@ -1880,7 +1878,8 @@ def abort(repo, originalwd, destmap, state, activebookmark=None):
# Strip from the first rebased revision
if rebased:
# no backup of rebased cset versions needed
repair.strip(repo.ui, repo, strippoints)
nodes = map(repo.changelog.node, rebased)
scmutil.cleanupnodes(repo, nodes, "rebase")
if activebookmark and activebookmark in repo._bookmarks:
bookmarks.activate(repo, activebookmark)

View File

@ -208,7 +208,6 @@ Test failure to rebase deletion after rename
abort: a@ba0395f0e180: not found in manifest!
[255]
$ hg rebase --abort
saved backup bundle to $TESTTMP/repo/.hg/strip-backup/3fd0353a7967-a25c7d46-backup.hg (glob)
rebase aborted
$ cd ..
$ rm -rf repo

View File

@ -265,7 +265,6 @@ amend.autorestack=always, and conflicting changes (expect restack)
unresolved conflicts (see hg resolve, then hg rebase --continue)
[1]
$ hg rebase --abort
saved backup bundle to $TESTTMP/repo11/.hg/strip-backup/7655d36150ed-96938de3-backup.hg
rebase aborted
$ cat file
unmergeable!

View File

@ -110,7 +110,7 @@ Insert unsupported mandatory merge record:
Abort (should clear out unsupported merge state):
$ hg rebase --abort
saved backup bundle to $TESTTMP/a/.hg/strip-backup/3e046f2ecedb-6beef7d5-backup.hg
saved backup bundle to $TESTTMP/a/.hg/strip-backup/3e046f2ecedb-6beef7d5-rebase.hg
rebase aborted
$ hg debugmergestate
no merge state found
@ -369,7 +369,7 @@ test aborting an interrupted series (issue5084)
abort: ^C
[255]
$ hg rebase --abort
saved backup bundle to $TESTTMP/interrupted/.hg/strip-backup/3d8812cf300d-93041a90-backup.hg
saved backup bundle to $TESTTMP/interrupted/.hg/strip-backup/3d8812cf300d-93041a90-rebase.hg
rebase aborted
$ hg log -G --template "{rev} {desc} {bookmarks}"
o 6 no-a