Mercurial > public > mercurial-scm > hg-stable
diff hgext/shelve.py @ 37603:678d760c71ff
export: extract function to write patch to file object (API)
This is common use case of cmdutil.export(), and we wouldn't want to handle
formatter thingy everywhere.
.. api::
The ``fp`` argument is removed from ``cmdutil.export()``. Use
``cmdutil.exportfile()`` instead.
author | Yuya Nishihara <yuya@tcha.org> |
---|---|
date | Thu, 12 Apr 2018 22:59:49 +0900 |
parents | f0b6fbea00cf |
children | 7932be8b0559 |
line wrap: on
line diff
--- a/hgext/shelve.py Thu Apr 12 22:39:43 2018 +0900 +++ b/hgext/shelve.py Thu Apr 12 22:59:49 2018 +0900 @@ -413,9 +413,8 @@ def _shelvecreatedcommit(repo, node, name): bases = list(mutableancestors(repo[node])) shelvedfile(repo, name, 'hg').writebundle(bases, node) - cmdutil.export(repo, [node], - fp=shelvedfile(repo, name, patchextension).opener('wb'), - opts=mdiff.diffopts(git=True)) + with shelvedfile(repo, name, patchextension).opener('wb') as fp: + cmdutil.exportfile(repo, [node], fp, opts=mdiff.diffopts(git=True)) def _includeunknownfiles(repo, pats, opts, extra): s = repo.status(match=scmutil.match(repo[None], pats, opts),