ui.configpath() vs util.expandpath()
mpm at selenic.com
Sat Oct 15 12:05:33 CDT 2011
On Sat, 2011-10-15 at 12:45 -0400, Greg Ward wrote:
> I was just looking at how largefiles finds its cache directory, and
> found yet another place where you can't put "~/foo/bar" in
> configuration. "Argh, how many places do I have to add a call to
> util.expandpath()", I thought? Then I discovered ui.configpath():
> Well, almost perfect... ui.configpath() uses os.path.expanduser(), so
> you get "~/" expanded but not "$HOME/". Argh. And it only calls
> expanduser() under certain circumstances.
> So the obvious thing here is to fix ui.configpath() to use
> util.expandpath(), right? And possibly move the call out of the nested
> "if" statements so it's more predictable. That seems like a low-risk
> no-brainer. Then the long tedious part is auditing calls to
> ui.config() to see which ones are getting a path and should really use
> ui.configpath(). Seems to me like the only catch is the interpretation
> of relative paths -- ui.configpath() interprets them relative to the
> config file they came from, which makes sense but could conceivably
> break some existing caller of ui.config().
I'd say ui.config users that are interpreting things relative to the
current directory can generally be considered 'buggy'.
Sounds eminently sensible.
Mathematics is the supreme nostalgia of our time.
More information about the Mercurial-devel