Mercurial > hg4j
comparison cmdline/org/tmatesoft/hg/console/Main.java @ 445:d0e5dc3cae6e smartgit3
Support for phases functionality from Mercurial 2.1
author | Artem Tikhomirov <tikhomirov.artem@gmail.com> |
---|---|
date | Tue, 05 Jun 2012 20:50:06 +0200 |
parents | 2fadf8695f8a |
children | 5787e912f60e |
comparison
equal
deleted
inserted
replaced
412:63c5a9d7ca3f | 445:d0e5dc3cae6e |
---|---|
41 import org.tmatesoft.hg.core.HgManifestCommand; | 41 import org.tmatesoft.hg.core.HgManifestCommand; |
42 import org.tmatesoft.hg.core.Nodeid; | 42 import org.tmatesoft.hg.core.Nodeid; |
43 import org.tmatesoft.hg.internal.ByteArrayChannel; | 43 import org.tmatesoft.hg.internal.ByteArrayChannel; |
44 import org.tmatesoft.hg.internal.DigestHelper; | 44 import org.tmatesoft.hg.internal.DigestHelper; |
45 import org.tmatesoft.hg.internal.PathGlobMatcher; | 45 import org.tmatesoft.hg.internal.PathGlobMatcher; |
46 import org.tmatesoft.hg.internal.PhasesHelper; | |
46 import org.tmatesoft.hg.internal.RelativePathRewrite; | 47 import org.tmatesoft.hg.internal.RelativePathRewrite; |
47 import org.tmatesoft.hg.internal.StreamLogFacility; | 48 import org.tmatesoft.hg.internal.StreamLogFacility; |
48 import org.tmatesoft.hg.repo.HgBranches; | 49 import org.tmatesoft.hg.repo.HgBranches; |
49 import org.tmatesoft.hg.repo.HgChangelog; | 50 import org.tmatesoft.hg.repo.HgChangelog; |
50 import org.tmatesoft.hg.repo.HgChangelog.RawChangeset; | 51 import org.tmatesoft.hg.repo.HgChangelog.RawChangeset; |
55 import org.tmatesoft.hg.repo.HgIgnore; | 56 import org.tmatesoft.hg.repo.HgIgnore; |
56 import org.tmatesoft.hg.repo.HgInternals; | 57 import org.tmatesoft.hg.repo.HgInternals; |
57 import org.tmatesoft.hg.repo.HgManifest; | 58 import org.tmatesoft.hg.repo.HgManifest; |
58 import org.tmatesoft.hg.repo.HgManifest.Flags; | 59 import org.tmatesoft.hg.repo.HgManifest.Flags; |
59 import org.tmatesoft.hg.repo.HgMergeState; | 60 import org.tmatesoft.hg.repo.HgMergeState; |
61 import org.tmatesoft.hg.repo.HgPhase; | |
60 import org.tmatesoft.hg.repo.HgRepository; | 62 import org.tmatesoft.hg.repo.HgRepository; |
61 import org.tmatesoft.hg.repo.HgStatusCollector; | 63 import org.tmatesoft.hg.repo.HgStatusCollector; |
62 import org.tmatesoft.hg.repo.HgStatusInspector; | 64 import org.tmatesoft.hg.repo.HgStatusInspector; |
63 import org.tmatesoft.hg.repo.HgSubrepoLocation; | 65 import org.tmatesoft.hg.repo.HgSubrepoLocation; |
64 import org.tmatesoft.hg.repo.HgSubrepoLocation.Kind; | 66 import org.tmatesoft.hg.repo.HgSubrepoLocation.Kind; |
91 System.out.println("REPO:" + hgRepo.getLocation()); | 93 System.out.println("REPO:" + hgRepo.getLocation()); |
92 } | 94 } |
93 | 95 |
94 public static void main(String[] args) throws Exception { | 96 public static void main(String[] args) throws Exception { |
95 Main m = new Main(args); | 97 Main m = new Main(args); |
98 m.dumpPhases(); | |
96 // m.buildFileLog(); | 99 // m.buildFileLog(); |
97 // m.testConsoleLog(); | 100 // m.testConsoleLog(); |
98 // m.testTreeTraversal(); | 101 // m.testTreeTraversal(); |
99 // m.testRevisionMap(); | 102 // m.testRevisionMap(); |
100 // m.testSubrepos(); | 103 // m.testSubrepos(); |
109 // m.dumpIgnored(); | 112 // m.dumpIgnored(); |
110 // m.dumpDirstate(); | 113 // m.dumpDirstate(); |
111 // m.testStatusInternals(); | 114 // m.testStatusInternals(); |
112 // m.catCompleteHistory(); | 115 // m.catCompleteHistory(); |
113 // m.dumpCompleteManifestLow(); | 116 // m.dumpCompleteManifestLow(); |
114 m.dumpCompleteManifestHigh(); | 117 // m.dumpCompleteManifestHigh(); |
115 // m.bunchOfTests(); | 118 // m.bunchOfTests(); |
119 } | |
120 | |
121 // hg/test-phases | |
122 // TODO as junit test | |
123 private void dumpPhases() throws Exception { | |
124 HgChangelog.ParentWalker pw = hgRepo.getChangelog().new ParentWalker(); | |
125 pw.init(); | |
126 PhasesHelper ph = new PhasesHelper(hgRepo, pw); | |
127 System.out.println("With ParentWalker(simulates HgChangeset case)"); | |
128 for (int i = 0, l = hgRepo.getChangelog().getLastRevision(); i <= l; i++) { | |
129 HgPhase phase = ph.getPhase(i, null); | |
130 System.out.printf("rev:%3d, phase:%s\n", i, phase); | |
131 } | |
132 ph = new PhasesHelper(hgRepo); | |
133 System.out.println("Without ParentWalker"); | |
134 for (int i = 0, l = hgRepo.getChangelog().getLastRevision(); i <= l; i++) { | |
135 HgPhase phase = ph.getPhase(i, null); | |
136 System.out.printf("rev:%3d, phase:%s\n", i, phase); | |
137 } | |
116 } | 138 } |
117 | 139 |
118 private void buildFileLog() throws Exception { | 140 private void buildFileLog() throws Exception { |
119 HgLogCommand cmd = new HgLogCommand(hgRepo); | 141 HgLogCommand cmd = new HgLogCommand(hgRepo); |
120 cmd.file("file1", false); | 142 cmd.file("file1", false); |