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