[PATCH 4 of 5] amend: use scmutil.cleanupnodes (BC)
Jun Wu
quark at fb.com
Mon Jun 26 18:35:31 EDT 2017
# HG changeset patch
# User Jun Wu <quark at fb.com>
# Date 1498516108 25200
# Mon Jun 26 15:28:28 2017 -0700
# Node ID b21d9244c743fd4cd06de7cbc68d9b8948b17180
# Parent 7a7f6844fe0b0e0545510ea4a73b00432029a12c
# Available At https://bitbucket.org/quark-zju/hg-draft
# hg pull https://bitbucket.org/quark-zju/hg-draft -r b21d9244c743
amend: use scmutil.cleanupnodes (BC)
This is marked as BC because the strip backup file name has changed.
diff --git a/mercurial/cmdutil.py b/mercurial/cmdutil.py
--- a/mercurial/cmdutil.py
+++ b/mercurial/cmdutil.py
@@ -38,5 +38,4 @@ from . import (
pycompat,
registrar,
- repair,
revlog,
revset,
@@ -2742,5 +2741,4 @@ def amend(ui, repo, commitfunc, old, ext
ui.note(_('amending changeset %s\n') % old)
base = old.p1()
- createmarkers = obsolete.isenabled(repo, obsolete.createmarkersopt)
newid = None
@@ -2882,30 +2880,8 @@ def amend(ui, repo, commitfunc, old, ext
# Reroute the working copy parent to the new changeset
repo.setparents(newid, nullid)
-
- # Move bookmarks from old parent to amend commit
- bms = repo.nodebookmarks(old.node())
- if bms:
- marks = repo._bookmarks
- for bm in bms:
- ui.debug('moving bookmarks %r from %s to %s\n' %
- (marks, old.hex(), hex(newid)))
- marks[bm] = newid
- marks.recordchange(tr)
- #commit the whole amend process
- if createmarkers:
- # mark the new changeset as successor of the rewritten one
- new = repo[newid]
- obs = [(old, (new,))]
- if node:
- obs.append((ctx, ()))
-
- obsolete.createmarkers(repo, obs, operation='amend')
- if not createmarkers and newid != old.node():
- # Strip the intermediate commit (if there was one) and the amended
- # commit
- if node:
- ui.note(_('stripping intermediate changeset %s\n') % ctx)
- ui.note(_('stripping amended changeset %s\n') % old)
- repair.strip(ui, repo, old.node(), topic='amend-backup')
+ mapping = {old.node(): (newid,)}
+ if node:
+ mapping[ctx.node()] = ()
+ scmutil.cleanupnodes(repo, mapping, 'amend')
return newid
diff --git a/tests/test-automv.t b/tests/test-automv.t
--- a/tests/test-automv.t
+++ b/tests/test-automv.t
@@ -163,5 +163,5 @@ mv/rm/add
$ hg commit --amend -m 'amended'
detected move of 1 files
- saved backup bundle to $TESTTMP/repo/.hg/strip-backup/*-amend-backup.hg (glob)
+ saved backup bundle to $TESTTMP/repo/.hg/strip-backup/*-amend.hg (glob)
$ hg status --change . -C
A b.txt
@@ -186,5 +186,5 @@ mv/rm/add/modif
$ hg commit --amend -m 'amended'
detected move of 1 files
- saved backup bundle to $TESTTMP/repo/.hg/strip-backup/*-amend-backup.hg (glob)
+ saved backup bundle to $TESTTMP/repo/.hg/strip-backup/*-amend.hg (glob)
$ hg status --change . -C
A b.txt
@@ -208,5 +208,5 @@ mv/rm/add/modif
R a.txt
$ hg commit --amend -m 'amended'
- saved backup bundle to $TESTTMP/repo/.hg/strip-backup/*-amend-backup.hg (glob)
+ saved backup bundle to $TESTTMP/repo/.hg/strip-backup/*-amend.hg (glob)
$ hg status --change . -C
A b.txt
@@ -230,5 +230,5 @@ mv/rm/add/modif/changethreshold
$ hg commit --amend --config automv.similarity='60' -m 'amended'
detected move of 1 files
- saved backup bundle to $TESTTMP/repo/.hg/strip-backup/*-amend-backup.hg (glob)
+ saved backup bundle to $TESTTMP/repo/.hg/strip-backup/*-amend.hg (glob)
$ hg status --change . -C
A b.txt
@@ -249,5 +249,5 @@ mv
? b.txt
$ hg commit --amend -m 'amended'
- saved backup bundle to $TESTTMP/repo/.hg/strip-backup/*-amend-backup.hg (glob)
+ saved backup bundle to $TESTTMP/repo/.hg/strip-backup/*-amend.hg (glob)
$ hg status -C
! a.txt
@@ -271,5 +271,5 @@ mv/rm/add/notincommitfiles
R a.txt
$ hg commit --amend -m 'amended' d.txt
- saved backup bundle to $TESTTMP/repo/.hg/strip-backup/*-amend-backup.hg (glob)
+ saved backup bundle to $TESTTMP/repo/.hg/strip-backup/*-amend.hg (glob)
$ hg status --change . -C
A c.txt
@@ -280,5 +280,5 @@ mv/rm/add/notincommitfiles
$ hg commit --amend -m 'amended'
detected move of 1 files
- saved backup bundle to $TESTTMP/repo/.hg/strip-backup/*-amend-backup.hg (glob)
+ saved backup bundle to $TESTTMP/repo/.hg/strip-backup/*-amend.hg (glob)
$ hg status --change . -C
A b.txt
@@ -302,5 +302,5 @@ mv/rm/add/--no-automv
R a.txt
$ hg commit --amend -m 'amended' --no-automv
- saved backup bundle to $TESTTMP/repo/.hg/strip-backup/*-amend-backup.hg (glob)
+ saved backup bundle to $TESTTMP/repo/.hg/strip-backup/*-amend.hg (glob)
$ hg status --change . -C
A b.txt
@@ -323,5 +323,5 @@ mv/rm/commit/add/amend
$ hg add b.txt
$ hg commit --amend -m 'amended'
- saved backup bundle to $TESTTMP/repo/.hg/strip-backup/*-amend-backup.hg (glob)
+ saved backup bundle to $TESTTMP/repo/.hg/strip-backup/*-amend.hg (glob)
$ hg status --change . -C
A b.txt
diff --git a/tests/test-commit-amend.t b/tests/test-commit-amend.t
--- a/tests/test-commit-amend.t
+++ b/tests/test-commit-amend.t
@@ -41,5 +41,5 @@ Amending changeset with changes in worki
pretxncommit 43f1ba15f28a50abf0aae529cf8a16bfced7b149
43f1ba15f28a tip
- saved backup bundle to $TESTTMP/.hg/strip-backup/489edb5b847d-f1bf3ab8-amend-backup.hg (glob)
+ saved backup bundle to $TESTTMP/.hg/strip-backup/489edb5b847d-f1bf3ab8-amend.hg (glob)
$ echo 'pretxncommit.foo = ' >> $HGRCPATH
$ hg diff -c .
@@ -94,5 +94,5 @@ Check proper abort for empty message
Add new file:
$ hg ci --amend -m 'amend base1 new file'
- saved backup bundle to $TESTTMP/.hg/strip-backup/43f1ba15f28a-7a3b3496-amend-backup.hg (glob)
+ saved backup bundle to $TESTTMP/.hg/strip-backup/43f1ba15f28a-7a3b3496-amend.hg (glob)
Remove file that was added in amended commit:
@@ -103,5 +103,5 @@ Remove file that was added in amended co
$ echo 'amend base1 remove new file' > ../logfile
$ HGEDITOR="\"sh\" \"`pwd`/editor.sh\"" hg ci --amend --logfile ../logfile
- saved backup bundle to $TESTTMP/.hg/strip-backup/b8e3cb2b3882-0b55739a-amend-backup.hg (glob)
+ saved backup bundle to $TESTTMP/.hg/strip-backup/b8e3cb2b3882-0b55739a-amend.hg (glob)
$ hg cat b
@@ -118,5 +118,4 @@ No changes, just a different message:
committing manifest
committing changelog
- stripping amended changeset 74609c7f506e
1 changesets found
uncompressed size of bundle content:
@@ -124,5 +123,5 @@ No changes, just a different message:
163 (manifests)
129 a
- saved backup bundle to $TESTTMP/.hg/strip-backup/74609c7f506e-1bfde511-amend-backup.hg (glob)
+ saved backup bundle to $TESTTMP/.hg/strip-backup/74609c7f506e-1bfde511-amend.hg (glob)
1 changesets found
uncompressed size of bundle content:
@@ -170,8 +169,8 @@ Test -u/-d:
$ HGEDITOR="sh .hg/checkeditform.sh" hg ci --amend -u foo -d '1 0'
HGEDITFORM=commit.amend.normal
- saved backup bundle to $TESTTMP/.hg/strip-backup/1cd866679df8-5f5bcb85-amend-backup.hg (glob)
+ saved backup bundle to $TESTTMP/.hg/strip-backup/1cd866679df8-5f5bcb85-amend.hg (glob)
$ echo a >> a
$ hg ci --amend -u foo -d '1 0'
- saved backup bundle to $TESTTMP/.hg/strip-backup/780e6f23e03d-83b10a27-amend-backup.hg (glob)
+ saved backup bundle to $TESTTMP/.hg/strip-backup/780e6f23e03d-83b10a27-amend.hg (glob)
$ hg log -r .
changeset: 1:5f357c7560ab
@@ -262,5 +261,4 @@ then, test editing custom commit message
committing manifest
committing changelog
- stripping amended changeset 5f357c7560ab
1 changesets found
uncompressed size of bundle content:
@@ -268,5 +266,5 @@ then, test editing custom commit message
163 (manifests)
131 a
- saved backup bundle to $TESTTMP/.hg/strip-backup/5f357c7560ab-e7c84ade-amend-backup.hg (glob)
+ saved backup bundle to $TESTTMP/.hg/strip-backup/5f357c7560ab-e7c84ade-amend.hg (glob)
1 changesets found
uncompressed size of bundle content:
@@ -304,6 +302,4 @@ Same, but with changes in working dir (d
committing manifest
committing changelog
- stripping intermediate changeset a0ea9b1a4c8c
- stripping amended changeset 7ab3bf440b54
2 changesets found
uncompressed size of bundle content:
@@ -311,5 +307,5 @@ Same, but with changes in working dir (d
322 (manifests)
249 a
- saved backup bundle to $TESTTMP/.hg/strip-backup/7ab3bf440b54-8e3b5088-amend-backup.hg (glob)
+ saved backup bundle to $TESTTMP/.hg/strip-backup/7ab3bf440b54-8e3b5088-amend.hg (glob)
1 changesets found
uncompressed size of bundle content:
@@ -338,5 +334,5 @@ Moving bookmarks, preserve active bookma
$ hg book book2
$ hg ci --amend -m 'move bookmarks'
- saved backup bundle to $TESTTMP/.hg/strip-backup/ea22a388757c-e51094db-amend-backup.hg (glob)
+ saved backup bundle to $TESTTMP/.hg/strip-backup/ea22a388757c-e51094db-amend.hg (glob)
$ hg book
book1 1:6cec5aa930e2
@@ -344,5 +340,5 @@ Moving bookmarks, preserve active bookma
$ echo a >> a
$ hg ci --amend -m 'move bookmarks'
- saved backup bundle to $TESTTMP/.hg/strip-backup/6cec5aa930e2-e9b06de4-amend-backup.hg (glob)
+ saved backup bundle to $TESTTMP/.hg/strip-backup/6cec5aa930e2-e9b06de4-amend.hg (glob)
$ hg book
book1 1:48bb6e53a15f
@@ -380,5 +376,5 @@ Moving branches:
marked working directory as branch default
$ hg ci --amend -m 'back to default'
- saved backup bundle to $TESTTMP/.hg/strip-backup/8ac881fbf49d-fd962fef-amend-backup.hg (glob)
+ saved backup bundle to $TESTTMP/.hg/strip-backup/8ac881fbf49d-fd962fef-amend.hg (glob)
$ hg branches
default 2:ce12b0b57d46
@@ -396,5 +392,5 @@ Close branch:
$ hg ci -mb
$ hg ci --amend --close-branch -m 'closing branch foo'
- saved backup bundle to $TESTTMP/.hg/strip-backup/c962248fa264-6701c392-amend-backup.hg (glob)
+ saved backup bundle to $TESTTMP/.hg/strip-backup/c962248fa264-6701c392-amend.hg (glob)
Same thing, different code path:
@@ -405,5 +401,5 @@ Same thing, different code path:
$ echo b >> b
$ hg ci --amend --close-branch
- saved backup bundle to $TESTTMP/.hg/strip-backup/027371728205-49c0c55d-amend-backup.hg (glob)
+ saved backup bundle to $TESTTMP/.hg/strip-backup/027371728205-49c0c55d-amend.hg (glob)
$ hg branches
default 2:ce12b0b57d46
@@ -426,5 +422,5 @@ Follow copies/renames:
$ hg mv c d
$ hg ci --amend -m 'b -> d'
- saved backup bundle to $TESTTMP/.hg/strip-backup/b8c6eac7f12e-adaaa8b1-amend-backup.hg (glob)
+ saved backup bundle to $TESTTMP/.hg/strip-backup/b8c6eac7f12e-adaaa8b1-amend.hg (glob)
$ hg st --rev '.^' --copies d
A d
@@ -434,5 +430,5 @@ Follow copies/renames:
$ hg cp e f
$ hg ci --amend -m 'f = d'
- saved backup bundle to $TESTTMP/.hg/strip-backup/7f9761d65613-d37aa788-amend-backup.hg (glob)
+ saved backup bundle to $TESTTMP/.hg/strip-backup/7f9761d65613-d37aa788-amend.hg (glob)
$ hg st --rev '.^' --copies f
A f
@@ -445,5 +441,5 @@ Follow copies/renames:
$ mv f.orig f
$ hg ci --amend -m replacef
- saved backup bundle to $TESTTMP/.hg/strip-backup/9e8c5f7e3d95-90259f67-amend-backup.hg (glob)
+ saved backup bundle to $TESTTMP/.hg/strip-backup/9e8c5f7e3d95-90259f67-amend.hg (glob)
$ hg st --change . --copies
$ hg log -r . --template "{file_copies}\n"
@@ -457,5 +453,5 @@ Move added file (issue3410):
$ hg mv g h
$ hg ci --amend
- saved backup bundle to $TESTTMP/.hg/strip-backup/24aa8eacce2b-7059e0f1-amend-backup.hg (glob)
+ saved backup bundle to $TESTTMP/.hg/strip-backup/24aa8eacce2b-7059e0f1-amend.hg (glob)
$ hg st --change . --copies h
A h
@@ -477,9 +473,9 @@ Preserve extra dict (issue3430):
$ hg ci -ma
$ hg ci --amend -m "a'"
- saved backup bundle to $TESTTMP/.hg/strip-backup/3837aa2a2fdb-2be01fd1-amend-backup.hg (glob)
+ saved backup bundle to $TESTTMP/.hg/strip-backup/3837aa2a2fdb-2be01fd1-amend.hg (glob)
$ hg log -r . --template "{branch}\n"
a
$ hg ci --amend -m "a''"
- saved backup bundle to $TESTTMP/.hg/strip-backup/c05c06be7514-ed28c4cd-amend-backup.hg (glob)
+ saved backup bundle to $TESTTMP/.hg/strip-backup/c05c06be7514-ed28c4cd-amend.hg (glob)
$ hg log -r . --template "{branch}\n"
a
@@ -498,5 +494,5 @@ first graft something so there's an addi
grafting 12:2647734878ef "fork" (tip)
$ hg ci --amend -m 'graft amend'
- saved backup bundle to $TESTTMP/.hg/strip-backup/bd010aea3f39-eedb103b-amend-backup.hg (glob)
+ saved backup bundle to $TESTTMP/.hg/strip-backup/bd010aea3f39-eedb103b-amend.hg (glob)
$ hg log -r . --debug | grep extra
extra: amend_source=bd010aea3f39f3fb2a2f884b9ccb0471cd77398e
diff --git a/tests/test-commit-interactive-curses.t b/tests/test-commit-interactive-curses.t
--- a/tests/test-commit-interactive-curses.t
+++ b/tests/test-commit-interactive-curses.t
@@ -207,5 +207,5 @@ Amend option works
> EOF
$ hg commit -i -m "newly added file" -d "0 0"
- saved backup bundle to $TESTTMP/a/.hg/strip-backup/2b0e9be4d336-28bbe4e2-amend-backup.hg (glob)
+ saved backup bundle to $TESTTMP/a/.hg/strip-backup/2b0e9be4d336-28bbe4e2-amend.hg (glob)
$ hg diff -c .
diff -r a6735021574d -r c1d239d165ae x
diff --git a/tests/test-treemanifest.t b/tests/test-treemanifest.t
--- a/tests/test-treemanifest.t
+++ b/tests/test-treemanifest.t
@@ -863,5 +863,5 @@ Committing a empty commit does not dupli
$ hg rm z
$ hg commit --amend -m 'empty commit'
- saved backup bundle to $TESTTMP/grafted-dir-repo-clone/.hg/strip-backup/cb99d5717cea-de37743b-amend-backup.hg (glob)
+ saved backup bundle to $TESTTMP/grafted-dir-repo-clone/.hg/strip-backup/cb99d5717cea-de37743b-amend.hg (glob)
$ hg log -r 'tip + tip^' -T '{manifest}\n'
1:678d3574b88c
More information about the Mercurial-devel
mailing list