2018-01-23 23:09:16 +03:00
|
|
|
$ . helpers-usechg.sh
|
|
|
|
|
2015-10-20 13:09:18 +03:00
|
|
|
$ cat << EOF >> $HGRCPATH
|
|
|
|
> [format]
|
|
|
|
> usegeneraldelta=yes
|
|
|
|
> EOF
|
|
|
|
|
2012-04-18 02:20:16 +04:00
|
|
|
$ 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
|
2017-11-28 03:20:45 +03:00
|
|
|
(see 'hg help phases' for details)
|
2012-04-18 02:20:16 +04:00
|
|
|
[255]
|
|
|
|
$ hg phase -r . -f -d
|
|
|
|
|
|
|
|
$ echo a >> a
|
|
|
|
$ hg ci -Am 'base1'
|
|
|
|
|
|
|
|
Nothing to amend:
|
|
|
|
|
cmdutil: make in-memory changes visible to external editor (issue4378)
Before this patch, external editor process for the commit log can't
view some in-memory changes (especially, of dirstate), because they
aren't written out until the end of transaction (or wlock).
This causes unexpected output of Mercurial commands spawned from that
editor process.
To make in-memory changes visible to external editor process, this
patch does:
- write (or schedule to write) in-memory dirstate changes, and
- set HG_PENDING environment variable, if:
- a transaction is running, and
- there are in-memory changes to be visible
"hg diff" spawned from external editor process for "hg qrefresh"
shows:
- "changes newly imported into the topmost" before ab68b153ce34(*)
- "all changes recorded in the topmost by refreshing" after this patch
(*) ab68b153ce34 changed steps invoking editor process
Even though backward compatibility may be broken, the latter behavior
looks reasonable, because "hg diff" spawned from the editor process
consistently shows "what changes new revision records" regardless of
invocation context.
In fact, issue4378 itself should be resolved by b46029eb5b29, which
made 'repo.transaction()' write in-memory dirstate changes out
explicitly before starting transaction. It also made "hg qrefresh"
imply 'dirstate.write()' before external editor invocation in call
chain below.
- mq.queue.refresh
- strip.strip
- repair.strip
- localrepository.transaction
- dirstate.write
- localrepository.commit
- invoke external editor
Though, this patch has '(issue4378)' in own summary line to indicate
that issues like issue4378 should be fixed by this.
BTW, this patch adds '-m' option to a 'hg ci --amend' execution in
'test-commit-amend.t', to avoid invoking external editor process.
In this case, "unsure" states may be changed to "clean" according to
timestamp or so on. These changes should be written into pending file,
if external editor invocation is required,
Then, writing dirstate changes out breaks stability of test, because
it shows "transaction abort!/rollback completed" occasionally.
Aborting after editor process invocation while commands below may
cause similar instability of tests, too (AFAIK, there is no more such
one, at this revision)
- commit --amend
- without --message/--logfile
- import
- without --message/--logfile,
- without --no-commit,
- without --bypass,
- one of below, and
- patch has no description text, or
- with --edit
- aborting at the 1st patch, which adds or removes file(s)
- if it only changes existing files, status is checked only for
changed files by 'scmutil.matchfiles()', and transition from
"unsure" to "normal" in dirstate doesn't occur (= dirstate
isn't changed, and written out)
- aborting at the 2nd or later patch implies other pending
changes (e.g. changelog), and always causes showing
"transaction abort!/rollback completed"
2015-10-16 19:15:34 +03:00
|
|
|
$ hg ci --amend -m 'base1'
|
2012-04-18 02:20:16 +04:00
|
|
|
nothing changed
|
|
|
|
[1]
|
|
|
|
|
2012-06-29 17:21:35 +04:00
|
|
|
$ cat >> $HGRCPATH <<EOF
|
|
|
|
> [hooks]
|
2012-09-03 20:25:50 +04:00
|
|
|
> pretxncommit.foo = sh -c "echo \\"pretxncommit \$HG_NODE\\"; hg id -r \$HG_NODE"
|
2012-06-29 17:21:35 +04:00
|
|
|
> EOF
|
2012-06-23 20:57:29 +04:00
|
|
|
|
2012-04-18 02:20:16 +04:00
|
|
|
Amending changeset with changes in working dir:
|
2012-11-13 20:41:56 +04:00
|
|
|
(and check that --message does not trigger an editor)
|
2012-04-18 02:20:16 +04:00
|
|
|
|
|
|
|
$ echo a >> a
|
2012-11-13 20:41:56 +04:00
|
|
|
$ HGEDITOR="\"sh\" \"`pwd`/editor.sh\"" hg commit --amend -m 'amend base1'
|
2012-10-19 00:12:15 +04:00
|
|
|
pretxncommit 43f1ba15f28a50abf0aae529cf8a16bfced7b149
|
|
|
|
43f1ba15f28a tip
|
2017-12-11 06:50:57 +03:00
|
|
|
saved backup bundle to $TESTTMP/.hg/strip-backup/489edb5b847d-5ab4f721-amend.hg
|
2012-06-23 20:57:29 +04:00
|
|
|
$ echo 'pretxncommit.foo = ' >> $HGRCPATH
|
2012-04-18 02:20:16 +04:00
|
|
|
$ hg diff -c .
|
2012-10-19 00:12:15 +04:00
|
|
|
diff -r ad120869acf0 -r 43f1ba15f28a a
|
2012-04-18 02:20:16 +04:00
|
|
|
--- a/a Thu Jan 01 00:00:00 1970 +0000
|
|
|
|
+++ b/a Thu Jan 01 00:00:00 1970 +0000
|
|
|
|
@@ -1,1 +1,3 @@
|
2016-11-08 20:37:33 +03:00
|
|
|
a
|
2012-04-18 02:20:16 +04:00
|
|
|
+a
|
2016-11-15 23:56:49 +03:00
|
|
|
+a
|
2012-04-18 02:20:16 +04:00
|
|
|
$ hg log
|
2012-10-19 00:12:15 +04:00
|
|
|
changeset: 1:43f1ba15f28a
|
2012-04-18 02:20:16 +04:00
|
|
|
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
|
|
|
|
|
|
|
|
|
2012-12-29 21:00:18 +04:00
|
|
|
Check proper abort for empty message
|
2012-04-18 02:20:16 +04:00
|
|
|
|
2012-12-29 21:00:18 +04:00
|
|
|
$ cat > editor.sh << '__EOF__'
|
|
|
|
> #!/bin/sh
|
|
|
|
> echo "" > "$1"
|
|
|
|
> __EOF__
|
2017-09-01 22:34:36 +03:00
|
|
|
|
|
|
|
Update the existing file to ensure that the dirstate is not in pending state
|
|
|
|
(where the status of some files in the working copy is not known yet). This in
|
|
|
|
turn ensures that when the transaction is aborted due to an empty message during
|
|
|
|
the amend, there should be no rollback.
|
|
|
|
$ echo a >> a
|
|
|
|
|
2012-04-18 02:20:16 +04:00
|
|
|
$ echo b > b
|
2012-12-29 21:00:18 +04:00
|
|
|
$ hg add b
|
|
|
|
$ hg summary
|
|
|
|
parent: 1:43f1ba15f28a tip
|
|
|
|
amend base1
|
|
|
|
branch: default
|
2017-09-01 22:34:36 +03:00
|
|
|
commit: 1 modified, 1 added, 1 unknown
|
2012-12-29 21:00:18 +04:00
|
|
|
update: (current)
|
2015-05-29 23:23:58 +03:00
|
|
|
phases: 2 draft
|
2012-12-29 21:00:18 +04:00
|
|
|
$ HGEDITOR="\"sh\" \"`pwd`/editor.sh\"" hg commit --amend
|
|
|
|
abort: empty commit message
|
|
|
|
[255]
|
|
|
|
$ hg summary
|
|
|
|
parent: 1:43f1ba15f28a tip
|
|
|
|
amend base1
|
|
|
|
branch: default
|
2017-09-01 22:34:36 +03:00
|
|
|
commit: 1 modified, 1 added, 1 unknown
|
2012-12-29 21:00:18 +04:00
|
|
|
update: (current)
|
2015-05-29 23:23:58 +03:00
|
|
|
phases: 2 draft
|
2012-12-29 21:00:18 +04:00
|
|
|
|
2017-09-01 22:34:36 +03:00
|
|
|
Add new file along with modified existing file:
|
2012-12-29 21:00:18 +04:00
|
|
|
$ hg ci --amend -m 'amend base1 new file'
|
2017-12-11 06:50:57 +03:00
|
|
|
saved backup bundle to $TESTTMP/.hg/strip-backup/43f1ba15f28a-007467c2-amend.hg
|
2012-04-18 02:20:16 +04:00
|
|
|
|
|
|
|
Remove file that was added in amended commit:
|
2012-10-24 17:37:32 +04:00
|
|
|
(and test logfile option)
|
2012-11-13 20:41:56 +04:00
|
|
|
(and test that logfile option do not trigger an editor)
|
2012-04-18 02:20:16 +04:00
|
|
|
|
|
|
|
$ hg rm b
|
2012-10-24 17:37:32 +04:00
|
|
|
$ echo 'amend base1 remove new file' > ../logfile
|
2012-11-13 20:41:56 +04:00
|
|
|
$ HGEDITOR="\"sh\" \"`pwd`/editor.sh\"" hg ci --amend --logfile ../logfile
|
2017-12-11 06:50:57 +03:00
|
|
|
saved backup bundle to $TESTTMP/.hg/strip-backup/c16295aaf401-1ada9901-amend.hg
|
2012-04-18 02:20:16 +04:00
|
|
|
|
|
|
|
$ hg cat b
|
2017-09-01 22:34:36 +03:00
|
|
|
b: no such file in rev 47343646fa3d
|
2012-04-18 02:20:16 +04:00
|
|
|
[1]
|
|
|
|
|
|
|
|
No changes, just a different message:
|
|
|
|
|
|
|
|
$ hg ci -v --amend -m 'no changes, new message'
|
2017-09-01 22:34:36 +03:00
|
|
|
amending changeset 47343646fa3d
|
|
|
|
copying changeset 47343646fa3d to ad120869acf0
|
2014-04-18 15:33:20 +04:00
|
|
|
committing files:
|
2012-04-18 02:20:16 +04:00
|
|
|
a
|
2014-04-18 15:33:20 +04:00
|
|
|
committing manifest
|
|
|
|
committing changelog
|
2012-04-18 02:20:16 +04:00
|
|
|
1 changesets found
|
2014-08-15 21:43:32 +04:00
|
|
|
uncompressed size of bundle content:
|
2016-10-14 02:31:11 +03:00
|
|
|
254 (changelog)
|
2015-10-20 13:09:18 +03:00
|
|
|
163 (manifests)
|
2017-09-01 22:34:36 +03:00
|
|
|
131 a
|
2017-12-11 06:50:57 +03:00
|
|
|
saved backup bundle to $TESTTMP/.hg/strip-backup/47343646fa3d-c2758885-amend.hg
|
2012-04-18 02:20:16 +04:00
|
|
|
1 changesets found
|
2014-08-15 21:43:32 +04:00
|
|
|
uncompressed size of bundle content:
|
2016-10-14 02:31:11 +03:00
|
|
|
250 (changelog)
|
2015-10-20 13:09:18 +03:00
|
|
|
163 (manifests)
|
2017-09-01 22:34:36 +03:00
|
|
|
131 a
|
2012-04-18 02:20:16 +04:00
|
|
|
adding branch
|
|
|
|
adding changesets
|
|
|
|
adding manifests
|
|
|
|
adding file changes
|
|
|
|
added 1 changesets with 1 changes to 1 files
|
2017-09-01 22:34:36 +03:00
|
|
|
committed changeset 1:401431e913a1
|
2012-04-18 02:20:16 +04:00
|
|
|
$ hg diff -c .
|
2017-09-01 22:34:36 +03:00
|
|
|
diff -r ad120869acf0 -r 401431e913a1 a
|
2012-04-18 02:20:16 +04:00
|
|
|
--- a/a Thu Jan 01 00:00:00 1970 +0000
|
|
|
|
+++ b/a Thu Jan 01 00:00:00 1970 +0000
|
2017-09-01 22:34:36 +03:00
|
|
|
@@ -1,1 +1,4 @@
|
2016-11-08 20:37:33 +03:00
|
|
|
a
|
2012-04-18 02:20:16 +04:00
|
|
|
+a
|
2016-11-15 23:56:49 +03:00
|
|
|
+a
|
2017-09-01 22:34:36 +03:00
|
|
|
+a
|
2012-04-18 02:20:16 +04:00
|
|
|
$ hg log
|
2017-09-01 22:34:36 +03:00
|
|
|
changeset: 1:401431e913a1
|
2012-04-18 02:20:16 +04:00
|
|
|
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:
|
|
|
|
|
2014-08-16 05:43:59 +04:00
|
|
|
$ 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
|
2017-12-11 06:50:57 +03:00
|
|
|
saved backup bundle to $TESTTMP/.hg/strip-backup/401431e913a1-5e8e532c-amend.hg
|
2012-04-18 02:20:16 +04:00
|
|
|
$ echo a >> a
|
|
|
|
$ hg ci --amend -u foo -d '1 0'
|
2017-12-11 06:50:57 +03:00
|
|
|
saved backup bundle to $TESTTMP/.hg/strip-backup/d96b1d28ae33-677e0afb-amend.hg
|
2012-04-18 02:20:16 +04:00
|
|
|
$ hg log -r .
|
2017-09-01 22:34:36 +03:00
|
|
|
changeset: 1:a9a13940fc03
|
2012-04-18 02:20:16 +04:00
|
|
|
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:
|
|
|
|
|
2012-06-10 16:41:14 +04:00
|
|
|
$ cat > editor.sh << '__EOF__'
|
2012-04-18 02:20:16 +04:00
|
|
|
> #!/bin/sh
|
|
|
|
> cat $1
|
|
|
|
> echo "another precious commit message" > "$1"
|
|
|
|
> __EOF__
|
2014-03-18 20:07:41 +04:00
|
|
|
|
|
|
|
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"
|
2017-09-01 22:34:36 +03:00
|
|
|
amending changeset a9a13940fc03
|
|
|
|
copying changeset a9a13940fc03 to ad120869acf0
|
2014-04-18 15:33:20 +04:00
|
|
|
committing files:
|
2014-03-18 20:07:41 +04:00
|
|
|
a
|
2014-04-18 15:33:20 +04:00
|
|
|
committing manifest
|
|
|
|
committing changelog
|
2014-03-18 20:07:41 +04:00
|
|
|
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
|
2017-09-01 22:34:36 +03:00
|
|
|
amending changeset a9a13940fc03
|
|
|
|
copying changeset a9a13940fc03 to ad120869acf0
|
2014-03-18 20:07:41 +04:00
|
|
|
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
|
2014-04-18 15:33:20 +04:00
|
|
|
committing files:
|
2014-03-18 20:07:41 +04:00
|
|
|
a
|
2014-04-18 15:33:20 +04:00
|
|
|
committing manifest
|
|
|
|
committing changelog
|
2014-03-18 20:07:41 +04:00
|
|
|
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
|
|
|
|
|
2012-06-10 16:41:14 +04:00
|
|
|
$ HGEDITOR="\"sh\" \"`pwd`/editor.sh\"" hg commit --amend -v
|
2017-09-01 22:34:36 +03:00
|
|
|
amending changeset a9a13940fc03
|
|
|
|
copying changeset a9a13940fc03 to ad120869acf0
|
2012-04-18 02:20:16 +04:00
|
|
|
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
|
2014-04-18 15:33:20 +04:00
|
|
|
committing files:
|
2012-04-18 02:20:16 +04:00
|
|
|
a
|
2014-04-18 15:33:20 +04:00
|
|
|
committing manifest
|
|
|
|
committing changelog
|
2012-04-18 02:20:16 +04:00
|
|
|
1 changesets found
|
2014-08-15 21:43:32 +04:00
|
|
|
uncompressed size of bundle content:
|
2016-10-14 02:31:11 +03:00
|
|
|
249 (changelog)
|
2015-10-20 13:09:18 +03:00
|
|
|
163 (manifests)
|
2017-09-01 22:34:36 +03:00
|
|
|
133 a
|
2017-12-11 06:50:57 +03:00
|
|
|
saved backup bundle to $TESTTMP/.hg/strip-backup/a9a13940fc03-7c2e8674-amend.hg
|
2012-04-18 02:20:16 +04:00
|
|
|
1 changesets found
|
2014-08-15 21:43:32 +04:00
|
|
|
uncompressed size of bundle content:
|
2016-10-14 02:31:11 +03:00
|
|
|
257 (changelog)
|
2015-10-20 13:09:18 +03:00
|
|
|
163 (manifests)
|
2017-09-01 22:34:36 +03:00
|
|
|
133 a
|
2012-04-18 02:20:16 +04:00
|
|
|
adding branch
|
|
|
|
adding changesets
|
|
|
|
adding manifests
|
|
|
|
adding file changes
|
|
|
|
added 1 changesets with 1 changes to 1 files
|
2017-09-01 22:34:36 +03:00
|
|
|
committed changeset 1:64a124ba1b44
|
2012-04-18 02:20:16 +04:00
|
|
|
|
|
|
|
Same, but with changes in working dir (different code path):
|
|
|
|
|
|
|
|
$ echo a >> a
|
2012-06-10 16:41:14 +04:00
|
|
|
$ HGEDITOR="\"sh\" \"`pwd`/editor.sh\"" hg commit --amend -v
|
2017-09-01 22:34:36 +03:00
|
|
|
amending changeset 64a124ba1b44
|
2012-04-18 02:20:16 +04:00
|
|
|
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
|
2014-04-18 15:33:20 +04:00
|
|
|
committing files:
|
2012-04-18 02:20:16 +04:00
|
|
|
a
|
2014-04-18 15:33:20 +04:00
|
|
|
committing manifest
|
|
|
|
committing changelog
|
2012-04-18 02:20:16 +04:00
|
|
|
1 changesets found
|
2014-08-15 21:43:32 +04:00
|
|
|
uncompressed size of bundle content:
|
2016-10-14 02:31:11 +03:00
|
|
|
257 (changelog)
|
2015-10-20 13:09:18 +03:00
|
|
|
163 (manifests)
|
2016-11-15 23:56:49 +03:00
|
|
|
133 a
|
2017-12-11 06:50:57 +03:00
|
|
|
saved backup bundle to $TESTTMP/.hg/strip-backup/64a124ba1b44-10374b8f-amend.hg
|
2017-09-01 22:34:36 +03:00
|
|
|
1 changesets found
|
|
|
|
uncompressed size of bundle content:
|
|
|
|
257 (changelog)
|
|
|
|
163 (manifests)
|
|
|
|
135 a
|
2012-04-18 02:20:16 +04:00
|
|
|
adding branch
|
|
|
|
adding changesets
|
|
|
|
adding manifests
|
|
|
|
adding file changes
|
|
|
|
added 1 changesets with 1 changes to 1 files
|
2017-09-01 22:34:36 +03:00
|
|
|
committed changeset 1:7892795b8e38
|
2012-04-18 02:20:16 +04:00
|
|
|
|
2012-06-10 16:41:14 +04:00
|
|
|
$ rm editor.sh
|
2012-04-18 02:20:16 +04:00
|
|
|
$ hg log -r .
|
2017-09-01 22:34:36 +03:00
|
|
|
changeset: 1:7892795b8e38
|
2012-04-18 02:20:16 +04:00
|
|
|
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'
|
2017-12-11 06:50:57 +03:00
|
|
|
saved backup bundle to $TESTTMP/.hg/strip-backup/7892795b8e38-3fb46217-amend.hg
|
2012-04-18 02:20:16 +04:00
|
|
|
$ hg book
|
2017-09-01 22:34:36 +03:00
|
|
|
book1 1:8311f17e2616
|
|
|
|
* book2 1:8311f17e2616
|
2012-04-18 02:20:16 +04:00
|
|
|
$ echo a >> a
|
|
|
|
$ hg ci --amend -m 'move bookmarks'
|
2017-12-11 06:50:57 +03:00
|
|
|
saved backup bundle to $TESTTMP/.hg/strip-backup/8311f17e2616-f0504fe3-amend.hg
|
2012-04-18 02:20:16 +04:00
|
|
|
$ hg book
|
2017-09-01 22:34:36 +03:00
|
|
|
book1 1:a3b65065808c
|
|
|
|
* book2 1:a3b65065808c
|
2012-04-18 02:20:16 +04:00
|
|
|
|
2012-12-30 06:49:15 +04:00
|
|
|
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
|
|
|
|
abort: empty commit message
|
|
|
|
[255]
|
|
|
|
$ hg book
|
2017-09-01 22:34:36 +03:00
|
|
|
book1 1:a3b65065808c
|
|
|
|
* book2 1:a3b65065808c
|
2012-12-30 06:49:15 +04:00
|
|
|
$ hg revert -Caq
|
|
|
|
$ rm editor.sh
|
|
|
|
|
2012-04-18 02:20:16 +04:00
|
|
|
$ 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'
|
2017-12-11 06:50:57 +03:00
|
|
|
saved backup bundle to $TESTTMP/.hg/strip-backup/f8339a38efe1-c18453c9-amend.hg
|
2012-04-18 02:20:16 +04:00
|
|
|
$ hg branches
|
2017-09-01 22:34:36 +03:00
|
|
|
default 2:9c07515f2650
|
2012-04-18 02:20:16 +04:00
|
|
|
|
|
|
|
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'
|
2017-12-11 06:50:57 +03:00
|
|
|
saved backup bundle to $TESTTMP/.hg/strip-backup/c962248fa264-54245dc7-amend.hg
|
2012-04-18 02:20:16 +04:00
|
|
|
|
|
|
|
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
|
2017-12-11 06:50:57 +03:00
|
|
|
saved backup bundle to $TESTTMP/.hg/strip-backup/027371728205-b900d9fa-amend.hg
|
2012-04-18 02:20:16 +04:00
|
|
|
$ hg branches
|
2017-09-01 22:34:36 +03:00
|
|
|
default 2:9c07515f2650
|
2012-04-18 02:20:16 +04:00
|
|
|
|
2013-02-09 01:08:34 +04:00
|
|
|
Refuse to amend during a merge:
|
2012-04-18 02:20:16 +04:00
|
|
|
|
|
|
|
$ 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'
|
|
|
|
|
2018-04-10 21:03:26 +03:00
|
|
|
Refuse to amend if there is a merge conflict (issue5805):
|
|
|
|
|
|
|
|
$ hg up -q foo
|
|
|
|
$ echo c > a
|
|
|
|
$ hg up default -t :fail
|
|
|
|
0 files updated, 0 files merged, 0 files removed, 1 files unresolved
|
|
|
|
use 'hg resolve' to retry unresolved file merges
|
|
|
|
[1]
|
|
|
|
$ hg resolve -l
|
|
|
|
U a
|
|
|
|
|
|
|
|
$ hg ci --amend
|
|
|
|
abort: unresolved merge conflicts (see 'hg help resolve')
|
|
|
|
[255]
|
|
|
|
|
|
|
|
$ hg up -qC .
|
|
|
|
|
2012-04-18 02:20:16 +04:00
|
|
|
Follow copies/renames:
|
|
|
|
|
|
|
|
$ hg mv b c
|
|
|
|
$ hg ci -m 'b -> c'
|
|
|
|
$ hg mv c d
|
|
|
|
$ hg ci --amend -m 'b -> d'
|
2017-12-11 06:50:57 +03:00
|
|
|
saved backup bundle to $TESTTMP/.hg/strip-backup/42f3f27a067d-f23cc9f7-amend.hg
|
2012-04-23 03:39:26 +04:00
|
|
|
$ hg st --rev '.^' --copies d
|
2012-04-18 02:20:16 +04:00
|
|
|
A d
|
|
|
|
b
|
|
|
|
$ hg cp d e
|
|
|
|
$ hg ci -m 'e = d'
|
|
|
|
$ hg cp e f
|
|
|
|
$ hg ci --amend -m 'f = d'
|
2017-12-11 06:50:57 +03:00
|
|
|
saved backup bundle to $TESTTMP/.hg/strip-backup/9198f73182d5-251d584a-amend.hg
|
2012-04-23 03:39:26 +04:00
|
|
|
$ hg st --rev '.^' --copies f
|
2012-04-18 02:20:16 +04:00
|
|
|
A f
|
|
|
|
d
|
|
|
|
|
2012-04-30 22:36:29 +04:00
|
|
|
$ 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
|
2017-12-11 06:50:57 +03:00
|
|
|
saved backup bundle to $TESTTMP/.hg/strip-backup/f0993ab6b482-eda301bf-amend.hg
|
2012-04-30 22:36:29 +04:00
|
|
|
$ hg st --change . --copies
|
|
|
|
$ hg log -r . --template "{file_copies}\n"
|
2012-04-30 22:45:45 +04:00
|
|
|
|
|
|
|
|
|
|
|
Move added file (issue3410):
|
|
|
|
|
|
|
|
$ echo g >> g
|
|
|
|
$ hg ci -Am g
|
|
|
|
adding g
|
|
|
|
$ hg mv g h
|
|
|
|
$ hg ci --amend
|
2017-12-11 06:50:57 +03:00
|
|
|
saved backup bundle to $TESTTMP/.hg/strip-backup/58585e3f095c-0f5ebcda-amend.hg
|
2012-04-30 22:45:45 +04:00
|
|
|
$ hg st --change . --copies h
|
|
|
|
A h
|
|
|
|
$ hg log -r . --template "{file_copies}\n"
|
|
|
|
|
2012-04-30 22:36:29 +04:00
|
|
|
|
2012-04-18 02:20:16 +04:00
|
|
|
Can't rollback an amend:
|
|
|
|
|
|
|
|
$ hg rollback
|
|
|
|
no rollback information available
|
|
|
|
[1]
|
2012-05-11 19:33:45 +04:00
|
|
|
|
|
|
|
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'"
|
2017-12-11 06:50:57 +03:00
|
|
|
saved backup bundle to $TESTTMP/.hg/strip-backup/39a162f1d65e-9dfe13d8-amend.hg
|
2012-05-11 19:33:45 +04:00
|
|
|
$ hg log -r . --template "{branch}\n"
|
|
|
|
a
|
|
|
|
$ hg ci --amend -m "a''"
|
2017-12-11 06:50:57 +03:00
|
|
|
saved backup bundle to $TESTTMP/.hg/strip-backup/d5ca7b1ac72b-0b4c1a34-amend.hg
|
2012-05-11 19:33:45 +04:00
|
|
|
$ 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
|
|
|
|
$ hg up 11
|
|
|
|
5 files updated, 0 files merged, 1 files removed, 0 files unresolved
|
|
|
|
$ hg graft 12
|
2014-12-09 05:38:23 +03:00
|
|
|
grafting 12:2647734878ef "fork" (tip)
|
2012-05-11 19:33:45 +04:00
|
|
|
$ hg ci --amend -m 'graft amend'
|
2017-12-11 06:50:57 +03:00
|
|
|
saved backup bundle to $TESTTMP/.hg/strip-backup/fe8c6f7957ca-25638666-amend.hg
|
2012-05-11 19:33:45 +04:00
|
|
|
$ hg log -r . --debug | grep extra
|
2017-09-01 22:34:36 +03:00
|
|
|
extra: amend_source=fe8c6f7957ca1665ed77496ed7a07657d469ac60
|
2012-05-11 19:33:45 +04:00
|
|
|
extra: branch=a
|
|
|
|
extra: source=2647734878ef0236dda712fae9c1651cf694ea8a
|
2012-08-30 18:47:08 +04:00
|
|
|
|
|
|
|
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
|
|
|
|
|
2012-09-11 02:12:07 +04:00
|
|
|
Test amend with obsolete
|
|
|
|
---------------------------
|
|
|
|
|
|
|
|
Enable obsolete
|
|
|
|
|
2014-10-15 00:34:57 +04:00
|
|
|
$ cat >> $HGRCPATH << EOF
|
|
|
|
> [experimental]
|
2017-09-28 20:19:06 +03:00
|
|
|
> evolution.createmarkers=True
|
2017-09-28 20:56:40 +03:00
|
|
|
> evolution.allowunstable=True
|
2012-09-11 02:12:07 +04:00
|
|
|
> 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
|
2017-09-01 22:34:36 +03:00
|
|
|
@ 14[tip]:11 682950e85999 1970-01-01 00:00 +0000 test
|
2012-09-11 02:12:07 +04:00
|
|
|
| babar
|
|
|
|
|
|
|
|
|
| o 12:0 2647734878ef 1970-01-01 00:00 +0000 test
|
|
|
|
| | fork
|
2016-03-23 23:34:47 +03:00
|
|
|
| ~
|
2017-09-01 22:34:36 +03:00
|
|
|
o 11 0ddb275cfad1 1970-01-01 00:00 +0000 test
|
2016-03-23 23:34:47 +03:00
|
|
|
| a''
|
|
|
|
~
|
2012-09-11 02:12:07 +04:00
|
|
|
$ hg log -Gl 4 --hidden --style=compact
|
2017-09-01 22:34:36 +03:00
|
|
|
@ 14[tip]:11 682950e85999 1970-01-01 00:00 +0000 test
|
2012-09-11 02:12:07 +04:00
|
|
|
| babar
|
|
|
|
|
|
2017-09-01 22:34:36 +03:00
|
|
|
| x 13:11 5167600b0f7a 1970-01-01 00:00 +0000 test
|
2012-09-11 02:12:07 +04:00
|
|
|
|/ amend for phase
|
|
|
|
|
|
|
|
|
| o 12:0 2647734878ef 1970-01-01 00:00 +0000 test
|
|
|
|
| | fork
|
2016-03-23 23:34:47 +03:00
|
|
|
| ~
|
2017-09-01 22:34:36 +03:00
|
|
|
o 11 0ddb275cfad1 1970-01-01 00:00 +0000 test
|
2016-03-23 23:34:47 +03:00
|
|
|
| a''
|
|
|
|
~
|
2012-09-11 02:12:07 +04:00
|
|
|
|
|
|
|
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
|
2017-09-01 22:34:36 +03:00
|
|
|
@ 15[tip]:11 a5b42b49b0d5 1970-01-01 00:00 +0000 test
|
2012-09-11 02:12:07 +04:00
|
|
|
| babar
|
|
|
|
|
|
2017-09-01 22:34:36 +03:00
|
|
|
| x 14:11 682950e85999 1970-01-01 00:00 +0000 test
|
2012-09-11 02:12:07 +04:00
|
|
|
|/ babar
|
|
|
|
|
|
2017-09-01 22:34:36 +03:00
|
|
|
| x 13:11 5167600b0f7a 1970-01-01 00:00 +0000 test
|
2012-09-11 02:12:07 +04:00
|
|
|
|/ amend for phase
|
|
|
|
|
|
|
|
|
| o 12:0 2647734878ef 1970-01-01 00:00 +0000 test
|
|
|
|
| | fork
|
2016-03-23 23:34:47 +03:00
|
|
|
| ~
|
2017-09-01 22:34:36 +03:00
|
|
|
o 11 0ddb275cfad1 1970-01-01 00:00 +0000 test
|
2016-03-23 23:34:47 +03:00
|
|
|
| a''
|
2017-09-01 22:34:36 +03:00
|
|
|
|
|
|
|
|
o 10 5fa75032e226 1970-01-01 00:00 +0000 test
|
|
|
|
| g
|
2016-03-23 23:34:47 +03:00
|
|
|
~
|
2012-09-11 02:12:07 +04:00
|
|
|
|
|
|
|
|
2013-01-16 08:08:47 +04:00
|
|
|
Test that amend does not make it easy to create obsolescence cycle
|
2012-10-19 00:12:15 +04:00
|
|
|
---------------------------------------------------------------------
|
|
|
|
|
2013-01-08 23:37:37 +04:00
|
|
|
$ hg id -r 14 --hidden
|
2017-09-01 22:34:36 +03:00
|
|
|
682950e85999 (a)
|
2013-01-08 23:37:37 +04:00
|
|
|
$ hg revert -ar 14 --hidden
|
2012-10-19 00:12:15 +04:00
|
|
|
reverting a
|
|
|
|
$ hg commit --amend
|
|
|
|
$ hg id
|
2017-09-01 22:34:36 +03:00
|
|
|
37973c7e0b61 (a) tip
|
2013-01-01 03:44:18 +04:00
|
|
|
|
2013-01-16 03:46:29 +04:00
|
|
|
Test that rewriting leaving instability behind is allowed
|
2013-01-01 03:44:18 +04:00
|
|
|
---------------------------------------------------------------------
|
|
|
|
|
|
|
|
$ hg up '.^'
|
|
|
|
0 files updated, 0 files merged, 1 files removed, 0 files unresolved
|
|
|
|
$ echo 'b' >> a
|
|
|
|
$ hg log --style compact -r 'children(.)'
|
2017-09-01 22:34:36 +03:00
|
|
|
16[tip]:11 37973c7e0b61 1970-01-01 00:00 +0000 test
|
2013-01-01 03:44:18 +04:00
|
|
|
babar
|
|
|
|
|
|
|
|
$ hg commit --amend
|
2017-08-03 14:48:39 +03:00
|
|
|
$ hg log -r 'orphan()'
|
2017-09-01 22:34:36 +03:00
|
|
|
changeset: 16:37973c7e0b61
|
2013-01-01 03:44:18 +04:00
|
|
|
branch: a
|
2017-09-01 22:34:36 +03:00
|
|
|
parent: 11:0ddb275cfad1
|
2013-01-01 03:44:18 +04:00
|
|
|
user: test
|
|
|
|
date: Thu Jan 01 00:00:00 1970 +0000
|
2017-08-01 18:53:48 +03:00
|
|
|
instability: orphan
|
2013-01-01 03:44:18 +04:00
|
|
|
summary: babar
|
|
|
|
|
2013-02-09 01:08:34 +04:00
|
|
|
|
|
|
|
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
|
2015-10-09 23:54:52 +03:00
|
|
|
warning: conflicts while merging cc! (edit, then use 'hg resolve --mark')
|
2013-02-09 01:08:34 +04:00
|
|
|
[1]
|
|
|
|
$ hg resolve -m cc
|
2014-07-26 05:32:49 +04:00
|
|
|
(no more unresolved files)
|
2013-02-09 01:08:34 +04:00
|
|
|
$ hg ci -m 'merge bar'
|
|
|
|
$ hg log --config diff.git=1 -pr .
|
2017-09-01 22:34:36 +03:00
|
|
|
changeset: 20:163cfd7219f7
|
2013-02-09 01:08:34 +04:00
|
|
|
tag: tip
|
2017-09-01 22:34:36 +03:00
|
|
|
parent: 19:30d96aeaf27b
|
|
|
|
parent: 18:1aa437659d19
|
2013-02-09 01:08:34 +04:00
|
|
|
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 @@
|
2016-10-07 18:51:50 +03:00
|
|
|
+<<<<<<< working copy: 30d96aeaf27b - test: aa
|
2013-02-09 01:08:34 +04:00
|
|
|
dd
|
|
|
|
+=======
|
|
|
|
+cc
|
2016-11-20 02:41:37 +03:00
|
|
|
+>>>>>>> merge rev: 1aa437659d19 bar - test: aazzcc
|
2013-02-09 01:08:34 +04:00
|
|
|
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
|
2014-08-16 05:43:59 +04:00
|
|
|
$ HGEDITOR="sh .hg/checkeditform.sh" hg ci --amend -m 'merge bar (amend message)' --edit
|
|
|
|
HGEDITFORM=commit.amend.merge
|
2013-02-09 01:08:34 +04:00
|
|
|
$ hg log --config diff.git=1 -pr .
|
2017-09-01 22:34:36 +03:00
|
|
|
changeset: 21:bca52d4ed186
|
2013-02-09 01:08:34 +04:00
|
|
|
tag: tip
|
2017-09-01 22:34:36 +03:00
|
|
|
parent: 19:30d96aeaf27b
|
|
|
|
parent: 18:1aa437659d19
|
2013-02-09 01:08:34 +04:00
|
|
|
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 @@
|
2016-10-07 18:51:50 +03:00
|
|
|
+<<<<<<< working copy: 30d96aeaf27b - test: aa
|
2013-02-09 01:08:34 +04:00
|
|
|
dd
|
|
|
|
+=======
|
|
|
|
+cc
|
2016-11-20 02:41:37 +03:00
|
|
|
+>>>>>>> merge rev: 1aa437659d19 bar - test: aazzcc
|
2013-02-09 01:08:34 +04:00
|
|
|
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 .
|
2017-09-01 22:34:36 +03:00
|
|
|
changeset: 22:12594a98ca3f
|
2013-02-09 01:08:34 +04:00
|
|
|
tag: tip
|
2017-09-01 22:34:36 +03:00
|
|
|
parent: 19:30d96aeaf27b
|
|
|
|
parent: 18:1aa437659d19
|
2013-02-09 01:08:34 +04:00
|
|
|
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 @@
|
2016-10-07 18:51:50 +03:00
|
|
|
+<<<<<<< working copy: 30d96aeaf27b - test: aa
|
2013-02-09 01:08:34 +04:00
|
|
|
dd
|
|
|
|
+=======
|
|
|
|
+cc
|
2016-11-20 02:41:37 +03:00
|
|
|
+>>>>>>> merge rev: 1aa437659d19 bar - test: aazzcc
|
2013-02-09 01:08:34 +04:00
|
|
|
|
|
|
|
$ 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 .
|
2017-09-01 22:34:36 +03:00
|
|
|
changeset: 24:dffde028b388
|
2013-02-09 01:08:34 +04:00
|
|
|
tag: tip
|
2017-09-01 22:34:36 +03:00
|
|
|
parent: 22:12594a98ca3f
|
|
|
|
parent: 23:4c94d5bc65f5
|
2013-02-09 01:08:34 +04:00
|
|
|
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 .
|
2017-09-01 22:34:36 +03:00
|
|
|
changeset: 25:18e3ba160489
|
2013-02-09 01:08:34 +04:00
|
|
|
tag: tip
|
2017-09-01 22:34:36 +03:00
|
|
|
parent: 22:12594a98ca3f
|
|
|
|
parent: 23:4c94d5bc65f5
|
2013-02-09 01:08:34 +04:00
|
|
|
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
|
2013-04-13 01:00:42 +04:00
|
|
|
$ hg debugrename -r '.^' aa
|
2013-02-09 01:08:34 +04:00
|
|
|
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
|
2015-12-23 23:41:20 +03:00
|
|
|
$ hg merge -q bar --config ui.interactive=True << EOF
|
|
|
|
> c
|
|
|
|
> EOF
|
2016-10-07 18:51:50 +03:00
|
|
|
local [working copy] changed aa which other [merge rev] deleted
|
2015-12-01 00:43:55 +03:00
|
|
|
use (c)hanged version, (d)elete, or leave (u)nresolved? c
|
2013-02-09 01:08:34 +04:00
|
|
|
$ hg ci -m 'merge bar (with conflicts)'
|
|
|
|
$ hg log --config diff.git=1 -pr .
|
2017-09-01 22:34:36 +03:00
|
|
|
changeset: 28:b4c3035e2544
|
2013-02-09 01:08:34 +04:00
|
|
|
tag: tip
|
2017-09-01 22:34:36 +03:00
|
|
|
parent: 27:4b216ca5ba97
|
|
|
|
parent: 26:67db8847a540
|
2013-02-09 01:08:34 +04:00
|
|
|
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 .
|
2017-09-01 22:34:36 +03:00
|
|
|
changeset: 29:1205ed810051
|
2013-02-09 01:08:34 +04:00
|
|
|
tag: tip
|
2017-09-01 22:34:36 +03:00
|
|
|
parent: 27:4b216ca5ba97
|
|
|
|
parent: 26:67db8847a540
|
2013-02-09 01:08:34 +04:00
|
|
|
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
|
|
|
|
|
2013-05-02 20:36:47 +04:00
|
|
|
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
|
2014-12-17 09:09:43 +03:00
|
|
|
$ echo foo > foo
|
2014-10-15 00:34:57 +04:00
|
|
|
$ hg add foo
|
2013-11-05 13:55:45 +04:00
|
|
|
$ hg ci -m..
|
2013-05-02 20:36:47 +04:00
|
|
|
$ 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]
|
2014-03-13 14:48:41 +04:00
|
|
|
|
|
|
|
Test that amend with --secret creates new secret changeset forcibly
|
|
|
|
---------------------------------------------------------------------
|
|
|
|
|
|
|
|
$ hg phase '.^::.'
|
2017-09-01 22:34:36 +03:00
|
|
|
29: draft
|
|
|
|
30: draft
|
2014-03-13 14:48:41 +04:00
|
|
|
$ hg commit --amend --secret -m 'amend as secret' -q
|
|
|
|
$ hg phase '.^::.'
|
2017-09-01 22:34:36 +03:00
|
|
|
29: draft
|
|
|
|
31: secret
|
2014-04-15 21:38:11 +04:00
|
|
|
|
|
|
|
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
|
|
|
|
|
2014-12-17 09:09:38 +03:00
|
|
|
$ hg status --rev '.^1::.'
|
|
|
|
A foo
|
2014-04-15 21:38:11 +04:00
|
|
|
$ 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'
|
2014-12-17 09:09:38 +03:00
|
|
|
HG: added foo
|
2014-04-15 21:38:11 +04:00
|
|
|
$ hg parents --template "{desc}\n"
|
|
|
|
editor should be invoked
|
2014-10-16 17:35:06 +04:00
|
|
|
|
2014-12-17 09:09:43 +03:00
|
|
|
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:
|
2016-11-20 02:41:37 +03:00
|
|
|
HG: diff -r 1205ed810051 foo
|
2014-12-17 09:09:43 +03:00
|
|
|
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:
|
2016-11-20 02:41:37 +03:00
|
|
|
HG: diff -r 1205ed810051 foo
|
2014-12-17 09:09:43 +03:00
|
|
|
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
|
2016-11-20 02:41:37 +03:00
|
|
|
HG: diff -r 1205ed810051 y
|
2014-12-17 09:09:43 +03:00
|
|
|
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
|
|
|
|
|
2014-12-17 09:09:43 +03:00
|
|
|
$ 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
|
2016-11-20 02:41:37 +03:00
|
|
|
HG: diff -r 1205ed810051 a
|
2014-12-17 09:09:43 +03:00
|
|
|
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
|
2016-11-20 02:41:37 +03:00
|
|
|
HG: diff -r 1205ed810051 foo
|
2014-12-17 09:09:43 +03:00
|
|
|
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
|
2016-11-20 02:41:37 +03:00
|
|
|
HG: diff -r 1205ed810051 y
|
2014-12-17 09:09:43 +03:00
|
|
|
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
|
2016-11-20 02:41:37 +03:00
|
|
|
HG: diff -r 1205ed810051 a
|
2014-12-17 09:09:43 +03:00
|
|
|
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
|
2016-11-20 02:41:37 +03:00
|
|
|
HG: diff -r 1205ed810051 foo
|
2014-12-17 09:09:43 +03:00
|
|
|
HG: --- /dev/null Thu Jan 01 00:00:00 1970 +0000
|
2015-06-01 20:28:33 +03:00
|
|
|
HG: +++ b/foo Thu Jan 01 00:00:00 1970 +0000
|
|
|
|
HG: @@ -0,0 +1,1 @@
|
|
|
|
HG: +foo
|
2016-11-20 02:41:37 +03:00
|
|
|
HG: diff -r 1205ed810051 x
|
2015-06-01 20:28:33 +03:00
|
|
|
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
|
2016-11-20 02:41:37 +03:00
|
|
|
HG: diff -r 1205ed810051 y
|
2015-06-01 20:28:33 +03:00
|
|
|
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
|
|
|
|
|
|
|
|
$ 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
|
2016-11-20 02:41:37 +03:00
|
|
|
HG: diff -r 1205ed810051 a
|
2015-06-01 20:28:33 +03:00
|
|
|
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
|
2016-11-20 02:41:37 +03:00
|
|
|
HG: diff -r 1205ed810051 foo
|
2015-06-01 20:28:33 +03:00
|
|
|
HG: --- /dev/null Thu Jan 01 00:00:00 1970 +0000
|
2014-12-17 09:09:43 +03:00
|
|
|
HG: +++ b/foo Thu Jan 01 00:00:00 1970 +0000
|
|
|
|
HG: @@ -0,0 +1,1 @@
|
|
|
|
HG: +foo
|
2016-11-20 02:41:37 +03:00
|
|
|
HG: diff -r 1205ed810051 x
|
2014-12-17 09:09:43 +03:00
|
|
|
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
|
2016-11-20 02:41:37 +03:00
|
|
|
HG: diff -r 1205ed810051 y
|
2014-12-17 09:09:43 +03:00
|
|
|
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
|
2014-12-17 09:09:43 +03:00
|
|
|
|
2014-10-16 17:35:06 +04:00
|
|
|
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
|
|
|
|
|
|
|
|
|
2017-09-01 22:34:36 +03:00
|
|
|
The way mercurial does amends is by folding the working copy and old commit
|
|
|
|
together into another commit (rev 3). During this process, _findlimit is called
|
|
|
|
to check how far back to look for the transitive closure of file copy
|
|
|
|
information, but due to the divergence of the filelog and changelog graph
|
|
|
|
topologies, before _findlimit was fixed, it returned a rev which was not far
|
|
|
|
enough back in this case.
|
2014-10-16 17:35:06 +04:00
|
|
|
$ hg mv a1 a2
|
|
|
|
$ hg status --copies --rev 0
|
|
|
|
A a2
|
|
|
|
a0
|
|
|
|
R a0
|
|
|
|
$ hg ci --amend -q
|
|
|
|
$ hg log -G --template '{rev} {desc}'
|
2017-09-01 22:34:36 +03:00
|
|
|
@ 3 a1-amend
|
2014-10-16 17:35:06 +04:00
|
|
|
|
|
|
|
|
| o 1 a1
|
|
|
|
|/
|
|
|
|
o 0 a0
|
|
|
|
|
|
|
|
|
|
|
|
Before the fix, the copy information was lost.
|
|
|
|
$ hg status --copies --rev 0
|
|
|
|
A a2
|
|
|
|
a0
|
|
|
|
R a0
|
2015-03-02 22:01:00 +03:00
|
|
|
$ 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
|
2017-12-11 06:50:57 +03:00
|
|
|
moving olddirname/commonfile.py to newdirname/commonfile.py
|
2015-03-02 22:01:00 +03:00
|
|
|
$ 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
|
2017-12-11 06:50:57 +03:00
|
|
|
newdirname/newfile.py renamed from olddirname/newfile.py:690b295714aed510803d3020da9c70fca8336def
|
2015-03-02 22:01:00 +03:00
|
|
|
$ 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
|
2015-10-20 13:09:18 +03:00
|
|
|
rev offset length delta linkrev nodeid p1 p2
|
2017-01-02 22:50:17 +03:00
|
|
|
0 0 89 -1 3 34a4d536c0c0 000000000000 000000000000
|
2015-03-02 22:01:00 +03:00
|
|
|
|
|
|
|
$ echo a >> newdirname/commonfile.py
|
|
|
|
$ hg ci --amend -m bug
|
|
|
|
$ hg debugrename newdirname/newfile.py
|
2017-12-11 06:50:57 +03:00
|
|
|
newdirname/newfile.py renamed from olddirname/newfile.py:690b295714aed510803d3020da9c70fca8336def
|
2015-03-02 22:01:00 +03:00
|
|
|
$ hg debugindex newdirname/newfile.py
|
2015-10-20 13:09:18 +03:00
|
|
|
rev offset length delta linkrev nodeid p1 p2
|
2017-01-02 22:50:17 +03:00
|
|
|
0 0 89 -1 3 34a4d536c0c0 000000000000 000000000000
|
2015-03-02 22:01:00 +03:00
|
|
|
|
2016-10-30 00:15:09 +03:00
|
|
|
#if execbit
|
|
|
|
|
2016-05-20 00:35:22 +03:00
|
|
|
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 .
|
2017-09-01 22:34:36 +03:00
|
|
|
changeset: 7:b1326f52dddf
|
2016-05-20 00:35:22 +03:00
|
|
|
branch: newdirname
|
|
|
|
tag: tip
|
2017-09-01 22:34:36 +03:00
|
|
|
parent: 4:7fd235f7cb2f
|
2016-05-20 00:35:22 +03:00
|
|
|
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
|
|
|
|
|
2016-10-30 00:15:09 +03:00
|
|
|
#endif
|
2017-09-01 22:34:34 +03:00
|
|
|
|
|
|
|
Test amend with file inclusion options
|
|
|
|
--------------------------------------
|
|
|
|
|
|
|
|
These tests ensure that we are always amending some files that were part of the
|
|
|
|
pre-amend commit. We want to test that the remaining files in the pre-amend
|
|
|
|
commit were not changed in the amended commit. We do so by performing a diff of
|
|
|
|
the amended commit against its parent commit.
|
|
|
|
$ cd ..
|
|
|
|
$ hg init testfileinclusions
|
|
|
|
$ cd testfileinclusions
|
|
|
|
$ echo a > a
|
|
|
|
$ echo b > b
|
|
|
|
$ hg commit -Aqm "Adding a and b"
|
|
|
|
|
|
|
|
Only add changes to a particular file
|
|
|
|
$ echo a >> a
|
|
|
|
$ echo b >> b
|
|
|
|
$ hg commit --amend -I a
|
|
|
|
$ hg diff --git -r null -r .
|
|
|
|
diff --git a/a b/a
|
|
|
|
new file mode 100644
|
|
|
|
--- /dev/null
|
|
|
|
+++ b/a
|
|
|
|
@@ -0,0 +1,2 @@
|
|
|
|
+a
|
|
|
|
+a
|
|
|
|
diff --git a/b b/b
|
|
|
|
new file mode 100644
|
|
|
|
--- /dev/null
|
|
|
|
+++ b/b
|
|
|
|
@@ -0,0 +1,1 @@
|
|
|
|
+b
|
|
|
|
|
|
|
|
$ echo a >> a
|
|
|
|
$ hg commit --amend b
|
|
|
|
$ hg diff --git -r null -r .
|
|
|
|
diff --git a/a b/a
|
|
|
|
new file mode 100644
|
|
|
|
--- /dev/null
|
|
|
|
+++ b/a
|
|
|
|
@@ -0,0 +1,2 @@
|
|
|
|
+a
|
|
|
|
+a
|
|
|
|
diff --git a/b b/b
|
|
|
|
new file mode 100644
|
|
|
|
--- /dev/null
|
|
|
|
+++ b/b
|
|
|
|
@@ -0,0 +1,2 @@
|
|
|
|
+b
|
|
|
|
+b
|
|
|
|
|
|
|
|
Exclude changes to a particular file
|
|
|
|
$ echo b >> b
|
|
|
|
$ hg commit --amend -X a
|
|
|
|
$ hg diff --git -r null -r .
|
|
|
|
diff --git a/a b/a
|
|
|
|
new file mode 100644
|
|
|
|
--- /dev/null
|
|
|
|
+++ b/a
|
|
|
|
@@ -0,0 +1,2 @@
|
|
|
|
+a
|
|
|
|
+a
|
|
|
|
diff --git a/b b/b
|
|
|
|
new file mode 100644
|
|
|
|
--- /dev/null
|
|
|
|
+++ b/b
|
|
|
|
@@ -0,0 +1,3 @@
|
|
|
|
+b
|
|
|
|
+b
|
|
|
|
+b
|
|
|
|
|
|
|
|
Check the addremove flag
|
|
|
|
$ echo c > c
|
|
|
|
$ rm a
|
|
|
|
$ hg commit --amend -A
|
|
|
|
removing a
|
|
|
|
adding c
|
|
|
|
$ hg diff --git -r null -r .
|
|
|
|
diff --git a/b b/b
|
|
|
|
new file mode 100644
|
|
|
|
--- /dev/null
|
|
|
|
+++ b/b
|
|
|
|
@@ -0,0 +1,3 @@
|
|
|
|
+b
|
|
|
|
+b
|
|
|
|
+b
|
|
|
|
diff --git a/c b/c
|
|
|
|
new file mode 100644
|
|
|
|
--- /dev/null
|
|
|
|
+++ b/c
|
|
|
|
@@ -0,0 +1,1 @@
|
|
|
|
+c
|