Patchwork D6499: phabricator: make `hg debugcallconduit` work outside a hg repo

login
register
mail settings
Submitter phabricator
Date June 8, 2019, 4:07 p.m.
Message ID <differential-rev-PHID-DREV-ryzcgypil44wkgjszltg-req@phab.mercurial-scm.org>
Download mbox | patch
Permalink /patch/40368/
State Superseded
Headers show

Comments

phabricator - June 8, 2019, 4:07 p.m.
pulkit created this revision.
Herald added subscribers: mercurial-devel, Kwan.
Herald added a reviewer: hg-reviewers.

REVISION SUMMARY
  I am trying to write some automations around phabricator and having
  debugcallconduit work outside a hg repo will be nice!

REPOSITORY
  rHG Mercurial

REVISION DETAIL
  https://phab.mercurial-scm.org/D6499

AFFECTED FILES
  hgext/phabricator.py

CHANGE DETAILS




To: pulkit, #hg-reviewers
Cc: Kwan, mercurial-devel
Yuya Nishihara - June 9, 2019, 1:42 a.m.
> -@vcrcommand(b'debugcallconduit', [], _(b'METHOD'))
> -def debugcallconduit(ui, repo, name):
> +@vcrcommand(b'debugcallconduit', [], _(b'METHOD'), norepo=True)
> +def debugcallconduit(ui, name):

Maybe optionalrepo to load repo/.hg/hgrc?
phabricator - June 9, 2019, 1:51 a.m.
yuja added a comment.


  > -@vcrcommand(b'debugcallconduit', [], _(b'METHOD'))
  >  -def debugcallconduit(ui, repo, name):
  >  +@vcrcommand(b'debugcallconduit', [], _(b'METHOD'), norepo=True)
  >  +def debugcallconduit(ui, name):
  
  Maybe optionalrepo to load repo/.hg/hgrc?

REPOSITORY
  rHG Mercurial

REVISION DETAIL
  https://phab.mercurial-scm.org/D6499

To: pulkit, #hg-reviewers
Cc: yuja, Kwan, mercurial-devel

Patch

diff --git a/hgext/phabricator.py b/hgext/phabricator.py
--- a/hgext/phabricator.py
+++ b/hgext/phabricator.py
@@ -125,7 +125,7 @@ 
      )),
 ]
 
-def vcrcommand(name, flags, spec, helpcategory=None):
+def vcrcommand(name, flags, spec, helpcategory=None, norepo=False):
     fullflags = flags + _VCR_FLAGS
     def hgmatcher(r1, r2):
         if r1.uri != r2.uri or r1.method != r2.method:
@@ -156,7 +156,8 @@ 
             return fn(*args, **kwargs)
         inner.__name__ = fn.__name__
         inner.__doc__ = fn.__doc__
-        return command(name, fullflags, spec, helpcategory=helpcategory)(inner)
+        return command(name, fullflags, spec, helpcategory=helpcategory,
+                       norepo=norepo)(inner)
     return decorate
 
 def urlencodenested(params):
@@ -242,8 +243,8 @@ 
         raise error.Abort(msg)
     return parsed[b'result']
 
-@vcrcommand(b'debugcallconduit', [], _(b'METHOD'))
-def debugcallconduit(ui, repo, name):
+@vcrcommand(b'debugcallconduit', [], _(b'METHOD'), norepo=True)
+def debugcallconduit(ui, name):
     """call Conduit API
 
     Call parameters are read from stdin as a JSON blob. Result will be written