mirror of
https://github.com/facebook/sapling.git
synced 2024-10-10 08:47:12 +03:00
0dce99888f
Summary: We had a bug: if two files were reverted and then we try to amend one of them mercurial will actually amend both of them. Looks like the problem was caused by "Prune files reverted by amend" block. Previously this block was considering every file that was changed in a commit we are about to amend and comparing with working copy. If a file is the same in a commit we are about to amend and in the working copy then it will amended as well. This diff attempts to fix it by considering only files that were selected for amending. Reviewed By: DurhamG Differential Revision: D24949727 fbshipit-source-id: cf6cb95af3f67ec769e8a58db3b829945133b830
88 lines
1.4 KiB
Perl
88 lines
1.4 KiB
Perl
#chg-compatible
|
|
|
|
$ enable amend
|
|
$ setconfig diff.git=1
|
|
|
|
$ configure mutation-norecord
|
|
|
|
Basic amend
|
|
|
|
$ hg init repo1
|
|
$ cd repo1
|
|
$ hg debugdrawdag <<'EOS'
|
|
> B
|
|
> |
|
|
> A
|
|
> EOS
|
|
|
|
$ hg update B -q
|
|
$ echo 2 >> B
|
|
$ hg amend
|
|
$ hg log -r . -T '{files}'
|
|
B (no-eol)
|
|
$ hg st
|
|
|
|
Now revert and amend file B, we should get an empty commit
|
|
$ hg revert -r .^ B
|
|
$ hg amend
|
|
$ hg st
|
|
$ hg log -r . -T '{files}'
|
|
|
|
|
|
Create a commit with a few files, revert a few of them
|
|
and then amend them one by one
|
|
$ echo 1 > 1
|
|
$ echo 2 > 2
|
|
$ echo 3 > 3
|
|
$ hg add 1 2 3
|
|
$ hg ci -m '1 2 3'
|
|
$ hg revert -r .^ 1
|
|
$ hg revert -r .^ 2
|
|
|
|
Now amend a single file
|
|
$ hg st
|
|
R 1
|
|
R 2
|
|
$ hg amend 1
|
|
$ hg st
|
|
R 2
|
|
$ hg log -r . -T '{files}'
|
|
2 3 (no-eol)
|
|
|
|
Now amend the second file
|
|
$ hg amend 2
|
|
$ hg st
|
|
$ hg log -r . -T '{files}'
|
|
3 (no-eol)
|
|
|
|
Now rename a file and amend
|
|
$ hg mv 3 33
|
|
$ hg amend
|
|
$ hg st
|
|
$ hg log -r . -T '{files}'
|
|
33 (no-eol)
|
|
|
|
$ hg mv 33 333
|
|
$ hg amend 333
|
|
$ hg log -r . -T '{files}'
|
|
33 333 (no-eol)
|
|
|
|
|
|
Create a commit with two files, then change these files in another
|
|
commit, then revert two of them and then amend a single one
|
|
$ echo x > x
|
|
$ echo y > y
|
|
$ hg add x y
|
|
$ hg ci -m 'x y'
|
|
$ echo xx > x
|
|
$ echo yy > y
|
|
$ hg ci -m 'xx yy'
|
|
$ hg revert -r .^ x
|
|
$ hg revert -r .^ y
|
|
$ hg amend x
|
|
$ hg st
|
|
M y
|
|
$ hg log -r . -T '{files}'
|
|
y (no-eol)
|
|
|