mercurial/cmdutil.py
branchstable
changeset 19496 607191a45f8c
parent 19482 499fc471296b
child 19510 8b190adb7ee3
equal deleted inserted replaced
19495:9aee3d014394 19496:607191a45f8c
  2105 summaryhooks = util.hooks()
  2105 summaryhooks = util.hooks()
  2106 
  2106 
  2107 # A list of state files kept by multistep operations like graft.
  2107 # A list of state files kept by multistep operations like graft.
  2108 # Since graft cannot be aborted, it is considered 'clearable' by update.
  2108 # Since graft cannot be aborted, it is considered 'clearable' by update.
  2109 # note: bisect is intentionally excluded
  2109 # note: bisect is intentionally excluded
  2110 # (state file, clearable, error, hint)
  2110 # (state file, clearable, allowcommit, error, hint)
  2111 unfinishedstates = [
  2111 unfinishedstates = [
  2112     ('graftstate', True, _('graft in progress'),
  2112     ('graftstate', True, False, _('graft in progress'),
  2113      _("use 'hg graft --continue' or 'hg update' to abort")),
  2113      _("use 'hg graft --continue' or 'hg update' to abort")),
  2114     ('updatestate', True, _('last update was interrupted'),
  2114     ('updatestate', True, False, _('last update was interrupted'),
  2115      _("use 'hg update' to get a consistent checkout"))
  2115      _("use 'hg update' to get a consistent checkout"))
  2116     ]
  2116     ]
  2117 
  2117 
  2118 def checkunfinished(repo):
  2118 def checkunfinished(repo, commit=False):
  2119     '''Look for an unfinished multistep operation, like graft, and abort
  2119     '''Look for an unfinished multistep operation, like graft, and abort
  2120     if found. It's probably good to check this right before
  2120     if found. It's probably good to check this right before
  2121     bailifchanged().
  2121     bailifchanged().
  2122     '''
  2122     '''
  2123     for f, clearable, msg, hint in unfinishedstates:
  2123     for f, clearable, allowcommit, msg, hint in unfinishedstates:
       
  2124         if commit and allowcommit:
       
  2125             continue
  2124         if repo.vfs.exists(f):
  2126         if repo.vfs.exists(f):
  2125             raise util.Abort(msg, hint=hint)
  2127             raise util.Abort(msg, hint=hint)
  2126 
  2128 
  2127 def clearunfinished(repo):
  2129 def clearunfinished(repo):
  2128     '''Check for unfinished operations (as above), and clear the ones
  2130     '''Check for unfinished operations (as above), and clear the ones
  2129     that are clearable.
  2131     that are clearable.
  2130     '''
  2132     '''
  2131     for f, clearable, msg, hint in unfinishedstates:
  2133     for f, clearable, allowcommit, msg, hint in unfinishedstates:
  2132         if not clearable and repo.vfs.exists(f):
  2134         if not clearable and repo.vfs.exists(f):
  2133             raise util.Abort(msg, hint=hint)
  2135             raise util.Abort(msg, hint=hint)
  2134     for f, clearable, msg, hint in unfinishedstates:
  2136     for f, clearable, allowcommit, msg, hint in unfinishedstates:
  2135         if clearable and repo.vfs.exists(f):
  2137         if clearable and repo.vfs.exists(f):
  2136             util.unlink(repo.join(f))
  2138             util.unlink(repo.join(f))