Mercurial > hg4j
comparison cmdline/org/tmatesoft/hg/console/Status.java @ 94:af1f3b78b918
*StatusCollector renamed to Hg*StatusCollector
author | Artem Tikhomirov <tikhomirov.artem@gmail.com> |
---|---|
date | Thu, 27 Jan 2011 21:18:47 +0100 |
parents | d55d4eedfc57 |
children | ace7042a5ce6 |
comparison
equal
deleted
inserted
replaced
93:d55d4eedfc57 | 94:af1f3b78b918 |
---|---|
27 import org.tmatesoft.hg.core.Path; | 27 import org.tmatesoft.hg.core.Path; |
28 import org.tmatesoft.hg.repo.HgDataFile; | 28 import org.tmatesoft.hg.repo.HgDataFile; |
29 import org.tmatesoft.hg.repo.HgRepository; | 29 import org.tmatesoft.hg.repo.HgRepository; |
30 import org.tmatesoft.hg.repo.HgStatusInspector; | 30 import org.tmatesoft.hg.repo.HgStatusInspector; |
31 import org.tmatesoft.hg.repo.Internals; | 31 import org.tmatesoft.hg.repo.Internals; |
32 import org.tmatesoft.hg.repo.StatusCollector; | 32 import org.tmatesoft.hg.repo.HgStatusCollector; |
33 import org.tmatesoft.hg.repo.StatusCollector.Record; | 33 import org.tmatesoft.hg.repo.HgStatusCollector.Record; |
34 import org.tmatesoft.hg.repo.WorkingCopyStatusCollector; | 34 import org.tmatesoft.hg.repo.HgWorkingCopyStatusCollector; |
35 | 35 |
36 /** | 36 /** |
37 * | 37 * |
38 * @author Artem Tikhomirov | 38 * @author Artem Tikhomirov |
39 * @author TMate Software Ltd. | 39 * @author TMate Software Ltd. |
56 //statusWorkingCopy(hgRepo); | 56 //statusWorkingCopy(hgRepo); |
57 statusRevVsWorkingCopy(hgRepo); | 57 statusRevVsWorkingCopy(hgRepo); |
58 } | 58 } |
59 | 59 |
60 private static void statusWorkingCopy(HgRepository hgRepo) { | 60 private static void statusWorkingCopy(HgRepository hgRepo) { |
61 WorkingCopyStatusCollector wcc = new WorkingCopyStatusCollector(hgRepo); | 61 HgWorkingCopyStatusCollector wcc = new HgWorkingCopyStatusCollector(hgRepo); |
62 StatusCollector.Record r = new StatusCollector.Record(); | 62 HgStatusCollector.Record r = new HgStatusCollector.Record(); |
63 wcc.walk(TIP, r); | 63 wcc.walk(TIP, r); |
64 mardu(r); | 64 mardu(r); |
65 } | 65 } |
66 | 66 |
67 private static void mardu(Record r) { | 67 private static void mardu(Record r) { |
73 // sortAndPrint('C', r.getClean()); | 73 // sortAndPrint('C', r.getClean()); |
74 sortAndPrint('!', r.getMissing()); | 74 sortAndPrint('!', r.getMissing()); |
75 } | 75 } |
76 | 76 |
77 private static void statusRevVsWorkingCopy(HgRepository hgRepo) { | 77 private static void statusRevVsWorkingCopy(HgRepository hgRepo) { |
78 WorkingCopyStatusCollector wcc = new WorkingCopyStatusCollector(hgRepo); | 78 HgWorkingCopyStatusCollector wcc = new HgWorkingCopyStatusCollector(hgRepo); |
79 StatusCollector.Record r = new StatusCollector.Record(); | 79 HgStatusCollector.Record r = new HgStatusCollector.Record(); |
80 wcc.walk(3, r); | 80 wcc.walk(3, r); |
81 mardu(r); | 81 mardu(r); |
82 } | 82 } |
83 | 83 |
84 private static void bunchOfTests(HgRepository hgRepo) throws Exception { | 84 private static void bunchOfTests(HgRepository hgRepo) throws Exception { |
85 Internals debug = new Internals(hgRepo); | 85 Internals debug = new Internals(hgRepo); |
86 debug.dumpDirstate(); | 86 debug.dumpDirstate(); |
87 final StatusDump dump = new StatusDump(); | 87 final StatusDump dump = new StatusDump(); |
88 dump.showIgnored = false; | 88 dump.showIgnored = false; |
89 dump.showClean = false; | 89 dump.showClean = false; |
90 StatusCollector sc = new StatusCollector(hgRepo); | 90 HgStatusCollector sc = new HgStatusCollector(hgRepo); |
91 final int r1 = 0, r2 = 3; | 91 final int r1 = 0, r2 = 3; |
92 System.out.printf("Status for changes between revision %d and %d:\n", r1, r2); | 92 System.out.printf("Status for changes between revision %d and %d:\n", r1, r2); |
93 sc.walk(r1, r2, dump); | 93 sc.walk(r1, r2, dump); |
94 // | 94 // |
95 System.out.println("\n\nSame, but sorted in the way hg status does:"); | 95 System.out.println("\n\nSame, but sorted in the way hg status does:"); |
96 StatusCollector.Record r = sc.status(r1, r2); | 96 HgStatusCollector.Record r = sc.status(r1, r2); |
97 sortAndPrint('M', r.getModified()); | 97 sortAndPrint('M', r.getModified()); |
98 sortAndPrint('A', r.getAdded()); | 98 sortAndPrint('A', r.getAdded()); |
99 sortAndPrint('R', r.getRemoved()); | 99 sortAndPrint('R', r.getRemoved()); |
100 // | 100 // |
101 System.out.println("\n\nTry hg status --change <rev>:"); | 101 System.out.println("\n\nTry hg status --change <rev>:"); |
102 sc.change(0, dump); | 102 sc.change(0, dump); |
103 System.out.println("\nStatus against working dir:"); | 103 System.out.println("\nStatus against working dir:"); |
104 WorkingCopyStatusCollector wcc = new WorkingCopyStatusCollector(hgRepo); | 104 HgWorkingCopyStatusCollector wcc = new HgWorkingCopyStatusCollector(hgRepo); |
105 wcc.walk(TIP, dump); | 105 wcc.walk(TIP, dump); |
106 System.out.println(); | 106 System.out.println(); |
107 System.out.printf("Manifest of the revision %d:\n", r2); | 107 System.out.printf("Manifest of the revision %d:\n", r2); |
108 hgRepo.getManifest().walk(r2, r2, new Manifest.Dump()); | 108 hgRepo.getManifest().walk(r2, r2, new Manifest.Dump()); |
109 System.out.println(); | 109 System.out.println(); |