diff --git a/hgext3rd/phabstatus.py b/hgext3rd/phabstatus.py index 95204806c4..a4718638b4 100644 --- a/hgext3rd/phabstatus.py +++ b/hgext3rd/phabstatus.py @@ -193,5 +193,13 @@ def _getdag(orig, *args): return orig(*args) def extsetup(ui): - smartlog = extensions.find("smartlog") - extensions.wrapfunction(smartlog, 'getdag', _getdag) + def _smartlogloaded(loaded): + smartlog = None + try: + smartlog = extensions.find('smartlog') + except KeyError: + pass + if smartlog: + extensions.wrapfunction(smartlog, 'getdag', _getdag) + + extensions.afterloaded('smartlog', _smartlogloaded) diff --git a/tests/test-phabstatus.t b/tests/test-phabstatus.t index 475bc7e05a..f547135153 100644 --- a/tests/test-phabstatus.t +++ b/tests/test-phabstatus.t @@ -59,6 +59,15 @@ And finally, the success case $ HG_ARC_CONDUIT_MOCK=$TESTTMP/mockduit hg log -T '{phabstatus}\n' -r . Needs Review +Make sure the code works without the smartlog extensions + + $ cat > $TESTTMP/mockduit << EOF + > [{"cmd": ["differential.querydiffhashes", {"revisionIDs": ["1"]}], + > "result": {"1" : {"count": 1, "status": "Needs Review", "hash": "lolwut"}}}] + > EOF + $ HG_ARC_CONDUIT_MOCK=$TESTTMP/mockduit hg --config 'extensions.smartlog=!' log -T '{phabstatus}\n' -r . + Needs Review + Make sure the template keywords are documented correctly $ hg help templates | egrep 'phabstatus|syncstatus'