##// END OF EJS Templates
tests: clarify test setup test in test-uncommit.t...
Martin von Zweigbergk -
r42054:6a944bf4 default
parent child Browse files
Show More
@@ -1,515 +1,515 b''
1 Test uncommit - set up the config
1 Test uncommit - set up the config
2
2
3 $ cat >> $HGRCPATH <<EOF
3 $ cat >> $HGRCPATH <<EOF
4 > [experimental]
4 > [experimental]
5 > evolution.createmarkers=True
5 > evolution.createmarkers=True
6 > evolution.allowunstable=True
6 > evolution.allowunstable=True
7 > [extensions]
7 > [extensions]
8 > uncommit =
8 > uncommit =
9 > drawdag=$TESTDIR/drawdag.py
9 > drawdag=$TESTDIR/drawdag.py
10 > EOF
10 > EOF
11
11
12 Build up a repo
12 Build up a repo
13
13
14 $ hg init repo
14 $ hg init repo
15 $ cd repo
15 $ cd repo
16 $ hg bookmark foo
16 $ hg bookmark foo
17
17
18 Help for uncommit
18 Help for uncommit
19
19
20 $ hg help uncommit
20 $ hg help uncommit
21 hg uncommit [OPTION]... [FILE]...
21 hg uncommit [OPTION]... [FILE]...
22
22
23 uncommit part or all of a local changeset
23 uncommit part or all of a local changeset
24
24
25 This command undoes the effect of a local commit, returning the affected
25 This command undoes the effect of a local commit, returning the affected
26 files to their uncommitted state. This means that files modified or
26 files to their uncommitted state. This means that files modified or
27 deleted in the changeset will be left unchanged, and so will remain
27 deleted in the changeset will be left unchanged, and so will remain
28 modified in the working directory.
28 modified in the working directory.
29
29
30 If no files are specified, the commit will be pruned, unless --keep is
30 If no files are specified, the commit will be pruned, unless --keep is
31 given.
31 given.
32
32
33 (use 'hg help -e uncommit' to show help for the uncommit extension)
33 (use 'hg help -e uncommit' to show help for the uncommit extension)
34
34
35 options ([+] can be repeated):
35 options ([+] can be repeated):
36
36
37 --keep allow an empty commit after uncommiting
37 --keep allow an empty commit after uncommiting
38 --allow-dirty-working-copy allow uncommit with outstanding changes
38 --allow-dirty-working-copy allow uncommit with outstanding changes
39 -I --include PATTERN [+] include names matching the given patterns
39 -I --include PATTERN [+] include names matching the given patterns
40 -X --exclude PATTERN [+] exclude names matching the given patterns
40 -X --exclude PATTERN [+] exclude names matching the given patterns
41
41
42 (some details hidden, use --verbose to show complete help)
42 (some details hidden, use --verbose to show complete help)
43
43
44 Uncommit with no commits should fail
44 Uncommit with no commits should fail
45
45
46 $ hg uncommit
46 $ hg uncommit
47 abort: cannot uncommit null changeset
47 abort: cannot uncommit null changeset
48 (no changeset checked out)
48 (no changeset checked out)
49 [255]
49 [255]
50
50
51 Create some commits
51 Create some commits
52
52
53 $ touch files
53 $ touch files
54 $ hg add files
54 $ hg add files
55 $ for i in a ab abc abcd abcde; do echo $i > files; echo $i > file-$i; hg add file-$i; hg commit -m "added file-$i"; done
55 $ for i in a ab abc abcd abcde; do echo $i > files; echo $i > file-$i; hg add file-$i; hg commit -m "added file-$i"; done
56 $ ls
56 $ ls
57 file-a
57 file-a
58 file-ab
58 file-ab
59 file-abc
59 file-abc
60 file-abcd
60 file-abcd
61 file-abcde
61 file-abcde
62 files
62 files
63
63
64 $ hg log -G -T '{rev}:{node} {desc}' --hidden
64 $ hg log -G -T '{rev}:{node} {desc}' --hidden
65 @ 4:6c4fd43ed714e7fcd8adbaa7b16c953c2e985b60 added file-abcde
65 @ 4:6c4fd43ed714e7fcd8adbaa7b16c953c2e985b60 added file-abcde
66 |
66 |
67 o 3:6db330d65db434145c0b59d291853e9a84719b24 added file-abcd
67 o 3:6db330d65db434145c0b59d291853e9a84719b24 added file-abcd
68 |
68 |
69 o 2:abf2df566fc193b3ac34d946e63c1583e4d4732b added file-abc
69 o 2:abf2df566fc193b3ac34d946e63c1583e4d4732b added file-abc
70 |
70 |
71 o 1:69a232e754b08d568c4899475faf2eb44b857802 added file-ab
71 o 1:69a232e754b08d568c4899475faf2eb44b857802 added file-ab
72 |
72 |
73 o 0:3004d2d9b50883c1538fc754a3aeb55f1b4084f6 added file-a
73 o 0:3004d2d9b50883c1538fc754a3aeb55f1b4084f6 added file-a
74
74
75 Simple uncommit off the top, also moves bookmark
75 Simple uncommit off the top, also moves bookmark
76
76
77 $ hg bookmark
77 $ hg bookmark
78 * foo 4:6c4fd43ed714
78 * foo 4:6c4fd43ed714
79 $ hg uncommit
79 $ hg uncommit
80 $ hg status
80 $ hg status
81 M files
81 M files
82 A file-abcde
82 A file-abcde
83 $ hg bookmark
83 $ hg bookmark
84 * foo 3:6db330d65db4
84 * foo 3:6db330d65db4
85
85
86 $ hg log -G -T '{rev}:{node} {desc}' --hidden
86 $ hg log -G -T '{rev}:{node} {desc}' --hidden
87 x 4:6c4fd43ed714e7fcd8adbaa7b16c953c2e985b60 added file-abcde
87 x 4:6c4fd43ed714e7fcd8adbaa7b16c953c2e985b60 added file-abcde
88 |
88 |
89 @ 3:6db330d65db434145c0b59d291853e9a84719b24 added file-abcd
89 @ 3:6db330d65db434145c0b59d291853e9a84719b24 added file-abcd
90 |
90 |
91 o 2:abf2df566fc193b3ac34d946e63c1583e4d4732b added file-abc
91 o 2:abf2df566fc193b3ac34d946e63c1583e4d4732b added file-abc
92 |
92 |
93 o 1:69a232e754b08d568c4899475faf2eb44b857802 added file-ab
93 o 1:69a232e754b08d568c4899475faf2eb44b857802 added file-ab
94 |
94 |
95 o 0:3004d2d9b50883c1538fc754a3aeb55f1b4084f6 added file-a
95 o 0:3004d2d9b50883c1538fc754a3aeb55f1b4084f6 added file-a
96
96
97
97
98 Recommit
98 Recommit
99
99
100 $ hg commit -m 'new change abcde'
100 $ hg commit -m 'new change abcde'
101 $ hg status
101 $ hg status
102 $ hg heads -T '{rev}:{node} {desc}'
102 $ hg heads -T '{rev}:{node} {desc}'
103 5:0c07a3ccda771b25f1cb1edbd02e683723344ef1 new change abcde (no-eol)
103 5:0c07a3ccda771b25f1cb1edbd02e683723344ef1 new change abcde (no-eol)
104
104
105 Uncommit of non-existent and unchanged files has no effect
105 Uncommit of non-existent and unchanged files has no effect
106 $ hg uncommit nothinghere
106 $ hg uncommit nothinghere
107 nothing to uncommit
107 nothing to uncommit
108 [1]
108 [1]
109 $ hg status
109 $ hg status
110 $ hg uncommit file-abc
110 $ hg uncommit file-abc
111 nothing to uncommit
111 nothing to uncommit
112 [1]
112 [1]
113 $ hg status
113 $ hg status
114
114
115 Try partial uncommit, also moves bookmark
115 Try partial uncommit, also moves bookmark
116
116
117 $ hg bookmark
117 $ hg bookmark
118 * foo 5:0c07a3ccda77
118 * foo 5:0c07a3ccda77
119 $ hg uncommit files
119 $ hg uncommit files
120 $ hg status
120 $ hg status
121 M files
121 M files
122 $ hg bookmark
122 $ hg bookmark
123 * foo 6:3727deee06f7
123 * foo 6:3727deee06f7
124 $ hg heads -T '{rev}:{node} {desc}'
124 $ hg heads -T '{rev}:{node} {desc}'
125 6:3727deee06f72f5ffa8db792ee299cf39e3e190b new change abcde (no-eol)
125 6:3727deee06f72f5ffa8db792ee299cf39e3e190b new change abcde (no-eol)
126 $ hg log -r . -p -T '{rev}:{node} {desc}'
126 $ hg log -r . -p -T '{rev}:{node} {desc}'
127 6:3727deee06f72f5ffa8db792ee299cf39e3e190b new change abcdediff -r 6db330d65db4 -r 3727deee06f7 file-abcde
127 6:3727deee06f72f5ffa8db792ee299cf39e3e190b new change abcdediff -r 6db330d65db4 -r 3727deee06f7 file-abcde
128 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
128 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
129 +++ b/file-abcde Thu Jan 01 00:00:00 1970 +0000
129 +++ b/file-abcde Thu Jan 01 00:00:00 1970 +0000
130 @@ -0,0 +1,1 @@
130 @@ -0,0 +1,1 @@
131 +abcde
131 +abcde
132
132
133 $ hg log -G -T '{rev}:{node} {desc}' --hidden
133 $ hg log -G -T '{rev}:{node} {desc}' --hidden
134 @ 6:3727deee06f72f5ffa8db792ee299cf39e3e190b new change abcde
134 @ 6:3727deee06f72f5ffa8db792ee299cf39e3e190b new change abcde
135 |
135 |
136 | x 5:0c07a3ccda771b25f1cb1edbd02e683723344ef1 new change abcde
136 | x 5:0c07a3ccda771b25f1cb1edbd02e683723344ef1 new change abcde
137 |/
137 |/
138 | x 4:6c4fd43ed714e7fcd8adbaa7b16c953c2e985b60 added file-abcde
138 | x 4:6c4fd43ed714e7fcd8adbaa7b16c953c2e985b60 added file-abcde
139 |/
139 |/
140 o 3:6db330d65db434145c0b59d291853e9a84719b24 added file-abcd
140 o 3:6db330d65db434145c0b59d291853e9a84719b24 added file-abcd
141 |
141 |
142 o 2:abf2df566fc193b3ac34d946e63c1583e4d4732b added file-abc
142 o 2:abf2df566fc193b3ac34d946e63c1583e4d4732b added file-abc
143 |
143 |
144 o 1:69a232e754b08d568c4899475faf2eb44b857802 added file-ab
144 o 1:69a232e754b08d568c4899475faf2eb44b857802 added file-ab
145 |
145 |
146 o 0:3004d2d9b50883c1538fc754a3aeb55f1b4084f6 added file-a
146 o 0:3004d2d9b50883c1538fc754a3aeb55f1b4084f6 added file-a
147
147
148 $ hg commit -m 'update files for abcde'
148 $ hg commit -m 'update files for abcde'
149
149
150 Uncommit with dirty state
150 Uncommit with dirty state
151
151
152 $ echo "foo" >> files
152 $ echo "foo" >> files
153 $ cat files
153 $ cat files
154 abcde
154 abcde
155 foo
155 foo
156 $ hg status
156 $ hg status
157 M files
157 M files
158 $ hg uncommit
158 $ hg uncommit
159 abort: uncommitted changes
159 abort: uncommitted changes
160 (requires --allow-dirty-working-copy to uncommit)
160 (requires --allow-dirty-working-copy to uncommit)
161 [255]
161 [255]
162 $ hg uncommit files
162 $ hg uncommit files
163 abort: uncommitted changes
163 abort: uncommitted changes
164 (requires --allow-dirty-working-copy to uncommit)
164 (requires --allow-dirty-working-copy to uncommit)
165 [255]
165 [255]
166 $ cat files
166 $ cat files
167 abcde
167 abcde
168 foo
168 foo
169 $ hg commit --amend -m "files abcde + foo"
169 $ hg commit --amend -m "files abcde + foo"
170
170
171 Testing the 'experimental.uncommitondirtywdir' config
171 Testing the 'experimental.uncommitondirtywdir' config
172
172
173 $ echo "bar" >> files
173 $ echo "bar" >> files
174 $ hg uncommit
174 $ hg uncommit
175 abort: uncommitted changes
175 abort: uncommitted changes
176 (requires --allow-dirty-working-copy to uncommit)
176 (requires --allow-dirty-working-copy to uncommit)
177 [255]
177 [255]
178 $ hg uncommit --config experimental.uncommitondirtywdir=True
178 $ hg uncommit --config experimental.uncommitondirtywdir=True
179 $ hg commit -m "files abcde + foo"
179 $ hg commit -m "files abcde + foo"
180
180
181 Uncommit in the middle of a stack, does not move bookmark
181 Uncommit in the middle of a stack, does not move bookmark
182
182
183 $ hg checkout '.^^^'
183 $ hg checkout '.^^^'
184 1 files updated, 0 files merged, 2 files removed, 0 files unresolved
184 1 files updated, 0 files merged, 2 files removed, 0 files unresolved
185 (leaving bookmark foo)
185 (leaving bookmark foo)
186 $ hg log -r . -p -T '{rev}:{node} {desc}'
186 $ hg log -r . -p -T '{rev}:{node} {desc}'
187 2:abf2df566fc193b3ac34d946e63c1583e4d4732b added file-abcdiff -r 69a232e754b0 -r abf2df566fc1 file-abc
187 2:abf2df566fc193b3ac34d946e63c1583e4d4732b added file-abcdiff -r 69a232e754b0 -r abf2df566fc1 file-abc
188 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
188 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
189 +++ b/file-abc Thu Jan 01 00:00:00 1970 +0000
189 +++ b/file-abc Thu Jan 01 00:00:00 1970 +0000
190 @@ -0,0 +1,1 @@
190 @@ -0,0 +1,1 @@
191 +abc
191 +abc
192 diff -r 69a232e754b0 -r abf2df566fc1 files
192 diff -r 69a232e754b0 -r abf2df566fc1 files
193 --- a/files Thu Jan 01 00:00:00 1970 +0000
193 --- a/files Thu Jan 01 00:00:00 1970 +0000
194 +++ b/files Thu Jan 01 00:00:00 1970 +0000
194 +++ b/files Thu Jan 01 00:00:00 1970 +0000
195 @@ -1,1 +1,1 @@
195 @@ -1,1 +1,1 @@
196 -ab
196 -ab
197 +abc
197 +abc
198
198
199 $ hg bookmark
199 $ hg bookmark
200 foo 9:48e5bd7cd583
200 foo 9:48e5bd7cd583
201 $ hg uncommit
201 $ hg uncommit
202 3 new orphan changesets
202 3 new orphan changesets
203 $ hg status
203 $ hg status
204 M files
204 M files
205 A file-abc
205 A file-abc
206 $ hg heads -T '{rev}:{node} {desc}'
206 $ hg heads -T '{rev}:{node} {desc}'
207 9:48e5bd7cd583eb24164ef8b89185819c84c96ed7 files abcde + foo (no-eol)
207 9:48e5bd7cd583eb24164ef8b89185819c84c96ed7 files abcde + foo (no-eol)
208 $ hg bookmark
208 $ hg bookmark
209 foo 9:48e5bd7cd583
209 foo 9:48e5bd7cd583
210 $ hg commit -m 'new abc'
210 $ hg commit -m 'new abc'
211 created new head
211 created new head
212
212
213 Partial uncommit in the middle, does not move bookmark
213 Partial uncommit in the middle, does not move bookmark
214
214
215 $ hg checkout '.^'
215 $ hg checkout '.^'
216 1 files updated, 0 files merged, 1 files removed, 0 files unresolved
216 1 files updated, 0 files merged, 1 files removed, 0 files unresolved
217 $ hg log -r . -p -T '{rev}:{node} {desc}'
217 $ hg log -r . -p -T '{rev}:{node} {desc}'
218 1:69a232e754b08d568c4899475faf2eb44b857802 added file-abdiff -r 3004d2d9b508 -r 69a232e754b0 file-ab
218 1:69a232e754b08d568c4899475faf2eb44b857802 added file-abdiff -r 3004d2d9b508 -r 69a232e754b0 file-ab
219 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
219 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
220 +++ b/file-ab Thu Jan 01 00:00:00 1970 +0000
220 +++ b/file-ab Thu Jan 01 00:00:00 1970 +0000
221 @@ -0,0 +1,1 @@
221 @@ -0,0 +1,1 @@
222 +ab
222 +ab
223 diff -r 3004d2d9b508 -r 69a232e754b0 files
223 diff -r 3004d2d9b508 -r 69a232e754b0 files
224 --- a/files Thu Jan 01 00:00:00 1970 +0000
224 --- a/files Thu Jan 01 00:00:00 1970 +0000
225 +++ b/files Thu Jan 01 00:00:00 1970 +0000
225 +++ b/files Thu Jan 01 00:00:00 1970 +0000
226 @@ -1,1 +1,1 @@
226 @@ -1,1 +1,1 @@
227 -a
227 -a
228 +ab
228 +ab
229
229
230 $ hg bookmark
230 $ hg bookmark
231 foo 9:48e5bd7cd583
231 foo 9:48e5bd7cd583
232 $ hg uncommit file-ab
232 $ hg uncommit file-ab
233 1 new orphan changesets
233 1 new orphan changesets
234 $ hg status
234 $ hg status
235 A file-ab
235 A file-ab
236
236
237 $ hg heads -T '{rev}:{node} {desc}\n'
237 $ hg heads -T '{rev}:{node} {desc}\n'
238 11:8eb87968f2edb7f27f27fe676316e179de65fff6 added file-ab
238 11:8eb87968f2edb7f27f27fe676316e179de65fff6 added file-ab
239 10:5dc89ca4486f8a88716c5797fa9f498d13d7c2e1 new abc
239 10:5dc89ca4486f8a88716c5797fa9f498d13d7c2e1 new abc
240 9:48e5bd7cd583eb24164ef8b89185819c84c96ed7 files abcde + foo
240 9:48e5bd7cd583eb24164ef8b89185819c84c96ed7 files abcde + foo
241
241
242 $ hg bookmark
242 $ hg bookmark
243 foo 9:48e5bd7cd583
243 foo 9:48e5bd7cd583
244 $ hg commit -m 'update ab'
244 $ hg commit -m 'update ab'
245 $ hg status
245 $ hg status
246 $ hg heads -T '{rev}:{node} {desc}\n'
246 $ hg heads -T '{rev}:{node} {desc}\n'
247 12:f21039c59242b085491bb58f591afc4ed1c04c09 update ab
247 12:f21039c59242b085491bb58f591afc4ed1c04c09 update ab
248 10:5dc89ca4486f8a88716c5797fa9f498d13d7c2e1 new abc
248 10:5dc89ca4486f8a88716c5797fa9f498d13d7c2e1 new abc
249 9:48e5bd7cd583eb24164ef8b89185819c84c96ed7 files abcde + foo
249 9:48e5bd7cd583eb24164ef8b89185819c84c96ed7 files abcde + foo
250
250
251 $ hg log -G -T '{rev}:{node} {desc}' --hidden
251 $ hg log -G -T '{rev}:{node} {desc}' --hidden
252 @ 12:f21039c59242b085491bb58f591afc4ed1c04c09 update ab
252 @ 12:f21039c59242b085491bb58f591afc4ed1c04c09 update ab
253 |
253 |
254 o 11:8eb87968f2edb7f27f27fe676316e179de65fff6 added file-ab
254 o 11:8eb87968f2edb7f27f27fe676316e179de65fff6 added file-ab
255 |
255 |
256 | * 10:5dc89ca4486f8a88716c5797fa9f498d13d7c2e1 new abc
256 | * 10:5dc89ca4486f8a88716c5797fa9f498d13d7c2e1 new abc
257 | |
257 | |
258 | | * 9:48e5bd7cd583eb24164ef8b89185819c84c96ed7 files abcde + foo
258 | | * 9:48e5bd7cd583eb24164ef8b89185819c84c96ed7 files abcde + foo
259 | | |
259 | | |
260 | | | x 8:84beeba0ac30e19521c036e4d2dd3a5fa02586ff files abcde + foo
260 | | | x 8:84beeba0ac30e19521c036e4d2dd3a5fa02586ff files abcde + foo
261 | | |/
261 | | |/
262 | | | x 7:0977fa602c2fd7d8427ed4e7ee15ea13b84c9173 update files for abcde
262 | | | x 7:0977fa602c2fd7d8427ed4e7ee15ea13b84c9173 update files for abcde
263 | | |/
263 | | |/
264 | | * 6:3727deee06f72f5ffa8db792ee299cf39e3e190b new change abcde
264 | | * 6:3727deee06f72f5ffa8db792ee299cf39e3e190b new change abcde
265 | | |
265 | | |
266 | | | x 5:0c07a3ccda771b25f1cb1edbd02e683723344ef1 new change abcde
266 | | | x 5:0c07a3ccda771b25f1cb1edbd02e683723344ef1 new change abcde
267 | | |/
267 | | |/
268 | | | x 4:6c4fd43ed714e7fcd8adbaa7b16c953c2e985b60 added file-abcde
268 | | | x 4:6c4fd43ed714e7fcd8adbaa7b16c953c2e985b60 added file-abcde
269 | | |/
269 | | |/
270 | | * 3:6db330d65db434145c0b59d291853e9a84719b24 added file-abcd
270 | | * 3:6db330d65db434145c0b59d291853e9a84719b24 added file-abcd
271 | | |
271 | | |
272 | | x 2:abf2df566fc193b3ac34d946e63c1583e4d4732b added file-abc
272 | | x 2:abf2df566fc193b3ac34d946e63c1583e4d4732b added file-abc
273 | |/
273 | |/
274 | x 1:69a232e754b08d568c4899475faf2eb44b857802 added file-ab
274 | x 1:69a232e754b08d568c4899475faf2eb44b857802 added file-ab
275 |/
275 |/
276 o 0:3004d2d9b50883c1538fc754a3aeb55f1b4084f6 added file-a
276 o 0:3004d2d9b50883c1538fc754a3aeb55f1b4084f6 added file-a
277
277
278 Uncommit with draft parent
278 Uncommit with draft parent
279
279
280 $ hg uncommit
280 $ hg uncommit
281 $ hg phase -r .
281 $ hg phase -r .
282 11: draft
282 11: draft
283 $ hg commit -m 'update ab again'
283 $ hg commit -m 'update ab again'
284
284
285 Phase is preserved
285 Phase is preserved
286
286
287 $ hg uncommit --keep --config phases.new-commit=secret
287 $ hg uncommit --keep --config phases.new-commit=secret
288 note: keeping empty commit
288 note: keeping empty commit
289 $ hg phase -r .
289 $ hg phase -r .
290 14: draft
290 14: draft
291 $ hg commit --amend -m 'update ab again'
291 $ hg commit --amend -m 'update ab again'
292
292
293 Uncommit with public parent
293 Uncommit with public parent
294
294
295 $ hg phase -p "::.^"
295 $ hg phase -p "::.^"
296 $ hg uncommit
296 $ hg uncommit
297 $ hg phase -r .
297 $ hg phase -r .
298 11: public
298 11: public
299
299
300 Partial uncommit with public parent
300 Partial uncommit with public parent
301
301
302 $ echo xyz > xyz
302 $ echo xyz > xyz
303 $ hg add xyz
303 $ hg add xyz
304 $ hg commit -m "update ab and add xyz"
304 $ hg commit -m "update ab and add xyz"
305 $ hg uncommit xyz
305 $ hg uncommit xyz
306 $ hg status
306 $ hg status
307 A xyz
307 A xyz
308 $ hg phase -r .
308 $ hg phase -r .
309 17: draft
309 17: draft
310 $ hg phase -r ".^"
310 $ hg phase -r ".^"
311 11: public
311 11: public
312
312
313 Uncommit with --keep or experimental.uncommit.keep leaves an empty changeset
313 Uncommit with --keep or experimental.uncommit.keep leaves an empty changeset
314
314
315 $ cd $TESTTMP
315 $ cd $TESTTMP
316 $ hg init repo1
316 $ hg init repo1
317 $ cd repo1
317 $ cd repo1
318 $ hg debugdrawdag <<'EOS'
318 $ hg debugdrawdag <<'EOS'
319 > Q
319 > Q
320 > |
320 > |
321 > P
321 > P
322 > EOS
322 > EOS
323 $ hg up Q -q
323 $ hg up Q -q
324 $ hg uncommit --keep
324 $ hg uncommit --keep
325 note: keeping empty commit
325 note: keeping empty commit
326 $ hg log -G -T '{desc} FILES: {files}'
326 $ hg log -G -T '{desc} FILES: {files}'
327 @ Q FILES:
327 @ Q FILES:
328 |
328 |
329 | x Q FILES: Q
329 | x Q FILES: Q
330 |/
330 |/
331 o P FILES: P
331 o P FILES: P
332
332
333 $ cat >> .hg/hgrc <<EOF
333 $ cat >> .hg/hgrc <<EOF
334 > [experimental]
334 > [experimental]
335 > uncommit.keep=True
335 > uncommit.keep=True
336 > EOF
336 > EOF
337 $ hg ci --amend
337 $ hg ci --amend
338 $ hg uncommit
338 $ hg uncommit
339 note: keeping empty commit
339 note: keeping empty commit
340 $ hg log -G -T '{desc} FILES: {files}'
340 $ hg log -G -T '{desc} FILES: {files}'
341 @ Q FILES:
341 @ Q FILES:
342 |
342 |
343 | x Q FILES: Q
343 | x Q FILES: Q
344 |/
344 |/
345 o P FILES: P
345 o P FILES: P
346
346
347 $ hg status
347 $ hg status
348 A Q
348 A Q
349 $ hg ci --amend
349 $ hg ci --amend
350 $ hg uncommit --no-keep
350 $ hg uncommit --no-keep
351 $ hg log -G -T '{desc} FILES: {files}'
351 $ hg log -G -T '{desc} FILES: {files}'
352 x Q FILES: Q
352 x Q FILES: Q
353 |
353 |
354 @ P FILES: P
354 @ P FILES: P
355
355
356 $ hg status
356 $ hg status
357 A Q
357 A Q
358 $ cd ..
358 $ cd ..
359 $ rm -rf repo1
359 $ rm -rf repo1
360
360
361 Testing uncommit while merge
361 Testing uncommit while merge
362
362
363 $ hg init repo2
363 $ hg init repo2
364 $ cd repo2
364 $ cd repo2
365
365
366 Create some history
366 Create some history
367
367
368 $ touch a
368 $ touch a
369 $ hg add a
369 $ hg add a
370 $ for i in 1 2 3; do echo $i > a; hg commit -m "a $i"; done
370 $ for i in 1 2 3; do echo $i > a; hg commit -m "a $i"; done
371 $ hg checkout 0
371 $ hg checkout 0
372 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
372 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
373 $ touch b
373 $ touch b
374 $ hg add b
374 $ hg add b
375 $ for i in 1 2 3; do echo $i > b; hg commit -m "b $i"; done
375 $ for i in 1 2 3; do echo $i > b; hg commit -m "b $i"; done
376 created new head
376 created new head
377 $ hg log -G -T '{rev}:{node} {desc}' --hidden
377 $ hg log -G -T '{rev}:{node} {desc}' --hidden
378 @ 5:2cd56cdde163ded2fbb16ba2f918c96046ab0bf2 b 3
378 @ 5:2cd56cdde163ded2fbb16ba2f918c96046ab0bf2 b 3
379 |
379 |
380 o 4:c3a0d5bb3b15834ffd2ef9ef603e93ec65cf2037 b 2
380 o 4:c3a0d5bb3b15834ffd2ef9ef603e93ec65cf2037 b 2
381 |
381 |
382 o 3:49bb009ca26078726b8870f1edb29fae8f7618f5 b 1
382 o 3:49bb009ca26078726b8870f1edb29fae8f7618f5 b 1
383 |
383 |
384 | o 2:990982b7384266e691f1bc08ca36177adcd1c8a9 a 3
384 | o 2:990982b7384266e691f1bc08ca36177adcd1c8a9 a 3
385 | |
385 | |
386 | o 1:24d38e3cf160c7b6f5ffe82179332229886a6d34 a 2
386 | o 1:24d38e3cf160c7b6f5ffe82179332229886a6d34 a 2
387 |/
387 |/
388 o 0:ea4e33293d4d274a2ba73150733c2612231f398c a 1
388 o 0:ea4e33293d4d274a2ba73150733c2612231f398c a 1
389
389
390
390
391 Add and expect uncommit to fail on both merge working dir and merge changeset
391 Add and expect uncommit to fail on both merge working dir and merge changeset
392
392
393 $ hg merge 2
393 $ hg merge 2
394 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
394 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
395 (branch merge, don't forget to commit)
395 (branch merge, don't forget to commit)
396
396
397 $ hg uncommit
397 $ hg uncommit
398 abort: outstanding uncommitted merge
398 abort: outstanding uncommitted merge
399 (requires --allow-dirty-working-copy to uncommit)
399 (requires --allow-dirty-working-copy to uncommit)
400 [255]
400 [255]
401
401
402 $ hg uncommit --config experimental.uncommitondirtywdir=True
402 $ hg uncommit --config experimental.uncommitondirtywdir=True
403 abort: cannot uncommit while merging
403 abort: cannot uncommit while merging
404 [255]
404 [255]
405
405
406 $ hg status
406 $ hg status
407 M a
407 M a
408 $ hg commit -m 'merge a and b'
408 $ hg commit -m 'merge a and b'
409
409
410 $ hg uncommit
410 $ hg uncommit
411 abort: cannot uncommit merge changeset
411 abort: cannot uncommit merge changeset
412 [255]
412 [255]
413
413
414 $ hg status
414 $ hg status
415 $ hg log -G -T '{rev}:{node} {desc}' --hidden
415 $ hg log -G -T '{rev}:{node} {desc}' --hidden
416 @ 6:c03b9c37bc67bf504d4912061cfb527b47a63c6e merge a and b
416 @ 6:c03b9c37bc67bf504d4912061cfb527b47a63c6e merge a and b
417 |\
417 |\
418 | o 5:2cd56cdde163ded2fbb16ba2f918c96046ab0bf2 b 3
418 | o 5:2cd56cdde163ded2fbb16ba2f918c96046ab0bf2 b 3
419 | |
419 | |
420 | o 4:c3a0d5bb3b15834ffd2ef9ef603e93ec65cf2037 b 2
420 | o 4:c3a0d5bb3b15834ffd2ef9ef603e93ec65cf2037 b 2
421 | |
421 | |
422 | o 3:49bb009ca26078726b8870f1edb29fae8f7618f5 b 1
422 | o 3:49bb009ca26078726b8870f1edb29fae8f7618f5 b 1
423 | |
423 | |
424 o | 2:990982b7384266e691f1bc08ca36177adcd1c8a9 a 3
424 o | 2:990982b7384266e691f1bc08ca36177adcd1c8a9 a 3
425 | |
425 | |
426 o | 1:24d38e3cf160c7b6f5ffe82179332229886a6d34 a 2
426 o | 1:24d38e3cf160c7b6f5ffe82179332229886a6d34 a 2
427 |/
427 |/
428 o 0:ea4e33293d4d274a2ba73150733c2612231f398c a 1
428 o 0:ea4e33293d4d274a2ba73150733c2612231f398c a 1
429
429
430
430
431 Rename a->b, then remove b in working copy. Result should remove a.
431 Rename a->b, then remove b in working copy. Result should remove a.
432
432
433 $ hg co -q 0
433 $ hg co -q 0
434 $ hg mv a b
434 $ hg mv a b
435 $ hg ci -qm 'move a to b'
435 $ hg ci -qm 'move a to b'
436 $ hg rm b
436 $ hg rm b
437 $ hg uncommit --config experimental.uncommitondirtywdir=True
437 $ hg uncommit --config experimental.uncommitondirtywdir=True
438 $ hg st --copies
438 $ hg st --copies
439 R a
439 R a
440 $ hg revert a
440 $ hg revert a
441
441
442 Rename a->b, then rename b->c in working copy. Result should rename a->c.
442 Rename a->b, then rename b->c in working copy. Result should rename a->c.
443
443
444 $ hg co -q 0
444 $ hg co -q 0
445 $ hg mv a b
445 $ hg mv a b
446 $ hg ci -qm 'move a to b'
446 $ hg ci -qm 'move a to b'
447 $ hg mv b c
447 $ hg mv b c
448 $ hg uncommit --config experimental.uncommitondirtywdir=True
448 $ hg uncommit --config experimental.uncommitondirtywdir=True
449 $ hg st --copies
449 $ hg st --copies
450 A c
450 A c
451 a
451 a
452 R a
452 R a
453 $ hg revert a
453 $ hg revert a
454 $ hg forget c
454 $ hg forget c
455 $ rm c
455 $ rm c
456
456
457 Copy a->b1 and a->b2, then rename b1->c in working copy. Result should copy a->b2 and a->c.
457 Copy a->b1 and a->b2, then rename b1->c in working copy. Result should copy a->b2 and a->c.
458
458
459 $ hg co -q 0
459 $ hg co -q 0
460 $ hg cp a b1
460 $ hg cp a b1
461 $ hg cp a b2
461 $ hg cp a b2
462 $ hg ci -qm 'move a to b1 and b2'
462 $ hg ci -qm 'move a to b1 and b2'
463 $ hg mv b1 c
463 $ hg mv b1 c
464 $ hg uncommit --config experimental.uncommitondirtywdir=True
464 $ hg uncommit --config experimental.uncommitondirtywdir=True
465 $ hg st --copies
465 $ hg st --copies
466 A b2
466 A b2
467 a
467 a
468 A c
468 A c
469 a
469 a
470 $ cd ..
470 $ cd ..
471
471
472 --allow-dirty-working-copy should also work on a dirty PATH
472 --allow-dirty-working-copy should also work on a dirty PATH
473
473
474 $ hg init issue5977
474 $ hg init issue5977
475 $ cd issue5977
475 $ cd issue5977
476 $ echo 'super critical info!' > a
476 $ echo 'super critical info!' > a
477 $ hg ci -Am 'add a'
477 $ hg ci -Am 'add a'
478 adding a
478 adding a
479 $ echo 'foo' > b
479 $ echo 'foo' > b
480 $ hg add b
480 $ hg add b
481 $ hg status
481 $ hg status
482 A b
482 A b
483 $ hg unc a
483 $ hg unc a
484 note: keeping empty commit
484 note: keeping empty commit
485 $ hg unc b
486 abort: uncommitted changes
487 (requires --allow-dirty-working-copy to uncommit)
488 [255]
489 $ cat a
485 $ cat a
490 super critical info!
486 super critical info!
491 $ hg log
487 $ hg log
492 changeset: 1:656ba143d384
488 changeset: 1:656ba143d384
493 tag: tip
489 tag: tip
494 parent: -1:000000000000
490 parent: -1:000000000000
495 user: test
491 user: test
496 date: Thu Jan 01 00:00:00 1970 +0000
492 date: Thu Jan 01 00:00:00 1970 +0000
497 summary: add a
493 summary: add a
498
494
499 $ hg ci -Am 'add b'
495 $ hg ci -Am 'add b'
500 $ echo 'foo bar' > b
496 $ echo 'foo bar' > b
497 $ hg unc b
498 abort: uncommitted changes
499 (requires --allow-dirty-working-copy to uncommit)
500 [255]
501 $ hg unc --allow-dirty-working-copy b
501 $ hg unc --allow-dirty-working-copy b
502 $ hg log
502 $ hg log
503 changeset: 3:30fa958635b2
503 changeset: 3:30fa958635b2
504 tag: tip
504 tag: tip
505 parent: 1:656ba143d384
505 parent: 1:656ba143d384
506 user: test
506 user: test
507 date: Thu Jan 01 00:00:00 1970 +0000
507 date: Thu Jan 01 00:00:00 1970 +0000
508 summary: add b
508 summary: add b
509
509
510 changeset: 1:656ba143d384
510 changeset: 1:656ba143d384
511 parent: -1:000000000000
511 parent: -1:000000000000
512 user: test
512 user: test
513 date: Thu Jan 01 00:00:00 1970 +0000
513 date: Thu Jan 01 00:00:00 1970 +0000
514 summary: add a
514 summary: add a
515
515
General Comments 0
You need to be logged in to leave comments. Login now