Show More
@@ -1,237 +1,339 b'' | |||
|
1 | 1 | #testcases obsstore-off obsstore-on |
|
2 | 2 | |
|
3 | 3 | $ cat << EOF >> $HGRCPATH |
|
4 | 4 | > [extensions] |
|
5 | 5 | > amend= |
|
6 | 6 | > debugdrawdag=$TESTDIR/drawdag.py |
|
7 | 7 | > [diff] |
|
8 | 8 | > git=1 |
|
9 | 9 | > EOF |
|
10 | 10 | |
|
11 | 11 | #if obsstore-on |
|
12 | 12 | $ cat << EOF >> $HGRCPATH |
|
13 | 13 | > [experimental] |
|
14 | 14 | > evolution.createmarkers=True |
|
15 | 15 | > EOF |
|
16 | 16 | #endif |
|
17 | 17 | |
|
18 | 18 | Basic amend |
|
19 | 19 | |
|
20 | 20 | $ hg init repo1 |
|
21 | 21 | $ cd repo1 |
|
22 | 22 | $ hg debugdrawdag <<'EOS' |
|
23 | 23 | > B |
|
24 | 24 | > | |
|
25 | 25 | > A |
|
26 | 26 | > EOS |
|
27 | 27 | |
|
28 | 28 | $ hg update B -q |
|
29 | 29 | $ echo 2 >> B |
|
30 | 30 | |
|
31 | 31 | $ hg amend |
|
32 | 32 | saved backup bundle to $TESTTMP/repo1/.hg/strip-backup/112478962961-7e959a55-amend.hg (glob) (obsstore-off !) |
|
33 | 33 | #if obsstore-off |
|
34 | 34 | $ hg log -p -G --hidden -T '{rev} {node|short} {desc}\n' |
|
35 | 35 | @ 1 be169c7e8dbe B |
|
36 | 36 | | diff --git a/B b/B |
|
37 | 37 | | new file mode 100644 |
|
38 | 38 | | --- /dev/null |
|
39 | 39 | | +++ b/B |
|
40 | 40 | | @@ -0,0 +1,1 @@ |
|
41 | 41 | | +B2 |
|
42 | 42 | | |
|
43 | 43 | o 0 426bada5c675 A |
|
44 | 44 | diff --git a/A b/A |
|
45 | 45 | new file mode 100644 |
|
46 | 46 | --- /dev/null |
|
47 | 47 | +++ b/A |
|
48 | 48 | @@ -0,0 +1,1 @@ |
|
49 | 49 | +A |
|
50 | 50 | \ No newline at end of file |
|
51 | 51 | |
|
52 | 52 | #else |
|
53 | 53 | $ hg log -p -G --hidden -T '{rev} {node|short} {desc}\n' |
|
54 | 54 | @ 2 be169c7e8dbe B |
|
55 | 55 | | diff --git a/B b/B |
|
56 | 56 | | new file mode 100644 |
|
57 | 57 | | --- /dev/null |
|
58 | 58 | | +++ b/B |
|
59 | 59 | | @@ -0,0 +1,1 @@ |
|
60 | 60 | | +B2 |
|
61 | 61 | | |
|
62 | 62 | | x 1 112478962961 B |
|
63 | 63 | |/ diff --git a/B b/B |
|
64 | 64 | | new file mode 100644 |
|
65 | 65 | | --- /dev/null |
|
66 | 66 | | +++ b/B |
|
67 | 67 | | @@ -0,0 +1,1 @@ |
|
68 | 68 | | +B |
|
69 | 69 | | \ No newline at end of file |
|
70 | 70 | | |
|
71 | 71 | o 0 426bada5c675 A |
|
72 | 72 | diff --git a/A b/A |
|
73 | 73 | new file mode 100644 |
|
74 | 74 | --- /dev/null |
|
75 | 75 | +++ b/A |
|
76 | 76 | @@ -0,0 +1,1 @@ |
|
77 | 77 | +A |
|
78 | 78 | \ No newline at end of file |
|
79 | 79 | |
|
80 | 80 | #endif |
|
81 | 81 | |
|
82 | 82 | Nothing changed |
|
83 | 83 | |
|
84 | 84 | $ hg amend |
|
85 | 85 | nothing changed |
|
86 | 86 | [1] |
|
87 | 87 | |
|
88 | 88 | $ hg amend -d "0 0" |
|
89 | 89 | nothing changed |
|
90 | 90 | [1] |
|
91 | 91 | |
|
92 | 92 | $ hg amend -d "Thu Jan 01 00:00:00 1970 UTC" |
|
93 | 93 | nothing changed |
|
94 | 94 | [1] |
|
95 | 95 | |
|
96 | 96 | Matcher and metadata options |
|
97 | 97 | |
|
98 | 98 | $ echo 3 > C |
|
99 | 99 | $ echo 4 > D |
|
100 | 100 | $ hg add C D |
|
101 | 101 | $ hg amend -m NEWMESSAGE -I C |
|
102 | 102 | saved backup bundle to $TESTTMP/repo1/.hg/strip-backup/be169c7e8dbe-7684ddc5-amend.hg (glob) (obsstore-off !) |
|
103 | 103 | $ hg log -r . -T '{node|short} {desc} {files}\n' |
|
104 | 104 | c7ba14d9075b NEWMESSAGE B C |
|
105 | 105 | $ echo 5 > E |
|
106 | 106 | $ rm C |
|
107 | 107 | $ hg amend -d '2000 1000' -u 'Foo <foo@example.com>' -A C D |
|
108 | 108 | saved backup bundle to $TESTTMP/repo1/.hg/strip-backup/c7ba14d9075b-b3e76daa-amend.hg (glob) (obsstore-off !) |
|
109 | 109 | $ hg log -r . -T '{node|short} {desc} {files} {author} {date}\n' |
|
110 | 110 | 14f6c4bcc865 NEWMESSAGE B D Foo <foo@example.com> 2000.01000 |
|
111 | 111 | |
|
112 | 112 | Amend with editor |
|
113 | 113 | |
|
114 | 114 | $ cat > $TESTTMP/prefix.sh <<'EOF' |
|
115 | 115 | > printf 'EDITED: ' > $TESTTMP/msg |
|
116 | 116 | > cat "$1" >> $TESTTMP/msg |
|
117 | 117 | > mv $TESTTMP/msg "$1" |
|
118 | 118 | > EOF |
|
119 | 119 | $ chmod +x $TESTTMP/prefix.sh |
|
120 | 120 | |
|
121 | 121 | $ HGEDITOR="sh $TESTTMP/prefix.sh" hg amend --edit |
|
122 | 122 | saved backup bundle to $TESTTMP/repo1/.hg/strip-backup/14f6c4bcc865-6591f15d-amend.hg (glob) (obsstore-off !) |
|
123 | 123 | $ hg log -r . -T '{node|short} {desc}\n' |
|
124 | 124 | 298f085230c3 EDITED: NEWMESSAGE |
|
125 | 125 | $ HGEDITOR="sh $TESTTMP/prefix.sh" hg amend -e -m MSG |
|
126 | 126 | saved backup bundle to $TESTTMP/repo1/.hg/strip-backup/298f085230c3-d81a6ad3-amend.hg (glob) (obsstore-off !) |
|
127 | 127 | $ hg log -r . -T '{node|short} {desc}\n' |
|
128 | 128 | 974f07f28537 EDITED: MSG |
|
129 | 129 | |
|
130 | 130 | $ echo FOO > $TESTTMP/msg |
|
131 | 131 | $ hg amend -l $TESTTMP/msg -m BAR |
|
132 | 132 | abort: options --message and --logfile are mutually exclusive |
|
133 | 133 | [255] |
|
134 | 134 | $ hg amend -l $TESTTMP/msg |
|
135 | 135 | saved backup bundle to $TESTTMP/repo1/.hg/strip-backup/974f07f28537-edb6470a-amend.hg (glob) (obsstore-off !) |
|
136 | 136 | $ hg log -r . -T '{node|short} {desc}\n' |
|
137 | 137 | 507be9bdac71 FOO |
|
138 | 138 | |
|
139 | 139 | Interactive mode |
|
140 | 140 | |
|
141 | 141 | $ touch F G |
|
142 | 142 | $ hg add F G |
|
143 | 143 | $ cat <<EOS | hg amend -i --config ui.interactive=1 |
|
144 | 144 | > y |
|
145 | 145 | > n |
|
146 | 146 | > EOS |
|
147 | 147 | diff --git a/F b/F |
|
148 | 148 | new file mode 100644 |
|
149 | 149 | examine changes to 'F'? [Ynesfdaq?] y |
|
150 | 150 | |
|
151 | 151 | diff --git a/G b/G |
|
152 | 152 | new file mode 100644 |
|
153 | 153 | examine changes to 'G'? [Ynesfdaq?] n |
|
154 | 154 | |
|
155 | 155 | saved backup bundle to $TESTTMP/repo1/.hg/strip-backup/507be9bdac71-c8077452-amend.hg (glob) (obsstore-off !) |
|
156 | 156 | $ hg log -r . -T '{files}\n' |
|
157 | 157 | B D F |
|
158 | 158 | |
|
159 | 159 | Amend in the middle of a stack |
|
160 | 160 | |
|
161 | 161 | $ hg init $TESTTMP/repo2 |
|
162 | 162 | $ cd $TESTTMP/repo2 |
|
163 | 163 | $ hg debugdrawdag <<'EOS' |
|
164 | 164 | > C |
|
165 | 165 | > | |
|
166 | 166 | > B |
|
167 | 167 | > | |
|
168 | 168 | > A |
|
169 | 169 | > EOS |
|
170 | 170 | |
|
171 | 171 | $ hg update -q B |
|
172 | 172 | $ echo 2 >> B |
|
173 | 173 | $ hg amend |
|
174 | 174 | abort: cannot amend changeset with children |
|
175 | 175 | [255] |
|
176 | 176 | |
|
177 | 177 | #if obsstore-on |
|
178 | 178 | |
|
179 | 179 | With allowunstable, amend could work in the middle of a stack |
|
180 | 180 | |
|
181 | 181 | $ cat >> $HGRCPATH <<EOF |
|
182 | 182 | > [experimental] |
|
183 | 183 | > evolution.createmarkers=True |
|
184 | 184 | > evolution.allowunstable=True |
|
185 | 185 | > EOF |
|
186 | 186 | |
|
187 | 187 | $ hg amend |
|
188 | 188 | $ hg log -T '{rev} {node|short} {desc}\n' -G |
|
189 | 189 | @ 3 be169c7e8dbe B |
|
190 | 190 | | |
|
191 | 191 | | o 2 26805aba1e60 C |
|
192 | 192 | | | |
|
193 | 193 | | x 1 112478962961 B |
|
194 | 194 | |/ |
|
195 | 195 | o 0 426bada5c675 A |
|
196 | 196 | |
|
197 | 197 | Checking the note stored in the obsmarker |
|
198 | 198 | |
|
199 | 199 | $ echo foo > bar |
|
200 | 200 | $ hg add bar |
|
201 | 201 | $ hg amend --note 'yyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyy' |
|
202 | 202 | abort: cannot store a note of more than 255 bytes |
|
203 | 203 | [255] |
|
204 | 204 | $ hg amend --note "adding bar" |
|
205 | 205 | $ hg debugobsolete -r . |
|
206 | 206 | 112478962961147124edd43549aedd1a335e44bf be169c7e8dbe21cd10b3d79691cbe7f241e3c21c 0 (Thu Jan 01 00:00:00 1970 +0000) {'operation': 'amend', 'user': 'test'} |
|
207 | 207 | be169c7e8dbe21cd10b3d79691cbe7f241e3c21c 16084da537dd8f84cfdb3055c633772269d62e1b 0 (Thu Jan 01 00:00:00 1970 +0000) {'note': 'adding bar', 'operation': 'amend', 'user': 'test'} |
|
208 | 208 | #endif |
|
209 | 209 | |
|
210 | 210 | Cannot amend public changeset |
|
211 | 211 | |
|
212 | 212 | $ hg phase -r A --public |
|
213 | 213 | $ hg update -C -q A |
|
214 | 214 | $ hg amend -m AMEND |
|
215 | 215 | abort: cannot amend public changesets |
|
216 | 216 | [255] |
|
217 | 217 | |
|
218 | 218 | Amend a merge changeset |
|
219 | 219 | |
|
220 | 220 | $ hg init $TESTTMP/repo3 |
|
221 | 221 | $ cd $TESTTMP/repo3 |
|
222 | 222 | $ hg debugdrawdag <<'EOS' |
|
223 | 223 | > C |
|
224 | 224 | > /| |
|
225 | 225 | > A B |
|
226 | 226 | > EOS |
|
227 | 227 | $ hg update -q C |
|
228 | 228 | $ hg amend -m FOO |
|
229 | 229 | saved backup bundle to $TESTTMP/repo3/.hg/strip-backup/a35c07e8a2a4-15ff4612-amend.hg (glob) (obsstore-off !) |
|
230 | 230 | $ rm .hg/localtags |
|
231 | 231 | $ hg log -G -T '{desc}\n' |
|
232 | 232 | @ FOO |
|
233 | 233 | |\ |
|
234 | 234 | | o B |
|
235 | 235 | | |
|
236 | 236 | o A |
|
237 | 237 | |
|
238 | ||
|
239 | More complete test for status changes (issue5732) | |
|
240 | ------------------------------------------------- | |
|
241 | ||
|
242 | Generates history of files having 3 states, r0_r1_wc: | |
|
243 | ||
|
244 | r0: ground (content/missing) | |
|
245 | r1: old state to be amended (content/missing, where missing means removed) | |
|
246 | wc: changes to be included in r1 (content/missing-tracked/untracked) | |
|
247 | ||
|
248 | $ hg init $TESTTMP/wcstates | |
|
249 | $ cd $TESTTMP/wcstates | |
|
250 | ||
|
251 | $ $PYTHON $TESTDIR/generate-working-copy-states.py state 2 1 | |
|
252 | $ hg addremove -q --similarity 0 | |
|
253 | $ hg commit -m0 | |
|
254 | ||
|
255 | $ $PYTHON $TESTDIR/generate-working-copy-states.py state 2 2 | |
|
256 | $ hg addremove -q --similarity 0 | |
|
257 | $ hg commit -m1 | |
|
258 | ||
|
259 | $ $PYTHON $TESTDIR/generate-working-copy-states.py state 2 wc | |
|
260 | $ hg addremove -q --similarity 0 | |
|
261 | $ hg forget *_*_*-untracked | |
|
262 | $ rm *_*_missing-* | |
|
263 | ||
|
264 | amend r1 to include wc changes | |
|
265 | ||
|
266 | $ hg amend | |
|
267 | saved backup bundle to * (glob) (obsstore-off !) | |
|
268 | ||
|
269 | clean/modified/removed/added states of the amended revision | |
|
270 | ||
|
271 | BROKEN: untracked files aren't removed | |
|
272 | BROKEN: missing files are removed | |
|
273 | ||
|
274 | $ hg status --all --change . 'glob:content1_*_content1-tracked' | |
|
275 | C content1_content1_content1-tracked | |
|
276 | C content1_content2_content1-tracked | |
|
277 | C content1_missing_content1-tracked | |
|
278 | $ hg status --all --change . 'glob:content1_*_content[23]-tracked' | |
|
279 | M content1_content1_content3-tracked | |
|
280 | M content1_content2_content2-tracked | |
|
281 | M content1_content2_content3-tracked | |
|
282 | M content1_missing_content3-tracked | |
|
283 | $ hg status --all --change . 'glob:content1_*_missing-tracked' | |
|
284 | M content1_content2_missing-tracked | |
|
285 | R content1_missing_missing-tracked | |
|
286 | C content1_content1_missing-tracked | |
|
287 | $ hg status --all --change . 'glob:content1_*_*-untracked' | |
|
288 | M content1_content1_content3-untracked (true !) | |
|
289 | M content1_content2_content2-untracked (true !) | |
|
290 | M content1_content2_content3-untracked (true !) | |
|
291 | R content1_content1_content1-untracked (false !) | |
|
292 | R content1_content1_content3-untracked (false !) | |
|
293 | R content1_content1_missing-untracked | |
|
294 | R content1_content2_content1-untracked (false !) | |
|
295 | R content1_content2_content2-untracked (false !) | |
|
296 | R content1_content2_content3-untracked (false !) | |
|
297 | R content1_content2_missing-untracked | |
|
298 | R content1_missing_content1-untracked | |
|
299 | R content1_missing_content3-untracked | |
|
300 | R content1_missing_missing-untracked | |
|
301 | C content1_content1_content1-untracked (true !) | |
|
302 | C content1_content2_content1-untracked (true !) | |
|
303 | $ hg status --all --change . 'glob:missing_content2_*' | |
|
304 | A missing_content2_content2-tracked | |
|
305 | A missing_content2_content3-tracked | |
|
306 | A missing_content2_missing-tracked (false !) | |
|
307 | $ hg status --all --change . 'glob:missing_missing_*' | |
|
308 | A missing_missing_content3-tracked | |
|
309 | ||
|
310 | working directory should be all clean (with some missing/untracked files) | |
|
311 | ||
|
312 | $ hg status --all 'glob:*_content?-tracked' | |
|
313 | C content1_content1_content1-tracked | |
|
314 | C content1_content1_content3-tracked | |
|
315 | C content1_content2_content1-tracked | |
|
316 | C content1_content2_content2-tracked | |
|
317 | C content1_content2_content3-tracked | |
|
318 | C content1_missing_content1-tracked | |
|
319 | C content1_missing_content3-tracked | |
|
320 | C missing_content2_content2-tracked | |
|
321 | C missing_content2_content3-tracked | |
|
322 | C missing_missing_content3-tracked | |
|
323 | $ hg status --all 'glob:*_missing-tracked' | |
|
324 | ! content1_content1_missing-tracked | |
|
325 | ! content1_content2_missing-tracked | |
|
326 | ! content1_missing_missing-tracked | |
|
327 | ! missing_content2_missing-tracked | |
|
328 | ! missing_missing_missing-tracked | |
|
329 | $ hg status --all 'glob:*-untracked' | |
|
330 | ? content1_content1_content1-untracked | |
|
331 | ? content1_content1_content3-untracked | |
|
332 | ? content1_content2_content1-untracked | |
|
333 | ? content1_content2_content2-untracked | |
|
334 | ? content1_content2_content3-untracked | |
|
335 | ? content1_missing_content1-untracked | |
|
336 | ? content1_missing_content3-untracked | |
|
337 | ? missing_content2_content2-untracked | |
|
338 | ? missing_content2_content3-untracked | |
|
339 | ? missing_missing_content3-untracked |
General Comments 0
You need to be logged in to leave comments.
Login now