3034: RBTools Mercurial client ignore hgrc configuration file

al**@zigar***** (Google Code) (Is this you? Claim this profile.)
Dec. 9, 2013
With RBTools 0.5.1 Mercurial client, hgrc configuration file is by-passed by setting "'HGRCPATH': os.devnull" in 'hg_env'.

In my case, it breaks the connection to the repository : my repo is on a self-signed HTTP server and I set "hostfingerprints" to avoid SSL problem, but with RBTools, I have SSL problem back.
#1 david
I think in your case, you may have to modify rbtools/clients/mercurial.py to remove the HGRCPATH line. In general, we ignore the hgrc file because there are many potential settings which can break diff generation, which is a much more common case.
  • +SetupIssue
#2 al**@zigar***** (Google Code) (Is this you? Claim this profile.)
That's what I did.

But it's not a definitive solution when all my colleagues have to do it too.

I see 3 solutions:
 * add an option (RBT_HG_DISABLE_HGRC=[true|false]) to enable/disable the current behavior
 * or add an option to set a RBTools specific hgrc (RBT_HGRC_PATH=~/.hgrc.minimal)
 * or add options for each hgrc options that have impact on connection with the server
#3 david
I think option 2 sounds like a nice compromise. 
  • -SetupIssue
#4 david
  • +Component-RBTools
#5 gregor*******@gmai***** (Google Code) (Is this you? Claim this profile.)
The current behavior of ignoring the hgrc is wrong for reasons beyond what was reported in the initial report. There are valid scenarios where the user's hgrc should be loaded.

For example, when I saw that RBTools was querying for the existence of a special "reviewboard" path, I updated the custom Mercurial extension that provides project-specific enhancements to automagically define this path. To my surprise, RBTools wasn't picking up this path because that extension wasn't being loaded because the hgrc was ignored! So much for easier RBtools usage.

Furthermore, I'm using changeset evolution for Mercurial development. This enables obsolescence (which isn't enabled by Mercurial by default). Now, when RBTools queries my repos with obsolescence markers, Mercurial complains about obsolescence not being enabled because the extension that enables it isn't being loaded.

Not loading the repo's hgrc files is unexpected and thus wrong.

If RBtools needs consistent output from diff `hg diff`, it should specify all the options in the command arguments. hg command-line arguments will override values in hgrc files. Furthermore, it's possible to overwrite hgrc values via the --config argument. This may be painful, but it needs to be done in order for things to be "right." If this is too painful to do manually, it might be worth writing a very basic Mercurial extension that resets values in the [diff] section of the loaded config. RBTools can load this extension via --config extensions.diffreset=/path/to/diffreset.py. The Mercurial API for resetting config options has been stable for years, so the extension approach should be relatively safe. I may author a patch since I'm currently giving the Mercurial client some much needed love.
#6 gregor*******@gmai***** (Google Code) (Is this you? Claim this profile.)
Patch at https://reviews.reviewboard.org/r/5065/
#7 chipx86
Your changes look fantastic. Thank you for taking the time to submit these to us. Most of our Mercurial support has come from third-parties, and there are certainly things that aren't where they should be. Contributions like these really help.

I'm going to be largely out this weekend, but I'll be looking at these closely. We'll have a new RBTools release in the near future, and I'll be sure these get reviewed and committed before that happens.
  • -New
#8 chipx86
Pushed to release-0.5.x (855bc5c)
  • -Confirmed