Mercurial > public > mercurial-scm > hg
comparison hgext/phabricator.py @ 44423:5e2d74e5f450
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
author | Matt Harbison <matt_harbison@yahoo.com> |
---|---|
date | Wed, 04 Mar 2020 10:25:07 -0500 |
parents | d5d262c7e7a2 |
children | 98f7b9cf7bfc |
comparison
equal
deleted
inserted
replaced
44422:d5d262c7e7a2 | 44423:5e2d74e5f450 |
---|---|
1653 @vcrcommand( | 1653 @vcrcommand( |
1654 b'phabread', | 1654 b'phabread', |
1655 [(b'', b'stack', False, _(b'read dependencies'))], | 1655 [(b'', b'stack', False, _(b'read dependencies'))], |
1656 _(b'DREVSPEC [OPTIONS]'), | 1656 _(b'DREVSPEC [OPTIONS]'), |
1657 helpcategory=command.CATEGORY_IMPORT_EXPORT, | 1657 helpcategory=command.CATEGORY_IMPORT_EXPORT, |
1658 optionalrepo=True, | |
1658 ) | 1659 ) |
1659 def phabread(ui, repo, spec, **opts): | 1660 def phabread(ui, repo, spec, **opts): |
1660 """print patches from Phabricator suitable for importing | 1661 """print patches from Phabricator suitable for importing |
1661 | 1662 |
1662 DREVSPEC could be a Differential Revision identity, like ``D123``, or just | 1663 DREVSPEC could be a Differential Revision identity, like ``D123``, or just |
1676 It is equivalent to the ``:`` operator. | 1677 It is equivalent to the ``:`` operator. |
1677 """ | 1678 """ |
1678 opts = pycompat.byteskwargs(opts) | 1679 opts = pycompat.byteskwargs(opts) |
1679 if opts.get(b'stack'): | 1680 if opts.get(b'stack'): |
1680 spec = b':(%s)' % spec | 1681 spec = b':(%s)' % spec |
1681 drevs = querydrev(repo.ui, spec) | 1682 drevs = querydrev(ui, spec) |
1682 | 1683 |
1683 def _write(patches): | 1684 def _write(patches): |
1684 for drev, content in patches: | 1685 for drev, content in patches: |
1685 ui.write(content) | 1686 ui.write(content) |
1686 | 1687 |
1687 readpatch(repo.ui, drevs, _write) | 1688 readpatch(ui, drevs, _write) |
1688 | 1689 |
1689 | 1690 |
1690 @vcrcommand( | 1691 @vcrcommand( |
1691 b'phabupdate', | 1692 b'phabupdate', |
1692 [ | 1693 [ |