comparison 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
comparison
equal deleted inserted replaced
482:6c67debed07e 483:e31e85cf4d4c
42 import org.tmatesoft.hg.core.HgLogCommand; 42 import org.tmatesoft.hg.core.HgLogCommand;
43 import org.tmatesoft.hg.core.HgManifestCommand; 43 import org.tmatesoft.hg.core.HgManifestCommand;
44 import org.tmatesoft.hg.core.Nodeid; 44 import org.tmatesoft.hg.core.Nodeid;
45 import org.tmatesoft.hg.internal.BasicSessionContext; 45 import org.tmatesoft.hg.internal.BasicSessionContext;
46 import org.tmatesoft.hg.internal.ByteArrayChannel; 46 import org.tmatesoft.hg.internal.ByteArrayChannel;
47 import org.tmatesoft.hg.internal.ConfigFile;
47 import org.tmatesoft.hg.internal.DigestHelper; 48 import org.tmatesoft.hg.internal.DigestHelper;
48 import org.tmatesoft.hg.internal.IntMap; 49 import org.tmatesoft.hg.internal.IntMap;
50 import org.tmatesoft.hg.internal.Internals;
49 import org.tmatesoft.hg.internal.PathGlobMatcher; 51 import org.tmatesoft.hg.internal.PathGlobMatcher;
50 import org.tmatesoft.hg.internal.PhasesHelper; 52 import org.tmatesoft.hg.internal.PhasesHelper;
51 import org.tmatesoft.hg.internal.RelativePathRewrite; 53 import org.tmatesoft.hg.internal.RelativePathRewrite;
52 import org.tmatesoft.hg.internal.RevisionDescendants; 54 import org.tmatesoft.hg.internal.RevisionDescendants;
53 import org.tmatesoft.hg.internal.StreamLogFacility; 55 import org.tmatesoft.hg.internal.StreamLogFacility;
107 System.out.println("REPO:" + hgRepo.getLocation()); 109 System.out.println("REPO:" + hgRepo.getLocation());
108 } 110 }
109 111
110 public static void main(String[] args) throws Exception { 112 public static void main(String[] args) throws Exception {
111 Main m = new Main(args); 113 Main m = new Main(args);
112 m.dumpCommitLastMessage(); 114 m.readConfigFile();
115 // m.dumpCommitLastMessage();
113 // m.buildFileLog(); 116 // m.buildFileLog();
114 // m.testConsoleLog(); 117 // m.testConsoleLog();
115 // m.testTreeTraversal(); 118 // m.testTreeTraversal();
116 // m.testRevisionMap(); 119 // m.testRevisionMap();
117 // m.testSubrepos(); 120 // m.testSubrepos();
128 // m.catCompleteHistory(); 131 // m.catCompleteHistory();
129 // m.dumpCompleteManifestLow(); 132 // m.dumpCompleteManifestLow();
130 // m.dumpCompleteManifestHigh(); 133 // m.dumpCompleteManifestHigh();
131 // m.bunchOfTests(); 134 // m.bunchOfTests();
132 } 135 }
133 136
137 // TODO as test
138 private void readConfigFile() throws Exception {
139 ConfigFile configFile = new ConfigFile(HgInternals.getContext(hgRepo));
140 configFile.addLocation(new File(System.getProperty("user.home"), "test-cfg/aaa/config1"));
141 for (String s : configFile.getSectionNames()) {
142 System.out.printf("[%s]\n", s);
143 for (Map.Entry<String, String> e : configFile.getSection(s).entrySet()) {
144 System.out.printf("%s = %s\n", e.getKey(), e.getValue());
145 }
146 }
147
148 }
149
134 private void dumpCommitLastMessage() throws Exception { 150 private void dumpCommitLastMessage() throws Exception {
135 System.out.println(hgRepo.getCommitLastMessage()); 151 System.out.println(hgRepo.getCommitLastMessage());
136 } 152 }
137 153
138 private void buildFileLog() throws Exception { 154 private void buildFileLog() throws Exception {