user251433
user251433

Reputation: 151

how to assign a value to a property in the configuration file

There is a configuration file of repository in %path_of_repo%\.hg\hgrc

It has the following configuration:

[paths]
default = C:\STORAGE\REPOSITORIES\PROJ_FIRST

[web]
name = The First Project
encoding = utf-8    

I want change property into conf-file an example. But commands like as:

hg config web.name=NewNameOfProject

It doesn't work (

What is the correct syntax for a command that edits parameters from the Hg Mercurial console? Thx

Upvotes: 1

Views: 103

Answers (1)

StayOnTarget
StayOnTarget

Reputation: 13008

If I have understood your question correctly, it is asking how to use the Mercurial command-line modify its configuration files.

As far as I am aware, you have to edit the config files manually.

Its a little hard to prove that you "can't" do something... but looking at documentation etc. there are a few things which seem to corroborate this impression.

From hg help config:

Files ...

Mercurial reads configuration data from several files, if they exist. These files do not exist by default and you will have to create the appropriate configuration files yourself

From hg config --help:

hg config [-u] [NAME]...

show combined config settings from all hgrc files ...

With --edit, start an editor on the user-level config file. With --global, edit the system-wide config file. With --local, edit the repository-level config file.

Furthermore all the other instructions for hg config only explain how to get it to display configuration information, not how to modify it.


Using TortoiseHG, obviously in its File > Settings GUI it will allow you to modify certain values in the config files; but there is no general capability to modify any arbitrary value.

THG however does have a nice built-in editor for those files which is at least convenient to use.


So for web.name you would probably use the per-repository <repo>/.hg/hgrc file. It should include:

...

[web]
name=NewNameOfProject

...

for your example.

Upvotes: 1

Related Questions