[Bug 6920] New: Commands to change user and repo config
mercurial-bugs at mercurial-scm.org
mercurial-bugs at mercurial-scm.org
Fri Oct 4 13:53:07 UTC 2024
https://bz.mercurial-scm.org/show_bug.cgi?id=6920
Bug ID: 6920
Summary: Commands to change user and repo config
Product: Mercurial
Version: unspecified
Hardware: All
OS: All
Status: UNCONFIRMED
Severity: feature
Priority: wish
Component: Mercurial
Assignee: bugzilla at mercurial-scm.org
Reporter: pierre.augier at univ-grenoble-alpes.fr
CC: mercurial-devel at mercurial-scm.org
Python Version: ---
I teach Mercurial to students and it appears that editing basic configuration
by modifying a text file is still very difficult, especially because this is
one of the first thing that they have to do even before their first commit.
`hg config --edit` is nice, but it does not solve the issue since even nano is
hard for beginners (plus I don't know what it gives on Windows).
It would be much simpler with the possibility of modifying the user config with
a command like in git (`git config --global user.name "Mona Lisa"`).
Then for example I can just ask them to copy/paste few commands, like
hg config --set ui.tweakdefaults True
hg config --set alias.lg "log -G"
which is much easier.
I quote Pierre-Yves David from an email on Mercurial mailing list:
"
Changing config without manually editing files have been a long standing topic
for Mercurial. The main issue being the complexity of mixing automated and
human edit.
However, there is actually a quite simple solution to this issue. We could have
a config file dedicated to automated changes independent from the one targeted
to human. The human one would take priority and the command that manipulate the
config would warn if the "human" config shadow the "machine" value set through
it. For the new file to be taken in account by older Mercurial version, it must
be "%included" from the historic one.
To details a bit this would mean :
introduce a `hg config --set foo.bar my-value` command (UI may varies),
that command write `.hg/auto.rc` file, that explicitly state that is
machine managed (path varies depending config level),
that command ensure that the first line of `.hg/hgrc` is `%include
./auto.rc # some explanatory comment`
If `foo.bar` as a value in `.hg/hgrc` it override the newly set from the
command in `.hg/auto.rc`, the command will warn about it.
With this approach we could finally have a programmatic way to set config,
greatly improving the situation.
"
--
You are receiving this mail because:
You are on the CC list for the bug.
More information about the Mercurial-devel
mailing list