# HG changeset patch # User Jordi GutiƩrrez Hermoso # Date 1553274206 14400 # Node ID 9b78bbb761118802df2e0f3a88d57f553cb82c6d # Parent 22278dae287c74017c5d5ad829ba0d5f70008bd1 shelve: refactor _shelvecreatedcommit's match object into calling site We might need to use this match object again to move the dirstate in case the user requested to `--keep` the changes. diff -r 22278dae287c -r 9b78bbb76111 hgext/shelve.py --- a/hgext/shelve.py Fri Mar 22 11:24:23 2019 -0400 +++ b/hgext/shelve.py Fri Mar 22 13:03:26 2019 -0400 @@ -420,14 +420,11 @@ else: ui.status(_("nothing changed\n")) -def _shelvecreatedcommit(repo, node, name): +def _shelvecreatedcommit(repo, node, name, match): info = {'node': nodemod.hex(node)} shelvedfile(repo, name, 'shelve').writeinfo(info) bases = list(mutableancestors(repo[node])) shelvedfile(repo, name, 'hg').writebundle(bases, node) - # Create a matcher so that prefetch doesn't attempt to fetch the entire - # repository pointlessly. - match = scmutil.matchfiles(repo, repo[node].files()) with shelvedfile(repo, name, patchextension).opener('wb') as fp: cmdutil.exportfile(repo, [node], fp, opts=mdiff.diffopts(git=True), match=match) @@ -501,7 +498,10 @@ _nothingtoshelvemessaging(ui, repo, pats, opts) return 1 - _shelvecreatedcommit(repo, node, name) + # Create a matcher so that prefetch doesn't attempt to fetch + # the entire repository pointlessly + match = scmutil.matchfiles(repo, repo[node].files()) + _shelvecreatedcommit(repo, node, name, match) if ui.formatted(): desc = stringutil.ellipsis(desc, ui.termwidth())