mercurial/cmdutil.py
changeset 42530 dc3fdd1b5af4
parent 42529 5f2f6912c9e6
child 42531 5bddd2244814
equal deleted inserted replaced
42529:5f2f6912c9e6 42530:dc3fdd1b5af4
  3312 # otherwise, 'changes' is a tuple of tuples below:
  3312 # otherwise, 'changes' is a tuple of tuples below:
  3313 #  - (sourceurl, sourcebranch, sourcepeer, incoming)
  3313 #  - (sourceurl, sourcebranch, sourcepeer, incoming)
  3314 #  - (desturl,   destbranch,   destpeer,   outgoing)
  3314 #  - (desturl,   destbranch,   destpeer,   outgoing)
  3315 summaryremotehooks = util.hooks()
  3315 summaryremotehooks = util.hooks()
  3316 
  3316 
       
  3317 
  3317 def checkunfinished(repo, commit=False):
  3318 def checkunfinished(repo, commit=False):
  3318     '''Look for an unfinished multistep operation, like graft, and abort
  3319     '''Look for an unfinished multistep operation, like graft, and abort
  3319     if found. It's probably good to check this right before
  3320     if found. It's probably good to check this right before
  3320     bailifchanged().
  3321     bailifchanged().
  3321     '''
  3322     '''
  3322     # Check for non-clearable states first, so things like rebase will take
  3323     # Check for non-clearable states first, so things like rebase will take
  3323     # precedence over update.
  3324     # precedence over update.
  3324     for f, clearable, allowcommit, msg, hint in statemod.unfinishedstates:
  3325     for state in statemod._unfinishedstates:
  3325         if clearable or (commit and allowcommit):
  3326         if state._clearable or (commit and state._allowcommit):
  3326             continue
  3327             continue
  3327         if repo.vfs.exists(f):
  3328         if state.isunfinished(repo):
  3328             raise error.Abort(msg, hint=hint)
  3329             raise error.Abort(state.msg(), hint=state.hint())
  3329 
  3330 
  3330     for f, clearable, allowcommit, msg, hint in statemod.unfinishedstates:
  3331     for s in statemod._unfinishedstates:
  3331         if not clearable or (commit and allowcommit):
  3332         if not s._clearable or (commit and s._allowcommit):
  3332             continue
  3333             continue
  3333         if repo.vfs.exists(f):
  3334         if s.isunfinished(repo):
  3334             raise error.Abort(msg, hint=hint)
  3335             raise error.Abort(s.msg(), hint=s.hint())
  3335 
  3336 
  3336 def clearunfinished(repo):
  3337 def clearunfinished(repo):
  3337     '''Check for unfinished operations (as above), and clear the ones
  3338     '''Check for unfinished operations (as above), and clear the ones
  3338     that are clearable.
  3339     that are clearable.
  3339     '''
  3340     '''
  3340     for f, clearable, allowcommit, msg, hint in statemod.unfinishedstates:
  3341     for state in statemod._unfinishedstates:
  3341         if not clearable and repo.vfs.exists(f):
  3342         if not state._clearable and state.isunfinished(repo):
  3342             raise error.Abort(msg, hint=hint)
  3343             raise error.Abort(state.msg(), hint=state.hint())
  3343     for f, clearable, allowcommit, msg, hint in statemod.unfinishedstates:
  3344 
  3344         if clearable and repo.vfs.exists(f):
  3345     for s in statemod._unfinishedstates:
  3345             util.unlink(repo.vfs.join(f))
  3346         if s._clearable and s.isunfinished(repo):
       
  3347             util.unlink(repo.vfs.join(s._fname))
  3346 
  3348 
  3347 afterresolvedstates = [
  3349 afterresolvedstates = [
  3348     ('graftstate',
  3350     ('graftstate',
  3349      _('hg graft --continue')),
  3351      _('hg graft --continue')),
  3350     ]
  3352     ]