Mercurial > hg4j
comparison test/org/tmatesoft/hg/test/TestStatus.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 | bcd31a4c638a |
comparison
equal
deleted
inserted
replaced
93:d55d4eedfc57 | 94:af1f3b78b918 |
---|---|
25 | 25 |
26 import org.tmatesoft.hg.core.Path; | 26 import org.tmatesoft.hg.core.Path; |
27 import org.tmatesoft.hg.core.StatusCommand; | 27 import org.tmatesoft.hg.core.StatusCommand; |
28 import org.tmatesoft.hg.repo.HgRepository; | 28 import org.tmatesoft.hg.repo.HgRepository; |
29 import org.tmatesoft.hg.repo.Lookup; | 29 import org.tmatesoft.hg.repo.Lookup; |
30 import org.tmatesoft.hg.repo.StatusCollector; | 30 import org.tmatesoft.hg.repo.HgStatusCollector; |
31 import org.tmatesoft.hg.repo.WorkingCopyStatusCollector; | 31 import org.tmatesoft.hg.repo.HgWorkingCopyStatusCollector; |
32 | 32 |
33 | 33 |
34 /** | 34 /** |
35 * | 35 * |
36 * @author Artem Tikhomirov | 36 * @author Artem Tikhomirov |
54 statusParser = new StatusOutputParser(); | 54 statusParser = new StatusOutputParser(); |
55 eh = new ExecHelper(statusParser, null); | 55 eh = new ExecHelper(statusParser, null); |
56 } | 56 } |
57 | 57 |
58 public void testLowLevel() throws Exception { | 58 public void testLowLevel() throws Exception { |
59 final WorkingCopyStatusCollector wcc = new WorkingCopyStatusCollector(repo); | 59 final HgWorkingCopyStatusCollector wcc = new HgWorkingCopyStatusCollector(repo); |
60 statusParser.reset(); | 60 statusParser.reset(); |
61 eh.run("hg", "status", "-A"); | 61 eh.run("hg", "status", "-A"); |
62 StatusCollector.Record r = wcc.status(HgRepository.TIP); | 62 HgStatusCollector.Record r = wcc.status(HgRepository.TIP); |
63 report("hg status -A", r, statusParser); | 63 report("hg status -A", r, statusParser); |
64 // | 64 // |
65 statusParser.reset(); | 65 statusParser.reset(); |
66 int revision = 3; | 66 int revision = 3; |
67 eh.run("hg", "status", "-A", "--rev", String.valueOf(revision)); | 67 eh.run("hg", "status", "-A", "--rev", String.valueOf(revision)); |
68 r = wcc.status(revision); | 68 r = wcc.status(revision); |
69 report("status -A --rev " + revision, r, statusParser); | 69 report("status -A --rev " + revision, r, statusParser); |
70 // | 70 // |
71 statusParser.reset(); | 71 statusParser.reset(); |
72 eh.run("hg", "status", "-A", "--change", String.valueOf(revision)); | 72 eh.run("hg", "status", "-A", "--change", String.valueOf(revision)); |
73 r = new StatusCollector.Record(); | 73 r = new HgStatusCollector.Record(); |
74 new StatusCollector(repo).change(revision, r); | 74 new HgStatusCollector(repo).change(revision, r); |
75 report("status -A --change " + revision, r, statusParser); | 75 report("status -A --change " + revision, r, statusParser); |
76 // | 76 // |
77 statusParser.reset(); | 77 statusParser.reset(); |
78 int rev2 = 80; | 78 int rev2 = 80; |
79 final String range = String.valueOf(revision) + ":" + String.valueOf(rev2); | 79 final String range = String.valueOf(revision) + ":" + String.valueOf(rev2); |
80 eh.run("hg", "status", "-A", "--rev", range); | 80 eh.run("hg", "status", "-A", "--rev", range); |
81 r = new StatusCollector(repo).status(revision, rev2); | 81 r = new HgStatusCollector(repo).status(revision, rev2); |
82 report("Status -A -rev " + range, r, statusParser); | 82 report("Status -A -rev " + range, r, statusParser); |
83 } | 83 } |
84 | 84 |
85 public void testStatusCommand() throws Exception { | 85 public void testStatusCommand() throws Exception { |
86 final StatusCommand sc = new StatusCommand(repo).all(); | 86 final StatusCommand sc = new StatusCommand(repo).all(); |
87 StatusCollector.Record r; | 87 HgStatusCollector.Record r; |
88 statusParser.reset(); | 88 statusParser.reset(); |
89 eh.run("hg", "status", "-A"); | 89 eh.run("hg", "status", "-A"); |
90 sc.execute(r = new StatusCollector.Record()); | 90 sc.execute(r = new HgStatusCollector.Record()); |
91 report("hg status -A", r, statusParser); | 91 report("hg status -A", r, statusParser); |
92 // | 92 // |
93 statusParser.reset(); | 93 statusParser.reset(); |
94 int revision = 3; | 94 int revision = 3; |
95 eh.run("hg", "status", "-A", "--rev", String.valueOf(revision)); | 95 eh.run("hg", "status", "-A", "--rev", String.valueOf(revision)); |
96 sc.base(revision).execute(r = new StatusCollector.Record()); | 96 sc.base(revision).execute(r = new HgStatusCollector.Record()); |
97 report("status -A --rev " + revision, r, statusParser); | 97 report("status -A --rev " + revision, r, statusParser); |
98 // | 98 // |
99 statusParser.reset(); | 99 statusParser.reset(); |
100 eh.run("hg", "status", "-A", "--change", String.valueOf(revision)); | 100 eh.run("hg", "status", "-A", "--change", String.valueOf(revision)); |
101 sc.base(TIP).revision(revision).execute(r = new StatusCollector.Record()); | 101 sc.base(TIP).revision(revision).execute(r = new HgStatusCollector.Record()); |
102 report("status -A --change " + revision, r, statusParser); | 102 report("status -A --change " + revision, r, statusParser); |
103 | 103 |
104 // TODO check not -A, but defaults()/custom set of modifications | 104 // TODO check not -A, but defaults()/custom set of modifications |
105 } | 105 } |
106 | 106 |
110 | 110 |
111 Reports extra REMOVED file (the one added and removed in between). Shall not | 111 Reports extra REMOVED file (the one added and removed in between). Shall not |
112 */ | 112 */ |
113 } | 113 } |
114 | 114 |
115 private static void report(String what, StatusCollector.Record r, StatusOutputParser statusParser) { | 115 private static void report(String what, HgStatusCollector.Record r, StatusOutputParser statusParser) { |
116 System.out.println(">>>" + what); | 116 System.out.println(">>>" + what); |
117 reportNotEqual("MODIFIED", r.getModified(), statusParser.getModified()); | 117 reportNotEqual("MODIFIED", r.getModified(), statusParser.getModified()); |
118 reportNotEqual("ADDED", r.getAdded(), statusParser.getAdded()); | 118 reportNotEqual("ADDED", r.getAdded(), statusParser.getAdded()); |
119 reportNotEqual("REMOVED", r.getRemoved(), statusParser.getRemoved()); | 119 reportNotEqual("REMOVED", r.getRemoved(), statusParser.getRemoved()); |
120 reportNotEqual("CLEAN", r.getClean(), statusParser.getClean()); | 120 reportNotEqual("CLEAN", r.getClean(), statusParser.getClean()); |