comparison hgext/evolve.py @ 908:06100fbc05e5

fold: enable --date and --user options Like all other commit-creating commits, `hg fold` should also have these options enabled. This also allows getting consistent hashes during tests involving fold.
author Jordi Gutiérrez Hermoso <jordigh@octave.org>
date Fri, 11 Apr 2014 19:24:29 -0400
parents c17ab719da56
children ff71b83a4bbe
comparison
equal deleted inserted replaced
907:c17ab719da56 908:06100fbc05e5
1980 finally: 1980 finally:
1981 lockmod.release(lock, wlock) 1981 lockmod.release(lock, wlock)
1982 1982
1983 @command('^fold', 1983 @command('^fold',
1984 [('r', 'rev', [], _("explicitly specify the full set of revision to fold")), 1984 [('r', 'rev', [], _("explicitly specify the full set of revision to fold")),
1985 ], 1985 ] + commitopts2,
1986 # allow to choose the seed ? 1986 # allow to choose the seed ?
1987 _('rev')) 1987 _('rev'))
1988 def fold(ui, repo, *revs, **opts): 1988 def fold(ui, repo, *revs, **opts):
1989 """Fold multiple revisions into a single one 1989 """Fold multiple revisions into a single one
1990 1990
2021 try: 2021 try:
2022 wlock = repo.wlock() 2022 wlock = repo.wlock()
2023 lock = repo.lock() 2023 lock = repo.lock()
2024 tr = repo.transaction('touch') 2024 tr = repo.transaction('touch')
2025 try: 2025 try:
2026 commitopts = opts.copy()
2026 allctx = [repo[r] for r in revs] 2027 allctx = [repo[r] for r in revs]
2027 targetphase = max(c.phase() for c in allctx) 2028 targetphase = max(c.phase() for c in allctx)
2028 msgs = ["HG: This is a fold of %d changesets." % len(allctx)] 2029 msgs = ["HG: This is a fold of %d changesets." % len(allctx)]
2029 msgs += ["HG: Commit message of changeset %s.\n\n%s\n" % 2030 msgs += ["HG: Commit message of changeset %s.\n\n%s\n" %
2030 (c.rev(), c.description()) for c in allctx] 2031 (c.rev(), c.description()) for c in allctx]
2031 commitopts = {'message': "\n".join(msgs)} 2032 commitopts['message'] = "\n".join(msgs)
2032 commitopts['edit'] = True 2033 commitopts['edit'] = True
2033 newid, _ = rewrite(repo, root, allctx, head, 2034 newid, _ = rewrite(repo, root, allctx, head,
2034 [root.p1().node(), root.p2().node()], 2035 [root.p1().node(), root.p2().node()],
2035 commitopts=commitopts) 2036 commitopts=commitopts)
2036 phases.retractboundary(repo, targetphase, [newid]) 2037 phases.retractboundary(repo, targetphase, [newid])