phabricator: pass ui instead of repo to `userphids()`
authorMatt Harbison <matt_harbison@yahoo.com>
Mon, 17 Feb 2020 13:28:40 -0500
changeset 44420 ddcb51390891
parent 44419 df8053082364
child 44421 b715432fabba
phabricator: pass ui instead of repo to `userphids()` Also not a repository operation. Differential Revision: https://phab.mercurial-scm.org/D8207
hgext/phabricator.py
--- a/hgext/phabricator.py	Mon Feb 17 13:08:01 2020 -0500
+++ b/hgext/phabricator.py	Mon Feb 17 13:28:40 2020 -0500
@@ -1040,11 +1040,11 @@
     return revision, diff
 
 
-def userphids(repo, names):
+def userphids(ui, names):
     """convert user names to PHIDs"""
     names = [name.lower() for name in names]
     query = {b'constraints': {b'usernames': names}}
-    result = callconduit(repo.ui, b'user.search', query)
+    result = callconduit(ui, b'user.search', query)
     # username not found is not an error of the API. So check if we have missed
     # some names here.
     data = result[b'data']
@@ -1127,10 +1127,13 @@
     blockers = opts.get(b'blocker', [])
     phids = []
     if reviewers:
-        phids.extend(userphids(repo, reviewers))
+        phids.extend(userphids(repo.ui, reviewers))
     if blockers:
         phids.extend(
-            map(lambda phid: b'blocking(%s)' % phid, userphids(repo, blockers))
+            map(
+                lambda phid: b'blocking(%s)' % phid,
+                userphids(repo.ui, blockers),
+            )
         )
     if phids:
         actions.append({b'type': b'reviewers.add', b'value': phids})