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