hgext/shelve.py
changeset 30823 806a830e6612
parent 30671 64a75655b988
child 30846 dfc6663f97ca
equal deleted inserted replaced
30822:b54a2984cdd4 30823:806a830e6612
   520                     ui.write(chunk, label=label)
   520                     ui.write(chunk, label=label)
   521             if opts['stat']:
   521             if opts['stat']:
   522                 for chunk, label in patch.diffstatui(difflines, width=width):
   522                 for chunk, label in patch.diffstatui(difflines, width=width):
   523                     ui.write(chunk, label=label)
   523                     ui.write(chunk, label=label)
   524 
   524 
   525 def singlepatchcmds(ui, repo, pats, opts, subcommand):
   525 def patchcmds(ui, repo, pats, opts, subcommand):
   526     """subcommand that displays a single shelf"""
   526     """subcommand that displays shelves"""
   527     if len(pats) != 1:
   527     if len(pats) == 0:
   528         raise error.Abort(_("--%s expects a single shelf") % subcommand)
   528         raise error.Abort(_("--%s expects at least one shelf") % subcommand)
   529     shelfname = pats[0]
   529 
   530 
   530     for shelfname in pats:
   531     if not shelvedfile(repo, shelfname, patchextension).exists():
   531         if not shelvedfile(repo, shelfname, patchextension).exists():
   532         raise error.Abort(_("cannot find shelf %s") % shelfname)
   532             raise error.Abort(_("cannot find shelf %s") % shelfname)
   533 
   533 
   534     listcmd(ui, repo, pats, opts)
   534     listcmd(ui, repo, pats, opts)
   535 
   535 
   536 def checkparents(repo, state):
   536 def checkparents(repo, state):
   537     """check parent while resuming an unshelve"""
   537     """check parent while resuming an unshelve"""
   965     elif checkopt('delete'):
   965     elif checkopt('delete'):
   966         return deletecmd(ui, repo, pats)
   966         return deletecmd(ui, repo, pats)
   967     elif checkopt('list'):
   967     elif checkopt('list'):
   968         return listcmd(ui, repo, pats, opts)
   968         return listcmd(ui, repo, pats, opts)
   969     elif checkopt('patch'):
   969     elif checkopt('patch'):
   970         return singlepatchcmds(ui, repo, pats, opts, subcommand='patch')
   970         return patchcmds(ui, repo, pats, opts, subcommand='patch')
   971     elif checkopt('stat'):
   971     elif checkopt('stat'):
   972         return singlepatchcmds(ui, repo, pats, opts, subcommand='stat')
   972         return patchcmds(ui, repo, pats, opts, subcommand='stat')
   973     else:
   973     else:
   974         return createcmd(ui, repo, pats, opts)
   974         return createcmd(ui, repo, pats, opts)
   975 
   975 
   976 def extsetup(ui):
   976 def extsetup(ui):
   977     cmdutil.unfinishedstates.append(
   977     cmdutil.unfinishedstates.append(