hgext/shelve.py
changeset 30382 dedf0915ca5b
parent 30381 caba61934721
child 30383 455f7856db20
equal deleted inserted replaced
30381:caba61934721 30382:dedf0915ca5b
   318         message = opts['message']
   318         message = opts['message']
   319         return commitfunc(ui, repo, message, match, opts)
   319         return commitfunc(ui, repo, message, match, opts)
   320 
   320 
   321     return interactivecommitfunc if interactive else commitfunc
   321     return interactivecommitfunc if interactive else commitfunc
   322 
   322 
       
   323 def _nothingtoshelvemessaging(ui, repo, pats, opts):
       
   324     stat = repo.status(match=scmutil.match(repo[None], pats, opts))
       
   325     if stat.deleted:
       
   326         ui.status(_("nothing changed (%d missing files, see "
       
   327                     "'hg status')\n") % len(stat.deleted))
       
   328     else:
       
   329         ui.status(_("nothing changed\n"))
       
   330 
   323 def _docreatecmd(ui, repo, pats, opts):
   331 def _docreatecmd(ui, repo, pats, opts):
   324     wctx = repo[None]
   332     wctx = repo[None]
   325     parents = wctx.parents()
   333     parents = wctx.parents()
   326     if len(parents) > 1:
   334     if len(parents) > 1:
   327         raise error.Abort(_('cannot shelve while merging'))
   335         raise error.Abort(_('cannot shelve while merging'))
   367             node = cmdutil.commit(ui, repo, commitfunc, pats, opts)
   375             node = cmdutil.commit(ui, repo, commitfunc, pats, opts)
   368         else:
   376         else:
   369             node = cmdutil.dorecord(ui, repo, commitfunc, None,
   377             node = cmdutil.dorecord(ui, repo, commitfunc, None,
   370                                     False, cmdutil.recordfilter, *pats, **opts)
   378                                     False, cmdutil.recordfilter, *pats, **opts)
   371         if not node:
   379         if not node:
   372             stat = repo.status(match=scmutil.match(repo[None], pats, opts))
   380             _nothingtoshelvemessaging(ui, repo, pats, opts)
   373             if stat.deleted:
       
   374                 ui.status(_("nothing changed (%d missing files, see "
       
   375                             "'hg status')\n") % len(stat.deleted))
       
   376             else:
       
   377                 ui.status(_("nothing changed\n"))
       
   378             return 1
   381             return 1
   379 
   382 
   380         bases = list(mutableancestors(repo[node]))
   383         bases = list(mutableancestors(repo[node]))
   381         shelvedfile(repo, name, 'hg').writebundle(bases, node)
   384         shelvedfile(repo, name, 'hg').writebundle(bases, node)
   382         cmdutil.export(repo, [node],
   385         cmdutil.export(repo, [node],