Mercurial > hg4j
changeset 351:5abba41751e6
Read extra predefined locations with mercurial configuration files
author | Artem Tikhomirov <tikhomirov.artem@gmail.com> |
---|---|
date | Wed, 30 Nov 2011 04:39:50 +0100 |
parents | 33eaed1ad130 |
children | 7b34d24b8f4d |
files | src/org/tmatesoft/hg/internal/Internals.java |
diffstat | 1 files changed, 20 insertions(+), 1 deletions(-) [+] |
line wrap: on
line diff
--- a/src/org/tmatesoft/hg/internal/Internals.java Tue Nov 29 03:46:17 2011 +0100 +++ b/src/org/tmatesoft/hg/internal/Internals.java Wed Nov 30 04:39:50 2011 +0100 @@ -117,7 +117,26 @@ public ConfigFile readConfiguration(HgRepository hgRepo, File repoRoot) throws IOException { ConfigFile configFile = new ConfigFile(); - // FIXME use Unix/Win location according to runningOnWindows + if (runningOnWindows()) { + // FIXME read install-dir + // + // XXX perhaps, makes sense to compare getenv(USERPROFILE) and getenv(HOME) and use + // them if set (and use both if their values do not match). Only if both not set, rely to user.home? + configFile.addLocation(new File(System.getProperty("user.home"), "Mercurial.ini")); + } else { + // FIXME read from install-root + // + File d = new File("/etc/mercurial/hgrc.d/"); + if (d.isDirectory()) { + for (File f : d.listFiles()) { + // XXX in fact, need to sort in alphabetical order + if (f.getName().endsWith(".rc")) { + configFile.addLocation(f); + } + } + } + configFile.addLocation(new File("/etc/mercurial/hgrc")); + } configFile.addLocation(new File(System.getProperty("user.home"), ".hgrc")); // last one, overrides anything else // <repo>/.hg/hgrc