hgext/uncommit.py
changeset 46465 0e2becd1fe0c
parent 46113 59fa3890d40a
child 47012 d55b71393907
equal deleted inserted replaced
46463:95b276283b67 46465:0e2becd1fe0c
   173                 hint=_(b'requires --allow-dirty-working-copy to uncommit'),
   173                 hint=_(b'requires --allow-dirty-working-copy to uncommit'),
   174             )
   174             )
   175         old = repo[b'.']
   175         old = repo[b'.']
   176         rewriteutil.precheck(repo, [old.rev()], b'uncommit')
   176         rewriteutil.precheck(repo, [old.rev()], b'uncommit')
   177         if len(old.parents()) > 1:
   177         if len(old.parents()) > 1:
   178             raise error.Abort(_(b"cannot uncommit merge changeset"))
   178             raise error.InputError(_(b"cannot uncommit merge changeset"))
   179 
   179 
   180         match = scmutil.match(old, pats, opts)
   180         match = scmutil.match(old, pats, opts)
   181 
   181 
   182         # Check all explicitly given files; abort if there's a problem.
   182         # Check all explicitly given files; abort if there's a problem.
   183         if match.files():
   183         if match.files():
   200                 elif repo.wvfs.exists(f):
   200                 elif repo.wvfs.exists(f):
   201                     hint = _(b"file was untracked in working directory parent")
   201                     hint = _(b"file was untracked in working directory parent")
   202                 else:
   202                 else:
   203                     hint = _(b"file does not exist")
   203                     hint = _(b"file does not exist")
   204 
   204 
   205                 raise error.Abort(
   205                 raise error.InputError(
   206                     _(b'cannot uncommit "%s"') % scmutil.getuipathfn(repo)(f),
   206                     _(b'cannot uncommit "%s"') % scmutil.getuipathfn(repo)(f),
   207                     hint=hint,
   207                     hint=hint,
   208                 )
   208                 )
   209 
   209 
   210         with repo.transaction(b'uncommit'):
   210         with repo.transaction(b'uncommit'):
   278 
   278 
   279         # identify the commit to which to unamend
   279         # identify the commit to which to unamend
   280         markers = list(predecessormarkers(curctx))
   280         markers = list(predecessormarkers(curctx))
   281         if len(markers) != 1:
   281         if len(markers) != 1:
   282             e = _(b"changeset must have one predecessor, found %i predecessors")
   282             e = _(b"changeset must have one predecessor, found %i predecessors")
   283             raise error.Abort(e % len(markers))
   283             raise error.InputError(e % len(markers))
   284 
   284 
   285         prednode = markers[0].prednode()
   285         prednode = markers[0].prednode()
   286         predctx = unfi[prednode]
   286         predctx = unfi[prednode]
   287 
   287 
   288         # add an extra so that we get a new hash
   288         # add an extra so that we get a new hash