This is similar to 16312ea45a8b and 2513f0f70a26- we don't need a repo, but will
load .hg/hgrc if inside one.
Details
Details
Diff Detail
Diff Detail
- Repository
- rHG Mercurial
- Branch
- default
- Lint
No Linters Available - Unit
No Unit Test Coverage
This is similar to 16312ea45a8b and 2513f0f70a26- we don't need a repo, but will
load .hg/hgrc if inside one.
No Linters Available |
No Unit Test Coverage |
Path | Packages | |||
---|---|---|---|---|
M | hgext/phabricator.py (5 lines) |
Commit | Parents | Author | Summary | Date |
---|---|---|---|---|
a161a993f253 | ee5ea026ba8f | Matt Harbison | Mar 4 2020, 10:25 AM |
write(patches) | write(patches) | ||||
@vcrcommand( | @vcrcommand( | ||||
b'phabread', | b'phabread', | ||||
[(b'', b'stack', False, _(b'read dependencies'))], | [(b'', b'stack', False, _(b'read dependencies'))], | ||||
_(b'DREVSPEC [OPTIONS]'), | _(b'DREVSPEC [OPTIONS]'), | ||||
helpcategory=command.CATEGORY_IMPORT_EXPORT, | helpcategory=command.CATEGORY_IMPORT_EXPORT, | ||||
optionalrepo=True, | |||||
) | ) | ||||
def phabread(ui, repo, spec, **opts): | def phabread(ui, repo, spec, **opts): | ||||
"""print patches from Phabricator suitable for importing | """print patches from Phabricator suitable for importing | ||||
DREVSPEC could be a Differential Revision identity, like ``D123``, or just | DREVSPEC could be a Differential Revision identity, like ``D123``, or just | ||||
the number ``123``. It could also have common operators like ``+``, ``-``, | the number ``123``. It could also have common operators like ``+``, ``-``, | ||||
``&``, ``(``, ``)`` for complex queries. Prefix ``:`` could be used to | ``&``, ``(``, ``)`` for complex queries. Prefix ``:`` could be used to | ||||
select a stack. | select a stack. | ||||
``abandoned``, ``accepted``, ``closed``, ``needsreview``, ``needsrevision`` | ``abandoned``, ``accepted``, ``closed``, ``needsreview``, ``needsrevision`` | ||||
could be used to filter patches by status. For performance reason, they | could be used to filter patches by status. For performance reason, they | ||||
only represent a subset of non-status selections and cannot be used alone. | only represent a subset of non-status selections and cannot be used alone. | ||||
For example, ``:D6+8-(2+D4)`` selects a stack up to D6, plus D8 and exclude | For example, ``:D6+8-(2+D4)`` selects a stack up to D6, plus D8 and exclude | ||||
D2 and D4. ``:D9 & needsreview`` selects "Needs Review" revisions in a | D2 and D4. ``:D9 & needsreview`` selects "Needs Review" revisions in a | ||||
stack up to D9. | stack up to D9. | ||||
If --stack is given, follow dependencies information and read all patches. | If --stack is given, follow dependencies information and read all patches. | ||||
It is equivalent to the ``:`` operator. | It is equivalent to the ``:`` operator. | ||||
""" | """ | ||||
opts = pycompat.byteskwargs(opts) | opts = pycompat.byteskwargs(opts) | ||||
if opts.get(b'stack'): | if opts.get(b'stack'): | ||||
spec = b':(%s)' % spec | spec = b':(%s)' % spec | ||||
drevs = querydrev(repo.ui, spec) | drevs = querydrev(ui, spec) | ||||
def _write(patches): | def _write(patches): | ||||
for drev, content in patches: | for drev, content in patches: | ||||
ui.write(content) | ui.write(content) | ||||
readpatch(repo.ui, drevs, _write) | readpatch(ui, drevs, _write) | ||||
@vcrcommand( | @vcrcommand( | ||||
b'phabupdate', | b'phabupdate', | ||||
[ | [ | ||||
(b'', b'accept', False, _(b'accept revisions')), | (b'', b'accept', False, _(b'accept revisions')), | ||||
(b'', b'reject', False, _(b'reject revisions')), | (b'', b'reject', False, _(b'reject revisions')), | ||||
(b'', b'abandon', False, _(b'abandon revisions')), | (b'', b'abandon', False, _(b'abandon revisions')), |