Also not a repository operation.
Details
Details
Diff Detail
Diff Detail
- Repository
- rHG Mercurial
- Lint
Automatic diff as part of commit; lint not applicable. - Unit
Automatic diff as part of commit; unit tests not applicable.
Also not a repository operation.
Automatic diff as part of commit; lint not applicable. |
Automatic diff as part of commit; unit tests not applicable. |
Path | Packages | |||
---|---|---|---|---|
M | hgext/phabricator.py (11 lines) |
Status | Author | Revision | |
---|---|---|---|
Closed | mharbison72 | ||
Closed | mharbison72 | ||
Closed | mharbison72 | ||
Closed | mharbison72 | ||
Closed | mharbison72 | ||
Closed | mharbison72 | ||
Closed | mharbison72 | ||
Closed | mharbison72 | ||
Closed | mharbison72 | ||
Closed | mharbison72 |
revision = callconduit(repo.ui, b'differential.revision.edit', params) | revision = callconduit(repo.ui, b'differential.revision.edit', params) | ||||
if not revision: | if not revision: | ||||
raise error.Abort(_(b'cannot create revision for %s') % ctx) | raise error.Abort(_(b'cannot create revision for %s') % ctx) | ||||
return revision, diff | return revision, diff | ||||
def userphids(repo, names): | def userphids(ui, names): | ||||
"""convert user names to PHIDs""" | """convert user names to PHIDs""" | ||||
names = [name.lower() for name in names] | names = [name.lower() for name in names] | ||||
query = {b'constraints': {b'usernames': 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 | # username not found is not an error of the API. So check if we have missed | ||||
# some names here. | # some names here. | ||||
data = result[b'data'] | data = result[b'data'] | ||||
resolved = set(entry[b'fields'][b'username'].lower() for entry in data) | resolved = set(entry[b'fields'][b'username'].lower() for entry in data) | ||||
unresolved = set(names) - resolved | unresolved = set(names) - resolved | ||||
if unresolved: | if unresolved: | ||||
raise error.Abort( | raise error.Abort( | ||||
_(b'unknown username: %s') % b' '.join(sorted(unresolved)) | _(b'unknown username: %s') % b' '.join(sorted(unresolved)) | ||||
if not confirmed: | if not confirmed: | ||||
raise error.Abort(_(b'phabsend cancelled')) | raise error.Abort(_(b'phabsend cancelled')) | ||||
actions = [] | actions = [] | ||||
reviewers = opts.get(b'reviewer', []) | reviewers = opts.get(b'reviewer', []) | ||||
blockers = opts.get(b'blocker', []) | blockers = opts.get(b'blocker', []) | ||||
phids = [] | phids = [] | ||||
if reviewers: | if reviewers: | ||||
phids.extend(userphids(repo, reviewers)) | phids.extend(userphids(repo.ui, reviewers)) | ||||
if blockers: | if blockers: | ||||
phids.extend( | 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: | if phids: | ||||
actions.append({b'type': b'reviewers.add', b'value': phids}) | actions.append({b'type': b'reviewers.add', b'value': phids}) | ||||
drevids = [] # [int] | drevids = [] # [int] | ||||
diffmap = {} # {newnode: diff} | diffmap = {} # {newnode: diff} | ||||
# Send patches one by one so we know their Differential Revision PHIDs and | # Send patches one by one so we know their Differential Revision PHIDs and |