Mercurial > hg4j
diff cmdline/org/tmatesoft/hg/console/Main.java @ 483:e31e85cf4d4c
Handle include and unset directives in config files
author | Artem Tikhomirov <tikhomirov.artem@gmail.com> |
---|---|
date | Tue, 07 Aug 2012 19:14:53 +0200 |
parents | a458f9fb00ce |
children | ae4d6604debd |
line wrap: on
line diff
--- a/cmdline/org/tmatesoft/hg/console/Main.java Tue Aug 07 14:27:13 2012 +0200 +++ b/cmdline/org/tmatesoft/hg/console/Main.java Tue Aug 07 19:14:53 2012 +0200 @@ -44,8 +44,10 @@ import org.tmatesoft.hg.core.Nodeid; import org.tmatesoft.hg.internal.BasicSessionContext; import org.tmatesoft.hg.internal.ByteArrayChannel; +import org.tmatesoft.hg.internal.ConfigFile; import org.tmatesoft.hg.internal.DigestHelper; import org.tmatesoft.hg.internal.IntMap; +import org.tmatesoft.hg.internal.Internals; import org.tmatesoft.hg.internal.PathGlobMatcher; import org.tmatesoft.hg.internal.PhasesHelper; import org.tmatesoft.hg.internal.RelativePathRewrite; @@ -109,7 +111,8 @@ public static void main(String[] args) throws Exception { Main m = new Main(args); - m.dumpCommitLastMessage(); + m.readConfigFile(); +// m.dumpCommitLastMessage(); // m.buildFileLog(); // m.testConsoleLog(); // m.testTreeTraversal(); @@ -130,7 +133,20 @@ // m.dumpCompleteManifestHigh(); // m.bunchOfTests(); } - + + // TODO as test + private void readConfigFile() throws Exception { + ConfigFile configFile = new ConfigFile(HgInternals.getContext(hgRepo)); + configFile.addLocation(new File(System.getProperty("user.home"), "test-cfg/aaa/config1")); + for (String s : configFile.getSectionNames()) { + System.out.printf("[%s]\n", s); + for (Map.Entry<String, String> e : configFile.getSection(s).entrySet()) { + System.out.printf("%s = %s\n", e.getKey(), e.getValue()); + } + } + + } + private void dumpCommitLastMessage() throws Exception { System.out.println(hgRepo.getCommitLastMessage()); }