phabricator: make `hg phabread` work outside of a repository
authorMatt Harbison <matt_harbison@yahoo.com>
Wed, 04 Mar 2020 10:25:07 -0500
changeset 44423 5e2d74e5f450
parent 44422 d5d262c7e7a2
child 44424 98f7b9cf7bfc
phabricator: make `hg phabread` work outside of a repository This is similar to 16312ea45a8b and 2513f0f70a26- we don't need a repo, but will load .hg/hgrc if inside one. Differential Revision: https://phab.mercurial-scm.org/D8214
hgext/phabricator.py
--- a/hgext/phabricator.py	Sun Feb 16 15:06:20 2020 -0500
+++ b/hgext/phabricator.py	Wed Mar 04 10:25:07 2020 -0500
@@ -1655,6 +1655,7 @@
     [(b'', b'stack', False, _(b'read dependencies'))],
     _(b'DREVSPEC [OPTIONS]'),
     helpcategory=command.CATEGORY_IMPORT_EXPORT,
+    optionalrepo=True,
 )
 def phabread(ui, repo, spec, **opts):
     """print patches from Phabricator suitable for importing
@@ -1678,13 +1679,13 @@
     opts = pycompat.byteskwargs(opts)
     if opts.get(b'stack'):
         spec = b':(%s)' % spec
-    drevs = querydrev(repo.ui, spec)
+    drevs = querydrev(ui, spec)
 
     def _write(patches):
         for drev, content in patches:
             ui.write(content)
 
-    readpatch(repo.ui, drevs, _write)
+    readpatch(ui, drevs, _write)
 
 
 @vcrcommand(