##// END OF EJS Templates
phabricator: avoid calling differential.getcommitmessage...
Jun Wu -
r33268:85391b95 default
parent child Browse files
Show More
@@ -307,8 +307,6 b' def phabsend(ui, repo, *revs, **opts):'
307 307 ctx.description().split('\n')[0]))
308 308 lastrevid = newrevid
309 309
310 _summaryre = re.compile('^Summary:\s*', re.M)
311
312 310 # Map from "hg:meta" keys to header understood by "hg import". The order is
313 311 # consistent with "hg export" output.
314 312 _metanamemap = util.sortdict([(r'user', 'User'), (r'date', 'Date'),
@@ -377,6 +375,20 b' def querydrev(repo, params, stack=False)'
377 375 result.reverse()
378 376 return result
379 377
378 def getdescfromdrev(drev):
379 """get description (commit message) from "Differential Revision"
380
381 This is similar to differential.getcommitmessage API. But we only care
382 about limited fields: title, summary, test plan, and URL.
383 """
384 title = drev[r'title']
385 summary = drev[r'summary'].rstrip()
386 testplan = drev[r'testPlan'].rstrip()
387 if testplan:
388 testplan = 'Test Plan:\n%s' % testplan
389 uri = 'Differential Revision: %s' % drev[r'uri']
390 return '\n\n'.join(filter(None, [title, summary, testplan, uri]))
391
380 392 def readpatch(repo, params, write, stack=False):
381 393 """generate plain-text patch readable by 'hg import'
382 394
@@ -396,13 +408,9 b' def readpatch(repo, params, write, stack'
396 408
397 409 diffid = max(int(v) for v in drev[r'diffs'])
398 410 body = callconduit(repo, 'differential.getrawdiff', {'diffID': diffid})
399 desc = callconduit(repo, 'differential.getcommitmessage',
400 {'revision_id': drev[r'id']})
411 desc = getdescfromdrev(drev)
401 412 header = '# HG changeset patch\n'
402 413
403 # Remove potential empty "Summary:"
404 desc = _summaryre.sub('', desc)
405
406 414 # Try to preserve metadata from hg:meta property. Write hg patch
407 415 # headers that can be read by the "import" command. See patchheadermap
408 416 # and extract in mercurial/patch.py for supported headers.
General Comments 0
You need to be logged in to leave comments. Login now