##// END OF EJS Templates
tests: use full `uncommit` command name in tests...
Martin von Zweigbergk -
r44694:5323cdb8 default
parent child Browse files
Show More
@@ -1,595 +1,595 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 uncommitting
37 --keep allow an empty commit after uncommitting
38 --allow-dirty-working-copy allow uncommit with outstanding changes
38 --allow-dirty-working-copy allow uncommit with outstanding changes
39 -n --note TEXT store a note on uncommit
39 -n --note TEXT store a note on uncommit
40 -I --include PATTERN [+] include names matching the given patterns
40 -I --include PATTERN [+] include names matching the given patterns
41 -X --exclude PATTERN [+] exclude names matching the given patterns
41 -X --exclude PATTERN [+] exclude names matching the given patterns
42 -m --message TEXT use text as commit message
42 -m --message TEXT use text as commit message
43 -l --logfile FILE read commit message from file
43 -l --logfile FILE read commit message from file
44 -d --date DATE record the specified date as commit date
44 -d --date DATE record the specified date as commit date
45 -u --user USER record the specified user as committer
45 -u --user USER record the specified user as committer
46 -D --currentdate record the current date as commit date
46 -D --currentdate record the current date as commit date
47 -U --currentuser record the current user as committer
47 -U --currentuser record the current user as committer
48
48
49 (some details hidden, use --verbose to show complete help)
49 (some details hidden, use --verbose to show complete help)
50
50
51 Uncommit with no commits should fail
51 Uncommit with no commits should fail
52
52
53 $ hg uncommit
53 $ hg uncommit
54 abort: cannot uncommit null changeset
54 abort: cannot uncommit null changeset
55 (no changeset checked out)
55 (no changeset checked out)
56 [255]
56 [255]
57
57
58 Create some commits
58 Create some commits
59
59
60 $ touch files
60 $ touch files
61 $ hg add files
61 $ hg add files
62 $ 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
62 $ 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
63 $ ls
63 $ ls
64 file-a
64 file-a
65 file-ab
65 file-ab
66 file-abc
66 file-abc
67 file-abcd
67 file-abcd
68 file-abcde
68 file-abcde
69 files
69 files
70
70
71 $ hg log -G -T '{rev}:{node} {desc}' --hidden
71 $ hg log -G -T '{rev}:{node} {desc}' --hidden
72 @ 4:6c4fd43ed714e7fcd8adbaa7b16c953c2e985b60 added file-abcde
72 @ 4:6c4fd43ed714e7fcd8adbaa7b16c953c2e985b60 added file-abcde
73 |
73 |
74 o 3:6db330d65db434145c0b59d291853e9a84719b24 added file-abcd
74 o 3:6db330d65db434145c0b59d291853e9a84719b24 added file-abcd
75 |
75 |
76 o 2:abf2df566fc193b3ac34d946e63c1583e4d4732b added file-abc
76 o 2:abf2df566fc193b3ac34d946e63c1583e4d4732b added file-abc
77 |
77 |
78 o 1:69a232e754b08d568c4899475faf2eb44b857802 added file-ab
78 o 1:69a232e754b08d568c4899475faf2eb44b857802 added file-ab
79 |
79 |
80 o 0:3004d2d9b50883c1538fc754a3aeb55f1b4084f6 added file-a
80 o 0:3004d2d9b50883c1538fc754a3aeb55f1b4084f6 added file-a
81
81
82 Simple uncommit off the top, also moves bookmark
82 Simple uncommit off the top, also moves bookmark
83
83
84 $ hg bookmark
84 $ hg bookmark
85 * foo 4:6c4fd43ed714
85 * foo 4:6c4fd43ed714
86 $ hg uncommit
86 $ hg uncommit
87 $ hg status
87 $ hg status
88 M files
88 M files
89 A file-abcde
89 A file-abcde
90 $ hg bookmark
90 $ hg bookmark
91 * foo 3:6db330d65db4
91 * foo 3:6db330d65db4
92
92
93 $ hg log -G -T '{rev}:{node} {desc}' --hidden
93 $ hg log -G -T '{rev}:{node} {desc}' --hidden
94 x 4:6c4fd43ed714e7fcd8adbaa7b16c953c2e985b60 added file-abcde
94 x 4:6c4fd43ed714e7fcd8adbaa7b16c953c2e985b60 added file-abcde
95 |
95 |
96 @ 3:6db330d65db434145c0b59d291853e9a84719b24 added file-abcd
96 @ 3:6db330d65db434145c0b59d291853e9a84719b24 added file-abcd
97 |
97 |
98 o 2:abf2df566fc193b3ac34d946e63c1583e4d4732b added file-abc
98 o 2:abf2df566fc193b3ac34d946e63c1583e4d4732b added file-abc
99 |
99 |
100 o 1:69a232e754b08d568c4899475faf2eb44b857802 added file-ab
100 o 1:69a232e754b08d568c4899475faf2eb44b857802 added file-ab
101 |
101 |
102 o 0:3004d2d9b50883c1538fc754a3aeb55f1b4084f6 added file-a
102 o 0:3004d2d9b50883c1538fc754a3aeb55f1b4084f6 added file-a
103
103
104
104
105 Recommit
105 Recommit
106
106
107 $ hg commit -m 'new change abcde'
107 $ hg commit -m 'new change abcde'
108 $ hg status
108 $ hg status
109 $ hg heads -T '{rev}:{node} {desc}'
109 $ hg heads -T '{rev}:{node} {desc}'
110 5:0c07a3ccda771b25f1cb1edbd02e683723344ef1 new change abcde (no-eol)
110 5:0c07a3ccda771b25f1cb1edbd02e683723344ef1 new change abcde (no-eol)
111
111
112 Uncommit of non-existent and unchanged files aborts
112 Uncommit of non-existent and unchanged files aborts
113 $ hg uncommit nothinghere
113 $ hg uncommit nothinghere
114 abort: cannot uncommit "nothinghere"
114 abort: cannot uncommit "nothinghere"
115 (file does not exist)
115 (file does not exist)
116 [255]
116 [255]
117 $ hg status
117 $ hg status
118 $ hg uncommit file-abc
118 $ hg uncommit file-abc
119 abort: cannot uncommit "file-abc"
119 abort: cannot uncommit "file-abc"
120 (file was not changed in working directory parent)
120 (file was not changed in working directory parent)
121 [255]
121 [255]
122 $ hg status
122 $ hg status
123
123
124 Try partial uncommit, also moves bookmark
124 Try partial uncommit, also moves bookmark
125
125
126 $ hg bookmark
126 $ hg bookmark
127 * foo 5:0c07a3ccda77
127 * foo 5:0c07a3ccda77
128 $ hg uncommit files
128 $ hg uncommit files
129 $ hg status
129 $ hg status
130 M files
130 M files
131 $ hg bookmark
131 $ hg bookmark
132 * foo 6:3727deee06f7
132 * foo 6:3727deee06f7
133 $ hg heads -T '{rev}:{node} {desc}'
133 $ hg heads -T '{rev}:{node} {desc}'
134 6:3727deee06f72f5ffa8db792ee299cf39e3e190b new change abcde (no-eol)
134 6:3727deee06f72f5ffa8db792ee299cf39e3e190b new change abcde (no-eol)
135 $ hg log -r . -p -T '{rev}:{node} {desc}'
135 $ hg log -r . -p -T '{rev}:{node} {desc}'
136 6:3727deee06f72f5ffa8db792ee299cf39e3e190b new change abcdediff -r 6db330d65db4 -r 3727deee06f7 file-abcde
136 6:3727deee06f72f5ffa8db792ee299cf39e3e190b new change abcdediff -r 6db330d65db4 -r 3727deee06f7 file-abcde
137 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
137 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
138 +++ b/file-abcde Thu Jan 01 00:00:00 1970 +0000
138 +++ b/file-abcde Thu Jan 01 00:00:00 1970 +0000
139 @@ -0,0 +1,1 @@
139 @@ -0,0 +1,1 @@
140 +abcde
140 +abcde
141
141
142 $ hg log -G -T '{rev}:{node} {desc}' --hidden
142 $ hg log -G -T '{rev}:{node} {desc}' --hidden
143 @ 6:3727deee06f72f5ffa8db792ee299cf39e3e190b new change abcde
143 @ 6:3727deee06f72f5ffa8db792ee299cf39e3e190b new change abcde
144 |
144 |
145 | x 5:0c07a3ccda771b25f1cb1edbd02e683723344ef1 new change abcde
145 | x 5:0c07a3ccda771b25f1cb1edbd02e683723344ef1 new change abcde
146 |/
146 |/
147 | x 4:6c4fd43ed714e7fcd8adbaa7b16c953c2e985b60 added file-abcde
147 | x 4:6c4fd43ed714e7fcd8adbaa7b16c953c2e985b60 added file-abcde
148 |/
148 |/
149 o 3:6db330d65db434145c0b59d291853e9a84719b24 added file-abcd
149 o 3:6db330d65db434145c0b59d291853e9a84719b24 added file-abcd
150 |
150 |
151 o 2:abf2df566fc193b3ac34d946e63c1583e4d4732b added file-abc
151 o 2:abf2df566fc193b3ac34d946e63c1583e4d4732b added file-abc
152 |
152 |
153 o 1:69a232e754b08d568c4899475faf2eb44b857802 added file-ab
153 o 1:69a232e754b08d568c4899475faf2eb44b857802 added file-ab
154 |
154 |
155 o 0:3004d2d9b50883c1538fc754a3aeb55f1b4084f6 added file-a
155 o 0:3004d2d9b50883c1538fc754a3aeb55f1b4084f6 added file-a
156
156
157 $ hg commit -m 'update files for abcde'
157 $ hg commit -m 'update files for abcde'
158
158
159 Uncommit with dirty state
159 Uncommit with dirty state
160
160
161 $ echo "foo" >> files
161 $ echo "foo" >> files
162 $ cat files
162 $ cat files
163 abcde
163 abcde
164 foo
164 foo
165 $ hg status
165 $ hg status
166 M files
166 M files
167 $ hg uncommit
167 $ hg uncommit
168 abort: uncommitted changes
168 abort: uncommitted changes
169 (requires --allow-dirty-working-copy to uncommit)
169 (requires --allow-dirty-working-copy to uncommit)
170 [255]
170 [255]
171 $ hg uncommit files
171 $ hg uncommit files
172 abort: uncommitted changes
172 abort: uncommitted changes
173 (requires --allow-dirty-working-copy to uncommit)
173 (requires --allow-dirty-working-copy to uncommit)
174 [255]
174 [255]
175 $ cat files
175 $ cat files
176 abcde
176 abcde
177 foo
177 foo
178 $ hg commit --amend -m "files abcde + foo"
178 $ hg commit --amend -m "files abcde + foo"
179
179
180 Testing the 'experimental.uncommitondirtywdir' config
180 Testing the 'experimental.uncommitondirtywdir' config
181
181
182 $ echo "bar" >> files
182 $ echo "bar" >> files
183 $ hg uncommit
183 $ hg uncommit
184 abort: uncommitted changes
184 abort: uncommitted changes
185 (requires --allow-dirty-working-copy to uncommit)
185 (requires --allow-dirty-working-copy to uncommit)
186 [255]
186 [255]
187 $ hg uncommit --config experimental.uncommitondirtywdir=True
187 $ hg uncommit --config experimental.uncommitondirtywdir=True
188 $ hg commit -m "files abcde + foo"
188 $ hg commit -m "files abcde + foo"
189
189
190 Uncommit in the middle of a stack, does not move bookmark
190 Uncommit in the middle of a stack, does not move bookmark
191
191
192 $ hg checkout '.^^^'
192 $ hg checkout '.^^^'
193 1 files updated, 0 files merged, 2 files removed, 0 files unresolved
193 1 files updated, 0 files merged, 2 files removed, 0 files unresolved
194 (leaving bookmark foo)
194 (leaving bookmark foo)
195 $ hg log -r . -p -T '{rev}:{node} {desc}'
195 $ hg log -r . -p -T '{rev}:{node} {desc}'
196 2:abf2df566fc193b3ac34d946e63c1583e4d4732b added file-abcdiff -r 69a232e754b0 -r abf2df566fc1 file-abc
196 2:abf2df566fc193b3ac34d946e63c1583e4d4732b added file-abcdiff -r 69a232e754b0 -r abf2df566fc1 file-abc
197 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
197 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
198 +++ b/file-abc Thu Jan 01 00:00:00 1970 +0000
198 +++ b/file-abc Thu Jan 01 00:00:00 1970 +0000
199 @@ -0,0 +1,1 @@
199 @@ -0,0 +1,1 @@
200 +abc
200 +abc
201 diff -r 69a232e754b0 -r abf2df566fc1 files
201 diff -r 69a232e754b0 -r abf2df566fc1 files
202 --- a/files Thu Jan 01 00:00:00 1970 +0000
202 --- a/files Thu Jan 01 00:00:00 1970 +0000
203 +++ b/files Thu Jan 01 00:00:00 1970 +0000
203 +++ b/files Thu Jan 01 00:00:00 1970 +0000
204 @@ -1,1 +1,1 @@
204 @@ -1,1 +1,1 @@
205 -ab
205 -ab
206 +abc
206 +abc
207
207
208 $ hg bookmark
208 $ hg bookmark
209 foo 9:48e5bd7cd583
209 foo 9:48e5bd7cd583
210 $ hg uncommit
210 $ hg uncommit
211 3 new orphan changesets
211 3 new orphan changesets
212 $ hg status
212 $ hg status
213 M files
213 M files
214 A file-abc
214 A file-abc
215 $ hg heads -T '{rev}:{node} {desc}'
215 $ hg heads -T '{rev}:{node} {desc}'
216 9:48e5bd7cd583eb24164ef8b89185819c84c96ed7 files abcde + foo (no-eol)
216 9:48e5bd7cd583eb24164ef8b89185819c84c96ed7 files abcde + foo (no-eol)
217 $ hg bookmark
217 $ hg bookmark
218 foo 9:48e5bd7cd583
218 foo 9:48e5bd7cd583
219 $ hg commit -m 'new abc'
219 $ hg commit -m 'new abc'
220 created new head
220 created new head
221
221
222 Partial uncommit in the middle, does not move bookmark
222 Partial uncommit in the middle, does not move bookmark
223
223
224 $ hg checkout '.^'
224 $ hg checkout '.^'
225 1 files updated, 0 files merged, 1 files removed, 0 files unresolved
225 1 files updated, 0 files merged, 1 files removed, 0 files unresolved
226 $ hg log -r . -p -T '{rev}:{node} {desc}'
226 $ hg log -r . -p -T '{rev}:{node} {desc}'
227 1:69a232e754b08d568c4899475faf2eb44b857802 added file-abdiff -r 3004d2d9b508 -r 69a232e754b0 file-ab
227 1:69a232e754b08d568c4899475faf2eb44b857802 added file-abdiff -r 3004d2d9b508 -r 69a232e754b0 file-ab
228 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
228 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
229 +++ b/file-ab Thu Jan 01 00:00:00 1970 +0000
229 +++ b/file-ab Thu Jan 01 00:00:00 1970 +0000
230 @@ -0,0 +1,1 @@
230 @@ -0,0 +1,1 @@
231 +ab
231 +ab
232 diff -r 3004d2d9b508 -r 69a232e754b0 files
232 diff -r 3004d2d9b508 -r 69a232e754b0 files
233 --- a/files Thu Jan 01 00:00:00 1970 +0000
233 --- a/files Thu Jan 01 00:00:00 1970 +0000
234 +++ b/files Thu Jan 01 00:00:00 1970 +0000
234 +++ b/files Thu Jan 01 00:00:00 1970 +0000
235 @@ -1,1 +1,1 @@
235 @@ -1,1 +1,1 @@
236 -a
236 -a
237 +ab
237 +ab
238
238
239 $ hg bookmark
239 $ hg bookmark
240 foo 9:48e5bd7cd583
240 foo 9:48e5bd7cd583
241 $ hg uncommit file-ab
241 $ hg uncommit file-ab
242 1 new orphan changesets
242 1 new orphan changesets
243 $ hg status
243 $ hg status
244 A file-ab
244 A file-ab
245
245
246 $ hg heads -T '{rev}:{node} {desc}\n'
246 $ hg heads -T '{rev}:{node} {desc}\n'
247 11:8eb87968f2edb7f27f27fe676316e179de65fff6 added file-ab
247 11:8eb87968f2edb7f27f27fe676316e179de65fff6 added file-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 bookmark
251 $ hg bookmark
252 foo 9:48e5bd7cd583
252 foo 9:48e5bd7cd583
253 $ hg commit -m 'update ab'
253 $ hg commit -m 'update ab'
254 $ hg status
254 $ hg status
255 $ hg heads -T '{rev}:{node} {desc}\n'
255 $ hg heads -T '{rev}:{node} {desc}\n'
256 12:f21039c59242b085491bb58f591afc4ed1c04c09 update ab
256 12:f21039c59242b085491bb58f591afc4ed1c04c09 update ab
257 10:5dc89ca4486f8a88716c5797fa9f498d13d7c2e1 new abc
257 10:5dc89ca4486f8a88716c5797fa9f498d13d7c2e1 new abc
258 9:48e5bd7cd583eb24164ef8b89185819c84c96ed7 files abcde + foo
258 9:48e5bd7cd583eb24164ef8b89185819c84c96ed7 files abcde + foo
259
259
260 $ hg log -G -T '{rev}:{node} {desc}' --hidden
260 $ hg log -G -T '{rev}:{node} {desc}' --hidden
261 @ 12:f21039c59242b085491bb58f591afc4ed1c04c09 update ab
261 @ 12:f21039c59242b085491bb58f591afc4ed1c04c09 update ab
262 |
262 |
263 o 11:8eb87968f2edb7f27f27fe676316e179de65fff6 added file-ab
263 o 11:8eb87968f2edb7f27f27fe676316e179de65fff6 added file-ab
264 |
264 |
265 | * 10:5dc89ca4486f8a88716c5797fa9f498d13d7c2e1 new abc
265 | * 10:5dc89ca4486f8a88716c5797fa9f498d13d7c2e1 new abc
266 | |
266 | |
267 | | * 9:48e5bd7cd583eb24164ef8b89185819c84c96ed7 files abcde + foo
267 | | * 9:48e5bd7cd583eb24164ef8b89185819c84c96ed7 files abcde + foo
268 | | |
268 | | |
269 | | | x 8:84beeba0ac30e19521c036e4d2dd3a5fa02586ff files abcde + foo
269 | | | x 8:84beeba0ac30e19521c036e4d2dd3a5fa02586ff files abcde + foo
270 | | |/
270 | | |/
271 | | | x 7:0977fa602c2fd7d8427ed4e7ee15ea13b84c9173 update files for abcde
271 | | | x 7:0977fa602c2fd7d8427ed4e7ee15ea13b84c9173 update files for abcde
272 | | |/
272 | | |/
273 | | * 6:3727deee06f72f5ffa8db792ee299cf39e3e190b new change abcde
273 | | * 6:3727deee06f72f5ffa8db792ee299cf39e3e190b new change abcde
274 | | |
274 | | |
275 | | | x 5:0c07a3ccda771b25f1cb1edbd02e683723344ef1 new change abcde
275 | | | x 5:0c07a3ccda771b25f1cb1edbd02e683723344ef1 new change abcde
276 | | |/
276 | | |/
277 | | | x 4:6c4fd43ed714e7fcd8adbaa7b16c953c2e985b60 added file-abcde
277 | | | x 4:6c4fd43ed714e7fcd8adbaa7b16c953c2e985b60 added file-abcde
278 | | |/
278 | | |/
279 | | * 3:6db330d65db434145c0b59d291853e9a84719b24 added file-abcd
279 | | * 3:6db330d65db434145c0b59d291853e9a84719b24 added file-abcd
280 | | |
280 | | |
281 | | x 2:abf2df566fc193b3ac34d946e63c1583e4d4732b added file-abc
281 | | x 2:abf2df566fc193b3ac34d946e63c1583e4d4732b added file-abc
282 | |/
282 | |/
283 | x 1:69a232e754b08d568c4899475faf2eb44b857802 added file-ab
283 | x 1:69a232e754b08d568c4899475faf2eb44b857802 added file-ab
284 |/
284 |/
285 o 0:3004d2d9b50883c1538fc754a3aeb55f1b4084f6 added file-a
285 o 0:3004d2d9b50883c1538fc754a3aeb55f1b4084f6 added file-a
286
286
287 Uncommit with draft parent
287 Uncommit with draft parent
288
288
289 $ hg uncommit
289 $ hg uncommit
290 $ hg phase -r .
290 $ hg phase -r .
291 11: draft
291 11: draft
292 $ hg commit -m 'update ab again'
292 $ hg commit -m 'update ab again'
293
293
294 Phase is preserved
294 Phase is preserved
295
295
296 $ hg uncommit --keep --config phases.new-commit=secret
296 $ hg uncommit --keep --config phases.new-commit=secret
297 note: keeping empty commit
297 note: keeping empty commit
298 $ hg phase -r .
298 $ hg phase -r .
299 14: draft
299 14: draft
300 $ hg commit --amend -m 'update ab again'
300 $ hg commit --amend -m 'update ab again'
301
301
302 Uncommit with public parent
302 Uncommit with public parent
303
303
304 $ hg phase -p "::.^"
304 $ hg phase -p "::.^"
305 $ hg uncommit
305 $ hg uncommit
306 $ hg phase -r .
306 $ hg phase -r .
307 11: public
307 11: public
308
308
309 Partial uncommit with public parent
309 Partial uncommit with public parent
310
310
311 $ echo xyz > xyz
311 $ echo xyz > xyz
312 $ hg add xyz
312 $ hg add xyz
313 $ hg commit -m "update ab and add xyz"
313 $ hg commit -m "update ab and add xyz"
314 $ hg uncommit xyz
314 $ hg uncommit xyz
315 $ hg status
315 $ hg status
316 A xyz
316 A xyz
317 $ hg phase -r .
317 $ hg phase -r .
318 17: draft
318 17: draft
319 $ hg phase -r ".^"
319 $ hg phase -r ".^"
320 11: public
320 11: public
321
321
322 Uncommit with --keep or experimental.uncommit.keep leaves an empty changeset
322 Uncommit with --keep or experimental.uncommit.keep leaves an empty changeset
323
323
324 $ cd $TESTTMP
324 $ cd $TESTTMP
325 $ hg init repo1
325 $ hg init repo1
326 $ cd repo1
326 $ cd repo1
327 $ hg debugdrawdag <<'EOS'
327 $ hg debugdrawdag <<'EOS'
328 > Q
328 > Q
329 > |
329 > |
330 > P
330 > P
331 > EOS
331 > EOS
332 $ hg up Q -q
332 $ hg up Q -q
333 $ hg uncommit --keep
333 $ hg uncommit --keep
334 note: keeping empty commit
334 note: keeping empty commit
335 $ hg log -G -T '{desc} FILES: {files}'
335 $ hg log -G -T '{desc} FILES: {files}'
336 @ Q FILES:
336 @ Q FILES:
337 |
337 |
338 | x Q FILES: Q
338 | x Q FILES: Q
339 |/
339 |/
340 o P FILES: P
340 o P FILES: P
341
341
342 $ cat >> .hg/hgrc <<EOF
342 $ cat >> .hg/hgrc <<EOF
343 > [experimental]
343 > [experimental]
344 > uncommit.keep=True
344 > uncommit.keep=True
345 > EOF
345 > EOF
346 $ hg ci --amend
346 $ hg ci --amend
347 $ hg uncommit
347 $ hg uncommit
348 note: keeping empty commit
348 note: keeping empty commit
349 $ hg log -G -T '{desc} FILES: {files}'
349 $ hg log -G -T '{desc} FILES: {files}'
350 @ Q FILES:
350 @ Q FILES:
351 |
351 |
352 | x Q FILES: Q
352 | x Q FILES: Q
353 |/
353 |/
354 o P FILES: P
354 o P FILES: P
355
355
356 $ hg status
356 $ hg status
357 A Q
357 A Q
358 $ hg ci --amend
358 $ hg ci --amend
359 $ hg uncommit --no-keep
359 $ hg uncommit --no-keep
360 $ hg log -G -T '{desc} FILES: {files}'
360 $ hg log -G -T '{desc} FILES: {files}'
361 x Q FILES: Q
361 x Q FILES: Q
362 |
362 |
363 @ P FILES: P
363 @ P FILES: P
364
364
365 $ hg status
365 $ hg status
366 A Q
366 A Q
367 $ cd ..
367 $ cd ..
368 $ rm -rf repo1
368 $ rm -rf repo1
369
369
370 Testing uncommit while merge
370 Testing uncommit while merge
371
371
372 $ hg init repo2
372 $ hg init repo2
373 $ cd repo2
373 $ cd repo2
374
374
375 Create some history
375 Create some history
376
376
377 $ touch a
377 $ touch a
378 $ hg add a
378 $ hg add a
379 $ for i in 1 2 3; do echo $i > a; hg commit -m "a $i"; done
379 $ for i in 1 2 3; do echo $i > a; hg commit -m "a $i"; done
380 $ hg checkout 0
380 $ hg checkout 0
381 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
381 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
382 $ touch b
382 $ touch b
383 $ hg add b
383 $ hg add b
384 $ for i in 1 2 3; do echo $i > b; hg commit -m "b $i"; done
384 $ for i in 1 2 3; do echo $i > b; hg commit -m "b $i"; done
385 created new head
385 created new head
386 $ hg log -G -T '{rev}:{node} {desc}' --hidden
386 $ hg log -G -T '{rev}:{node} {desc}' --hidden
387 @ 5:2cd56cdde163ded2fbb16ba2f918c96046ab0bf2 b 3
387 @ 5:2cd56cdde163ded2fbb16ba2f918c96046ab0bf2 b 3
388 |
388 |
389 o 4:c3a0d5bb3b15834ffd2ef9ef603e93ec65cf2037 b 2
389 o 4:c3a0d5bb3b15834ffd2ef9ef603e93ec65cf2037 b 2
390 |
390 |
391 o 3:49bb009ca26078726b8870f1edb29fae8f7618f5 b 1
391 o 3:49bb009ca26078726b8870f1edb29fae8f7618f5 b 1
392 |
392 |
393 | o 2:990982b7384266e691f1bc08ca36177adcd1c8a9 a 3
393 | o 2:990982b7384266e691f1bc08ca36177adcd1c8a9 a 3
394 | |
394 | |
395 | o 1:24d38e3cf160c7b6f5ffe82179332229886a6d34 a 2
395 | o 1:24d38e3cf160c7b6f5ffe82179332229886a6d34 a 2
396 |/
396 |/
397 o 0:ea4e33293d4d274a2ba73150733c2612231f398c a 1
397 o 0:ea4e33293d4d274a2ba73150733c2612231f398c a 1
398
398
399
399
400 Add and expect uncommit to fail on both merge working dir and merge changeset
400 Add and expect uncommit to fail on both merge working dir and merge changeset
401
401
402 $ hg merge 2
402 $ hg merge 2
403 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
403 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
404 (branch merge, don't forget to commit)
404 (branch merge, don't forget to commit)
405
405
406 $ hg uncommit
406 $ hg uncommit
407 abort: outstanding uncommitted merge
407 abort: outstanding uncommitted merge
408 (requires --allow-dirty-working-copy to uncommit)
408 (requires --allow-dirty-working-copy to uncommit)
409 [255]
409 [255]
410
410
411 $ hg uncommit --config experimental.uncommitondirtywdir=True
411 $ hg uncommit --config experimental.uncommitondirtywdir=True
412 abort: cannot uncommit while merging
412 abort: cannot uncommit while merging
413 [255]
413 [255]
414
414
415 $ hg status
415 $ hg status
416 M a
416 M a
417 $ hg commit -m 'merge a and b'
417 $ hg commit -m 'merge a and b'
418
418
419 $ hg uncommit
419 $ hg uncommit
420 abort: cannot uncommit merge changeset
420 abort: cannot uncommit merge changeset
421 [255]
421 [255]
422
422
423 $ hg status
423 $ hg status
424 $ hg log -G -T '{rev}:{node} {desc}' --hidden
424 $ hg log -G -T '{rev}:{node} {desc}' --hidden
425 @ 6:c03b9c37bc67bf504d4912061cfb527b47a63c6e merge a and b
425 @ 6:c03b9c37bc67bf504d4912061cfb527b47a63c6e merge a and b
426 |\
426 |\
427 | o 5:2cd56cdde163ded2fbb16ba2f918c96046ab0bf2 b 3
427 | o 5:2cd56cdde163ded2fbb16ba2f918c96046ab0bf2 b 3
428 | |
428 | |
429 | o 4:c3a0d5bb3b15834ffd2ef9ef603e93ec65cf2037 b 2
429 | o 4:c3a0d5bb3b15834ffd2ef9ef603e93ec65cf2037 b 2
430 | |
430 | |
431 | o 3:49bb009ca26078726b8870f1edb29fae8f7618f5 b 1
431 | o 3:49bb009ca26078726b8870f1edb29fae8f7618f5 b 1
432 | |
432 | |
433 o | 2:990982b7384266e691f1bc08ca36177adcd1c8a9 a 3
433 o | 2:990982b7384266e691f1bc08ca36177adcd1c8a9 a 3
434 | |
434 | |
435 o | 1:24d38e3cf160c7b6f5ffe82179332229886a6d34 a 2
435 o | 1:24d38e3cf160c7b6f5ffe82179332229886a6d34 a 2
436 |/
436 |/
437 o 0:ea4e33293d4d274a2ba73150733c2612231f398c a 1
437 o 0:ea4e33293d4d274a2ba73150733c2612231f398c a 1
438
438
439
439
440 Rename a->b, then remove b in working copy. Result should remove a.
440 Rename a->b, then remove b in working copy. Result should remove a.
441
441
442 $ hg co -q 0
442 $ hg co -q 0
443 $ hg mv a b
443 $ hg mv a b
444 $ hg ci -qm 'move a to b'
444 $ hg ci -qm 'move a to b'
445 $ hg rm b
445 $ hg rm b
446 $ hg uncommit --config experimental.uncommitondirtywdir=True
446 $ hg uncommit --config experimental.uncommitondirtywdir=True
447 $ hg st --copies
447 $ hg st --copies
448 R a
448 R a
449 $ hg revert a
449 $ hg revert a
450
450
451 Rename a->b, then rename b->c in working copy. Result should rename a->c.
451 Rename a->b, then rename b->c in working copy. Result should rename a->c.
452
452
453 $ hg co -q 0
453 $ hg co -q 0
454 $ hg mv a b
454 $ hg mv a b
455 $ hg ci -qm 'move a to b'
455 $ hg ci -qm 'move a to b'
456 $ hg mv b c
456 $ hg mv b c
457 $ hg uncommit --config experimental.uncommitondirtywdir=True
457 $ hg uncommit --config experimental.uncommitondirtywdir=True
458 $ hg st --copies
458 $ hg st --copies
459 A c
459 A c
460 a
460 a
461 R a
461 R a
462 $ hg revert a
462 $ hg revert a
463 $ hg forget c
463 $ hg forget c
464 $ rm c
464 $ rm c
465
465
466 Copy a->b1 and a->b2, then rename b1->c in working copy. Result should copy a->b2 and a->c.
466 Copy a->b1 and a->b2, then rename b1->c in working copy. Result should copy a->b2 and a->c.
467
467
468 $ hg co -q 0
468 $ hg co -q 0
469 $ hg cp a b1
469 $ hg cp a b1
470 $ hg cp a b2
470 $ hg cp a b2
471 $ hg ci -qm 'move a to b1 and b2'
471 $ hg ci -qm 'move a to b1 and b2'
472 $ hg mv b1 c
472 $ hg mv b1 c
473 $ hg uncommit --config experimental.uncommitondirtywdir=True
473 $ hg uncommit --config experimental.uncommitondirtywdir=True
474 $ hg st --copies
474 $ hg st --copies
475 A b2
475 A b2
476 a
476 a
477 A c
477 A c
478 a
478 a
479 $ cd ..
479 $ cd ..
480
480
481 --allow-dirty-working-copy should also work on a dirty PATH
481 --allow-dirty-working-copy should also work on a dirty PATH
482
482
483 $ hg init issue5977
483 $ hg init issue5977
484 $ cd issue5977
484 $ cd issue5977
485 $ echo 'super critical info!' > a
485 $ echo 'super critical info!' > a
486 $ hg ci -Am 'add a'
486 $ hg ci -Am 'add a'
487 adding a
487 adding a
488 $ echo 'foo' > b
488 $ echo 'foo' > b
489 $ hg add b
489 $ hg add b
490 $ hg status
490 $ hg status
491 A b
491 A b
492 $ hg unc a
492 $ hg uncommit a
493 note: keeping empty commit
493 note: keeping empty commit
494 $ cat a
494 $ cat a
495 super critical info!
495 super critical info!
496 $ hg log
496 $ hg log
497 changeset: 1:656ba143d384
497 changeset: 1:656ba143d384
498 tag: tip
498 tag: tip
499 parent: -1:000000000000
499 parent: -1:000000000000
500 user: test
500 user: test
501 date: Thu Jan 01 00:00:00 1970 +0000
501 date: Thu Jan 01 00:00:00 1970 +0000
502 summary: add a
502 summary: add a
503
503
504 $ hg ci -Am 'add b'
504 $ hg ci -Am 'add b'
505 $ echo 'foo bar' > b
505 $ echo 'foo bar' > b
506 $ hg unc b
506 $ hg uncommit b
507 abort: uncommitted changes
507 abort: uncommitted changes
508 (requires --allow-dirty-working-copy to uncommit)
508 (requires --allow-dirty-working-copy to uncommit)
509 [255]
509 [255]
510 $ hg unc --allow-dirty-working-copy b
510 $ hg uncommit --allow-dirty-working-copy b
511 $ hg log
511 $ hg log
512 changeset: 3:30fa958635b2
512 changeset: 3:30fa958635b2
513 tag: tip
513 tag: tip
514 parent: 1:656ba143d384
514 parent: 1:656ba143d384
515 user: test
515 user: test
516 date: Thu Jan 01 00:00:00 1970 +0000
516 date: Thu Jan 01 00:00:00 1970 +0000
517 summary: add b
517 summary: add b
518
518
519 changeset: 1:656ba143d384
519 changeset: 1:656ba143d384
520 parent: -1:000000000000
520 parent: -1:000000000000
521 user: test
521 user: test
522 date: Thu Jan 01 00:00:00 1970 +0000
522 date: Thu Jan 01 00:00:00 1970 +0000
523 summary: add a
523 summary: add a
524
524
525 Removes can be uncommitted
525 Removes can be uncommitted
526
526
527 $ hg ci -m 'modified b'
527 $ hg ci -m 'modified b'
528 $ hg rm b
528 $ hg rm b
529 $ hg ci -m 'remove b'
529 $ hg ci -m 'remove b'
530 $ hg uncommit b
530 $ hg uncommit b
531 note: keeping empty commit
531 note: keeping empty commit
532 $ hg status
532 $ hg status
533 R b
533 R b
534
534
535 Uncommitting a directory won't run afoul of the checks that an explicit file
535 Uncommitting a directory won't run afoul of the checks that an explicit file
536 can be uncommitted.
536 can be uncommitted.
537
537
538 $ mkdir dir
538 $ mkdir dir
539 $ echo 1 > dir/file.txt
539 $ echo 1 > dir/file.txt
540 $ hg ci -Aqm 'add file in directory'
540 $ hg ci -Aqm 'add file in directory'
541 $ hg uncommit dir -m 'uncommit with message' -u 'different user' \
541 $ hg uncommit dir -m 'uncommit with message' -u 'different user' \
542 > -d 'Jun 30 12:12:12 1980 +0000'
542 > -d 'Jun 30 12:12:12 1980 +0000'
543 $ hg status
543 $ hg status
544 A dir/file.txt
544 A dir/file.txt
545 $ hg log -r .
545 $ hg log -r .
546 changeset: 8:b4dd26dc42e0
546 changeset: 8:b4dd26dc42e0
547 tag: tip
547 tag: tip
548 parent: 6:2278a4c24330
548 parent: 6:2278a4c24330
549 user: different user
549 user: different user
550 date: Mon Jun 30 12:12:12 1980 +0000
550 date: Mon Jun 30 12:12:12 1980 +0000
551 summary: uncommit with message
551 summary: uncommit with message
552
552
553 Bad option combinations
553 Bad option combinations
554
554
555 $ hg rollback -q --config ui.rollback=True
555 $ hg rollback -q --config ui.rollback=True
556 $ hg uncommit -U --user 'user'
556 $ hg uncommit -U --user 'user'
557 abort: cannot specify both --user and --currentuser
557 abort: cannot specify both --user and --currentuser
558 [255]
558 [255]
559 $ hg uncommit -D --date today
559 $ hg uncommit -D --date today
560 abort: cannot specify both --date and --currentdate
560 abort: cannot specify both --date and --currentdate
561 [255]
561 [255]
562
562
563 `uncommit <dir>` and `cd <dir> && uncommit .` behave the same...
563 `uncommit <dir>` and `cd <dir> && uncommit .` behave the same...
564
564
565 $ echo 2 > dir/file2.txt
565 $ echo 2 > dir/file2.txt
566 $ hg ci -Aqm 'add file2 in directory'
566 $ hg ci -Aqm 'add file2 in directory'
567 $ hg uncommit dir
567 $ hg uncommit dir
568 note: keeping empty commit
568 note: keeping empty commit
569 $ hg status
569 $ hg status
570 A dir/file2.txt
570 A dir/file2.txt
571
571
572 $ hg rollback -q --config ui.rollback=True
572 $ hg rollback -q --config ui.rollback=True
573 $ cd dir
573 $ cd dir
574 $ hg uncommit . -n 'this is a note'
574 $ hg uncommit . -n 'this is a note'
575 note: keeping empty commit
575 note: keeping empty commit
576 $ hg status
576 $ hg status
577 A dir/file2.txt
577 A dir/file2.txt
578 $ cd ..
578 $ cd ..
579
579
580 ... and errors out the same way when nothing can be uncommitted
580 ... and errors out the same way when nothing can be uncommitted
581
581
582 $ hg rollback -q --config ui.rollback=True
582 $ hg rollback -q --config ui.rollback=True
583 $ mkdir emptydir
583 $ mkdir emptydir
584 $ hg uncommit emptydir
584 $ hg uncommit emptydir
585 abort: cannot uncommit "emptydir"
585 abort: cannot uncommit "emptydir"
586 (file was untracked in working directory parent)
586 (file was untracked in working directory parent)
587 [255]
587 [255]
588
588
589 $ cd emptydir
589 $ cd emptydir
590 $ hg uncommit .
590 $ hg uncommit .
591 abort: cannot uncommit "emptydir"
591 abort: cannot uncommit "emptydir"
592 (file was untracked in working directory parent)
592 (file was untracked in working directory parent)
593 [255]
593 [255]
594 $ hg status
594 $ hg status
595 $ cd ..
595 $ cd ..
General Comments 0
You need to be logged in to leave comments. Login now