Mercurial error on commit: "abort: phases.new-commit: not a valid phase name ('')"
Asked Answered
S

3

7

I'm getting the following error when attempting to commit to a Hg repository:

Z:\wormcard_maker>hg commit -m "asdf"
transaction abort!
rollback completed
abort: phases.new-commit: not a valid phase name ('')

This happens over multiple different repositories and has survived re-cloning the repository and reinstalling Mercurial. I can commit to the repository fine from a different computer (running Linux).

I'm running Hg 4.8 as distributed with TortoiseHg 4.8 on Windows 7.

Schaffhausen answered 2/12, 2018 at 7:31 Comment(2)
Well that's heartening; I was worried it was a hardware problem because I couldn't find any information about it on the internet. Someone else having the same problem doesn't prove it isn't hardware, I guess, but it makes it less likely.Schaffhausen
What does the relevant config file(s) say about [phases] new-commit = <HERE>? Valid entries are draft, public and secret.Messy
T
7

In TortoiseHg just set the "File - Settings - Commit - New Commit Phase" option.

Traylor answered 3/12, 2018 at 10:17 Comment(2)
Thanks; this fixed it. Not familiar enough with Hg to know what that setting actually does; seems like a documentation issue I should maybe chase up.Schaffhausen
@JamesPicone hg phase --helpTbar
T
0

I tried using the THG setting but it didn't work; just kept producing the same error. (While doing this I noticed that the THG dropdown for the phase choices had a bunch of blank lines in it; so I think THG was confused.)

Instead I manually edited my HGRC file and made sure it contained:

[phases]
new-commit = secret

which worked.

You could obviously use draft, etc. in place of secret.

Tbar answered 10/1, 2020 at 15:12 Comment(0)
T
0

Neither of the other answers worked for me - even though I had new-commit = secret in the HGRC it still produced the error.

The workaround I found was to do this:

hg ci -m "message" --config phases.new-commit=secret

which did work, apparently by overriding whatever invalid phase name hg was trying to use. Even though I don't know why.

I assume this would work with other comments, not just ci (aka commit).

Tbar answered 8/9, 2020 at 12:33 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.