D8852: phabricator: unconditionally pop `test_vcr` from kwargs to fix debugcallconduit

classic Classic list List threaded Threaded
1 message Options
Reply | Threaded
Open this post in threaded view
|

D8852: phabricator: unconditionally pop `test_vcr` from kwargs to fix debugcallconduit

pulkit (Pulkit Goyal)
Kwan created this revision.
Herald added a reviewer: hg-reviewers.
Herald added a subscriber: mercurial-patches.

REVISION SUMMARY
  11592ce6a711 <https://phab.mercurial-scm.org/rHG11592ce6a7119a5ea2779e914ff21833171ba6f8> / D8525 <https://phab.mercurial-scm.org/D8525> accidentally broke debugcallconduit in non-test scenarios
  because it stopped popping `test_vcr` from `kwargs` unconditionally, so when
  `--test-vcr` isn't set the empty string still gets passed down as the value of
  `test_vcr` in `kwargs`.  However unlike all the other commands debugcallconduit
  doesn't have an `**opts` argument to receive it, so it aborts because of
  invalid arguments.

REPOSITORY
  rHG Mercurial

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

AFFECTED FILES
  hgext/phabricator.py
  tests/test-phabricator.t

CHANGE DETAILS

diff --git a/tests/test-phabricator.t b/tests/test-phabricator.t
--- a/tests/test-phabricator.t
+++ b/tests/test-phabricator.t
@@ -24,16 +24,9 @@
   > EOF
   $ VCR="$TESTDIR/phabricator"
 
-BROKEN: debugcallconduit fails without --test-vcr:
+debugcallconduit doesn't claim invalid arguments without --test-vcr:
   $ echo '{}' | HGRCSKIPREPO= hg debugcallconduit 'conduit.ping'
-  hg debugcallconduit: invalid arguments
-  hg debugcallconduit METHOD
-  
-  call Conduit API
-  
-  options:
-  
-  (use 'hg debugcallconduit -h' to show more help)
+  abort: config phabricator.url is required
   [255]
 
 Error is handled reasonably. We override the phabtoken here so that
diff --git a/hgext/phabricator.py b/hgext/phabricator.py
--- a/hgext/phabricator.py
+++ b/hgext/phabricator.py
@@ -238,8 +238,9 @@
 
     def decorate(fn):
         def inner(*args, **kwargs):
-            if kwargs.get('test_vcr'):
-                cassette = pycompat.fsdecode(kwargs.pop('test_vcr'))
+            vcr = kwargs.pop('test_vcr')
+            if vcr:
+                cassette = pycompat.fsdecode(vcr)
                 import hgdemandimport
 
                 with hgdemandimport.deactivated():



To: Kwan, #hg-reviewers
Cc: mercurial-patches, mercurial-devel
_______________________________________________
Mercurial-devel mailing list
[hidden email]
https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel