Mercurial > hg4j
annotate test/org/tmatesoft/hg/test/TestStatus.java @ 559:6ca3d0c5b4bc
Commit: tests and fixes for defects discovered
author | Artem Tikhomirov <tikhomirov.artem@gmail.com> |
---|---|
date | Mon, 25 Feb 2013 19:48:20 +0100 |
parents | 5c09a9f2e073 |
children | b286222158be |
rev | line source |
---|---|
61
fac8e7fcc8b0
Simple test framework - capable of parsing Hg cmdline output to compare with Java result
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
diff
changeset
|
1 /* |
397
5e95b0da26f2
Issue 24: IAE, Underflow in FilterDataAccess. Issue 26:UnsupportedOperationException when patching empty base revision. Tests
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
387
diff
changeset
|
2 * Copyright (c) 2011-2012 TMate Software Ltd |
66
52dc3f4cfc76
Primitive test suite in org.tmatesoft
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
62
diff
changeset
|
3 * |
52dc3f4cfc76
Primitive test suite in org.tmatesoft
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
62
diff
changeset
|
4 * This program is free software; you can redistribute it and/or modify |
52dc3f4cfc76
Primitive test suite in org.tmatesoft
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
62
diff
changeset
|
5 * it under the terms of the GNU General Public License as published by |
52dc3f4cfc76
Primitive test suite in org.tmatesoft
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
62
diff
changeset
|
6 * the Free Software Foundation; version 2 of the License. |
52dc3f4cfc76
Primitive test suite in org.tmatesoft
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
62
diff
changeset
|
7 * |
52dc3f4cfc76
Primitive test suite in org.tmatesoft
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
62
diff
changeset
|
8 * This program is distributed in the hope that it will be useful, |
52dc3f4cfc76
Primitive test suite in org.tmatesoft
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
62
diff
changeset
|
9 * but WITHOUT ANY WARRANTY; without even the implied warranty of |
52dc3f4cfc76
Primitive test suite in org.tmatesoft
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
62
diff
changeset
|
10 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
52dc3f4cfc76
Primitive test suite in org.tmatesoft
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
62
diff
changeset
|
11 * GNU General Public License for more details. |
52dc3f4cfc76
Primitive test suite in org.tmatesoft
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
62
diff
changeset
|
12 * |
52dc3f4cfc76
Primitive test suite in org.tmatesoft
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
62
diff
changeset
|
13 * For information on how to redistribute this software under |
52dc3f4cfc76
Primitive test suite in org.tmatesoft
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
62
diff
changeset
|
14 * the terms of a license other than GNU General Public License |
102
a3a2e5deb320
Updated contact address to support@hg4j.com
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
101
diff
changeset
|
15 * contact TMate Software at support@hg4j.com |
61
fac8e7fcc8b0
Simple test framework - capable of parsing Hg cmdline output to compare with Java result
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
diff
changeset
|
16 */ |
66
52dc3f4cfc76
Primitive test suite in org.tmatesoft
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
62
diff
changeset
|
17 package org.tmatesoft.hg.test; |
61
fac8e7fcc8b0
Simple test framework - capable of parsing Hg cmdline output to compare with Java result
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
diff
changeset
|
18 |
229
1ec6b327a6ac
Scope for status reworked: explicit files or a general matcher
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
224
diff
changeset
|
19 import static org.hamcrest.CoreMatchers.equalTo; |
1ec6b327a6ac
Scope for status reworked: explicit files or a general matcher
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
224
diff
changeset
|
20 import static org.junit.Assert.assertEquals; |
224
7fe5982bcac0
Few tests for HgWorkingCopyStatusCollector
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
162
diff
changeset
|
21 import static org.junit.Assert.assertTrue; |
127
2e395db595e2
Moved HgStatus to toplevel
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
109
diff
changeset
|
22 import static org.tmatesoft.hg.core.HgStatus.Kind.*; |
74
6f1b88693d48
Complete refactoring to org.tmatesoft
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
68
diff
changeset
|
23 import static org.tmatesoft.hg.repo.HgRepository.TIP; |
429
cd658b24a620
FIXMEs: javadoc, proper use of constants
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
427
diff
changeset
|
24 import static org.tmatesoft.hg.repo.HgRepository.WORKING_COPY; |
68
0e499fed9b3d
StatusCommand with tests. Extra constants to indicate common revision cases
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
66
diff
changeset
|
25 |
397
5e95b0da26f2
Issue 24: IAE, Underflow in FilterDataAccess. Issue 26:UnsupportedOperationException when patching empty base revision. Tests
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
387
diff
changeset
|
26 import java.io.File; |
282
e51dd9a14b6f
Yet another WC status fix, where dirstate parent and base revision are treated right (dirstate parent other than tip and explicit baseRevision are not the same)
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
230
diff
changeset
|
27 import java.util.ArrayList; |
61
fac8e7fcc8b0
Simple test framework - capable of parsing Hg cmdline output to compare with Java result
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
diff
changeset
|
28 import java.util.Collection; |
103
0b2dcca7de9f
ErrorCollector in tests to grab multiple errors
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
102
diff
changeset
|
29 import java.util.Collections; |
75
e62f9638fb27
Modified test to check copied files
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
74
diff
changeset
|
30 import java.util.HashMap; |
360
150500515714
Report non-critical errors during status operation to handler/inspector
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
283
diff
changeset
|
31 import java.util.LinkedHashMap; |
61
fac8e7fcc8b0
Simple test framework - capable of parsing Hg cmdline output to compare with Java result
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
diff
changeset
|
32 import java.util.LinkedList; |
fac8e7fcc8b0
Simple test framework - capable of parsing Hg cmdline output to compare with Java result
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
diff
changeset
|
33 import java.util.List; |
109
dd4d2d0e42cd
Handler for StatusCommand to get notifications in the form of HgStatus object
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
103
diff
changeset
|
34 import java.util.Map; |
dd4d2d0e42cd
Handler for StatusCommand to get notifications in the form of HgStatus object
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
103
diff
changeset
|
35 import java.util.TreeMap; |
61
fac8e7fcc8b0
Simple test framework - capable of parsing Hg cmdline output to compare with Java result
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
diff
changeset
|
36 |
101
777ab7034c1b
Switch to JUnit for tests
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
100
diff
changeset
|
37 import org.junit.Assume; |
282
e51dd9a14b6f
Yet another WC status fix, where dirstate parent and base revision are treated right (dirstate parent other than tip and explicit baseRevision are not the same)
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
230
diff
changeset
|
38 import org.junit.Ignore; |
103
0b2dcca7de9f
ErrorCollector in tests to grab multiple errors
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
102
diff
changeset
|
39 import org.junit.Rule; |
101
777ab7034c1b
Switch to JUnit for tests
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
100
diff
changeset
|
40 import org.junit.Test; |
127
2e395db595e2
Moved HgStatus to toplevel
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
109
diff
changeset
|
41 import org.tmatesoft.hg.core.HgStatus; |
224
7fe5982bcac0
Few tests for HgWorkingCopyStatusCollector
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
162
diff
changeset
|
42 import org.tmatesoft.hg.core.HgStatus.Kind; |
131
aa1629f36482
Renamed .core classes to start with Hg prefix
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
127
diff
changeset
|
43 import org.tmatesoft.hg.core.HgStatusCommand; |
360
150500515714
Report non-critical errors during status operation to handler/inspector
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
283
diff
changeset
|
44 import org.tmatesoft.hg.core.HgStatusHandler; |
229
1ec6b327a6ac
Scope for status reworked: explicit files or a general matcher
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
224
diff
changeset
|
45 import org.tmatesoft.hg.internal.PathGlobMatcher; |
101
777ab7034c1b
Switch to JUnit for tests
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
100
diff
changeset
|
46 import org.tmatesoft.hg.repo.HgLookup; |
74
6f1b88693d48
Complete refactoring to org.tmatesoft
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
68
diff
changeset
|
47 import org.tmatesoft.hg.repo.HgRepository; |
94
af1f3b78b918
*StatusCollector renamed to Hg*StatusCollector
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
93
diff
changeset
|
48 import org.tmatesoft.hg.repo.HgStatusCollector; |
af1f3b78b918
*StatusCollector renamed to Hg*StatusCollector
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
93
diff
changeset
|
49 import org.tmatesoft.hg.repo.HgWorkingCopyStatusCollector; |
133
4a948ec83980
core.Path to util.Path as it's not Hg repo dependant
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
131
diff
changeset
|
50 import org.tmatesoft.hg.util.Path; |
454
36fd1fd06492
oth.util.Status renamed to Outcome as the noun is too overloaded, especially in scm
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
442
diff
changeset
|
51 import org.tmatesoft.hg.util.Outcome; |
68
0e499fed9b3d
StatusCommand with tests. Extra constants to indicate common revision cases
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
66
diff
changeset
|
52 |
61
fac8e7fcc8b0
Simple test framework - capable of parsing Hg cmdline output to compare with Java result
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
diff
changeset
|
53 /** |
76
658fa6b3a371
Fixed a defect when a file added and removed past some revision was reported as R for status against that rev
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
75
diff
changeset
|
54 * |
66
52dc3f4cfc76
Primitive test suite in org.tmatesoft
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
62
diff
changeset
|
55 * @author Artem Tikhomirov |
52dc3f4cfc76
Primitive test suite in org.tmatesoft
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
62
diff
changeset
|
56 * @author TMate Software Ltd. |
61
fac8e7fcc8b0
Simple test framework - capable of parsing Hg cmdline output to compare with Java result
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
diff
changeset
|
57 */ |
fac8e7fcc8b0
Simple test framework - capable of parsing Hg cmdline output to compare with Java result
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
diff
changeset
|
58 public class TestStatus { |
fac8e7fcc8b0
Simple test framework - capable of parsing Hg cmdline output to compare with Java result
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
diff
changeset
|
59 |
103
0b2dcca7de9f
ErrorCollector in tests to grab multiple errors
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
102
diff
changeset
|
60 @Rule |
0b2dcca7de9f
ErrorCollector in tests to grab multiple errors
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
102
diff
changeset
|
61 public ErrorCollectorExt errorCollector = new ErrorCollectorExt(); |
0b2dcca7de9f
ErrorCollector in tests to grab multiple errors
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
102
diff
changeset
|
62 |
224
7fe5982bcac0
Few tests for HgWorkingCopyStatusCollector
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
162
diff
changeset
|
63 private HgRepository repo; |
66
52dc3f4cfc76
Primitive test suite in org.tmatesoft
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
62
diff
changeset
|
64 private StatusOutputParser statusParser; |
52dc3f4cfc76
Primitive test suite in org.tmatesoft
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
62
diff
changeset
|
65 private ExecHelper eh; |
442
6865eb742883
Tests for subrepo API, refactor status tests for reuse, better subrepos API
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
429
diff
changeset
|
66 private StatusReporter sr; |
66
52dc3f4cfc76
Primitive test suite in org.tmatesoft
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
62
diff
changeset
|
67 |
103
0b2dcca7de9f
ErrorCollector in tests to grab multiple errors
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
102
diff
changeset
|
68 public static void main(String[] args) throws Throwable { |
101
777ab7034c1b
Switch to JUnit for tests
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
100
diff
changeset
|
69 TestStatus test = new TestStatus(); |
66
52dc3f4cfc76
Primitive test suite in org.tmatesoft
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
62
diff
changeset
|
70 test.testLowLevel(); |
99
4d7bb95d553b
StatusCommand().add should list copies
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
95
diff
changeset
|
71 test.testStatusCommand(); |
100
b71b3f7d24d4
Primitive performance test
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
99
diff
changeset
|
72 test.testPerformance(); |
103
0b2dcca7de9f
ErrorCollector in tests to grab multiple errors
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
102
diff
changeset
|
73 test.errorCollector.verify(); |
282
e51dd9a14b6f
Yet another WC status fix, where dirstate parent and base revision are treated right (dirstate parent other than tip and explicit baseRevision are not the same)
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
230
diff
changeset
|
74 // |
e51dd9a14b6f
Yet another WC status fix, where dirstate parent and base revision are treated right (dirstate parent other than tip and explicit baseRevision are not the same)
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
230
diff
changeset
|
75 TestStatus t2 = new TestStatus(new HgLookup().detect("/temp/hg/hg4j-merging/hg4j")); |
283
7a8e1a305a78
Ignored tests shall be valid tests nevertheless
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
282
diff
changeset
|
76 t2.testDirstateParentOtherThanTipWithUpdate(); |
282
e51dd9a14b6f
Yet another WC status fix, where dirstate parent and base revision are treated right (dirstate parent other than tip and explicit baseRevision are not the same)
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
230
diff
changeset
|
77 t2.errorCollector.verify(); |
e51dd9a14b6f
Yet another WC status fix, where dirstate parent and base revision are treated right (dirstate parent other than tip and explicit baseRevision are not the same)
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
230
diff
changeset
|
78 TestStatus t3 = new TestStatus(new HgLookup().detect("/temp/hg/cpython")); |
283
7a8e1a305a78
Ignored tests shall be valid tests nevertheless
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
282
diff
changeset
|
79 t3.testDirstateParentOtherThanTipNoUpdate(); |
282
e51dd9a14b6f
Yet another WC status fix, where dirstate parent and base revision are treated right (dirstate parent other than tip and explicit baseRevision are not the same)
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
230
diff
changeset
|
80 t3.errorCollector.verify(); |
66
52dc3f4cfc76
Primitive test suite in org.tmatesoft
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
62
diff
changeset
|
81 } |
442
6865eb742883
Tests for subrepo API, refactor status tests for reuse, better subrepos API
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
429
diff
changeset
|
82 |
101
777ab7034c1b
Switch to JUnit for tests
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
100
diff
changeset
|
83 public TestStatus() throws Exception { |
777ab7034c1b
Switch to JUnit for tests
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
100
diff
changeset
|
84 this(new HgLookup().detectFromWorkingDir()); |
777ab7034c1b
Switch to JUnit for tests
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
100
diff
changeset
|
85 } |
777ab7034c1b
Switch to JUnit for tests
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
100
diff
changeset
|
86 |
777ab7034c1b
Switch to JUnit for tests
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
100
diff
changeset
|
87 private TestStatus(HgRepository hgRepo) { |
66
52dc3f4cfc76
Primitive test suite in org.tmatesoft
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
62
diff
changeset
|
88 repo = hgRepo; |
101
777ab7034c1b
Switch to JUnit for tests
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
100
diff
changeset
|
89 Assume.assumeTrue(!repo.isInvalid()); |
66
52dc3f4cfc76
Primitive test suite in org.tmatesoft
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
62
diff
changeset
|
90 statusParser = new StatusOutputParser(); |
282
e51dd9a14b6f
Yet another WC status fix, where dirstate parent and base revision are treated right (dirstate parent other than tip and explicit baseRevision are not the same)
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
230
diff
changeset
|
91 eh = new ExecHelper(statusParser, hgRepo.getWorkingDir()); |
442
6865eb742883
Tests for subrepo API, refactor status tests for reuse, better subrepos API
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
429
diff
changeset
|
92 sr = new StatusReporter(errorCollector, statusParser); |
66
52dc3f4cfc76
Primitive test suite in org.tmatesoft
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
62
diff
changeset
|
93 } |
442
6865eb742883
Tests for subrepo API, refactor status tests for reuse, better subrepos API
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
429
diff
changeset
|
94 |
101
777ab7034c1b
Switch to JUnit for tests
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
100
diff
changeset
|
95 @Test |
66
52dc3f4cfc76
Primitive test suite in org.tmatesoft
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
62
diff
changeset
|
96 public void testLowLevel() throws Exception { |
94
af1f3b78b918
*StatusCollector renamed to Hg*StatusCollector
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
93
diff
changeset
|
97 final HgWorkingCopyStatusCollector wcc = new HgWorkingCopyStatusCollector(repo); |
68
0e499fed9b3d
StatusCommand with tests. Extra constants to indicate common revision cases
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
66
diff
changeset
|
98 statusParser.reset(); |
61
fac8e7fcc8b0
Simple test framework - capable of parsing Hg cmdline output to compare with Java result
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
diff
changeset
|
99 eh.run("hg", "status", "-A"); |
94
af1f3b78b918
*StatusCollector renamed to Hg*StatusCollector
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
93
diff
changeset
|
100 HgStatusCollector.Record r = wcc.status(HgRepository.TIP); |
442
6865eb742883
Tests for subrepo API, refactor status tests for reuse, better subrepos API
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
429
diff
changeset
|
101 sr.report("hg status -A", r); |
62
25819103de17
Few more tests for status
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
61
diff
changeset
|
102 // |
25819103de17
Few more tests for status
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
61
diff
changeset
|
103 statusParser.reset(); |
25819103de17
Few more tests for status
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
61
diff
changeset
|
104 int revision = 3; |
25819103de17
Few more tests for status
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
61
diff
changeset
|
105 eh.run("hg", "status", "-A", "--rev", String.valueOf(revision)); |
25819103de17
Few more tests for status
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
61
diff
changeset
|
106 r = wcc.status(revision); |
442
6865eb742883
Tests for subrepo API, refactor status tests for reuse, better subrepos API
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
429
diff
changeset
|
107 sr.report("status -A --rev " + revision, r); |
62
25819103de17
Few more tests for status
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
61
diff
changeset
|
108 // |
25819103de17
Few more tests for status
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
61
diff
changeset
|
109 statusParser.reset(); |
25819103de17
Few more tests for status
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
61
diff
changeset
|
110 eh.run("hg", "status", "-A", "--change", String.valueOf(revision)); |
94
af1f3b78b918
*StatusCollector renamed to Hg*StatusCollector
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
93
diff
changeset
|
111 r = new HgStatusCollector.Record(); |
af1f3b78b918
*StatusCollector renamed to Hg*StatusCollector
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
93
diff
changeset
|
112 new HgStatusCollector(repo).change(revision, r); |
442
6865eb742883
Tests for subrepo API, refactor status tests for reuse, better subrepos API
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
429
diff
changeset
|
113 sr.report("status -A --change " + revision, r); |
88
61eedab3eb3e
Status between two revisions to recognize copy/rename
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
76
diff
changeset
|
114 // |
61eedab3eb3e
Status between two revisions to recognize copy/rename
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
76
diff
changeset
|
115 statusParser.reset(); |
61eedab3eb3e
Status between two revisions to recognize copy/rename
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
76
diff
changeset
|
116 int rev2 = 80; |
61eedab3eb3e
Status between two revisions to recognize copy/rename
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
76
diff
changeset
|
117 final String range = String.valueOf(revision) + ":" + String.valueOf(rev2); |
61eedab3eb3e
Status between two revisions to recognize copy/rename
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
76
diff
changeset
|
118 eh.run("hg", "status", "-A", "--rev", range); |
94
af1f3b78b918
*StatusCollector renamed to Hg*StatusCollector
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
93
diff
changeset
|
119 r = new HgStatusCollector(repo).status(revision, rev2); |
442
6865eb742883
Tests for subrepo API, refactor status tests for reuse, better subrepos API
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
429
diff
changeset
|
120 sr.report("Status -A -rev " + range, r); |
62
25819103de17
Few more tests for status
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
61
diff
changeset
|
121 } |
282
e51dd9a14b6f
Yet another WC status fix, where dirstate parent and base revision are treated right (dirstate parent other than tip and explicit baseRevision are not the same)
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
230
diff
changeset
|
122 |
e51dd9a14b6f
Yet another WC status fix, where dirstate parent and base revision are treated right (dirstate parent other than tip and explicit baseRevision are not the same)
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
230
diff
changeset
|
123 /** |
e51dd9a14b6f
Yet another WC status fix, where dirstate parent and base revision are treated right (dirstate parent other than tip and explicit baseRevision are not the same)
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
230
diff
changeset
|
124 * hg up --rev <earlier rev>; hg status |
e51dd9a14b6f
Yet another WC status fix, where dirstate parent and base revision are treated right (dirstate parent other than tip and explicit baseRevision are not the same)
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
230
diff
changeset
|
125 * |
e51dd9a14b6f
Yet another WC status fix, where dirstate parent and base revision are treated right (dirstate parent other than tip and explicit baseRevision are not the same)
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
230
diff
changeset
|
126 * To check if HgWorkingCopyStatusCollector respects actual working copy parent (takes from dirstate) |
442
6865eb742883
Tests for subrepo API, refactor status tests for reuse, better subrepos API
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
429
diff
changeset
|
127 * and if status is calculated correctly |
282
e51dd9a14b6f
Yet another WC status fix, where dirstate parent and base revision are treated right (dirstate parent other than tip and explicit baseRevision are not the same)
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
230
diff
changeset
|
128 */ |
e51dd9a14b6f
Yet another WC status fix, where dirstate parent and base revision are treated right (dirstate parent other than tip and explicit baseRevision are not the same)
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
230
diff
changeset
|
129 @Test |
e51dd9a14b6f
Yet another WC status fix, where dirstate parent and base revision are treated right (dirstate parent other than tip and explicit baseRevision are not the same)
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
230
diff
changeset
|
130 @Ignore("modifies test repository, needs careful configuration") |
283
7a8e1a305a78
Ignored tests shall be valid tests nevertheless
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
282
diff
changeset
|
131 public void testDirstateParentOtherThanTipWithUpdate() throws Exception { |
7a8e1a305a78
Ignored tests shall be valid tests nevertheless
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
282
diff
changeset
|
132 int revToUpdate = 238; |
7a8e1a305a78
Ignored tests shall be valid tests nevertheless
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
282
diff
changeset
|
133 try { |
7a8e1a305a78
Ignored tests shall be valid tests nevertheless
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
282
diff
changeset
|
134 eh.run("hg", "up", "--rev", String.valueOf(revToUpdate)); |
7a8e1a305a78
Ignored tests shall be valid tests nevertheless
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
282
diff
changeset
|
135 testDirstateParentOtherThanTipNoUpdate(); |
7a8e1a305a78
Ignored tests shall be valid tests nevertheless
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
282
diff
changeset
|
136 } finally { |
7a8e1a305a78
Ignored tests shall be valid tests nevertheless
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
282
diff
changeset
|
137 eh.run("hg", "up"); |
7a8e1a305a78
Ignored tests shall be valid tests nevertheless
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
282
diff
changeset
|
138 } |
7a8e1a305a78
Ignored tests shall be valid tests nevertheless
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
282
diff
changeset
|
139 } |
7a8e1a305a78
Ignored tests shall be valid tests nevertheless
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
282
diff
changeset
|
140 |
7a8e1a305a78
Ignored tests shall be valid tests nevertheless
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
282
diff
changeset
|
141 @Test |
7a8e1a305a78
Ignored tests shall be valid tests nevertheless
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
282
diff
changeset
|
142 @Ignore("needs configuration as it requires special repository") |
7a8e1a305a78
Ignored tests shall be valid tests nevertheless
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
282
diff
changeset
|
143 public void testDirstateParentOtherThanTipNoUpdate() throws Exception { |
282
e51dd9a14b6f
Yet another WC status fix, where dirstate parent and base revision are treated right (dirstate parent other than tip and explicit baseRevision are not the same)
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
230
diff
changeset
|
144 final HgWorkingCopyStatusCollector wcc = new HgWorkingCopyStatusCollector(repo); |
e51dd9a14b6f
Yet another WC status fix, where dirstate parent and base revision are treated right (dirstate parent other than tip and explicit baseRevision are not the same)
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
230
diff
changeset
|
145 statusParser.reset(); |
283
7a8e1a305a78
Ignored tests shall be valid tests nevertheless
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
282
diff
changeset
|
146 // |
7a8e1a305a78
Ignored tests shall be valid tests nevertheless
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
282
diff
changeset
|
147 eh.run("hg", "status", "-A"); |
7a8e1a305a78
Ignored tests shall be valid tests nevertheless
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
282
diff
changeset
|
148 HgStatusCollector.Record r = wcc.status(HgRepository.TIP); |
442
6865eb742883
Tests for subrepo API, refactor status tests for reuse, better subrepos API
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
429
diff
changeset
|
149 sr.report("hg status -A", r); |
283
7a8e1a305a78
Ignored tests shall be valid tests nevertheless
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
282
diff
changeset
|
150 // |
7a8e1a305a78
Ignored tests shall be valid tests nevertheless
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
282
diff
changeset
|
151 statusParser.reset(); |
7a8e1a305a78
Ignored tests shall be valid tests nevertheless
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
282
diff
changeset
|
152 int revision = 3; |
7a8e1a305a78
Ignored tests shall be valid tests nevertheless
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
282
diff
changeset
|
153 eh.run("hg", "status", "-A", "--rev", String.valueOf(revision)); |
7a8e1a305a78
Ignored tests shall be valid tests nevertheless
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
282
diff
changeset
|
154 r = wcc.status(revision); |
442
6865eb742883
Tests for subrepo API, refactor status tests for reuse, better subrepos API
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
429
diff
changeset
|
155 sr.report("status -A --rev " + revision, r); |
282
e51dd9a14b6f
Yet another WC status fix, where dirstate parent and base revision are treated right (dirstate parent other than tip and explicit baseRevision are not the same)
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
230
diff
changeset
|
156 } |
e51dd9a14b6f
Yet another WC status fix, where dirstate parent and base revision are treated right (dirstate parent other than tip and explicit baseRevision are not the same)
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
230
diff
changeset
|
157 |
101
777ab7034c1b
Switch to JUnit for tests
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
100
diff
changeset
|
158 @Test |
66
52dc3f4cfc76
Primitive test suite in org.tmatesoft
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
62
diff
changeset
|
159 public void testStatusCommand() throws Exception { |
131
aa1629f36482
Renamed .core classes to start with Hg prefix
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
127
diff
changeset
|
160 final HgStatusCommand sc = new HgStatusCommand(repo).all(); |
109
dd4d2d0e42cd
Handler for StatusCommand to get notifications in the form of HgStatus object
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
103
diff
changeset
|
161 StatusCollector r; |
68
0e499fed9b3d
StatusCommand with tests. Extra constants to indicate common revision cases
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
66
diff
changeset
|
162 statusParser.reset(); |
0e499fed9b3d
StatusCommand with tests. Extra constants to indicate common revision cases
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
66
diff
changeset
|
163 eh.run("hg", "status", "-A"); |
109
dd4d2d0e42cd
Handler for StatusCommand to get notifications in the form of HgStatus object
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
103
diff
changeset
|
164 sc.execute(r = new StatusCollector()); |
442
6865eb742883
Tests for subrepo API, refactor status tests for reuse, better subrepos API
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
429
diff
changeset
|
165 sr.report("hg status -A", r); |
68
0e499fed9b3d
StatusCommand with tests. Extra constants to indicate common revision cases
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
66
diff
changeset
|
166 // |
0e499fed9b3d
StatusCommand with tests. Extra constants to indicate common revision cases
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
66
diff
changeset
|
167 statusParser.reset(); |
0e499fed9b3d
StatusCommand with tests. Extra constants to indicate common revision cases
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
66
diff
changeset
|
168 int revision = 3; |
0e499fed9b3d
StatusCommand with tests. Extra constants to indicate common revision cases
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
66
diff
changeset
|
169 eh.run("hg", "status", "-A", "--rev", String.valueOf(revision)); |
109
dd4d2d0e42cd
Handler for StatusCommand to get notifications in the form of HgStatus object
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
103
diff
changeset
|
170 sc.base(revision).execute(r = new StatusCollector()); |
442
6865eb742883
Tests for subrepo API, refactor status tests for reuse, better subrepos API
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
429
diff
changeset
|
171 sr.report("status -A --rev " + revision, r); |
68
0e499fed9b3d
StatusCommand with tests. Extra constants to indicate common revision cases
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
66
diff
changeset
|
172 // |
0e499fed9b3d
StatusCommand with tests. Extra constants to indicate common revision cases
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
66
diff
changeset
|
173 statusParser.reset(); |
0e499fed9b3d
StatusCommand with tests. Extra constants to indicate common revision cases
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
66
diff
changeset
|
174 eh.run("hg", "status", "-A", "--change", String.valueOf(revision)); |
109
dd4d2d0e42cd
Handler for StatusCommand to get notifications in the form of HgStatus object
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
103
diff
changeset
|
175 sc.base(TIP).revision(revision).execute(r = new StatusCollector()); |
442
6865eb742883
Tests for subrepo API, refactor status tests for reuse, better subrepos API
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
429
diff
changeset
|
176 sr.report("status -A --change " + revision, r); |
6865eb742883
Tests for subrepo API, refactor status tests for reuse, better subrepos API
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
429
diff
changeset
|
177 |
68
0e499fed9b3d
StatusCommand with tests. Extra constants to indicate common revision cases
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
66
diff
changeset
|
178 // TODO check not -A, but defaults()/custom set of modifications |
66
52dc3f4cfc76
Primitive test suite in org.tmatesoft
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
62
diff
changeset
|
179 } |
442
6865eb742883
Tests for subrepo API, refactor status tests for reuse, better subrepos API
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
429
diff
changeset
|
180 |
6865eb742883
Tests for subrepo API, refactor status tests for reuse, better subrepos API
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
429
diff
changeset
|
181 static class StatusCollector implements HgStatusHandler { |
224
7fe5982bcac0
Few tests for HgWorkingCopyStatusCollector
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
162
diff
changeset
|
182 private final Map<Kind, List<Path>> kind2names = new TreeMap<Kind, List<Path>>(); |
7fe5982bcac0
Few tests for HgWorkingCopyStatusCollector
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
162
diff
changeset
|
183 private final Map<Path, List<Kind>> name2kinds = new TreeMap<Path, List<Kind>>(); |
454
36fd1fd06492
oth.util.Status renamed to Outcome as the noun is too overloaded, especially in scm
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
442
diff
changeset
|
184 private final Map<Path, Outcome> name2error = new LinkedHashMap<Path, Outcome>(); |
442
6865eb742883
Tests for subrepo API, refactor status tests for reuse, better subrepos API
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
429
diff
changeset
|
185 private final Map<Path, Path> new2oldName = new LinkedHashMap<Path, Path>(); |
109
dd4d2d0e42cd
Handler for StatusCommand to get notifications in the form of HgStatus object
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
103
diff
changeset
|
186 |
427
31a89587eb04
FIXMEs: consistent names, throws for commands and their handlers. Use of checked exceptions in hi-level api
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
418
diff
changeset
|
187 public void status(HgStatus s) { |
224
7fe5982bcac0
Few tests for HgWorkingCopyStatusCollector
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
162
diff
changeset
|
188 List<Path> l = kind2names.get(s.getKind()); |
109
dd4d2d0e42cd
Handler for StatusCommand to get notifications in the form of HgStatus object
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
103
diff
changeset
|
189 if (l == null) { |
224
7fe5982bcac0
Few tests for HgWorkingCopyStatusCollector
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
162
diff
changeset
|
190 kind2names.put(s.getKind(), l = new LinkedList<Path>()); |
109
dd4d2d0e42cd
Handler for StatusCommand to get notifications in the form of HgStatus object
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
103
diff
changeset
|
191 } |
dd4d2d0e42cd
Handler for StatusCommand to get notifications in the form of HgStatus object
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
103
diff
changeset
|
192 l.add(s.getPath()); |
442
6865eb742883
Tests for subrepo API, refactor status tests for reuse, better subrepos API
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
429
diff
changeset
|
193 if (s.isCopy()) { |
6865eb742883
Tests for subrepo API, refactor status tests for reuse, better subrepos API
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
429
diff
changeset
|
194 new2oldName.put(s.getPath(), s.getOriginalPath()); |
6865eb742883
Tests for subrepo API, refactor status tests for reuse, better subrepos API
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
429
diff
changeset
|
195 } |
224
7fe5982bcac0
Few tests for HgWorkingCopyStatusCollector
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
162
diff
changeset
|
196 // |
7fe5982bcac0
Few tests for HgWorkingCopyStatusCollector
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
162
diff
changeset
|
197 List<Kind> k = name2kinds.get(s.getPath()); |
7fe5982bcac0
Few tests for HgWorkingCopyStatusCollector
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
162
diff
changeset
|
198 if (k == null) { |
7fe5982bcac0
Few tests for HgWorkingCopyStatusCollector
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
162
diff
changeset
|
199 name2kinds.put(s.getPath(), k = new LinkedList<Kind>()); |
7fe5982bcac0
Few tests for HgWorkingCopyStatusCollector
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
162
diff
changeset
|
200 } |
7fe5982bcac0
Few tests for HgWorkingCopyStatusCollector
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
162
diff
changeset
|
201 k.add(s.getKind()); |
109
dd4d2d0e42cd
Handler for StatusCommand to get notifications in the form of HgStatus object
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
103
diff
changeset
|
202 } |
442
6865eb742883
Tests for subrepo API, refactor status tests for reuse, better subrepos API
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
429
diff
changeset
|
203 |
454
36fd1fd06492
oth.util.Status renamed to Outcome as the noun is too overloaded, especially in scm
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
442
diff
changeset
|
204 public void error(Path file, Outcome s) { |
360
150500515714
Report non-critical errors during status operation to handler/inspector
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
283
diff
changeset
|
205 name2error.put(file, s); |
150500515714
Report non-critical errors during status operation to handler/inspector
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
283
diff
changeset
|
206 } |
442
6865eb742883
Tests for subrepo API, refactor status tests for reuse, better subrepos API
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
429
diff
changeset
|
207 |
109
dd4d2d0e42cd
Handler for StatusCommand to get notifications in the form of HgStatus object
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
103
diff
changeset
|
208 public List<Path> get(Kind k) { |
224
7fe5982bcac0
Few tests for HgWorkingCopyStatusCollector
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
162
diff
changeset
|
209 List<Path> rv = kind2names.get(k); |
442
6865eb742883
Tests for subrepo API, refactor status tests for reuse, better subrepos API
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
429
diff
changeset
|
210 return rv == null ? Collections.<Path> emptyList() : rv; |
224
7fe5982bcac0
Few tests for HgWorkingCopyStatusCollector
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
162
diff
changeset
|
211 } |
442
6865eb742883
Tests for subrepo API, refactor status tests for reuse, better subrepos API
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
429
diff
changeset
|
212 |
224
7fe5982bcac0
Few tests for HgWorkingCopyStatusCollector
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
162
diff
changeset
|
213 public List<Kind> get(Path p) { |
7fe5982bcac0
Few tests for HgWorkingCopyStatusCollector
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
162
diff
changeset
|
214 List<Kind> rv = name2kinds.get(p); |
442
6865eb742883
Tests for subrepo API, refactor status tests for reuse, better subrepos API
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
429
diff
changeset
|
215 return rv == null ? Collections.<Kind> emptyList() : rv; |
109
dd4d2d0e42cd
Handler for StatusCommand to get notifications in the form of HgStatus object
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
103
diff
changeset
|
216 } |
442
6865eb742883
Tests for subrepo API, refactor status tests for reuse, better subrepos API
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
429
diff
changeset
|
217 |
454
36fd1fd06492
oth.util.Status renamed to Outcome as the noun is too overloaded, especially in scm
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
442
diff
changeset
|
218 public Map<Path, Outcome> getErrors() { |
360
150500515714
Report non-critical errors during status operation to handler/inspector
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
283
diff
changeset
|
219 return name2error; |
150500515714
Report non-critical errors during status operation to handler/inspector
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
283
diff
changeset
|
220 } |
442
6865eb742883
Tests for subrepo API, refactor status tests for reuse, better subrepos API
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
429
diff
changeset
|
221 |
6865eb742883
Tests for subrepo API, refactor status tests for reuse, better subrepos API
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
429
diff
changeset
|
222 public HgStatusCollector.Record asStatusRecord() { |
6865eb742883
Tests for subrepo API, refactor status tests for reuse, better subrepos API
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
429
diff
changeset
|
223 HgStatusCollector.Record rv = new HgStatusCollector.Record(); |
6865eb742883
Tests for subrepo API, refactor status tests for reuse, better subrepos API
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
429
diff
changeset
|
224 for (Path p : get(Modified)) { |
6865eb742883
Tests for subrepo API, refactor status tests for reuse, better subrepos API
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
429
diff
changeset
|
225 rv.modified(p); |
6865eb742883
Tests for subrepo API, refactor status tests for reuse, better subrepos API
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
429
diff
changeset
|
226 } |
6865eb742883
Tests for subrepo API, refactor status tests for reuse, better subrepos API
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
429
diff
changeset
|
227 for (Path p : get(Added)) { |
6865eb742883
Tests for subrepo API, refactor status tests for reuse, better subrepos API
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
429
diff
changeset
|
228 if (!new2oldName.containsKey(p)) { |
6865eb742883
Tests for subrepo API, refactor status tests for reuse, better subrepos API
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
429
diff
changeset
|
229 // new files that are result of a copy get reported separately, below |
6865eb742883
Tests for subrepo API, refactor status tests for reuse, better subrepos API
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
429
diff
changeset
|
230 rv.added(p); |
6865eb742883
Tests for subrepo API, refactor status tests for reuse, better subrepos API
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
429
diff
changeset
|
231 } |
6865eb742883
Tests for subrepo API, refactor status tests for reuse, better subrepos API
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
429
diff
changeset
|
232 } |
6865eb742883
Tests for subrepo API, refactor status tests for reuse, better subrepos API
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
429
diff
changeset
|
233 for (Path p : get(Removed)) { |
6865eb742883
Tests for subrepo API, refactor status tests for reuse, better subrepos API
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
429
diff
changeset
|
234 rv.removed(p); |
6865eb742883
Tests for subrepo API, refactor status tests for reuse, better subrepos API
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
429
diff
changeset
|
235 } |
6865eb742883
Tests for subrepo API, refactor status tests for reuse, better subrepos API
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
429
diff
changeset
|
236 for (Path p : get(Clean)) { |
6865eb742883
Tests for subrepo API, refactor status tests for reuse, better subrepos API
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
429
diff
changeset
|
237 rv.clean(p); |
6865eb742883
Tests for subrepo API, refactor status tests for reuse, better subrepos API
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
429
diff
changeset
|
238 } |
6865eb742883
Tests for subrepo API, refactor status tests for reuse, better subrepos API
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
429
diff
changeset
|
239 for (Path p : get(Ignored)) { |
6865eb742883
Tests for subrepo API, refactor status tests for reuse, better subrepos API
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
429
diff
changeset
|
240 rv.ignored(p); |
6865eb742883
Tests for subrepo API, refactor status tests for reuse, better subrepos API
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
429
diff
changeset
|
241 } |
6865eb742883
Tests for subrepo API, refactor status tests for reuse, better subrepos API
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
429
diff
changeset
|
242 for (Path p : get(Missing)) { |
6865eb742883
Tests for subrepo API, refactor status tests for reuse, better subrepos API
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
429
diff
changeset
|
243 rv.missing(p); |
6865eb742883
Tests for subrepo API, refactor status tests for reuse, better subrepos API
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
429
diff
changeset
|
244 } |
6865eb742883
Tests for subrepo API, refactor status tests for reuse, better subrepos API
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
429
diff
changeset
|
245 for (Path p : get(Unknown)) { |
6865eb742883
Tests for subrepo API, refactor status tests for reuse, better subrepos API
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
429
diff
changeset
|
246 rv.unknown(p); |
6865eb742883
Tests for subrepo API, refactor status tests for reuse, better subrepos API
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
429
diff
changeset
|
247 } |
6865eb742883
Tests for subrepo API, refactor status tests for reuse, better subrepos API
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
429
diff
changeset
|
248 for (Map.Entry<Path, Path> e : new2oldName.entrySet()) { |
6865eb742883
Tests for subrepo API, refactor status tests for reuse, better subrepos API
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
429
diff
changeset
|
249 rv.copied(e.getValue(), e.getKey()); |
6865eb742883
Tests for subrepo API, refactor status tests for reuse, better subrepos API
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
429
diff
changeset
|
250 } |
6865eb742883
Tests for subrepo API, refactor status tests for reuse, better subrepos API
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
429
diff
changeset
|
251 return rv; |
6865eb742883
Tests for subrepo API, refactor status tests for reuse, better subrepos API
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
429
diff
changeset
|
252 } |
109
dd4d2d0e42cd
Handler for StatusCommand to get notifications in the form of HgStatus object
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
103
diff
changeset
|
253 } |
224
7fe5982bcac0
Few tests for HgWorkingCopyStatusCollector
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
162
diff
changeset
|
254 |
7fe5982bcac0
Few tests for HgWorkingCopyStatusCollector
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
162
diff
changeset
|
255 /* |
7fe5982bcac0
Few tests for HgWorkingCopyStatusCollector
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
162
diff
changeset
|
256 * status-1/dir/file5 was added in rev 8, scheduled (hg remove file5) for removal, but not yet committed |
7fe5982bcac0
Few tests for HgWorkingCopyStatusCollector
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
162
diff
changeset
|
257 * Erroneously reported extra REMOVED file (the one added and removed in between). Shall not |
7fe5982bcac0
Few tests for HgWorkingCopyStatusCollector
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
162
diff
changeset
|
258 */ |
7fe5982bcac0
Few tests for HgWorkingCopyStatusCollector
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
162
diff
changeset
|
259 @Test |
7fe5982bcac0
Few tests for HgWorkingCopyStatusCollector
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
162
diff
changeset
|
260 public void testRemovedAgainstBaseWithoutIt() throws Exception { |
7fe5982bcac0
Few tests for HgWorkingCopyStatusCollector
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
162
diff
changeset
|
261 // check very end of WCStatusCollector, foreach left knownEntry, collect == null || baseRevFiles.contains() |
7fe5982bcac0
Few tests for HgWorkingCopyStatusCollector
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
162
diff
changeset
|
262 repo = Configuration.get().find("status-1"); |
7fe5982bcac0
Few tests for HgWorkingCopyStatusCollector
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
162
diff
changeset
|
263 HgStatusCommand cmd = new HgStatusCommand(repo); |
7fe5982bcac0
Few tests for HgWorkingCopyStatusCollector
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
162
diff
changeset
|
264 StatusCollector sc = new StatusCollector(); |
7fe5982bcac0
Few tests for HgWorkingCopyStatusCollector
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
162
diff
changeset
|
265 cmd.all().base(7).execute(sc); |
360
150500515714
Report non-critical errors during status operation to handler/inspector
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
283
diff
changeset
|
266 assertTrue(sc.getErrors().isEmpty()); |
224
7fe5982bcac0
Few tests for HgWorkingCopyStatusCollector
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
162
diff
changeset
|
267 Path file5 = Path.create("dir/file5"); |
7fe5982bcac0
Few tests for HgWorkingCopyStatusCollector
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
162
diff
changeset
|
268 // shall not be listed at all |
7fe5982bcac0
Few tests for HgWorkingCopyStatusCollector
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
162
diff
changeset
|
269 assertTrue(sc.get(file5).isEmpty()); |
7fe5982bcac0
Few tests for HgWorkingCopyStatusCollector
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
162
diff
changeset
|
270 } |
442
6865eb742883
Tests for subrepo API, refactor status tests for reuse, better subrepos API
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
429
diff
changeset
|
271 |
224
7fe5982bcac0
Few tests for HgWorkingCopyStatusCollector
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
162
diff
changeset
|
272 /* |
7fe5982bcac0
Few tests for HgWorkingCopyStatusCollector
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
162
diff
changeset
|
273 * status-1/file2 is tracked, but later .hgignore got entry to ignore it, file2 got modified |
7fe5982bcac0
Few tests for HgWorkingCopyStatusCollector
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
162
diff
changeset
|
274 * HG doesn't respect .hgignore for tracked files. |
7fe5982bcac0
Few tests for HgWorkingCopyStatusCollector
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
162
diff
changeset
|
275 * Now reported as ignored and missing(?!). |
7fe5982bcac0
Few tests for HgWorkingCopyStatusCollector
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
162
diff
changeset
|
276 * Shall be reported as modified. |
7fe5982bcac0
Few tests for HgWorkingCopyStatusCollector
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
162
diff
changeset
|
277 */ |
7fe5982bcac0
Few tests for HgWorkingCopyStatusCollector
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
162
diff
changeset
|
278 @Test |
7fe5982bcac0
Few tests for HgWorkingCopyStatusCollector
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
162
diff
changeset
|
279 public void testTrackedModifiedIgnored() throws Exception { |
7fe5982bcac0
Few tests for HgWorkingCopyStatusCollector
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
162
diff
changeset
|
280 repo = Configuration.get().find("status-1"); |
7fe5982bcac0
Few tests for HgWorkingCopyStatusCollector
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
162
diff
changeset
|
281 HgStatusCommand cmd = new HgStatusCommand(repo); |
7fe5982bcac0
Few tests for HgWorkingCopyStatusCollector
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
162
diff
changeset
|
282 StatusCollector sc = new StatusCollector(); |
7fe5982bcac0
Few tests for HgWorkingCopyStatusCollector
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
162
diff
changeset
|
283 cmd.all().execute(sc); |
360
150500515714
Report non-critical errors during status operation to handler/inspector
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
283
diff
changeset
|
284 assertTrue(sc.getErrors().isEmpty()); |
224
7fe5982bcac0
Few tests for HgWorkingCopyStatusCollector
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
162
diff
changeset
|
285 final Path file2 = Path.create("file2"); |
7fe5982bcac0
Few tests for HgWorkingCopyStatusCollector
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
162
diff
changeset
|
286 assertTrue(sc.get(file2).contains(Modified)); |
7fe5982bcac0
Few tests for HgWorkingCopyStatusCollector
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
162
diff
changeset
|
287 assertTrue(sc.get(file2).size() == 1); |
7fe5982bcac0
Few tests for HgWorkingCopyStatusCollector
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
162
diff
changeset
|
288 } |
76
658fa6b3a371
Fixed a defect when a file added and removed past some revision was reported as R for status against that rev
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
75
diff
changeset
|
289 |
224
7fe5982bcac0
Few tests for HgWorkingCopyStatusCollector
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
162
diff
changeset
|
290 /* |
7fe5982bcac0
Few tests for HgWorkingCopyStatusCollector
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
162
diff
changeset
|
291 * status/dir/file4, added in rev 3, has been scheduled for removal (hg remove -Af file4), but still there in the WC. |
442
6865eb742883
Tests for subrepo API, refactor status tests for reuse, better subrepos API
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
429
diff
changeset
|
292 * Shall be reported as Removed, when comparing against rev 3 |
6865eb742883
Tests for subrepo API, refactor status tests for reuse, better subrepos API
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
429
diff
changeset
|
293 * (despite both rev 3 and WC's parent has file4, there are different paths in the code for wc against parent and wc against rev) |
224
7fe5982bcac0
Few tests for HgWorkingCopyStatusCollector
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
162
diff
changeset
|
294 */ |
7fe5982bcac0
Few tests for HgWorkingCopyStatusCollector
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
162
diff
changeset
|
295 @Test |
7fe5982bcac0
Few tests for HgWorkingCopyStatusCollector
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
162
diff
changeset
|
296 public void testMarkedRemovedButStillInWC() throws Exception { |
7fe5982bcac0
Few tests for HgWorkingCopyStatusCollector
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
162
diff
changeset
|
297 repo = Configuration.get().find("status-1"); |
7fe5982bcac0
Few tests for HgWorkingCopyStatusCollector
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
162
diff
changeset
|
298 HgStatusCommand cmd = new HgStatusCommand(repo); |
7fe5982bcac0
Few tests for HgWorkingCopyStatusCollector
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
162
diff
changeset
|
299 StatusCollector sc = new StatusCollector(); |
7fe5982bcac0
Few tests for HgWorkingCopyStatusCollector
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
162
diff
changeset
|
300 cmd.all().execute(sc); |
360
150500515714
Report non-critical errors during status operation to handler/inspector
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
283
diff
changeset
|
301 assertTrue(sc.getErrors().isEmpty()); |
224
7fe5982bcac0
Few tests for HgWorkingCopyStatusCollector
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
162
diff
changeset
|
302 Path file4 = Path.create("dir/file4"); |
7fe5982bcac0
Few tests for HgWorkingCopyStatusCollector
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
162
diff
changeset
|
303 assertTrue(sc.get(file4).contains(Removed)); |
7fe5982bcac0
Few tests for HgWorkingCopyStatusCollector
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
162
diff
changeset
|
304 assertTrue(sc.get(file4).size() == 1); |
7fe5982bcac0
Few tests for HgWorkingCopyStatusCollector
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
162
diff
changeset
|
305 // |
7fe5982bcac0
Few tests for HgWorkingCopyStatusCollector
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
162
diff
changeset
|
306 // different code path (collect != null) |
7fe5982bcac0
Few tests for HgWorkingCopyStatusCollector
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
162
diff
changeset
|
307 cmd.base(3).execute(sc = new StatusCollector()); |
360
150500515714
Report non-critical errors during status operation to handler/inspector
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
283
diff
changeset
|
308 assertTrue(sc.getErrors().isEmpty()); |
224
7fe5982bcac0
Few tests for HgWorkingCopyStatusCollector
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
162
diff
changeset
|
309 assertTrue(sc.get(file4).contains(Removed)); |
7fe5982bcac0
Few tests for HgWorkingCopyStatusCollector
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
162
diff
changeset
|
310 assertTrue(sc.get(file4).size() == 1); |
7fe5982bcac0
Few tests for HgWorkingCopyStatusCollector
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
162
diff
changeset
|
311 // |
7fe5982bcac0
Few tests for HgWorkingCopyStatusCollector
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
162
diff
changeset
|
312 // wasn't there in rev 2, shall not be reported at all |
7fe5982bcac0
Few tests for HgWorkingCopyStatusCollector
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
162
diff
changeset
|
313 cmd.base(2).execute(sc = new StatusCollector()); |
360
150500515714
Report non-critical errors during status operation to handler/inspector
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
283
diff
changeset
|
314 assertTrue(sc.getErrors().isEmpty()); |
224
7fe5982bcac0
Few tests for HgWorkingCopyStatusCollector
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
162
diff
changeset
|
315 assertTrue(sc.get(file4).isEmpty()); |
7fe5982bcac0
Few tests for HgWorkingCopyStatusCollector
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
162
diff
changeset
|
316 } |
7fe5982bcac0
Few tests for HgWorkingCopyStatusCollector
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
162
diff
changeset
|
317 |
7fe5982bcac0
Few tests for HgWorkingCopyStatusCollector
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
162
diff
changeset
|
318 /* |
442
6865eb742883
Tests for subrepo API, refactor status tests for reuse, better subrepos API
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
429
diff
changeset
|
319 * status-1/dir/file3 tracked, listed in .hgignore since rev 4, removed (hg remove file3) from repo and WC |
224
7fe5982bcac0
Few tests for HgWorkingCopyStatusCollector
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
162
diff
changeset
|
320 * (but entry in .hgignore left) in revision 5, and new file3 got created in WC. |
7fe5982bcac0
Few tests for HgWorkingCopyStatusCollector
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
162
diff
changeset
|
321 * Shall be reported as ignored when comparing against WC's parent, |
442
6865eb742883
Tests for subrepo API, refactor status tests for reuse, better subrepos API
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
429
diff
changeset
|
322 * and both ignored and removed when comparing against revision 3 |
224
7fe5982bcac0
Few tests for HgWorkingCopyStatusCollector
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
162
diff
changeset
|
323 */ |
7fe5982bcac0
Few tests for HgWorkingCopyStatusCollector
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
162
diff
changeset
|
324 @Test |
7fe5982bcac0
Few tests for HgWorkingCopyStatusCollector
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
162
diff
changeset
|
325 public void testRemovedIgnoredInWC() throws Exception { |
7fe5982bcac0
Few tests for HgWorkingCopyStatusCollector
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
162
diff
changeset
|
326 // check branch !known, ignored |
7fe5982bcac0
Few tests for HgWorkingCopyStatusCollector
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
162
diff
changeset
|
327 repo = Configuration.get().find("status-1"); |
7fe5982bcac0
Few tests for HgWorkingCopyStatusCollector
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
162
diff
changeset
|
328 HgStatusCommand cmd = new HgStatusCommand(repo); |
7fe5982bcac0
Few tests for HgWorkingCopyStatusCollector
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
162
diff
changeset
|
329 StatusCollector sc = new StatusCollector(); |
7fe5982bcac0
Few tests for HgWorkingCopyStatusCollector
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
162
diff
changeset
|
330 cmd.all().execute(sc); |
360
150500515714
Report non-critical errors during status operation to handler/inspector
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
283
diff
changeset
|
331 assertTrue(sc.getErrors().isEmpty()); |
224
7fe5982bcac0
Few tests for HgWorkingCopyStatusCollector
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
162
diff
changeset
|
332 final Path file3 = Path.create("dir/file3"); |
7fe5982bcac0
Few tests for HgWorkingCopyStatusCollector
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
162
diff
changeset
|
333 assertTrue(sc.get(file3).contains(Ignored)); |
7fe5982bcac0
Few tests for HgWorkingCopyStatusCollector
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
162
diff
changeset
|
334 assertTrue(sc.get(file3).size() == 1); |
7fe5982bcac0
Few tests for HgWorkingCopyStatusCollector
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
162
diff
changeset
|
335 // |
7fe5982bcac0
Few tests for HgWorkingCopyStatusCollector
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
162
diff
changeset
|
336 cmd.base(3).execute(sc = new StatusCollector()); |
360
150500515714
Report non-critical errors during status operation to handler/inspector
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
283
diff
changeset
|
337 assertTrue(sc.getErrors().isEmpty()); |
224
7fe5982bcac0
Few tests for HgWorkingCopyStatusCollector
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
162
diff
changeset
|
338 assertTrue(sc.get(file3).contains(Ignored)); |
7fe5982bcac0
Few tests for HgWorkingCopyStatusCollector
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
162
diff
changeset
|
339 assertTrue(sc.get(file3).contains(Removed)); |
7fe5982bcac0
Few tests for HgWorkingCopyStatusCollector
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
162
diff
changeset
|
340 assertTrue(sc.get(file3).size() == 2); |
7fe5982bcac0
Few tests for HgWorkingCopyStatusCollector
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
162
diff
changeset
|
341 // |
7fe5982bcac0
Few tests for HgWorkingCopyStatusCollector
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
162
diff
changeset
|
342 cmd.base(5).execute(sc = new StatusCollector()); |
360
150500515714
Report non-critical errors during status operation to handler/inspector
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
283
diff
changeset
|
343 assertTrue(sc.getErrors().isEmpty()); |
224
7fe5982bcac0
Few tests for HgWorkingCopyStatusCollector
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
162
diff
changeset
|
344 assertTrue(sc.get(file3).contains(Ignored)); |
7fe5982bcac0
Few tests for HgWorkingCopyStatusCollector
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
162
diff
changeset
|
345 assertTrue(sc.get(file3).size() == 1); |
7fe5982bcac0
Few tests for HgWorkingCopyStatusCollector
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
162
diff
changeset
|
346 // |
7fe5982bcac0
Few tests for HgWorkingCopyStatusCollector
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
162
diff
changeset
|
347 cmd.base(0).execute(sc = new StatusCollector()); |
360
150500515714
Report non-critical errors during status operation to handler/inspector
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
283
diff
changeset
|
348 assertTrue(sc.getErrors().isEmpty()); |
224
7fe5982bcac0
Few tests for HgWorkingCopyStatusCollector
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
162
diff
changeset
|
349 assertTrue(sc.get(file3).contains(Ignored)); |
7fe5982bcac0
Few tests for HgWorkingCopyStatusCollector
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
162
diff
changeset
|
350 assertTrue(sc.get(file3).size() == 1); |
7fe5982bcac0
Few tests for HgWorkingCopyStatusCollector
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
162
diff
changeset
|
351 |
7fe5982bcac0
Few tests for HgWorkingCopyStatusCollector
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
162
diff
changeset
|
352 } |
7fe5982bcac0
Few tests for HgWorkingCopyStatusCollector
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
162
diff
changeset
|
353 |
7fe5982bcac0
Few tests for HgWorkingCopyStatusCollector
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
162
diff
changeset
|
354 /* |
7fe5982bcac0
Few tests for HgWorkingCopyStatusCollector
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
162
diff
changeset
|
355 * status/file1 was removed in cset 2. New file with the same name in the WC. |
442
6865eb742883
Tests for subrepo API, refactor status tests for reuse, better subrepos API
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
429
diff
changeset
|
356 * Shall report 2 statuses (as cmdline hg does): unknown and removed when comparing against that revision. |
224
7fe5982bcac0
Few tests for HgWorkingCopyStatusCollector
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
162
diff
changeset
|
357 */ |
7fe5982bcac0
Few tests for HgWorkingCopyStatusCollector
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
162
diff
changeset
|
358 @Test |
7fe5982bcac0
Few tests for HgWorkingCopyStatusCollector
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
162
diff
changeset
|
359 public void testNewFileWithSameNameAsDeletedOld() throws Exception { |
7fe5982bcac0
Few tests for HgWorkingCopyStatusCollector
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
162
diff
changeset
|
360 // check branch !known, !ignored (=> unknown) |
7fe5982bcac0
Few tests for HgWorkingCopyStatusCollector
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
162
diff
changeset
|
361 repo = Configuration.get().find("status-1"); |
7fe5982bcac0
Few tests for HgWorkingCopyStatusCollector
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
162
diff
changeset
|
362 HgStatusCommand cmd = new HgStatusCommand(repo); |
7fe5982bcac0
Few tests for HgWorkingCopyStatusCollector
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
162
diff
changeset
|
363 StatusCollector sc = new StatusCollector(); |
7fe5982bcac0
Few tests for HgWorkingCopyStatusCollector
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
162
diff
changeset
|
364 cmd.base(1); |
7fe5982bcac0
Few tests for HgWorkingCopyStatusCollector
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
162
diff
changeset
|
365 cmd.all().execute(sc); |
360
150500515714
Report non-critical errors during status operation to handler/inspector
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
283
diff
changeset
|
366 assertTrue(sc.getErrors().isEmpty()); |
224
7fe5982bcac0
Few tests for HgWorkingCopyStatusCollector
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
162
diff
changeset
|
367 final Path file1 = Path.create("file1"); |
7fe5982bcac0
Few tests for HgWorkingCopyStatusCollector
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
162
diff
changeset
|
368 assertTrue(sc.get(file1).contains(Unknown)); |
7fe5982bcac0
Few tests for HgWorkingCopyStatusCollector
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
162
diff
changeset
|
369 assertTrue(sc.get(file1).contains(Removed)); |
7fe5982bcac0
Few tests for HgWorkingCopyStatusCollector
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
162
diff
changeset
|
370 assertTrue(sc.get(file1).size() == 2); |
7fe5982bcac0
Few tests for HgWorkingCopyStatusCollector
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
162
diff
changeset
|
371 // |
7fe5982bcac0
Few tests for HgWorkingCopyStatusCollector
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
162
diff
changeset
|
372 // no file1 in rev 2, shall be reported as unknown only |
7fe5982bcac0
Few tests for HgWorkingCopyStatusCollector
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
162
diff
changeset
|
373 cmd.base(2).execute(sc = new StatusCollector()); |
360
150500515714
Report non-critical errors during status operation to handler/inspector
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
283
diff
changeset
|
374 assertTrue(sc.getErrors().isEmpty()); |
224
7fe5982bcac0
Few tests for HgWorkingCopyStatusCollector
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
162
diff
changeset
|
375 assertTrue(sc.get(file1).contains(Unknown)); |
7fe5982bcac0
Few tests for HgWorkingCopyStatusCollector
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
162
diff
changeset
|
376 assertTrue(sc.get(file1).size() == 1); |
76
658fa6b3a371
Fixed a defect when a file added and removed past some revision was reported as R for status against that rev
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
75
diff
changeset
|
377 } |
442
6865eb742883
Tests for subrepo API, refactor status tests for reuse, better subrepos API
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
429
diff
changeset
|
378 |
229
1ec6b327a6ac
Scope for status reworked: explicit files or a general matcher
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
224
diff
changeset
|
379 @Test |
1ec6b327a6ac
Scope for status reworked: explicit files or a general matcher
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
224
diff
changeset
|
380 public void testSubTreeStatus() throws Exception { |
1ec6b327a6ac
Scope for status reworked: explicit files or a general matcher
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
224
diff
changeset
|
381 repo = Configuration.get().find("status-1"); |
1ec6b327a6ac
Scope for status reworked: explicit files or a general matcher
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
224
diff
changeset
|
382 HgStatusCommand cmd = new HgStatusCommand(repo); |
1ec6b327a6ac
Scope for status reworked: explicit files or a general matcher
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
224
diff
changeset
|
383 StatusCollector sc = new StatusCollector(); |
1ec6b327a6ac
Scope for status reworked: explicit files or a general matcher
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
224
diff
changeset
|
384 cmd.match(new PathGlobMatcher("*")); |
1ec6b327a6ac
Scope for status reworked: explicit files or a general matcher
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
224
diff
changeset
|
385 cmd.all().execute(sc); |
360
150500515714
Report non-critical errors during status operation to handler/inspector
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
283
diff
changeset
|
386 assertTrue(sc.getErrors().isEmpty()); |
229
1ec6b327a6ac
Scope for status reworked: explicit files or a general matcher
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
224
diff
changeset
|
387 /* |
1ec6b327a6ac
Scope for status reworked: explicit files or a general matcher
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
224
diff
changeset
|
388 * C .hgignore |
1ec6b327a6ac
Scope for status reworked: explicit files or a general matcher
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
224
diff
changeset
|
389 * ? file1 |
1ec6b327a6ac
Scope for status reworked: explicit files or a general matcher
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
224
diff
changeset
|
390 * M file2 |
1ec6b327a6ac
Scope for status reworked: explicit files or a general matcher
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
224
diff
changeset
|
391 * C readme |
1ec6b327a6ac
Scope for status reworked: explicit files or a general matcher
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
224
diff
changeset
|
392 */ |
1ec6b327a6ac
Scope for status reworked: explicit files or a general matcher
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
224
diff
changeset
|
393 final Path file1 = Path.create("file1"); |
1ec6b327a6ac
Scope for status reworked: explicit files or a general matcher
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
224
diff
changeset
|
394 assertTrue(sc.get(file1).contains(Unknown)); |
1ec6b327a6ac
Scope for status reworked: explicit files or a general matcher
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
224
diff
changeset
|
395 assertTrue(sc.get(file1).size() == 1); |
1ec6b327a6ac
Scope for status reworked: explicit files or a general matcher
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
224
diff
changeset
|
396 assertTrue(sc.get(Removed).isEmpty()); |
1ec6b327a6ac
Scope for status reworked: explicit files or a general matcher
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
224
diff
changeset
|
397 assertTrue(sc.get(Clean).size() == 2); |
1ec6b327a6ac
Scope for status reworked: explicit files or a general matcher
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
224
diff
changeset
|
398 assertTrue(sc.get(Modified).size() == 1); |
1ec6b327a6ac
Scope for status reworked: explicit files or a general matcher
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
224
diff
changeset
|
399 // |
1ec6b327a6ac
Scope for status reworked: explicit files or a general matcher
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
224
diff
changeset
|
400 cmd.match(new PathGlobMatcher("dir/*")).execute(sc = new StatusCollector()); |
360
150500515714
Report non-critical errors during status operation to handler/inspector
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
283
diff
changeset
|
401 assertTrue(sc.getErrors().isEmpty()); |
229
1ec6b327a6ac
Scope for status reworked: explicit files or a general matcher
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
224
diff
changeset
|
402 /* |
1ec6b327a6ac
Scope for status reworked: explicit files or a general matcher
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
224
diff
changeset
|
403 * I dir/file3 |
1ec6b327a6ac
Scope for status reworked: explicit files or a general matcher
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
224
diff
changeset
|
404 * R dir/file4 |
1ec6b327a6ac
Scope for status reworked: explicit files or a general matcher
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
224
diff
changeset
|
405 * R dir/file5 |
1ec6b327a6ac
Scope for status reworked: explicit files or a general matcher
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
224
diff
changeset
|
406 */ |
1ec6b327a6ac
Scope for status reworked: explicit files or a general matcher
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
224
diff
changeset
|
407 assertTrue(sc.get(Modified).isEmpty()); |
1ec6b327a6ac
Scope for status reworked: explicit files or a general matcher
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
224
diff
changeset
|
408 assertTrue(sc.get(Added).isEmpty()); |
1ec6b327a6ac
Scope for status reworked: explicit files or a general matcher
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
224
diff
changeset
|
409 assertTrue(sc.get(Ignored).size() == 1); |
1ec6b327a6ac
Scope for status reworked: explicit files or a general matcher
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
224
diff
changeset
|
410 assertTrue(sc.get(Removed).size() == 2); |
1ec6b327a6ac
Scope for status reworked: explicit files or a general matcher
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
224
diff
changeset
|
411 } |
442
6865eb742883
Tests for subrepo API, refactor status tests for reuse, better subrepos API
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
429
diff
changeset
|
412 |
229
1ec6b327a6ac
Scope for status reworked: explicit files or a general matcher
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
224
diff
changeset
|
413 @Test |
1ec6b327a6ac
Scope for status reworked: explicit files or a general matcher
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
224
diff
changeset
|
414 public void testSpecificFileStatus() throws Exception { |
1ec6b327a6ac
Scope for status reworked: explicit files or a general matcher
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
224
diff
changeset
|
415 repo = Configuration.get().find("status-1"); |
1ec6b327a6ac
Scope for status reworked: explicit files or a general matcher
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
224
diff
changeset
|
416 // files only |
1ec6b327a6ac
Scope for status reworked: explicit files or a general matcher
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
224
diff
changeset
|
417 final Path file2 = Path.create("file2"); |
1ec6b327a6ac
Scope for status reworked: explicit files or a general matcher
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
224
diff
changeset
|
418 final Path file3 = Path.create("dir/file3"); |
1ec6b327a6ac
Scope for status reworked: explicit files or a general matcher
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
224
diff
changeset
|
419 HgWorkingCopyStatusCollector sc = HgWorkingCopyStatusCollector.create(repo, file2, file3); |
1ec6b327a6ac
Scope for status reworked: explicit files or a general matcher
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
224
diff
changeset
|
420 HgStatusCollector.Record r = new HgStatusCollector.Record(); |
429
cd658b24a620
FIXMEs: javadoc, proper use of constants
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
427
diff
changeset
|
421 sc.walk(WORKING_COPY, r); |
229
1ec6b327a6ac
Scope for status reworked: explicit files or a general matcher
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
224
diff
changeset
|
422 assertTrue(r.getAdded().isEmpty()); |
1ec6b327a6ac
Scope for status reworked: explicit files or a general matcher
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
224
diff
changeset
|
423 assertTrue(r.getRemoved().isEmpty()); |
1ec6b327a6ac
Scope for status reworked: explicit files or a general matcher
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
224
diff
changeset
|
424 assertTrue(r.getUnknown().isEmpty()); |
1ec6b327a6ac
Scope for status reworked: explicit files or a general matcher
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
224
diff
changeset
|
425 assertTrue(r.getClean().isEmpty()); |
1ec6b327a6ac
Scope for status reworked: explicit files or a general matcher
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
224
diff
changeset
|
426 assertTrue(r.getMissing().isEmpty()); |
1ec6b327a6ac
Scope for status reworked: explicit files or a general matcher
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
224
diff
changeset
|
427 assertTrue(r.getCopied().isEmpty()); |
1ec6b327a6ac
Scope for status reworked: explicit files or a general matcher
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
224
diff
changeset
|
428 assertTrue(r.getIgnored().contains(file3)); |
1ec6b327a6ac
Scope for status reworked: explicit files or a general matcher
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
224
diff
changeset
|
429 assertTrue(r.getIgnored().size() == 1); |
1ec6b327a6ac
Scope for status reworked: explicit files or a general matcher
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
224
diff
changeset
|
430 assertTrue(r.getModified().contains(file2)); |
1ec6b327a6ac
Scope for status reworked: explicit files or a general matcher
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
224
diff
changeset
|
431 assertTrue(r.getModified().size() == 1); |
1ec6b327a6ac
Scope for status reworked: explicit files or a general matcher
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
224
diff
changeset
|
432 // mix files and directories |
1ec6b327a6ac
Scope for status reworked: explicit files or a general matcher
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
224
diff
changeset
|
433 final Path readme = Path.create("readme"); |
1ec6b327a6ac
Scope for status reworked: explicit files or a general matcher
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
224
diff
changeset
|
434 final Path dir = Path.create("dir/"); |
1ec6b327a6ac
Scope for status reworked: explicit files or a general matcher
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
224
diff
changeset
|
435 sc = HgWorkingCopyStatusCollector.create(repo, readme, dir); |
429
cd658b24a620
FIXMEs: javadoc, proper use of constants
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
427
diff
changeset
|
436 sc.walk(WORKING_COPY, r = new HgStatusCollector.Record()); |
229
1ec6b327a6ac
Scope for status reworked: explicit files or a general matcher
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
224
diff
changeset
|
437 assertTrue(r.getAdded().isEmpty()); |
1ec6b327a6ac
Scope for status reworked: explicit files or a general matcher
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
224
diff
changeset
|
438 assertTrue(r.getRemoved().size() == 2); |
1ec6b327a6ac
Scope for status reworked: explicit files or a general matcher
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
224
diff
changeset
|
439 for (Path p : r.getRemoved()) { |
458
c95cd5994ba2
Tests: with more precise relations for files/dirs, ImmediateChild is the right expectation
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
454
diff
changeset
|
440 assertEquals(Path.CompareResult.ImmediateChild, p.compareWith(dir)); |
229
1ec6b327a6ac
Scope for status reworked: explicit files or a general matcher
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
224
diff
changeset
|
441 } |
1ec6b327a6ac
Scope for status reworked: explicit files or a general matcher
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
224
diff
changeset
|
442 assertTrue(r.getUnknown().isEmpty()); |
1ec6b327a6ac
Scope for status reworked: explicit files or a general matcher
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
224
diff
changeset
|
443 assertTrue(r.getClean().size() == 1); |
1ec6b327a6ac
Scope for status reworked: explicit files or a general matcher
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
224
diff
changeset
|
444 assertTrue(r.getClean().contains(readme)); |
1ec6b327a6ac
Scope for status reworked: explicit files or a general matcher
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
224
diff
changeset
|
445 assertTrue(r.getMissing().isEmpty()); |
1ec6b327a6ac
Scope for status reworked: explicit files or a general matcher
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
224
diff
changeset
|
446 assertTrue(r.getCopied().isEmpty()); |
1ec6b327a6ac
Scope for status reworked: explicit files or a general matcher
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
224
diff
changeset
|
447 assertTrue(r.getIgnored().contains(file3)); |
1ec6b327a6ac
Scope for status reworked: explicit files or a general matcher
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
224
diff
changeset
|
448 assertTrue(r.getIgnored().size() == 1); |
1ec6b327a6ac
Scope for status reworked: explicit files or a general matcher
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
224
diff
changeset
|
449 assertTrue(r.getModified().isEmpty()); |
1ec6b327a6ac
Scope for status reworked: explicit files or a general matcher
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
224
diff
changeset
|
450 } |
442
6865eb742883
Tests for subrepo API, refactor status tests for reuse, better subrepos API
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
429
diff
changeset
|
451 |
229
1ec6b327a6ac
Scope for status reworked: explicit files or a general matcher
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
224
diff
changeset
|
452 @Test |
1ec6b327a6ac
Scope for status reworked: explicit files or a general matcher
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
224
diff
changeset
|
453 public void testSameResultDirectPathVsMatcher() throws Exception { |
1ec6b327a6ac
Scope for status reworked: explicit files or a general matcher
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
224
diff
changeset
|
454 repo = Configuration.get().find("status-1"); |
1ec6b327a6ac
Scope for status reworked: explicit files or a general matcher
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
224
diff
changeset
|
455 final Path file3 = Path.create("dir/file3"); |
1ec6b327a6ac
Scope for status reworked: explicit files or a general matcher
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
224
diff
changeset
|
456 final Path file5 = Path.create("dir/file5"); |
442
6865eb742883
Tests for subrepo API, refactor status tests for reuse, better subrepos API
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
429
diff
changeset
|
457 |
229
1ec6b327a6ac
Scope for status reworked: explicit files or a general matcher
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
224
diff
changeset
|
458 HgWorkingCopyStatusCollector sc = HgWorkingCopyStatusCollector.create(repo, file3, file5); |
1ec6b327a6ac
Scope for status reworked: explicit files or a general matcher
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
224
diff
changeset
|
459 HgStatusCollector.Record r; |
429
cd658b24a620
FIXMEs: javadoc, proper use of constants
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
427
diff
changeset
|
460 sc.walk(WORKING_COPY, r = new HgStatusCollector.Record()); |
229
1ec6b327a6ac
Scope for status reworked: explicit files or a general matcher
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
224
diff
changeset
|
461 assertTrue(r.getRemoved().contains(file5)); |
1ec6b327a6ac
Scope for status reworked: explicit files or a general matcher
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
224
diff
changeset
|
462 assertTrue(r.getIgnored().contains(file3)); |
1ec6b327a6ac
Scope for status reworked: explicit files or a general matcher
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
224
diff
changeset
|
463 // |
1ec6b327a6ac
Scope for status reworked: explicit files or a general matcher
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
224
diff
changeset
|
464 // query for the same file, but with |
1ec6b327a6ac
Scope for status reworked: explicit files or a general matcher
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
224
diff
changeset
|
465 sc = HgWorkingCopyStatusCollector.create(repo, new PathGlobMatcher(file3.toString(), file5.toString())); |
429
cd658b24a620
FIXMEs: javadoc, proper use of constants
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
427
diff
changeset
|
466 sc.walk(WORKING_COPY, r = new HgStatusCollector.Record()); |
229
1ec6b327a6ac
Scope for status reworked: explicit files or a general matcher
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
224
diff
changeset
|
467 assertTrue(r.getRemoved().contains(file5)); |
1ec6b327a6ac
Scope for status reworked: explicit files or a general matcher
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
224
diff
changeset
|
468 assertTrue(r.getIgnored().contains(file3)); |
1ec6b327a6ac
Scope for status reworked: explicit files or a general matcher
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
224
diff
changeset
|
469 } |
442
6865eb742883
Tests for subrepo API, refactor status tests for reuse, better subrepos API
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
429
diff
changeset
|
470 |
230
0dd9da7489dc
Test for scoped operation of HgStatusCollector
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
229
diff
changeset
|
471 @Test |
0dd9da7489dc
Test for scoped operation of HgStatusCollector
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
229
diff
changeset
|
472 public void testScopeInHistoricalStatus() throws Exception { |
0dd9da7489dc
Test for scoped operation of HgStatusCollector
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
229
diff
changeset
|
473 repo = Configuration.get().find("status-1"); |
0dd9da7489dc
Test for scoped operation of HgStatusCollector
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
229
diff
changeset
|
474 HgStatusCommand cmd = new HgStatusCommand(repo); |
0dd9da7489dc
Test for scoped operation of HgStatusCollector
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
229
diff
changeset
|
475 cmd.base(3).revision(8).all(); |
0dd9da7489dc
Test for scoped operation of HgStatusCollector
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
229
diff
changeset
|
476 cmd.match(new PathGlobMatcher("dir/*")); |
0dd9da7489dc
Test for scoped operation of HgStatusCollector
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
229
diff
changeset
|
477 StatusCollector sc = new StatusCollector(); |
0dd9da7489dc
Test for scoped operation of HgStatusCollector
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
229
diff
changeset
|
478 cmd.execute(sc); |
360
150500515714
Report non-critical errors during status operation to handler/inspector
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
283
diff
changeset
|
479 assertTrue(sc.getErrors().isEmpty()); |
230
0dd9da7489dc
Test for scoped operation of HgStatusCollector
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
229
diff
changeset
|
480 final Path file3 = Path.create("dir/file3"); |
0dd9da7489dc
Test for scoped operation of HgStatusCollector
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
229
diff
changeset
|
481 final Path file4 = Path.create("dir/file4"); |
0dd9da7489dc
Test for scoped operation of HgStatusCollector
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
229
diff
changeset
|
482 final Path file5 = Path.create("dir/file5"); |
0dd9da7489dc
Test for scoped operation of HgStatusCollector
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
229
diff
changeset
|
483 // |
0dd9da7489dc
Test for scoped operation of HgStatusCollector
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
229
diff
changeset
|
484 assertTrue(sc.get(file3).contains(Removed)); |
0dd9da7489dc
Test for scoped operation of HgStatusCollector
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
229
diff
changeset
|
485 assertTrue(sc.get(file3).size() == 1); |
0dd9da7489dc
Test for scoped operation of HgStatusCollector
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
229
diff
changeset
|
486 assertTrue(sc.get(Removed).size() == 1); |
0dd9da7489dc
Test for scoped operation of HgStatusCollector
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
229
diff
changeset
|
487 // |
0dd9da7489dc
Test for scoped operation of HgStatusCollector
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
229
diff
changeset
|
488 assertTrue(sc.get(file4).contains(Clean)); |
0dd9da7489dc
Test for scoped operation of HgStatusCollector
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
229
diff
changeset
|
489 assertTrue(sc.get(file4).size() == 1); |
0dd9da7489dc
Test for scoped operation of HgStatusCollector
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
229
diff
changeset
|
490 assertTrue(sc.get(Clean).size() == 1); |
0dd9da7489dc
Test for scoped operation of HgStatusCollector
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
229
diff
changeset
|
491 // |
0dd9da7489dc
Test for scoped operation of HgStatusCollector
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
229
diff
changeset
|
492 assertTrue(sc.get(file5).contains(Added)); |
0dd9da7489dc
Test for scoped operation of HgStatusCollector
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
229
diff
changeset
|
493 assertTrue(sc.get(file5).size() == 1); |
0dd9da7489dc
Test for scoped operation of HgStatusCollector
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
229
diff
changeset
|
494 assertTrue(sc.get(Added).size() == 1); |
0dd9da7489dc
Test for scoped operation of HgStatusCollector
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
229
diff
changeset
|
495 |
0dd9da7489dc
Test for scoped operation of HgStatusCollector
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
229
diff
changeset
|
496 } |
442
6865eb742883
Tests for subrepo API, refactor status tests for reuse, better subrepos API
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
429
diff
changeset
|
497 |
372
155c1893bda4
Issue 22: UnsupportedOperationException on empty manifest entry
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
360
diff
changeset
|
498 /** |
155c1893bda4
Issue 22: UnsupportedOperationException on empty manifest entry
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
360
diff
changeset
|
499 * Issue 22 |
155c1893bda4
Issue 22: UnsupportedOperationException on empty manifest entry
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
360
diff
changeset
|
500 */ |
155c1893bda4
Issue 22: UnsupportedOperationException on empty manifest entry
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
360
diff
changeset
|
501 @Test |
155c1893bda4
Issue 22: UnsupportedOperationException on empty manifest entry
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
360
diff
changeset
|
502 public void testOnEmptyRepositoryWithAllFilesDeleted() throws Exception { |
155c1893bda4
Issue 22: UnsupportedOperationException on empty manifest entry
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
360
diff
changeset
|
503 repo = Configuration.get().find("status-2"); |
155c1893bda4
Issue 22: UnsupportedOperationException on empty manifest entry
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
360
diff
changeset
|
504 HgStatusCommand cmd = new HgStatusCommand(repo); |
155c1893bda4
Issue 22: UnsupportedOperationException on empty manifest entry
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
360
diff
changeset
|
505 cmd.all(); |
155c1893bda4
Issue 22: UnsupportedOperationException on empty manifest entry
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
360
diff
changeset
|
506 StatusCollector sc = new StatusCollector(); |
155c1893bda4
Issue 22: UnsupportedOperationException on empty manifest entry
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
360
diff
changeset
|
507 cmd.execute(sc); |
155c1893bda4
Issue 22: UnsupportedOperationException on empty manifest entry
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
360
diff
changeset
|
508 // shall pass without exception |
155c1893bda4
Issue 22: UnsupportedOperationException on empty manifest entry
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
360
diff
changeset
|
509 assertTrue(sc.getErrors().isEmpty()); |
155c1893bda4
Issue 22: UnsupportedOperationException on empty manifest entry
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
360
diff
changeset
|
510 for (HgStatus.Kind k : HgStatus.Kind.values()) { |
442
6865eb742883
Tests for subrepo API, refactor status tests for reuse, better subrepos API
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
429
diff
changeset
|
511 assertTrue("Kind " + k.name() + " shall be empty", sc.get(k).isEmpty()); |
372
155c1893bda4
Issue 22: UnsupportedOperationException on empty manifest entry
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
360
diff
changeset
|
512 } |
155c1893bda4
Issue 22: UnsupportedOperationException on empty manifest entry
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
360
diff
changeset
|
513 } |
442
6865eb742883
Tests for subrepo API, refactor status tests for reuse, better subrepos API
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
429
diff
changeset
|
514 |
377
86f049e6bcae
Issue 22: Test for subsequent empty manifest entries case for separate .i and .d repository control files
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
372
diff
changeset
|
515 /** |
86f049e6bcae
Issue 22: Test for subsequent empty manifest entries case for separate .i and .d repository control files
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
372
diff
changeset
|
516 * Issue 22, two subsequent commits that remove all repository files, each in a different branch. |
86f049e6bcae
Issue 22: Test for subsequent empty manifest entries case for separate .i and .d repository control files
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
372
diff
changeset
|
517 * Here's excerpt from my RevlogWriter utility: |
442
6865eb742883
Tests for subrepo API, refactor status tests for reuse, better subrepos API
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
429
diff
changeset
|
518 * |
377
86f049e6bcae
Issue 22: Test for subsequent empty manifest entries case for separate .i and .d repository control files
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
372
diff
changeset
|
519 * <pre> |
86f049e6bcae
Issue 22: Test for subsequent empty manifest entries case for separate .i and .d repository control files
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
372
diff
changeset
|
520 * final List<String> filesList = Collections.singletonList("file1"); |
442
6865eb742883
Tests for subrepo API, refactor status tests for reuse, better subrepos API
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
429
diff
changeset
|
521 * // |
6865eb742883
Tests for subrepo API, refactor status tests for reuse, better subrepos API
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
429
diff
changeset
|
522 * file1.writeUncompressed(-1, -1, 0, 0, "garbage".getBytes()); |
6865eb742883
Tests for subrepo API, refactor status tests for reuse, better subrepos API
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
429
diff
changeset
|
523 * // |
6865eb742883
Tests for subrepo API, refactor status tests for reuse, better subrepos API
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
429
diff
changeset
|
524 * ManifestBuilder mb = new ManifestBuilder(); |
6865eb742883
Tests for subrepo API, refactor status tests for reuse, better subrepos API
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
429
diff
changeset
|
525 * mb.reset().add("file1", file1.getRevision(0)); |
6865eb742883
Tests for subrepo API, refactor status tests for reuse, better subrepos API
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
429
diff
changeset
|
526 * manifest.writeUncompressed(-1, -1, 0, 0, mb.build()); // manifest revision 0 |
6865eb742883
Tests for subrepo API, refactor status tests for reuse, better subrepos API
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
429
diff
changeset
|
527 * final byte[] cset1 = buildChangelogEntry(manifest.getRevision(0), Collections.<String, String>emptyMap(), filesList, "Add a file"); |
6865eb742883
Tests for subrepo API, refactor status tests for reuse, better subrepos API
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
429
diff
changeset
|
528 * changelog.writeUncompressed(-1, -1, 0, 0, cset1); |
6865eb742883
Tests for subrepo API, refactor status tests for reuse, better subrepos API
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
429
diff
changeset
|
529 * // |
6865eb742883
Tests for subrepo API, refactor status tests for reuse, better subrepos API
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
429
diff
changeset
|
530 * // pretend we delete all files in a branch 1 |
6865eb742883
Tests for subrepo API, refactor status tests for reuse, better subrepos API
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
429
diff
changeset
|
531 * manifest.writeUncompressed(0, -1, 1, 1, new byte[0]); // manifest revision 1 |
6865eb742883
Tests for subrepo API, refactor status tests for reuse, better subrepos API
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
429
diff
changeset
|
532 * final byte[] cset2 = buildChangelogEntry(manifest.getRevision(1), Collections.singletonMap("branch", "delete-all-1"), filesList, "Delete all files in a first branch"); |
6865eb742883
Tests for subrepo API, refactor status tests for reuse, better subrepos API
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
429
diff
changeset
|
533 * changelog.writeUncompressed(0, -1, 1, 1, cset2); |
6865eb742883
Tests for subrepo API, refactor status tests for reuse, better subrepos API
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
429
diff
changeset
|
534 * // |
6865eb742883
Tests for subrepo API, refactor status tests for reuse, better subrepos API
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
429
diff
changeset
|
535 * // pretend we delete all files in a branch 2 (which is based on revision 0, same as branch 1) |
6865eb742883
Tests for subrepo API, refactor status tests for reuse, better subrepos API
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
429
diff
changeset
|
536 * manifest.writeUncompressed(1, -1, 1 /*!!! here comes baseRevision != index * /, 2, new byte[0]); // manifest revision 2 |
6865eb742883
Tests for subrepo API, refactor status tests for reuse, better subrepos API
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
429
diff
changeset
|
537 * final byte[] cset3 = buildChangelogEntry(manifest.getRevision(2), Collections.singletonMap("branch", "delete-all-2"), filesList, "Again delete all files but in another branch"); |
6865eb742883
Tests for subrepo API, refactor status tests for reuse, better subrepos API
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
429
diff
changeset
|
538 * changelog.writeUncompressed(0, -1, 2, 2, cset3); |
6865eb742883
Tests for subrepo API, refactor status tests for reuse, better subrepos API
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
429
diff
changeset
|
539 * </pre> |
377
86f049e6bcae
Issue 22: Test for subsequent empty manifest entries case for separate .i and .d repository control files
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
372
diff
changeset
|
540 */ |
86f049e6bcae
Issue 22: Test for subsequent empty manifest entries case for separate .i and .d repository control files
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
372
diff
changeset
|
541 @Test |
86f049e6bcae
Issue 22: Test for subsequent empty manifest entries case for separate .i and .d repository control files
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
372
diff
changeset
|
542 public void testOnEmptyRepositoryWithAllFilesDeletedInBranch() throws Exception { |
86f049e6bcae
Issue 22: Test for subsequent empty manifest entries case for separate .i and .d repository control files
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
372
diff
changeset
|
543 repo = Configuration.get().find("status-3"); |
86f049e6bcae
Issue 22: Test for subsequent empty manifest entries case for separate .i and .d repository control files
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
372
diff
changeset
|
544 HgStatusCommand cmd = new HgStatusCommand(repo); |
86f049e6bcae
Issue 22: Test for subsequent empty manifest entries case for separate .i and .d repository control files
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
372
diff
changeset
|
545 cmd.all(); |
86f049e6bcae
Issue 22: Test for subsequent empty manifest entries case for separate .i and .d repository control files
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
372
diff
changeset
|
546 StatusCollector sc = new StatusCollector(); |
86f049e6bcae
Issue 22: Test for subsequent empty manifest entries case for separate .i and .d repository control files
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
372
diff
changeset
|
547 cmd.execute(sc); |
86f049e6bcae
Issue 22: Test for subsequent empty manifest entries case for separate .i and .d repository control files
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
372
diff
changeset
|
548 // shall pass without exception |
86f049e6bcae
Issue 22: Test for subsequent empty manifest entries case for separate .i and .d repository control files
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
372
diff
changeset
|
549 assertTrue(sc.getErrors().isEmpty()); |
86f049e6bcae
Issue 22: Test for subsequent empty manifest entries case for separate .i and .d repository control files
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
372
diff
changeset
|
550 for (HgStatus.Kind k : HgStatus.Kind.values()) { |
442
6865eb742883
Tests for subrepo API, refactor status tests for reuse, better subrepos API
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
429
diff
changeset
|
551 assertTrue("Kind " + k.name() + " shall be empty", sc.get(k).isEmpty()); |
377
86f049e6bcae
Issue 22: Test for subsequent empty manifest entries case for separate .i and .d repository control files
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
372
diff
changeset
|
552 } |
86f049e6bcae
Issue 22: Test for subsequent empty manifest entries case for separate .i and .d repository control files
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
372
diff
changeset
|
553 } |
442
6865eb742883
Tests for subrepo API, refactor status tests for reuse, better subrepos API
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
429
diff
changeset
|
554 |
387
cdea37239b01
Issue 23: HgInvalidRevisionException for svn imported repository (changeset 0 references nullid manifest). Tests
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
377
diff
changeset
|
555 /** |
442
6865eb742883
Tests for subrepo API, refactor status tests for reuse, better subrepos API
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
429
diff
changeset
|
556 * Issue 23: HgInvalidRevisionException for svn imported repository (changeset 0 references nullid manifest) |
387
cdea37239b01
Issue 23: HgInvalidRevisionException for svn imported repository (changeset 0 references nullid manifest). Tests
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
377
diff
changeset
|
557 */ |
cdea37239b01
Issue 23: HgInvalidRevisionException for svn imported repository (changeset 0 references nullid manifest). Tests
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
377
diff
changeset
|
558 @Test |
cdea37239b01
Issue 23: HgInvalidRevisionException for svn imported repository (changeset 0 references nullid manifest). Tests
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
377
diff
changeset
|
559 public void testImportedRepoWithOddManifestRevisions() throws Exception { |
cdea37239b01
Issue 23: HgInvalidRevisionException for svn imported repository (changeset 0 references nullid manifest). Tests
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
377
diff
changeset
|
560 repo = Configuration.get().find("status-4"); |
cdea37239b01
Issue 23: HgInvalidRevisionException for svn imported repository (changeset 0 references nullid manifest). Tests
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
377
diff
changeset
|
561 HgStatusCommand cmd = new HgStatusCommand(repo); |
cdea37239b01
Issue 23: HgInvalidRevisionException for svn imported repository (changeset 0 references nullid manifest). Tests
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
377
diff
changeset
|
562 cmd.all(); |
cdea37239b01
Issue 23: HgInvalidRevisionException for svn imported repository (changeset 0 references nullid manifest). Tests
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
377
diff
changeset
|
563 StatusCollector sc = new StatusCollector(); |
cdea37239b01
Issue 23: HgInvalidRevisionException for svn imported repository (changeset 0 references nullid manifest). Tests
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
377
diff
changeset
|
564 cmd.execute(sc); |
cdea37239b01
Issue 23: HgInvalidRevisionException for svn imported repository (changeset 0 references nullid manifest). Tests
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
377
diff
changeset
|
565 // shall pass without exception |
cdea37239b01
Issue 23: HgInvalidRevisionException for svn imported repository (changeset 0 references nullid manifest). Tests
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
377
diff
changeset
|
566 assertTrue(sc.getErrors().isEmpty()); |
cdea37239b01
Issue 23: HgInvalidRevisionException for svn imported repository (changeset 0 references nullid manifest). Tests
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
377
diff
changeset
|
567 } |
442
6865eb742883
Tests for subrepo API, refactor status tests for reuse, better subrepos API
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
429
diff
changeset
|
568 |
397
5e95b0da26f2
Issue 24: IAE, Underflow in FilterDataAccess. Issue 26:UnsupportedOperationException when patching empty base revision. Tests
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
387
diff
changeset
|
569 /** |
5e95b0da26f2
Issue 24: IAE, Underflow in FilterDataAccess. Issue 26:UnsupportedOperationException when patching empty base revision. Tests
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
387
diff
changeset
|
570 * Issue 24: IllegalArgumentException in FilterDataAccess |
5e95b0da26f2
Issue 24: IAE, Underflow in FilterDataAccess. Issue 26:UnsupportedOperationException when patching empty base revision. Tests
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
387
diff
changeset
|
571 * There were two related defects in RevlogStream |
442
6865eb742883
Tests for subrepo API, refactor status tests for reuse, better subrepos API
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
429
diff
changeset
|
572 * a) for compressedLen == 0, a byte was read and FilterDataAccess (of length 0, but it didn't help too much) was created - first byte happen to be 0. |
6865eb742883
Tests for subrepo API, refactor status tests for reuse, better subrepos API
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
429
diff
changeset
|
573 * Patch was not applied (userDataAccess.isEmpty() check thanks to Issue 22) |
6865eb742883
Tests for subrepo API, refactor status tests for reuse, better subrepos API
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
429
diff
changeset
|
574 * b) That FilterDataAccess (with 0 size represents patch more or less relevantly, but didn't represent actual revision) get successfully |
6865eb742883
Tests for subrepo API, refactor status tests for reuse, better subrepos API
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
429
diff
changeset
|
575 * reassigned as lastUserData for the next iteration. And at the next step attempt to apply patch recorded in the next revision failed |
6865eb742883
Tests for subrepo API, refactor status tests for reuse, better subrepos API
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
429
diff
changeset
|
576 * because baseRevisionData is 0 length FilterDataAccess |
399
fdc1db8f7f61
Issue 25: Underflow in InflaterDataAccess; test and fix for hang up when reading past end of compressed data (or zero-length data)
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
397
diff
changeset
|
577 * |
442
6865eb742883
Tests for subrepo API, refactor status tests for reuse, better subrepos API
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
429
diff
changeset
|
578 * Same applies for |
399
fdc1db8f7f61
Issue 25: Underflow in InflaterDataAccess; test and fix for hang up when reading past end of compressed data (or zero-length data)
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
397
diff
changeset
|
579 * Issue 25: IOException: Underflow. Rewind past end of the slice in InflaterDataAccess |
fdc1db8f7f61
Issue 25: Underflow in InflaterDataAccess; test and fix for hang up when reading past end of compressed data (or zero-length data)
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
397
diff
changeset
|
580 * with the difference in separate .i and .d (thus not 0 but 'x' first byte was read) |
442
6865eb742883
Tests for subrepo API, refactor status tests for reuse, better subrepos API
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
429
diff
changeset
|
581 * |
397
5e95b0da26f2
Issue 24: IAE, Underflow in FilterDataAccess. Issue 26:UnsupportedOperationException when patching empty base revision. Tests
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
387
diff
changeset
|
582 * Sample: |
442
6865eb742883
Tests for subrepo API, refactor status tests for reuse, better subrepos API
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
429
diff
changeset
|
583 * status-5/file1 has 3 revisions, second is zero-length patch: |
6865eb742883
Tests for subrepo API, refactor status tests for reuse, better subrepos API
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
429
diff
changeset
|
584 * Index Offset Packed Actual Base Rev |
6865eb742883
Tests for subrepo API, refactor status tests for reuse, better subrepos API
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
429
diff
changeset
|
585 * 0: 0 8 7 0 |
6865eb742883
Tests for subrepo API, refactor status tests for reuse, better subrepos API
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
429
diff
changeset
|
586 * DATA |
6865eb742883
Tests for subrepo API, refactor status tests for reuse, better subrepos API
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
429
diff
changeset
|
587 * 1: 8 0 7 0 |
6865eb742883
Tests for subrepo API, refactor status tests for reuse, better subrepos API
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
429
diff
changeset
|
588 * NO DATA |
6865eb742883
Tests for subrepo API, refactor status tests for reuse, better subrepos API
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
429
diff
changeset
|
589 * 2: 8 14 6 0 |
6865eb742883
Tests for subrepo API, refactor status tests for reuse, better subrepos API
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
429
diff
changeset
|
590 * PATCH |
397
5e95b0da26f2
Issue 24: IAE, Underflow in FilterDataAccess. Issue 26:UnsupportedOperationException when patching empty base revision. Tests
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
387
diff
changeset
|
591 */ |
5e95b0da26f2
Issue 24: IAE, Underflow in FilterDataAccess. Issue 26:UnsupportedOperationException when patching empty base revision. Tests
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
387
diff
changeset
|
592 @Test |
442
6865eb742883
Tests for subrepo API, refactor status tests for reuse, better subrepos API
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
429
diff
changeset
|
593 public void testZeroLengthPatchAgainstNonEmptyBaseRev() throws Exception { |
397
5e95b0da26f2
Issue 24: IAE, Underflow in FilterDataAccess. Issue 26:UnsupportedOperationException when patching empty base revision. Tests
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
387
diff
changeset
|
594 repo = Configuration.get().find("status-5"); |
399
fdc1db8f7f61
Issue 25: Underflow in InflaterDataAccess; test and fix for hang up when reading past end of compressed data (or zero-length data)
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
397
diff
changeset
|
595 // pretend we modified files in the working copy |
397
5e95b0da26f2
Issue 24: IAE, Underflow in FilterDataAccess. Issue 26:UnsupportedOperationException when patching empty base revision. Tests
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
387
diff
changeset
|
596 // for HgWorkingCopyStatusCollector to go and retrieve its content from repository |
5e95b0da26f2
Issue 24: IAE, Underflow in FilterDataAccess. Issue 26:UnsupportedOperationException when patching empty base revision. Tests
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
387
diff
changeset
|
597 File f1 = new File(repo.getWorkingDir(), "file1"); |
5e95b0da26f2
Issue 24: IAE, Underflow in FilterDataAccess. Issue 26:UnsupportedOperationException when patching empty base revision. Tests
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
387
diff
changeset
|
598 f1.setLastModified(System.currentTimeMillis()); |
399
fdc1db8f7f61
Issue 25: Underflow in InflaterDataAccess; test and fix for hang up when reading past end of compressed data (or zero-length data)
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
397
diff
changeset
|
599 File f3 = new File(repo.getWorkingDir(), "file3"); |
fdc1db8f7f61
Issue 25: Underflow in InflaterDataAccess; test and fix for hang up when reading past end of compressed data (or zero-length data)
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
397
diff
changeset
|
600 f3.setLastModified(System.currentTimeMillis()); |
397
5e95b0da26f2
Issue 24: IAE, Underflow in FilterDataAccess. Issue 26:UnsupportedOperationException when patching empty base revision. Tests
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
387
diff
changeset
|
601 // |
5e95b0da26f2
Issue 24: IAE, Underflow in FilterDataAccess. Issue 26:UnsupportedOperationException when patching empty base revision. Tests
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
387
diff
changeset
|
602 HgStatusCommand cmd = new HgStatusCommand(repo); |
5e95b0da26f2
Issue 24: IAE, Underflow in FilterDataAccess. Issue 26:UnsupportedOperationException when patching empty base revision. Tests
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
387
diff
changeset
|
603 cmd.all(); |
5e95b0da26f2
Issue 24: IAE, Underflow in FilterDataAccess. Issue 26:UnsupportedOperationException when patching empty base revision. Tests
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
387
diff
changeset
|
604 StatusCollector sc = new StatusCollector(); |
5e95b0da26f2
Issue 24: IAE, Underflow in FilterDataAccess. Issue 26:UnsupportedOperationException when patching empty base revision. Tests
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
387
diff
changeset
|
605 cmd.execute(sc); |
5e95b0da26f2
Issue 24: IAE, Underflow in FilterDataAccess. Issue 26:UnsupportedOperationException when patching empty base revision. Tests
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
387
diff
changeset
|
606 // shall pass without exception |
5e95b0da26f2
Issue 24: IAE, Underflow in FilterDataAccess. Issue 26:UnsupportedOperationException when patching empty base revision. Tests
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
387
diff
changeset
|
607 // |
454
36fd1fd06492
oth.util.Status renamed to Outcome as the noun is too overloaded, especially in scm
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
442
diff
changeset
|
608 for (Map.Entry<Path, Outcome> e : sc.getErrors().entrySet()) { |
397
5e95b0da26f2
Issue 24: IAE, Underflow in FilterDataAccess. Issue 26:UnsupportedOperationException when patching empty base revision. Tests
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
387
diff
changeset
|
609 System.out.printf("%s : (%s %s)\n", e.getKey(), e.getValue().getKind(), e.getValue().getMessage()); |
5e95b0da26f2
Issue 24: IAE, Underflow in FilterDataAccess. Issue 26:UnsupportedOperationException when patching empty base revision. Tests
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
387
diff
changeset
|
610 } |
5e95b0da26f2
Issue 24: IAE, Underflow in FilterDataAccess. Issue 26:UnsupportedOperationException when patching empty base revision. Tests
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
387
diff
changeset
|
611 assertTrue(sc.getErrors().isEmpty()); |
5e95b0da26f2
Issue 24: IAE, Underflow in FilterDataAccess. Issue 26:UnsupportedOperationException when patching empty base revision. Tests
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
387
diff
changeset
|
612 } |
5e95b0da26f2
Issue 24: IAE, Underflow in FilterDataAccess. Issue 26:UnsupportedOperationException when patching empty base revision. Tests
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
387
diff
changeset
|
613 |
5e95b0da26f2
Issue 24: IAE, Underflow in FilterDataAccess. Issue 26:UnsupportedOperationException when patching empty base revision. Tests
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
387
diff
changeset
|
614 /** |
5e95b0da26f2
Issue 24: IAE, Underflow in FilterDataAccess. Issue 26:UnsupportedOperationException when patching empty base revision. Tests
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
387
diff
changeset
|
615 * Issue 26: UnsupportedOperationException when patching empty base revision |
5e95b0da26f2
Issue 24: IAE, Underflow in FilterDataAccess. Issue 26:UnsupportedOperationException when patching empty base revision. Tests
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
387
diff
changeset
|
616 * |
5e95b0da26f2
Issue 24: IAE, Underflow in FilterDataAccess. Issue 26:UnsupportedOperationException when patching empty base revision. Tests
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
387
diff
changeset
|
617 * Sample: |
442
6865eb742883
Tests for subrepo API, refactor status tests for reuse, better subrepos API
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
429
diff
changeset
|
618 * status-5/file2 has 3 revisions, second is patch (complete revision content in a form of the patch) for empty base revision: |
6865eb742883
Tests for subrepo API, refactor status tests for reuse, better subrepos API
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
429
diff
changeset
|
619 * Index Offset Packed Actual Base Rev |
6865eb742883
Tests for subrepo API, refactor status tests for reuse, better subrepos API
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
429
diff
changeset
|
620 * 0: 0 0 0 0 |
6865eb742883
Tests for subrepo API, refactor status tests for reuse, better subrepos API
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
429
diff
changeset
|
621 * NO DATA |
6865eb742883
Tests for subrepo API, refactor status tests for reuse, better subrepos API
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
429
diff
changeset
|
622 * 1: 0 20 7 0 |
6865eb742883
Tests for subrepo API, refactor status tests for reuse, better subrepos API
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
429
diff
changeset
|
623 * PATCH: 0..0, 7:garbage |
6865eb742883
Tests for subrepo API, refactor status tests for reuse, better subrepos API
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
429
diff
changeset
|
624 * 2: 20 16 7 0 |
397
5e95b0da26f2
Issue 24: IAE, Underflow in FilterDataAccess. Issue 26:UnsupportedOperationException when patching empty base revision. Tests
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
387
diff
changeset
|
625 */ |
5e95b0da26f2
Issue 24: IAE, Underflow in FilterDataAccess. Issue 26:UnsupportedOperationException when patching empty base revision. Tests
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
387
diff
changeset
|
626 @Test |
5e95b0da26f2
Issue 24: IAE, Underflow in FilterDataAccess. Issue 26:UnsupportedOperationException when patching empty base revision. Tests
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
387
diff
changeset
|
627 public void testPatchZeroLengthBaseRevision() throws Exception { |
5e95b0da26f2
Issue 24: IAE, Underflow in FilterDataAccess. Issue 26:UnsupportedOperationException when patching empty base revision. Tests
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
387
diff
changeset
|
628 repo = Configuration.get().find("status-5"); |
5e95b0da26f2
Issue 24: IAE, Underflow in FilterDataAccess. Issue 26:UnsupportedOperationException when patching empty base revision. Tests
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
387
diff
changeset
|
629 // touch the file to force content retrieval |
5e95b0da26f2
Issue 24: IAE, Underflow in FilterDataAccess. Issue 26:UnsupportedOperationException when patching empty base revision. Tests
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
387
diff
changeset
|
630 File f2 = new File(repo.getWorkingDir(), "file2"); |
5e95b0da26f2
Issue 24: IAE, Underflow in FilterDataAccess. Issue 26:UnsupportedOperationException when patching empty base revision. Tests
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
387
diff
changeset
|
631 f2.setLastModified(System.currentTimeMillis()); |
5e95b0da26f2
Issue 24: IAE, Underflow in FilterDataAccess. Issue 26:UnsupportedOperationException when patching empty base revision. Tests
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
387
diff
changeset
|
632 // |
5e95b0da26f2
Issue 24: IAE, Underflow in FilterDataAccess. Issue 26:UnsupportedOperationException when patching empty base revision. Tests
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
387
diff
changeset
|
633 HgStatusCommand cmd = new HgStatusCommand(repo); |
5e95b0da26f2
Issue 24: IAE, Underflow in FilterDataAccess. Issue 26:UnsupportedOperationException when patching empty base revision. Tests
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
387
diff
changeset
|
634 cmd.all(); |
5e95b0da26f2
Issue 24: IAE, Underflow in FilterDataAccess. Issue 26:UnsupportedOperationException when patching empty base revision. Tests
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
387
diff
changeset
|
635 StatusCollector sc = new StatusCollector(); |
5e95b0da26f2
Issue 24: IAE, Underflow in FilterDataAccess. Issue 26:UnsupportedOperationException when patching empty base revision. Tests
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
387
diff
changeset
|
636 cmd.execute(sc); |
5e95b0da26f2
Issue 24: IAE, Underflow in FilterDataAccess. Issue 26:UnsupportedOperationException when patching empty base revision. Tests
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
387
diff
changeset
|
637 // shall pass without exception |
5e95b0da26f2
Issue 24: IAE, Underflow in FilterDataAccess. Issue 26:UnsupportedOperationException when patching empty base revision. Tests
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
387
diff
changeset
|
638 // |
454
36fd1fd06492
oth.util.Status renamed to Outcome as the noun is too overloaded, especially in scm
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
442
diff
changeset
|
639 for (Map.Entry<Path, Outcome> e : sc.getErrors().entrySet()) { |
397
5e95b0da26f2
Issue 24: IAE, Underflow in FilterDataAccess. Issue 26:UnsupportedOperationException when patching empty base revision. Tests
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
387
diff
changeset
|
640 System.out.printf("%s : (%s %s)\n", e.getKey(), e.getValue().getKind(), e.getValue().getMessage()); |
5e95b0da26f2
Issue 24: IAE, Underflow in FilterDataAccess. Issue 26:UnsupportedOperationException when patching empty base revision. Tests
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
387
diff
changeset
|
641 } |
5e95b0da26f2
Issue 24: IAE, Underflow in FilterDataAccess. Issue 26:UnsupportedOperationException when patching empty base revision. Tests
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
387
diff
changeset
|
642 assertTrue(sc.getErrors().isEmpty()); |
5e95b0da26f2
Issue 24: IAE, Underflow in FilterDataAccess. Issue 26:UnsupportedOperationException when patching empty base revision. Tests
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
387
diff
changeset
|
643 } |
461
613c883e360e
Do not walk into nested repositories at all, ignore not only .hg but whole nested repo
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
458
diff
changeset
|
644 |
613c883e360e
Do not walk into nested repositories at all, ignore not only .hg but whole nested repo
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
458
diff
changeset
|
645 @Test |
613c883e360e
Do not walk into nested repositories at all, ignore not only .hg but whole nested repo
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
458
diff
changeset
|
646 public void testNestedRepositoriesAreNotWalkedIn() throws Exception { |
613c883e360e
Do not walk into nested repositories at all, ignore not only .hg but whole nested repo
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
458
diff
changeset
|
647 repo = Configuration.get().find("status-nested-repo"); |
613c883e360e
Do not walk into nested repositories at all, ignore not only .hg but whole nested repo
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
458
diff
changeset
|
648 File s2 = new File(repo.getWorkingDir(), "skip/s2/.hg/"); |
613c883e360e
Do not walk into nested repositories at all, ignore not only .hg but whole nested repo
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
458
diff
changeset
|
649 File s1 = new File(repo.getWorkingDir(), "s1/.hg/"); |
613c883e360e
Do not walk into nested repositories at all, ignore not only .hg but whole nested repo
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
458
diff
changeset
|
650 File s1b = new File(repo.getWorkingDir(), "s1/b"); |
613c883e360e
Do not walk into nested repositories at all, ignore not only .hg but whole nested repo
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
458
diff
changeset
|
651 assertTrue("[sanity]", s1.exists() && s1.isDirectory()); |
613c883e360e
Do not walk into nested repositories at all, ignore not only .hg but whole nested repo
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
458
diff
changeset
|
652 assertTrue("[sanity]", s1b.exists() && s1b.isFile()); |
613c883e360e
Do not walk into nested repositories at all, ignore not only .hg but whole nested repo
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
458
diff
changeset
|
653 assertTrue("[sanity]", s2.exists() && s2.isDirectory()); |
613c883e360e
Do not walk into nested repositories at all, ignore not only .hg but whole nested repo
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
458
diff
changeset
|
654 StatusCollector sc = new StatusCollector(); |
613c883e360e
Do not walk into nested repositories at all, ignore not only .hg but whole nested repo
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
458
diff
changeset
|
655 new HgStatusCommand(repo).all().execute(sc); |
613c883e360e
Do not walk into nested repositories at all, ignore not only .hg but whole nested repo
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
458
diff
changeset
|
656 List<Path> ignored = sc.get(Ignored); |
613c883e360e
Do not walk into nested repositories at all, ignore not only .hg but whole nested repo
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
458
diff
changeset
|
657 assertEquals(1, ignored.size()); |
613c883e360e
Do not walk into nested repositories at all, ignore not only .hg but whole nested repo
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
458
diff
changeset
|
658 assertEquals(Path.create("skip/a"), ignored.get(0)); |
613c883e360e
Do not walk into nested repositories at all, ignore not only .hg but whole nested repo
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
458
diff
changeset
|
659 assertTrue(sc.get(Path.create("s1/b")).isEmpty()); |
613c883e360e
Do not walk into nested repositories at all, ignore not only .hg but whole nested repo
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
458
diff
changeset
|
660 } |
377
86f049e6bcae
Issue 22: Test for subsequent empty manifest entries case for separate .i and .d repository control files
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
372
diff
changeset
|
661 |
100
b71b3f7d24d4
Primitive performance test
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
99
diff
changeset
|
662 /* |
b71b3f7d24d4
Primitive performance test
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
99
diff
changeset
|
663 * With warm-up of previous tests, 10 runs, time in milliseconds |
b71b3f7d24d4
Primitive performance test
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
99
diff
changeset
|
664 * 'hg status -A': Native client total 953 (95 per run), Java client 94 (9) |
b71b3f7d24d4
Primitive performance test
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
99
diff
changeset
|
665 * 'hg status -A --rev 3:80': Native client total 1828 (182 per run), Java client 235 (23) |
b71b3f7d24d4
Primitive performance test
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
99
diff
changeset
|
666 * 'hg log --debug', 10 runs: Native client total 1766 (176 per run), Java client 78 (7) |
147
a05145db4d0c
Bring test repos along with us to recreate testbench
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
133
diff
changeset
|
667 * |
a05145db4d0c
Bring test repos along with us to recreate testbench
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
133
diff
changeset
|
668 * 18.02.2011 |
442
6865eb742883
Tests for subrepo API, refactor status tests for reuse, better subrepos API
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
429
diff
changeset
|
669 * 'hg status -A --rev 3:80', 10 runs: Native client total 2000 (200 per run), Java client 250 (25) |
147
a05145db4d0c
Bring test repos along with us to recreate testbench
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
133
diff
changeset
|
670 * 'hg log --debug', 10 runs: Native client total 2297 (229 per run), Java client 125 (12) |
162
c17a08095e44
New performance data
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
147
diff
changeset
|
671 * |
c17a08095e44
New performance data
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
147
diff
changeset
|
672 * 9.3.2011 (DataAccess instead of byte[] in ReflogStream.Inspector |
442
6865eb742883
Tests for subrepo API, refactor status tests for reuse, better subrepos API
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
429
diff
changeset
|
673 * 'hg status -A', 10 runs: Native client total 1516 (151 per run), Java client 219 (21) |
6865eb742883
Tests for subrepo API, refactor status tests for reuse, better subrepos API
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
429
diff
changeset
|
674 * 'hg status -A --rev 3:80', 10 runs: Native client total 1875 (187 per run), Java client 3187 (318) (!!! ???) |
6865eb742883
Tests for subrepo API, refactor status tests for reuse, better subrepos API
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
429
diff
changeset
|
675 * 'hg log --debug', 10 runs: Native client total 2484 (248 per run), Java client 344 (34) |
100
b71b3f7d24d4
Primitive performance test
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
99
diff
changeset
|
676 */ |
b71b3f7d24d4
Primitive performance test
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
99
diff
changeset
|
677 public void testPerformance() throws Exception { |
b71b3f7d24d4
Primitive performance test
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
99
diff
changeset
|
678 final int runs = 10; |
b71b3f7d24d4
Primitive performance test
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
99
diff
changeset
|
679 final long start1 = System.currentTimeMillis(); |
b71b3f7d24d4
Primitive performance test
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
99
diff
changeset
|
680 for (int i = 0; i < runs; i++) { |
b71b3f7d24d4
Primitive performance test
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
99
diff
changeset
|
681 statusParser.reset(); |
b71b3f7d24d4
Primitive performance test
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
99
diff
changeset
|
682 eh.run("hg", "status", "-A", "--rev", "3:80"); |
b71b3f7d24d4
Primitive performance test
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
99
diff
changeset
|
683 } |
b71b3f7d24d4
Primitive performance test
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
99
diff
changeset
|
684 final long start2 = System.currentTimeMillis(); |
b71b3f7d24d4
Primitive performance test
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
99
diff
changeset
|
685 for (int i = 0; i < runs; i++) { |
109
dd4d2d0e42cd
Handler for StatusCommand to get notifications in the form of HgStatus object
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
103
diff
changeset
|
686 StatusCollector r = new StatusCollector(); |
131
aa1629f36482
Renamed .core classes to start with Hg prefix
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
127
diff
changeset
|
687 new HgStatusCommand(repo).all().base(3).revision(80).execute(r); |
100
b71b3f7d24d4
Primitive performance test
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
99
diff
changeset
|
688 } |
b71b3f7d24d4
Primitive performance test
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
99
diff
changeset
|
689 final long end = System.currentTimeMillis(); |
442
6865eb742883
Tests for subrepo API, refactor status tests for reuse, better subrepos API
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
429
diff
changeset
|
690 System.out.printf("'hg status -A --rev 3:80', %d runs: Native client total %d (%d per run), Java client %d (%d)\n", runs, start2 - start1, (start2 - start1) / runs, end - start2, |
6865eb742883
Tests for subrepo API, refactor status tests for reuse, better subrepos API
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
429
diff
changeset
|
691 (end - start2) / runs); |
100
b71b3f7d24d4
Primitive performance test
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
99
diff
changeset
|
692 } |
b71b3f7d24d4
Primitive performance test
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
99
diff
changeset
|
693 |
442
6865eb742883
Tests for subrepo API, refactor status tests for reuse, better subrepos API
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
429
diff
changeset
|
694 static class StatusReporter { |
6865eb742883
Tests for subrepo API, refactor status tests for reuse, better subrepos API
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
429
diff
changeset
|
695 private final StatusOutputParser statusParser; |
6865eb742883
Tests for subrepo API, refactor status tests for reuse, better subrepos API
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
429
diff
changeset
|
696 private final ErrorCollectorExt errorCollector; |
109
dd4d2d0e42cd
Handler for StatusCommand to get notifications in the form of HgStatus object
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
103
diff
changeset
|
697 |
442
6865eb742883
Tests for subrepo API, refactor status tests for reuse, better subrepos API
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
429
diff
changeset
|
698 public StatusReporter(ErrorCollectorExt ec, StatusOutputParser sp) { |
6865eb742883
Tests for subrepo API, refactor status tests for reuse, better subrepos API
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
429
diff
changeset
|
699 errorCollector = ec; |
6865eb742883
Tests for subrepo API, refactor status tests for reuse, better subrepos API
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
429
diff
changeset
|
700 statusParser = sp; |
6865eb742883
Tests for subrepo API, refactor status tests for reuse, better subrepos API
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
429
diff
changeset
|
701 } |
6865eb742883
Tests for subrepo API, refactor status tests for reuse, better subrepos API
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
429
diff
changeset
|
702 |
6865eb742883
Tests for subrepo API, refactor status tests for reuse, better subrepos API
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
429
diff
changeset
|
703 public void report(String what, StatusCollector r) { |
6865eb742883
Tests for subrepo API, refactor status tests for reuse, better subrepos API
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
429
diff
changeset
|
704 errorCollector.assertTrue(what, r.getErrors().isEmpty()); |
6865eb742883
Tests for subrepo API, refactor status tests for reuse, better subrepos API
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
429
diff
changeset
|
705 report(what, r.asStatusRecord()); |
6865eb742883
Tests for subrepo API, refactor status tests for reuse, better subrepos API
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
429
diff
changeset
|
706 } |
6865eb742883
Tests for subrepo API, refactor status tests for reuse, better subrepos API
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
429
diff
changeset
|
707 |
6865eb742883
Tests for subrepo API, refactor status tests for reuse, better subrepos API
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
429
diff
changeset
|
708 public void report(String what, HgStatusCollector.Record r) { |
6865eb742883
Tests for subrepo API, refactor status tests for reuse, better subrepos API
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
429
diff
changeset
|
709 reportNotEqual(what + "#MODIFIED", r.getModified(), statusParser.getModified()); |
6865eb742883
Tests for subrepo API, refactor status tests for reuse, better subrepos API
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
429
diff
changeset
|
710 reportNotEqual(what + "#ADDED", r.getAdded(), statusParser.getAdded()); |
6865eb742883
Tests for subrepo API, refactor status tests for reuse, better subrepos API
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
429
diff
changeset
|
711 reportNotEqual(what + "#REMOVED", r.getRemoved(), statusParser.getRemoved()); |
6865eb742883
Tests for subrepo API, refactor status tests for reuse, better subrepos API
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
429
diff
changeset
|
712 reportNotEqual(what + "#CLEAN", r.getClean(), statusParser.getClean()); |
6865eb742883
Tests for subrepo API, refactor status tests for reuse, better subrepos API
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
429
diff
changeset
|
713 reportNotEqual(what + "#IGNORED", r.getIgnored(), statusParser.getIgnored()); |
6865eb742883
Tests for subrepo API, refactor status tests for reuse, better subrepos API
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
429
diff
changeset
|
714 reportNotEqual(what + "#MISSING", r.getMissing(), statusParser.getMissing()); |
6865eb742883
Tests for subrepo API, refactor status tests for reuse, better subrepos API
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
429
diff
changeset
|
715 reportNotEqual(what + "#UNKNOWN", r.getUnknown(), statusParser.getUnknown()); |
6865eb742883
Tests for subrepo API, refactor status tests for reuse, better subrepos API
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
429
diff
changeset
|
716 List<Path> copiedKeyDiff = difference(r.getCopied().keySet(), statusParser.getCopied().keySet()); |
6865eb742883
Tests for subrepo API, refactor status tests for reuse, better subrepos API
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
429
diff
changeset
|
717 HashMap<Path, String> copyDiff = new HashMap<Path, String>(); |
6865eb742883
Tests for subrepo API, refactor status tests for reuse, better subrepos API
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
429
diff
changeset
|
718 if (copiedKeyDiff.isEmpty()) { |
6865eb742883
Tests for subrepo API, refactor status tests for reuse, better subrepos API
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
429
diff
changeset
|
719 for (Path jk : r.getCopied().keySet()) { |
6865eb742883
Tests for subrepo API, refactor status tests for reuse, better subrepos API
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
429
diff
changeset
|
720 Path jv = r.getCopied().get(jk); |
6865eb742883
Tests for subrepo API, refactor status tests for reuse, better subrepos API
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
429
diff
changeset
|
721 if (statusParser.getCopied().containsKey(jk)) { |
6865eb742883
Tests for subrepo API, refactor status tests for reuse, better subrepos API
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
429
diff
changeset
|
722 Path cmdv = statusParser.getCopied().get(jk); |
6865eb742883
Tests for subrepo API, refactor status tests for reuse, better subrepos API
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
429
diff
changeset
|
723 if (!jv.equals(cmdv)) { |
6865eb742883
Tests for subrepo API, refactor status tests for reuse, better subrepos API
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
429
diff
changeset
|
724 copyDiff.put(jk, jv + " instead of " + cmdv); |
6865eb742883
Tests for subrepo API, refactor status tests for reuse, better subrepos API
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
429
diff
changeset
|
725 } |
6865eb742883
Tests for subrepo API, refactor status tests for reuse, better subrepos API
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
429
diff
changeset
|
726 } else { |
6865eb742883
Tests for subrepo API, refactor status tests for reuse, better subrepos API
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
429
diff
changeset
|
727 copyDiff.put(jk, "ERRONEOUSLY REPORTED IN JAVA"); |
75
e62f9638fb27
Modified test to check copied files
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
74
diff
changeset
|
728 } |
e62f9638fb27
Modified test to check copied files
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
74
diff
changeset
|
729 } |
e62f9638fb27
Modified test to check copied files
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
74
diff
changeset
|
730 } |
442
6865eb742883
Tests for subrepo API, refactor status tests for reuse, better subrepos API
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
429
diff
changeset
|
731 errorCollector.checkThat(what + "#Non-matching 'copied' keys: ", copiedKeyDiff, equalTo(Collections.<Path> emptyList())); |
6865eb742883
Tests for subrepo API, refactor status tests for reuse, better subrepos API
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
429
diff
changeset
|
732 errorCollector.checkThat(what + "#COPIED", copyDiff, equalTo(Collections.<Path, String> emptyMap())); |
75
e62f9638fb27
Modified test to check copied files
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
74
diff
changeset
|
733 } |
61
fac8e7fcc8b0
Simple test framework - capable of parsing Hg cmdline output to compare with Java result
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
diff
changeset
|
734 |
442
6865eb742883
Tests for subrepo API, refactor status tests for reuse, better subrepos API
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
429
diff
changeset
|
735 private <T extends Comparable<? super T>> void reportNotEqual(String what, Collection<T> l1, Collection<T> l2) { |
6865eb742883
Tests for subrepo API, refactor status tests for reuse, better subrepos API
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
429
diff
changeset
|
736 // List<T> diff = difference(l1, l2); |
6865eb742883
Tests for subrepo API, refactor status tests for reuse, better subrepos API
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
429
diff
changeset
|
737 // errorCollector.checkThat(what, diff, equalTo(Collections.<T>emptyList())); |
6865eb742883
Tests for subrepo API, refactor status tests for reuse, better subrepos API
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
429
diff
changeset
|
738 ArrayList<T> sl1 = new ArrayList<T>(l1); |
6865eb742883
Tests for subrepo API, refactor status tests for reuse, better subrepos API
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
429
diff
changeset
|
739 Collections.sort(sl1); |
6865eb742883
Tests for subrepo API, refactor status tests for reuse, better subrepos API
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
429
diff
changeset
|
740 ArrayList<T> sl2 = new ArrayList<T>(l2); |
6865eb742883
Tests for subrepo API, refactor status tests for reuse, better subrepos API
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
429
diff
changeset
|
741 Collections.sort(sl2); |
473
5c09a9f2e073
Issue 34: incorrect status for a file copy in wc against base rev
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
461
diff
changeset
|
742 if (!sl1.isEmpty() && !sl2.isEmpty()) { |
5c09a9f2e073
Issue 34: incorrect status for a file copy in wc against base rev
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
461
diff
changeset
|
743 what = what + ", diff:" + difference(sl1, sl2); |
5c09a9f2e073
Issue 34: incorrect status for a file copy in wc against base rev
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
461
diff
changeset
|
744 } |
442
6865eb742883
Tests for subrepo API, refactor status tests for reuse, better subrepos API
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
429
diff
changeset
|
745 errorCollector.checkThat(what, sl1, equalTo(sl2)); |
6865eb742883
Tests for subrepo API, refactor status tests for reuse, better subrepos API
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
429
diff
changeset
|
746 } |
6865eb742883
Tests for subrepo API, refactor status tests for reuse, better subrepos API
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
429
diff
changeset
|
747 |
6865eb742883
Tests for subrepo API, refactor status tests for reuse, better subrepos API
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
429
diff
changeset
|
748 public static <T> List<T> difference(Collection<T> l1, Collection<T> l2) { |
6865eb742883
Tests for subrepo API, refactor status tests for reuse, better subrepos API
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
429
diff
changeset
|
749 LinkedList<T> result = new LinkedList<T>(l2); |
6865eb742883
Tests for subrepo API, refactor status tests for reuse, better subrepos API
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
429
diff
changeset
|
750 for (T t : l1) { |
6865eb742883
Tests for subrepo API, refactor status tests for reuse, better subrepos API
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
429
diff
changeset
|
751 if (l2.contains(t)) { |
6865eb742883
Tests for subrepo API, refactor status tests for reuse, better subrepos API
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
429
diff
changeset
|
752 result.remove(t); |
6865eb742883
Tests for subrepo API, refactor status tests for reuse, better subrepos API
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
429
diff
changeset
|
753 } else { |
6865eb742883
Tests for subrepo API, refactor status tests for reuse, better subrepos API
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
429
diff
changeset
|
754 result.add(t); |
6865eb742883
Tests for subrepo API, refactor status tests for reuse, better subrepos API
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
429
diff
changeset
|
755 } |
61
fac8e7fcc8b0
Simple test framework - capable of parsing Hg cmdline output to compare with Java result
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
diff
changeset
|
756 } |
442
6865eb742883
Tests for subrepo API, refactor status tests for reuse, better subrepos API
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
429
diff
changeset
|
757 return result; |
61
fac8e7fcc8b0
Simple test framework - capable of parsing Hg cmdline output to compare with Java result
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
diff
changeset
|
758 } |
fac8e7fcc8b0
Simple test framework - capable of parsing Hg cmdline output to compare with Java result
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
diff
changeset
|
759 } |
fac8e7fcc8b0
Simple test framework - capable of parsing Hg cmdline output to compare with Java result
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
diff
changeset
|
760 } |