Show More
@@ -1296,9 +1296,13 b' def diff(ui, repo, *files, **opts):' | |||||
1296 | repo.mq.diff(repo, list(files)) |
|
1296 | repo.mq.diff(repo, list(files)) | |
1297 | return 0 |
|
1297 | return 0 | |
1298 |
|
1298 | |||
1299 | def fold(ui, repo, *files): |
|
1299 | def fold(ui, repo, *files, **opts): | |
1300 | """fold the named patches into the current patch |
|
1300 | """fold the named patches into the current patch | |
1301 | Patches must not yet be applied.""" |
|
1301 | ||
|
1302 | Patches must not yet be applied. | |||
|
1303 | The header for each folded patch will be concatenated with | |||
|
1304 | the current patch header, separated by a line of '* * *'.""" | |||
|
1305 | ||||
1302 | q = repo.mq |
|
1306 | q = repo.mq | |
1303 |
|
1307 | |||
1304 | if not files: |
|
1308 | if not files: | |
@@ -1306,6 +1310,11 b' def fold(ui, repo, *files):' | |||||
1306 | if not q.check_toppatch(repo): |
|
1310 | if not q.check_toppatch(repo): | |
1307 | raise util.Abort(_('No patches applied\n')) |
|
1311 | raise util.Abort(_('No patches applied\n')) | |
1308 |
|
1312 | |||
|
1313 | message=commands.logmessage(**opts) | |||
|
1314 | if opts['edit']: | |||
|
1315 | if message: | |||
|
1316 | raise util.Abort(_('option "-e" incompatible with "-m" or "-l"')) | |||
|
1317 | ||||
1309 | parent = q.lookup('qtip') |
|
1318 | parent = q.lookup('qtip') | |
1310 | patches = [] |
|
1319 | patches = [] | |
1311 | messages = [] |
|
1320 | messages = [] | |
@@ -1318,17 +1327,22 b' def fold(ui, repo, *files):' | |||||
1318 | patches.append(patch) |
|
1327 | patches.append(patch) | |
1319 |
|
1328 | |||
1320 | for patch in patches: |
|
1329 | for patch in patches: | |
1321 | messages.append(q.readheaders(patch)[0]) |
|
1330 | if not message: | |
|
1331 | messages.append(q.readheaders(patch)[0]) | |||
1322 | pf = os.path.join(q.path, patch) |
|
1332 | pf = os.path.join(q.path, patch) | |
1323 | (patchsuccess, files, fuzz) = q.patch(repo, pf) |
|
1333 | (patchsuccess, files, fuzz) = q.patch(repo, pf) | |
1324 | if not patchsuccess: |
|
1334 | if not patchsuccess: | |
1325 | raise util.Abort(_('Error folding patch %s') % patch) |
|
1335 | raise util.Abort(_('Error folding patch %s') % patch) | |
1326 |
|
1336 | |||
1327 | message = q.readheaders(parent)[0] |
|
1337 | if not message: | |
1328 | for msg in messages: |
|
1338 | message, comments, user = q.readheaders(parent)[0:3] | |
1329 | message.append('* * *') |
|
1339 | for msg in messages: | |
1330 |
message. |
|
1340 | message.append('* * *') | |
1331 | message = '\n'.join(message) |
|
1341 | message.extend(msg) | |
|
1342 | message = '\n'.join(message) | |||
|
1343 | ||||
|
1344 | if opts['edit']: | |||
|
1345 | message = ui.edit(message, user or ui.username()) | |||
1332 |
|
1346 | |||
1333 | q.refresh(repo, msg=message) |
|
1347 | q.refresh(repo, msg=message) | |
1334 |
|
1348 | |||
@@ -1510,7 +1524,12 b' cmdtable = {' | |||||
1510 | 'hg qcommit [OPTION]... [FILE]...'), |
|
1524 | 'hg qcommit [OPTION]... [FILE]...'), | |
1511 | "^qdiff": (diff, [], 'hg qdiff [FILE]...'), |
|
1525 | "^qdiff": (diff, [], 'hg qdiff [FILE]...'), | |
1512 | "qdelete": (delete, [], 'hg qdelete PATCH'), |
|
1526 | "qdelete": (delete, [], 'hg qdelete PATCH'), | |
1513 | 'qfold': (fold, [], 'hg qfold PATCH...'), |
|
1527 | 'qfold': | |
|
1528 | (fold, | |||
|
1529 | [('e', 'edit', None, _('edit patch header')), | |||
|
1530 | ('m', 'message', '', _('set patch header to <text>')), | |||
|
1531 | ('l', 'logfile', '', _('set patch header to contents of <file>'))], | |||
|
1532 | 'hg qfold [-e] [-m <text>] [-l <file] PATCH...'), | |||
1514 | 'qheader': (header, [], |
|
1533 | 'qheader': (header, [], | |
1515 | _('hg qheader [PATCH]')), |
|
1534 | _('hg qheader [PATCH]')), | |
1516 | "^qimport": |
|
1535 | "^qimport": |
General Comments 0
You need to be logged in to leave comments.
Login now