0

Is there any built in mechanism for editing a repository's hgrc config file using the Mercurial API? I'm writing an extension that requires storing some options in the config file, and I'd like to provide a command for do so (the options that need to be stored involve timestamps and would be a little tricky for users to edit manually).

brianmearns
  • 9,581
  • 10
  • 52
  • 79
  • 1
    Not really an answer, but you could look at [hgconfig](http://mercurial.selenic.com/wiki/ConfigExtensionCommandLine) for some ideas. – icabod Oct 29 '13 at 15:39
  • @icabod: Thanks, that was helpful. That extension just hacks away at the config file itself instead of using an API, but it seems to work alright. I was able to import that extension as a python module and just call into it instead of copying it. – brianmearns Oct 29 '13 at 16:27

1 Answers1

1

The Mercurial codebase does not provide any automated way to edit hgrc files except when they're first created by a clone operation and then only to set the paths.default setting to the origin.

Ry4an Brase
  • 78,112
  • 7
  • 148
  • 169
  • Thanks. It looks like even there they're just hacking it, there's no interface or abstraction for editing the config file, they're just writing text directly to it. Oh well. – brianmearns Oct 30 '13 at 14:00
  • Yeah, there are a lot of issues you can find here in stackoverflow where the Mercurial position that only text editors should edit config files is justified. Some find it convincing (I do) and some don't, but it's firmly established and not going to change. – Ry4an Brase Oct 30 '13 at 17:51