hgext/shelve.py
changeset 42012 9b78bbb76111
parent 42011 22278dae287c
child 42013 50d5e64ec561
equal deleted inserted replaced
42011:22278dae287c 42012:9b78bbb76111
   418         ui.status(_("nothing changed (%d missing files, see "
   418         ui.status(_("nothing changed (%d missing files, see "
   419                     "'hg status')\n") % len(stat.deleted))
   419                     "'hg status')\n") % len(stat.deleted))
   420     else:
   420     else:
   421         ui.status(_("nothing changed\n"))
   421         ui.status(_("nothing changed\n"))
   422 
   422 
   423 def _shelvecreatedcommit(repo, node, name):
   423 def _shelvecreatedcommit(repo, node, name, match):
   424     info = {'node': nodemod.hex(node)}
   424     info = {'node': nodemod.hex(node)}
   425     shelvedfile(repo, name, 'shelve').writeinfo(info)
   425     shelvedfile(repo, name, 'shelve').writeinfo(info)
   426     bases = list(mutableancestors(repo[node]))
   426     bases = list(mutableancestors(repo[node]))
   427     shelvedfile(repo, name, 'hg').writebundle(bases, node)
   427     shelvedfile(repo, name, 'hg').writebundle(bases, node)
   428     # Create a matcher so that prefetch doesn't attempt to fetch the entire
       
   429     # repository pointlessly.
       
   430     match = scmutil.matchfiles(repo, repo[node].files())
       
   431     with shelvedfile(repo, name, patchextension).opener('wb') as fp:
   428     with shelvedfile(repo, name, patchextension).opener('wb') as fp:
   432         cmdutil.exportfile(repo, [node], fp, opts=mdiff.diffopts(git=True),
   429         cmdutil.exportfile(repo, [node], fp, opts=mdiff.diffopts(git=True),
   433                            match=match)
   430                            match=match)
   434 
   431 
   435 def _includeunknownfiles(repo, pats, opts, extra):
   432 def _includeunknownfiles(repo, pats, opts, extra):
   499                                     **pycompat.strkwargs(opts))
   496                                     **pycompat.strkwargs(opts))
   500         if not node:
   497         if not node:
   501             _nothingtoshelvemessaging(ui, repo, pats, opts)
   498             _nothingtoshelvemessaging(ui, repo, pats, opts)
   502             return 1
   499             return 1
   503 
   500 
   504         _shelvecreatedcommit(repo, node, name)
   501         # Create a matcher so that prefetch doesn't attempt to fetch
       
   502         # the entire repository pointlessly
       
   503         match = scmutil.matchfiles(repo, repo[node].files())
       
   504         _shelvecreatedcommit(repo, node, name, match)
   505 
   505 
   506         if ui.formatted():
   506         if ui.formatted():
   507             desc = stringutil.ellipsis(desc, ui.termwidth())
   507             desc = stringutil.ellipsis(desc, ui.termwidth())
   508         ui.status(_('shelved as %s\n') % name)
   508         ui.status(_('shelved as %s\n') % name)
   509         hg.update(repo, parent.node())
   509         hg.update(repo, parent.node())