Mercurial > hg4j
comparison test/org/tmatesoft/hg/test/TestIncoming.java @ 203:66fd2c73c56f
Basic test for HgOutgoingCommand. Handle cases with no outgoing changes in RepositoryComparator
author | Artem Tikhomirov <tikhomirov.artem@gmail.com> |
---|---|
date | Tue, 26 Apr 2011 15:52:33 +0200 |
parents | 706bcc7cfee4 |
children | 883f1efbcf27 |
comparison
equal
deleted
inserted
replaced
202:706bcc7cfee4 | 203:66fd2c73c56f |
---|---|
91 LogOutputParser outParser = new LogOutputParser(true); | 91 LogOutputParser outParser = new LogOutputParser(true); |
92 ExecHelper eh = new ExecHelper(outParser, new File(localRepo.getLocation())); | 92 ExecHelper eh = new ExecHelper(outParser, new File(localRepo.getLocation())); |
93 cmd.executeFull(collector); | 93 cmd.executeFull(collector); |
94 eh.run("hg", "incoming", "--debug", hgRemote.getLocation()); | 94 eh.run("hg", "incoming", "--debug", hgRemote.getLocation()); |
95 List<Nodeid> liteResult = cmd.executeLite(null); | 95 List<Nodeid> liteResult = cmd.executeLite(null); |
96 report(collector, outParser, liteResult); | 96 report(collector, outParser, liteResult, errorCollector); |
97 return liteResult; | 97 return liteResult; |
98 } | 98 } |
99 | 99 |
100 private void report(HgLogCommand.CollectHandler collector, LogOutputParser outParser, List<Nodeid> liteResult) { | 100 static void report(HgLogCommand.CollectHandler collector, LogOutputParser outParser, List<Nodeid> liteResult, ErrorCollectorExt errorCollector) { |
101 TestHistory.report("hg in - against blank repo", collector.getChanges(), outParser.getResult(), false, errorCollector); | 101 TestHistory.report("hg vs execFull", collector.getChanges(), outParser.getResult(), false, errorCollector); |
102 // | 102 // |
103 ArrayList<Nodeid> expected = new ArrayList<Nodeid>(outParser.getResult().size()); | 103 ArrayList<Nodeid> expected = new ArrayList<Nodeid>(outParser.getResult().size()); |
104 for (LogOutputParser.Record r : outParser.getResult()) { | 104 for (LogOutputParser.Record r : outParser.getResult()) { |
105 Nodeid nid = Nodeid.fromAscii(r.changesetNodeid); | 105 Nodeid nid = Nodeid.fromAscii(r.changesetNodeid); |
106 expected.add(nid); | 106 expected.add(nid); |
120 boolean removed = set.remove(nid); | 120 boolean removed = set.remove(nid); |
121 errorCollector.checkThat(what + " Missing " + nid.shortNotation() + " in HgIncomingCommand.execLite result", removed, equalTo(true)); | 121 errorCollector.checkThat(what + " Missing " + nid.shortNotation() + " in HgIncomingCommand.execLite result", removed, equalTo(true)); |
122 } | 122 } |
123 errorCollector.checkThat(what + " Superfluous cset reported by HgIncomingCommand.execLite", set.isEmpty(), equalTo(true)); | 123 errorCollector.checkThat(what + " Superfluous cset reported by HgIncomingCommand.execLite", set.isEmpty(), equalTo(true)); |
124 } | 124 } |
125 | 125 |
126 static File initEmptyTempRepo(String dirName) throws IOException { | 126 static File createEmptyDir(String dirName) throws IOException { |
127 File dest = new File(Configuration.get().getTempDir(), dirName); | 127 File dest = new File(Configuration.get().getTempDir(), dirName); |
128 if (dest.exists()) { | 128 if (dest.exists()) { |
129 TestClone.rmdir(dest); | 129 TestClone.rmdir(dest); |
130 } | 130 } |
131 dest.mkdirs(); | 131 dest.mkdirs(); |
132 return dest; | |
133 } | |
134 | |
135 static File initEmptyTempRepo(String dirName) throws IOException { | |
136 File dest = createEmptyDir(dirName); | |
132 Internals implHelper = new Internals(); | 137 Internals implHelper = new Internals(); |
133 implHelper.setStorageConfig(1, STORE | FNCACHE | DOTENCODE); | 138 implHelper.setStorageConfig(1, STORE | FNCACHE | DOTENCODE); |
134 implHelper.initEmptyRepository(new File(dest, ".hg")); | 139 implHelper.initEmptyRepository(new File(dest, ".hg")); |
135 return dest; | 140 return dest; |
136 } | 141 } |