Mercurial > hg-stable
comparison hgext/shelve.py @ 30393:455f7856db20
shelve: move actual created commit shelving to a separate function
Currently, this code does not have any branching, it just bundles
a commit and saves a patch file. Later, obsolescence-based shelve
will be added, so this code will also create some obsmarkers and
will be one of the few places where obsshelve will be different
from traditional shelve.
author | Kostia Balytskyi <ikostia@fb.com> |
---|---|
date | Thu, 10 Nov 2016 03:07:20 -0800 |
parents | dedf0915ca5b |
children | 21a75b63c10e |
comparison
equal
deleted
inserted
replaced
30392:dedf0915ca5b | 30393:455f7856db20 |
---|---|
326 ui.status(_("nothing changed (%d missing files, see " | 326 ui.status(_("nothing changed (%d missing files, see " |
327 "'hg status')\n") % len(stat.deleted)) | 327 "'hg status')\n") % len(stat.deleted)) |
328 else: | 328 else: |
329 ui.status(_("nothing changed\n")) | 329 ui.status(_("nothing changed\n")) |
330 | 330 |
331 def _shelvecreatedcommit(repo, node, name): | |
332 bases = list(mutableancestors(repo[node])) | |
333 shelvedfile(repo, name, 'hg').writebundle(bases, node) | |
334 cmdutil.export(repo, [node], | |
335 fp=shelvedfile(repo, name, 'patch').opener('wb'), | |
336 opts=mdiff.diffopts(git=True)) | |
337 | |
331 def _docreatecmd(ui, repo, pats, opts): | 338 def _docreatecmd(ui, repo, pats, opts): |
332 wctx = repo[None] | 339 wctx = repo[None] |
333 parents = wctx.parents() | 340 parents = wctx.parents() |
334 if len(parents) > 1: | 341 if len(parents) > 1: |
335 raise error.Abort(_('cannot shelve while merging')) | 342 raise error.Abort(_('cannot shelve while merging')) |
378 False, cmdutil.recordfilter, *pats, **opts) | 385 False, cmdutil.recordfilter, *pats, **opts) |
379 if not node: | 386 if not node: |
380 _nothingtoshelvemessaging(ui, repo, pats, opts) | 387 _nothingtoshelvemessaging(ui, repo, pats, opts) |
381 return 1 | 388 return 1 |
382 | 389 |
383 bases = list(mutableancestors(repo[node])) | 390 _shelvecreatedcommit(repo, node, name) |
384 shelvedfile(repo, name, 'hg').writebundle(bases, node) | |
385 cmdutil.export(repo, [node], | |
386 fp=shelvedfile(repo, name, 'patch').opener('wb'), | |
387 opts=mdiff.diffopts(git=True)) | |
388 | |
389 | 391 |
390 if ui.formatted(): | 392 if ui.formatted(): |
391 desc = util.ellipsis(desc, ui.termwidth()) | 393 desc = util.ellipsis(desc, ui.termwidth()) |
392 ui.status(_('shelved as %s\n') % name) | 394 ui.status(_('shelved as %s\n') % name) |
393 hg.update(repo, parent.node()) | 395 hg.update(repo, parent.node()) |