Show More
@@ -1,1298 +1,1329 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 | (see 'hg help phases' for details) |
|
14 | (see 'hg help phases' for details) | |
15 | [255] |
|
15 | [255] | |
16 | $ hg phase -r . -f -d |
|
16 | $ hg phase -r . -f -d | |
17 |
|
17 | |||
18 | $ echo a >> a |
|
18 | $ echo a >> a | |
19 | $ hg ci -Am 'base1' |
|
19 | $ hg ci -Am 'base1' | |
20 |
|
20 | |||
21 | Nothing to amend: |
|
21 | Nothing to amend: | |
22 |
|
22 | |||
23 | $ hg ci --amend -m 'base1' |
|
23 | $ hg ci --amend -m 'base1' | |
24 | nothing changed |
|
24 | nothing changed | |
25 | [1] |
|
25 | [1] | |
26 |
|
26 | |||
27 | $ cat >> $HGRCPATH <<EOF |
|
27 | $ cat >> $HGRCPATH <<EOF | |
28 | > [hooks] |
|
28 | > [hooks] | |
29 | > pretxncommit.foo = sh -c "echo \\"pretxncommit \$HG_NODE\\"; hg id -r \$HG_NODE" |
|
29 | > pretxncommit.foo = sh -c "echo \\"pretxncommit \$HG_NODE\\"; hg id -r \$HG_NODE" | |
30 | > EOF |
|
30 | > EOF | |
31 |
|
31 | |||
32 | Amending changeset with changes in working dir: |
|
32 | Amending changeset with changes in working dir: | |
33 | (and check that --message does not trigger an editor) |
|
33 | (and check that --message does not trigger an editor) | |
34 |
|
34 | |||
35 | $ echo a >> a |
|
35 | $ echo a >> a | |
36 | $ HGEDITOR="\"sh\" \"`pwd`/editor.sh\"" hg commit --amend -m 'amend base1' |
|
36 | $ HGEDITOR="\"sh\" \"`pwd`/editor.sh\"" hg commit --amend -m 'amend base1' | |
37 | pretxncommit 43f1ba15f28a50abf0aae529cf8a16bfced7b149 |
|
37 | pretxncommit 43f1ba15f28a50abf0aae529cf8a16bfced7b149 | |
38 | 43f1ba15f28a tip |
|
38 | 43f1ba15f28a tip | |
39 | saved backup bundle to $TESTTMP/.hg/strip-backup/489edb5b847d-5ab4f721-amend.hg |
|
39 | saved backup bundle to $TESTTMP/.hg/strip-backup/489edb5b847d-5ab4f721-amend.hg | |
40 | $ echo 'pretxncommit.foo = ' >> $HGRCPATH |
|
40 | $ echo 'pretxncommit.foo = ' >> $HGRCPATH | |
41 | $ hg diff -c . |
|
41 | $ hg diff -c . | |
42 | diff -r ad120869acf0 -r 43f1ba15f28a a |
|
42 | diff -r ad120869acf0 -r 43f1ba15f28a a | |
43 | --- a/a Thu Jan 01 00:00:00 1970 +0000 |
|
43 | --- a/a Thu Jan 01 00:00:00 1970 +0000 | |
44 | +++ b/a Thu Jan 01 00:00:00 1970 +0000 |
|
44 | +++ b/a Thu Jan 01 00:00:00 1970 +0000 | |
45 | @@ -1,1 +1,3 @@ |
|
45 | @@ -1,1 +1,3 @@ | |
46 | a |
|
46 | a | |
47 | +a |
|
47 | +a | |
48 | +a |
|
48 | +a | |
49 | $ hg log |
|
49 | $ hg log | |
50 | changeset: 1:43f1ba15f28a |
|
50 | changeset: 1:43f1ba15f28a | |
51 | tag: tip |
|
51 | tag: tip | |
52 | user: test |
|
52 | user: test | |
53 | date: Thu Jan 01 00:00:00 1970 +0000 |
|
53 | date: Thu Jan 01 00:00:00 1970 +0000 | |
54 | summary: amend base1 |
|
54 | summary: amend base1 | |
55 |
|
55 | |||
56 | changeset: 0:ad120869acf0 |
|
56 | changeset: 0:ad120869acf0 | |
57 | user: test |
|
57 | user: test | |
58 | date: Thu Jan 01 00:00:00 1970 +0000 |
|
58 | date: Thu Jan 01 00:00:00 1970 +0000 | |
59 | summary: base |
|
59 | summary: base | |
60 |
|
60 | |||
61 |
|
61 | |||
62 | Check proper abort for empty message |
|
62 | Check proper abort for empty message | |
63 |
|
63 | |||
64 | $ cat > editor.sh << '__EOF__' |
|
64 | $ cat > editor.sh << '__EOF__' | |
65 | > #!/bin/sh |
|
65 | > #!/bin/sh | |
66 | > echo "" > "$1" |
|
66 | > echo "" > "$1" | |
67 | > __EOF__ |
|
67 | > __EOF__ | |
68 |
|
68 | |||
69 | Update the existing file to ensure that the dirstate is not in pending state |
|
69 | Update the existing file to ensure that the dirstate is not in pending state | |
70 | (where the status of some files in the working copy is not known yet). This in |
|
70 | (where the status of some files in the working copy is not known yet). This in | |
71 | turn ensures that when the transaction is aborted due to an empty message during |
|
71 | turn ensures that when the transaction is aborted due to an empty message during | |
72 | the amend, there should be no rollback. |
|
72 | the amend, there should be no rollback. | |
73 | $ echo a >> a |
|
73 | $ echo a >> a | |
74 |
|
74 | |||
75 | $ echo b > b |
|
75 | $ echo b > b | |
76 | $ hg add b |
|
76 | $ hg add b | |
77 | $ hg summary |
|
77 | $ hg summary | |
78 | parent: 1:43f1ba15f28a tip |
|
78 | parent: 1:43f1ba15f28a tip | |
79 | amend base1 |
|
79 | amend base1 | |
80 | branch: default |
|
80 | branch: default | |
81 | commit: 1 modified, 1 added, 1 unknown |
|
81 | commit: 1 modified, 1 added, 1 unknown | |
82 | update: (current) |
|
82 | update: (current) | |
83 | phases: 2 draft |
|
83 | phases: 2 draft | |
84 | $ HGEDITOR="\"sh\" \"`pwd`/editor.sh\"" hg commit --amend |
|
84 | $ HGEDITOR="\"sh\" \"`pwd`/editor.sh\"" hg commit --amend | |
85 | abort: empty commit message |
|
85 | abort: empty commit message | |
86 | [255] |
|
86 | [255] | |
87 | $ hg summary |
|
87 | $ hg summary | |
88 | parent: 1:43f1ba15f28a tip |
|
88 | parent: 1:43f1ba15f28a tip | |
89 | amend base1 |
|
89 | amend base1 | |
90 | branch: default |
|
90 | branch: default | |
91 | commit: 1 modified, 1 added, 1 unknown |
|
91 | commit: 1 modified, 1 added, 1 unknown | |
92 | update: (current) |
|
92 | update: (current) | |
93 | phases: 2 draft |
|
93 | phases: 2 draft | |
94 |
|
94 | |||
95 | Add new file along with modified existing file: |
|
95 | Add new file along with modified existing file: | |
96 | $ hg ci --amend -m 'amend base1 new file' |
|
96 | $ hg ci --amend -m 'amend base1 new file' | |
97 | saved backup bundle to $TESTTMP/.hg/strip-backup/43f1ba15f28a-007467c2-amend.hg |
|
97 | saved backup bundle to $TESTTMP/.hg/strip-backup/43f1ba15f28a-007467c2-amend.hg | |
98 |
|
98 | |||
99 | Remove file that was added in amended commit: |
|
99 | Remove file that was added in amended commit: | |
100 | (and test logfile option) |
|
100 | (and test logfile option) | |
101 | (and test that logfile option do not trigger an editor) |
|
101 | (and test that logfile option do not trigger an editor) | |
102 |
|
102 | |||
103 | $ hg rm b |
|
103 | $ hg rm b | |
104 | $ echo 'amend base1 remove new file' > ../logfile |
|
104 | $ echo 'amend base1 remove new file' > ../logfile | |
105 | $ HGEDITOR="\"sh\" \"`pwd`/editor.sh\"" hg ci --amend --logfile ../logfile |
|
105 | $ HGEDITOR="\"sh\" \"`pwd`/editor.sh\"" hg ci --amend --logfile ../logfile | |
106 | saved backup bundle to $TESTTMP/.hg/strip-backup/c16295aaf401-1ada9901-amend.hg |
|
106 | saved backup bundle to $TESTTMP/.hg/strip-backup/c16295aaf401-1ada9901-amend.hg | |
107 |
|
107 | |||
108 | $ hg cat b |
|
108 | $ hg cat b | |
109 | b: no such file in rev 47343646fa3d |
|
109 | b: no such file in rev 47343646fa3d | |
110 | [1] |
|
110 | [1] | |
111 |
|
111 | |||
112 | No changes, just a different message: |
|
112 | No changes, just a different message: | |
113 |
|
113 | |||
114 | $ hg ci -v --amend -m 'no changes, new message' |
|
114 | $ hg ci -v --amend -m 'no changes, new message' | |
115 | amending changeset 47343646fa3d |
|
115 | amending changeset 47343646fa3d | |
116 | copying changeset 47343646fa3d to ad120869acf0 |
|
116 | copying changeset 47343646fa3d to ad120869acf0 | |
117 | committing files: |
|
117 | committing files: | |
118 | a |
|
118 | a | |
119 | committing manifest |
|
119 | committing manifest | |
120 | committing changelog |
|
120 | committing changelog | |
121 | 1 changesets found |
|
121 | 1 changesets found | |
122 | uncompressed size of bundle content: |
|
122 | uncompressed size of bundle content: | |
123 | 254 (changelog) |
|
123 | 254 (changelog) | |
124 | 163 (manifests) |
|
124 | 163 (manifests) | |
125 | 131 a |
|
125 | 131 a | |
126 | saved backup bundle to $TESTTMP/.hg/strip-backup/47343646fa3d-c2758885-amend.hg |
|
126 | saved backup bundle to $TESTTMP/.hg/strip-backup/47343646fa3d-c2758885-amend.hg | |
127 | 1 changesets found |
|
127 | 1 changesets found | |
128 | uncompressed size of bundle content: |
|
128 | uncompressed size of bundle content: | |
129 | 250 (changelog) |
|
129 | 250 (changelog) | |
130 | 163 (manifests) |
|
130 | 163 (manifests) | |
131 | 131 a |
|
131 | 131 a | |
132 | adding branch |
|
132 | adding branch | |
133 | adding changesets |
|
133 | adding changesets | |
134 | adding manifests |
|
134 | adding manifests | |
135 | adding file changes |
|
135 | adding file changes | |
136 | added 1 changesets with 1 changes to 1 files |
|
136 | added 1 changesets with 1 changes to 1 files | |
137 | committed changeset 1:401431e913a1 |
|
137 | committed changeset 1:401431e913a1 | |
138 | $ hg diff -c . |
|
138 | $ hg diff -c . | |
139 | diff -r ad120869acf0 -r 401431e913a1 a |
|
139 | diff -r ad120869acf0 -r 401431e913a1 a | |
140 | --- a/a Thu Jan 01 00:00:00 1970 +0000 |
|
140 | --- a/a Thu Jan 01 00:00:00 1970 +0000 | |
141 | +++ b/a Thu Jan 01 00:00:00 1970 +0000 |
|
141 | +++ b/a Thu Jan 01 00:00:00 1970 +0000 | |
142 | @@ -1,1 +1,4 @@ |
|
142 | @@ -1,1 +1,4 @@ | |
143 | a |
|
143 | a | |
144 | +a |
|
144 | +a | |
145 | +a |
|
145 | +a | |
146 | +a |
|
146 | +a | |
147 | $ hg log |
|
147 | $ hg log | |
148 | changeset: 1:401431e913a1 |
|
148 | changeset: 1:401431e913a1 | |
149 | tag: tip |
|
149 | tag: tip | |
150 | user: test |
|
150 | user: test | |
151 | date: Thu Jan 01 00:00:00 1970 +0000 |
|
151 | date: Thu Jan 01 00:00:00 1970 +0000 | |
152 | summary: no changes, new message |
|
152 | summary: no changes, new message | |
153 |
|
153 | |||
154 | changeset: 0:ad120869acf0 |
|
154 | changeset: 0:ad120869acf0 | |
155 | user: test |
|
155 | user: test | |
156 | date: Thu Jan 01 00:00:00 1970 +0000 |
|
156 | date: Thu Jan 01 00:00:00 1970 +0000 | |
157 | summary: base |
|
157 | summary: base | |
158 |
|
158 | |||
159 |
|
159 | |||
160 | Disable default date on commit so when -d isn't given, the old date is preserved: |
|
160 | Disable default date on commit so when -d isn't given, the old date is preserved: | |
161 |
|
161 | |||
162 | $ echo '[defaults]' >> $HGRCPATH |
|
162 | $ echo '[defaults]' >> $HGRCPATH | |
163 | $ echo 'commit=' >> $HGRCPATH |
|
163 | $ echo 'commit=' >> $HGRCPATH | |
164 |
|
164 | |||
165 | Test -u/-d: |
|
165 | Test -u/-d: | |
166 |
|
166 | |||
167 | $ cat > .hg/checkeditform.sh <<EOF |
|
167 | $ cat > .hg/checkeditform.sh <<EOF | |
168 | > env | grep HGEDITFORM |
|
168 | > env | grep HGEDITFORM | |
169 | > true |
|
169 | > true | |
170 | > EOF |
|
170 | > EOF | |
171 | $ HGEDITOR="sh .hg/checkeditform.sh" hg ci --amend -u foo -d '1 0' |
|
171 | $ HGEDITOR="sh .hg/checkeditform.sh" hg ci --amend -u foo -d '1 0' | |
172 | HGEDITFORM=commit.amend.normal |
|
172 | HGEDITFORM=commit.amend.normal | |
173 | saved backup bundle to $TESTTMP/.hg/strip-backup/401431e913a1-5e8e532c-amend.hg |
|
173 | saved backup bundle to $TESTTMP/.hg/strip-backup/401431e913a1-5e8e532c-amend.hg | |
174 | $ echo a >> a |
|
174 | $ echo a >> a | |
175 | $ hg ci --amend -u foo -d '1 0' |
|
175 | $ hg ci --amend -u foo -d '1 0' | |
176 | saved backup bundle to $TESTTMP/.hg/strip-backup/d96b1d28ae33-677e0afb-amend.hg |
|
176 | saved backup bundle to $TESTTMP/.hg/strip-backup/d96b1d28ae33-677e0afb-amend.hg | |
177 | $ hg log -r . |
|
177 | $ hg log -r . | |
178 | changeset: 1:a9a13940fc03 |
|
178 | changeset: 1:a9a13940fc03 | |
179 | tag: tip |
|
179 | tag: tip | |
180 | user: foo |
|
180 | user: foo | |
181 | date: Thu Jan 01 00:00:01 1970 +0000 |
|
181 | date: Thu Jan 01 00:00:01 1970 +0000 | |
182 | summary: no changes, new message |
|
182 | summary: no changes, new message | |
183 |
|
183 | |||
184 |
|
184 | |||
185 | Open editor with old commit message if a message isn't given otherwise: |
|
185 | Open editor with old commit message if a message isn't given otherwise: | |
186 |
|
186 | |||
187 | $ cat > editor.sh << '__EOF__' |
|
187 | $ cat > editor.sh << '__EOF__' | |
188 | > #!/bin/sh |
|
188 | > #!/bin/sh | |
189 | > cat $1 |
|
189 | > cat $1 | |
190 | > echo "another precious commit message" > "$1" |
|
190 | > echo "another precious commit message" > "$1" | |
191 | > __EOF__ |
|
191 | > __EOF__ | |
192 |
|
192 | |||
193 | at first, test saving last-message.txt |
|
193 | at first, test saving last-message.txt | |
194 |
|
194 | |||
195 | $ cat > .hg/hgrc << '__EOF__' |
|
195 | $ cat > .hg/hgrc << '__EOF__' | |
196 | > [hooks] |
|
196 | > [hooks] | |
197 | > pretxncommit.test-saving-last-message = false |
|
197 | > pretxncommit.test-saving-last-message = false | |
198 | > __EOF__ |
|
198 | > __EOF__ | |
199 |
|
199 | |||
200 | $ rm -f .hg/last-message.txt |
|
200 | $ rm -f .hg/last-message.txt | |
201 | $ hg commit --amend -v -m "message given from command line" |
|
201 | $ hg commit --amend -v -m "message given from command line" | |
202 | amending changeset a9a13940fc03 |
|
202 | amending changeset a9a13940fc03 | |
203 | copying changeset a9a13940fc03 to ad120869acf0 |
|
203 | copying changeset a9a13940fc03 to ad120869acf0 | |
204 | committing files: |
|
204 | committing files: | |
205 | a |
|
205 | a | |
206 | committing manifest |
|
206 | committing manifest | |
207 | committing changelog |
|
207 | committing changelog | |
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 | $ cat .hg/last-message.txt |
|
213 | $ cat .hg/last-message.txt | |
214 | message given from command line (no-eol) |
|
214 | message given from command line (no-eol) | |
215 |
|
215 | |||
216 | $ rm -f .hg/last-message.txt |
|
216 | $ rm -f .hg/last-message.txt | |
217 | $ HGEDITOR="\"sh\" \"`pwd`/editor.sh\"" hg commit --amend -v |
|
217 | $ HGEDITOR="\"sh\" \"`pwd`/editor.sh\"" hg commit --amend -v | |
218 | amending changeset a9a13940fc03 |
|
218 | amending changeset a9a13940fc03 | |
219 | copying changeset a9a13940fc03 to ad120869acf0 |
|
219 | copying changeset a9a13940fc03 to ad120869acf0 | |
220 | no changes, new message |
|
220 | no changes, new message | |
221 |
|
221 | |||
222 |
|
222 | |||
223 | HG: Enter commit message. Lines beginning with 'HG:' are removed. |
|
223 | HG: Enter commit message. Lines beginning with 'HG:' are removed. | |
224 | HG: Leave message empty to abort commit. |
|
224 | HG: Leave message empty to abort commit. | |
225 | HG: -- |
|
225 | HG: -- | |
226 | HG: user: foo |
|
226 | HG: user: foo | |
227 | HG: branch 'default' |
|
227 | HG: branch 'default' | |
228 | HG: changed a |
|
228 | HG: changed a | |
229 | committing files: |
|
229 | committing files: | |
230 | a |
|
230 | a | |
231 | committing manifest |
|
231 | committing manifest | |
232 | committing changelog |
|
232 | committing changelog | |
233 | running hook pretxncommit.test-saving-last-message: false |
|
233 | running hook pretxncommit.test-saving-last-message: false | |
234 | transaction abort! |
|
234 | transaction abort! | |
235 | rollback completed |
|
235 | rollback completed | |
236 | abort: pretxncommit.test-saving-last-message hook exited with status 1 |
|
236 | abort: pretxncommit.test-saving-last-message hook exited with status 1 | |
237 | [255] |
|
237 | [255] | |
238 |
|
238 | |||
239 | $ cat .hg/last-message.txt |
|
239 | $ cat .hg/last-message.txt | |
240 | another precious commit message |
|
240 | another precious commit message | |
241 |
|
241 | |||
242 | $ cat > .hg/hgrc << '__EOF__' |
|
242 | $ cat > .hg/hgrc << '__EOF__' | |
243 | > [hooks] |
|
243 | > [hooks] | |
244 | > pretxncommit.test-saving-last-message = |
|
244 | > pretxncommit.test-saving-last-message = | |
245 | > __EOF__ |
|
245 | > __EOF__ | |
246 |
|
246 | |||
247 | then, test editing custom commit message |
|
247 | then, test editing custom commit message | |
248 |
|
248 | |||
249 | $ HGEDITOR="\"sh\" \"`pwd`/editor.sh\"" hg commit --amend -v |
|
249 | $ HGEDITOR="\"sh\" \"`pwd`/editor.sh\"" hg commit --amend -v | |
250 | amending changeset a9a13940fc03 |
|
250 | amending changeset a9a13940fc03 | |
251 | copying changeset a9a13940fc03 to ad120869acf0 |
|
251 | copying changeset a9a13940fc03 to ad120869acf0 | |
252 | no changes, new message |
|
252 | no changes, new message | |
253 |
|
253 | |||
254 |
|
254 | |||
255 | HG: Enter commit message. Lines beginning with 'HG:' are removed. |
|
255 | HG: Enter commit message. Lines beginning with 'HG:' are removed. | |
256 | HG: Leave message empty to abort commit. |
|
256 | HG: Leave message empty to abort commit. | |
257 | HG: -- |
|
257 | HG: -- | |
258 | HG: user: foo |
|
258 | HG: user: foo | |
259 | HG: branch 'default' |
|
259 | HG: branch 'default' | |
260 | HG: changed a |
|
260 | HG: changed a | |
261 | committing files: |
|
261 | committing files: | |
262 | a |
|
262 | a | |
263 | committing manifest |
|
263 | committing manifest | |
264 | committing changelog |
|
264 | committing changelog | |
265 | 1 changesets found |
|
265 | 1 changesets found | |
266 | uncompressed size of bundle content: |
|
266 | uncompressed size of bundle content: | |
267 | 249 (changelog) |
|
267 | 249 (changelog) | |
268 | 163 (manifests) |
|
268 | 163 (manifests) | |
269 | 133 a |
|
269 | 133 a | |
270 | saved backup bundle to $TESTTMP/.hg/strip-backup/a9a13940fc03-7c2e8674-amend.hg |
|
270 | saved backup bundle to $TESTTMP/.hg/strip-backup/a9a13940fc03-7c2e8674-amend.hg | |
271 | 1 changesets found |
|
271 | 1 changesets found | |
272 | uncompressed size of bundle content: |
|
272 | uncompressed size of bundle content: | |
273 | 257 (changelog) |
|
273 | 257 (changelog) | |
274 | 163 (manifests) |
|
274 | 163 (manifests) | |
275 | 133 a |
|
275 | 133 a | |
276 | adding branch |
|
276 | adding branch | |
277 | adding changesets |
|
277 | adding changesets | |
278 | adding manifests |
|
278 | adding manifests | |
279 | adding file changes |
|
279 | adding file changes | |
280 | added 1 changesets with 1 changes to 1 files |
|
280 | added 1 changesets with 1 changes to 1 files | |
281 | committed changeset 1:64a124ba1b44 |
|
281 | committed changeset 1:64a124ba1b44 | |
282 |
|
282 | |||
283 | Same, but with changes in working dir (different code path): |
|
283 | Same, but with changes in working dir (different code path): | |
284 |
|
284 | |||
285 | $ echo a >> a |
|
285 | $ echo a >> a | |
286 | $ HGEDITOR="\"sh\" \"`pwd`/editor.sh\"" hg commit --amend -v |
|
286 | $ HGEDITOR="\"sh\" \"`pwd`/editor.sh\"" hg commit --amend -v | |
287 | amending changeset 64a124ba1b44 |
|
287 | amending changeset 64a124ba1b44 | |
288 | another precious commit message |
|
288 | another precious commit message | |
289 |
|
289 | |||
290 |
|
290 | |||
291 | HG: Enter commit message. Lines beginning with 'HG:' are removed. |
|
291 | HG: Enter commit message. Lines beginning with 'HG:' are removed. | |
292 | HG: Leave message empty to abort commit. |
|
292 | HG: Leave message empty to abort commit. | |
293 | HG: -- |
|
293 | HG: -- | |
294 | HG: user: foo |
|
294 | HG: user: foo | |
295 | HG: branch 'default' |
|
295 | HG: branch 'default' | |
296 | HG: changed a |
|
296 | HG: changed a | |
297 | committing files: |
|
297 | committing files: | |
298 | a |
|
298 | a | |
299 | committing manifest |
|
299 | committing manifest | |
300 | committing changelog |
|
300 | committing changelog | |
301 | 1 changesets found |
|
301 | 1 changesets found | |
302 | uncompressed size of bundle content: |
|
302 | uncompressed size of bundle content: | |
303 | 257 (changelog) |
|
303 | 257 (changelog) | |
304 | 163 (manifests) |
|
304 | 163 (manifests) | |
305 | 133 a |
|
305 | 133 a | |
306 | saved backup bundle to $TESTTMP/.hg/strip-backup/64a124ba1b44-10374b8f-amend.hg |
|
306 | saved backup bundle to $TESTTMP/.hg/strip-backup/64a124ba1b44-10374b8f-amend.hg | |
307 | 1 changesets found |
|
307 | 1 changesets found | |
308 | uncompressed size of bundle content: |
|
308 | uncompressed size of bundle content: | |
309 | 257 (changelog) |
|
309 | 257 (changelog) | |
310 | 163 (manifests) |
|
310 | 163 (manifests) | |
311 | 135 a |
|
311 | 135 a | |
312 | adding branch |
|
312 | adding branch | |
313 | adding changesets |
|
313 | adding changesets | |
314 | adding manifests |
|
314 | adding manifests | |
315 | adding file changes |
|
315 | adding file changes | |
316 | added 1 changesets with 1 changes to 1 files |
|
316 | added 1 changesets with 1 changes to 1 files | |
317 | committed changeset 1:7892795b8e38 |
|
317 | committed changeset 1:7892795b8e38 | |
318 |
|
318 | |||
319 | $ rm editor.sh |
|
319 | $ rm editor.sh | |
320 | $ hg log -r . |
|
320 | $ hg log -r . | |
321 | changeset: 1:7892795b8e38 |
|
321 | changeset: 1:7892795b8e38 | |
322 | tag: tip |
|
322 | tag: tip | |
323 | user: foo |
|
323 | user: foo | |
324 | date: Thu Jan 01 00:00:01 1970 +0000 |
|
324 | date: Thu Jan 01 00:00:01 1970 +0000 | |
325 | summary: another precious commit message |
|
325 | summary: another precious commit message | |
326 |
|
326 | |||
327 |
|
327 | |||
328 | Moving bookmarks, preserve active bookmark: |
|
328 | Moving bookmarks, preserve active bookmark: | |
329 |
|
329 | |||
330 | $ hg book book1 |
|
330 | $ hg book book1 | |
331 | $ hg book book2 |
|
331 | $ hg book book2 | |
332 | $ hg ci --amend -m 'move bookmarks' |
|
332 | $ hg ci --amend -m 'move bookmarks' | |
333 | saved backup bundle to $TESTTMP/.hg/strip-backup/7892795b8e38-3fb46217-amend.hg |
|
333 | saved backup bundle to $TESTTMP/.hg/strip-backup/7892795b8e38-3fb46217-amend.hg | |
334 | $ hg book |
|
334 | $ hg book | |
335 | book1 1:8311f17e2616 |
|
335 | book1 1:8311f17e2616 | |
336 | * book2 1:8311f17e2616 |
|
336 | * book2 1:8311f17e2616 | |
337 | $ echo a >> a |
|
337 | $ echo a >> a | |
338 | $ hg ci --amend -m 'move bookmarks' |
|
338 | $ hg ci --amend -m 'move bookmarks' | |
339 | saved backup bundle to $TESTTMP/.hg/strip-backup/8311f17e2616-f0504fe3-amend.hg |
|
339 | saved backup bundle to $TESTTMP/.hg/strip-backup/8311f17e2616-f0504fe3-amend.hg | |
340 | $ hg book |
|
340 | $ hg book | |
341 | book1 1:a3b65065808c |
|
341 | book1 1:a3b65065808c | |
342 | * book2 1:a3b65065808c |
|
342 | * book2 1:a3b65065808c | |
343 |
|
343 | |||
344 | abort does not loose bookmarks |
|
344 | abort does not loose bookmarks | |
345 |
|
345 | |||
346 | $ cat > editor.sh << '__EOF__' |
|
346 | $ cat > editor.sh << '__EOF__' | |
347 | > #!/bin/sh |
|
347 | > #!/bin/sh | |
348 | > echo "" > "$1" |
|
348 | > echo "" > "$1" | |
349 | > __EOF__ |
|
349 | > __EOF__ | |
350 | $ echo a >> a |
|
350 | $ echo a >> a | |
351 | $ HGEDITOR="\"sh\" \"`pwd`/editor.sh\"" hg commit --amend |
|
351 | $ HGEDITOR="\"sh\" \"`pwd`/editor.sh\"" hg commit --amend | |
352 | abort: empty commit message |
|
352 | abort: empty commit message | |
353 | [255] |
|
353 | [255] | |
354 | $ hg book |
|
354 | $ hg book | |
355 | book1 1:a3b65065808c |
|
355 | book1 1:a3b65065808c | |
356 | * book2 1:a3b65065808c |
|
356 | * book2 1:a3b65065808c | |
357 | $ hg revert -Caq |
|
357 | $ hg revert -Caq | |
358 | $ rm editor.sh |
|
358 | $ rm editor.sh | |
359 |
|
359 | |||
360 | $ echo '[defaults]' >> $HGRCPATH |
|
360 | $ echo '[defaults]' >> $HGRCPATH | |
361 | $ echo "commit=-d '0 0'" >> $HGRCPATH |
|
361 | $ echo "commit=-d '0 0'" >> $HGRCPATH | |
362 |
|
362 | |||
363 | Moving branches: |
|
363 | Moving branches: | |
364 |
|
364 | |||
365 | $ hg branch foo |
|
365 | $ hg branch foo | |
366 | marked working directory as branch foo |
|
366 | marked working directory as branch foo | |
367 | (branches are permanent and global, did you want a bookmark?) |
|
367 | (branches are permanent and global, did you want a bookmark?) | |
368 | $ echo a >> a |
|
368 | $ echo a >> a | |
369 | $ hg ci -m 'branch foo' |
|
369 | $ hg ci -m 'branch foo' | |
370 | $ hg branch default -f |
|
370 | $ hg branch default -f | |
371 | marked working directory as branch default |
|
371 | marked working directory as branch default | |
372 | $ hg ci --amend -m 'back to default' |
|
372 | $ hg ci --amend -m 'back to default' | |
373 | saved backup bundle to $TESTTMP/.hg/strip-backup/f8339a38efe1-c18453c9-amend.hg |
|
373 | saved backup bundle to $TESTTMP/.hg/strip-backup/f8339a38efe1-c18453c9-amend.hg | |
374 | $ hg branches |
|
374 | $ hg branches | |
375 | default 2:9c07515f2650 |
|
375 | default 2:9c07515f2650 | |
376 |
|
376 | |||
377 | Close branch: |
|
377 | Close branch: | |
378 |
|
378 | |||
379 | $ hg up -q 0 |
|
379 | $ hg up -q 0 | |
380 | $ echo b >> b |
|
380 | $ echo b >> b | |
381 | $ hg branch foo |
|
381 | $ hg branch foo | |
382 | marked working directory as branch foo |
|
382 | marked working directory as branch foo | |
383 | (branches are permanent and global, did you want a bookmark?) |
|
383 | (branches are permanent and global, did you want a bookmark?) | |
384 | $ hg ci -Am 'fork' |
|
384 | $ hg ci -Am 'fork' | |
385 | adding b |
|
385 | adding b | |
386 | $ echo b >> b |
|
386 | $ echo b >> b | |
387 | $ hg ci -mb |
|
387 | $ hg ci -mb | |
388 | $ hg ci --amend --close-branch -m 'closing branch foo' |
|
388 | $ hg ci --amend --close-branch -m 'closing branch foo' | |
389 | saved backup bundle to $TESTTMP/.hg/strip-backup/c962248fa264-54245dc7-amend.hg |
|
389 | saved backup bundle to $TESTTMP/.hg/strip-backup/c962248fa264-54245dc7-amend.hg | |
390 |
|
390 | |||
391 | Same thing, different code path: |
|
391 | Same thing, different code path: | |
392 |
|
392 | |||
393 | $ echo b >> b |
|
393 | $ echo b >> b | |
394 | $ hg ci -m 'reopen branch' |
|
394 | $ hg ci -m 'reopen branch' | |
395 | reopening closed branch head 4 |
|
395 | reopening closed branch head 4 | |
396 | $ echo b >> b |
|
396 | $ echo b >> b | |
397 | $ hg ci --amend --close-branch |
|
397 | $ hg ci --amend --close-branch | |
398 | saved backup bundle to $TESTTMP/.hg/strip-backup/027371728205-b900d9fa-amend.hg |
|
398 | saved backup bundle to $TESTTMP/.hg/strip-backup/027371728205-b900d9fa-amend.hg | |
399 | $ hg branches |
|
399 | $ hg branches | |
400 | default 2:9c07515f2650 |
|
400 | default 2:9c07515f2650 | |
401 |
|
401 | |||
402 | Refuse to amend during a merge: |
|
402 | Refuse to amend during a merge: | |
403 |
|
403 | |||
404 | $ hg up -q default |
|
404 | $ hg up -q default | |
405 | $ hg merge foo |
|
405 | $ hg merge foo | |
406 | 1 files updated, 0 files merged, 0 files removed, 0 files unresolved |
|
406 | 1 files updated, 0 files merged, 0 files removed, 0 files unresolved | |
407 | (branch merge, don't forget to commit) |
|
407 | (branch merge, don't forget to commit) | |
408 | $ hg ci --amend |
|
408 | $ hg ci --amend | |
409 | abort: cannot amend while merging |
|
409 | abort: cannot amend while merging | |
410 | [255] |
|
410 | [255] | |
411 | $ hg ci -m 'merge' |
|
411 | $ hg ci -m 'merge' | |
412 |
|
412 | |||
413 | Refuse to amend if there is a merge conflict (issue5805): |
|
413 | Refuse to amend if there is a merge conflict (issue5805): | |
414 |
|
414 | |||
415 | $ hg up -q foo |
|
415 | $ hg up -q foo | |
416 | $ echo c > a |
|
416 | $ echo c > a | |
417 | $ hg up default -t :fail |
|
417 | $ hg up default -t :fail | |
418 | 0 files updated, 0 files merged, 0 files removed, 1 files unresolved |
|
418 | 0 files updated, 0 files merged, 0 files removed, 1 files unresolved | |
419 | use 'hg resolve' to retry unresolved file merges |
|
419 | use 'hg resolve' to retry unresolved file merges | |
420 | [1] |
|
420 | [1] | |
421 | $ hg resolve -l |
|
421 | $ hg resolve -l | |
422 | U a |
|
422 | U a | |
423 |
|
423 | |||
424 | $ hg ci --amend |
|
424 | $ hg ci --amend | |
425 | abort: unresolved merge conflicts (see 'hg help resolve') |
|
425 | abort: unresolved merge conflicts (see 'hg help resolve') | |
426 | [255] |
|
426 | [255] | |
427 |
|
427 | |||
428 | $ hg up -qC . |
|
428 | $ hg up -qC . | |
429 |
|
429 | |||
430 | Follow copies/renames: |
|
430 | Follow copies/renames: | |
431 |
|
431 | |||
432 | $ hg mv b c |
|
432 | $ hg mv b c | |
433 | $ hg ci -m 'b -> c' |
|
433 | $ hg ci -m 'b -> c' | |
434 | $ hg mv c d |
|
434 | $ hg mv c d | |
435 | $ hg ci --amend -m 'b -> d' |
|
435 | $ hg ci --amend -m 'b -> d' | |
436 | saved backup bundle to $TESTTMP/.hg/strip-backup/42f3f27a067d-f23cc9f7-amend.hg |
|
436 | saved backup bundle to $TESTTMP/.hg/strip-backup/42f3f27a067d-f23cc9f7-amend.hg | |
437 | $ hg st --rev '.^' --copies d |
|
437 | $ hg st --rev '.^' --copies d | |
438 | A d |
|
438 | A d | |
439 | b |
|
439 | b | |
440 | $ hg cp d e |
|
440 | $ hg cp d e | |
441 | $ hg ci -m 'e = d' |
|
441 | $ hg ci -m 'e = d' | |
442 | $ hg cp e f |
|
442 | $ hg cp e f | |
443 | $ hg ci --amend -m 'f = d' |
|
443 | $ hg ci --amend -m 'f = d' | |
444 | saved backup bundle to $TESTTMP/.hg/strip-backup/9198f73182d5-251d584a-amend.hg |
|
444 | saved backup bundle to $TESTTMP/.hg/strip-backup/9198f73182d5-251d584a-amend.hg | |
445 | $ hg st --rev '.^' --copies f |
|
445 | $ hg st --rev '.^' --copies f | |
446 | A f |
|
446 | A f | |
447 | d |
|
447 | d | |
448 |
|
448 | |||
449 | $ mv f f.orig |
|
449 | $ mv f f.orig | |
450 | $ hg rm -A f |
|
450 | $ hg rm -A f | |
451 | $ hg ci -m removef |
|
451 | $ hg ci -m removef | |
452 | $ hg cp a f |
|
452 | $ hg cp a f | |
453 | $ mv f.orig f |
|
453 | $ mv f.orig f | |
454 | $ hg ci --amend -m replacef |
|
454 | $ hg ci --amend -m replacef | |
455 | saved backup bundle to $TESTTMP/.hg/strip-backup/f0993ab6b482-eda301bf-amend.hg |
|
455 | saved backup bundle to $TESTTMP/.hg/strip-backup/f0993ab6b482-eda301bf-amend.hg | |
456 | $ hg st --change . --copies |
|
456 | $ hg st --change . --copies | |
457 | $ hg log -r . --template "{file_copies}\n" |
|
457 | $ hg log -r . --template "{file_copies}\n" | |
458 |
|
458 | |||
459 |
|
459 | |||
460 | Move added file (issue3410): |
|
460 | Move added file (issue3410): | |
461 |
|
461 | |||
462 | $ echo g >> g |
|
462 | $ echo g >> g | |
463 | $ hg ci -Am g |
|
463 | $ hg ci -Am g | |
464 | adding g |
|
464 | adding g | |
465 | $ hg mv g h |
|
465 | $ hg mv g h | |
466 | $ hg ci --amend |
|
466 | $ hg ci --amend | |
467 | saved backup bundle to $TESTTMP/.hg/strip-backup/58585e3f095c-0f5ebcda-amend.hg |
|
467 | saved backup bundle to $TESTTMP/.hg/strip-backup/58585e3f095c-0f5ebcda-amend.hg | |
468 | $ hg st --change . --copies h |
|
468 | $ hg st --change . --copies h | |
469 | A h |
|
469 | A h | |
470 | $ hg log -r . --template "{file_copies}\n" |
|
470 | $ hg log -r . --template "{file_copies}\n" | |
471 |
|
471 | |||
472 |
|
472 | |||
473 | Can't rollback an amend: |
|
473 | Can't rollback an amend: | |
474 |
|
474 | |||
475 | $ hg rollback |
|
475 | $ hg rollback | |
476 | no rollback information available |
|
476 | no rollback information available | |
477 | [1] |
|
477 | [1] | |
478 |
|
478 | |||
479 | Preserve extra dict (issue3430): |
|
479 | Preserve extra dict (issue3430): | |
480 |
|
480 | |||
481 | $ hg branch a |
|
481 | $ hg branch a | |
482 | marked working directory as branch a |
|
482 | marked working directory as branch a | |
483 | (branches are permanent and global, did you want a bookmark?) |
|
483 | (branches are permanent and global, did you want a bookmark?) | |
484 | $ echo a >> a |
|
484 | $ echo a >> a | |
485 | $ hg ci -ma |
|
485 | $ hg ci -ma | |
486 | $ hg ci --amend -m "a'" |
|
486 | $ hg ci --amend -m "a'" | |
487 | saved backup bundle to $TESTTMP/.hg/strip-backup/39a162f1d65e-9dfe13d8-amend.hg |
|
487 | saved backup bundle to $TESTTMP/.hg/strip-backup/39a162f1d65e-9dfe13d8-amend.hg | |
488 | $ hg log -r . --template "{branch}\n" |
|
488 | $ hg log -r . --template "{branch}\n" | |
489 | a |
|
489 | a | |
490 | $ hg ci --amend -m "a''" |
|
490 | $ hg ci --amend -m "a''" | |
491 | saved backup bundle to $TESTTMP/.hg/strip-backup/d5ca7b1ac72b-0b4c1a34-amend.hg |
|
491 | saved backup bundle to $TESTTMP/.hg/strip-backup/d5ca7b1ac72b-0b4c1a34-amend.hg | |
492 | $ hg log -r . --template "{branch}\n" |
|
492 | $ hg log -r . --template "{branch}\n" | |
493 | a |
|
493 | a | |
494 |
|
494 | |||
495 | Also preserve other entries in the dict that are in the old commit, |
|
495 | Also preserve other entries in the dict that are in the old commit, | |
496 | first graft something so there's an additional entry: |
|
496 | first graft something so there's an additional entry: | |
497 |
|
497 | |||
498 | $ hg up 0 -q |
|
498 | $ hg up 0 -q | |
499 | $ echo z > z |
|
499 | $ echo z > z | |
500 | $ hg ci -Am 'fork' |
|
500 | $ hg ci -Am 'fork' | |
501 | adding z |
|
501 | adding z | |
502 | created new head |
|
502 | created new head | |
503 | $ hg up 11 |
|
503 | $ hg up 11 | |
504 | 5 files updated, 0 files merged, 1 files removed, 0 files unresolved |
|
504 | 5 files updated, 0 files merged, 1 files removed, 0 files unresolved | |
505 | $ hg graft 12 |
|
505 | $ hg graft 12 | |
506 | grafting 12:2647734878ef "fork" (tip) |
|
506 | grafting 12:2647734878ef "fork" (tip) | |
507 | $ hg ci --amend -m 'graft amend' |
|
507 | $ hg ci --amend -m 'graft amend' | |
508 | saved backup bundle to $TESTTMP/.hg/strip-backup/fe8c6f7957ca-25638666-amend.hg |
|
508 | saved backup bundle to $TESTTMP/.hg/strip-backup/fe8c6f7957ca-25638666-amend.hg | |
509 | $ hg log -r . --debug | grep extra |
|
509 | $ hg log -r . --debug | grep extra | |
510 | extra: amend_source=fe8c6f7957ca1665ed77496ed7a07657d469ac60 |
|
510 | extra: amend_source=fe8c6f7957ca1665ed77496ed7a07657d469ac60 | |
511 | extra: branch=a |
|
511 | extra: branch=a | |
512 | extra: source=2647734878ef0236dda712fae9c1651cf694ea8a |
|
512 | extra: source=2647734878ef0236dda712fae9c1651cf694ea8a | |
513 |
|
513 | |||
514 | Preserve phase |
|
514 | Preserve phase | |
515 |
|
515 | |||
516 | $ hg phase '.^::.' |
|
516 | $ hg phase '.^::.' | |
517 | 11: draft |
|
517 | 11: draft | |
518 | 13: draft |
|
518 | 13: draft | |
519 | $ hg phase --secret --force . |
|
519 | $ hg phase --secret --force . | |
520 | $ hg phase '.^::.' |
|
520 | $ hg phase '.^::.' | |
521 | 11: draft |
|
521 | 11: draft | |
522 | 13: secret |
|
522 | 13: secret | |
523 | $ hg commit --amend -m 'amend for phase' -q |
|
523 | $ hg commit --amend -m 'amend for phase' -q | |
524 | $ hg phase '.^::.' |
|
524 | $ hg phase '.^::.' | |
525 | 11: draft |
|
525 | 11: draft | |
526 | 13: secret |
|
526 | 13: secret | |
527 |
|
527 | |||
528 | Test amend with obsolete |
|
528 | Test amend with obsolete | |
529 | --------------------------- |
|
529 | --------------------------- | |
530 |
|
530 | |||
531 | Enable obsolete |
|
531 | Enable obsolete | |
532 |
|
532 | |||
533 | $ cat >> $HGRCPATH << EOF |
|
533 | $ cat >> $HGRCPATH << EOF | |
534 | > [experimental] |
|
534 | > [experimental] | |
535 | > evolution.createmarkers=True |
|
535 | > evolution.createmarkers=True | |
536 | > evolution.allowunstable=True |
|
536 | > evolution.allowunstable=True | |
537 | > EOF |
|
537 | > EOF | |
538 |
|
538 | |||
539 | Amend with no files changes |
|
539 | Amend with no files changes | |
540 |
|
540 | |||
541 | $ hg id -n |
|
541 | $ hg id -n | |
542 | 13 |
|
542 | 13 | |
543 | $ hg ci --amend -m 'babar' |
|
543 | $ hg ci --amend -m 'babar' | |
544 | $ hg id -n |
|
544 | $ hg id -n | |
545 | 14 |
|
545 | 14 | |
546 | $ hg log -Gl 3 --style=compact |
|
546 | $ hg log -Gl 3 --style=compact | |
547 | @ 14[tip]:11 682950e85999 1970-01-01 00:00 +0000 test |
|
547 | @ 14[tip]:11 682950e85999 1970-01-01 00:00 +0000 test | |
548 | | babar |
|
548 | | babar | |
549 | | |
|
549 | | | |
550 | | o 12:0 2647734878ef 1970-01-01 00:00 +0000 test |
|
550 | | o 12:0 2647734878ef 1970-01-01 00:00 +0000 test | |
551 | | | fork |
|
551 | | | fork | |
552 | | ~ |
|
552 | | ~ | |
553 | o 11 0ddb275cfad1 1970-01-01 00:00 +0000 test |
|
553 | o 11 0ddb275cfad1 1970-01-01 00:00 +0000 test | |
554 | | a'' |
|
554 | | a'' | |
555 | ~ |
|
555 | ~ | |
556 | $ hg log -Gl 4 --hidden --style=compact |
|
556 | $ hg log -Gl 4 --hidden --style=compact | |
557 | @ 14[tip]:11 682950e85999 1970-01-01 00:00 +0000 test |
|
557 | @ 14[tip]:11 682950e85999 1970-01-01 00:00 +0000 test | |
558 | | babar |
|
558 | | babar | |
559 | | |
|
559 | | | |
560 | | x 13:11 5167600b0f7a 1970-01-01 00:00 +0000 test |
|
560 | | x 13:11 5167600b0f7a 1970-01-01 00:00 +0000 test | |
561 | |/ amend for phase |
|
561 | |/ amend for phase | |
562 | | |
|
562 | | | |
563 | | o 12:0 2647734878ef 1970-01-01 00:00 +0000 test |
|
563 | | o 12:0 2647734878ef 1970-01-01 00:00 +0000 test | |
564 | | | fork |
|
564 | | | fork | |
565 | | ~ |
|
565 | | ~ | |
566 | o 11 0ddb275cfad1 1970-01-01 00:00 +0000 test |
|
566 | o 11 0ddb275cfad1 1970-01-01 00:00 +0000 test | |
567 | | a'' |
|
567 | | a'' | |
568 | ~ |
|
568 | ~ | |
569 |
|
569 | |||
570 | Amend with files changes |
|
570 | Amend with files changes | |
571 |
|
571 | |||
572 | (note: the extra commit over 15 is a temporary junk I would be happy to get |
|
572 | (note: the extra commit over 15 is a temporary junk I would be happy to get | |
573 | ride of) |
|
573 | ride of) | |
574 |
|
574 | |||
575 | $ echo 'babar' >> a |
|
575 | $ echo 'babar' >> a | |
576 | $ hg commit --amend |
|
576 | $ hg commit --amend | |
577 | $ hg log -Gl 6 --hidden --style=compact |
|
577 | $ hg log -Gl 6 --hidden --style=compact | |
578 | @ 15[tip]:11 a5b42b49b0d5 1970-01-01 00:00 +0000 test |
|
578 | @ 15[tip]:11 a5b42b49b0d5 1970-01-01 00:00 +0000 test | |
579 | | babar |
|
579 | | babar | |
580 | | |
|
580 | | | |
581 | | x 14:11 682950e85999 1970-01-01 00:00 +0000 test |
|
581 | | x 14:11 682950e85999 1970-01-01 00:00 +0000 test | |
582 | |/ babar |
|
582 | |/ babar | |
583 | | |
|
583 | | | |
584 | | x 13:11 5167600b0f7a 1970-01-01 00:00 +0000 test |
|
584 | | x 13:11 5167600b0f7a 1970-01-01 00:00 +0000 test | |
585 | |/ amend for phase |
|
585 | |/ amend for phase | |
586 | | |
|
586 | | | |
587 | | o 12:0 2647734878ef 1970-01-01 00:00 +0000 test |
|
587 | | o 12:0 2647734878ef 1970-01-01 00:00 +0000 test | |
588 | | | fork |
|
588 | | | fork | |
589 | | ~ |
|
589 | | ~ | |
590 | o 11 0ddb275cfad1 1970-01-01 00:00 +0000 test |
|
590 | o 11 0ddb275cfad1 1970-01-01 00:00 +0000 test | |
591 | | a'' |
|
591 | | a'' | |
592 | | |
|
592 | | | |
593 | o 10 5fa75032e226 1970-01-01 00:00 +0000 test |
|
593 | o 10 5fa75032e226 1970-01-01 00:00 +0000 test | |
594 | | g |
|
594 | | g | |
595 | ~ |
|
595 | ~ | |
596 |
|
596 | |||
597 |
|
597 | |||
598 | Test that amend does not make it easy to create obsolescence cycle |
|
598 | Test that amend does not make it easy to create obsolescence cycle | |
599 | --------------------------------------------------------------------- |
|
599 | --------------------------------------------------------------------- | |
600 |
|
600 | |||
601 | $ hg id -r 14 --hidden |
|
601 | $ hg id -r 14 --hidden | |
602 | 682950e85999 (a) |
|
602 | 682950e85999 (a) | |
603 | $ hg revert -ar 14 --hidden |
|
603 | $ hg revert -ar 14 --hidden | |
604 | reverting a |
|
604 | reverting a | |
605 | $ hg commit --amend |
|
605 | $ hg commit --amend | |
606 | $ hg id |
|
606 | $ hg id | |
607 | 37973c7e0b61 (a) tip |
|
607 | 37973c7e0b61 (a) tip | |
608 |
|
608 | |||
609 | Test that rewriting leaving instability behind is allowed |
|
609 | Test that rewriting leaving instability behind is allowed | |
610 | --------------------------------------------------------------------- |
|
610 | --------------------------------------------------------------------- | |
611 |
|
611 | |||
612 | $ hg up '.^' |
|
612 | $ hg up '.^' | |
613 | 0 files updated, 0 files merged, 1 files removed, 0 files unresolved |
|
613 | 0 files updated, 0 files merged, 1 files removed, 0 files unresolved | |
614 | $ echo 'b' >> a |
|
614 | $ echo 'b' >> a | |
615 | $ hg log --style compact -r 'children(.)' |
|
615 | $ hg log --style compact -r 'children(.)' | |
616 | 16[tip]:11 37973c7e0b61 1970-01-01 00:00 +0000 test |
|
616 | 16[tip]:11 37973c7e0b61 1970-01-01 00:00 +0000 test | |
617 | babar |
|
617 | babar | |
618 |
|
618 | |||
619 | $ hg commit --amend |
|
619 | $ hg commit --amend | |
620 | 1 new orphan changesets |
|
620 | 1 new orphan changesets | |
621 | $ hg log -r 'orphan()' |
|
621 | $ hg log -r 'orphan()' | |
622 | changeset: 16:37973c7e0b61 |
|
622 | changeset: 16:37973c7e0b61 | |
623 | branch: a |
|
623 | branch: a | |
624 | parent: 11:0ddb275cfad1 |
|
624 | parent: 11:0ddb275cfad1 | |
625 | user: test |
|
625 | user: test | |
626 | date: Thu Jan 01 00:00:00 1970 +0000 |
|
626 | date: Thu Jan 01 00:00:00 1970 +0000 | |
627 | instability: orphan |
|
627 | instability: orphan | |
628 | summary: babar |
|
628 | summary: babar | |
629 |
|
629 | |||
630 |
|
630 | |||
631 | Amend a merge changeset (with renames and conflicts from the second parent): |
|
631 | Amend a merge changeset (with renames and conflicts from the second parent): | |
632 |
|
632 | |||
633 | $ hg up -q default |
|
633 | $ hg up -q default | |
634 | $ hg branch -q bar |
|
634 | $ hg branch -q bar | |
635 | $ hg cp a aa |
|
635 | $ hg cp a aa | |
636 | $ hg mv z zz |
|
636 | $ hg mv z zz | |
637 | $ echo cc > cc |
|
637 | $ echo cc > cc | |
638 | $ hg add cc |
|
638 | $ hg add cc | |
639 | $ hg ci -m aazzcc |
|
639 | $ hg ci -m aazzcc | |
640 | $ hg up -q default |
|
640 | $ hg up -q default | |
641 | $ echo a >> a |
|
641 | $ echo a >> a | |
642 | $ echo dd > cc |
|
642 | $ echo dd > cc | |
643 | $ hg add cc |
|
643 | $ hg add cc | |
644 | $ hg ci -m aa |
|
644 | $ hg ci -m aa | |
645 | $ hg merge -q bar |
|
645 | $ hg merge -q bar | |
646 | warning: conflicts while merging cc! (edit, then use 'hg resolve --mark') |
|
646 | warning: conflicts while merging cc! (edit, then use 'hg resolve --mark') | |
647 | [1] |
|
647 | [1] | |
648 | $ hg resolve -m cc |
|
648 | $ hg resolve -m cc | |
649 | (no more unresolved files) |
|
649 | (no more unresolved files) | |
650 | $ hg ci -m 'merge bar' |
|
650 | $ hg ci -m 'merge bar' | |
651 | $ hg log --config diff.git=1 -pr . |
|
651 | $ hg log --config diff.git=1 -pr . | |
652 | changeset: 20:163cfd7219f7 |
|
652 | changeset: 20:163cfd7219f7 | |
653 | tag: tip |
|
653 | tag: tip | |
654 | parent: 19:30d96aeaf27b |
|
654 | parent: 19:30d96aeaf27b | |
655 | parent: 18:1aa437659d19 |
|
655 | parent: 18:1aa437659d19 | |
656 | user: test |
|
656 | user: test | |
657 | date: Thu Jan 01 00:00:00 1970 +0000 |
|
657 | date: Thu Jan 01 00:00:00 1970 +0000 | |
658 | summary: merge bar |
|
658 | summary: merge bar | |
659 |
|
659 | |||
660 | diff --git a/a b/aa |
|
660 | diff --git a/a b/aa | |
661 | copy from a |
|
661 | copy from a | |
662 | copy to aa |
|
662 | copy to aa | |
663 | diff --git a/cc b/cc |
|
663 | diff --git a/cc b/cc | |
664 | --- a/cc |
|
664 | --- a/cc | |
665 | +++ b/cc |
|
665 | +++ b/cc | |
666 | @@ -1,1 +1,5 @@ |
|
666 | @@ -1,1 +1,5 @@ | |
667 | +<<<<<<< working copy: 30d96aeaf27b - test: aa |
|
667 | +<<<<<<< working copy: 30d96aeaf27b - test: aa | |
668 | dd |
|
668 | dd | |
669 | +======= |
|
669 | +======= | |
670 | +cc |
|
670 | +cc | |
671 | +>>>>>>> merge rev: 1aa437659d19 bar - test: aazzcc |
|
671 | +>>>>>>> merge rev: 1aa437659d19 bar - test: aazzcc | |
672 | diff --git a/z b/zz |
|
672 | diff --git a/z b/zz | |
673 | rename from z |
|
673 | rename from z | |
674 | rename to zz |
|
674 | rename to zz | |
675 |
|
675 | |||
676 | $ hg debugrename aa |
|
676 | $ hg debugrename aa | |
677 | aa renamed from a:a80d06849b333b8a3d5c445f8ba3142010dcdc9e |
|
677 | aa renamed from a:a80d06849b333b8a3d5c445f8ba3142010dcdc9e | |
678 | $ hg debugrename zz |
|
678 | $ hg debugrename zz | |
679 | zz renamed from z:69a1b67522704ec122181c0890bd16e9d3e7516a |
|
679 | zz renamed from z:69a1b67522704ec122181c0890bd16e9d3e7516a | |
680 | $ hg debugrename cc |
|
680 | $ hg debugrename cc | |
681 | cc not renamed |
|
681 | cc not renamed | |
682 | $ HGEDITOR="sh .hg/checkeditform.sh" hg ci --amend -m 'merge bar (amend message)' --edit |
|
682 | $ HGEDITOR="sh .hg/checkeditform.sh" hg ci --amend -m 'merge bar (amend message)' --edit | |
683 | HGEDITFORM=commit.amend.merge |
|
683 | HGEDITFORM=commit.amend.merge | |
684 | $ hg log --config diff.git=1 -pr . |
|
684 | $ hg log --config diff.git=1 -pr . | |
685 | changeset: 21:bca52d4ed186 |
|
685 | changeset: 21:bca52d4ed186 | |
686 | tag: tip |
|
686 | tag: tip | |
687 | parent: 19:30d96aeaf27b |
|
687 | parent: 19:30d96aeaf27b | |
688 | parent: 18:1aa437659d19 |
|
688 | parent: 18:1aa437659d19 | |
689 | user: test |
|
689 | user: test | |
690 | date: Thu Jan 01 00:00:00 1970 +0000 |
|
690 | date: Thu Jan 01 00:00:00 1970 +0000 | |
691 | summary: merge bar (amend message) |
|
691 | summary: merge bar (amend message) | |
692 |
|
692 | |||
693 | diff --git a/a b/aa |
|
693 | diff --git a/a b/aa | |
694 | copy from a |
|
694 | copy from a | |
695 | copy to aa |
|
695 | copy to aa | |
696 | diff --git a/cc b/cc |
|
696 | diff --git a/cc b/cc | |
697 | --- a/cc |
|
697 | --- a/cc | |
698 | +++ b/cc |
|
698 | +++ b/cc | |
699 | @@ -1,1 +1,5 @@ |
|
699 | @@ -1,1 +1,5 @@ | |
700 | +<<<<<<< working copy: 30d96aeaf27b - test: aa |
|
700 | +<<<<<<< working copy: 30d96aeaf27b - test: aa | |
701 | dd |
|
701 | dd | |
702 | +======= |
|
702 | +======= | |
703 | +cc |
|
703 | +cc | |
704 | +>>>>>>> merge rev: 1aa437659d19 bar - test: aazzcc |
|
704 | +>>>>>>> merge rev: 1aa437659d19 bar - test: aazzcc | |
705 | diff --git a/z b/zz |
|
705 | diff --git a/z b/zz | |
706 | rename from z |
|
706 | rename from z | |
707 | rename to zz |
|
707 | rename to zz | |
708 |
|
708 | |||
709 | $ hg debugrename aa |
|
709 | $ hg debugrename aa | |
710 | aa renamed from a:a80d06849b333b8a3d5c445f8ba3142010dcdc9e |
|
710 | aa renamed from a:a80d06849b333b8a3d5c445f8ba3142010dcdc9e | |
711 | $ hg debugrename zz |
|
711 | $ hg debugrename zz | |
712 | zz renamed from z:69a1b67522704ec122181c0890bd16e9d3e7516a |
|
712 | zz renamed from z:69a1b67522704ec122181c0890bd16e9d3e7516a | |
713 | $ hg debugrename cc |
|
713 | $ hg debugrename cc | |
714 | cc not renamed |
|
714 | cc not renamed | |
715 | $ hg mv zz z |
|
715 | $ hg mv zz z | |
716 | $ hg ci --amend -m 'merge bar (undo rename)' |
|
716 | $ hg ci --amend -m 'merge bar (undo rename)' | |
717 | $ hg log --config diff.git=1 -pr . |
|
717 | $ hg log --config diff.git=1 -pr . | |
718 | changeset: 22:12594a98ca3f |
|
718 | changeset: 22:12594a98ca3f | |
719 | tag: tip |
|
719 | tag: tip | |
720 | parent: 19:30d96aeaf27b |
|
720 | parent: 19:30d96aeaf27b | |
721 | parent: 18:1aa437659d19 |
|
721 | parent: 18:1aa437659d19 | |
722 | user: test |
|
722 | user: test | |
723 | date: Thu Jan 01 00:00:00 1970 +0000 |
|
723 | date: Thu Jan 01 00:00:00 1970 +0000 | |
724 | summary: merge bar (undo rename) |
|
724 | summary: merge bar (undo rename) | |
725 |
|
725 | |||
726 | diff --git a/a b/aa |
|
726 | diff --git a/a b/aa | |
727 | copy from a |
|
727 | copy from a | |
728 | copy to aa |
|
728 | copy to aa | |
729 | diff --git a/cc b/cc |
|
729 | diff --git a/cc b/cc | |
730 | --- a/cc |
|
730 | --- a/cc | |
731 | +++ b/cc |
|
731 | +++ b/cc | |
732 | @@ -1,1 +1,5 @@ |
|
732 | @@ -1,1 +1,5 @@ | |
733 | +<<<<<<< working copy: 30d96aeaf27b - test: aa |
|
733 | +<<<<<<< working copy: 30d96aeaf27b - test: aa | |
734 | dd |
|
734 | dd | |
735 | +======= |
|
735 | +======= | |
736 | +cc |
|
736 | +cc | |
737 | +>>>>>>> merge rev: 1aa437659d19 bar - test: aazzcc |
|
737 | +>>>>>>> merge rev: 1aa437659d19 bar - test: aazzcc | |
738 |
|
738 | |||
739 | $ hg debugrename z |
|
739 | $ hg debugrename z | |
740 | z not renamed |
|
740 | z not renamed | |
741 |
|
741 | |||
742 | Amend a merge changeset (with renames during the merge): |
|
742 | Amend a merge changeset (with renames during the merge): | |
743 |
|
743 | |||
744 | $ hg up -q bar |
|
744 | $ hg up -q bar | |
745 | $ echo x > x |
|
745 | $ echo x > x | |
746 | $ hg add x |
|
746 | $ hg add x | |
747 | $ hg ci -m x |
|
747 | $ hg ci -m x | |
748 | $ hg up -q default |
|
748 | $ hg up -q default | |
749 | $ hg merge -q bar |
|
749 | $ hg merge -q bar | |
750 | $ hg mv aa aaa |
|
750 | $ hg mv aa aaa | |
751 | $ echo aa >> aaa |
|
751 | $ echo aa >> aaa | |
752 | $ hg ci -m 'merge bar again' |
|
752 | $ hg ci -m 'merge bar again' | |
753 | $ hg log --config diff.git=1 -pr . |
|
753 | $ hg log --config diff.git=1 -pr . | |
754 | changeset: 24:dffde028b388 |
|
754 | changeset: 24:dffde028b388 | |
755 | tag: tip |
|
755 | tag: tip | |
756 | parent: 22:12594a98ca3f |
|
756 | parent: 22:12594a98ca3f | |
757 | parent: 23:4c94d5bc65f5 |
|
757 | parent: 23:4c94d5bc65f5 | |
758 | user: test |
|
758 | user: test | |
759 | date: Thu Jan 01 00:00:00 1970 +0000 |
|
759 | date: Thu Jan 01 00:00:00 1970 +0000 | |
760 | summary: merge bar again |
|
760 | summary: merge bar again | |
761 |
|
761 | |||
762 | diff --git a/aa b/aa |
|
762 | diff --git a/aa b/aa | |
763 | deleted file mode 100644 |
|
763 | deleted file mode 100644 | |
764 | --- a/aa |
|
764 | --- a/aa | |
765 | +++ /dev/null |
|
765 | +++ /dev/null | |
766 | @@ -1,2 +0,0 @@ |
|
766 | @@ -1,2 +0,0 @@ | |
767 | -a |
|
767 | -a | |
768 | -a |
|
768 | -a | |
769 | diff --git a/aaa b/aaa |
|
769 | diff --git a/aaa b/aaa | |
770 | new file mode 100644 |
|
770 | new file mode 100644 | |
771 | --- /dev/null |
|
771 | --- /dev/null | |
772 | +++ b/aaa |
|
772 | +++ b/aaa | |
773 | @@ -0,0 +1,3 @@ |
|
773 | @@ -0,0 +1,3 @@ | |
774 | +a |
|
774 | +a | |
775 | +a |
|
775 | +a | |
776 | +aa |
|
776 | +aa | |
777 | diff --git a/x b/x |
|
777 | diff --git a/x b/x | |
778 | new file mode 100644 |
|
778 | new file mode 100644 | |
779 | --- /dev/null |
|
779 | --- /dev/null | |
780 | +++ b/x |
|
780 | +++ b/x | |
781 | @@ -0,0 +1,1 @@ |
|
781 | @@ -0,0 +1,1 @@ | |
782 | +x |
|
782 | +x | |
783 |
|
783 | |||
784 | $ hg debugrename aaa |
|
784 | $ hg debugrename aaa | |
785 | aaa renamed from aa:37d9b5d994eab34eda9c16b195ace52c7b129980 |
|
785 | aaa renamed from aa:37d9b5d994eab34eda9c16b195ace52c7b129980 | |
786 |
|
786 | |||
787 | Update to p1 with 'aaa' modified. 'aaa' was renamed from 'aa' in p2. 'aa' exists |
|
787 | Update to p1 with 'aaa' modified. 'aaa' was renamed from 'aa' in p2. 'aa' exists | |
788 | in p1 too, but it was recorded as copied from p2. |
|
788 | in p1 too, but it was recorded as copied from p2. | |
789 | $ echo modified >> aaa |
|
789 | $ echo modified >> aaa | |
790 | $ hg co -m '.^' -t :merge3 |
|
790 | $ hg co -m '.^' -t :merge3 | |
791 | file 'aaa' was deleted in other [destination] but was modified in local [working copy]. |
|
791 | file 'aaa' was deleted in other [destination] but was modified in local [working copy]. | |
792 | What do you want to do? |
|
792 | What do you want to do? | |
793 | use (c)hanged version, (d)elete, or leave (u)nresolved? u |
|
793 | use (c)hanged version, (d)elete, or leave (u)nresolved? u | |
794 | 1 files updated, 0 files merged, 1 files removed, 1 files unresolved |
|
794 | 1 files updated, 0 files merged, 1 files removed, 1 files unresolved | |
795 | use 'hg resolve' to retry unresolved file merges |
|
795 | use 'hg resolve' to retry unresolved file merges | |
796 | [1] |
|
796 | [1] | |
797 | $ hg co -C tip |
|
797 | $ hg co -C tip | |
798 | 2 files updated, 0 files merged, 1 files removed, 0 files unresolved |
|
798 | 2 files updated, 0 files merged, 1 files removed, 0 files unresolved | |
799 |
|
799 | |||
800 | $ hg mv aaa aa |
|
800 | $ hg mv aaa aa | |
801 | $ hg ci --amend -m 'merge bar again (undo rename)' |
|
801 | $ hg ci --amend -m 'merge bar again (undo rename)' | |
802 | $ hg log --config diff.git=1 -pr . |
|
802 | $ hg log --config diff.git=1 -pr . | |
803 | changeset: 25:18e3ba160489 |
|
803 | changeset: 25:18e3ba160489 | |
804 | tag: tip |
|
804 | tag: tip | |
805 | parent: 22:12594a98ca3f |
|
805 | parent: 22:12594a98ca3f | |
806 | parent: 23:4c94d5bc65f5 |
|
806 | parent: 23:4c94d5bc65f5 | |
807 | user: test |
|
807 | user: test | |
808 | date: Thu Jan 01 00:00:00 1970 +0000 |
|
808 | date: Thu Jan 01 00:00:00 1970 +0000 | |
809 | summary: merge bar again (undo rename) |
|
809 | summary: merge bar again (undo rename) | |
810 |
|
810 | |||
811 | diff --git a/aa b/aa |
|
811 | diff --git a/aa b/aa | |
812 | --- a/aa |
|
812 | --- a/aa | |
813 | +++ b/aa |
|
813 | +++ b/aa | |
814 | @@ -1,2 +1,3 @@ |
|
814 | @@ -1,2 +1,3 @@ | |
815 | a |
|
815 | a | |
816 | a |
|
816 | a | |
817 | +aa |
|
817 | +aa | |
818 | diff --git a/x b/x |
|
818 | diff --git a/x b/x | |
819 | new file mode 100644 |
|
819 | new file mode 100644 | |
820 | --- /dev/null |
|
820 | --- /dev/null | |
821 | +++ b/x |
|
821 | +++ b/x | |
822 | @@ -0,0 +1,1 @@ |
|
822 | @@ -0,0 +1,1 @@ | |
823 | +x |
|
823 | +x | |
824 |
|
824 | |||
825 | $ hg debugrename aa |
|
825 | $ hg debugrename aa | |
826 | aa not renamed |
|
826 | aa not renamed | |
827 | $ hg debugrename -r '.^' aa |
|
827 | $ hg debugrename -r '.^' aa | |
828 | aa renamed from a:a80d06849b333b8a3d5c445f8ba3142010dcdc9e |
|
828 | aa renamed from a:a80d06849b333b8a3d5c445f8ba3142010dcdc9e | |
829 |
|
829 | |||
830 | Amend a merge changeset (with manifest-level conflicts): |
|
830 | Amend a merge changeset (with manifest-level conflicts): | |
831 |
|
831 | |||
832 | $ hg up -q bar |
|
832 | $ hg up -q bar | |
833 | $ hg rm aa |
|
833 | $ hg rm aa | |
834 | $ hg ci -m 'rm aa' |
|
834 | $ hg ci -m 'rm aa' | |
835 | $ hg up -q default |
|
835 | $ hg up -q default | |
836 | $ echo aa >> aa |
|
836 | $ echo aa >> aa | |
837 | $ hg ci -m aa |
|
837 | $ hg ci -m aa | |
838 | $ hg merge -q bar --config ui.interactive=True << EOF |
|
838 | $ hg merge -q bar --config ui.interactive=True << EOF | |
839 | > c |
|
839 | > c | |
840 | > EOF |
|
840 | > EOF | |
841 | file 'aa' was deleted in other [merge rev] but was modified in local [working copy]. |
|
841 | file 'aa' was deleted in other [merge rev] but was modified in local [working copy]. | |
842 | What do you want to do? |
|
842 | What do you want to do? | |
843 | use (c)hanged version, (d)elete, or leave (u)nresolved? c |
|
843 | use (c)hanged version, (d)elete, or leave (u)nresolved? c | |
844 | $ hg ci -m 'merge bar (with conflicts)' |
|
844 | $ hg ci -m 'merge bar (with conflicts)' | |
845 | $ hg log --config diff.git=1 -pr . |
|
845 | $ hg log --config diff.git=1 -pr . | |
846 | changeset: 28:b4c3035e2544 |
|
846 | changeset: 28:b4c3035e2544 | |
847 | tag: tip |
|
847 | tag: tip | |
848 | parent: 27:4b216ca5ba97 |
|
848 | parent: 27:4b216ca5ba97 | |
849 | parent: 26:67db8847a540 |
|
849 | parent: 26:67db8847a540 | |
850 | user: test |
|
850 | user: test | |
851 | date: Thu Jan 01 00:00:00 1970 +0000 |
|
851 | date: Thu Jan 01 00:00:00 1970 +0000 | |
852 | summary: merge bar (with conflicts) |
|
852 | summary: merge bar (with conflicts) | |
853 |
|
853 | |||
854 |
|
854 | |||
855 | $ hg rm aa |
|
855 | $ hg rm aa | |
856 | $ hg ci --amend -m 'merge bar (with conflicts, amended)' |
|
856 | $ hg ci --amend -m 'merge bar (with conflicts, amended)' | |
857 | $ hg log --config diff.git=1 -pr . |
|
857 | $ hg log --config diff.git=1 -pr . | |
858 | changeset: 29:1205ed810051 |
|
858 | changeset: 29:1205ed810051 | |
859 | tag: tip |
|
859 | tag: tip | |
860 | parent: 27:4b216ca5ba97 |
|
860 | parent: 27:4b216ca5ba97 | |
861 | parent: 26:67db8847a540 |
|
861 | parent: 26:67db8847a540 | |
862 | user: test |
|
862 | user: test | |
863 | date: Thu Jan 01 00:00:00 1970 +0000 |
|
863 | date: Thu Jan 01 00:00:00 1970 +0000 | |
864 | summary: merge bar (with conflicts, amended) |
|
864 | summary: merge bar (with conflicts, amended) | |
865 |
|
865 | |||
866 | diff --git a/aa b/aa |
|
866 | diff --git a/aa b/aa | |
867 | deleted file mode 100644 |
|
867 | deleted file mode 100644 | |
868 | --- a/aa |
|
868 | --- a/aa | |
869 | +++ /dev/null |
|
869 | +++ /dev/null | |
870 | @@ -1,4 +0,0 @@ |
|
870 | @@ -1,4 +0,0 @@ | |
871 | -a |
|
871 | -a | |
872 | -a |
|
872 | -a | |
873 | -aa |
|
873 | -aa | |
874 | -aa |
|
874 | -aa | |
875 |
|
875 | |||
876 | Issue 3445: amending with --close-branch a commit that created a new head should fail |
|
876 | Issue 3445: amending with --close-branch a commit that created a new head should fail | |
877 | This shouldn't be possible: |
|
877 | This shouldn't be possible: | |
878 |
|
878 | |||
879 | $ hg up -q default |
|
879 | $ hg up -q default | |
880 | $ hg branch closewithamend |
|
880 | $ hg branch closewithamend | |
881 | marked working directory as branch closewithamend |
|
881 | marked working directory as branch closewithamend | |
882 | $ echo foo > foo |
|
882 | $ echo foo > foo | |
883 | $ hg add foo |
|
883 | $ hg add foo | |
884 | $ hg ci -m.. |
|
884 | $ hg ci -m.. | |
885 | $ hg ci --amend --close-branch -m 'closing' |
|
885 | $ hg ci --amend --close-branch -m 'closing' | |
886 | abort: can only close branch heads |
|
886 | abort: can only close branch heads | |
887 | [255] |
|
887 | [255] | |
888 |
|
888 | |||
889 | This silliness fails: |
|
889 | This silliness fails: | |
890 |
|
890 | |||
891 | $ hg branch silliness |
|
891 | $ hg branch silliness | |
892 | marked working directory as branch silliness |
|
892 | marked working directory as branch silliness | |
893 | $ echo b >> b |
|
893 | $ echo b >> b | |
894 | $ hg ci --close-branch -m'open and close' |
|
894 | $ hg ci --close-branch -m'open and close' | |
895 | abort: can only close branch heads |
|
895 | abort: can only close branch heads | |
896 | [255] |
|
896 | [255] | |
897 |
|
897 | |||
898 | Test that amend with --secret creates new secret changeset forcibly |
|
898 | Test that amend with --secret creates new secret changeset forcibly | |
899 | --------------------------------------------------------------------- |
|
899 | --------------------------------------------------------------------- | |
900 |
|
900 | |||
901 | $ hg phase '.^::.' |
|
901 | $ hg phase '.^::.' | |
902 | 29: draft |
|
902 | 29: draft | |
903 | 30: draft |
|
903 | 30: draft | |
904 | $ hg commit --amend --secret -m 'amend as secret' -q |
|
904 | $ hg commit --amend --secret -m 'amend as secret' -q | |
905 | $ hg phase '.^::.' |
|
905 | $ hg phase '.^::.' | |
906 | 29: draft |
|
906 | 29: draft | |
907 | 31: secret |
|
907 | 31: secret | |
908 |
|
908 | |||
909 | Test that amend with --edit invokes editor forcibly |
|
909 | Test that amend with --edit invokes editor forcibly | |
910 | --------------------------------------------------- |
|
910 | --------------------------------------------------- | |
911 |
|
911 | |||
912 | $ hg parents --template "{desc}\n" |
|
912 | $ hg parents --template "{desc}\n" | |
913 | amend as secret |
|
913 | amend as secret | |
914 | $ HGEDITOR=cat hg commit --amend -m "editor should be suppressed" |
|
914 | $ HGEDITOR=cat hg commit --amend -m "editor should be suppressed" | |
915 | $ hg parents --template "{desc}\n" |
|
915 | $ hg parents --template "{desc}\n" | |
916 | editor should be suppressed |
|
916 | editor should be suppressed | |
917 |
|
917 | |||
918 | $ hg status --rev '.^1::.' |
|
918 | $ hg status --rev '.^1::.' | |
919 | A foo |
|
919 | A foo | |
920 | $ HGEDITOR=cat hg commit --amend -m "editor should be invoked" --edit |
|
920 | $ HGEDITOR=cat hg commit --amend -m "editor should be invoked" --edit | |
921 | editor should be invoked |
|
921 | editor should be invoked | |
922 |
|
922 | |||
923 |
|
923 | |||
924 | HG: Enter commit message. Lines beginning with 'HG:' are removed. |
|
924 | HG: Enter commit message. Lines beginning with 'HG:' are removed. | |
925 | HG: Leave message empty to abort commit. |
|
925 | HG: Leave message empty to abort commit. | |
926 | HG: -- |
|
926 | HG: -- | |
927 | HG: user: test |
|
927 | HG: user: test | |
928 | HG: branch 'silliness' |
|
928 | HG: branch 'silliness' | |
929 | HG: added foo |
|
929 | HG: added foo | |
930 | $ hg parents --template "{desc}\n" |
|
930 | $ hg parents --template "{desc}\n" | |
931 | editor should be invoked |
|
931 | editor should be invoked | |
932 |
|
932 | |||
|
933 | Test that amend with --no-edit avoids the editor | |||
|
934 | ------------------------------------------------ | |||
|
935 | ||||
|
936 | $ hg commit --amend -m "before anything happens" | |||
|
937 | $ hg parents --template "{desc}\n" | |||
|
938 | before anything happens | |||
|
939 | $ HGEDITOR=cat hg commit --amend --no-edit -m "editor should be suppressed" | |||
|
940 | $ hg parents --template "{desc}\n" | |||
|
941 | editor should be suppressed | |||
|
942 | ||||
|
943 | (We need a file change here since we won't have a message change) | |||
|
944 | $ cp foo foo.orig | |||
|
945 | $ echo hi >> foo | |||
|
946 | FIXME: This shouldn't start the editor. | |||
|
947 | $ HGEDITOR=cat hg commit --amend --no-edit | |||
|
948 | editor should be suppressed | |||
|
949 | ||||
|
950 | ||||
|
951 | HG: Enter commit message. Lines beginning with 'HG:' are removed. | |||
|
952 | HG: Leave message empty to abort commit. | |||
|
953 | HG: -- | |||
|
954 | HG: user: test | |||
|
955 | HG: branch 'silliness' | |||
|
956 | HG: added foo | |||
|
957 | $ hg parents --template "{desc}\n" | |||
|
958 | editor should be suppressed | |||
|
959 | $ hg status -mar | |||
|
960 | (Let's undo adding that "hi" so later tests don't need to be adjusted) | |||
|
961 | $ mv foo.orig foo | |||
|
962 | $ hg commit --amend --no-edit | |||
|
963 | ||||
933 | Test that "diff()" in committemplate works correctly for amending |
|
964 | Test that "diff()" in committemplate works correctly for amending | |
934 | ----------------------------------------------------------------- |
|
965 | ----------------------------------------------------------------- | |
935 |
|
966 | |||
936 | $ cat >> .hg/hgrc <<EOF |
|
967 | $ cat >> .hg/hgrc <<EOF | |
937 | > [committemplate] |
|
968 | > [committemplate] | |
938 |
> changeset.commit.amend = {desc}\ |
|
969 | > changeset.commit.amend = {desc}\n | |
939 |
> HG: M: { |
|
970 | > HG: M: {file_mods} | |
940 |
|
|
971 | > HG: A: {file_adds} | |
941 |
|
|
972 | > HG: R: {file_dels} | |
942 |
|
|
973 | > {splitlines(diff()) % 'HG: {line}\n'} | |
943 | > EOF |
|
974 | > EOF | |
944 |
|
975 | |||
945 |
$ |
|
976 | $ hg parents --template "M: {file_mods}\nA: {file_adds}\nR: {file_dels}\n" | |
946 | M: |
|
977 | M: | |
947 | A: foo |
|
978 | A: foo | |
948 | R: |
|
979 | R: | |
949 | $ hg status -amr |
|
980 | $ hg status -amr | |
950 | $ HGEDITOR=cat hg commit --amend -e -m "expecting diff of foo" |
|
981 | $ HGEDITOR=cat hg commit --amend -e -m "expecting diff of foo" | |
951 | expecting diff of foo |
|
982 | expecting diff of foo | |
952 |
|
983 | |||
953 | HG: M: |
|
984 | HG: M: | |
954 | HG: A: foo |
|
985 | HG: A: foo | |
955 | HG: R: |
|
986 | HG: R: | |
956 | HG: diff -r 1205ed810051 foo |
|
987 | HG: diff -r 1205ed810051 foo | |
957 | HG: --- /dev/null Thu Jan 01 00:00:00 1970 +0000 |
|
988 | HG: --- /dev/null Thu Jan 01 00:00:00 1970 +0000 | |
958 | HG: +++ b/foo Thu Jan 01 00:00:00 1970 +0000 |
|
989 | HG: +++ b/foo Thu Jan 01 00:00:00 1970 +0000 | |
959 | HG: @@ -0,0 +1,1 @@ |
|
990 | HG: @@ -0,0 +1,1 @@ | |
960 | HG: +foo |
|
991 | HG: +foo | |
961 |
|
992 | |||
962 | $ echo y > y |
|
993 | $ echo y > y | |
963 | $ hg add y |
|
994 | $ hg add y | |
964 | $ HGEDITOR=cat hg commit --amend -e -m "expecting diff of foo and y" |
|
995 | $ HGEDITOR=cat hg commit --amend -e -m "expecting diff of foo and y" | |
965 | expecting diff of foo and y |
|
996 | expecting diff of foo and y | |
966 |
|
997 | |||
967 | HG: M: |
|
998 | HG: M: | |
968 | HG: A: foo y |
|
999 | HG: A: foo y | |
969 | HG: R: |
|
1000 | HG: R: | |
970 | HG: diff -r 1205ed810051 foo |
|
1001 | HG: diff -r 1205ed810051 foo | |
971 | HG: --- /dev/null Thu Jan 01 00:00:00 1970 +0000 |
|
1002 | HG: --- /dev/null Thu Jan 01 00:00:00 1970 +0000 | |
972 | HG: +++ b/foo Thu Jan 01 00:00:00 1970 +0000 |
|
1003 | HG: +++ b/foo Thu Jan 01 00:00:00 1970 +0000 | |
973 | HG: @@ -0,0 +1,1 @@ |
|
1004 | HG: @@ -0,0 +1,1 @@ | |
974 | HG: +foo |
|
1005 | HG: +foo | |
975 | HG: diff -r 1205ed810051 y |
|
1006 | HG: diff -r 1205ed810051 y | |
976 | HG: --- /dev/null Thu Jan 01 00:00:00 1970 +0000 |
|
1007 | HG: --- /dev/null Thu Jan 01 00:00:00 1970 +0000 | |
977 | HG: +++ b/y Thu Jan 01 00:00:00 1970 +0000 |
|
1008 | HG: +++ b/y Thu Jan 01 00:00:00 1970 +0000 | |
978 | HG: @@ -0,0 +1,1 @@ |
|
1009 | HG: @@ -0,0 +1,1 @@ | |
979 | HG: +y |
|
1010 | HG: +y | |
980 |
|
1011 | |||
981 | $ hg rm a |
|
1012 | $ hg rm a | |
982 | $ HGEDITOR=cat hg commit --amend -e -m "expecting diff of a, foo and y" |
|
1013 | $ HGEDITOR=cat hg commit --amend -e -m "expecting diff of a, foo and y" | |
983 | expecting diff of a, foo and y |
|
1014 | expecting diff of a, foo and y | |
984 |
|
1015 | |||
985 | HG: M: |
|
1016 | HG: M: | |
986 | HG: A: foo y |
|
1017 | HG: A: foo y | |
987 | HG: R: a |
|
1018 | HG: R: a | |
988 | HG: diff -r 1205ed810051 a |
|
1019 | HG: diff -r 1205ed810051 a | |
989 | HG: --- a/a Thu Jan 01 00:00:00 1970 +0000 |
|
1020 | HG: --- a/a Thu Jan 01 00:00:00 1970 +0000 | |
990 | HG: +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 |
|
1021 | HG: +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 | |
991 | HG: @@ -1,2 +0,0 @@ |
|
1022 | HG: @@ -1,2 +0,0 @@ | |
992 | HG: -a |
|
1023 | HG: -a | |
993 | HG: -a |
|
1024 | HG: -a | |
994 | HG: diff -r 1205ed810051 foo |
|
1025 | HG: diff -r 1205ed810051 foo | |
995 | HG: --- /dev/null Thu Jan 01 00:00:00 1970 +0000 |
|
1026 | HG: --- /dev/null Thu Jan 01 00:00:00 1970 +0000 | |
996 | HG: +++ b/foo Thu Jan 01 00:00:00 1970 +0000 |
|
1027 | HG: +++ b/foo Thu Jan 01 00:00:00 1970 +0000 | |
997 | HG: @@ -0,0 +1,1 @@ |
|
1028 | HG: @@ -0,0 +1,1 @@ | |
998 | HG: +foo |
|
1029 | HG: +foo | |
999 | HG: diff -r 1205ed810051 y |
|
1030 | HG: diff -r 1205ed810051 y | |
1000 | HG: --- /dev/null Thu Jan 01 00:00:00 1970 +0000 |
|
1031 | HG: --- /dev/null Thu Jan 01 00:00:00 1970 +0000 | |
1001 | HG: +++ b/y Thu Jan 01 00:00:00 1970 +0000 |
|
1032 | HG: +++ b/y Thu Jan 01 00:00:00 1970 +0000 | |
1002 | HG: @@ -0,0 +1,1 @@ |
|
1033 | HG: @@ -0,0 +1,1 @@ | |
1003 | HG: +y |
|
1034 | HG: +y | |
1004 |
|
1035 | |||
1005 | $ hg rm x |
|
1036 | $ hg rm x | |
1006 | $ HGEDITOR=cat hg commit --amend -e -m "expecting diff of a, foo, x and y" |
|
1037 | $ HGEDITOR=cat hg commit --amend -e -m "expecting diff of a, foo, x and y" | |
1007 | expecting diff of a, foo, x and y |
|
1038 | expecting diff of a, foo, x and y | |
1008 |
|
1039 | |||
1009 | HG: M: |
|
1040 | HG: M: | |
1010 | HG: A: foo y |
|
1041 | HG: A: foo y | |
1011 | HG: R: a x |
|
1042 | HG: R: a x | |
1012 | HG: diff -r 1205ed810051 a |
|
1043 | HG: diff -r 1205ed810051 a | |
1013 | HG: --- a/a Thu Jan 01 00:00:00 1970 +0000 |
|
1044 | HG: --- a/a Thu Jan 01 00:00:00 1970 +0000 | |
1014 | HG: +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 |
|
1045 | HG: +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 | |
1015 | HG: @@ -1,2 +0,0 @@ |
|
1046 | HG: @@ -1,2 +0,0 @@ | |
1016 | HG: -a |
|
1047 | HG: -a | |
1017 | HG: -a |
|
1048 | HG: -a | |
1018 | HG: diff -r 1205ed810051 foo |
|
1049 | HG: diff -r 1205ed810051 foo | |
1019 | HG: --- /dev/null Thu Jan 01 00:00:00 1970 +0000 |
|
1050 | HG: --- /dev/null Thu Jan 01 00:00:00 1970 +0000 | |
1020 | HG: +++ b/foo Thu Jan 01 00:00:00 1970 +0000 |
|
1051 | HG: +++ b/foo Thu Jan 01 00:00:00 1970 +0000 | |
1021 | HG: @@ -0,0 +1,1 @@ |
|
1052 | HG: @@ -0,0 +1,1 @@ | |
1022 | HG: +foo |
|
1053 | HG: +foo | |
1023 | HG: diff -r 1205ed810051 x |
|
1054 | HG: diff -r 1205ed810051 x | |
1024 | HG: --- a/x Thu Jan 01 00:00:00 1970 +0000 |
|
1055 | HG: --- a/x Thu Jan 01 00:00:00 1970 +0000 | |
1025 | HG: +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 |
|
1056 | HG: +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 | |
1026 | HG: @@ -1,1 +0,0 @@ |
|
1057 | HG: @@ -1,1 +0,0 @@ | |
1027 | HG: -x |
|
1058 | HG: -x | |
1028 | HG: diff -r 1205ed810051 y |
|
1059 | HG: diff -r 1205ed810051 y | |
1029 | HG: --- /dev/null Thu Jan 01 00:00:00 1970 +0000 |
|
1060 | HG: --- /dev/null Thu Jan 01 00:00:00 1970 +0000 | |
1030 | HG: +++ b/y Thu Jan 01 00:00:00 1970 +0000 |
|
1061 | HG: +++ b/y Thu Jan 01 00:00:00 1970 +0000 | |
1031 | HG: @@ -0,0 +1,1 @@ |
|
1062 | HG: @@ -0,0 +1,1 @@ | |
1032 | HG: +y |
|
1063 | HG: +y | |
1033 |
|
1064 | |||
1034 | $ echo cccc >> cc |
|
1065 | $ echo cccc >> cc | |
1035 | $ hg status -amr |
|
1066 | $ hg status -amr | |
1036 | M cc |
|
1067 | M cc | |
1037 | $ HGEDITOR=cat hg commit --amend -e -m "cc should be excluded" -X cc |
|
1068 | $ HGEDITOR=cat hg commit --amend -e -m "cc should be excluded" -X cc | |
1038 | cc should be excluded |
|
1069 | cc should be excluded | |
1039 |
|
1070 | |||
1040 | HG: M: |
|
1071 | HG: M: | |
1041 | HG: A: foo y |
|
1072 | HG: A: foo y | |
1042 | HG: R: a x |
|
1073 | HG: R: a x | |
1043 | HG: diff -r 1205ed810051 a |
|
1074 | HG: diff -r 1205ed810051 a | |
1044 | HG: --- a/a Thu Jan 01 00:00:00 1970 +0000 |
|
1075 | HG: --- a/a Thu Jan 01 00:00:00 1970 +0000 | |
1045 | HG: +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 |
|
1076 | HG: +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 | |
1046 | HG: @@ -1,2 +0,0 @@ |
|
1077 | HG: @@ -1,2 +0,0 @@ | |
1047 | HG: -a |
|
1078 | HG: -a | |
1048 | HG: -a |
|
1079 | HG: -a | |
1049 | HG: diff -r 1205ed810051 foo |
|
1080 | HG: diff -r 1205ed810051 foo | |
1050 | HG: --- /dev/null Thu Jan 01 00:00:00 1970 +0000 |
|
1081 | HG: --- /dev/null Thu Jan 01 00:00:00 1970 +0000 | |
1051 | HG: +++ b/foo Thu Jan 01 00:00:00 1970 +0000 |
|
1082 | HG: +++ b/foo Thu Jan 01 00:00:00 1970 +0000 | |
1052 | HG: @@ -0,0 +1,1 @@ |
|
1083 | HG: @@ -0,0 +1,1 @@ | |
1053 | HG: +foo |
|
1084 | HG: +foo | |
1054 | HG: diff -r 1205ed810051 x |
|
1085 | HG: diff -r 1205ed810051 x | |
1055 | HG: --- a/x Thu Jan 01 00:00:00 1970 +0000 |
|
1086 | HG: --- a/x Thu Jan 01 00:00:00 1970 +0000 | |
1056 | HG: +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 |
|
1087 | HG: +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 | |
1057 | HG: @@ -1,1 +0,0 @@ |
|
1088 | HG: @@ -1,1 +0,0 @@ | |
1058 | HG: -x |
|
1089 | HG: -x | |
1059 | HG: diff -r 1205ed810051 y |
|
1090 | HG: diff -r 1205ed810051 y | |
1060 | HG: --- /dev/null Thu Jan 01 00:00:00 1970 +0000 |
|
1091 | HG: --- /dev/null Thu Jan 01 00:00:00 1970 +0000 | |
1061 | HG: +++ b/y Thu Jan 01 00:00:00 1970 +0000 |
|
1092 | HG: +++ b/y Thu Jan 01 00:00:00 1970 +0000 | |
1062 | HG: @@ -0,0 +1,1 @@ |
|
1093 | HG: @@ -0,0 +1,1 @@ | |
1063 | HG: +y |
|
1094 | HG: +y | |
1064 |
|
1095 | |||
1065 | Check for issue4405 |
|
1096 | Check for issue4405 | |
1066 | ------------------- |
|
1097 | ------------------- | |
1067 |
|
1098 | |||
1068 | Setup the repo with a file that gets moved in a second commit. |
|
1099 | Setup the repo with a file that gets moved in a second commit. | |
1069 | $ hg init repo |
|
1100 | $ hg init repo | |
1070 | $ cd repo |
|
1101 | $ cd repo | |
1071 | $ touch a0 |
|
1102 | $ touch a0 | |
1072 | $ hg add a0 |
|
1103 | $ hg add a0 | |
1073 | $ hg commit -m a0 |
|
1104 | $ hg commit -m a0 | |
1074 | $ hg mv a0 a1 |
|
1105 | $ hg mv a0 a1 | |
1075 | $ hg commit -m a1 |
|
1106 | $ hg commit -m a1 | |
1076 | $ hg up -q 0 |
|
1107 | $ hg up -q 0 | |
1077 | $ hg log -G --template '{rev} {desc}' |
|
1108 | $ hg log -G --template '{rev} {desc}' | |
1078 | o 1 a1 |
|
1109 | o 1 a1 | |
1079 | | |
|
1110 | | | |
1080 | @ 0 a0 |
|
1111 | @ 0 a0 | |
1081 |
|
1112 | |||
1082 |
|
1113 | |||
1083 | Now we branch the repro, but re-use the file contents, so we have a divergence |
|
1114 | Now we branch the repro, but re-use the file contents, so we have a divergence | |
1084 | in the file revlog topology and the changelog topology. |
|
1115 | in the file revlog topology and the changelog topology. | |
1085 | $ hg revert --rev 1 --all |
|
1116 | $ hg revert --rev 1 --all | |
1086 | removing a0 |
|
1117 | removing a0 | |
1087 | adding a1 |
|
1118 | adding a1 | |
1088 | $ hg ci -qm 'a1-amend' |
|
1119 | $ hg ci -qm 'a1-amend' | |
1089 | $ hg log -G --template '{rev} {desc}' |
|
1120 | $ hg log -G --template '{rev} {desc}' | |
1090 | @ 2 a1-amend |
|
1121 | @ 2 a1-amend | |
1091 | | |
|
1122 | | | |
1092 | | o 1 a1 |
|
1123 | | o 1 a1 | |
1093 | |/ |
|
1124 | |/ | |
1094 | o 0 a0 |
|
1125 | o 0 a0 | |
1095 |
|
1126 | |||
1096 |
|
1127 | |||
1097 | The way mercurial does amends is by folding the working copy and old commit |
|
1128 | The way mercurial does amends is by folding the working copy and old commit | |
1098 | together into another commit (rev 3). During this process, _findlimit is called |
|
1129 | together into another commit (rev 3). During this process, _findlimit is called | |
1099 | to check how far back to look for the transitive closure of file copy |
|
1130 | to check how far back to look for the transitive closure of file copy | |
1100 | information, but due to the divergence of the filelog and changelog graph |
|
1131 | information, but due to the divergence of the filelog and changelog graph | |
1101 | topologies, before _findlimit was fixed, it returned a rev which was not far |
|
1132 | topologies, before _findlimit was fixed, it returned a rev which was not far | |
1102 | enough back in this case. |
|
1133 | enough back in this case. | |
1103 | $ hg mv a1 a2 |
|
1134 | $ hg mv a1 a2 | |
1104 | $ hg status --copies --rev 0 |
|
1135 | $ hg status --copies --rev 0 | |
1105 | A a2 |
|
1136 | A a2 | |
1106 | a0 |
|
1137 | a0 | |
1107 | R a0 |
|
1138 | R a0 | |
1108 | $ hg ci --amend -q |
|
1139 | $ hg ci --amend -q | |
1109 | $ hg log -G --template '{rev} {desc}' |
|
1140 | $ hg log -G --template '{rev} {desc}' | |
1110 | @ 3 a1-amend |
|
1141 | @ 3 a1-amend | |
1111 | | |
|
1142 | | | |
1112 | | o 1 a1 |
|
1143 | | o 1 a1 | |
1113 | |/ |
|
1144 | |/ | |
1114 | o 0 a0 |
|
1145 | o 0 a0 | |
1115 |
|
1146 | |||
1116 |
|
1147 | |||
1117 | Before the fix, the copy information was lost. |
|
1148 | Before the fix, the copy information was lost. | |
1118 | $ hg status --copies --rev 0 |
|
1149 | $ hg status --copies --rev 0 | |
1119 | A a2 |
|
1150 | A a2 | |
1120 | a0 |
|
1151 | a0 | |
1121 | R a0 |
|
1152 | R a0 | |
1122 | $ cd .. |
|
1153 | $ cd .. | |
1123 |
|
1154 | |||
1124 | Check that amend properly preserve rename from directory rename (issue-4516) |
|
1155 | Check that amend properly preserve rename from directory rename (issue-4516) | |
1125 |
|
1156 | |||
1126 | If a parent of the merge renames a full directory, any files added to the old |
|
1157 | If a parent of the merge renames a full directory, any files added to the old | |
1127 | directory in the other parent will be renamed to the new directory. For some |
|
1158 | directory in the other parent will be renamed to the new directory. For some | |
1128 | reason, the rename metadata was when amending such merge. This test ensure we |
|
1159 | reason, the rename metadata was when amending such merge. This test ensure we | |
1129 | do not regress. We have a dedicated repo because it needs a setup with renamed |
|
1160 | do not regress. We have a dedicated repo because it needs a setup with renamed | |
1130 | directory) |
|
1161 | directory) | |
1131 |
|
1162 | |||
1132 | $ hg init issue4516 |
|
1163 | $ hg init issue4516 | |
1133 | $ cd issue4516 |
|
1164 | $ cd issue4516 | |
1134 | $ mkdir olddirname |
|
1165 | $ mkdir olddirname | |
1135 | $ echo line1 > olddirname/commonfile.py |
|
1166 | $ echo line1 > olddirname/commonfile.py | |
1136 | $ hg add olddirname/commonfile.py |
|
1167 | $ hg add olddirname/commonfile.py | |
1137 | $ hg ci -m first |
|
1168 | $ hg ci -m first | |
1138 |
|
1169 | |||
1139 | $ hg branch newdirname |
|
1170 | $ hg branch newdirname | |
1140 | marked working directory as branch newdirname |
|
1171 | marked working directory as branch newdirname | |
1141 | (branches are permanent and global, did you want a bookmark?) |
|
1172 | (branches are permanent and global, did you want a bookmark?) | |
1142 | $ hg mv olddirname newdirname |
|
1173 | $ hg mv olddirname newdirname | |
1143 | moving olddirname/commonfile.py to newdirname/commonfile.py |
|
1174 | moving olddirname/commonfile.py to newdirname/commonfile.py | |
1144 | $ hg ci -m rename |
|
1175 | $ hg ci -m rename | |
1145 |
|
1176 | |||
1146 | $ hg update default |
|
1177 | $ hg update default | |
1147 | 1 files updated, 0 files merged, 1 files removed, 0 files unresolved |
|
1178 | 1 files updated, 0 files merged, 1 files removed, 0 files unresolved | |
1148 | $ echo line1 > olddirname/newfile.py |
|
1179 | $ echo line1 > olddirname/newfile.py | |
1149 | $ hg add olddirname/newfile.py |
|
1180 | $ hg add olddirname/newfile.py | |
1150 | $ hg ci -m log |
|
1181 | $ hg ci -m log | |
1151 |
|
1182 | |||
1152 | $ hg up newdirname |
|
1183 | $ hg up newdirname | |
1153 | 1 files updated, 0 files merged, 2 files removed, 0 files unresolved |
|
1184 | 1 files updated, 0 files merged, 2 files removed, 0 files unresolved | |
1154 | $ # create newdirname/newfile.py |
|
1185 | $ # create newdirname/newfile.py | |
1155 | $ hg merge default |
|
1186 | $ hg merge default | |
1156 | 1 files updated, 0 files merged, 0 files removed, 0 files unresolved |
|
1187 | 1 files updated, 0 files merged, 0 files removed, 0 files unresolved | |
1157 | (branch merge, don't forget to commit) |
|
1188 | (branch merge, don't forget to commit) | |
1158 | $ hg ci -m add |
|
1189 | $ hg ci -m add | |
1159 | $ |
|
1190 | $ | |
1160 | $ hg debugrename newdirname/newfile.py |
|
1191 | $ hg debugrename newdirname/newfile.py | |
1161 | newdirname/newfile.py renamed from olddirname/newfile.py:690b295714aed510803d3020da9c70fca8336def |
|
1192 | newdirname/newfile.py renamed from olddirname/newfile.py:690b295714aed510803d3020da9c70fca8336def | |
1162 | $ hg status -C --change . |
|
1193 | $ hg status -C --change . | |
1163 | A newdirname/newfile.py |
|
1194 | A newdirname/newfile.py | |
1164 | $ hg status -C --rev 1 |
|
1195 | $ hg status -C --rev 1 | |
1165 | A newdirname/newfile.py |
|
1196 | A newdirname/newfile.py | |
1166 | $ hg status -C --rev 2 |
|
1197 | $ hg status -C --rev 2 | |
1167 | A newdirname/commonfile.py |
|
1198 | A newdirname/commonfile.py | |
1168 | olddirname/commonfile.py |
|
1199 | olddirname/commonfile.py | |
1169 | A newdirname/newfile.py |
|
1200 | A newdirname/newfile.py | |
1170 | olddirname/newfile.py |
|
1201 | olddirname/newfile.py | |
1171 | R olddirname/commonfile.py |
|
1202 | R olddirname/commonfile.py | |
1172 | R olddirname/newfile.py |
|
1203 | R olddirname/newfile.py | |
1173 | $ hg debugindex newdirname/newfile.py |
|
1204 | $ hg debugindex newdirname/newfile.py | |
1174 | rev linkrev nodeid p1 p2 |
|
1205 | rev linkrev nodeid p1 p2 | |
1175 | 0 3 34a4d536c0c0 000000000000 000000000000 |
|
1206 | 0 3 34a4d536c0c0 000000000000 000000000000 | |
1176 |
|
1207 | |||
1177 | $ echo a >> newdirname/commonfile.py |
|
1208 | $ echo a >> newdirname/commonfile.py | |
1178 | $ hg ci --amend -m bug |
|
1209 | $ hg ci --amend -m bug | |
1179 | $ hg debugrename newdirname/newfile.py |
|
1210 | $ hg debugrename newdirname/newfile.py | |
1180 | newdirname/newfile.py renamed from olddirname/newfile.py:690b295714aed510803d3020da9c70fca8336def |
|
1211 | newdirname/newfile.py renamed from olddirname/newfile.py:690b295714aed510803d3020da9c70fca8336def | |
1181 | $ hg debugindex newdirname/newfile.py |
|
1212 | $ hg debugindex newdirname/newfile.py | |
1182 | rev linkrev nodeid p1 p2 |
|
1213 | rev linkrev nodeid p1 p2 | |
1183 | 0 3 34a4d536c0c0 000000000000 000000000000 |
|
1214 | 0 3 34a4d536c0c0 000000000000 000000000000 | |
1184 |
|
1215 | |||
1185 | #if execbit |
|
1216 | #if execbit | |
1186 |
|
1217 | |||
1187 | Test if amend preserves executable bit changes |
|
1218 | Test if amend preserves executable bit changes | |
1188 | $ chmod +x newdirname/commonfile.py |
|
1219 | $ chmod +x newdirname/commonfile.py | |
1189 | $ hg ci -m chmod |
|
1220 | $ hg ci -m chmod | |
1190 | $ hg ci --amend -m "chmod amended" |
|
1221 | $ hg ci --amend -m "chmod amended" | |
1191 | $ hg ci --amend -m "chmod amended second time" |
|
1222 | $ hg ci --amend -m "chmod amended second time" | |
1192 | $ hg log -p --git -r . |
|
1223 | $ hg log -p --git -r . | |
1193 | changeset: 7:b1326f52dddf |
|
1224 | changeset: 7:b1326f52dddf | |
1194 | branch: newdirname |
|
1225 | branch: newdirname | |
1195 | tag: tip |
|
1226 | tag: tip | |
1196 | parent: 4:7fd235f7cb2f |
|
1227 | parent: 4:7fd235f7cb2f | |
1197 | user: test |
|
1228 | user: test | |
1198 | date: Thu Jan 01 00:00:00 1970 +0000 |
|
1229 | date: Thu Jan 01 00:00:00 1970 +0000 | |
1199 | summary: chmod amended second time |
|
1230 | summary: chmod amended second time | |
1200 |
|
1231 | |||
1201 | diff --git a/newdirname/commonfile.py b/newdirname/commonfile.py |
|
1232 | diff --git a/newdirname/commonfile.py b/newdirname/commonfile.py | |
1202 | old mode 100644 |
|
1233 | old mode 100644 | |
1203 | new mode 100755 |
|
1234 | new mode 100755 | |
1204 |
|
1235 | |||
1205 | #endif |
|
1236 | #endif | |
1206 |
|
1237 | |||
1207 | Test amend with file inclusion options |
|
1238 | Test amend with file inclusion options | |
1208 | -------------------------------------- |
|
1239 | -------------------------------------- | |
1209 |
|
1240 | |||
1210 | These tests ensure that we are always amending some files that were part of the |
|
1241 | These tests ensure that we are always amending some files that were part of the | |
1211 | pre-amend commit. We want to test that the remaining files in the pre-amend |
|
1242 | pre-amend commit. We want to test that the remaining files in the pre-amend | |
1212 | commit were not changed in the amended commit. We do so by performing a diff of |
|
1243 | commit were not changed in the amended commit. We do so by performing a diff of | |
1213 | the amended commit against its parent commit. |
|
1244 | the amended commit against its parent commit. | |
1214 | $ cd .. |
|
1245 | $ cd .. | |
1215 | $ hg init testfileinclusions |
|
1246 | $ hg init testfileinclusions | |
1216 | $ cd testfileinclusions |
|
1247 | $ cd testfileinclusions | |
1217 | $ echo a > a |
|
1248 | $ echo a > a | |
1218 | $ echo b > b |
|
1249 | $ echo b > b | |
1219 | $ hg commit -Aqm "Adding a and b" |
|
1250 | $ hg commit -Aqm "Adding a and b" | |
1220 |
|
1251 | |||
1221 | Only add changes to a particular file |
|
1252 | Only add changes to a particular file | |
1222 | $ echo a >> a |
|
1253 | $ echo a >> a | |
1223 | $ echo b >> b |
|
1254 | $ echo b >> b | |
1224 | $ hg commit --amend -I a |
|
1255 | $ hg commit --amend -I a | |
1225 | $ hg diff --git -r null -r . |
|
1256 | $ hg diff --git -r null -r . | |
1226 | diff --git a/a b/a |
|
1257 | diff --git a/a b/a | |
1227 | new file mode 100644 |
|
1258 | new file mode 100644 | |
1228 | --- /dev/null |
|
1259 | --- /dev/null | |
1229 | +++ b/a |
|
1260 | +++ b/a | |
1230 | @@ -0,0 +1,2 @@ |
|
1261 | @@ -0,0 +1,2 @@ | |
1231 | +a |
|
1262 | +a | |
1232 | +a |
|
1263 | +a | |
1233 | diff --git a/b b/b |
|
1264 | diff --git a/b b/b | |
1234 | new file mode 100644 |
|
1265 | new file mode 100644 | |
1235 | --- /dev/null |
|
1266 | --- /dev/null | |
1236 | +++ b/b |
|
1267 | +++ b/b | |
1237 | @@ -0,0 +1,1 @@ |
|
1268 | @@ -0,0 +1,1 @@ | |
1238 | +b |
|
1269 | +b | |
1239 |
|
1270 | |||
1240 | $ echo a >> a |
|
1271 | $ echo a >> a | |
1241 | $ hg commit --amend b |
|
1272 | $ hg commit --amend b | |
1242 | $ hg diff --git -r null -r . |
|
1273 | $ hg diff --git -r null -r . | |
1243 | diff --git a/a b/a |
|
1274 | diff --git a/a b/a | |
1244 | new file mode 100644 |
|
1275 | new file mode 100644 | |
1245 | --- /dev/null |
|
1276 | --- /dev/null | |
1246 | +++ b/a |
|
1277 | +++ b/a | |
1247 | @@ -0,0 +1,2 @@ |
|
1278 | @@ -0,0 +1,2 @@ | |
1248 | +a |
|
1279 | +a | |
1249 | +a |
|
1280 | +a | |
1250 | diff --git a/b b/b |
|
1281 | diff --git a/b b/b | |
1251 | new file mode 100644 |
|
1282 | new file mode 100644 | |
1252 | --- /dev/null |
|
1283 | --- /dev/null | |
1253 | +++ b/b |
|
1284 | +++ b/b | |
1254 | @@ -0,0 +1,2 @@ |
|
1285 | @@ -0,0 +1,2 @@ | |
1255 | +b |
|
1286 | +b | |
1256 | +b |
|
1287 | +b | |
1257 |
|
1288 | |||
1258 | Exclude changes to a particular file |
|
1289 | Exclude changes to a particular file | |
1259 | $ echo b >> b |
|
1290 | $ echo b >> b | |
1260 | $ hg commit --amend -X a |
|
1291 | $ hg commit --amend -X a | |
1261 | $ hg diff --git -r null -r . |
|
1292 | $ hg diff --git -r null -r . | |
1262 | diff --git a/a b/a |
|
1293 | diff --git a/a b/a | |
1263 | new file mode 100644 |
|
1294 | new file mode 100644 | |
1264 | --- /dev/null |
|
1295 | --- /dev/null | |
1265 | +++ b/a |
|
1296 | +++ b/a | |
1266 | @@ -0,0 +1,2 @@ |
|
1297 | @@ -0,0 +1,2 @@ | |
1267 | +a |
|
1298 | +a | |
1268 | +a |
|
1299 | +a | |
1269 | diff --git a/b b/b |
|
1300 | diff --git a/b b/b | |
1270 | new file mode 100644 |
|
1301 | new file mode 100644 | |
1271 | --- /dev/null |
|
1302 | --- /dev/null | |
1272 | +++ b/b |
|
1303 | +++ b/b | |
1273 | @@ -0,0 +1,3 @@ |
|
1304 | @@ -0,0 +1,3 @@ | |
1274 | +b |
|
1305 | +b | |
1275 | +b |
|
1306 | +b | |
1276 | +b |
|
1307 | +b | |
1277 |
|
1308 | |||
1278 | Check the addremove flag |
|
1309 | Check the addremove flag | |
1279 | $ echo c > c |
|
1310 | $ echo c > c | |
1280 | $ rm a |
|
1311 | $ rm a | |
1281 | $ hg commit --amend -A |
|
1312 | $ hg commit --amend -A | |
1282 | removing a |
|
1313 | removing a | |
1283 | adding c |
|
1314 | adding c | |
1284 | $ hg diff --git -r null -r . |
|
1315 | $ hg diff --git -r null -r . | |
1285 | diff --git a/b b/b |
|
1316 | diff --git a/b b/b | |
1286 | new file mode 100644 |
|
1317 | new file mode 100644 | |
1287 | --- /dev/null |
|
1318 | --- /dev/null | |
1288 | +++ b/b |
|
1319 | +++ b/b | |
1289 | @@ -0,0 +1,3 @@ |
|
1320 | @@ -0,0 +1,3 @@ | |
1290 | +b |
|
1321 | +b | |
1291 | +b |
|
1322 | +b | |
1292 | +b |
|
1323 | +b | |
1293 | diff --git a/c b/c |
|
1324 | diff --git a/c b/c | |
1294 | new file mode 100644 |
|
1325 | new file mode 100644 | |
1295 | --- /dev/null |
|
1326 | --- /dev/null | |
1296 | +++ b/c |
|
1327 | +++ b/c | |
1297 | @@ -0,0 +1,1 @@ |
|
1328 | @@ -0,0 +1,1 @@ | |
1298 | +c |
|
1329 | +c |
General Comments 0
You need to be logged in to leave comments.
Login now