Mercurial > hg4j
comparison cmdline/org/tmatesoft/hg/console/Main.java @ 501:d2f6ab541330
Change the way extensions are accessed (with ExtensionsManager now), add preliminary Rebase extension support
author | Artem Tikhomirov <tikhomirov.artem@gmail.com> |
---|---|
date | Mon, 29 Oct 2012 19:04:13 +0100 |
parents | b3c16d1aede0 |
children | 27398bbfd543 |
comparison
equal
deleted
inserted
replaced
500:465316bf97e8 | 501:d2f6ab541330 |
---|---|
72 import org.tmatesoft.hg.repo.HgRuntimeException; | 72 import org.tmatesoft.hg.repo.HgRuntimeException; |
73 import org.tmatesoft.hg.repo.HgStatusCollector; | 73 import org.tmatesoft.hg.repo.HgStatusCollector; |
74 import org.tmatesoft.hg.repo.HgStatusInspector; | 74 import org.tmatesoft.hg.repo.HgStatusInspector; |
75 import org.tmatesoft.hg.repo.HgSubrepoLocation; | 75 import org.tmatesoft.hg.repo.HgSubrepoLocation; |
76 import org.tmatesoft.hg.repo.HgSubrepoLocation.Kind; | 76 import org.tmatesoft.hg.repo.HgSubrepoLocation.Kind; |
77 import org.tmatesoft.hg.repo.ext.HgExtensionsManager; | |
78 import org.tmatesoft.hg.repo.ext.HgExtensionsManager.HgExt; | |
77 import org.tmatesoft.hg.repo.ext.MqManager; | 79 import org.tmatesoft.hg.repo.ext.MqManager; |
80 import org.tmatesoft.hg.repo.ext.Rebase; | |
78 import org.tmatesoft.hg.repo.ext.MqManager.PatchRecord; | 81 import org.tmatesoft.hg.repo.ext.MqManager.PatchRecord; |
79 import org.tmatesoft.hg.repo.HgWorkingCopyStatusCollector; | 82 import org.tmatesoft.hg.repo.HgWorkingCopyStatusCollector; |
80 import org.tmatesoft.hg.repo.HgRevisionMap; | 83 import org.tmatesoft.hg.repo.HgRevisionMap; |
81 import org.tmatesoft.hg.test.ExecHelper; | 84 import org.tmatesoft.hg.test.ExecHelper; |
82 import org.tmatesoft.hg.test.OutputParser; | 85 import org.tmatesoft.hg.test.OutputParser; |
110 System.out.println("REPO:" + hgRepo.getLocation()); | 113 System.out.println("REPO:" + hgRepo.getLocation()); |
111 } | 114 } |
112 | 115 |
113 public static void main(String[] args) throws Exception { | 116 public static void main(String[] args) throws Exception { |
114 Main m = new Main(args); | 117 Main m = new Main(args); |
115 m.dumpBookmarks(); | 118 m.tryExtensions(); |
119 // m.dumpBookmarks(); | |
116 // m.readConfigFile(); | 120 // m.readConfigFile(); |
117 // m.dumpCommitLastMessage(); | 121 // m.dumpCommitLastMessage(); |
118 // m.buildFileLog(); | 122 // m.buildFileLog(); |
119 // m.testConsoleLog(); | 123 // m.testConsoleLog(); |
120 // m.testTreeTraversal(); | 124 // m.testTreeTraversal(); |
132 // m.testStatusInternals(); | 136 // m.testStatusInternals(); |
133 // m.catCompleteHistory(); | 137 // m.catCompleteHistory(); |
134 // m.dumpCompleteManifestLow(); | 138 // m.dumpCompleteManifestLow(); |
135 // m.dumpCompleteManifestHigh(); | 139 // m.dumpCompleteManifestHigh(); |
136 // m.bunchOfTests(); | 140 // m.bunchOfTests(); |
141 } | |
142 | |
143 private void tryExtensions() throws Exception { | |
144 HgExtensionsManager em = hgRepo.getExtensions(); | |
145 if (!em.isEnabled(HgExt.Rebase)) { | |
146 System.out.println("Rebase is not enabled"); | |
147 return; | |
148 } | |
149 Rebase re = em.getRebaseExtension(); | |
150 if (!re.refresh().isRebaseInProgress()) { | |
151 System.out.println("No rebase is in progress"); | |
152 return; | |
153 } | |
154 System.out.printf("%s %s %s\n", re.getWorkingDirParent().shortNotation(), re.getTarget().shortNotation(), re.getExternalParent().shortNotation()); | |
155 System.out.printf("collapse:%b, keep:%b, keepbranches:%b\n", re.isCollapse(), re.isKeepOriginalRevisions(), re.isKeepBranchNames()); | |
137 } | 156 } |
138 | 157 |
139 // TODO as test | 158 // TODO as test |
140 private void dumpBookmarks() throws Exception { | 159 private void dumpBookmarks() throws Exception { |
141 HgBookmarks bm = hgRepo.getBookmarks(); | 160 HgBookmarks bm = hgRepo.getBookmarks(); |