comparison cmdline/org/tmatesoft/hg/console/Main.java @ 235:fd845a53f53d

Experimental access to working dir parents
author Artem Tikhomirov <tikhomirov.artem@gmail.com>
date Tue, 07 Jun 2011 04:54:13 +0200
parents 1d389c0cb0a5
children 883300108179
comparison
equal deleted inserted replaced
234:b2cfbe46f9b6 235:fd845a53f53d
41 import org.tmatesoft.hg.repo.HgRepository; 41 import org.tmatesoft.hg.repo.HgRepository;
42 import org.tmatesoft.hg.repo.HgStatusCollector; 42 import org.tmatesoft.hg.repo.HgStatusCollector;
43 import org.tmatesoft.hg.repo.HgStatusInspector; 43 import org.tmatesoft.hg.repo.HgStatusInspector;
44 import org.tmatesoft.hg.repo.HgWorkingCopyStatusCollector; 44 import org.tmatesoft.hg.repo.HgWorkingCopyStatusCollector;
45 import org.tmatesoft.hg.repo.HgChangelog.RawChangeset; 45 import org.tmatesoft.hg.repo.HgChangelog.RawChangeset;
46 import org.tmatesoft.hg.util.Pair;
46 import org.tmatesoft.hg.util.Path; 47 import org.tmatesoft.hg.util.Path;
47 48
48 /** 49 /**
49 * Various debug dumps. 50 * Various debug dumps.
50 * 51 *
66 System.out.println("REPO:" + hgRepo.getLocation()); 67 System.out.println("REPO:" + hgRepo.getLocation());
67 } 68 }
68 69
69 public static void main(String[] args) throws Exception { 70 public static void main(String[] args) throws Exception {
70 Main m = new Main(args); 71 Main m = new Main(args);
71 m.testEffectiveFileLog(); 72 m.testParents();
73 // m.testEffectiveFileLog();
72 // m.testCatAtCsetRevision(); 74 // m.testCatAtCsetRevision();
73 // m.testMergeState(); 75 // m.testMergeState();
74 // m.testFileStatus(); 76 // m.testFileStatus();
75 // m.dumpBranches(); 77 // m.dumpBranches();
76 // m.inflaterLengthException(); 78 // m.inflaterLengthException();
81 // m.dumpCompleteManifestLow(); 83 // m.dumpCompleteManifestLow();
82 // m.dumpCompleteManifestHigh(); 84 // m.dumpCompleteManifestHigh();
83 // m.bunchOfTests(); 85 // m.bunchOfTests();
84 } 86 }
85 87
88 private void testParents() throws Exception {
89 // hg parents cmd
90 final Pair<Nodeid, Nodeid> wcParents = hgRepo.getWorkingCopyParents();
91 ChangesetDumpHandler dump = new ChangesetDumpHandler(hgRepo);
92 final HgChangelog clog = hgRepo.getChangelog();
93 HgLogCommand cmd = new HgLogCommand(hgRepo);
94 if (wcParents.hasFirst()) {
95 int x = clog.getLocalRevision(wcParents.first());
96 cmd.range(x, x).execute(dump); // FIXME HgLogCommand shall support Nodeid as revisions
97 }
98 if (wcParents.hasSecond()) {
99 int x = clog.getLocalRevision(wcParents.second());
100 cmd.range(x, x).execute(dump);
101 }
102 }
103
104 // -R \temp\hg\hg4j-50 src/org/tmatesoft/hg/internal/RevlogStream.java
86 private void testEffectiveFileLog() { 105 private void testEffectiveFileLog() {
87 for (String fname : cmdLineOpts.getList("")) { 106 for (String fname : cmdLineOpts.getList("")) {
88 System.out.println(fname); 107 System.out.println(fname);
89 HgDataFile fn = hgRepo.getFileNode(fname); 108 HgDataFile fn = hgRepo.getFileNode(fname);
90 if (fn.exists()) { 109 if (fn.exists()) {