Show More
@@ -28,10 +28,10 b' from mercurial import (' | |||
|
28 | 28 | copies, |
|
29 | 29 | error, |
|
30 | 30 | node, |
|
31 | obsolete, | |
|
32 | 31 | obsutil, |
|
33 | 32 | pycompat, |
|
34 | 33 | registrar, |
|
34 | rewriteutil, | |
|
35 | 35 | scmutil, |
|
36 | 36 | ) |
|
37 | 37 | |
@@ -155,23 +155,14 b' def uncommit(ui, repo, *pats, **opts):' | |||
|
155 | 155 | opts = pycompat.byteskwargs(opts) |
|
156 | 156 | |
|
157 | 157 | with repo.wlock(), repo.lock(): |
|
158 | wctx = repo[None] | |
|
159 | 158 | |
|
160 | 159 | if not pats and not repo.ui.configbool('experimental', |
|
161 | 160 | 'uncommitondirtywdir'): |
|
162 | 161 | cmdutil.bailifchanged(repo) |
|
163 | if wctx.parents()[0].node() == node.nullid: | |
|
164 | raise error.Abort(_("cannot uncommit null changeset")) | |
|
165 | if len(wctx.parents()) > 1: | |
|
166 | raise error.Abort(_("cannot uncommit while merging")) | |
|
167 | 162 | old = repo['.'] |
|
168 | if not old.mutable(): | |
|
169 | raise error.Abort(_('cannot uncommit public changesets')) | |
|
163 | rewriteutil.precheck(repo, [old.rev()], 'uncommit') | |
|
170 | 164 | if len(old.parents()) > 1: |
|
171 | 165 | raise error.Abort(_("cannot uncommit merge changeset")) |
|
172 | allowunstable = obsolete.isenabled(repo, obsolete.allowunstableopt) | |
|
173 | if not allowunstable and old.children(): | |
|
174 | raise error.Abort(_('cannot uncommit changeset with children')) | |
|
175 | 166 | |
|
176 | 167 | with repo.transaction('uncommit'): |
|
177 | 168 | match = scmutil.match(old, pats, opts) |
@@ -49,6 +49,7 b' from . import (' | |||
|
49 | 49 | rcutil, |
|
50 | 50 | registrar, |
|
51 | 51 | revsetlang, |
|
52 | rewriteutil, | |
|
52 | 53 | scmutil, |
|
53 | 54 | server, |
|
54 | 55 | sshserver, |
@@ -1541,13 +1542,7 b' def _docommit(ui, repo, *pats, **opts):' | |||
|
1541 | 1542 | raise error.Abort(_('cannot amend with ui.commitsubrepos enabled')) |
|
1542 | 1543 | |
|
1543 | 1544 | old = repo['.'] |
|
1544 | if not old.mutable(): | |
|
1545 | raise error.Abort(_('cannot amend public changesets')) | |
|
1546 | if len(repo[None].parents()) > 1: | |
|
1547 | raise error.Abort(_('cannot amend while merging')) | |
|
1548 | allowunstable = obsolete.isenabled(repo, obsolete.allowunstableopt) | |
|
1549 | if not allowunstable and old.children(): | |
|
1550 | raise error.Abort(_('cannot amend changeset with children')) | |
|
1545 | rewriteutil.precheck(repo, [old.rev()], 'amend') | |
|
1551 | 1546 | |
|
1552 | 1547 | # Currently histedit gets confused if an amend happens while histedit |
|
1553 | 1548 | # is in progress. Since we have a checkunfinished command, we are |
@@ -213,6 +213,7 b' Cannot amend public changeset' | |||
|
213 | 213 | $ hg update -C -q A |
|
214 | 214 | $ hg amend -m AMEND |
|
215 | 215 | abort: cannot amend public changesets |
|
216 | (see 'hg help phases' for details) | |
|
216 | 217 | [255] |
|
217 | 218 | |
|
218 | 219 | Amend a merge changeset |
General Comments 0
You need to be logged in to leave comments.
Login now