This is an archive of the discontinued Mercurial Phabricator instance.

hg: allow usage of XDG_CONFIG_HOME/hg/hgrc on OSX
AbandonedPublic

Authored by graemenail on Jul 7 2020, 8:31 AM.

Details

Reviewers
durin42
Group Reviewers
hg-reviewers
Summary

As per mercurial/help/config.txt, XDG_CONFIG_HOME/hg/hgrc should be consulted
on Unix systems.

This patch removes the Darwin specific code in changeset 354020079723 to enable
this behaviour. As such, backwards compatibility is retained in the same manner;
creating ~/.hgrc when no hgrc exists.

Diff Detail

Repository
rHG Mercurial
Branch
default
Lint
No Linters Available
Unit
No Unit Test Coverage

Event Timeline

graemenail created this revision.Jul 7 2020, 8:31 AM

I looked up the the mail thread which introduced this change, unable to understand why this limitation is there. @durin42 any chance you remember?

durin42 requested changes to this revision.Jul 7 2020, 2:22 PM

Yes: XDG isn't a thing on macOS, and we won't respect it there. Perhaps the help text should be improved instead.

(If anything, ~/Library/Preferences/org.mercurial-scm.hgrc might make sense, but that seems silly to me.)

This revision now requires changes to proceed.Jul 7 2020, 2:22 PM

Thanks for the prompt review.

(If anything, ~/Library/Preferences/org.mercurial-scm.hgrc might make sense, but that seems silly to me.)

I agree that ~/Library/Preferences would be the default XDG analogy in macOS. However, the patch was more motivated by relocating the configuration file.
Am I to understand that setting HGRCPATH is the preferred approach for relocating hgrc on macOS?

Perhaps the help text should be improved instead.

Did you have a suggestion? I wasn't able to find any help text that makes reference to macOS specifically.

Thanks for the prompt review.

(If anything, ~/Library/Preferences/org.mercurial-scm.hgrc might make sense, but that seems silly to me.)

I agree that ~/Library/Preferences would be the default XDG analogy in macOS. However, the patch was more motivated by relocating the configuration file.
Am I to understand that setting HGRCPATH is the preferred approach for relocating hgrc on macOS?

Yes and no: setting HGRCPATH means you won't pick up any system-wide configs (eg in /etc/mercurial/hgrc.d/), so it's not really a great option for institutional users. I guess I'd be "+0" on a change to core that would look in the relevant Library/Preferences places for config files: I'll review it, but I'm not excited about it.

Perhaps the help text should be improved instead.

Did you have a suggestion? I wasn't able to find any help text that makes reference to macOS specifically.

I don't have a strong suggestion. Perhaps it should call out somehow that "Unix" in this context doesn't include macOS?

graemenail abandoned this revision.Jul 8 2020, 5:08 AM

! In D8691#129814, @durin42 wrote:
Yes and no: setting HGRCPATH means you won't pick up any system-wide configs (eg in /etc/mercurial/hgrc.d/), so it's not really a great option for institutional users. I guess I'd be "+0" on a change to core that would look in the relevant Library/Preferences places for config files: I'll review it, but I'm not excited about it.

Indeed, it doesn't emulate the behaviour on non-macOS Unix. . As I indicated, my motivation was about the relocatability of hgrc. Burying it in a different hard-coded path seems unnecessary.

Given the lack of appetite, I'll abandon this. Thanks for the input @durin42, @pulkit.