Show More
@@ -307,8 +307,6 b' def phabsend(ui, repo, *revs, **opts):' | |||||
307 | ctx.description().split('\n')[0])) |
|
307 | ctx.description().split('\n')[0])) | |
308 | lastrevid = newrevid |
|
308 | lastrevid = newrevid | |
309 |
|
309 | |||
310 | _summaryre = re.compile('^Summary:\s*', re.M) |
|
|||
311 |
|
||||
312 | # Map from "hg:meta" keys to header understood by "hg import". The order is |
|
310 | # Map from "hg:meta" keys to header understood by "hg import". The order is | |
313 | # consistent with "hg export" output. |
|
311 | # consistent with "hg export" output. | |
314 | _metanamemap = util.sortdict([(r'user', 'User'), (r'date', 'Date'), |
|
312 | _metanamemap = util.sortdict([(r'user', 'User'), (r'date', 'Date'), | |
@@ -377,6 +375,20 b' def querydrev(repo, params, stack=False)' | |||||
377 | result.reverse() |
|
375 | result.reverse() | |
378 | return result |
|
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 | def readpatch(repo, params, write, stack=False): |
|
392 | def readpatch(repo, params, write, stack=False): | |
381 | """generate plain-text patch readable by 'hg import' |
|
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 | diffid = max(int(v) for v in drev[r'diffs']) |
|
409 | diffid = max(int(v) for v in drev[r'diffs']) | |
398 | body = callconduit(repo, 'differential.getrawdiff', {'diffID': diffid}) |
|
410 | body = callconduit(repo, 'differential.getrawdiff', {'diffID': diffid}) | |
399 | desc = callconduit(repo, 'differential.getcommitmessage', |
|
411 | desc = getdescfromdrev(drev) | |
400 | {'revision_id': drev[r'id']}) |
|
|||
401 | header = '# HG changeset patch\n' |
|
412 | header = '# HG changeset patch\n' | |
402 |
|
413 | |||
403 | # Remove potential empty "Summary:" |
|
|||
404 | desc = _summaryre.sub('', desc) |
|
|||
405 |
|
||||
406 | # Try to preserve metadata from hg:meta property. Write hg patch |
|
414 | # Try to preserve metadata from hg:meta property. Write hg patch | |
407 | # headers that can be read by the "import" command. See patchheadermap |
|
415 | # headers that can be read by the "import" command. See patchheadermap | |
408 | # and extract in mercurial/patch.py for supported headers. |
|
416 | # and extract in mercurial/patch.py for supported headers. |
General Comments 0
You need to be logged in to leave comments.
Login now