phabricator: pass ui instead of repo to `querydrev()`
authorMatt Harbison <matt_harbison@yahoo.com>
Mon, 17 Feb 2020 13:08:01 -0500
changeset 44419 df8053082364
parent 44418 41217dfa7a6d
child 44420 ddcb51390891
phabricator: pass ui instead of repo to `querydrev()` Also not a repository operation. Differential Revision: https://phab.mercurial-scm.org/D8206
hgext/phabricator.py
--- a/hgext/phabricator.py	Mon Feb 17 13:01:16 2020 -0500
+++ b/hgext/phabricator.py	Mon Feb 17 13:08:01 2020 -0500
@@ -1183,7 +1183,7 @@
         else:
             # Nothing changed. But still set "newrevphid" so the next revision
             # could depend on this one and "newrevid" for the summary line.
-            newrevphid = querydrev(repo, b'%d' % revid)[0][b'phid']
+            newrevphid = querydrev(repo.ui, b'%d' % revid)[0][b'phid']
             newrevid = revid
             action = b'skipped'
 
@@ -1398,7 +1398,7 @@
     return drevs, ancestordrevs
 
 
-def querydrev(repo, spec):
+def querydrev(ui, spec):
     """return a list of "Differential Revision" dicts
 
     spec is a string using a simple query language, see docstring in phabread
@@ -1449,7 +1449,7 @@
         key = (params.get(b'ids') or params.get(b'phids') or [None])[0]
         if key in prefetched:
             return prefetched[key]
-        drevs = callconduit(repo.ui, b'differential.query', params)
+        drevs = callconduit(ui, b'differential.query', params)
         # Fill prefetched with the result
         for drev in drevs:
             prefetched[drev[b'phid']] = drev
@@ -1486,7 +1486,7 @@
     drevs, ancestordrevs = _prefetchdrevs(tree)
 
     # developer config: phabricator.batchsize
-    batchsize = repo.ui.configint(b'phabricator', b'batchsize')
+    batchsize = ui.configint(b'phabricator', b'batchsize')
 
     # Prefetch Differential Revisions in batch
     tofetch = set(drevs)
@@ -1668,7 +1668,7 @@
     opts = pycompat.byteskwargs(opts)
     if opts.get(b'stack'):
         spec = b':(%s)' % spec
-    drevs = querydrev(repo, spec)
+    drevs = querydrev(repo.ui, spec)
     readpatch(repo.ui, drevs, ui.write)
 
 
@@ -1698,7 +1698,7 @@
     for f in flags:
         actions.append({b'type': f, b'value': True})
 
-    drevs = querydrev(repo, spec)
+    drevs = querydrev(repo.ui, spec)
     for i, drev in enumerate(drevs):
         if i + 1 == len(drevs) and opts.get(b'comment'):
             actions.append({b'type': b'comment', b'value': opts[b'comment']})