Mercurial > jhg
diff src/org/tmatesoft/hg/internal/Internals.java @ 579:36e36b926747
Provide means to read user-specific configuration, with no specific repository selected
author | Artem Tikhomirov <tikhomirov.artem@gmail.com> |
---|---|
date | Wed, 17 Apr 2013 16:06:10 +0200 |
parents | 6ca3d0c5b4bc |
children | ed243b668502 |
line wrap: on
line diff
--- a/src/org/tmatesoft/hg/internal/Internals.java Wed Apr 17 16:02:52 2013 +0200 +++ b/src/org/tmatesoft/hg/internal/Internals.java Wed Apr 17 16:06:10 2013 +0200 @@ -293,10 +293,11 @@ } /** + * User-specific configuration, from system-wide and user home locations, without any repository-specific data. + * * @see http://www.selenic.com/mercurial/hgrc.5.html */ - public ConfigFile readConfiguration() throws IOException { - SessionContext sessionCtx = repo.getSessionContext(); + public static ConfigFile readConfiguration(SessionContext sessionCtx) throws IOException { ConfigFile configFile = new ConfigFile(sessionCtx); File hgInstallRoot = findHgInstallRoot(sessionCtx); // may be null // @@ -335,11 +336,21 @@ configFile.addLocation(new File("/etc/mercurial/hgrc")); configFile.addLocation(new File(System.getenv("HOME"), ".hgrc")); } + return configFile; + } + + /** + * Repository-specific configuration + * @see http://www.selenic.com/mercurial/hgrc.5.html + */ + public ConfigFile readConfiguration() throws IOException { + ConfigFile configFile = readConfiguration(repo.getSessionContext()); // last one, overrides anything else // <repo>/.hg/hgrc configFile.addLocation(getFileFromRepoDir("hgrc")); return configFile; } + private static List<File> getWindowsConfigFilesPerInstall(File hgInstallDir) { File f = new File(hgInstallDir, "Mercurial.ini");