Patchwork D124: phabricator: change "readpatch" to be more flexible

login
register
mail settings
Submitter phabricator
Date Aug. 13, 2017, 4:41 a.m.
Message ID <cc71f01a6d2e97523367450af2b4f4ab@localhost.localdomain>
Download mbox | patch
Permalink /patch/22939/
State Not Applicable
Headers show

Comments

phabricator - Aug. 13, 2017, 4:41 a.m.
quark updated this revision to Diff 839.

REPOSITORY
  rHG Mercurial

CHANGES SINCE LAST UPDATE
  https://phab.mercurial-scm.org/D124?vs=569&id=839

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

AFFECTED FILES
  contrib/phabricator.py

CHANGE DETAILS




To: quark, #hg-reviewers, mitrandir
Cc: mercurial-devel

Patch

diff --git a/contrib/phabricator.py b/contrib/phabricator.py
--- a/contrib/phabricator.py
+++ b/contrib/phabricator.py
@@ -635,15 +635,12 @@ 
             meta[r'parent'] = commit[r'parents'][0]
     return meta or {}
 
-def readpatch(repo, params, write, stack=False):
+def readpatch(repo, drevs, write):
     """generate plain-text patch readable by 'hg import'
 
-    write is usually ui.write. params is passed to "differential.query". If
-    stack is True, also write dependent patches.
+    write is usually ui.write. drevs is what "querydrev" returns, results of
+    "differential.query".
     """
-    # Differential Revisions
-    drevs = querydrev(repo, params, stack)
-
     # Prefetch hg:meta property for all diffs
     diffids = sorted(set(max(int(v) for v in drev[r'diffs']) for drev in drevs))
     diffs = callconduit(repo, 'differential.querydiffs', {'ids': diffids})
@@ -683,4 +680,5 @@ 
         revid = int(revid.split('/')[-1].replace('D', ''))
     except ValueError:
         raise error.Abort(_('invalid Revision ID: %s') % revid)
-    readpatch(repo, {'ids': [revid]}, ui.write, opts.get('stack'))
+    drevs = querydrev(repo, {'ids': [revid]}, opts.get('stack'))
+    readpatch(repo, drevs, ui.write)