##// END OF EJS Templates
rewriteutil: give examples of public changesets that can't be rewritten...
rewriteutil: give examples of public changesets that can't be rewritten This patch copies the feature from the evolve extension. Differential Revision: https://phab.mercurial-scm.org/D10670

File last commit:

r47835:5b6dd0d9 default
r47835:5b6dd0d9 default
Show More
test-amend.t
543 lines | 14.4 KiB | text/troff | Tads3Lexer
Jun Wu
amend: new extension providing the amend command...
r33404 #testcases obsstore-off obsstore-on
$ cat << EOF >> $HGRCPATH
> [extensions]
> amend=
> debugdrawdag=$TESTDIR/drawdag.py
> [diff]
> git=1
> EOF
#if obsstore-on
$ cat << EOF >> $HGRCPATH
> [experimental]
Boris Feld
config: use 'experimental.evolution.create-markers'...
r34867 > evolution.createmarkers=True
Jun Wu
amend: new extension providing the amend command...
r33404 > EOF
#endif
Basic amend
$ hg init repo1
$ cd repo1
$ hg debugdrawdag <<'EOS'
> B
> |
> A
> EOS
$ hg update B -q
$ echo 2 >> B
Jun Wu
test-amend: match output using conditional test case name...
r34055 $ hg amend
Matt Harbison
tests: remove (glob) annotations that were only for '\' matches...
r35394 saved backup bundle to $TESTTMP/repo1/.hg/strip-backup/112478962961-7e959a55-amend.hg (obsstore-off !)
Jun Wu
amend: new extension providing the amend command...
r33404 #if obsstore-off
$ hg log -p -G --hidden -T '{rev} {node|short} {desc}\n'
@ 1 be169c7e8dbe B
| diff --git a/B b/B
| new file mode 100644
| --- /dev/null
| +++ b/B
| @@ -0,0 +1,1 @@
| +B2
|
o 0 426bada5c675 A
diff --git a/A b/A
new file mode 100644
--- /dev/null
+++ b/A
@@ -0,0 +1,1 @@
+A
\ No newline at end of file
#else
$ hg log -p -G --hidden -T '{rev} {node|short} {desc}\n'
Saurabh Singh
cmdutil: remove the redundant commit during amend...
r34087 @ 2 be169c7e8dbe B
Jun Wu
amend: new extension providing the amend command...
r33404 | diff --git a/B b/B
| new file mode 100644
| --- /dev/null
| +++ b/B
| @@ -0,0 +1,1 @@
| +B2
|
| x 1 112478962961 B
|/ diff --git a/B b/B
| new file mode 100644
| --- /dev/null
| +++ b/B
| @@ -0,0 +1,1 @@
| +B
| \ No newline at end of file
|
o 0 426bada5c675 A
diff --git a/A b/A
new file mode 100644
--- /dev/null
+++ b/A
@@ -0,0 +1,1 @@
+A
\ No newline at end of file
#endif
Nothing changed
$ hg amend
nothing changed
[1]
Boris Feld
cmdutil: fix amend when passing a date...
r34123 $ hg amend -d "0 0"
nothing changed
[1]
$ hg amend -d "Thu Jan 01 00:00:00 1970 UTC"
nothing changed
[1]
Martin von Zweigbergk
tests: add test showing that merge state is not cleared by amend...
r45947 #if obsstore-on
$ hg init repo-merge-state
$ cd repo-merge-state
$ echo a > f
$ hg ci -Aqm a
$ echo b > f
$ hg ci -Aqm b
$ echo c > f
$ hg co -m '.^'
merging f
warning: conflicts while merging f! (edit, then use 'hg resolve --mark')
0 files updated, 0 files merged, 0 files removed, 1 files unresolved
use 'hg resolve' to retry unresolved file merges
[1]
$ echo d > f
$ hg resolve -m f
(no more unresolved files)
$ hg ci --amend --config experimental.evolution.allowunstable=True
1 new orphan changesets
$ hg resolve -l
$ cd ..
#endif
Jun Wu
amend: new extension providing the amend command...
r33404 Matcher and metadata options
$ echo 3 > C
$ echo 4 > D
$ hg add C D
Jun Wu
test-amend: match output using conditional test case name...
r34055 $ hg amend -m NEWMESSAGE -I C
Matt Harbison
tests: remove (glob) annotations that were only for '\' matches...
r35394 saved backup bundle to $TESTTMP/repo1/.hg/strip-backup/be169c7e8dbe-7684ddc5-amend.hg (obsstore-off !)
Jun Wu
amend: new extension providing the amend command...
r33404 $ hg log -r . -T '{node|short} {desc} {files}\n'
c7ba14d9075b NEWMESSAGE B C
$ echo 5 > E
$ rm C
Jun Wu
test-amend: match output using conditional test case name...
r34055 $ hg amend -d '2000 1000' -u 'Foo <foo@example.com>' -A C D
Matt Harbison
tests: remove (glob) annotations that were only for '\' matches...
r35394 saved backup bundle to $TESTTMP/repo1/.hg/strip-backup/c7ba14d9075b-b3e76daa-amend.hg (obsstore-off !)
Jun Wu
amend: new extension providing the amend command...
r33404 $ hg log -r . -T '{node|short} {desc} {files} {author} {date}\n'
Yuya Nishihara
templater: restore the original string format of {date}...
r38318 14f6c4bcc865 NEWMESSAGE B D Foo <foo@example.com> 2000.01000
Jun Wu
amend: new extension providing the amend command...
r33404
Amend with editor
$ cat > $TESTTMP/prefix.sh <<'EOF'
> printf 'EDITED: ' > $TESTTMP/msg
> cat "$1" >> $TESTTMP/msg
> mv $TESTTMP/msg "$1"
> EOF
$ chmod +x $TESTTMP/prefix.sh
Jun Wu
test-amend: match output using conditional test case name...
r34055 $ HGEDITOR="sh $TESTTMP/prefix.sh" hg amend --edit
Matt Harbison
tests: remove (glob) annotations that were only for '\' matches...
r35394 saved backup bundle to $TESTTMP/repo1/.hg/strip-backup/14f6c4bcc865-6591f15d-amend.hg (obsstore-off !)
Jun Wu
amend: new extension providing the amend command...
r33404 $ hg log -r . -T '{node|short} {desc}\n'
298f085230c3 EDITED: NEWMESSAGE
Jun Wu
test-amend: match output using conditional test case name...
r34055 $ HGEDITOR="sh $TESTTMP/prefix.sh" hg amend -e -m MSG
Matt Harbison
tests: remove (glob) annotations that were only for '\' matches...
r35394 saved backup bundle to $TESTTMP/repo1/.hg/strip-backup/298f085230c3-d81a6ad3-amend.hg (obsstore-off !)
Jun Wu
amend: new extension providing the amend command...
r33404 $ hg log -r . -T '{node|short} {desc}\n'
974f07f28537 EDITED: MSG
$ echo FOO > $TESTTMP/msg
$ hg amend -l $TESTTMP/msg -m BAR
Martin von Zweigbergk
amend: use cmdutil.check_at_most_one_arg()...
r44346 abort: cannot specify both --message and --logfile
Martin von Zweigbergk
errors: introduce InputError and use it from commands and cmdutil...
r46431 [10]
Jun Wu
test-amend: match output using conditional test case name...
r34055 $ hg amend -l $TESTTMP/msg
Matt Harbison
tests: remove (glob) annotations that were only for '\' matches...
r35394 saved backup bundle to $TESTTMP/repo1/.hg/strip-backup/974f07f28537-edb6470a-amend.hg (obsstore-off !)
Jun Wu
amend: new extension providing the amend command...
r33404 $ hg log -r . -T '{node|short} {desc}\n'
507be9bdac71 FOO
Interactive mode
$ touch F G
$ hg add F G
Jun Wu
test-amend: match output using conditional test case name...
r34055 $ cat <<EOS | hg amend -i --config ui.interactive=1
Jun Wu
amend: new extension providing the amend command...
r33404 > y
> n
> EOS
diff --git a/F b/F
new file mode 100644
Kyle Lippincott
patch: use a short, fixed-size message for last line of prompt (issue6158)...
r42766 examine changes to 'F'?
(enter ? for help) [Ynesfdaq?] y
Jun Wu
amend: new extension providing the amend command...
r33404
diff --git a/G b/G
new file mode 100644
Kyle Lippincott
patch: use a short, fixed-size message for last line of prompt (issue6158)...
r42766 examine changes to 'G'?
(enter ? for help) [Ynesfdaq?] n
Jun Wu
amend: new extension providing the amend command...
r33404
Matt Harbison
tests: remove (glob) annotations that were only for '\' matches...
r35394 saved backup bundle to $TESTTMP/repo1/.hg/strip-backup/507be9bdac71-c8077452-amend.hg (obsstore-off !)
Jun Wu
amend: new extension providing the amend command...
r33404 $ hg log -r . -T '{files}\n'
B D F
Amend in the middle of a stack
$ hg init $TESTTMP/repo2
$ cd $TESTTMP/repo2
$ hg debugdrawdag <<'EOS'
> C
> |
> B
> |
> A
> EOS
$ hg update -q B
$ echo 2 >> B
$ hg amend
abort: cannot amend changeset with children
Martin von Zweigbergk
rewriteutil: point to help about instability when rewriting creates orphan...
r47782 (see 'hg help evolution.instability')
Martin von Zweigbergk
errors: raise more specific errors from rewriteutil...
r46457 [10]
Jun Wu
amend: new extension providing the amend command...
r33404
#if obsstore-on
With allowunstable, amend could work in the middle of a stack
$ cat >> $HGRCPATH <<EOF
> [experimental]
Boris Feld
config: use 'experimental.evolution.create-markers'...
r34867 > evolution.createmarkers=True
Boris Feld
config: use 'experimental.evolution.allowunstable'...
r34868 > evolution.allowunstable=True
Jun Wu
amend: new extension providing the amend command...
r33404 > EOF
$ hg amend
Martin von Zweigbergk
evolution: report new unstable changesets...
r35727 1 new orphan changesets
Jun Wu
amend: new extension providing the amend command...
r33404 $ hg log -T '{rev} {node|short} {desc}\n' -G
Saurabh Singh
cmdutil: remove the redundant commit during amend...
r34087 @ 3 be169c7e8dbe B
Jun Wu
amend: new extension providing the amend command...
r33404 |
av6
graphlog: add another graph node type, unstable, using character "*" (BC)
r35524 | * 2 26805aba1e60 C
Jun Wu
amend: new extension providing the amend command...
r33404 | |
| x 1 112478962961 B
|/
o 0 426bada5c675 A
Pulkit Goyal
amend: add a flag `-n/--note` to store note with amend...
r34796 Checking the note stored in the obsmarker
$ echo foo > bar
$ hg add bar
Pulkit Goyal
amend: error out if the note is greater than 255bytes...
r34890 $ hg amend --note 'yyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyy'
abort: cannot store a note of more than 255 bytes
Martin von Zweigbergk
errors: introduce InputError and use it from commands and cmdutil...
r46431 [10]
Pulkit Goyal
amend: add a flag `-n/--note` to store note with amend...
r34796 $ hg amend --note "adding bar"
$ hg debugobsolete -r .
Boris Feld
obsolete: activate effect-flag by default...
r34962 112478962961147124edd43549aedd1a335e44bf be169c7e8dbe21cd10b3d79691cbe7f241e3c21c 0 (Thu Jan 01 00:00:00 1970 +0000) {'ef1': '8', 'operation': 'amend', 'user': 'test'}
be169c7e8dbe21cd10b3d79691cbe7f241e3c21c 16084da537dd8f84cfdb3055c633772269d62e1b 0 (Thu Jan 01 00:00:00 1970 +0000) {'ef1': '8', 'note': 'adding bar', 'operation': 'amend', 'user': 'test'}
Martin von Zweigbergk
rewriteutil: check for divergence...
r47784
Cannot cause divergence by default
$ hg co --hidden 1
1 files updated, 0 files merged, 1 files removed, 0 files unresolved
$ hg amend -m divergent
abort: cannot amend 112478962961, as that creates content-divergence with 16084da537dd
(add --verbose for details)
[10]
$ hg amend -m divergent --config experimental.evolution.allowdivergence=true
2 new content-divergent changesets
Jun Wu
amend: new extension providing the amend command...
r33404 #endif
Cannot amend public changeset
$ hg phase -r A --public
$ hg update -C -q A
Jun Wu
test-amend: match output using conditional test case name...
r34055 $ hg amend -m AMEND
Martin von Zweigbergk
rewriteutil: give examples of public changesets that can't be rewritten...
r47835 abort: cannot amend public changesets: 426bada5c675
Pulkit Goyal
rewriteutil: use precheck() in uncommit and amend commands...
r35244 (see 'hg help phases' for details)
Martin von Zweigbergk
errors: raise more specific errors from rewriteutil...
r46457 [10]
Jun Wu
amend: new extension providing the amend command...
r33404
Amend a merge changeset
$ hg init $TESTTMP/repo3
$ cd $TESTTMP/repo3
$ hg debugdrawdag <<'EOS'
> C
> /|
> A B
> EOS
$ hg update -q C
Jun Wu
test-amend: match output using conditional test case name...
r34055 $ hg amend -m FOO
Matt Harbison
tests: remove (glob) annotations that were only for '\' matches...
r35394 saved backup bundle to $TESTTMP/repo3/.hg/strip-backup/a35c07e8a2a4-15ff4612-amend.hg (obsstore-off !)
Jun Wu
amend: new extension providing the amend command...
r33404 $ rm .hg/localtags
$ hg log -G -T '{desc}\n'
@ FOO
|\
| o B
|
o A
Yuya Nishihara
tests: add more complete test for status changes on amend...
r35014
More complete test for status changes (issue5732)
-------------------------------------------------
Generates history of files having 3 states, r0_r1_wc:
r0: ground (content/missing)
r1: old state to be amended (content/missing, where missing means removed)
wc: changes to be included in r1 (content/missing-tracked/untracked)
$ hg init $TESTTMP/wcstates
$ cd $TESTTMP/wcstates
Matt Harbison
tests: quote PYTHON usage...
r39743 $ "$PYTHON" $TESTDIR/generate-working-copy-states.py state 2 1
Yuya Nishihara
tests: add more complete test for status changes on amend...
r35014 $ hg addremove -q --similarity 0
$ hg commit -m0
Matt Harbison
tests: quote PYTHON usage...
r39743 $ "$PYTHON" $TESTDIR/generate-working-copy-states.py state 2 2
Yuya Nishihara
tests: add more complete test for status changes on amend...
r35014 $ hg addremove -q --similarity 0
$ hg commit -m1
Matt Harbison
tests: quote PYTHON usage...
r39743 $ "$PYTHON" $TESTDIR/generate-working-copy-states.py state 2 wc
Yuya Nishihara
tests: add more complete test for status changes on amend...
r35014 $ hg addremove -q --similarity 0
$ hg forget *_*_*-untracked
$ rm *_*_missing-*
amend r1 to include wc changes
$ hg amend
saved backup bundle to * (glob) (obsstore-off !)
clean/modified/removed/added states of the amended revision
$ hg status --all --change . 'glob:content1_*_content1-tracked'
C content1_content1_content1-tracked
C content1_content2_content1-tracked
C content1_missing_content1-tracked
$ hg status --all --change . 'glob:content1_*_content[23]-tracked'
M content1_content1_content3-tracked
M content1_content2_content2-tracked
M content1_content2_content3-tracked
M content1_missing_content3-tracked
$ hg status --all --change . 'glob:content1_*_missing-tracked'
M content1_content2_missing-tracked
R content1_missing_missing-tracked
C content1_content1_missing-tracked
$ hg status --all --change . 'glob:content1_*_*-untracked'
Yuya Nishihara
amend: do not take untracked files as modified or clean (issue5732)...
r35015 R content1_content1_content1-untracked
R content1_content1_content3-untracked
Yuya Nishihara
tests: add more complete test for status changes on amend...
r35014 R content1_content1_missing-untracked
Yuya Nishihara
amend: do not take untracked files as modified or clean (issue5732)...
r35015 R content1_content2_content1-untracked
R content1_content2_content2-untracked
R content1_content2_content3-untracked
Yuya Nishihara
tests: add more complete test for status changes on amend...
r35014 R content1_content2_missing-untracked
R content1_missing_content1-untracked
R content1_missing_content3-untracked
R content1_missing_missing-untracked
$ hg status --all --change . 'glob:missing_content2_*'
A missing_content2_content2-tracked
A missing_content2_content3-tracked
Yuya Nishihara
amend: do not drop missing files (issue5732)...
r35016 A missing_content2_missing-tracked
Yuya Nishihara
tests: add more complete test for status changes on amend...
r35014 $ hg status --all --change . 'glob:missing_missing_*'
A missing_missing_content3-tracked
working directory should be all clean (with some missing/untracked files)
$ hg status --all 'glob:*_content?-tracked'
C content1_content1_content1-tracked
C content1_content1_content3-tracked
C content1_content2_content1-tracked
C content1_content2_content2-tracked
C content1_content2_content3-tracked
C content1_missing_content1-tracked
C content1_missing_content3-tracked
C missing_content2_content2-tracked
C missing_content2_content3-tracked
C missing_missing_content3-tracked
$ hg status --all 'glob:*_missing-tracked'
! content1_content1_missing-tracked
! content1_content2_missing-tracked
! content1_missing_missing-tracked
! missing_content2_missing-tracked
! missing_missing_missing-tracked
$ hg status --all 'glob:*-untracked'
? content1_content1_content1-untracked
? content1_content1_content3-untracked
? content1_content2_content1-untracked
? content1_content2_content2-untracked
? content1_content2_content3-untracked
? content1_missing_content1-untracked
? content1_missing_content3-untracked
? missing_content2_content2-untracked
? missing_content2_content3-untracked
? missing_missing_content3-untracked
Sushil khanchi
amend: support "history-editing-backup" config option...
r38853
Yuya Nishihara
repair: move ui.history-editing-backup to [rewrite] section...
r41242 =================================
Test backup-bundle config option|
=================================
Sushil khanchi
amend: support "history-editing-backup" config option...
r38853 $ hg init $TESTTMP/repo4
$ cd $TESTTMP/repo4
$ echo a>a
$ hg ci -Aqma
$ echo oops>b
$ hg ci -Aqm "b"
$ echo partiallyfixed > b
#if obsstore-off
$ hg amend
saved backup bundle to $TESTTMP/repo4/.hg/strip-backup/95e899acf2ce-f11cb050-amend.hg
Yuya Nishihara
repair: move ui.history-editing-backup to [rewrite] section...
r41242 When backup-bundle config option is set:
Sushil khanchi
amend: support "history-editing-backup" config option...
r38853 $ cat << EOF >> $HGRCPATH
Yuya Nishihara
repair: move ui.history-editing-backup to [rewrite] section...
r41242 > [rewrite]
> backup-bundle = False
Sushil khanchi
amend: support "history-editing-backup" config option...
r38853 > EOF
$ echo fixed > b
$ hg amend
#else
$ hg amend
Yuya Nishihara
repair: move ui.history-editing-backup to [rewrite] section...
r41242 When backup-bundle config option is set:
Sushil khanchi
amend: support "history-editing-backup" config option...
r38853 $ cat << EOF >> $HGRCPATH
Yuya Nishihara
repair: move ui.history-editing-backup to [rewrite] section...
r41242 > [rewrite]
> backup-bundle = False
Sushil khanchi
amend: support "history-editing-backup" config option...
r38853 > EOF
$ echo fixed > b
$ hg amend
#endif
Taapas Agrawal
amend: add config option to update time to current in hg amend (issue5828)...
r41155 ==========================================
Test update-timestamp config option|
==========================================
$ cat >> $HGRCPATH << EOF
> [extensions]
> amend=
Taapas Agrawal
tests: replace mockmakedate function in test-amend.t...
r41250 > mockmakedate = $TESTDIR/mockmakedate.py
Taapas Agrawal
amend: add config option to update time to current in hg amend (issue5828)...
r41155 > EOF
$ hg init $TESTTMP/repo5
$ cd $TESTTMP/repo5
Yuya Nishihara
test-amend: remove uninteresting fields from log output to deduplicate tests...
r41157 $ cat <<'EOF' >> .hg/hgrc
Martin von Zweigbergk
config: add a new [command-templates] section for templates defined by hg...
r46350 > [command-templates]
> log = 'user: {user}
> date: {date|date}
> summary: {desc|firstline}\n'
Yuya Nishihara
test-amend: remove uninteresting fields from log output to deduplicate tests...
r41157 > EOF
Taapas Agrawal
amend: add config option to update time to current in hg amend (issue5828)...
r41155 $ echo a>a
$ hg ci -Am 'commit 1'
adding a
When updatetimestamp is False
$ hg amend --date '1997-1-1 0:1'
$ hg log --limit 1
user: test
date: Wed Jan 01 00:01:00 1997 +0000
summary: commit 1
Yuya Nishihara
test-amend: remove uninteresting fields from log output to deduplicate tests...
r41157
Taapas Agrawal
amend: add config option to update time to current in hg amend (issue5828)...
r41155 When update-timestamp is True and no other change than the date
$ hg amend --config rewrite.update-timestamp=True
nothing changed
[1]
$ hg log --limit 1
user: test
date: Wed Jan 01 00:01:00 1997 +0000
summary: commit 1
Yuya Nishihara
test-amend: remove uninteresting fields from log output to deduplicate tests...
r41157
Taapas Agrawal
amend: add config option to update time to current in hg amend (issue5828)...
r41155 When update-timestamp is True and there is other change than the date
$ hg amend --user foobar --config rewrite.update-timestamp=True
$ hg log --limit 1
user: foobar
date: Thu Jan 01 00:00:02 1970 +0000
summary: commit 1
When date option is applicable and update-timestamp is True
$ hg amend --date '1998-1-1 0:1' --config rewrite.update-timestamp=True
$ hg log --limit 1
user: foobar
date: Thu Jan 01 00:01:00 1998 +0000
summary: commit 1
Yuya Nishihara
amend: add -D/--currentdate option...
r41160
Unlike rewrite.update-timestamp, -D/--currentdate always updates the timestamp
$ hg amend -D
$ hg log --limit 1
user: foobar
date: Thu Jan 01 00:00:04 1970 +0000
summary: commit 1
$ hg amend -D --config rewrite.update-timestamp=True
$ hg log --limit 1
user: foobar
date: Thu Jan 01 00:00:05 1970 +0000
summary: commit 1
Yuya Nishihara
amend: turn currentdate into tri-state bool so config option can be negated...
r41209 rewrite.update-timestamp can be negated by --no-currentdate
$ hg amend --config rewrite.update-timestamp=True --no-currentdate -u baz
$ hg log --limit 1
user: baz
date: Thu Jan 01 00:00:05 1970 +0000
summary: commit 1
Yuya Nishihara
amend: add -D/--currentdate option...
r41160 Bad combination of date options:
$ hg amend -D --date '0 0'
Martin von Zweigbergk
commit: use cmdutil.check_at_most_one_arg()...
r44345 abort: cannot specify both --date and --currentdate
Martin von Zweigbergk
errors: introduce InputError and use it from commands and cmdutil...
r46431 [10]
Yuya Nishihara
amend: add -D/--currentdate option...
r41160
Matt Harbison
amend: enable support for closing the branch...
r43204 Close branch
Matt Harbison
amend: enable support for using the secret phase...
r43205 $ hg amend --secret --close-branch
$ hg log --limit 1 -T 'close={get(extras, "close")}\nphase={phase}\n'
Matt Harbison
amend: enable support for closing the branch...
r43204 close=1
Matt Harbison
amend: enable support for using the secret phase...
r43205 phase=secret
Matt Harbison
amend: enable support for closing the branch...
r43204
Yuya Nishihara
amend: add -D/--currentdate option...
r41160 $ cd ..
Valentin Gatien-Baron
amend: add a test for a simplified version of issue6157...
r42865
Corner case of amend from issue6157:
- working copy parent has a change to file `a`
- working copy has the inverse change
- we amend the working copy parent for files other than `a`
Valentin Gatien-Baron
amend: stop committing unrequested file reverts (issue6157)...
r42866 hg used to include the changes to `a` anyway.
Valentin Gatien-Baron
amend: add a test for a simplified version of issue6157...
r42865
$ hg init 6157; cd 6157
$ echo a > a; echo b > b; hg commit -qAm_
$ echo a2 > a; hg commit -qm_
$ hg diff --stat -c .
a | 2 +-
1 files changed, 1 insertions(+), 1 deletions(-)
$ echo a > a; echo b2 > b; hg amend -q b
$ hg diff --stat -c .
Valentin Gatien-Baron
amend: stop committing unrequested file reverts (issue6157)...
r42866 a | 2 +-
Valentin Gatien-Baron
amend: add a test for a simplified version of issue6157...
r42865 b | 2 +-
Valentin Gatien-Baron
amend: stop committing unrequested file reverts (issue6157)...
r42866 2 files changed, 2 insertions(+), 2 deletions(-)
Kyle Lippincott
amend: check for file modifications when updating dirstate (issue6233)...
r44238
Modifying a file while the editor is open can cause dirstate corruption
(issue6233)
$ cd $TESTTMP
$ hg init modify-during-amend; cd modify-during-amend
$ echo r0 > foo; hg commit -qAm "r0"
$ echo alpha > foo; hg commit -qm "alpha"
$ echo beta >> foo
test: simplify test-amend.t to avoid race condition...
r44731 $ cat > $TESTTMP/touchy_editor.sh <<EOF
> sleep 1
Matt Harbison
tests: stabilize test-amend.t on Windows...
r44861 > echo delta >> "$TESTTMP/modify-during-amend/foo"
test: simplify test-amend.t to avoid race condition...
r44731 > sleep 1
Kyle Lippincott
amend: check for file modifications when updating dirstate (issue6233)...
r44238 > echo hi > "\$1"
test: simplify test-amend.t to avoid race condition...
r44731 > sleep 1
Kyle Lippincott
amend: check for file modifications when updating dirstate (issue6233)...
r44238 > EOF
test: simplify test-amend.t to avoid race condition...
r44731 $ HGEDITOR="sh $TESTTMP/touchy_editor.sh" hg commit --amend
Augie Fackler
tests: replace [[]] bashism with portable [] invocation...
r44280 $ if (hg diff -c . | grep 'delta' >/dev/null) || [ -n "$(hg status)" ]; then
Kyle Lippincott
amend: check for file modifications when updating dirstate (issue6233)...
r44238 > echo "OK."
> else
> echo "Bug detected. 'delta' is not part of the commit OR the wdir"
> echo "Diff and status before rebuild:"
> hg diff
> hg status
> hg debugrebuilddirstate
> echo "Diff and status after rebuild:"
> hg diff
> hg status
> fi
OK.