Mercurial > hg
changeset 16030:308406677e9d stable
phases: allow phase name in phases.new-commit settings
Before this commit only phase index where accepted
author | Pierre-Yves David <pierre-yves.david@logilab.fr> |
---|---|
date | Mon, 30 Jan 2012 17:46:15 +0100 |
parents | ee1c8385e5b0 |
children | e6e12e60a45f |
files | mercurial/localrepo.py mercurial/phases.py tests/test-phases.t |
diffstat | 3 files changed, 19 insertions(+), 3 deletions(-) [+] |
line wrap: on
line diff
--- a/mercurial/localrepo.py Mon Jan 30 15:17:08 2012 +0100 +++ b/mercurial/localrepo.py Mon Jan 30 17:46:15 2012 +0100 @@ -1268,8 +1268,7 @@ parent2=xp2, pending=p) self.changelog.finalize(trp) # set the new commit is proper phase - targetphase = self.ui.configint('phases', 'new-commit', - phases.draft) + targetphase = phases.newcommitphase(self.ui) if targetphase: # retract boundary do not alter parent changeset. # if a parent have higher the resulting phase will
--- a/mercurial/phases.py Mon Jan 30 15:17:08 2012 +0100 +++ b/mercurial/phases.py Mon Jan 30 17:46:15 2012 +0100 @@ -298,3 +298,20 @@ heads, roots, roots, heads) return [c.node() for c in revset] + +def newcommitphase(ui): + """helper to get the target phase of new commit + + Handle all possible values for the phases.new-commit options. + + """ + v = ui.config('phases', 'new-commit', draft) + try: + return phasenames.index(v) + except ValueError: + try: + return int(v) + except ValueError: + msg = _("phases.new-commit: not a valid phase name ('%s')") + raise error.ConfigError(msg % v) +