1468 |
1468 |
1469 parent = q.lookup('qtip') |
1469 parent = q.lookup('qtip') |
1470 patches = [] |
1470 patches = [] |
1471 messages = [] |
1471 messages = [] |
1472 for f in files: |
1472 for f in files: |
1473 patch = q.lookup(f) |
1473 p = q.lookup(f) |
1474 if patch in patches or patch == parent: |
1474 if p in patches or p == parent: |
1475 ui.warn(_('Skipping already folded patch %s') % patch) |
1475 ui.warn(_('Skipping already folded patch %s') % p) |
1476 if q.isapplied(patch): |
1476 if q.isapplied(p): |
1477 raise util.Abort(_('qfold cannot fold already applied patch %s') % patch) |
1477 raise util.Abort(_('qfold cannot fold already applied patch %s') % p) |
1478 patches.append(patch) |
1478 patches.append(p) |
1479 |
1479 |
1480 for patch in patches: |
1480 for p in patches: |
1481 if not message: |
1481 if not message: |
1482 messages.append(q.readheaders(patch)[0]) |
1482 messages.append(q.readheaders(p)[0]) |
1483 pf = q.join(patch) |
1483 pf = q.join(p) |
1484 (patchsuccess, files, fuzz) = q.patch(repo, pf) |
1484 (patchsuccess, files, fuzz) = q.patch(repo, pf) |
1485 if not patchsuccess: |
1485 if not patchsuccess: |
1486 raise util.Abort(_('Error folding patch %s') % patch) |
1486 raise util.Abort(_('Error folding patch %s') % p) |
|
1487 patch.updatedir(ui, repo, files) |
1487 |
1488 |
1488 if not message: |
1489 if not message: |
1489 message, comments, user = q.readheaders(parent)[0:3] |
1490 message, comments, user = q.readheaders(parent)[0:3] |
1490 for msg in messages: |
1491 for msg in messages: |
1491 message.append('* * *') |
1492 message.append('* * *') |
1494 |
1495 |
1495 if opts['edit']: |
1496 if opts['edit']: |
1496 message = ui.edit(message, user or ui.username()) |
1497 message = ui.edit(message, user or ui.username()) |
1497 |
1498 |
1498 q.refresh(repo, msg=message) |
1499 q.refresh(repo, msg=message) |
1499 |
1500 q.delete(repo, patches, keep=opts['keep']) |
1500 for patch in patches: |
|
1501 q.delete(repo, patch, keep=opts['keep']) |
|
1502 |
|
1503 q.save_dirty() |
1501 q.save_dirty() |
1504 |
1502 |
1505 def guard(ui, repo, *args, **opts): |
1503 def guard(ui, repo, *args, **opts): |
1506 '''set or print guards for a patch |
1504 '''set or print guards for a patch |
1507 |
1505 |