##// END OF EJS Templates
dispatch: protect against malicious 'hg serve --stdio' invocations (sec)...
dispatch: protect against malicious 'hg serve --stdio' invocations (sec) Some shared-ssh installations assume that 'hg serve --stdio' is a safe command to run for minimally trusted users. Unfortunately, the messy implementation of argument parsing here meant that trying to access a repo named '--debugger' would give the user a pdb prompt, thereby sidestepping any hoped-for sandboxing. Serving repositories over HTTP(S) is unaffected. We're not currently hardening any subcommands other than 'serve'. If your service exposes other commands to users with arbitrary repository names, it is imperative that you defend against repository names of '--debugger' and anything starting with '--config'. The read-only mode of hg-ssh stopped working because it provided its hook configuration to "hg serve --stdio" via --config parameter. This is banned for security reasons now. This patch switches it to directly call ui.setconfig(). If your custom hosting infrastructure relies on passing --config to "hg serve --stdio", you'll need to find a different way to get that configuration into Mercurial, either by using ui.setconfig() as hg-ssh does in this patch, or by placing an hgrc file someplace where Mercurial will read it. mitrandir@fb.com provided some extra fixes for the dispatch code and for hg-ssh in places that I overlooked.

File last commit:

r30792:4215dc1b default
r32050:77eaf953 4.1.3 stable
Show More
test-commit-amend.t
1180 lines | 29.9 KiB | text/troff | Tads3Lexer
/ tests / test-commit-amend.t
Pierre-Yves David
test: use general delta for 'test-commit-amend.t'...
r26927 $ cat << EOF >> $HGRCPATH
> [format]
> usegeneraldelta=yes
> EOF
Idan Kamara
commit: add option to amend the working dir parent...
r16458 $ hg init
Setup:
$ echo a >> a
$ hg ci -Am 'base'
adding a
Refuse to amend public csets:
$ hg phase -r . -p
$ hg ci --amend
abort: cannot amend public changesets
[255]
$ hg phase -r . -f -d
$ echo a >> a
$ hg ci -Am 'base1'
Nothing to amend:
FUJIWARA Katsunori
cmdutil: make in-memory changes visible to external editor (issue4378)...
r26750 $ hg ci --amend -m 'base1'
Idan Kamara
commit: add option to amend the working dir parent...
r16458 nothing changed
[1]
Adrian Buehlmann
test-commit-amend: adapt for Windows after fba17a64fa49
r17060 $ cat >> $HGRCPATH <<EOF
> [hooks]
Jim Hague
tests: correct quoting of double quotes in here documents used to write hooks...
r17462 > pretxncommit.foo = sh -c "echo \\"pretxncommit \$HG_NODE\\"; hg id -r \$HG_NODE"
Adrian Buehlmann
test-commit-amend: adapt for Windows after fba17a64fa49
r17060 > EOF
Idan Kamara
amend: disable hooks when creating intermediate commit (issue3501)
r17049
Idan Kamara
commit: add option to amend the working dir parent...
r16458 Amending changeset with changes in working dir:
Pierre-Yves David
amend: force editor only if old message is reused (issue3698)...
r17924 (and check that --message does not trigger an editor)
Idan Kamara
commit: add option to amend the working dir parent...
r16458
$ echo a >> a
Pierre-Yves David
amend: force editor only if old message is reused (issue3698)...
r17924 $ HGEDITOR="\"sh\" \"`pwd`/editor.sh\"" hg commit --amend -m 'amend base1'
Pierre-Yves David
amend: add noise in extra to avoid creating obsolescence cycle (issue3664)...
r17811 pretxncommit 43f1ba15f28a50abf0aae529cf8a16bfced7b149
43f1ba15f28a tip
Durham Goode
bundles: do not overwrite existing backup bundles (BC)...
r23835 saved backup bundle to $TESTTMP/.hg/strip-backup/489edb5b847d-f1bf3ab8-amend-backup.hg (glob)
Idan Kamara
amend: disable hooks when creating intermediate commit (issue3501)
r17049 $ echo 'pretxncommit.foo = ' >> $HGRCPATH
Idan Kamara
commit: add option to amend the working dir parent...
r16458 $ hg diff -c .
Pierre-Yves David
amend: add noise in extra to avoid creating obsolescence cycle (issue3664)...
r17811 diff -r ad120869acf0 -r 43f1ba15f28a a
Idan Kamara
commit: add option to amend the working dir parent...
r16458 --- a/a Thu Jan 01 00:00:00 1970 +0000
+++ b/a Thu Jan 01 00:00:00 1970 +0000
@@ -1,1 +1,3 @@
Mads Kiilerich
bdiff: give slight preference to appending lines...
r30432 a
Mads Kiilerich
bdiff: give slight preference to longest matches in the middle of the B side...
r30431 +a
Idan Kamara
commit: add option to amend the working dir parent...
r16458 +a
$ hg log
Pierre-Yves David
amend: add noise in extra to avoid creating obsolescence cycle (issue3664)...
r17811 changeset: 1:43f1ba15f28a
Idan Kamara
commit: add option to amend the working dir parent...
r16458 tag: tip
user: test
date: Thu Jan 01 00:00:00 1970 +0000
summary: amend base1
changeset: 0:ad120869acf0
user: test
date: Thu Jan 01 00:00:00 1970 +0000
summary: base
Pierre-Yves David
amend: invalidate dirstate in case of failure (issue3670)...
r18197 Check proper abort for empty message
Idan Kamara
commit: add option to amend the working dir parent...
r16458
Pierre-Yves David
amend: invalidate dirstate in case of failure (issue3670)...
r18197 $ cat > editor.sh << '__EOF__'
> #!/bin/sh
> echo "" > "$1"
> __EOF__
Idan Kamara
commit: add option to amend the working dir parent...
r16458 $ echo b > b
Pierre-Yves David
amend: invalidate dirstate in case of failure (issue3670)...
r18197 $ hg add b
$ hg summary
parent: 1:43f1ba15f28a tip
amend base1
branch: default
commit: 1 added, 1 unknown
update: (current)
Gilles Moris
summary: move the parents phase marker to commit line (issue4688)...
r25382 phases: 2 draft
Pierre-Yves David
amend: invalidate dirstate in case of failure (issue3670)...
r18197 $ HGEDITOR="\"sh\" \"`pwd`/editor.sh\"" hg commit --amend
transaction abort!
rollback completed
abort: empty commit message
[255]
$ hg summary
parent: 1:43f1ba15f28a tip
amend base1
branch: default
commit: 1 added, 1 unknown
update: (current)
Gilles Moris
summary: move the parents phase marker to commit line (issue4688)...
r25382 phases: 2 draft
Pierre-Yves David
amend: invalidate dirstate in case of failure (issue3670)...
r18197
Add new file:
$ hg ci --amend -m 'amend base1 new file'
Durham Goode
bundles: do not overwrite existing backup bundles (BC)...
r23835 saved backup bundle to $TESTTMP/.hg/strip-backup/43f1ba15f28a-7a3b3496-amend-backup.hg (glob)
Idan Kamara
commit: add option to amend the working dir parent...
r16458
Remove file that was added in amended commit:
Pierre-Yves David
amend: fix incompatibity between logfile and message option (issue3675)...
r17863 (and test logfile option)
Pierre-Yves David
amend: force editor only if old message is reused (issue3698)...
r17924 (and test that logfile option do not trigger an editor)
Idan Kamara
commit: add option to amend the working dir parent...
r16458
$ hg rm b
Pierre-Yves David
amend: fix incompatibity between logfile and message option (issue3675)...
r17863 $ echo 'amend base1 remove new file' > ../logfile
Pierre-Yves David
amend: force editor only if old message is reused (issue3698)...
r17924 $ HGEDITOR="\"sh\" \"`pwd`/editor.sh\"" hg ci --amend --logfile ../logfile
Durham Goode
bundles: do not overwrite existing backup bundles (BC)...
r23835 saved backup bundle to $TESTTMP/.hg/strip-backup/b8e3cb2b3882-0b55739a-amend-backup.hg (glob)
Idan Kamara
commit: add option to amend the working dir parent...
r16458
$ hg cat b
Pierre-Yves David
amend: add noise in extra to avoid creating obsolescence cycle (issue3664)...
r17811 b: no such file in rev 74609c7f506e
Idan Kamara
commit: add option to amend the working dir parent...
r16458 [1]
No changes, just a different message:
$ hg ci -v --amend -m 'no changes, new message'
Pierre-Yves David
amend: add noise in extra to avoid creating obsolescence cycle (issue3664)...
r17811 amending changeset 74609c7f506e
copying changeset 74609c7f506e to ad120869acf0
Mads Kiilerich
localrepo: show headline notes in commitctx before showing filenames...
r23749 committing files:
Idan Kamara
commit: add option to amend the working dir parent...
r16458 a
Mads Kiilerich
localrepo: show headline notes in commitctx before showing filenames...
r23749 committing manifest
committing changelog
Pierre-Yves David
amend: add noise in extra to avoid creating obsolescence cycle (issue3664)...
r17811 stripping amended changeset 74609c7f506e
Idan Kamara
commit: add option to amend the working dir parent...
r16458 1 changesets found
Mads Kiilerich
bundle: when verbose, show what takes up the space in the generated bundle...
r23748 uncompressed size of bundle content:
Pierre-Yves David
changegroup: skip delta when the underlying revlog do not use them...
r30211 254 (changelog)
Pierre-Yves David
test: use general delta for 'test-commit-amend.t'...
r26927 163 (manifests)
Mads Kiilerich
bdiff: give slight preference to appending lines...
r30432 129 a
Durham Goode
bundles: do not overwrite existing backup bundles (BC)...
r23835 saved backup bundle to $TESTTMP/.hg/strip-backup/74609c7f506e-1bfde511-amend-backup.hg (glob)
Idan Kamara
commit: add option to amend the working dir parent...
r16458 1 changesets found
Mads Kiilerich
bundle: when verbose, show what takes up the space in the generated bundle...
r23748 uncompressed size of bundle content:
Pierre-Yves David
changegroup: skip delta when the underlying revlog do not use them...
r30211 250 (changelog)
Pierre-Yves David
test: use general delta for 'test-commit-amend.t'...
r26927 163 (manifests)
Mads Kiilerich
bdiff: give slight preference to appending lines...
r30432 129 a
Idan Kamara
commit: add option to amend the working dir parent...
r16458 adding branch
adding changesets
adding manifests
adding file changes
added 1 changesets with 1 changes to 1 files
Pierre-Yves David
amend: add noise in extra to avoid creating obsolescence cycle (issue3664)...
r17811 committed changeset 1:1cd866679df8
Idan Kamara
commit: add option to amend the working dir parent...
r16458 $ hg diff -c .
Pierre-Yves David
amend: add noise in extra to avoid creating obsolescence cycle (issue3664)...
r17811 diff -r ad120869acf0 -r 1cd866679df8 a
Idan Kamara
commit: add option to amend the working dir parent...
r16458 --- a/a Thu Jan 01 00:00:00 1970 +0000
+++ b/a Thu Jan 01 00:00:00 1970 +0000
@@ -1,1 +1,3 @@
Mads Kiilerich
bdiff: give slight preference to appending lines...
r30432 a
Mads Kiilerich
bdiff: give slight preference to longest matches in the middle of the B side...
r30431 +a
Idan Kamara
commit: add option to amend the working dir parent...
r16458 +a
$ hg log
Pierre-Yves David
amend: add noise in extra to avoid creating obsolescence cycle (issue3664)...
r17811 changeset: 1:1cd866679df8
Idan Kamara
commit: add option to amend the working dir parent...
r16458 tag: tip
user: test
date: Thu Jan 01 00:00:00 1970 +0000
summary: no changes, new message
changeset: 0:ad120869acf0
user: test
date: Thu Jan 01 00:00:00 1970 +0000
summary: base
Disable default date on commit so when -d isn't given, the old date is preserved:
$ echo '[defaults]' >> $HGRCPATH
$ echo 'commit=' >> $HGRCPATH
Test -u/-d:
FUJIWARA Katsunori
commit: change "editform" to distinguish merge commits from other (--amend)...
r22249 $ cat > .hg/checkeditform.sh <<EOF
> env | grep HGEDITFORM
> true
> EOF
$ HGEDITOR="sh .hg/checkeditform.sh" hg ci --amend -u foo -d '1 0'
HGEDITFORM=commit.amend.normal
Durham Goode
bundles: do not overwrite existing backup bundles (BC)...
r23835 saved backup bundle to $TESTTMP/.hg/strip-backup/1cd866679df8-5f5bcb85-amend-backup.hg (glob)
Idan Kamara
commit: add option to amend the working dir parent...
r16458 $ echo a >> a
$ hg ci --amend -u foo -d '1 0'
Durham Goode
bundles: do not overwrite existing backup bundles (BC)...
r23835 saved backup bundle to $TESTTMP/.hg/strip-backup/780e6f23e03d-83b10a27-amend-backup.hg (glob)
Idan Kamara
commit: add option to amend the working dir parent...
r16458 $ hg log -r .
Pierre-Yves David
amend: add noise in extra to avoid creating obsolescence cycle (issue3664)...
r17811 changeset: 1:5f357c7560ab
Idan Kamara
commit: add option to amend the working dir parent...
r16458 tag: tip
user: foo
date: Thu Jan 01 00:00:01 1970 +0000
summary: no changes, new message
Open editor with old commit message if a message isn't given otherwise:
Mads Kiilerich
tests: consistently use a HGEDITOR pattern that works with msys on windows...
r16901 $ cat > editor.sh << '__EOF__'
Idan Kamara
commit: add option to amend the working dir parent...
r16458 > #!/bin/sh
> cat $1
> echo "another precious commit message" > "$1"
> __EOF__
FUJIWARA Katsunori
amend: save commit message into ".hg/last-message.txt"...
r20771
at first, test saving last-message.txt
$ cat > .hg/hgrc << '__EOF__'
> [hooks]
> pretxncommit.test-saving-last-message = false
> __EOF__
$ rm -f .hg/last-message.txt
$ hg commit --amend -v -m "message given from command line"
amending changeset 5f357c7560ab
copying changeset 5f357c7560ab to ad120869acf0
Mads Kiilerich
localrepo: show headline notes in commitctx before showing filenames...
r23749 committing files:
FUJIWARA Katsunori
amend: save commit message into ".hg/last-message.txt"...
r20771 a
Mads Kiilerich
localrepo: show headline notes in commitctx before showing filenames...
r23749 committing manifest
committing changelog
FUJIWARA Katsunori
amend: save commit message into ".hg/last-message.txt"...
r20771 running hook pretxncommit.test-saving-last-message: false
transaction abort!
rollback completed
abort: pretxncommit.test-saving-last-message hook exited with status 1
[255]
$ cat .hg/last-message.txt
message given from command line (no-eol)
$ rm -f .hg/last-message.txt
$ HGEDITOR="\"sh\" \"`pwd`/editor.sh\"" hg commit --amend -v
amending changeset 5f357c7560ab
copying changeset 5f357c7560ab to ad120869acf0
no changes, new message
HG: Enter commit message. Lines beginning with 'HG:' are removed.
HG: Leave message empty to abort commit.
HG: --
HG: user: foo
HG: branch 'default'
HG: changed a
Mads Kiilerich
localrepo: show headline notes in commitctx before showing filenames...
r23749 committing files:
FUJIWARA Katsunori
amend: save commit message into ".hg/last-message.txt"...
r20771 a
Mads Kiilerich
localrepo: show headline notes in commitctx before showing filenames...
r23749 committing manifest
committing changelog
FUJIWARA Katsunori
amend: save commit message into ".hg/last-message.txt"...
r20771 running hook pretxncommit.test-saving-last-message: false
transaction abort!
rollback completed
abort: pretxncommit.test-saving-last-message hook exited with status 1
[255]
$ cat .hg/last-message.txt
another precious commit message
$ cat > .hg/hgrc << '__EOF__'
> [hooks]
> pretxncommit.test-saving-last-message =
> __EOF__
then, test editing custom commit message
Mads Kiilerich
tests: consistently use a HGEDITOR pattern that works with msys on windows...
r16901 $ HGEDITOR="\"sh\" \"`pwd`/editor.sh\"" hg commit --amend -v
Pierre-Yves David
amend: add noise in extra to avoid creating obsolescence cycle (issue3664)...
r17811 amending changeset 5f357c7560ab
copying changeset 5f357c7560ab to ad120869acf0
Idan Kamara
commit: add option to amend the working dir parent...
r16458 no changes, new message
HG: Enter commit message. Lines beginning with 'HG:' are removed.
HG: Leave message empty to abort commit.
HG: --
HG: user: foo
HG: branch 'default'
HG: changed a
Mads Kiilerich
localrepo: show headline notes in commitctx before showing filenames...
r23749 committing files:
Idan Kamara
commit: add option to amend the working dir parent...
r16458 a
Mads Kiilerich
localrepo: show headline notes in commitctx before showing filenames...
r23749 committing manifest
committing changelog
Pierre-Yves David
amend: add noise in extra to avoid creating obsolescence cycle (issue3664)...
r17811 stripping amended changeset 5f357c7560ab
Idan Kamara
commit: add option to amend the working dir parent...
r16458 1 changesets found
Mads Kiilerich
bundle: when verbose, show what takes up the space in the generated bundle...
r23748 uncompressed size of bundle content:
Pierre-Yves David
changegroup: skip delta when the underlying revlog do not use them...
r30211 249 (changelog)
Pierre-Yves David
test: use general delta for 'test-commit-amend.t'...
r26927 163 (manifests)
Mads Kiilerich
bdiff: give slight preference to appending lines...
r30432 131 a
Durham Goode
bundles: do not overwrite existing backup bundles (BC)...
r23835 saved backup bundle to $TESTTMP/.hg/strip-backup/5f357c7560ab-e7c84ade-amend-backup.hg (glob)
Idan Kamara
commit: add option to amend the working dir parent...
r16458 1 changesets found
Mads Kiilerich
bundle: when verbose, show what takes up the space in the generated bundle...
r23748 uncompressed size of bundle content:
Pierre-Yves David
changegroup: skip delta when the underlying revlog do not use them...
r30211 257 (changelog)
Pierre-Yves David
test: use general delta for 'test-commit-amend.t'...
r26927 163 (manifests)
Mads Kiilerich
bdiff: give slight preference to appending lines...
r30432 131 a
Idan Kamara
commit: add option to amend the working dir parent...
r16458 adding branch
adding changesets
adding manifests
adding file changes
added 1 changesets with 1 changes to 1 files
Pierre-Yves David
amend: add noise in extra to avoid creating obsolescence cycle (issue3664)...
r17811 committed changeset 1:7ab3bf440b54
Idan Kamara
commit: add option to amend the working dir parent...
r16458
Same, but with changes in working dir (different code path):
$ echo a >> a
Mads Kiilerich
tests: consistently use a HGEDITOR pattern that works with msys on windows...
r16901 $ HGEDITOR="\"sh\" \"`pwd`/editor.sh\"" hg commit --amend -v
Pierre-Yves David
amend: add noise in extra to avoid creating obsolescence cycle (issue3664)...
r17811 amending changeset 7ab3bf440b54
Mads Kiilerich
localrepo: show headline notes in commitctx before showing filenames...
r23749 committing files:
Pierre-Yves David
amend: use an explicit commit message for temporary amending commit...
r17473 a
Mads Kiilerich
localrepo: show headline notes in commitctx before showing filenames...
r23749 committing manifest
committing changelog
Pierre-Yves David
amend: add noise in extra to avoid creating obsolescence cycle (issue3664)...
r17811 copying changeset a0ea9b1a4c8c to ad120869acf0
Idan Kamara
commit: add option to amend the working dir parent...
r16458 another precious commit message
HG: Enter commit message. Lines beginning with 'HG:' are removed.
HG: Leave message empty to abort commit.
HG: --
HG: user: foo
HG: branch 'default'
HG: changed a
Mads Kiilerich
localrepo: show headline notes in commitctx before showing filenames...
r23749 committing files:
Idan Kamara
commit: add option to amend the working dir parent...
r16458 a
Mads Kiilerich
localrepo: show headline notes in commitctx before showing filenames...
r23749 committing manifest
committing changelog
Pierre-Yves David
amend: add noise in extra to avoid creating obsolescence cycle (issue3664)...
r17811 stripping intermediate changeset a0ea9b1a4c8c
stripping amended changeset 7ab3bf440b54
Idan Kamara
commit: add option to amend the working dir parent...
r16458 2 changesets found
Mads Kiilerich
bundle: when verbose, show what takes up the space in the generated bundle...
r23748 uncompressed size of bundle content:
Pierre-Yves David
changegroup: skip delta when the underlying revlog do not use them...
r30211 464 (changelog)
Pierre-Yves David
test: use general delta for 'test-commit-amend.t'...
r26927 322 (manifests)
Mads Kiilerich
bdiff: give slight preference to appending lines...
r30432 249 a
Durham Goode
bundles: do not overwrite existing backup bundles (BC)...
r23835 saved backup bundle to $TESTTMP/.hg/strip-backup/7ab3bf440b54-8e3b5088-amend-backup.hg (glob)
Idan Kamara
commit: add option to amend the working dir parent...
r16458 1 changesets found
Mads Kiilerich
bundle: when verbose, show what takes up the space in the generated bundle...
r23748 uncompressed size of bundle content:
Pierre-Yves David
changegroup: skip delta when the underlying revlog do not use them...
r30211 257 (changelog)
Pierre-Yves David
test: use general delta for 'test-commit-amend.t'...
r26927 163 (manifests)
Mads Kiilerich
bdiff: give slight preference to appending lines...
r30432 133 a
Idan Kamara
commit: add option to amend the working dir parent...
r16458 adding branch
adding changesets
adding manifests
adding file changes
added 1 changesets with 1 changes to 1 files
Pierre-Yves David
amend: add noise in extra to avoid creating obsolescence cycle (issue3664)...
r17811 committed changeset 1:ea22a388757c
Idan Kamara
commit: add option to amend the working dir parent...
r16458
Mads Kiilerich
tests: consistently use a HGEDITOR pattern that works with msys on windows...
r16901 $ rm editor.sh
Idan Kamara
commit: add option to amend the working dir parent...
r16458 $ hg log -r .
Pierre-Yves David
amend: add noise in extra to avoid creating obsolescence cycle (issue3664)...
r17811 changeset: 1:ea22a388757c
Idan Kamara
commit: add option to amend the working dir parent...
r16458 tag: tip
user: foo
date: Thu Jan 01 00:00:01 1970 +0000
summary: another precious commit message
Moving bookmarks, preserve active bookmark:
$ hg book book1
$ hg book book2
$ hg ci --amend -m 'move bookmarks'
Durham Goode
bundles: do not overwrite existing backup bundles (BC)...
r23835 saved backup bundle to $TESTTMP/.hg/strip-backup/ea22a388757c-e51094db-amend-backup.hg (glob)
Idan Kamara
commit: add option to amend the working dir parent...
r16458 $ hg book
Pierre-Yves David
amend: add noise in extra to avoid creating obsolescence cycle (issue3664)...
r17811 book1 1:6cec5aa930e2
* book2 1:6cec5aa930e2
Idan Kamara
commit: add option to amend the working dir parent...
r16458 $ echo a >> a
$ hg ci --amend -m 'move bookmarks'
Durham Goode
bundles: do not overwrite existing backup bundles (BC)...
r23835 saved backup bundle to $TESTTMP/.hg/strip-backup/6cec5aa930e2-e9b06de4-amend-backup.hg (glob)
Idan Kamara
commit: add option to amend the working dir parent...
r16458 $ hg book
Pierre-Yves David
amend: add noise in extra to avoid creating obsolescence cycle (issue3664)...
r17811 book1 1:48bb6e53a15f
* book2 1:48bb6e53a15f
Idan Kamara
commit: add option to amend the working dir parent...
r16458
Pierre-Yves David
amend: prevent loss of bookmark on failed amend...
r18198 abort does not loose bookmarks
$ cat > editor.sh << '__EOF__'
> #!/bin/sh
> echo "" > "$1"
> __EOF__
$ echo a >> a
$ HGEDITOR="\"sh\" \"`pwd`/editor.sh\"" hg commit --amend
transaction abort!
rollback completed
abort: empty commit message
[255]
$ hg book
book1 1:48bb6e53a15f
* book2 1:48bb6e53a15f
$ hg revert -Caq
$ rm editor.sh
Idan Kamara
commit: add option to amend the working dir parent...
r16458 $ echo '[defaults]' >> $HGRCPATH
$ echo "commit=-d '0 0'" >> $HGRCPATH
Moving branches:
$ hg branch foo
marked working directory as branch foo
(branches are permanent and global, did you want a bookmark?)
$ echo a >> a
$ hg ci -m 'branch foo'
$ hg branch default -f
marked working directory as branch default
$ hg ci --amend -m 'back to default'
Durham Goode
bundles: do not overwrite existing backup bundles (BC)...
r23835 saved backup bundle to $TESTTMP/.hg/strip-backup/8ac881fbf49d-fd962fef-amend-backup.hg (glob)
Idan Kamara
commit: add option to amend the working dir parent...
r16458 $ hg branches
Pierre-Yves David
amend: add noise in extra to avoid creating obsolescence cycle (issue3664)...
r17811 default 2:ce12b0b57d46
Idan Kamara
commit: add option to amend the working dir parent...
r16458
Close branch:
$ hg up -q 0
$ echo b >> b
$ hg branch foo
marked working directory as branch foo
(branches are permanent and global, did you want a bookmark?)
$ hg ci -Am 'fork'
adding b
$ echo b >> b
$ hg ci -mb
$ hg ci --amend --close-branch -m 'closing branch foo'
Durham Goode
bundles: do not overwrite existing backup bundles (BC)...
r23835 saved backup bundle to $TESTTMP/.hg/strip-backup/c962248fa264-6701c392-amend-backup.hg (glob)
Idan Kamara
commit: add option to amend the working dir parent...
r16458
Same thing, different code path:
$ echo b >> b
$ hg ci -m 'reopen branch'
reopening closed branch head 4
$ echo b >> b
$ hg ci --amend --close-branch
Durham Goode
bundles: do not overwrite existing backup bundles (BC)...
r23835 saved backup bundle to $TESTTMP/.hg/strip-backup/027371728205-49c0c55d-amend-backup.hg (glob)
Idan Kamara
commit: add option to amend the working dir parent...
r16458 $ hg branches
Pierre-Yves David
amend: add noise in extra to avoid creating obsolescence cycle (issue3664)...
r17811 default 2:ce12b0b57d46
Idan Kamara
commit: add option to amend the working dir parent...
r16458
Brodie Rao
amend: support amending merge changesets (issue3778)
r18909 Refuse to amend during a merge:
Idan Kamara
commit: add option to amend the working dir parent...
r16458
$ hg up -q default
$ hg merge foo
1 files updated, 0 files merged, 0 files removed, 0 files unresolved
(branch merge, don't forget to commit)
$ hg ci --amend
abort: cannot amend while merging
[255]
$ hg ci -m 'merge'
Follow copies/renames:
$ hg mv b c
$ hg ci -m 'b -> c'
$ hg mv c d
$ hg ci --amend -m 'b -> d'
Durham Goode
bundles: do not overwrite existing backup bundles (BC)...
r23835 saved backup bundle to $TESTTMP/.hg/strip-backup/b8c6eac7f12e-adaaa8b1-amend-backup.hg (glob)
Mads Kiilerich
tests: ^ must be quoted when used on solaris sh...
r16483 $ hg st --rev '.^' --copies d
Idan Kamara
commit: add option to amend the working dir parent...
r16458 A d
b
$ hg cp d e
$ hg ci -m 'e = d'
$ hg cp e f
$ hg ci --amend -m 'f = d'
Durham Goode
bundles: do not overwrite existing backup bundles (BC)...
r23835 saved backup bundle to $TESTTMP/.hg/strip-backup/7f9761d65613-d37aa788-amend-backup.hg (glob)
Mads Kiilerich
tests: ^ must be quoted when used on solaris sh...
r16483 $ hg st --rev '.^' --copies f
Idan Kamara
commit: add option to amend the working dir parent...
r16458 A f
d
Patrick Mezard
test-commit-amend: exhibit an --amend weirdness...
r16552 $ mv f f.orig
$ hg rm -A f
$ hg ci -m removef
$ hg cp a f
$ mv f.orig f
$ hg ci --amend -m replacef
Durham Goode
bundles: do not overwrite existing backup bundles (BC)...
r23835 saved backup bundle to $TESTTMP/.hg/strip-backup/9e8c5f7e3d95-90259f67-amend-backup.hg (glob)
Patrick Mezard
test-commit-amend: exhibit an --amend weirdness...
r16552 $ hg st --change . --copies
$ hg log -r . --template "{file_copies}\n"
Patrick Mezard
amend: fix copy records handling (issue3410)...
r16553
Move added file (issue3410):
$ echo g >> g
$ hg ci -Am g
adding g
$ hg mv g h
$ hg ci --amend
Durham Goode
bundles: do not overwrite existing backup bundles (BC)...
r23835 saved backup bundle to $TESTTMP/.hg/strip-backup/24aa8eacce2b-7059e0f1-amend-backup.hg (glob)
Patrick Mezard
amend: fix copy records handling (issue3410)...
r16553 $ hg st --change . --copies h
A h
$ hg log -r . --template "{file_copies}\n"
Patrick Mezard
test-commit-amend: exhibit an --amend weirdness...
r16552
Idan Kamara
commit: add option to amend the working dir parent...
r16458 Can't rollback an amend:
$ hg rollback
no rollback information available
[1]
Idan Kamara
amend: preserve extra dict (issue3430)
r16630
Preserve extra dict (issue3430):
$ hg branch a
marked working directory as branch a
(branches are permanent and global, did you want a bookmark?)
$ echo a >> a
$ hg ci -ma
$ hg ci --amend -m "a'"
Durham Goode
bundles: do not overwrite existing backup bundles (BC)...
r23835 saved backup bundle to $TESTTMP/.hg/strip-backup/3837aa2a2fdb-2be01fd1-amend-backup.hg (glob)
Idan Kamara
amend: preserve extra dict (issue3430)
r16630 $ hg log -r . --template "{branch}\n"
a
$ hg ci --amend -m "a''"
Durham Goode
bundles: do not overwrite existing backup bundles (BC)...
r23835 saved backup bundle to $TESTTMP/.hg/strip-backup/c05c06be7514-ed28c4cd-amend-backup.hg (glob)
Idan Kamara
amend: preserve extra dict (issue3430)
r16630 $ hg log -r . --template "{branch}\n"
a
Also preserve other entries in the dict that are in the old commit,
first graft something so there's an additional entry:
$ hg up 0 -q
$ echo z > z
$ hg ci -Am 'fork'
adding z
created new head
$ hg up 11
5 files updated, 0 files merged, 1 files removed, 0 files unresolved
$ hg graft 12
Mads Kiilerich
graft: show more useful status information while grafting...
r23505 grafting 12:2647734878ef "fork" (tip)
Idan Kamara
amend: preserve extra dict (issue3430)
r16630 $ hg ci --amend -m 'graft amend'
Durham Goode
bundles: do not overwrite existing backup bundles (BC)...
r23835 saved backup bundle to $TESTTMP/.hg/strip-backup/bd010aea3f39-eedb103b-amend-backup.hg (glob)
Idan Kamara
amend: preserve extra dict (issue3430)
r16630 $ hg log -r . --debug | grep extra
Pierre-Yves David
amend: add noise in extra to avoid creating obsolescence cycle (issue3664)...
r17811 extra: amend_source=bd010aea3f39f3fb2a2f884b9ccb0471cd77398e
Idan Kamara
amend: preserve extra dict (issue3430)
r16630 extra: branch=a
extra: source=2647734878ef0236dda712fae9c1651cf694ea8a
Pierre-Yves David
amend: preserve phase of amended revision (issue3602)...
r17461
Preserve phase
$ hg phase '.^::.'
11: draft
13: draft
$ hg phase --secret --force .
$ hg phase '.^::.'
11: draft
13: secret
$ hg commit --amend -m 'amend for phase' -q
$ hg phase '.^::.'
11: draft
13: secret
Pierre-Yves David
amend: add obsolete support...
r17475 Test amend with obsolete
---------------------------
Enable obsolete
Durham Goode
obsolete: update test-commit-amend to use obsolete option...
r22956 $ cat >> $HGRCPATH << EOF
> [experimental]
> evolution=createmarkers,allowunstable
Pierre-Yves David
amend: add obsolete support...
r17475 > EOF
Amend with no files changes
$ hg id -n
13
$ hg ci --amend -m 'babar'
$ hg id -n
14
$ hg log -Gl 3 --style=compact
Pierre-Yves David
amend: add noise in extra to avoid creating obsolescence cycle (issue3664)...
r17811 @ 14[tip]:11 b650e6ee8614 1970-01-01 00:00 +0000 test
Pierre-Yves David
amend: add obsolete support...
r17475 | babar
|
| o 12:0 2647734878ef 1970-01-01 00:00 +0000 test
| | fork
Martijn Pieters
graphmod: set default edge styles for ascii graphs (BC)...
r28627 | ~
o 11 3334b7925910 1970-01-01 00:00 +0000 test
| a''
~
Pierre-Yves David
amend: add obsolete support...
r17475 $ hg log -Gl 4 --hidden --style=compact
Pierre-Yves David
amend: add noise in extra to avoid creating obsolescence cycle (issue3664)...
r17811 @ 14[tip]:11 b650e6ee8614 1970-01-01 00:00 +0000 test
Pierre-Yves David
amend: add obsolete support...
r17475 | babar
|
Pierre-Yves David
amend: add noise in extra to avoid creating obsolescence cycle (issue3664)...
r17811 | x 13:11 68ff8ff97044 1970-01-01 00:00 +0000 test
Pierre-Yves David
amend: add obsolete support...
r17475 |/ amend for phase
|
| o 12:0 2647734878ef 1970-01-01 00:00 +0000 test
| | fork
Martijn Pieters
graphmod: set default edge styles for ascii graphs (BC)...
r28627 | ~
o 11 3334b7925910 1970-01-01 00:00 +0000 test
| a''
~
Pierre-Yves David
amend: add obsolete support...
r17475
Amend with files changes
(note: the extra commit over 15 is a temporary junk I would be happy to get
ride of)
$ echo 'babar' >> a
$ hg commit --amend
$ hg log -Gl 6 --hidden --style=compact
Pierre-Yves David
amend: add noise in extra to avoid creating obsolescence cycle (issue3664)...
r17811 @ 16[tip]:11 9f9e9bccf56c 1970-01-01 00:00 +0000 test
Pierre-Yves David
amend: add obsolete support...
r17475 | babar
|
Pierre-Yves David
amend: add noise in extra to avoid creating obsolescence cycle (issue3664)...
r17811 | x 15 90fef497c56f 1970-01-01 00:00 +0000 test
| | temporary amend commit for b650e6ee8614
Pierre-Yves David
amend: add obsolete support...
r17475 | |
Pierre-Yves David
amend: add noise in extra to avoid creating obsolescence cycle (issue3664)...
r17811 | x 14:11 b650e6ee8614 1970-01-01 00:00 +0000 test
Pierre-Yves David
amend: add obsolete support...
r17475 |/ babar
|
Pierre-Yves David
amend: add noise in extra to avoid creating obsolescence cycle (issue3664)...
r17811 | x 13:11 68ff8ff97044 1970-01-01 00:00 +0000 test
Pierre-Yves David
amend: add obsolete support...
r17475 |/ amend for phase
|
| o 12:0 2647734878ef 1970-01-01 00:00 +0000 test
| | fork
Martijn Pieters
graphmod: set default edge styles for ascii graphs (BC)...
r28627 | ~
o 11 3334b7925910 1970-01-01 00:00 +0000 test
| a''
~
Pierre-Yves David
amend: add obsolete support...
r17475
Kevin Bullock
tests: more comment cleanup related to obsolescence
r18399 Test that amend does not make it easy to create obsolescence cycle
Pierre-Yves David
amend: add noise in extra to avoid creating obsolescence cycle (issue3664)...
r17811 ---------------------------------------------------------------------
Pierre-Yves David
clfilter: enforce hidden changeset globally...
r18267 $ hg id -r 14 --hidden
Pierre-Yves David
amend: add noise in extra to avoid creating obsolescence cycle (issue3664)...
r17811 b650e6ee8614 (a)
Pierre-Yves David
clfilter: enforce hidden changeset globally...
r18267 $ hg revert -ar 14 --hidden
Pierre-Yves David
amend: add noise in extra to avoid creating obsolescence cycle (issue3664)...
r17811 reverting a
$ hg commit --amend
$ hg id
b99e5df575f7 (a) tip
Pierre-Yves David
amend: allow amend of non-head when obsolete is enabled...
r18163
Pierre-Yves David
test: fix in-test comments related to obsolescence...
r18398 Test that rewriting leaving instability behind is allowed
Pierre-Yves David
amend: allow amend of non-head when obsolete is enabled...
r18163 ---------------------------------------------------------------------
$ hg up '.^'
0 files updated, 0 files merged, 1 files removed, 0 files unresolved
$ echo 'b' >> a
$ hg log --style compact -r 'children(.)'
18[tip]:11 b99e5df575f7 1970-01-01 00:00 +0000 test
babar
$ hg commit --amend
$ hg log -r 'unstable()'
changeset: 18:b99e5df575f7
branch: a
parent: 11:3334b7925910
user: test
date: Thu Jan 01 00:00:00 1970 +0000
Denis Laxalde
cmdutil: add support for evolution "troubles" display in changeset_printer...
r30695 trouble: unstable
Pierre-Yves David
amend: allow amend of non-head when obsolete is enabled...
r18163 summary: babar
Brodie Rao
amend: support amending merge changesets (issue3778)
r18909
Amend a merge changeset (with renames and conflicts from the second parent):
$ hg up -q default
$ hg branch -q bar
$ hg cp a aa
$ hg mv z zz
$ echo cc > cc
$ hg add cc
$ hg ci -m aazzcc
$ hg up -q default
$ echo a >> a
$ echo dd > cc
$ hg add cc
$ hg ci -m aa
$ hg merge -q bar
Siddharth Agarwal
simplemerge: move conflict warning message to filemerge...
r26614 warning: conflicts while merging cc! (edit, then use 'hg resolve --mark')
Brodie Rao
amend: support amending merge changesets (issue3778)
r18909 [1]
$ hg resolve -m cc
Pierre-Yves David
resolve: add parenthesis around "no more unresolved files" message...
r21947 (no more unresolved files)
Brodie Rao
amend: support amending merge changesets (issue3778)
r18909 $ hg ci -m 'merge bar'
$ hg log --config diff.git=1 -pr .
Kostia Balytskyi
conflicts: make spacing consistent in conflict markers...
r30460 changeset: 23:163cfd7219f7
Brodie Rao
amend: support amending merge changesets (issue3778)
r18909 tag: tip
parent: 22:30d96aeaf27b
parent: 21:1aa437659d19
user: test
date: Thu Jan 01 00:00:00 1970 +0000
summary: merge bar
diff --git a/a b/aa
copy from a
copy to aa
diff --git a/cc b/cc
--- a/cc
+++ b/cc
@@ -1,1 +1,5 @@
Simon Farnsworth
merge: add conflict labels to merge command...
r30062 +<<<<<<< working copy: 30d96aeaf27b - test: aa
Brodie Rao
amend: support amending merge changesets (issue3778)
r18909 dd
+=======
+cc
Kostia Balytskyi
conflicts: make spacing consistent in conflict markers...
r30460 +>>>>>>> merge rev: 1aa437659d19 bar - test: aazzcc
Brodie Rao
amend: support amending merge changesets (issue3778)
r18909 diff --git a/z b/zz
rename from z
rename to zz
$ hg debugrename aa
aa renamed from a:a80d06849b333b8a3d5c445f8ba3142010dcdc9e
$ hg debugrename zz
zz renamed from z:69a1b67522704ec122181c0890bd16e9d3e7516a
$ hg debugrename cc
cc not renamed
FUJIWARA Katsunori
commit: change "editform" to distinguish merge commits from other (--amend)...
r22249 $ HGEDITOR="sh .hg/checkeditform.sh" hg ci --amend -m 'merge bar (amend message)' --edit
HGEDITFORM=commit.amend.merge
Brodie Rao
amend: support amending merge changesets (issue3778)
r18909 $ hg log --config diff.git=1 -pr .
Kostia Balytskyi
conflicts: make spacing consistent in conflict markers...
r30460 changeset: 24:bca52d4ed186
Brodie Rao
amend: support amending merge changesets (issue3778)
r18909 tag: tip
parent: 22:30d96aeaf27b
parent: 21:1aa437659d19
user: test
date: Thu Jan 01 00:00:00 1970 +0000
summary: merge bar (amend message)
diff --git a/a b/aa
copy from a
copy to aa
diff --git a/cc b/cc
--- a/cc
+++ b/cc
@@ -1,1 +1,5 @@
Simon Farnsworth
merge: add conflict labels to merge command...
r30062 +<<<<<<< working copy: 30d96aeaf27b - test: aa
Brodie Rao
amend: support amending merge changesets (issue3778)
r18909 dd
+=======
+cc
Kostia Balytskyi
conflicts: make spacing consistent in conflict markers...
r30460 +>>>>>>> merge rev: 1aa437659d19 bar - test: aazzcc
Brodie Rao
amend: support amending merge changesets (issue3778)
r18909 diff --git a/z b/zz
rename from z
rename to zz
$ hg debugrename aa
aa renamed from a:a80d06849b333b8a3d5c445f8ba3142010dcdc9e
$ hg debugrename zz
zz renamed from z:69a1b67522704ec122181c0890bd16e9d3e7516a
$ hg debugrename cc
cc not renamed
$ hg mv zz z
$ hg ci --amend -m 'merge bar (undo rename)'
$ hg log --config diff.git=1 -pr .
Kostia Balytskyi
conflicts: make spacing consistent in conflict markers...
r30460 changeset: 26:12594a98ca3f
Brodie Rao
amend: support amending merge changesets (issue3778)
r18909 tag: tip
parent: 22:30d96aeaf27b
parent: 21:1aa437659d19
user: test
date: Thu Jan 01 00:00:00 1970 +0000
summary: merge bar (undo rename)
diff --git a/a b/aa
copy from a
copy to aa
diff --git a/cc b/cc
--- a/cc
+++ b/cc
@@ -1,1 +1,5 @@
Simon Farnsworth
merge: add conflict labels to merge command...
r30062 +<<<<<<< working copy: 30d96aeaf27b - test: aa
Brodie Rao
amend: support amending merge changesets (issue3778)
r18909 dd
+=======
+cc
Kostia Balytskyi
conflicts: make spacing consistent in conflict markers...
r30460 +>>>>>>> merge rev: 1aa437659d19 bar - test: aazzcc
Brodie Rao
amend: support amending merge changesets (issue3778)
r18909
$ hg debugrename z
z not renamed
Amend a merge changeset (with renames during the merge):
$ hg up -q bar
$ echo x > x
$ hg add x
$ hg ci -m x
$ hg up -q default
$ hg merge -q bar
$ hg mv aa aaa
$ echo aa >> aaa
$ hg ci -m 'merge bar again'
$ hg log --config diff.git=1 -pr .
Kostia Balytskyi
conflicts: make spacing consistent in conflict markers...
r30460 changeset: 28:dffde028b388
Brodie Rao
amend: support amending merge changesets (issue3778)
r18909 tag: tip
Kostia Balytskyi
conflicts: make spacing consistent in conflict markers...
r30460 parent: 26:12594a98ca3f
Brodie Rao
amend: support amending merge changesets (issue3778)
r18909 parent: 27:4c94d5bc65f5
user: test
date: Thu Jan 01 00:00:00 1970 +0000
summary: merge bar again
diff --git a/aa b/aa
deleted file mode 100644
--- a/aa
+++ /dev/null
@@ -1,2 +0,0 @@
-a
-a
diff --git a/aaa b/aaa
new file mode 100644
--- /dev/null
+++ b/aaa
@@ -0,0 +1,3 @@
+a
+a
+aa
diff --git a/x b/x
new file mode 100644
--- /dev/null
+++ b/x
@@ -0,0 +1,1 @@
+x
$ hg debugrename aaa
aaa renamed from aa:37d9b5d994eab34eda9c16b195ace52c7b129980
$ hg mv aaa aa
$ hg ci --amend -m 'merge bar again (undo rename)'
$ hg log --config diff.git=1 -pr .
Kostia Balytskyi
conflicts: make spacing consistent in conflict markers...
r30460 changeset: 30:18e3ba160489
Brodie Rao
amend: support amending merge changesets (issue3778)
r18909 tag: tip
Kostia Balytskyi
conflicts: make spacing consistent in conflict markers...
r30460 parent: 26:12594a98ca3f
Brodie Rao
amend: support amending merge changesets (issue3778)
r18909 parent: 27:4c94d5bc65f5
user: test
date: Thu Jan 01 00:00:00 1970 +0000
summary: merge bar again (undo rename)
diff --git a/aa b/aa
--- a/aa
+++ b/aa
@@ -1,2 +1,3 @@
a
a
+aa
diff --git a/x b/x
new file mode 100644
--- /dev/null
+++ b/x
@@ -0,0 +1,1 @@
+x
$ hg debugrename aa
aa not renamed
Augie Fackler
test-commit-amend.t: fix check-code violation from 3a72c89a83ec
r18912 $ hg debugrename -r '.^' aa
Brodie Rao
amend: support amending merge changesets (issue3778)
r18909 aa renamed from a:a80d06849b333b8a3d5c445f8ba3142010dcdc9e
Amend a merge changeset (with manifest-level conflicts):
$ hg up -q bar
$ hg rm aa
$ hg ci -m 'rm aa'
$ hg up -q default
$ echo aa >> aa
$ hg ci -m aa
Siddharth Agarwal
tests: explicitly request changed version in c/d conflict in test-commit-amend.t...
r27597 $ hg merge -q bar --config ui.interactive=True << EOF
> c
> EOF
Simon Farnsworth
merge: add conflict labels to merge command...
r30062 local [working copy] changed aa which other [merge rev] deleted
Siddharth Agarwal
filemerge: add a 'leave unresolved' option to change/delete prompts...
r27163 use (c)hanged version, (d)elete, or leave (u)nresolved? c
Brodie Rao
amend: support amending merge changesets (issue3778)
r18909 $ hg ci -m 'merge bar (with conflicts)'
$ hg log --config diff.git=1 -pr .
Kostia Balytskyi
conflicts: make spacing consistent in conflict markers...
r30460 changeset: 33:b4c3035e2544
Brodie Rao
amend: support amending merge changesets (issue3778)
r18909 tag: tip
Kostia Balytskyi
conflicts: make spacing consistent in conflict markers...
r30460 parent: 32:4b216ca5ba97
Brodie Rao
amend: support amending merge changesets (issue3778)
r18909 parent: 31:67db8847a540
user: test
date: Thu Jan 01 00:00:00 1970 +0000
summary: merge bar (with conflicts)
$ hg rm aa
$ hg ci --amend -m 'merge bar (with conflicts, amended)'
$ hg log --config diff.git=1 -pr .
Kostia Balytskyi
conflicts: make spacing consistent in conflict markers...
r30460 changeset: 35:1205ed810051
Brodie Rao
amend: support amending merge changesets (issue3778)
r18909 tag: tip
Kostia Balytskyi
conflicts: make spacing consistent in conflict markers...
r30460 parent: 32:4b216ca5ba97
Brodie Rao
amend: support amending merge changesets (issue3778)
r18909 parent: 31:67db8847a540
user: test
date: Thu Jan 01 00:00:00 1970 +0000
summary: merge bar (with conflicts, amended)
diff --git a/aa b/aa
deleted file mode 100644
--- a/aa
+++ /dev/null
@@ -1,4 +0,0 @@
-a
-a
-aa
-aa
Iulian Stana
commit: amending with --close-branch (issue3445)...
r19305 Issue 3445: amending with --close-branch a commit that created a new head should fail
This shouldn't be possible:
$ hg up -q default
$ hg branch closewithamend
marked working directory as branch closewithamend
FUJIWARA Katsunori
memctx: calculate manifest including newly added files correctly...
r23588 $ echo foo > foo
Durham Goode
obsolete: update test-commit-amend to use obsolete option...
r22956 $ hg add foo
Pierre-Yves David
test: do not add .pyc and .orig in test-commit-amend.t (issue4085)...
r19980 $ hg ci -m..
Iulian Stana
commit: amending with --close-branch (issue3445)...
r19305 $ hg ci --amend --close-branch -m 'closing'
abort: can only close branch heads
[255]
This silliness fails:
$ hg branch silliness
marked working directory as branch silliness
$ echo b >> b
$ hg ci --close-branch -m'open and close'
abort: can only close branch heads
[255]
FUJIWARA Katsunori
commit: create new amend changeset as secret correctly for "--secret" option...
r20700
Test that amend with --secret creates new secret changeset forcibly
---------------------------------------------------------------------
$ hg phase '.^::.'
35: draft
36: draft
$ hg commit --amend --secret -m 'amend as secret' -q
$ hg phase '.^::.'
35: draft
38: secret
FUJIWARA Katsunori
amend: invoke editor forcibly when "--edit" option is specified...
r21036
Test that amend with --edit invokes editor forcibly
---------------------------------------------------
$ hg parents --template "{desc}\n"
amend as secret
$ HGEDITOR=cat hg commit --amend -m "editor should be suppressed"
$ hg parents --template "{desc}\n"
editor should be suppressed
FUJIWARA Katsunori
memctx: calculate exact status being committed from specified files...
r23587 $ hg status --rev '.^1::.'
A foo
FUJIWARA Katsunori
amend: invoke editor forcibly when "--edit" option is specified...
r21036 $ HGEDITOR=cat hg commit --amend -m "editor should be invoked" --edit
editor should be invoked
HG: Enter commit message. Lines beginning with 'HG:' are removed.
HG: Leave message empty to abort commit.
HG: --
HG: user: test
HG: branch 'silliness'
FUJIWARA Katsunori
memctx: calculate exact status being committed from specified files...
r23587 HG: added foo
FUJIWARA Katsunori
amend: invoke editor forcibly when "--edit" option is specified...
r21036 $ hg parents --template "{desc}\n"
editor should be invoked
Ryan McElroy
amend: fix amending rename commit with diverged topologies (issue4405)...
r23071
FUJIWARA Katsunori
memctx: calculate manifest including newly added files correctly...
r23588 Test that "diff()" in committemplate works correctly for amending
-----------------------------------------------------------------
$ cat >> .hg/hgrc <<EOF
> [committemplate]
> changeset.commit.amend = {desc}\n
> HG: M: {file_mods}
> HG: A: {file_adds}
> HG: R: {file_dels}
> {splitlines(diff()) % 'HG: {line}\n'}
> EOF
$ hg parents --template "M: {file_mods}\nA: {file_adds}\nR: {file_dels}\n"
M:
A: foo
R:
$ hg status -amr
$ HGEDITOR=cat hg commit --amend -e -m "expecting diff of foo"
expecting diff of foo
HG: M:
HG: A: foo
HG: R:
Kostia Balytskyi
conflicts: make spacing consistent in conflict markers...
r30460 HG: diff -r 1205ed810051 foo
FUJIWARA Katsunori
memctx: calculate manifest including newly added files correctly...
r23588 HG: --- /dev/null Thu Jan 01 00:00:00 1970 +0000
HG: +++ b/foo Thu Jan 01 00:00:00 1970 +0000
HG: @@ -0,0 +1,1 @@
HG: +foo
$ echo y > y
$ hg add y
$ HGEDITOR=cat hg commit --amend -e -m "expecting diff of foo and y"
expecting diff of foo and y
HG: M:
HG: A: foo y
HG: R:
Kostia Balytskyi
conflicts: make spacing consistent in conflict markers...
r30460 HG: diff -r 1205ed810051 foo
FUJIWARA Katsunori
memctx: calculate manifest including newly added files correctly...
r23588 HG: --- /dev/null Thu Jan 01 00:00:00 1970 +0000
HG: +++ b/foo Thu Jan 01 00:00:00 1970 +0000
HG: @@ -0,0 +1,1 @@
HG: +foo
Kostia Balytskyi
conflicts: make spacing consistent in conflict markers...
r30460 HG: diff -r 1205ed810051 y
FUJIWARA Katsunori
memctx: calculate manifest including newly added files correctly...
r23588 HG: --- /dev/null Thu Jan 01 00:00:00 1970 +0000
HG: +++ b/y Thu Jan 01 00:00:00 1970 +0000
HG: @@ -0,0 +1,1 @@
HG: +y
FUJIWARA Katsunori
memctx: calculate manifest correctly with newly-removed files (issue4470)...
r23589 $ hg rm a
$ HGEDITOR=cat hg commit --amend -e -m "expecting diff of a, foo and y"
expecting diff of a, foo and y
HG: M:
HG: A: foo y
HG: R: a
Kostia Balytskyi
conflicts: make spacing consistent in conflict markers...
r30460 HG: diff -r 1205ed810051 a
FUJIWARA Katsunori
memctx: calculate manifest correctly with newly-removed files (issue4470)...
r23589 HG: --- a/a Thu Jan 01 00:00:00 1970 +0000
HG: +++ /dev/null Thu Jan 01 00:00:00 1970 +0000
HG: @@ -1,2 +0,0 @@
HG: -a
HG: -a
Kostia Balytskyi
conflicts: make spacing consistent in conflict markers...
r30460 HG: diff -r 1205ed810051 foo
FUJIWARA Katsunori
memctx: calculate manifest correctly with newly-removed files (issue4470)...
r23589 HG: --- /dev/null Thu Jan 01 00:00:00 1970 +0000
HG: +++ b/foo Thu Jan 01 00:00:00 1970 +0000
HG: @@ -0,0 +1,1 @@
HG: +foo
Kostia Balytskyi
conflicts: make spacing consistent in conflict markers...
r30460 HG: diff -r 1205ed810051 y
FUJIWARA Katsunori
memctx: calculate manifest correctly with newly-removed files (issue4470)...
r23589 HG: --- /dev/null Thu Jan 01 00:00:00 1970 +0000
HG: +++ b/y Thu Jan 01 00:00:00 1970 +0000
HG: @@ -0,0 +1,1 @@
HG: +y
$ hg rm x
$ HGEDITOR=cat hg commit --amend -e -m "expecting diff of a, foo, x and y"
expecting diff of a, foo, x and y
HG: M:
HG: A: foo y
HG: R: a x
Kostia Balytskyi
conflicts: make spacing consistent in conflict markers...
r30460 HG: diff -r 1205ed810051 a
FUJIWARA Katsunori
memctx: calculate manifest correctly with newly-removed files (issue4470)...
r23589 HG: --- a/a Thu Jan 01 00:00:00 1970 +0000
HG: +++ /dev/null Thu Jan 01 00:00:00 1970 +0000
HG: @@ -1,2 +0,0 @@
HG: -a
HG: -a
Kostia Balytskyi
conflicts: make spacing consistent in conflict markers...
r30460 HG: diff -r 1205ed810051 foo
FUJIWARA Katsunori
memctx: calculate manifest correctly with newly-removed files (issue4470)...
r23589 HG: --- /dev/null Thu Jan 01 00:00:00 1970 +0000
HG: +++ b/foo Thu Jan 01 00:00:00 1970 +0000
HG: @@ -0,0 +1,1 @@
HG: +foo
Kostia Balytskyi
conflicts: make spacing consistent in conflict markers...
r30460 HG: diff -r 1205ed810051 x
FUJIWARA Katsunori
memctx: calculate manifest correctly with newly-removed files (issue4470)...
r23589 HG: --- a/x Thu Jan 01 00:00:00 1970 +0000
HG: +++ /dev/null Thu Jan 01 00:00:00 1970 +0000
HG: @@ -1,1 +0,0 @@
HG: -x
Kostia Balytskyi
conflicts: make spacing consistent in conflict markers...
r30460 HG: diff -r 1205ed810051 y
FUJIWARA Katsunori
memctx: calculate manifest correctly with newly-removed files (issue4470)...
r23589 HG: --- /dev/null Thu Jan 01 00:00:00 1970 +0000
HG: +++ b/y Thu Jan 01 00:00:00 1970 +0000
HG: @@ -0,0 +1,1 @@
HG: +y
FUJIWARA Katsunori
memctx: calculate manifest including newly added files correctly...
r23588
FUJIWARA Katsunori
templatekw: compare target context and its parent exactly (issue4690)...
r25392 $ echo cccc >> cc
$ hg status -amr
M cc
$ HGEDITOR=cat hg commit --amend -e -m "cc should be excluded" -X cc
cc should be excluded
HG: M:
HG: A: foo y
HG: R: a x
Kostia Balytskyi
conflicts: make spacing consistent in conflict markers...
r30460 HG: diff -r 1205ed810051 a
FUJIWARA Katsunori
templatekw: compare target context and its parent exactly (issue4690)...
r25392 HG: --- a/a Thu Jan 01 00:00:00 1970 +0000
HG: +++ /dev/null Thu Jan 01 00:00:00 1970 +0000
HG: @@ -1,2 +0,0 @@
HG: -a
HG: -a
Kostia Balytskyi
conflicts: make spacing consistent in conflict markers...
r30460 HG: diff -r 1205ed810051 foo
FUJIWARA Katsunori
templatekw: compare target context and its parent exactly (issue4690)...
r25392 HG: --- /dev/null Thu Jan 01 00:00:00 1970 +0000
HG: +++ b/foo Thu Jan 01 00:00:00 1970 +0000
HG: @@ -0,0 +1,1 @@
HG: +foo
Kostia Balytskyi
conflicts: make spacing consistent in conflict markers...
r30460 HG: diff -r 1205ed810051 x
FUJIWARA Katsunori
templatekw: compare target context and its parent exactly (issue4690)...
r25392 HG: --- a/x Thu Jan 01 00:00:00 1970 +0000
HG: +++ /dev/null Thu Jan 01 00:00:00 1970 +0000
HG: @@ -1,1 +0,0 @@
HG: -x
Kostia Balytskyi
conflicts: make spacing consistent in conflict markers...
r30460 HG: diff -r 1205ed810051 y
FUJIWARA Katsunori
templatekw: compare target context and its parent exactly (issue4690)...
r25392 HG: --- /dev/null Thu Jan 01 00:00:00 1970 +0000
HG: +++ b/y Thu Jan 01 00:00:00 1970 +0000
HG: @@ -0,0 +1,1 @@
HG: +y
Ryan McElroy
amend: fix amending rename commit with diverged topologies (issue4405)...
r23071 Check for issue4405
-------------------
Setup the repo with a file that gets moved in a second commit.
$ hg init repo
$ cd repo
$ touch a0
$ hg add a0
$ hg commit -m a0
$ hg mv a0 a1
$ hg commit -m a1
$ hg up -q 0
$ hg log -G --template '{rev} {desc}'
o 1 a1
|
@ 0 a0
Now we branch the repro, but re-use the file contents, so we have a divergence
in the file revlog topology and the changelog topology.
$ hg revert --rev 1 --all
removing a0
adding a1
$ hg ci -qm 'a1-amend'
$ hg log -G --template '{rev} {desc}'
@ 2 a1-amend
|
| o 1 a1
|/
o 0 a0
The way mercurial does amends is to create a temporary commit (rev 3) and then
fold the new and old commits together into another commit (rev 4). During this
Mads Kiilerich
spelling: fixes from proofreading of spell checker issues
r23139 process, _findlimit is called to check how far back to look for the transitive
Ryan McElroy
amend: fix amending rename commit with diverged topologies (issue4405)...
r23071 closure of file copy information, but due to the divergence of the filelog
Mads Kiilerich
spelling: fixes from proofreading of spell checker issues
r23139 and changelog graph topologies, before _findlimit was fixed, it returned a rev
Ryan McElroy
amend: fix amending rename commit with diverged topologies (issue4405)...
r23071 which was not far enough back in this case.
$ hg mv a1 a2
$ hg status --copies --rev 0
A a2
a0
R a0
$ hg ci --amend -q
$ hg log -G --template '{rev} {desc}'
@ 4 a1-amend
|
| o 1 a1
|/
o 0 a0
Before the fix, the copy information was lost.
$ hg status --copies --rev 0
A a2
a0
R a0
Pierre-Yves David
amend: check for directory renames for both merge parents (issue4516)...
r24169 $ cd ..
Check that amend properly preserve rename from directory rename (issue-4516)
If a parent of the merge renames a full directory, any files added to the old
directory in the other parent will be renamed to the new directory. For some
reason, the rename metadata was when amending such merge. This test ensure we
do not regress. We have a dedicated repo because it needs a setup with renamed
directory)
$ hg init issue4516
$ cd issue4516
$ mkdir olddirname
$ echo line1 > olddirname/commonfile.py
$ hg add olddirname/commonfile.py
$ hg ci -m first
$ hg branch newdirname
marked working directory as branch newdirname
(branches are permanent and global, did you want a bookmark?)
$ hg mv olddirname newdirname
moving olddirname/commonfile.py to newdirname/commonfile.py (glob)
$ hg ci -m rename
$ hg update default
1 files updated, 0 files merged, 1 files removed, 0 files unresolved
$ echo line1 > olddirname/newfile.py
$ hg add olddirname/newfile.py
$ hg ci -m log
$ hg up newdirname
1 files updated, 0 files merged, 2 files removed, 0 files unresolved
$ # create newdirname/newfile.py
$ hg merge default
1 files updated, 0 files merged, 0 files removed, 0 files unresolved
(branch merge, don't forget to commit)
$ hg ci -m add
$
$ hg debugrename newdirname/newfile.py
Matt Harbison
test-commit-amend: add globs for Windows
r24229 newdirname/newfile.py renamed from olddirname/newfile.py:690b295714aed510803d3020da9c70fca8336def (glob)
Pierre-Yves David
amend: check for directory renames for both merge parents (issue4516)...
r24169 $ hg status -C --change .
A newdirname/newfile.py
$ hg status -C --rev 1
A newdirname/newfile.py
$ hg status -C --rev 2
A newdirname/commonfile.py
olddirname/commonfile.py
A newdirname/newfile.py
olddirname/newfile.py
R olddirname/commonfile.py
R olddirname/newfile.py
$ hg debugindex newdirname/newfile.py
Pierre-Yves David
test: use general delta for 'test-commit-amend.t'...
r26927 rev offset length delta linkrev nodeid p1 p2
Gregory Szorc
revlog: make compressed size comparisons consistent...
r30792 0 0 89 -1 3 34a4d536c0c0 000000000000 000000000000
Pierre-Yves David
amend: check for directory renames for both merge parents (issue4516)...
r24169
$ echo a >> newdirname/commonfile.py
$ hg ci --amend -m bug
$ hg debugrename newdirname/newfile.py
Matt Harbison
test-commit-amend: add globs for Windows
r24229 newdirname/newfile.py renamed from olddirname/newfile.py:690b295714aed510803d3020da9c70fca8336def (glob)
Pierre-Yves David
amend: check for directory renames for both merge parents (issue4516)...
r24169 $ hg debugindex newdirname/newfile.py
Pierre-Yves David
test: use general delta for 'test-commit-amend.t'...
r26927 rev offset length delta linkrev nodeid p1 p2
Gregory Szorc
revlog: make compressed size comparisons consistent...
r30792 0 0 89 -1 3 34a4d536c0c0 000000000000 000000000000
Pierre-Yves David
amend: check for directory renames for both merge parents (issue4516)...
r24169
FUJIWARA Katsunori
tests: test preserving execbit changes at amending only on execbit platform
r30240 #if execbit
Mateusz Kwapich
localrepo: prevent executable-bit only changes from being lost on amend...
r29181 Test if amend preserves executable bit changes
$ chmod +x newdirname/commonfile.py
$ hg ci -m chmod
$ hg ci --amend -m "chmod amended"
$ hg ci --amend -m "chmod amended second time"
$ hg log -p --git -r .
changeset: 8:b1326f52dddf
branch: newdirname
tag: tip
parent: 5:7fd235f7cb2f
user: test
date: Thu Jan 01 00:00:00 1970 +0000
summary: chmod amended second time
diff --git a/newdirname/commonfile.py b/newdirname/commonfile.py
old mode 100644
new mode 100755
FUJIWARA Katsunori
tests: test preserving execbit changes at amending only on execbit platform
r30240 #endif