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

login
register
mail settings
Submitter phabricator
Date March 4, 2020, 1:17 p.m.
Message ID <c8feb86418803929e52f6dfcd8812d3f@localhost.localdomain>
Download mbox | patch
Permalink /patch/45446/
State Not Applicable
Headers show

Comments

phabricator - March 4, 2020, 1:17 p.m.
Closed by commit rHG72c6190de577: phabricator: pass ui instead of repo to `readpatch()` (authored by mharbison72).
This revision was automatically updated to reflect the committed changes.

REPOSITORY
  rHG Mercurial

CHANGES SINCE LAST UPDATE
  https://phab.mercurial-scm.org/D8205?vs=20421&id=20441

CHANGES SINCE LAST ACTION
  https://phab.mercurial-scm.org/D8205/new/

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

AFFECTED FILES
  hgext/phabricator.py

CHANGE DETAILS




To: mharbison72, #hg-reviewers, pulkit
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(