phabricator: pass ui instead of repo to `readpatch()`
This makes it a little clearer that it isn't a repository operation.
Differential Revision: https://phab.mercurial-scm.org/D8205
--- a/hgext/phabricator.py Mon Mar 02 14:36:20 2020 -0500
+++ b/hgext/phabricator.py Mon Feb 17 13:01:16 2020 -0500
@@ -1609,7 +1609,7 @@
return meta
-def readpatch(repo, drevs, write):
+def readpatch(ui, drevs, write):
"""generate plain-text patch readable by 'hg import'
write is usually ui.write. drevs is what "querydrev" returns, results of
@@ -1617,16 +1617,14 @@
"""
# Prefetch hg:meta property for all diffs
diffids = sorted(set(max(int(v) for v in drev[b'diffs']) for drev in drevs))
- diffs = callconduit(repo.ui, b'differential.querydiffs', {b'ids': diffids})
+ diffs = callconduit(ui, b'differential.querydiffs', {b'ids': diffids})
# Generate patch for each drev
for drev in drevs:
- repo.ui.note(_(b'reading D%s\n') % drev[b'id'])
+ ui.note(_(b'reading D%s\n') % drev[b'id'])
diffid = max(int(v) for v in drev[b'diffs'])
- body = callconduit(
- repo.ui, b'differential.getrawdiff', {b'diffID': diffid}
- )
+ body = callconduit(ui, b'differential.getrawdiff', {b'diffID': diffid})
desc = getdescfromdrev(drev)
header = b'# HG changeset patch\n'
@@ -1671,7 +1669,7 @@
if opts.get(b'stack'):
spec = b':(%s)' % spec
drevs = querydrev(repo, spec)
- readpatch(repo, drevs, ui.write)
+ readpatch(repo.ui, drevs, ui.write)
@vcrcommand(