comparison test/org/tmatesoft/hg/test/TestAuxUtilities.java @ 331:a37ce7145c3f

Access to repository configuration
author Artem Tikhomirov <tikhomirov.artem@gmail.com>
date Sat, 05 Nov 2011 04:21:18 +0100
parents 3f09b8c19142
children 5f9073eabf06
comparison
equal deleted inserted replaced
330:9747a786a34d 331:a37ce7145c3f
20 20
21 import java.io.IOException; 21 import java.io.IOException;
22 import java.nio.ByteBuffer; 22 import java.nio.ByteBuffer;
23 23
24 import org.junit.Assert; 24 import org.junit.Assert;
25 import org.junit.Ignore;
25 import org.junit.Test; 26 import org.junit.Test;
26 import org.tmatesoft.hg.core.HgCatCommand; 27 import org.tmatesoft.hg.core.HgCatCommand;
27 import org.tmatesoft.hg.core.Nodeid; 28 import org.tmatesoft.hg.core.Nodeid;
28 import org.tmatesoft.hg.internal.ArrayHelper; 29 import org.tmatesoft.hg.internal.ArrayHelper;
29 import org.tmatesoft.hg.repo.HgChangelog; 30 import org.tmatesoft.hg.repo.HgChangelog;
30 import org.tmatesoft.hg.repo.HgChangelog.RawChangeset; 31 import org.tmatesoft.hg.repo.HgChangelog.RawChangeset;
31 import org.tmatesoft.hg.repo.HgDataFile; 32 import org.tmatesoft.hg.repo.HgDataFile;
32 import org.tmatesoft.hg.repo.HgManifest; 33 import org.tmatesoft.hg.repo.HgManifest;
33 import org.tmatesoft.hg.repo.HgManifest.Flags; 34 import org.tmatesoft.hg.repo.HgManifest.Flags;
35 import org.tmatesoft.hg.repo.HgRepoConfig;
36 import org.tmatesoft.hg.repo.HgRepoConfig.PathsSection;
37 import org.tmatesoft.hg.repo.HgRepoConfig.Section;
34 import org.tmatesoft.hg.repo.HgRepository; 38 import org.tmatesoft.hg.repo.HgRepository;
35 import org.tmatesoft.hg.util.Adaptable; 39 import org.tmatesoft.hg.util.Adaptable;
36 import org.tmatesoft.hg.util.ByteChannel; 40 import org.tmatesoft.hg.util.ByteChannel;
37 import org.tmatesoft.hg.util.CancelSupport; 41 import org.tmatesoft.hg.util.CancelSupport;
38 import org.tmatesoft.hg.util.CancelledException; 42 import org.tmatesoft.hg.util.CancelledException;
43 import org.tmatesoft.hg.util.Pair;
39 import org.tmatesoft.hg.util.Path; 44 import org.tmatesoft.hg.util.Path;
40 45
41 /** 46 /**
42 * 47 *
43 * @author Artem Tikhomirov 48 * @author Artem Tikhomirov
254 Assert.assertTrue(nidParent2 == all[parent2]); 259 Assert.assertTrue(nidParent2 == all[parent2]);
255 } 260 }
256 } 261 }
257 }); 262 });
258 } 263 }
264
265 @Test
266 @Ignore("just a dump for now, to compare values visually")
267 public void testRepositoryConfig() throws Exception {
268 HgRepository repo = Configuration.get().own();
269 final HgRepoConfig cfg = repo.getConfiguration();
270 Assert.assertNotNull(cfg.getPaths());
271 Assert.assertNotNull(cfg.getExtensions());
272 final Section dne = cfg.getSection("does-not-exist");
273 Assert.assertNotNull(dne);
274 Assert.assertFalse(dne.exists());
275 for (Pair<String, String> p : cfg.getSection("ui")) {
276 System.out.printf("%s = %s\n", p.first(), p.second());
277 }
278 final PathsSection p = cfg.getPaths();
279 System.out.printf("Known paths: %d. default: %s(%s), default-push: %s(%s)\n", p.getKeys().size(), p.getDefault(), p.hasDefault(), p.getDefaultPush(), p.hasDefaultPush());
280 for (String k : cfg.getPaths().getKeys()) {
281 System.out.println(k);
282 }
283 Assert.assertFalse(p.hasDefault() ^ p.getDefault() != null);
284 Assert.assertFalse(p.hasDefaultPush() ^ p.getDefaultPush() != null);
285 }
286
287 public static void main(String[] args) throws Exception {
288 new TestAuxUtilities().testRepositoryConfig();
289 }
259 } 290 }