Show More
@@ -1,858 +1,856 b'' | |||||
1 | $ hg init |
|
1 | $ hg init | |
2 |
|
2 | |||
3 | Setup: |
|
3 | Setup: | |
4 |
|
4 | |||
5 | $ echo a >> a |
|
5 | $ echo a >> a | |
6 | $ hg ci -Am 'base' |
|
6 | $ hg ci -Am 'base' | |
7 | adding a |
|
7 | adding a | |
8 |
|
8 | |||
9 | Refuse to amend public csets: |
|
9 | Refuse to amend public csets: | |
10 |
|
10 | |||
11 | $ hg phase -r . -p |
|
11 | $ hg phase -r . -p | |
12 | $ hg ci --amend |
|
12 | $ hg ci --amend | |
13 | abort: cannot amend public changesets |
|
13 | abort: cannot amend public changesets | |
14 | [255] |
|
14 | [255] | |
15 | $ hg phase -r . -f -d |
|
15 | $ hg phase -r . -f -d | |
16 |
|
16 | |||
17 | $ echo a >> a |
|
17 | $ echo a >> a | |
18 | $ hg ci -Am 'base1' |
|
18 | $ hg ci -Am 'base1' | |
19 |
|
19 | |||
20 | Nothing to amend: |
|
20 | Nothing to amend: | |
21 |
|
21 | |||
22 | $ hg ci --amend |
|
22 | $ hg ci --amend | |
23 | nothing changed |
|
23 | nothing changed | |
24 | [1] |
|
24 | [1] | |
25 |
|
25 | |||
26 | $ cat >> $HGRCPATH <<EOF |
|
26 | $ cat >> $HGRCPATH <<EOF | |
27 | > [hooks] |
|
27 | > [hooks] | |
28 | > pretxncommit.foo = sh -c "echo \\"pretxncommit \$HG_NODE\\"; hg id -r \$HG_NODE" |
|
28 | > pretxncommit.foo = sh -c "echo \\"pretxncommit \$HG_NODE\\"; hg id -r \$HG_NODE" | |
29 | > EOF |
|
29 | > EOF | |
30 |
|
30 | |||
31 | Amending changeset with changes in working dir: |
|
31 | Amending changeset with changes in working dir: | |
32 | (and check that --message does not trigger an editor) |
|
32 | (and check that --message does not trigger an editor) | |
33 |
|
33 | |||
34 | $ echo a >> a |
|
34 | $ echo a >> a | |
35 | $ HGEDITOR="\"sh\" \"`pwd`/editor.sh\"" hg commit --amend -m 'amend base1' |
|
35 | $ HGEDITOR="\"sh\" \"`pwd`/editor.sh\"" hg commit --amend -m 'amend base1' | |
36 | pretxncommit 43f1ba15f28a50abf0aae529cf8a16bfced7b149 |
|
36 | pretxncommit 43f1ba15f28a50abf0aae529cf8a16bfced7b149 | |
37 | 43f1ba15f28a tip |
|
37 | 43f1ba15f28a tip | |
38 | saved backup bundle to $TESTTMP/.hg/strip-backup/489edb5b847d-amend-backup.hg (glob) |
|
38 | saved backup bundle to $TESTTMP/.hg/strip-backup/489edb5b847d-amend-backup.hg (glob) | |
39 | $ echo 'pretxncommit.foo = ' >> $HGRCPATH |
|
39 | $ echo 'pretxncommit.foo = ' >> $HGRCPATH | |
40 | $ hg diff -c . |
|
40 | $ hg diff -c . | |
41 | diff -r ad120869acf0 -r 43f1ba15f28a a |
|
41 | diff -r ad120869acf0 -r 43f1ba15f28a a | |
42 | --- a/a Thu Jan 01 00:00:00 1970 +0000 |
|
42 | --- a/a Thu Jan 01 00:00:00 1970 +0000 | |
43 | +++ b/a Thu Jan 01 00:00:00 1970 +0000 |
|
43 | +++ b/a Thu Jan 01 00:00:00 1970 +0000 | |
44 | @@ -1,1 +1,3 @@ |
|
44 | @@ -1,1 +1,3 @@ | |
45 | a |
|
45 | a | |
46 | +a |
|
46 | +a | |
47 | +a |
|
47 | +a | |
48 | $ hg log |
|
48 | $ hg log | |
49 | changeset: 1:43f1ba15f28a |
|
49 | changeset: 1:43f1ba15f28a | |
50 | tag: tip |
|
50 | tag: tip | |
51 | user: test |
|
51 | user: test | |
52 | date: Thu Jan 01 00:00:00 1970 +0000 |
|
52 | date: Thu Jan 01 00:00:00 1970 +0000 | |
53 | summary: amend base1 |
|
53 | summary: amend base1 | |
54 |
|
54 | |||
55 | changeset: 0:ad120869acf0 |
|
55 | changeset: 0:ad120869acf0 | |
56 | user: test |
|
56 | user: test | |
57 | date: Thu Jan 01 00:00:00 1970 +0000 |
|
57 | date: Thu Jan 01 00:00:00 1970 +0000 | |
58 | summary: base |
|
58 | summary: base | |
59 |
|
59 | |||
60 |
|
60 | |||
61 | Check proper abort for empty message |
|
61 | Check proper abort for empty message | |
62 |
|
62 | |||
63 | $ cat > editor.sh << '__EOF__' |
|
63 | $ cat > editor.sh << '__EOF__' | |
64 | > #!/bin/sh |
|
64 | > #!/bin/sh | |
65 | > echo "" > "$1" |
|
65 | > echo "" > "$1" | |
66 | > __EOF__ |
|
66 | > __EOF__ | |
67 | $ echo b > b |
|
67 | $ echo b > b | |
68 | $ hg add b |
|
68 | $ hg add b | |
69 | $ hg summary |
|
69 | $ hg summary | |
70 | parent: 1:43f1ba15f28a tip |
|
70 | parent: 1:43f1ba15f28a tip | |
71 | amend base1 |
|
71 | amend base1 | |
72 | branch: default |
|
72 | branch: default | |
73 | commit: 1 added, 1 unknown |
|
73 | commit: 1 added, 1 unknown | |
74 | update: (current) |
|
74 | update: (current) | |
75 | $ HGEDITOR="\"sh\" \"`pwd`/editor.sh\"" hg commit --amend |
|
75 | $ HGEDITOR="\"sh\" \"`pwd`/editor.sh\"" hg commit --amend | |
76 | transaction abort! |
|
76 | transaction abort! | |
77 | rollback completed |
|
77 | rollback completed | |
78 | abort: empty commit message |
|
78 | abort: empty commit message | |
79 | [255] |
|
79 | [255] | |
80 | $ hg summary |
|
80 | $ hg summary | |
81 | parent: 1:43f1ba15f28a tip |
|
81 | parent: 1:43f1ba15f28a tip | |
82 | amend base1 |
|
82 | amend base1 | |
83 | branch: default |
|
83 | branch: default | |
84 | commit: 1 added, 1 unknown |
|
84 | commit: 1 added, 1 unknown | |
85 | update: (current) |
|
85 | update: (current) | |
86 |
|
86 | |||
87 | Add new file: |
|
87 | Add new file: | |
88 | $ hg ci --amend -m 'amend base1 new file' |
|
88 | $ hg ci --amend -m 'amend base1 new file' | |
89 | saved backup bundle to $TESTTMP/.hg/strip-backup/43f1ba15f28a-amend-backup.hg (glob) |
|
89 | saved backup bundle to $TESTTMP/.hg/strip-backup/43f1ba15f28a-amend-backup.hg (glob) | |
90 |
|
90 | |||
91 | Remove file that was added in amended commit: |
|
91 | Remove file that was added in amended commit: | |
92 | (and test logfile option) |
|
92 | (and test logfile option) | |
93 | (and test that logfile option do not trigger an editor) |
|
93 | (and test that logfile option do not trigger an editor) | |
94 |
|
94 | |||
95 | $ hg rm b |
|
95 | $ hg rm b | |
96 | $ echo 'amend base1 remove new file' > ../logfile |
|
96 | $ echo 'amend base1 remove new file' > ../logfile | |
97 | $ HGEDITOR="\"sh\" \"`pwd`/editor.sh\"" hg ci --amend --logfile ../logfile |
|
97 | $ HGEDITOR="\"sh\" \"`pwd`/editor.sh\"" hg ci --amend --logfile ../logfile | |
98 | saved backup bundle to $TESTTMP/.hg/strip-backup/b8e3cb2b3882-amend-backup.hg (glob) |
|
98 | saved backup bundle to $TESTTMP/.hg/strip-backup/b8e3cb2b3882-amend-backup.hg (glob) | |
99 |
|
99 | |||
100 | $ hg cat b |
|
100 | $ hg cat b | |
101 | b: no such file in rev 74609c7f506e |
|
101 | b: no such file in rev 74609c7f506e | |
102 | [1] |
|
102 | [1] | |
103 |
|
103 | |||
104 | No changes, just a different message: |
|
104 | No changes, just a different message: | |
105 |
|
105 | |||
106 | $ hg ci -v --amend -m 'no changes, new message' |
|
106 | $ hg ci -v --amend -m 'no changes, new message' | |
107 | amending changeset 74609c7f506e |
|
107 | amending changeset 74609c7f506e | |
108 | copying changeset 74609c7f506e to ad120869acf0 |
|
108 | copying changeset 74609c7f506e to ad120869acf0 | |
109 | a |
|
109 | a | |
110 | stripping amended changeset 74609c7f506e |
|
110 | stripping amended changeset 74609c7f506e | |
111 | 1 changesets found |
|
111 | 1 changesets found | |
112 | saved backup bundle to $TESTTMP/.hg/strip-backup/74609c7f506e-amend-backup.hg (glob) |
|
112 | saved backup bundle to $TESTTMP/.hg/strip-backup/74609c7f506e-amend-backup.hg (glob) | |
113 | 1 changesets found |
|
113 | 1 changesets found | |
114 | adding branch |
|
114 | adding branch | |
115 | adding changesets |
|
115 | adding changesets | |
116 | adding manifests |
|
116 | adding manifests | |
117 | adding file changes |
|
117 | adding file changes | |
118 | added 1 changesets with 1 changes to 1 files |
|
118 | added 1 changesets with 1 changes to 1 files | |
119 | committed changeset 1:1cd866679df8 |
|
119 | committed changeset 1:1cd866679df8 | |
120 | $ hg diff -c . |
|
120 | $ hg diff -c . | |
121 | diff -r ad120869acf0 -r 1cd866679df8 a |
|
121 | diff -r ad120869acf0 -r 1cd866679df8 a | |
122 | --- a/a Thu Jan 01 00:00:00 1970 +0000 |
|
122 | --- a/a Thu Jan 01 00:00:00 1970 +0000 | |
123 | +++ b/a Thu Jan 01 00:00:00 1970 +0000 |
|
123 | +++ b/a Thu Jan 01 00:00:00 1970 +0000 | |
124 | @@ -1,1 +1,3 @@ |
|
124 | @@ -1,1 +1,3 @@ | |
125 | a |
|
125 | a | |
126 | +a |
|
126 | +a | |
127 | +a |
|
127 | +a | |
128 | $ hg log |
|
128 | $ hg log | |
129 | changeset: 1:1cd866679df8 |
|
129 | changeset: 1:1cd866679df8 | |
130 | tag: tip |
|
130 | tag: tip | |
131 | user: test |
|
131 | user: test | |
132 | date: Thu Jan 01 00:00:00 1970 +0000 |
|
132 | date: Thu Jan 01 00:00:00 1970 +0000 | |
133 | summary: no changes, new message |
|
133 | summary: no changes, new message | |
134 |
|
134 | |||
135 | changeset: 0:ad120869acf0 |
|
135 | changeset: 0:ad120869acf0 | |
136 | user: test |
|
136 | user: test | |
137 | date: Thu Jan 01 00:00:00 1970 +0000 |
|
137 | date: Thu Jan 01 00:00:00 1970 +0000 | |
138 | summary: base |
|
138 | summary: base | |
139 |
|
139 | |||
140 |
|
140 | |||
141 | Disable default date on commit so when -d isn't given, the old date is preserved: |
|
141 | Disable default date on commit so when -d isn't given, the old date is preserved: | |
142 |
|
142 | |||
143 | $ echo '[defaults]' >> $HGRCPATH |
|
143 | $ echo '[defaults]' >> $HGRCPATH | |
144 | $ echo 'commit=' >> $HGRCPATH |
|
144 | $ echo 'commit=' >> $HGRCPATH | |
145 |
|
145 | |||
146 | Test -u/-d: |
|
146 | Test -u/-d: | |
147 |
|
147 | |||
148 | $ cat > .hg/checkeditform.sh <<EOF |
|
148 | $ cat > .hg/checkeditform.sh <<EOF | |
149 | > env | grep HGEDITFORM |
|
149 | > env | grep HGEDITFORM | |
150 | > true |
|
150 | > true | |
151 | > EOF |
|
151 | > EOF | |
152 | $ HGEDITOR="sh .hg/checkeditform.sh" hg ci --amend -u foo -d '1 0' |
|
152 | $ HGEDITOR="sh .hg/checkeditform.sh" hg ci --amend -u foo -d '1 0' | |
153 | HGEDITFORM=commit.amend.normal |
|
153 | HGEDITFORM=commit.amend.normal | |
154 | saved backup bundle to $TESTTMP/.hg/strip-backup/1cd866679df8-amend-backup.hg (glob) |
|
154 | saved backup bundle to $TESTTMP/.hg/strip-backup/1cd866679df8-amend-backup.hg (glob) | |
155 | $ echo a >> a |
|
155 | $ echo a >> a | |
156 | $ hg ci --amend -u foo -d '1 0' |
|
156 | $ hg ci --amend -u foo -d '1 0' | |
157 | saved backup bundle to $TESTTMP/.hg/strip-backup/780e6f23e03d-amend-backup.hg (glob) |
|
157 | saved backup bundle to $TESTTMP/.hg/strip-backup/780e6f23e03d-amend-backup.hg (glob) | |
158 | $ hg log -r . |
|
158 | $ hg log -r . | |
159 | changeset: 1:5f357c7560ab |
|
159 | changeset: 1:5f357c7560ab | |
160 | tag: tip |
|
160 | tag: tip | |
161 | user: foo |
|
161 | user: foo | |
162 | date: Thu Jan 01 00:00:01 1970 +0000 |
|
162 | date: Thu Jan 01 00:00:01 1970 +0000 | |
163 | summary: no changes, new message |
|
163 | summary: no changes, new message | |
164 |
|
164 | |||
165 |
|
165 | |||
166 | Open editor with old commit message if a message isn't given otherwise: |
|
166 | Open editor with old commit message if a message isn't given otherwise: | |
167 |
|
167 | |||
168 | $ cat > editor.sh << '__EOF__' |
|
168 | $ cat > editor.sh << '__EOF__' | |
169 | > #!/bin/sh |
|
169 | > #!/bin/sh | |
170 | > cat $1 |
|
170 | > cat $1 | |
171 | > echo "another precious commit message" > "$1" |
|
171 | > echo "another precious commit message" > "$1" | |
172 | > __EOF__ |
|
172 | > __EOF__ | |
173 |
|
173 | |||
174 | at first, test saving last-message.txt |
|
174 | at first, test saving last-message.txt | |
175 |
|
175 | |||
176 | $ cat > .hg/hgrc << '__EOF__' |
|
176 | $ cat > .hg/hgrc << '__EOF__' | |
177 | > [hooks] |
|
177 | > [hooks] | |
178 | > pretxncommit.test-saving-last-message = false |
|
178 | > pretxncommit.test-saving-last-message = false | |
179 | > __EOF__ |
|
179 | > __EOF__ | |
180 |
|
180 | |||
181 | $ rm -f .hg/last-message.txt |
|
181 | $ rm -f .hg/last-message.txt | |
182 | $ hg commit --amend -v -m "message given from command line" |
|
182 | $ hg commit --amend -v -m "message given from command line" | |
183 | amending changeset 5f357c7560ab |
|
183 | amending changeset 5f357c7560ab | |
184 | copying changeset 5f357c7560ab to ad120869acf0 |
|
184 | copying changeset 5f357c7560ab to ad120869acf0 | |
185 | a |
|
185 | a | |
186 | running hook pretxncommit.test-saving-last-message: false |
|
186 | running hook pretxncommit.test-saving-last-message: false | |
187 | transaction abort! |
|
187 | transaction abort! | |
188 | rollback completed |
|
188 | rollback completed | |
189 | abort: pretxncommit.test-saving-last-message hook exited with status 1 |
|
189 | abort: pretxncommit.test-saving-last-message hook exited with status 1 | |
190 | [255] |
|
190 | [255] | |
191 | $ cat .hg/last-message.txt |
|
191 | $ cat .hg/last-message.txt | |
192 | message given from command line (no-eol) |
|
192 | message given from command line (no-eol) | |
193 |
|
193 | |||
194 | $ rm -f .hg/last-message.txt |
|
194 | $ rm -f .hg/last-message.txt | |
195 | $ HGEDITOR="\"sh\" \"`pwd`/editor.sh\"" hg commit --amend -v |
|
195 | $ HGEDITOR="\"sh\" \"`pwd`/editor.sh\"" hg commit --amend -v | |
196 | amending changeset 5f357c7560ab |
|
196 | amending changeset 5f357c7560ab | |
197 | copying changeset 5f357c7560ab to ad120869acf0 |
|
197 | copying changeset 5f357c7560ab to ad120869acf0 | |
198 | no changes, new message |
|
198 | no changes, new message | |
199 |
|
199 | |||
200 |
|
200 | |||
201 | HG: Enter commit message. Lines beginning with 'HG:' are removed. |
|
201 | HG: Enter commit message. Lines beginning with 'HG:' are removed. | |
202 | HG: Leave message empty to abort commit. |
|
202 | HG: Leave message empty to abort commit. | |
203 | HG: -- |
|
203 | HG: -- | |
204 | HG: user: foo |
|
204 | HG: user: foo | |
205 | HG: branch 'default' |
|
205 | HG: branch 'default' | |
206 | HG: changed a |
|
206 | HG: changed a | |
207 | a |
|
207 | a | |
208 | running hook pretxncommit.test-saving-last-message: false |
|
208 | running hook pretxncommit.test-saving-last-message: false | |
209 | transaction abort! |
|
209 | transaction abort! | |
210 | rollback completed |
|
210 | rollback completed | |
211 | abort: pretxncommit.test-saving-last-message hook exited with status 1 |
|
211 | abort: pretxncommit.test-saving-last-message hook exited with status 1 | |
212 | [255] |
|
212 | [255] | |
213 |
|
213 | |||
214 | $ cat .hg/last-message.txt |
|
214 | $ cat .hg/last-message.txt | |
215 | another precious commit message |
|
215 | another precious commit message | |
216 |
|
216 | |||
217 | $ cat > .hg/hgrc << '__EOF__' |
|
217 | $ cat > .hg/hgrc << '__EOF__' | |
218 | > [hooks] |
|
218 | > [hooks] | |
219 | > pretxncommit.test-saving-last-message = |
|
219 | > pretxncommit.test-saving-last-message = | |
220 | > __EOF__ |
|
220 | > __EOF__ | |
221 |
|
221 | |||
222 | then, test editing custom commit message |
|
222 | then, test editing custom commit message | |
223 |
|
223 | |||
224 | $ HGEDITOR="\"sh\" \"`pwd`/editor.sh\"" hg commit --amend -v |
|
224 | $ HGEDITOR="\"sh\" \"`pwd`/editor.sh\"" hg commit --amend -v | |
225 | amending changeset 5f357c7560ab |
|
225 | amending changeset 5f357c7560ab | |
226 | copying changeset 5f357c7560ab to ad120869acf0 |
|
226 | copying changeset 5f357c7560ab to ad120869acf0 | |
227 | no changes, new message |
|
227 | no changes, new message | |
228 |
|
228 | |||
229 |
|
229 | |||
230 | HG: Enter commit message. Lines beginning with 'HG:' are removed. |
|
230 | HG: Enter commit message. Lines beginning with 'HG:' are removed. | |
231 | HG: Leave message empty to abort commit. |
|
231 | HG: Leave message empty to abort commit. | |
232 | HG: -- |
|
232 | HG: -- | |
233 | HG: user: foo |
|
233 | HG: user: foo | |
234 | HG: branch 'default' |
|
234 | HG: branch 'default' | |
235 | HG: changed a |
|
235 | HG: changed a | |
236 | a |
|
236 | a | |
237 | stripping amended changeset 5f357c7560ab |
|
237 | stripping amended changeset 5f357c7560ab | |
238 | 1 changesets found |
|
238 | 1 changesets found | |
239 | saved backup bundle to $TESTTMP/.hg/strip-backup/5f357c7560ab-amend-backup.hg (glob) |
|
239 | saved backup bundle to $TESTTMP/.hg/strip-backup/5f357c7560ab-amend-backup.hg (glob) | |
240 | 1 changesets found |
|
240 | 1 changesets found | |
241 | adding branch |
|
241 | adding branch | |
242 | adding changesets |
|
242 | adding changesets | |
243 | adding manifests |
|
243 | adding manifests | |
244 | adding file changes |
|
244 | adding file changes | |
245 | added 1 changesets with 1 changes to 1 files |
|
245 | added 1 changesets with 1 changes to 1 files | |
246 | committed changeset 1:7ab3bf440b54 |
|
246 | committed changeset 1:7ab3bf440b54 | |
247 |
|
247 | |||
248 | Same, but with changes in working dir (different code path): |
|
248 | Same, but with changes in working dir (different code path): | |
249 |
|
249 | |||
250 | $ echo a >> a |
|
250 | $ echo a >> a | |
251 | $ HGEDITOR="\"sh\" \"`pwd`/editor.sh\"" hg commit --amend -v |
|
251 | $ HGEDITOR="\"sh\" \"`pwd`/editor.sh\"" hg commit --amend -v | |
252 | amending changeset 7ab3bf440b54 |
|
252 | amending changeset 7ab3bf440b54 | |
253 | a |
|
253 | a | |
254 | copying changeset a0ea9b1a4c8c to ad120869acf0 |
|
254 | copying changeset a0ea9b1a4c8c to ad120869acf0 | |
255 | another precious commit message |
|
255 | another precious commit message | |
256 |
|
256 | |||
257 |
|
257 | |||
258 | HG: Enter commit message. Lines beginning with 'HG:' are removed. |
|
258 | HG: Enter commit message. Lines beginning with 'HG:' are removed. | |
259 | HG: Leave message empty to abort commit. |
|
259 | HG: Leave message empty to abort commit. | |
260 | HG: -- |
|
260 | HG: -- | |
261 | HG: user: foo |
|
261 | HG: user: foo | |
262 | HG: branch 'default' |
|
262 | HG: branch 'default' | |
263 | HG: changed a |
|
263 | HG: changed a | |
264 | a |
|
264 | a | |
265 | stripping intermediate changeset a0ea9b1a4c8c |
|
265 | stripping intermediate changeset a0ea9b1a4c8c | |
266 | stripping amended changeset 7ab3bf440b54 |
|
266 | stripping amended changeset 7ab3bf440b54 | |
267 | 2 changesets found |
|
267 | 2 changesets found | |
268 | saved backup bundle to $TESTTMP/.hg/strip-backup/7ab3bf440b54-amend-backup.hg (glob) |
|
268 | saved backup bundle to $TESTTMP/.hg/strip-backup/7ab3bf440b54-amend-backup.hg (glob) | |
269 | 1 changesets found |
|
269 | 1 changesets found | |
270 | adding branch |
|
270 | adding branch | |
271 | adding changesets |
|
271 | adding changesets | |
272 | adding manifests |
|
272 | adding manifests | |
273 | adding file changes |
|
273 | adding file changes | |
274 | added 1 changesets with 1 changes to 1 files |
|
274 | added 1 changesets with 1 changes to 1 files | |
275 | committed changeset 1:ea22a388757c |
|
275 | committed changeset 1:ea22a388757c | |
276 |
|
276 | |||
277 | $ rm editor.sh |
|
277 | $ rm editor.sh | |
278 | $ hg log -r . |
|
278 | $ hg log -r . | |
279 | changeset: 1:ea22a388757c |
|
279 | changeset: 1:ea22a388757c | |
280 | tag: tip |
|
280 | tag: tip | |
281 | user: foo |
|
281 | user: foo | |
282 | date: Thu Jan 01 00:00:01 1970 +0000 |
|
282 | date: Thu Jan 01 00:00:01 1970 +0000 | |
283 | summary: another precious commit message |
|
283 | summary: another precious commit message | |
284 |
|
284 | |||
285 |
|
285 | |||
286 | Moving bookmarks, preserve active bookmark: |
|
286 | Moving bookmarks, preserve active bookmark: | |
287 |
|
287 | |||
288 | $ hg book book1 |
|
288 | $ hg book book1 | |
289 | $ hg book book2 |
|
289 | $ hg book book2 | |
290 | $ hg ci --amend -m 'move bookmarks' |
|
290 | $ hg ci --amend -m 'move bookmarks' | |
291 | saved backup bundle to $TESTTMP/.hg/strip-backup/ea22a388757c-amend-backup.hg (glob) |
|
291 | saved backup bundle to $TESTTMP/.hg/strip-backup/ea22a388757c-amend-backup.hg (glob) | |
292 | $ hg book |
|
292 | $ hg book | |
293 | book1 1:6cec5aa930e2 |
|
293 | book1 1:6cec5aa930e2 | |
294 | * book2 1:6cec5aa930e2 |
|
294 | * book2 1:6cec5aa930e2 | |
295 | $ echo a >> a |
|
295 | $ echo a >> a | |
296 | $ hg ci --amend -m 'move bookmarks' |
|
296 | $ hg ci --amend -m 'move bookmarks' | |
297 | saved backup bundle to $TESTTMP/.hg/strip-backup/6cec5aa930e2-amend-backup.hg (glob) |
|
297 | saved backup bundle to $TESTTMP/.hg/strip-backup/6cec5aa930e2-amend-backup.hg (glob) | |
298 | $ hg book |
|
298 | $ hg book | |
299 | book1 1:48bb6e53a15f |
|
299 | book1 1:48bb6e53a15f | |
300 | * book2 1:48bb6e53a15f |
|
300 | * book2 1:48bb6e53a15f | |
301 |
|
301 | |||
302 | abort does not loose bookmarks |
|
302 | abort does not loose bookmarks | |
303 |
|
303 | |||
304 | $ cat > editor.sh << '__EOF__' |
|
304 | $ cat > editor.sh << '__EOF__' | |
305 | > #!/bin/sh |
|
305 | > #!/bin/sh | |
306 | > echo "" > "$1" |
|
306 | > echo "" > "$1" | |
307 | > __EOF__ |
|
307 | > __EOF__ | |
308 | $ echo a >> a |
|
308 | $ echo a >> a | |
309 | $ HGEDITOR="\"sh\" \"`pwd`/editor.sh\"" hg commit --amend |
|
309 | $ HGEDITOR="\"sh\" \"`pwd`/editor.sh\"" hg commit --amend | |
310 | transaction abort! |
|
310 | transaction abort! | |
311 | rollback completed |
|
311 | rollback completed | |
312 | abort: empty commit message |
|
312 | abort: empty commit message | |
313 | [255] |
|
313 | [255] | |
314 | $ hg book |
|
314 | $ hg book | |
315 | book1 1:48bb6e53a15f |
|
315 | book1 1:48bb6e53a15f | |
316 | * book2 1:48bb6e53a15f |
|
316 | * book2 1:48bb6e53a15f | |
317 | $ hg revert -Caq |
|
317 | $ hg revert -Caq | |
318 | $ rm editor.sh |
|
318 | $ rm editor.sh | |
319 |
|
319 | |||
320 | $ echo '[defaults]' >> $HGRCPATH |
|
320 | $ echo '[defaults]' >> $HGRCPATH | |
321 | $ echo "commit=-d '0 0'" >> $HGRCPATH |
|
321 | $ echo "commit=-d '0 0'" >> $HGRCPATH | |
322 |
|
322 | |||
323 | Moving branches: |
|
323 | Moving branches: | |
324 |
|
324 | |||
325 | $ hg branch foo |
|
325 | $ hg branch foo | |
326 | marked working directory as branch foo |
|
326 | marked working directory as branch foo | |
327 | (branches are permanent and global, did you want a bookmark?) |
|
327 | (branches are permanent and global, did you want a bookmark?) | |
328 | $ echo a >> a |
|
328 | $ echo a >> a | |
329 | $ hg ci -m 'branch foo' |
|
329 | $ hg ci -m 'branch foo' | |
330 | $ hg branch default -f |
|
330 | $ hg branch default -f | |
331 | marked working directory as branch default |
|
331 | marked working directory as branch default | |
332 | (branches are permanent and global, did you want a bookmark?) |
|
332 | (branches are permanent and global, did you want a bookmark?) | |
333 | $ hg ci --amend -m 'back to default' |
|
333 | $ hg ci --amend -m 'back to default' | |
334 | saved backup bundle to $TESTTMP/.hg/strip-backup/8ac881fbf49d-amend-backup.hg (glob) |
|
334 | saved backup bundle to $TESTTMP/.hg/strip-backup/8ac881fbf49d-amend-backup.hg (glob) | |
335 | $ hg branches |
|
335 | $ hg branches | |
336 | default 2:ce12b0b57d46 |
|
336 | default 2:ce12b0b57d46 | |
337 |
|
337 | |||
338 | Close branch: |
|
338 | Close branch: | |
339 |
|
339 | |||
340 | $ hg up -q 0 |
|
340 | $ hg up -q 0 | |
341 | $ echo b >> b |
|
341 | $ echo b >> b | |
342 | $ hg branch foo |
|
342 | $ hg branch foo | |
343 | marked working directory as branch foo |
|
343 | marked working directory as branch foo | |
344 | (branches are permanent and global, did you want a bookmark?) |
|
344 | (branches are permanent and global, did you want a bookmark?) | |
345 | $ hg ci -Am 'fork' |
|
345 | $ hg ci -Am 'fork' | |
346 | adding b |
|
346 | adding b | |
347 | $ echo b >> b |
|
347 | $ echo b >> b | |
348 | $ hg ci -mb |
|
348 | $ hg ci -mb | |
349 | $ hg ci --amend --close-branch -m 'closing branch foo' |
|
349 | $ hg ci --amend --close-branch -m 'closing branch foo' | |
350 | saved backup bundle to $TESTTMP/.hg/strip-backup/c962248fa264-amend-backup.hg (glob) |
|
350 | saved backup bundle to $TESTTMP/.hg/strip-backup/c962248fa264-amend-backup.hg (glob) | |
351 |
|
351 | |||
352 | Same thing, different code path: |
|
352 | Same thing, different code path: | |
353 |
|
353 | |||
354 | $ echo b >> b |
|
354 | $ echo b >> b | |
355 | $ hg ci -m 'reopen branch' |
|
355 | $ hg ci -m 'reopen branch' | |
356 | reopening closed branch head 4 |
|
356 | reopening closed branch head 4 | |
357 | $ echo b >> b |
|
357 | $ echo b >> b | |
358 | $ hg ci --amend --close-branch |
|
358 | $ hg ci --amend --close-branch | |
359 | saved backup bundle to $TESTTMP/.hg/strip-backup/027371728205-amend-backup.hg (glob) |
|
359 | saved backup bundle to $TESTTMP/.hg/strip-backup/027371728205-amend-backup.hg (glob) | |
360 | $ hg branches |
|
360 | $ hg branches | |
361 | default 2:ce12b0b57d46 |
|
361 | default 2:ce12b0b57d46 | |
362 |
|
362 | |||
363 | Refuse to amend during a merge: |
|
363 | Refuse to amend during a merge: | |
364 |
|
364 | |||
365 | $ hg up -q default |
|
365 | $ hg up -q default | |
366 | $ hg merge foo |
|
366 | $ hg merge foo | |
367 | 1 files updated, 0 files merged, 0 files removed, 0 files unresolved |
|
367 | 1 files updated, 0 files merged, 0 files removed, 0 files unresolved | |
368 | (branch merge, don't forget to commit) |
|
368 | (branch merge, don't forget to commit) | |
369 | $ hg ci --amend |
|
369 | $ hg ci --amend | |
370 | abort: cannot amend while merging |
|
370 | abort: cannot amend while merging | |
371 | [255] |
|
371 | [255] | |
372 | $ hg ci -m 'merge' |
|
372 | $ hg ci -m 'merge' | |
373 |
|
373 | |||
374 | Follow copies/renames: |
|
374 | Follow copies/renames: | |
375 |
|
375 | |||
376 | $ hg mv b c |
|
376 | $ hg mv b c | |
377 | $ hg ci -m 'b -> c' |
|
377 | $ hg ci -m 'b -> c' | |
378 | $ hg mv c d |
|
378 | $ hg mv c d | |
379 | $ hg ci --amend -m 'b -> d' |
|
379 | $ hg ci --amend -m 'b -> d' | |
380 | saved backup bundle to $TESTTMP/.hg/strip-backup/b8c6eac7f12e-amend-backup.hg (glob) |
|
380 | saved backup bundle to $TESTTMP/.hg/strip-backup/b8c6eac7f12e-amend-backup.hg (glob) | |
381 | $ hg st --rev '.^' --copies d |
|
381 | $ hg st --rev '.^' --copies d | |
382 | A d |
|
382 | A d | |
383 | b |
|
383 | b | |
384 | $ hg cp d e |
|
384 | $ hg cp d e | |
385 | $ hg ci -m 'e = d' |
|
385 | $ hg ci -m 'e = d' | |
386 | $ hg cp e f |
|
386 | $ hg cp e f | |
387 | $ hg ci --amend -m 'f = d' |
|
387 | $ hg ci --amend -m 'f = d' | |
388 | saved backup bundle to $TESTTMP/.hg/strip-backup/7f9761d65613-amend-backup.hg (glob) |
|
388 | saved backup bundle to $TESTTMP/.hg/strip-backup/7f9761d65613-amend-backup.hg (glob) | |
389 | $ hg st --rev '.^' --copies f |
|
389 | $ hg st --rev '.^' --copies f | |
390 | A f |
|
390 | A f | |
391 | d |
|
391 | d | |
392 |
|
392 | |||
393 | $ mv f f.orig |
|
393 | $ mv f f.orig | |
394 | $ hg rm -A f |
|
394 | $ hg rm -A f | |
395 | $ hg ci -m removef |
|
395 | $ hg ci -m removef | |
396 | $ hg cp a f |
|
396 | $ hg cp a f | |
397 | $ mv f.orig f |
|
397 | $ mv f.orig f | |
398 | $ hg ci --amend -m replacef |
|
398 | $ hg ci --amend -m replacef | |
399 | saved backup bundle to $TESTTMP/.hg/strip-backup/9e8c5f7e3d95-amend-backup.hg (glob) |
|
399 | saved backup bundle to $TESTTMP/.hg/strip-backup/9e8c5f7e3d95-amend-backup.hg (glob) | |
400 | $ hg st --change . --copies |
|
400 | $ hg st --change . --copies | |
401 | $ hg log -r . --template "{file_copies}\n" |
|
401 | $ hg log -r . --template "{file_copies}\n" | |
402 |
|
402 | |||
403 |
|
403 | |||
404 | Move added file (issue3410): |
|
404 | Move added file (issue3410): | |
405 |
|
405 | |||
406 | $ echo g >> g |
|
406 | $ echo g >> g | |
407 | $ hg ci -Am g |
|
407 | $ hg ci -Am g | |
408 | adding g |
|
408 | adding g | |
409 | $ hg mv g h |
|
409 | $ hg mv g h | |
410 | $ hg ci --amend |
|
410 | $ hg ci --amend | |
411 | saved backup bundle to $TESTTMP/.hg/strip-backup/24aa8eacce2b-amend-backup.hg (glob) |
|
411 | saved backup bundle to $TESTTMP/.hg/strip-backup/24aa8eacce2b-amend-backup.hg (glob) | |
412 | $ hg st --change . --copies h |
|
412 | $ hg st --change . --copies h | |
413 | A h |
|
413 | A h | |
414 | $ hg log -r . --template "{file_copies}\n" |
|
414 | $ hg log -r . --template "{file_copies}\n" | |
415 |
|
415 | |||
416 |
|
416 | |||
417 | Can't rollback an amend: |
|
417 | Can't rollback an amend: | |
418 |
|
418 | |||
419 | $ hg rollback |
|
419 | $ hg rollback | |
420 | no rollback information available |
|
420 | no rollback information available | |
421 | [1] |
|
421 | [1] | |
422 |
|
422 | |||
423 | Preserve extra dict (issue3430): |
|
423 | Preserve extra dict (issue3430): | |
424 |
|
424 | |||
425 | $ hg branch a |
|
425 | $ hg branch a | |
426 | marked working directory as branch a |
|
426 | marked working directory as branch a | |
427 | (branches are permanent and global, did you want a bookmark?) |
|
427 | (branches are permanent and global, did you want a bookmark?) | |
428 | $ echo a >> a |
|
428 | $ echo a >> a | |
429 | $ hg ci -ma |
|
429 | $ hg ci -ma | |
430 | $ hg ci --amend -m "a'" |
|
430 | $ hg ci --amend -m "a'" | |
431 | saved backup bundle to $TESTTMP/.hg/strip-backup/3837aa2a2fdb-amend-backup.hg (glob) |
|
431 | saved backup bundle to $TESTTMP/.hg/strip-backup/3837aa2a2fdb-amend-backup.hg (glob) | |
432 | $ hg log -r . --template "{branch}\n" |
|
432 | $ hg log -r . --template "{branch}\n" | |
433 | a |
|
433 | a | |
434 | $ hg ci --amend -m "a''" |
|
434 | $ hg ci --amend -m "a''" | |
435 | saved backup bundle to $TESTTMP/.hg/strip-backup/c05c06be7514-amend-backup.hg (glob) |
|
435 | saved backup bundle to $TESTTMP/.hg/strip-backup/c05c06be7514-amend-backup.hg (glob) | |
436 | $ hg log -r . --template "{branch}\n" |
|
436 | $ hg log -r . --template "{branch}\n" | |
437 | a |
|
437 | a | |
438 |
|
438 | |||
439 | Also preserve other entries in the dict that are in the old commit, |
|
439 | Also preserve other entries in the dict that are in the old commit, | |
440 | first graft something so there's an additional entry: |
|
440 | first graft something so there's an additional entry: | |
441 |
|
441 | |||
442 | $ hg up 0 -q |
|
442 | $ hg up 0 -q | |
443 | $ echo z > z |
|
443 | $ echo z > z | |
444 | $ hg ci -Am 'fork' |
|
444 | $ hg ci -Am 'fork' | |
445 | adding z |
|
445 | adding z | |
446 | created new head |
|
446 | created new head | |
447 | $ hg up 11 |
|
447 | $ hg up 11 | |
448 | 5 files updated, 0 files merged, 1 files removed, 0 files unresolved |
|
448 | 5 files updated, 0 files merged, 1 files removed, 0 files unresolved | |
449 | $ hg graft 12 |
|
449 | $ hg graft 12 | |
450 | grafting revision 12 |
|
450 | grafting revision 12 | |
451 | $ hg ci --amend -m 'graft amend' |
|
451 | $ hg ci --amend -m 'graft amend' | |
452 | saved backup bundle to $TESTTMP/.hg/strip-backup/bd010aea3f39-amend-backup.hg (glob) |
|
452 | saved backup bundle to $TESTTMP/.hg/strip-backup/bd010aea3f39-amend-backup.hg (glob) | |
453 | $ hg log -r . --debug | grep extra |
|
453 | $ hg log -r . --debug | grep extra | |
454 | extra: amend_source=bd010aea3f39f3fb2a2f884b9ccb0471cd77398e |
|
454 | extra: amend_source=bd010aea3f39f3fb2a2f884b9ccb0471cd77398e | |
455 | extra: branch=a |
|
455 | extra: branch=a | |
456 | extra: source=2647734878ef0236dda712fae9c1651cf694ea8a |
|
456 | extra: source=2647734878ef0236dda712fae9c1651cf694ea8a | |
457 |
|
457 | |||
458 | Preserve phase |
|
458 | Preserve phase | |
459 |
|
459 | |||
460 | $ hg phase '.^::.' |
|
460 | $ hg phase '.^::.' | |
461 | 11: draft |
|
461 | 11: draft | |
462 | 13: draft |
|
462 | 13: draft | |
463 | $ hg phase --secret --force . |
|
463 | $ hg phase --secret --force . | |
464 | $ hg phase '.^::.' |
|
464 | $ hg phase '.^::.' | |
465 | 11: draft |
|
465 | 11: draft | |
466 | 13: secret |
|
466 | 13: secret | |
467 | $ hg commit --amend -m 'amend for phase' -q |
|
467 | $ hg commit --amend -m 'amend for phase' -q | |
468 | $ hg phase '.^::.' |
|
468 | $ hg phase '.^::.' | |
469 | 11: draft |
|
469 | 11: draft | |
470 | 13: secret |
|
470 | 13: secret | |
471 |
|
471 | |||
472 | Test amend with obsolete |
|
472 | Test amend with obsolete | |
473 | --------------------------- |
|
473 | --------------------------- | |
474 |
|
474 | |||
475 | Enable obsolete |
|
475 | Enable obsolete | |
476 |
|
476 | |||
477 |
$ cat > |
|
477 | $ cat >> $HGRCPATH << EOF | |
478 | > import mercurial.obsolete |
|
478 | > [experimental] | |
479 | > mercurial.obsolete._enabled = True |
|
479 | > evolution=createmarkers,allowunstable | |
480 | > EOF |
|
480 | > EOF | |
481 | $ echo '[extensions]' >> $HGRCPATH |
|
|||
482 | $ echo "obs=${TESTTMP}/obs.py" >> $HGRCPATH |
|
|||
483 |
|
||||
484 |
|
481 | |||
485 | Amend with no files changes |
|
482 | Amend with no files changes | |
486 |
|
483 | |||
487 | $ hg id -n |
|
484 | $ hg id -n | |
488 | 13 |
|
485 | 13 | |
489 | $ hg ci --amend -m 'babar' |
|
486 | $ hg ci --amend -m 'babar' | |
490 | $ hg id -n |
|
487 | $ hg id -n | |
491 | 14 |
|
488 | 14 | |
492 | $ hg log -Gl 3 --style=compact |
|
489 | $ hg log -Gl 3 --style=compact | |
493 | @ 14[tip]:11 b650e6ee8614 1970-01-01 00:00 +0000 test |
|
490 | @ 14[tip]:11 b650e6ee8614 1970-01-01 00:00 +0000 test | |
494 | | babar |
|
491 | | babar | |
495 | | |
|
492 | | | |
496 | | o 12:0 2647734878ef 1970-01-01 00:00 +0000 test |
|
493 | | o 12:0 2647734878ef 1970-01-01 00:00 +0000 test | |
497 | | | fork |
|
494 | | | fork | |
498 | | | |
|
495 | | | | |
499 | o | 11 3334b7925910 1970-01-01 00:00 +0000 test |
|
496 | o | 11 3334b7925910 1970-01-01 00:00 +0000 test | |
500 | | | a'' |
|
497 | | | a'' | |
501 | | | |
|
498 | | | | |
502 | $ hg log -Gl 4 --hidden --style=compact |
|
499 | $ hg log -Gl 4 --hidden --style=compact | |
503 | @ 14[tip]:11 b650e6ee8614 1970-01-01 00:00 +0000 test |
|
500 | @ 14[tip]:11 b650e6ee8614 1970-01-01 00:00 +0000 test | |
504 | | babar |
|
501 | | babar | |
505 | | |
|
502 | | | |
506 | | x 13:11 68ff8ff97044 1970-01-01 00:00 +0000 test |
|
503 | | x 13:11 68ff8ff97044 1970-01-01 00:00 +0000 test | |
507 | |/ amend for phase |
|
504 | |/ amend for phase | |
508 | | |
|
505 | | | |
509 | | o 12:0 2647734878ef 1970-01-01 00:00 +0000 test |
|
506 | | o 12:0 2647734878ef 1970-01-01 00:00 +0000 test | |
510 | | | fork |
|
507 | | | fork | |
511 | | | |
|
508 | | | | |
512 | o | 11 3334b7925910 1970-01-01 00:00 +0000 test |
|
509 | o | 11 3334b7925910 1970-01-01 00:00 +0000 test | |
513 | | | a'' |
|
510 | | | a'' | |
514 | | | |
|
511 | | | | |
515 |
|
512 | |||
516 | Amend with files changes |
|
513 | Amend with files changes | |
517 |
|
514 | |||
518 | (note: the extra commit over 15 is a temporary junk I would be happy to get |
|
515 | (note: the extra commit over 15 is a temporary junk I would be happy to get | |
519 | ride of) |
|
516 | ride of) | |
520 |
|
517 | |||
521 | $ echo 'babar' >> a |
|
518 | $ echo 'babar' >> a | |
522 | $ hg commit --amend |
|
519 | $ hg commit --amend | |
523 | $ hg log -Gl 6 --hidden --style=compact |
|
520 | $ hg log -Gl 6 --hidden --style=compact | |
524 | @ 16[tip]:11 9f9e9bccf56c 1970-01-01 00:00 +0000 test |
|
521 | @ 16[tip]:11 9f9e9bccf56c 1970-01-01 00:00 +0000 test | |
525 | | babar |
|
522 | | babar | |
526 | | |
|
523 | | | |
527 | | x 15 90fef497c56f 1970-01-01 00:00 +0000 test |
|
524 | | x 15 90fef497c56f 1970-01-01 00:00 +0000 test | |
528 | | | temporary amend commit for b650e6ee8614 |
|
525 | | | temporary amend commit for b650e6ee8614 | |
529 | | | |
|
526 | | | | |
530 | | x 14:11 b650e6ee8614 1970-01-01 00:00 +0000 test |
|
527 | | x 14:11 b650e6ee8614 1970-01-01 00:00 +0000 test | |
531 | |/ babar |
|
528 | |/ babar | |
532 | | |
|
529 | | | |
533 | | x 13:11 68ff8ff97044 1970-01-01 00:00 +0000 test |
|
530 | | x 13:11 68ff8ff97044 1970-01-01 00:00 +0000 test | |
534 | |/ amend for phase |
|
531 | |/ amend for phase | |
535 | | |
|
532 | | | |
536 | | o 12:0 2647734878ef 1970-01-01 00:00 +0000 test |
|
533 | | o 12:0 2647734878ef 1970-01-01 00:00 +0000 test | |
537 | | | fork |
|
534 | | | fork | |
538 | | | |
|
535 | | | | |
539 | o | 11 3334b7925910 1970-01-01 00:00 +0000 test |
|
536 | o | 11 3334b7925910 1970-01-01 00:00 +0000 test | |
540 | | | a'' |
|
537 | | | a'' | |
541 | | | |
|
538 | | | | |
542 |
|
539 | |||
543 |
|
540 | |||
544 | Test that amend does not make it easy to create obsolescence cycle |
|
541 | Test that amend does not make it easy to create obsolescence cycle | |
545 | --------------------------------------------------------------------- |
|
542 | --------------------------------------------------------------------- | |
546 |
|
543 | |||
547 | $ hg id -r 14 --hidden |
|
544 | $ hg id -r 14 --hidden | |
548 | b650e6ee8614 (a) |
|
545 | b650e6ee8614 (a) | |
549 | $ hg revert -ar 14 --hidden |
|
546 | $ hg revert -ar 14 --hidden | |
550 | reverting a |
|
547 | reverting a | |
551 | $ hg commit --amend |
|
548 | $ hg commit --amend | |
552 | $ hg id |
|
549 | $ hg id | |
553 | b99e5df575f7 (a) tip |
|
550 | b99e5df575f7 (a) tip | |
554 |
|
551 | |||
555 | Test that rewriting leaving instability behind is allowed |
|
552 | Test that rewriting leaving instability behind is allowed | |
556 | --------------------------------------------------------------------- |
|
553 | --------------------------------------------------------------------- | |
557 |
|
554 | |||
558 | $ hg up '.^' |
|
555 | $ hg up '.^' | |
559 | 0 files updated, 0 files merged, 1 files removed, 0 files unresolved |
|
556 | 0 files updated, 0 files merged, 1 files removed, 0 files unresolved | |
560 | $ echo 'b' >> a |
|
557 | $ echo 'b' >> a | |
561 | $ hg log --style compact -r 'children(.)' |
|
558 | $ hg log --style compact -r 'children(.)' | |
562 | 18[tip]:11 b99e5df575f7 1970-01-01 00:00 +0000 test |
|
559 | 18[tip]:11 b99e5df575f7 1970-01-01 00:00 +0000 test | |
563 | babar |
|
560 | babar | |
564 |
|
561 | |||
565 | $ hg commit --amend |
|
562 | $ hg commit --amend | |
566 | $ hg log -r 'unstable()' |
|
563 | $ hg log -r 'unstable()' | |
567 | changeset: 18:b99e5df575f7 |
|
564 | changeset: 18:b99e5df575f7 | |
568 | branch: a |
|
565 | branch: a | |
569 | parent: 11:3334b7925910 |
|
566 | parent: 11:3334b7925910 | |
570 | user: test |
|
567 | user: test | |
571 | date: Thu Jan 01 00:00:00 1970 +0000 |
|
568 | date: Thu Jan 01 00:00:00 1970 +0000 | |
572 | summary: babar |
|
569 | summary: babar | |
573 |
|
570 | |||
574 |
|
571 | |||
575 | Amend a merge changeset (with renames and conflicts from the second parent): |
|
572 | Amend a merge changeset (with renames and conflicts from the second parent): | |
576 |
|
573 | |||
577 | $ hg up -q default |
|
574 | $ hg up -q default | |
578 | $ hg branch -q bar |
|
575 | $ hg branch -q bar | |
579 | $ hg cp a aa |
|
576 | $ hg cp a aa | |
580 | $ hg mv z zz |
|
577 | $ hg mv z zz | |
581 | $ echo cc > cc |
|
578 | $ echo cc > cc | |
582 | $ hg add cc |
|
579 | $ hg add cc | |
583 | $ hg ci -m aazzcc |
|
580 | $ hg ci -m aazzcc | |
584 | $ hg up -q default |
|
581 | $ hg up -q default | |
585 | $ echo a >> a |
|
582 | $ echo a >> a | |
586 | $ echo dd > cc |
|
583 | $ echo dd > cc | |
587 | $ hg add cc |
|
584 | $ hg add cc | |
588 | $ hg ci -m aa |
|
585 | $ hg ci -m aa | |
589 | $ hg merge -q bar |
|
586 | $ hg merge -q bar | |
590 | warning: conflicts during merge. |
|
587 | warning: conflicts during merge. | |
591 | merging cc incomplete! (edit conflicts, then use 'hg resolve --mark') |
|
588 | merging cc incomplete! (edit conflicts, then use 'hg resolve --mark') | |
592 | [1] |
|
589 | [1] | |
593 | $ hg resolve -m cc |
|
590 | $ hg resolve -m cc | |
594 | (no more unresolved files) |
|
591 | (no more unresolved files) | |
595 | $ hg ci -m 'merge bar' |
|
592 | $ hg ci -m 'merge bar' | |
596 | $ hg log --config diff.git=1 -pr . |
|
593 | $ hg log --config diff.git=1 -pr . | |
597 | changeset: 23:93cd4445f720 |
|
594 | changeset: 23:93cd4445f720 | |
598 | tag: tip |
|
595 | tag: tip | |
599 | parent: 22:30d96aeaf27b |
|
596 | parent: 22:30d96aeaf27b | |
600 | parent: 21:1aa437659d19 |
|
597 | parent: 21:1aa437659d19 | |
601 | user: test |
|
598 | user: test | |
602 | date: Thu Jan 01 00:00:00 1970 +0000 |
|
599 | date: Thu Jan 01 00:00:00 1970 +0000 | |
603 | summary: merge bar |
|
600 | summary: merge bar | |
604 |
|
601 | |||
605 | diff --git a/a b/aa |
|
602 | diff --git a/a b/aa | |
606 | copy from a |
|
603 | copy from a | |
607 | copy to aa |
|
604 | copy to aa | |
608 | diff --git a/cc b/cc |
|
605 | diff --git a/cc b/cc | |
609 | --- a/cc |
|
606 | --- a/cc | |
610 | +++ b/cc |
|
607 | +++ b/cc | |
611 | @@ -1,1 +1,5 @@ |
|
608 | @@ -1,1 +1,5 @@ | |
612 | +<<<<<<< local: 30d96aeaf27b - test: aa |
|
609 | +<<<<<<< local: 30d96aeaf27b - test: aa | |
613 | dd |
|
610 | dd | |
614 | +======= |
|
611 | +======= | |
615 | +cc |
|
612 | +cc | |
616 | +>>>>>>> other: 1aa437659d19 bar - test: aazzcc |
|
613 | +>>>>>>> other: 1aa437659d19 bar - test: aazzcc | |
617 | diff --git a/z b/zz |
|
614 | diff --git a/z b/zz | |
618 | rename from z |
|
615 | rename from z | |
619 | rename to zz |
|
616 | rename to zz | |
620 |
|
617 | |||
621 | $ hg debugrename aa |
|
618 | $ hg debugrename aa | |
622 | aa renamed from a:a80d06849b333b8a3d5c445f8ba3142010dcdc9e |
|
619 | aa renamed from a:a80d06849b333b8a3d5c445f8ba3142010dcdc9e | |
623 | $ hg debugrename zz |
|
620 | $ hg debugrename zz | |
624 | zz renamed from z:69a1b67522704ec122181c0890bd16e9d3e7516a |
|
621 | zz renamed from z:69a1b67522704ec122181c0890bd16e9d3e7516a | |
625 | $ hg debugrename cc |
|
622 | $ hg debugrename cc | |
626 | cc not renamed |
|
623 | cc not renamed | |
627 | $ HGEDITOR="sh .hg/checkeditform.sh" hg ci --amend -m 'merge bar (amend message)' --edit |
|
624 | $ HGEDITOR="sh .hg/checkeditform.sh" hg ci --amend -m 'merge bar (amend message)' --edit | |
628 | HGEDITFORM=commit.amend.merge |
|
625 | HGEDITFORM=commit.amend.merge | |
629 | $ hg log --config diff.git=1 -pr . |
|
626 | $ hg log --config diff.git=1 -pr . | |
630 | changeset: 24:832b50f2c271 |
|
627 | changeset: 24:832b50f2c271 | |
631 | tag: tip |
|
628 | tag: tip | |
632 | parent: 22:30d96aeaf27b |
|
629 | parent: 22:30d96aeaf27b | |
633 | parent: 21:1aa437659d19 |
|
630 | parent: 21:1aa437659d19 | |
634 | user: test |
|
631 | user: test | |
635 | date: Thu Jan 01 00:00:00 1970 +0000 |
|
632 | date: Thu Jan 01 00:00:00 1970 +0000 | |
636 | summary: merge bar (amend message) |
|
633 | summary: merge bar (amend message) | |
637 |
|
634 | |||
638 | diff --git a/a b/aa |
|
635 | diff --git a/a b/aa | |
639 | copy from a |
|
636 | copy from a | |
640 | copy to aa |
|
637 | copy to aa | |
641 | diff --git a/cc b/cc |
|
638 | diff --git a/cc b/cc | |
642 | --- a/cc |
|
639 | --- a/cc | |
643 | +++ b/cc |
|
640 | +++ b/cc | |
644 | @@ -1,1 +1,5 @@ |
|
641 | @@ -1,1 +1,5 @@ | |
645 | +<<<<<<< local: 30d96aeaf27b - test: aa |
|
642 | +<<<<<<< local: 30d96aeaf27b - test: aa | |
646 | dd |
|
643 | dd | |
647 | +======= |
|
644 | +======= | |
648 | +cc |
|
645 | +cc | |
649 | +>>>>>>> other: 1aa437659d19 bar - test: aazzcc |
|
646 | +>>>>>>> other: 1aa437659d19 bar - test: aazzcc | |
650 | diff --git a/z b/zz |
|
647 | diff --git a/z b/zz | |
651 | rename from z |
|
648 | rename from z | |
652 | rename to zz |
|
649 | rename to zz | |
653 |
|
650 | |||
654 | $ hg debugrename aa |
|
651 | $ hg debugrename aa | |
655 | aa renamed from a:a80d06849b333b8a3d5c445f8ba3142010dcdc9e |
|
652 | aa renamed from a:a80d06849b333b8a3d5c445f8ba3142010dcdc9e | |
656 | $ hg debugrename zz |
|
653 | $ hg debugrename zz | |
657 | zz renamed from z:69a1b67522704ec122181c0890bd16e9d3e7516a |
|
654 | zz renamed from z:69a1b67522704ec122181c0890bd16e9d3e7516a | |
658 | $ hg debugrename cc |
|
655 | $ hg debugrename cc | |
659 | cc not renamed |
|
656 | cc not renamed | |
660 | $ hg mv zz z |
|
657 | $ hg mv zz z | |
661 | $ hg ci --amend -m 'merge bar (undo rename)' |
|
658 | $ hg ci --amend -m 'merge bar (undo rename)' | |
662 | $ hg log --config diff.git=1 -pr . |
|
659 | $ hg log --config diff.git=1 -pr . | |
663 | changeset: 26:bdafc5c72f74 |
|
660 | changeset: 26:bdafc5c72f74 | |
664 | tag: tip |
|
661 | tag: tip | |
665 | parent: 22:30d96aeaf27b |
|
662 | parent: 22:30d96aeaf27b | |
666 | parent: 21:1aa437659d19 |
|
663 | parent: 21:1aa437659d19 | |
667 | user: test |
|
664 | user: test | |
668 | date: Thu Jan 01 00:00:00 1970 +0000 |
|
665 | date: Thu Jan 01 00:00:00 1970 +0000 | |
669 | summary: merge bar (undo rename) |
|
666 | summary: merge bar (undo rename) | |
670 |
|
667 | |||
671 | diff --git a/a b/aa |
|
668 | diff --git a/a b/aa | |
672 | copy from a |
|
669 | copy from a | |
673 | copy to aa |
|
670 | copy to aa | |
674 | diff --git a/cc b/cc |
|
671 | diff --git a/cc b/cc | |
675 | --- a/cc |
|
672 | --- a/cc | |
676 | +++ b/cc |
|
673 | +++ b/cc | |
677 | @@ -1,1 +1,5 @@ |
|
674 | @@ -1,1 +1,5 @@ | |
678 | +<<<<<<< local: 30d96aeaf27b - test: aa |
|
675 | +<<<<<<< local: 30d96aeaf27b - test: aa | |
679 | dd |
|
676 | dd | |
680 | +======= |
|
677 | +======= | |
681 | +cc |
|
678 | +cc | |
682 | +>>>>>>> other: 1aa437659d19 bar - test: aazzcc |
|
679 | +>>>>>>> other: 1aa437659d19 bar - test: aazzcc | |
683 |
|
680 | |||
684 | $ hg debugrename z |
|
681 | $ hg debugrename z | |
685 | z not renamed |
|
682 | z not renamed | |
686 |
|
683 | |||
687 | Amend a merge changeset (with renames during the merge): |
|
684 | Amend a merge changeset (with renames during the merge): | |
688 |
|
685 | |||
689 | $ hg up -q bar |
|
686 | $ hg up -q bar | |
690 | $ echo x > x |
|
687 | $ echo x > x | |
691 | $ hg add x |
|
688 | $ hg add x | |
692 | $ hg ci -m x |
|
689 | $ hg ci -m x | |
693 | $ hg up -q default |
|
690 | $ hg up -q default | |
694 | $ hg merge -q bar |
|
691 | $ hg merge -q bar | |
695 | $ hg mv aa aaa |
|
692 | $ hg mv aa aaa | |
696 | $ echo aa >> aaa |
|
693 | $ echo aa >> aaa | |
697 | $ hg ci -m 'merge bar again' |
|
694 | $ hg ci -m 'merge bar again' | |
698 | $ hg log --config diff.git=1 -pr . |
|
695 | $ hg log --config diff.git=1 -pr . | |
699 | changeset: 28:32f19415b634 |
|
696 | changeset: 28:32f19415b634 | |
700 | tag: tip |
|
697 | tag: tip | |
701 | parent: 26:bdafc5c72f74 |
|
698 | parent: 26:bdafc5c72f74 | |
702 | parent: 27:4c94d5bc65f5 |
|
699 | parent: 27:4c94d5bc65f5 | |
703 | user: test |
|
700 | user: test | |
704 | date: Thu Jan 01 00:00:00 1970 +0000 |
|
701 | date: Thu Jan 01 00:00:00 1970 +0000 | |
705 | summary: merge bar again |
|
702 | summary: merge bar again | |
706 |
|
703 | |||
707 | diff --git a/aa b/aa |
|
704 | diff --git a/aa b/aa | |
708 | deleted file mode 100644 |
|
705 | deleted file mode 100644 | |
709 | --- a/aa |
|
706 | --- a/aa | |
710 | +++ /dev/null |
|
707 | +++ /dev/null | |
711 | @@ -1,2 +0,0 @@ |
|
708 | @@ -1,2 +0,0 @@ | |
712 | -a |
|
709 | -a | |
713 | -a |
|
710 | -a | |
714 | diff --git a/aaa b/aaa |
|
711 | diff --git a/aaa b/aaa | |
715 | new file mode 100644 |
|
712 | new file mode 100644 | |
716 | --- /dev/null |
|
713 | --- /dev/null | |
717 | +++ b/aaa |
|
714 | +++ b/aaa | |
718 | @@ -0,0 +1,3 @@ |
|
715 | @@ -0,0 +1,3 @@ | |
719 | +a |
|
716 | +a | |
720 | +a |
|
717 | +a | |
721 | +aa |
|
718 | +aa | |
722 | diff --git a/x b/x |
|
719 | diff --git a/x b/x | |
723 | new file mode 100644 |
|
720 | new file mode 100644 | |
724 | --- /dev/null |
|
721 | --- /dev/null | |
725 | +++ b/x |
|
722 | +++ b/x | |
726 | @@ -0,0 +1,1 @@ |
|
723 | @@ -0,0 +1,1 @@ | |
727 | +x |
|
724 | +x | |
728 |
|
725 | |||
729 | $ hg debugrename aaa |
|
726 | $ hg debugrename aaa | |
730 | aaa renamed from aa:37d9b5d994eab34eda9c16b195ace52c7b129980 |
|
727 | aaa renamed from aa:37d9b5d994eab34eda9c16b195ace52c7b129980 | |
731 | $ hg mv aaa aa |
|
728 | $ hg mv aaa aa | |
732 | $ hg ci --amend -m 'merge bar again (undo rename)' |
|
729 | $ hg ci --amend -m 'merge bar again (undo rename)' | |
733 | $ hg log --config diff.git=1 -pr . |
|
730 | $ hg log --config diff.git=1 -pr . | |
734 | changeset: 30:1e2a06b3d312 |
|
731 | changeset: 30:1e2a06b3d312 | |
735 | tag: tip |
|
732 | tag: tip | |
736 | parent: 26:bdafc5c72f74 |
|
733 | parent: 26:bdafc5c72f74 | |
737 | parent: 27:4c94d5bc65f5 |
|
734 | parent: 27:4c94d5bc65f5 | |
738 | user: test |
|
735 | user: test | |
739 | date: Thu Jan 01 00:00:00 1970 +0000 |
|
736 | date: Thu Jan 01 00:00:00 1970 +0000 | |
740 | summary: merge bar again (undo rename) |
|
737 | summary: merge bar again (undo rename) | |
741 |
|
738 | |||
742 | diff --git a/aa b/aa |
|
739 | diff --git a/aa b/aa | |
743 | --- a/aa |
|
740 | --- a/aa | |
744 | +++ b/aa |
|
741 | +++ b/aa | |
745 | @@ -1,2 +1,3 @@ |
|
742 | @@ -1,2 +1,3 @@ | |
746 | a |
|
743 | a | |
747 | a |
|
744 | a | |
748 | +aa |
|
745 | +aa | |
749 | diff --git a/x b/x |
|
746 | diff --git a/x b/x | |
750 | new file mode 100644 |
|
747 | new file mode 100644 | |
751 | --- /dev/null |
|
748 | --- /dev/null | |
752 | +++ b/x |
|
749 | +++ b/x | |
753 | @@ -0,0 +1,1 @@ |
|
750 | @@ -0,0 +1,1 @@ | |
754 | +x |
|
751 | +x | |
755 |
|
752 | |||
756 | $ hg debugrename aa |
|
753 | $ hg debugrename aa | |
757 | aa not renamed |
|
754 | aa not renamed | |
758 | $ hg debugrename -r '.^' aa |
|
755 | $ hg debugrename -r '.^' aa | |
759 | aa renamed from a:a80d06849b333b8a3d5c445f8ba3142010dcdc9e |
|
756 | aa renamed from a:a80d06849b333b8a3d5c445f8ba3142010dcdc9e | |
760 |
|
757 | |||
761 | Amend a merge changeset (with manifest-level conflicts): |
|
758 | Amend a merge changeset (with manifest-level conflicts): | |
762 |
|
759 | |||
763 | $ hg up -q bar |
|
760 | $ hg up -q bar | |
764 | $ hg rm aa |
|
761 | $ hg rm aa | |
765 | $ hg ci -m 'rm aa' |
|
762 | $ hg ci -m 'rm aa' | |
766 | $ hg up -q default |
|
763 | $ hg up -q default | |
767 | $ echo aa >> aa |
|
764 | $ echo aa >> aa | |
768 | $ hg ci -m aa |
|
765 | $ hg ci -m aa | |
769 | $ hg merge -q bar |
|
766 | $ hg merge -q bar | |
770 | local changed aa which remote deleted |
|
767 | local changed aa which remote deleted | |
771 | use (c)hanged version or (d)elete? c |
|
768 | use (c)hanged version or (d)elete? c | |
772 | $ hg ci -m 'merge bar (with conflicts)' |
|
769 | $ hg ci -m 'merge bar (with conflicts)' | |
773 | $ hg log --config diff.git=1 -pr . |
|
770 | $ hg log --config diff.git=1 -pr . | |
774 | changeset: 33:97a298b0c59f |
|
771 | changeset: 33:97a298b0c59f | |
775 | tag: tip |
|
772 | tag: tip | |
776 | parent: 32:3d78ce4226b8 |
|
773 | parent: 32:3d78ce4226b8 | |
777 | parent: 31:67db8847a540 |
|
774 | parent: 31:67db8847a540 | |
778 | user: test |
|
775 | user: test | |
779 | date: Thu Jan 01 00:00:00 1970 +0000 |
|
776 | date: Thu Jan 01 00:00:00 1970 +0000 | |
780 | summary: merge bar (with conflicts) |
|
777 | summary: merge bar (with conflicts) | |
781 |
|
778 | |||
782 |
|
779 | |||
783 | $ hg rm aa |
|
780 | $ hg rm aa | |
784 | $ hg ci --amend -m 'merge bar (with conflicts, amended)' |
|
781 | $ hg ci --amend -m 'merge bar (with conflicts, amended)' | |
785 | $ hg log --config diff.git=1 -pr . |
|
782 | $ hg log --config diff.git=1 -pr . | |
786 | changeset: 35:6de0c1bde1c8 |
|
783 | changeset: 35:6de0c1bde1c8 | |
787 | tag: tip |
|
784 | tag: tip | |
788 | parent: 32:3d78ce4226b8 |
|
785 | parent: 32:3d78ce4226b8 | |
789 | parent: 31:67db8847a540 |
|
786 | parent: 31:67db8847a540 | |
790 | user: test |
|
787 | user: test | |
791 | date: Thu Jan 01 00:00:00 1970 +0000 |
|
788 | date: Thu Jan 01 00:00:00 1970 +0000 | |
792 | summary: merge bar (with conflicts, amended) |
|
789 | summary: merge bar (with conflicts, amended) | |
793 |
|
790 | |||
794 | diff --git a/aa b/aa |
|
791 | diff --git a/aa b/aa | |
795 | deleted file mode 100644 |
|
792 | deleted file mode 100644 | |
796 | --- a/aa |
|
793 | --- a/aa | |
797 | +++ /dev/null |
|
794 | +++ /dev/null | |
798 | @@ -1,4 +0,0 @@ |
|
795 | @@ -1,4 +0,0 @@ | |
799 | -a |
|
796 | -a | |
800 | -a |
|
797 | -a | |
801 | -aa |
|
798 | -aa | |
802 | -aa |
|
799 | -aa | |
803 |
|
800 | |||
804 | Issue 3445: amending with --close-branch a commit that created a new head should fail |
|
801 | Issue 3445: amending with --close-branch a commit that created a new head should fail | |
805 | This shouldn't be possible: |
|
802 | This shouldn't be possible: | |
806 |
|
803 | |||
807 | $ hg up -q default |
|
804 | $ hg up -q default | |
808 | $ hg branch closewithamend |
|
805 | $ hg branch closewithamend | |
809 | marked working directory as branch closewithamend |
|
806 | marked working directory as branch closewithamend | |
810 | (branches are permanent and global, did you want a bookmark?) |
|
807 | (branches are permanent and global, did you want a bookmark?) | |
811 | $ hg add obs.py |
|
808 | $ touch foo | |
|
809 | $ hg add foo | |||
812 | $ hg ci -m.. |
|
810 | $ hg ci -m.. | |
813 | $ hg ci --amend --close-branch -m 'closing' |
|
811 | $ hg ci --amend --close-branch -m 'closing' | |
814 | abort: can only close branch heads |
|
812 | abort: can only close branch heads | |
815 | [255] |
|
813 | [255] | |
816 |
|
814 | |||
817 | This silliness fails: |
|
815 | This silliness fails: | |
818 |
|
816 | |||
819 | $ hg branch silliness |
|
817 | $ hg branch silliness | |
820 | marked working directory as branch silliness |
|
818 | marked working directory as branch silliness | |
821 | (branches are permanent and global, did you want a bookmark?) |
|
819 | (branches are permanent and global, did you want a bookmark?) | |
822 | $ echo b >> b |
|
820 | $ echo b >> b | |
823 | $ hg ci --close-branch -m'open and close' |
|
821 | $ hg ci --close-branch -m'open and close' | |
824 | abort: can only close branch heads |
|
822 | abort: can only close branch heads | |
825 | [255] |
|
823 | [255] | |
826 |
|
824 | |||
827 | Test that amend with --secret creates new secret changeset forcibly |
|
825 | Test that amend with --secret creates new secret changeset forcibly | |
828 | --------------------------------------------------------------------- |
|
826 | --------------------------------------------------------------------- | |
829 |
|
827 | |||
830 | $ hg phase '.^::.' |
|
828 | $ hg phase '.^::.' | |
831 | 35: draft |
|
829 | 35: draft | |
832 | 36: draft |
|
830 | 36: draft | |
833 | $ hg commit --amend --secret -m 'amend as secret' -q |
|
831 | $ hg commit --amend --secret -m 'amend as secret' -q | |
834 | $ hg phase '.^::.' |
|
832 | $ hg phase '.^::.' | |
835 | 35: draft |
|
833 | 35: draft | |
836 | 38: secret |
|
834 | 38: secret | |
837 |
|
835 | |||
838 | Test that amend with --edit invokes editor forcibly |
|
836 | Test that amend with --edit invokes editor forcibly | |
839 | --------------------------------------------------- |
|
837 | --------------------------------------------------- | |
840 |
|
838 | |||
841 | $ hg parents --template "{desc}\n" |
|
839 | $ hg parents --template "{desc}\n" | |
842 | amend as secret |
|
840 | amend as secret | |
843 | $ HGEDITOR=cat hg commit --amend -m "editor should be suppressed" |
|
841 | $ HGEDITOR=cat hg commit --amend -m "editor should be suppressed" | |
844 | $ hg parents --template "{desc}\n" |
|
842 | $ hg parents --template "{desc}\n" | |
845 | editor should be suppressed |
|
843 | editor should be suppressed | |
846 |
|
844 | |||
847 | $ HGEDITOR=cat hg commit --amend -m "editor should be invoked" --edit |
|
845 | $ HGEDITOR=cat hg commit --amend -m "editor should be invoked" --edit | |
848 | editor should be invoked |
|
846 | editor should be invoked | |
849 |
|
847 | |||
850 |
|
848 | |||
851 | HG: Enter commit message. Lines beginning with 'HG:' are removed. |
|
849 | HG: Enter commit message. Lines beginning with 'HG:' are removed. | |
852 | HG: Leave message empty to abort commit. |
|
850 | HG: Leave message empty to abort commit. | |
853 | HG: -- |
|
851 | HG: -- | |
854 | HG: user: test |
|
852 | HG: user: test | |
855 | HG: branch 'silliness' |
|
853 | HG: branch 'silliness' | |
856 |
HG: changed |
|
854 | HG: changed foo | |
857 | $ hg parents --template "{desc}\n" |
|
855 | $ hg parents --template "{desc}\n" | |
858 | editor should be invoked |
|
856 | editor should be invoked |
General Comments 0
You need to be logged in to leave comments.
Login now