Patchwork D8205: phabricator: pass ui instead of repo to `readpatch()`

login
register
mail settings
Submitter phabricator
Date March 3, 2020, 6:25 p.m.
Message ID <differential-rev-PHID-DREV-42xnmk3odcdz2lwckiym-req@mercurial-scm.org>
Download mbox | patch
Permalink /patch/45426/
State Superseded
Headers show

Comments

phabricator - March 3, 2020, 6:25 p.m.
mharbison72 created this revision.
Herald added subscribers: mercurial-devel, Kwan.
Herald added a reviewer: hg-reviewers.

REVISION SUMMARY
  This makes it a little clearer that it isn't a repository operation.

REPOSITORY
  rHG Mercurial

BRANCH
  default

REVISION DETAIL
  https://phab.mercurial-scm.org/D8205

AFFECTED FILES
  hgext/phabricator.py

CHANGE DETAILS




To: mharbison72, #hg-reviewers
Cc: Kwan, mercurial-devel

Patch

diff --git a/hgext/phabricator.py b/hgext/phabricator.py
--- a/hgext/phabricator.py
+++ b/hgext/phabricator.py
@@ -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(