1726 finally: |
1726 finally: |
1727 lockmod.release(lock, wlock) |
1727 lockmod.release(lock, wlock) |
1728 |
1728 |
1729 @command('^fold', |
1729 @command('^fold', |
1730 [('r', 'rev', [], _("explicitly specify the full set of revision to fold")), |
1730 [('r', 'rev', [], _("explicitly specify the full set of revision to fold")), |
1731 ], |
1731 ] + commitopts2, |
1732 # allow to choose the seed ? |
1732 # allow to choose the seed ? |
1733 _('rev')) |
1733 _('rev')) |
1734 def fold(ui, repo, *revs, **opts): |
1734 def fold(ui, repo, *revs, **opts): |
1735 """Fold multiple revisions into a single one |
1735 """Fold multiple revisions into a single one |
1736 |
1736 |
1767 try: |
1767 try: |
1768 wlock = repo.wlock() |
1768 wlock = repo.wlock() |
1769 lock = repo.lock() |
1769 lock = repo.lock() |
1770 tr = repo.transaction('touch') |
1770 tr = repo.transaction('touch') |
1771 try: |
1771 try: |
|
1772 commitopts = opts.copy() |
1772 allctx = [repo[r] for r in revs] |
1773 allctx = [repo[r] for r in revs] |
1773 targetphase = max(c.phase() for c in allctx) |
1774 targetphase = max(c.phase() for c in allctx) |
1774 msgs = ["HG: This is a fold of %d changesets." % len(allctx)] |
1775 msgs = ["HG: This is a fold of %d changesets." % len(allctx)] |
1775 msgs += ["HG: Commit message of changeset %s.\n\n%s\n" % |
1776 msgs += ["HG: Commit message of changeset %s.\n\n%s\n" % |
1776 (c.rev(), c.description()) for c in allctx] |
1777 (c.rev(), c.description()) for c in allctx] |
1777 commitopts = {'message': "\n".join(msgs)} |
1778 commitopts['message'] = "\n".join(msgs) |
1778 commitopts['edit'] = True |
1779 commitopts['edit'] = True |
1779 newid, _ = rewrite(repo, root, allctx, head, |
1780 newid, _ = rewrite(repo, root, allctx, head, |
1780 [root.p1().node(), root.p2().node()], |
1781 [root.p1().node(), root.p2().node()], |
1781 commitopts=commitopts) |
1782 commitopts=commitopts) |
1782 phases.retractboundary(repo, targetphase, [newid]) |
1783 phases.retractboundary(repo, targetphase, [newid]) |