This makes it a little clearer that it isn't a repository operation.
Details
Details
Diff Detail
Diff Detail
- Repository
- rHG Mercurial
- Branch
- default
- Lint
No Linters Available - Unit
No Unit Test Coverage
This makes it a little clearer that it isn't a repository operation.
No Linters Available |
No Unit Test Coverage |
Path | Packages | |||
---|---|---|---|---|
M | hgext/phabricator.py (12 lines) |
Commit | Parents | Author | Summary | Date |
---|---|---|---|---|
de1ffbab8bd7 | 1e508097f570 | Matt Harbison | Feb 17 2020, 1:01 PM |
Status | Author | Revision | |
---|---|---|---|
Closed | mharbison72 | ||
Closed | mharbison72 | ||
Closed | mharbison72 | ||
Closed | mharbison72 | ||
Closed | mharbison72 | ||
Closed | mharbison72 | ||
Closed | mharbison72 | ||
Closed | mharbison72 | ||
Closed | mharbison72 | ||
Closed | mharbison72 |
meta[b'date'] = b'%s 0' % diff[b'dateCreated'] | meta[b'date'] = b'%s 0' % diff[b'dateCreated'] | ||||
if b'branch' not in meta and diff.get(b'branch'): | if b'branch' not in meta and diff.get(b'branch'): | ||||
meta[b'branch'] = diff[b'branch'] | meta[b'branch'] = diff[b'branch'] | ||||
if b'parent' not in meta and diff.get(b'sourceControlBaseRevision'): | if b'parent' not in meta and diff.get(b'sourceControlBaseRevision'): | ||||
meta[b'parent'] = diff[b'sourceControlBaseRevision'] | meta[b'parent'] = diff[b'sourceControlBaseRevision'] | ||||
return meta | return meta | ||||
def readpatch(repo, drevs, write): | def readpatch(ui, drevs, write): | ||||
"""generate plain-text patch readable by 'hg import' | """generate plain-text patch readable by 'hg import' | ||||
write is usually ui.write. drevs is what "querydrev" returns, results of | write is usually ui.write. drevs is what "querydrev" returns, results of | ||||
"differential.query". | "differential.query". | ||||
""" | """ | ||||
# Prefetch hg:meta property for all diffs | # Prefetch hg:meta property for all diffs | ||||
diffids = sorted(set(max(int(v) for v in drev[b'diffs']) for drev in drevs)) | diffids = sorted(set(max(int(v) for v in drev[b'diffs']) for drev in drevs)) | ||||
diffs = callconduit(repo.ui, b'differential.querydiffs', {b'ids': diffids}) | diffs = callconduit(ui, b'differential.querydiffs', {b'ids': diffids}) | ||||
# Generate patch for each drev | # Generate patch for each drev | ||||
for drev in drevs: | for drev in drevs: | ||||
repo.ui.note(_(b'reading D%s\n') % drev[b'id']) | ui.note(_(b'reading D%s\n') % drev[b'id']) | ||||
diffid = max(int(v) for v in drev[b'diffs']) | diffid = max(int(v) for v in drev[b'diffs']) | ||||
body = callconduit( | body = callconduit(ui, b'differential.getrawdiff', {b'diffID': diffid}) | ||||
repo.ui, b'differential.getrawdiff', {b'diffID': diffid} | |||||
) | |||||
desc = getdescfromdrev(drev) | desc = getdescfromdrev(drev) | ||||
header = b'# HG changeset patch\n' | header = b'# HG changeset patch\n' | ||||
# Try to preserve metadata from hg:meta property. Write hg patch | # Try to preserve metadata from hg:meta property. Write hg patch | ||||
# headers that can be read by the "import" command. See patchheadermap | # headers that can be read by the "import" command. See patchheadermap | ||||
# and extract in mercurial/patch.py for supported headers. | # and extract in mercurial/patch.py for supported headers. | ||||
meta = getdiffmeta(diffs[b'%d' % diffid]) | meta = getdiffmeta(diffs[b'%d' % diffid]) | ||||
for k in _metanamemap.keys(): | for k in _metanamemap.keys(): | ||||
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, spec) | drevs = querydrev(repo, spec) | ||||
readpatch(repo, drevs, ui.write) | readpatch(repo.ui, drevs, ui.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')), |