hgext/evolve.py
changeset 622 8cbada2b0c43
parent 618 c39afce52e31
parent 621 e50a5d9a6cbf
child 625 e291e5271694
child 630 722b52c75f02
equal deleted inserted replaced
618:c39afce52e31 622:8cbada2b0c43
  1807             tr.release()
  1807             tr.release()
  1808     finally:
  1808     finally:
  1809         lockmod.release(lock, wlock)
  1809         lockmod.release(lock, wlock)
  1810 
  1810 
  1811 @command('^fold',
  1811 @command('^fold',
  1812     [('r', 'rev', [], 'revisions to fold'),],
  1812     [('r', 'rev', [], 'revisions to fold'),
       
  1813     ],
  1813     # allow to choose the seed ?
  1814     # allow to choose the seed ?
  1814     _('[-r] revs'))
  1815     _('[-r] revs'))
  1815 def fold(ui, repo, *revs, **opts):
  1816 def fold(ui, repo, *revs, **opts):
  1816     """Fold multiple revisions into a single one"""
  1817     """Fold multiple revisions into a single one"""
  1817     revs = list(revs)
  1818     revs = list(revs)
  1837         lock = repo.lock()
  1838         lock = repo.lock()
  1838         tr = repo.transaction('touch')
  1839         tr = repo.transaction('touch')
  1839         try:
  1840         try:
  1840             allctx = [repo[r] for r in revs]
  1841             allctx = [repo[r] for r in revs]
  1841             targetphase = max(c.phase() for c in allctx)
  1842             targetphase = max(c.phase() for c in allctx)
  1842             msg = '\n\n***\n\n'.join(c.description() for c in allctx)
  1843             msgs = ["HG: This is a fold of %d changesets." % len(allctx)]
       
  1844             msgs += ["HG: Commit message of changeset %s.\n\n%s\n" %
       
  1845                      (c.rev(), c.description()) for c in allctx]
       
  1846             commitopts = {'message': "\n".join(msgs)}
       
  1847             commitopts['edit'] = True
  1843             newid, _ = rewrite(repo, root, allctx, head,
  1848             newid, _ = rewrite(repo, root, allctx, head,
  1844                              [root.p1().node(), root.p2().node()],
  1849                              [root.p1().node(), root.p2().node()],
  1845                              commitopts={'message': msg})
  1850                              commitopts=commitopts)
  1846             phases.retractboundary(repo, targetphase, [newid])
  1851             phases.retractboundary(repo, targetphase, [newid])
  1847             createmarkers(repo, [(ctx, (repo[newid],))
  1852             createmarkers(repo, [(ctx, (repo[newid],))
  1848                                  for ctx in allctx])
  1853                                  for ctx in allctx])
  1849             tr.close()
  1854             tr.close()
  1850         finally:
  1855         finally: