comparison mercurial/cmdutil.py @ 17461:bacde764fba0 stable

amend: preserve phase of amended revision (issue3602) New commit from the amend process were created without any phase contraint. If the amended changeset had a different phase from it's parent, the phases data were lost. The changeset ensure the new commit are created in the same phase than the original changeset.
author Pierre-Yves David <pierre-yves.david@logilab.fr>
date Thu, 30 Aug 2012 16:47:08 +0200
parents fc24c10424d2
children 8fea378242e3
comparison
equal deleted inserted replaced
17454:f5e86b416e05 17461:bacde764fba0
8 from node import hex, nullid, nullrev, short 8 from node import hex, nullid, nullrev, short
9 from i18n import _ 9 from i18n import _
10 import os, sys, errno, re, tempfile 10 import os, sys, errno, re, tempfile
11 import util, scmutil, templater, patch, error, templatekw, revlog, copies 11 import util, scmutil, templater, patch, error, templatekw, revlog, copies
12 import match as matchmod 12 import match as matchmod
13 import subrepo, context, repair, bookmarks, graphmod, revset 13 import subrepo, context, repair, bookmarks, graphmod, revset, phases
14 14
15 def parsealiases(cmd): 15 def parsealiases(cmd):
16 return cmd.lstrip("^").split("|") 16 return cmd.lstrip("^").split("|")
17 17
18 def findpossible(cmd, table, strict=False): 18 def findpossible(cmd, table, strict=False):
1666 files=files, 1666 files=files,
1667 filectxfn=filectxfn, 1667 filectxfn=filectxfn,
1668 user=user, 1668 user=user,
1669 date=date, 1669 date=date,
1670 extra=extra) 1670 extra=extra)
1671 newid = repo.commitctx(new) 1671 ph = repo.ui.config('phases', 'new-commit', phases.draft)
1672 try:
1673 repo.ui.setconfig('phases', 'new-commit', old.phase())
1674 newid = repo.commitctx(new)
1675 finally:
1676 repo.ui.setconfig('phases', 'new-commit', ph)
1672 if newid != old.node(): 1677 if newid != old.node():
1673 # Reroute the working copy parent to the new changeset 1678 # Reroute the working copy parent to the new changeset
1674 repo.setparents(newid, nullid) 1679 repo.setparents(newid, nullid)
1675 1680
1676 # Move bookmarks from old parent to amend commit 1681 # Move bookmarks from old parent to amend commit