Details
Details
- Reviewers
- None
- Group Reviewers
hg-reviewers - Commits
- rHG4057e38bba76: phabricator: fix templating bug by using hybriddict
Diff Detail
Diff Detail
- Repository
- rHG Mercurial
- Lint
Lint Skipped - Unit
Unit Tests Skipped
| hg-reviewers |
| Lint Skipped |
| Unit Tests Skipped |
| Path | Packages | |||
|---|---|---|---|---|
| M | hgext/phabricator.py (5 lines) | |||
| M | tests/test-phabricator.t (8 lines) |
| Commit | Parents | Author | Summary | Date |
|---|---|---|---|---|
| Augie Fackler | Sep 15 2018, 1:16 AM |
| mdiff, | mdiff, | ||||
| obsutil, | obsutil, | ||||
| parser, | parser, | ||||
| patch, | patch, | ||||
| registrar, | registrar, | ||||
| scmutil, | scmutil, | ||||
| smartset, | smartset, | ||||
| tags, | tags, | ||||
| templateutil, | |||||
| url as urlmod, | url as urlmod, | ||||
| util, | util, | ||||
| ) | ) | ||||
| from mercurial.utils import ( | from mercurial.utils import ( | ||||
| procutil, | procutil, | ||||
| stringutil, | stringutil, | ||||
| ) | ) | ||||
| @templatekeyword(b'phabreview', requires={b'ctx'}) | @templatekeyword(b'phabreview', requires={b'ctx'}) | ||||
| def template_review(context, mapping): | def template_review(context, mapping): | ||||
| """:phabreview: Object describing the review for this changeset. | """:phabreview: Object describing the review for this changeset. | ||||
| Has attributes `url` and `id`. | Has attributes `url` and `id`. | ||||
| """ | """ | ||||
| ctx = context.resource(mapping, b'ctx') | ctx = context.resource(mapping, b'ctx') | ||||
| m = _differentialrevisiondescre.search(ctx.description()) | m = _differentialrevisiondescre.search(ctx.description()) | ||||
| if m: | if m: | ||||
| return { | return templateutil.hybriddict({ | ||||
| b'url': m.group(b'url'), | b'url': m.group(b'url'), | ||||
| b'id': b"D{}".format(m.group(b'id')), | b'id': b"D{}".format(m.group(b'id')), | ||||
| } | }) | ||||
| D4597 - created - 1a5640df7bbf: create beta for phabricator test | D4597 - created - 1a5640df7bbf: create beta for phabricator test | ||||
| saved backup bundle to $TESTTMP/repo/.hg/strip-backup/1a5640df7bbf-6daf3e6e-phabsend.hg | saved backup bundle to $TESTTMP/repo/.hg/strip-backup/1a5640df7bbf-6daf3e6e-phabsend.hg | ||||
| Template keywords | Template keywords | ||||
| $ hg log -T'{rev} {phabreview|json}\n' | $ hg log -T'{rev} {phabreview|json}\n' | ||||
| 1 {"id": "D4597", "url": "https://phab.mercurial-scm.org/D4597"} | 1 {"id": "D4597", "url": "https://phab.mercurial-scm.org/D4597"} | ||||
| 0 {"id": "D4596", "url": "https://phab.mercurial-scm.org/D4596"} | 0 {"id": "D4596", "url": "https://phab.mercurial-scm.org/D4596"} | ||||
| BUG: this should work, but doesn't. | $ hg log -T'{rev} {phabreview.url} {phabreview.id}\n' | ||||
| $ hg log -T'{rev} {phabreview.url}\n' | 1 https://phab.mercurial-scm.org/D4597 D4597 | ||||
| hg: parse error: {* 'D4597'*} is not a dictionary (glob) | 0 https://phab.mercurial-scm.org/D4596 D4596 | ||||
| (keyword 'phabreview' does not support member operation) | |||||
| [255] | |||||
| $ cd .. | $ cd .. | ||||