1682 |
1682 |
1683 return templateutil.hybriddict({b'url': url, b'id': t,}) |
1683 return templateutil.hybriddict({b'url': url, b'id': t,}) |
1684 return None |
1684 return None |
1685 |
1685 |
1686 |
1686 |
|
1687 @eh.templatekeyword(b'phabstatus', requires={b'ctx', b'repo', b'ui'}) |
|
1688 def template_status(context, mapping): |
|
1689 """:phabstatus: String. Status of Phabricator differential. |
|
1690 """ |
|
1691 ctx = context.resource(mapping, b'ctx') |
|
1692 repo = context.resource(mapping, b'repo') |
|
1693 ui = context.resource(mapping, b'ui') |
|
1694 |
|
1695 rev = ctx.rev() |
|
1696 try: |
|
1697 drevid = getdrevmap(repo, [rev])[rev] |
|
1698 except KeyError: |
|
1699 return None |
|
1700 drevs = callconduit(ui, b'differential.query', {b'ids': [drevid]}) |
|
1701 for drev in drevs: |
|
1702 if int(drev[b'id']) == drevid: |
|
1703 return templateutil.hybriddict( |
|
1704 {b'url': drev[b'uri'], b'status': drev[b'statusName'],} |
|
1705 ) |
|
1706 return None |
|
1707 |
|
1708 |
1687 @show.showview(b'phabstatus', csettopic=b'work') |
1709 @show.showview(b'phabstatus', csettopic=b'work') |
1688 def phabstatusshowview(ui, repo, displayer): |
1710 def phabstatusshowview(ui, repo, displayer): |
1689 """Phabricator differiential status""" |
1711 """Phabricator differiential status""" |
1690 revs = repo.revs('sort(_underway(), topo)') |
1712 revs = repo.revs('sort(_underway(), topo)') |
1691 drevmap = getdrevmap(repo, revs) |
1713 drevmap = getdrevmap(repo, revs) |