comparison cmdline/org/tmatesoft/hg/console/Main.java @ 525:0be5be8d57e9

Repository checkout support, first iteration
author Artem Tikhomirov <tikhomirov.artem@gmail.com>
date Fri, 11 Jan 2013 18:12:39 +0100
parents 0ae5768081aa
children 2f9ed6bcefa2
comparison
equal deleted inserted replaced
524:57b2c9eb3c69 525:0be5be8d57e9
27 import java.util.List; 27 import java.util.List;
28 import java.util.Map; 28 import java.util.Map;
29 29
30 import org.tmatesoft.hg.core.HgChangeset; 30 import org.tmatesoft.hg.core.HgChangeset;
31 import org.tmatesoft.hg.core.HgChangesetTreeHandler; 31 import org.tmatesoft.hg.core.HgChangesetTreeHandler;
32 import org.tmatesoft.hg.core.HgCheckoutCommand;
32 import org.tmatesoft.hg.core.HgException; 33 import org.tmatesoft.hg.core.HgException;
33 import org.tmatesoft.hg.core.HgFileRenameHandlerMixin; 34 import org.tmatesoft.hg.core.HgFileRenameHandlerMixin;
34 import org.tmatesoft.hg.core.HgFileRevision; 35 import org.tmatesoft.hg.core.HgFileRevision;
35 import org.tmatesoft.hg.core.HgLogCommand; 36 import org.tmatesoft.hg.core.HgLogCommand;
36 import org.tmatesoft.hg.core.HgManifestCommand; 37 import org.tmatesoft.hg.core.HgManifestCommand;
96 System.out.println("REPO:" + hgRepo.getLocation()); 97 System.out.println("REPO:" + hgRepo.getLocation());
97 } 98 }
98 99
99 public static void main(String[] args) throws Exception { 100 public static void main(String[] args) throws Exception {
100 Main m = new Main(args); 101 Main m = new Main(args);
102 m.testCheckout();
101 // m.tryExtensions(); 103 // m.tryExtensions();
102 // m.dumpBookmarks(); 104 // m.dumpBookmarks();
103 // m.readConfigFile(); 105 // m.readConfigFile();
104 // m.dumpCommitLastMessage(); 106 // m.dumpCommitLastMessage();
105 m.buildFileLog(); 107 // m.buildFileLog();
106 // m.testConsoleLog(); 108 // m.testConsoleLog();
107 // m.testTreeTraversal(); 109 // m.testTreeTraversal();
108 // m.testRevisionMap(); 110 // m.testRevisionMap();
109 // m.testSubrepos(); 111 // m.testSubrepos();
110 // m.testReadWorkingCopy(); 112 // m.testReadWorkingCopy();
121 // m.dumpCompleteManifestLow(); 123 // m.dumpCompleteManifestLow();
122 // m.dumpCompleteManifestHigh(); 124 // m.dumpCompleteManifestHigh();
123 // m.bunchOfTests(); 125 // m.bunchOfTests();
124 } 126 }
125 127
128 private void testCheckout() throws Exception {
129 HgCheckoutCommand coCmd = new HgCheckoutCommand(hgRepo);
130 coCmd.changeset(17).execute();
131 }
132
126 private void tryExtensions() throws Exception { 133 private void tryExtensions() throws Exception {
127 HgExtensionsManager em = hgRepo.getExtensions(); 134 HgExtensionsManager em = hgRepo.getExtensions();
128 if (!em.isEnabled(HgExt.Rebase)) { 135 if (!em.isEnabled(HgExt.Rebase)) {
129 System.out.println("Rebase is not enabled"); 136 System.out.println("Rebase is not enabled");
130 return; 137 return;
172 } 179 }
173 180
174 private void buildFileLog() throws Exception { 181 private void buildFileLog() throws Exception {
175 final long start = System.nanoTime(); 182 final long start = System.nanoTime();
176 HgLogCommand cmd = new HgLogCommand(hgRepo); 183 HgLogCommand cmd = new HgLogCommand(hgRepo);
177 cmd.file("file1b.txt", true, true); 184 cmd.file("a2.txt", true, false);
178 final int[] count = new int[] { 0 }; 185 final int[] count = new int[] { 0 };
179 class MyHandler implements HgChangesetTreeHandler, Adaptable { 186 class MyHandler implements HgChangesetTreeHandler, Adaptable {
180 public void treeElement(HgChangesetTreeHandler.TreeElement entry) { 187 public void treeElement(HgChangesetTreeHandler.TreeElement entry) {
181 StringBuilder sb = new StringBuilder(); 188 StringBuilder sb = new StringBuilder();
182 HashSet<Nodeid> test = new HashSet<Nodeid>(entry.childRevisions()); 189 HashSet<Nodeid> test = new HashSet<Nodeid>(entry.childRevisions());