comparison cmdline/org/tmatesoft/hg/console/Main.java @ 463:a0507a9f3da0 smartgit3

Initial support for MqExtension
author Artem Tikhomirov <tikhomirov.artem@gmail.com>
date Wed, 20 Jun 2012 21:16:21 +0200
parents 03fd8d079e9c
children 1a3c18d57a8e
comparison
equal deleted inserted replaced
455:281cfb60e2ef 463:a0507a9f3da0
63 import org.tmatesoft.hg.repo.HgRepository; 63 import org.tmatesoft.hg.repo.HgRepository;
64 import org.tmatesoft.hg.repo.HgStatusCollector; 64 import org.tmatesoft.hg.repo.HgStatusCollector;
65 import org.tmatesoft.hg.repo.HgStatusInspector; 65 import org.tmatesoft.hg.repo.HgStatusInspector;
66 import org.tmatesoft.hg.repo.HgSubrepoLocation; 66 import org.tmatesoft.hg.repo.HgSubrepoLocation;
67 import org.tmatesoft.hg.repo.HgSubrepoLocation.Kind; 67 import org.tmatesoft.hg.repo.HgSubrepoLocation.Kind;
68 import org.tmatesoft.hg.repo.ext.MqManager;
69 import org.tmatesoft.hg.repo.ext.MqManager.PatchRecord;
68 import org.tmatesoft.hg.repo.HgWorkingCopyStatusCollector; 70 import org.tmatesoft.hg.repo.HgWorkingCopyStatusCollector;
69 import org.tmatesoft.hg.util.FileWalker; 71 import org.tmatesoft.hg.util.FileWalker;
70 import org.tmatesoft.hg.util.LogFacility; 72 import org.tmatesoft.hg.util.LogFacility;
71 import org.tmatesoft.hg.util.Pair; 73 import org.tmatesoft.hg.util.Pair;
72 import org.tmatesoft.hg.util.Path; 74 import org.tmatesoft.hg.util.Path;
94 System.out.println("REPO:" + hgRepo.getLocation()); 96 System.out.println("REPO:" + hgRepo.getLocation());
95 } 97 }
96 98
97 public static void main(String[] args) throws Exception { 99 public static void main(String[] args) throws Exception {
98 Main m = new Main(args); 100 Main m = new Main(args);
101 m.testMqManager();
99 // m.testRevisionDescendants(); 102 // m.testRevisionDescendants();
100 for (int i : new int[] {1,2,3,4,5}) { 103 // m.dumpPhases();
101 // m.dumpPhases(); 104 // m.buildFileLog();
102 m.buildFileLog();
103 }
104 // m.testConsoleLog(); 105 // m.testConsoleLog();
105 // m.testTreeTraversal(); 106 // m.testTreeTraversal();
106 // m.testRevisionMap(); 107 // m.testRevisionMap();
107 // m.testSubrepos(); 108 // m.testSubrepos();
108 // m.testReadWorkingCopy(); 109 // m.testReadWorkingCopy();
119 // m.catCompleteHistory(); 120 // m.catCompleteHistory();
120 // m.dumpCompleteManifestLow(); 121 // m.dumpCompleteManifestLow();
121 // m.dumpCompleteManifestHigh(); 122 // m.dumpCompleteManifestHigh();
122 // m.bunchOfTests(); 123 // m.bunchOfTests();
123 } 124 }
125
126
127 // TODO as junit tests in 'default'
128 // -R ${system_property:user.home}/hg/test-mq
129 private void testMqManager() throws Exception {
130 MqManager mqManager = new MqManager(hgRepo);
131 mqManager.refresh();
132 int i = 1;
133 System.out.println("Complete patch queue:");
134 for (PatchRecord pr : mqManager.getAllKnownPatches()) {
135 System.out.printf("#%-3d %s from %s\n", i++, pr.getName(), pr.getPatchLocation());
136 }
137 i = 1;
138 System.out.println("Patches from the queue already applied to the repo:");
139 for (PatchRecord pr : mqManager.getAppliedPatches()) {
140 System.out.printf("#%-3d %s, known as cset:%s\n", i++, pr.getName(), pr.getRevision().shortNotation());
141 }
142 }
143
124 144
125 // -R {junit-test-repos}/branches-1 145 // -R {junit-test-repos}/branches-1
126 private void testRevisionDescendants() throws Exception { 146 private void testRevisionDescendants() throws Exception {
127 int[] roots = new int[] {0, 1, 2, 3, 4, 5}; 147 int[] roots = new int[] {0, 1, 2, 3, 4, 5};
128 RevisionDescendants[] result = new RevisionDescendants[roots.length]; 148 RevisionDescendants[] result = new RevisionDescendants[roots.length];