Mercurial > jhg
annotate test/com/tmate/hgkit/StatusOutputParser.java @ 64:19e9e220bf68
Convenient commands constitute hi-level API. org.tmatesoft namespace, GPL2 statement
author | Artem Tikhomirov <tikhomirov.artem@gmail.com> |
---|---|
date | Fri, 21 Jan 2011 05:56:43 +0100 |
parents | fac8e7fcc8b0 |
children |
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 /* |
fac8e7fcc8b0
Simple test framework - capable of parsing Hg cmdline output to compare with Java result
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
diff
changeset
|
2 * Copyright (c) 2011 Artem Tikhomirov |
fac8e7fcc8b0
Simple test framework - capable of parsing Hg cmdline output to compare with Java result
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
diff
changeset
|
3 */ |
fac8e7fcc8b0
Simple test framework - capable of parsing Hg cmdline output to compare with Java result
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
diff
changeset
|
4 package com.tmate.hgkit; |
fac8e7fcc8b0
Simple test framework - capable of parsing Hg cmdline output to compare with Java result
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
diff
changeset
|
5 |
fac8e7fcc8b0
Simple test framework - capable of parsing Hg cmdline output to compare with Java result
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
diff
changeset
|
6 import java.io.File; |
fac8e7fcc8b0
Simple test framework - capable of parsing Hg cmdline output to compare with Java result
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
diff
changeset
|
7 import java.util.Collections; |
fac8e7fcc8b0
Simple test framework - capable of parsing Hg cmdline output to compare with Java result
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
diff
changeset
|
8 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
|
9 import java.util.List; |
fac8e7fcc8b0
Simple test framework - capable of parsing Hg cmdline output to compare with Java result
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
diff
changeset
|
10 import java.util.Map; |
fac8e7fcc8b0
Simple test framework - capable of parsing Hg cmdline output to compare with Java result
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
diff
changeset
|
11 import java.util.TreeMap; |
fac8e7fcc8b0
Simple test framework - capable of parsing Hg cmdline output to compare with Java result
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
diff
changeset
|
12 import java.util.regex.Matcher; |
fac8e7fcc8b0
Simple test framework - capable of parsing Hg cmdline output to compare with Java result
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
diff
changeset
|
13 import java.util.regex.Pattern; |
fac8e7fcc8b0
Simple test framework - capable of parsing Hg cmdline output to compare with Java result
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
diff
changeset
|
14 |
fac8e7fcc8b0
Simple test framework - capable of parsing Hg cmdline output to compare with Java result
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
diff
changeset
|
15 /** |
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 * |
fac8e7fcc8b0
Simple test framework - capable of parsing Hg cmdline output to compare with Java result
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
diff
changeset
|
17 * @author artem |
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 */ |
fac8e7fcc8b0
Simple test framework - capable of parsing Hg cmdline output to compare with Java result
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
diff
changeset
|
19 public class StatusOutputParser implements OutputParser { |
fac8e7fcc8b0
Simple test framework - capable of parsing Hg cmdline output to compare with Java result
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
diff
changeset
|
20 |
fac8e7fcc8b0
Simple test framework - capable of parsing Hg cmdline output to compare with Java result
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
diff
changeset
|
21 private final Pattern pattern; |
fac8e7fcc8b0
Simple test framework - capable of parsing Hg cmdline output to compare with Java result
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
diff
changeset
|
22 private List<String> modified, added, removed, clean, missing, unknown, ignored; |
fac8e7fcc8b0
Simple test framework - capable of parsing Hg cmdline output to compare with Java result
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
diff
changeset
|
23 private Map<String, String> copied; |
fac8e7fcc8b0
Simple test framework - capable of parsing Hg cmdline output to compare with Java result
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
diff
changeset
|
24 private final boolean winPathSeparator; |
fac8e7fcc8b0
Simple test framework - capable of parsing Hg cmdline output to compare with Java result
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
diff
changeset
|
25 |
fac8e7fcc8b0
Simple test framework - capable of parsing Hg cmdline output to compare with Java result
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
diff
changeset
|
26 public StatusOutputParser() { |
fac8e7fcc8b0
Simple test framework - capable of parsing Hg cmdline output to compare with Java result
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
diff
changeset
|
27 // pattern = Pattern.compile("^([MAR?IC! ]) ([\\w \\.-/\\\\]+)$", Pattern.MULTILINE); |
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 pattern = Pattern.compile("^([MAR?IC! ]) (.+)$", Pattern.MULTILINE); |
fac8e7fcc8b0
Simple test framework - capable of parsing Hg cmdline output to compare with Java result
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
diff
changeset
|
29 winPathSeparator = File.separatorChar == '\\'; |
fac8e7fcc8b0
Simple test framework - capable of parsing Hg cmdline output to compare with Java result
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
diff
changeset
|
30 } |
fac8e7fcc8b0
Simple test framework - capable of parsing Hg cmdline output to compare with Java result
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
diff
changeset
|
31 |
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 public void reset() { |
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 modified = added = removed = clean = missing = unknown = ignored = null; |
fac8e7fcc8b0
Simple test framework - capable of parsing Hg cmdline output to compare with Java result
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
diff
changeset
|
34 copied = null; |
fac8e7fcc8b0
Simple test framework - capable of parsing Hg cmdline output to compare with Java result
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
diff
changeset
|
35 } |
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 |
fac8e7fcc8b0
Simple test framework - capable of parsing Hg cmdline output to compare with Java result
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
diff
changeset
|
37 public void parse(CharSequence seq) { |
fac8e7fcc8b0
Simple test framework - capable of parsing Hg cmdline output to compare with Java result
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
diff
changeset
|
38 Matcher m = pattern.matcher(seq); |
fac8e7fcc8b0
Simple test framework - capable of parsing Hg cmdline output to compare with Java result
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
diff
changeset
|
39 while (m.find()) { |
fac8e7fcc8b0
Simple test framework - capable of parsing Hg cmdline output to compare with Java result
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
diff
changeset
|
40 String fname = m.group(2); |
fac8e7fcc8b0
Simple test framework - capable of parsing Hg cmdline output to compare with Java result
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
diff
changeset
|
41 switch ((int) m.group(1).charAt(0)) { |
fac8e7fcc8b0
Simple test framework - capable of parsing Hg cmdline output to compare with Java result
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
diff
changeset
|
42 case (int) 'M' : { |
fac8e7fcc8b0
Simple test framework - capable of parsing Hg cmdline output to compare with Java result
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
diff
changeset
|
43 modified = doAdd(modified, fname); |
fac8e7fcc8b0
Simple test framework - capable of parsing Hg cmdline output to compare with Java result
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
diff
changeset
|
44 break; |
fac8e7fcc8b0
Simple test framework - capable of parsing Hg cmdline output to compare with Java result
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
diff
changeset
|
45 } |
fac8e7fcc8b0
Simple test framework - capable of parsing Hg cmdline output to compare with Java result
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
diff
changeset
|
46 case (int) 'A' : { |
fac8e7fcc8b0
Simple test framework - capable of parsing Hg cmdline output to compare with Java result
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
diff
changeset
|
47 added = doAdd(added, fname); |
fac8e7fcc8b0
Simple test framework - capable of parsing Hg cmdline output to compare with Java result
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
diff
changeset
|
48 break; |
fac8e7fcc8b0
Simple test framework - capable of parsing Hg cmdline output to compare with Java result
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
diff
changeset
|
49 } |
fac8e7fcc8b0
Simple test framework - capable of parsing Hg cmdline output to compare with Java result
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
diff
changeset
|
50 case (int) 'R' : { |
fac8e7fcc8b0
Simple test framework - capable of parsing Hg cmdline output to compare with Java result
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
diff
changeset
|
51 removed = doAdd(removed, fname); |
fac8e7fcc8b0
Simple test framework - capable of parsing Hg cmdline output to compare with Java result
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
diff
changeset
|
52 break; |
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 } |
fac8e7fcc8b0
Simple test framework - capable of parsing Hg cmdline output to compare with Java result
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
diff
changeset
|
54 case (int) '?' : { |
fac8e7fcc8b0
Simple test framework - capable of parsing Hg cmdline output to compare with Java result
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
diff
changeset
|
55 unknown = doAdd(unknown, fname); |
fac8e7fcc8b0
Simple test framework - capable of parsing Hg cmdline output to compare with Java result
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
diff
changeset
|
56 break; |
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 case (int) 'I' : { |
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 ignored = doAdd(ignored, fname); |
fac8e7fcc8b0
Simple test framework - capable of parsing Hg cmdline output to compare with Java result
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
diff
changeset
|
60 break; |
fac8e7fcc8b0
Simple test framework - capable of parsing Hg cmdline output to compare with Java result
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
diff
changeset
|
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
|
62 case (int) 'C' : { |
fac8e7fcc8b0
Simple test framework - capable of parsing Hg cmdline output to compare with Java result
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
diff
changeset
|
63 clean = doAdd(clean, fname); |
fac8e7fcc8b0
Simple test framework - capable of parsing Hg cmdline output to compare with Java result
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
diff
changeset
|
64 break; |
fac8e7fcc8b0
Simple test framework - capable of parsing Hg cmdline output to compare with Java result
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
diff
changeset
|
65 } |
fac8e7fcc8b0
Simple test framework - capable of parsing Hg cmdline output to compare with Java result
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
diff
changeset
|
66 case (int) '!' : { |
fac8e7fcc8b0
Simple test framework - capable of parsing Hg cmdline output to compare with Java result
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
diff
changeset
|
67 missing = doAdd(missing, fname); |
fac8e7fcc8b0
Simple test framework - capable of parsing Hg cmdline output to compare with Java result
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
diff
changeset
|
68 break; |
fac8e7fcc8b0
Simple test framework - capable of parsing Hg cmdline output to compare with Java result
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
diff
changeset
|
69 } |
fac8e7fcc8b0
Simple test framework - capable of parsing Hg cmdline output to compare with Java result
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
diff
changeset
|
70 case (int) ' ' : { |
fac8e7fcc8b0
Simple test framework - capable of parsing Hg cmdline output to compare with Java result
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
diff
changeset
|
71 if (copied == null) { |
fac8e7fcc8b0
Simple test framework - capable of parsing Hg cmdline output to compare with Java result
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
diff
changeset
|
72 copied = new TreeMap<String, String>(); |
fac8e7fcc8b0
Simple test framework - capable of parsing Hg cmdline output to compare with Java result
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
diff
changeset
|
73 } |
fac8e7fcc8b0
Simple test framework - capable of parsing Hg cmdline output to compare with Java result
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
diff
changeset
|
74 // last added is copy destination |
fac8e7fcc8b0
Simple test framework - capable of parsing Hg cmdline output to compare with Java result
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
diff
changeset
|
75 // to get or to remove it - depends on what StatusCollector does in this case |
fac8e7fcc8b0
Simple test framework - capable of parsing Hg cmdline output to compare with Java result
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
diff
changeset
|
76 copied.put(fname, added.get(added.size() - 1)); |
fac8e7fcc8b0
Simple test framework - capable of parsing Hg cmdline output to compare with Java result
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
diff
changeset
|
77 break; |
fac8e7fcc8b0
Simple test framework - capable of parsing Hg cmdline output to compare with Java result
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
diff
changeset
|
78 } |
fac8e7fcc8b0
Simple test framework - capable of parsing Hg cmdline output to compare with Java result
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
diff
changeset
|
79 } |
fac8e7fcc8b0
Simple test framework - capable of parsing Hg cmdline output to compare with Java result
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
diff
changeset
|
80 } |
fac8e7fcc8b0
Simple test framework - capable of parsing Hg cmdline output to compare with Java result
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
diff
changeset
|
81 } |
fac8e7fcc8b0
Simple test framework - capable of parsing Hg cmdline output to compare with Java result
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
diff
changeset
|
82 |
fac8e7fcc8b0
Simple test framework - capable of parsing Hg cmdline output to compare with Java result
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
diff
changeset
|
83 // |
fac8e7fcc8b0
Simple test framework - capable of parsing Hg cmdline output to compare with Java result
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
diff
changeset
|
84 public List<String> getModified() { |
fac8e7fcc8b0
Simple test framework - capable of parsing Hg cmdline output to compare with Java result
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
diff
changeset
|
85 return proper(modified); |
fac8e7fcc8b0
Simple test framework - capable of parsing Hg cmdline output to compare with Java result
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
diff
changeset
|
86 } |
fac8e7fcc8b0
Simple test framework - capable of parsing Hg cmdline output to compare with Java result
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
diff
changeset
|
87 |
fac8e7fcc8b0
Simple test framework - capable of parsing Hg cmdline output to compare with Java result
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
diff
changeset
|
88 public List<String> getAdded() { |
fac8e7fcc8b0
Simple test framework - capable of parsing Hg cmdline output to compare with Java result
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
diff
changeset
|
89 return proper(added); |
fac8e7fcc8b0
Simple test framework - capable of parsing Hg cmdline output to compare with Java result
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
diff
changeset
|
90 } |
fac8e7fcc8b0
Simple test framework - capable of parsing Hg cmdline output to compare with Java result
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
diff
changeset
|
91 |
fac8e7fcc8b0
Simple test framework - capable of parsing Hg cmdline output to compare with Java result
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
diff
changeset
|
92 public List<String> getRemoved() { |
fac8e7fcc8b0
Simple test framework - capable of parsing Hg cmdline output to compare with Java result
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
diff
changeset
|
93 return proper(removed); |
fac8e7fcc8b0
Simple test framework - capable of parsing Hg cmdline output to compare with Java result
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
diff
changeset
|
94 } |
fac8e7fcc8b0
Simple test framework - capable of parsing Hg cmdline output to compare with Java result
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
diff
changeset
|
95 |
fac8e7fcc8b0
Simple test framework - capable of parsing Hg cmdline output to compare with Java result
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
diff
changeset
|
96 public Map<String,String> getCopied() { |
fac8e7fcc8b0
Simple test framework - capable of parsing Hg cmdline output to compare with Java result
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
diff
changeset
|
97 if (copied == null) { |
fac8e7fcc8b0
Simple test framework - capable of parsing Hg cmdline output to compare with Java result
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
diff
changeset
|
98 return Collections.emptyMap(); |
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 } |
fac8e7fcc8b0
Simple test framework - capable of parsing Hg cmdline output to compare with Java result
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
diff
changeset
|
100 return Collections.unmodifiableMap(copied); |
fac8e7fcc8b0
Simple test framework - capable of parsing Hg cmdline output to compare with Java result
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
diff
changeset
|
101 } |
fac8e7fcc8b0
Simple test framework - capable of parsing Hg cmdline output to compare with Java result
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
diff
changeset
|
102 |
fac8e7fcc8b0
Simple test framework - capable of parsing Hg cmdline output to compare with Java result
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
diff
changeset
|
103 public List<String> getClean() { |
fac8e7fcc8b0
Simple test framework - capable of parsing Hg cmdline output to compare with Java result
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
diff
changeset
|
104 return proper(clean); |
fac8e7fcc8b0
Simple test framework - capable of parsing Hg cmdline output to compare with Java result
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
diff
changeset
|
105 } |
fac8e7fcc8b0
Simple test framework - capable of parsing Hg cmdline output to compare with Java result
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
diff
changeset
|
106 |
fac8e7fcc8b0
Simple test framework - capable of parsing Hg cmdline output to compare with Java result
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
diff
changeset
|
107 public List<String> getMissing() { |
fac8e7fcc8b0
Simple test framework - capable of parsing Hg cmdline output to compare with Java result
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
diff
changeset
|
108 return proper(missing); |
fac8e7fcc8b0
Simple test framework - capable of parsing Hg cmdline output to compare with Java result
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
diff
changeset
|
109 } |
fac8e7fcc8b0
Simple test framework - capable of parsing Hg cmdline output to compare with Java result
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
diff
changeset
|
110 |
fac8e7fcc8b0
Simple test framework - capable of parsing Hg cmdline output to compare with Java result
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
diff
changeset
|
111 public List<String> getUnknown() { |
fac8e7fcc8b0
Simple test framework - capable of parsing Hg cmdline output to compare with Java result
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
diff
changeset
|
112 return proper(unknown); |
fac8e7fcc8b0
Simple test framework - capable of parsing Hg cmdline output to compare with Java result
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
diff
changeset
|
113 } |
fac8e7fcc8b0
Simple test framework - capable of parsing Hg cmdline output to compare with Java result
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
diff
changeset
|
114 |
fac8e7fcc8b0
Simple test framework - capable of parsing Hg cmdline output to compare with Java result
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
diff
changeset
|
115 public List<String> getIgnored() { |
fac8e7fcc8b0
Simple test framework - capable of parsing Hg cmdline output to compare with Java result
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
diff
changeset
|
116 return proper(ignored); |
fac8e7fcc8b0
Simple test framework - capable of parsing Hg cmdline output to compare with Java result
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
diff
changeset
|
117 } |
fac8e7fcc8b0
Simple test framework - capable of parsing Hg cmdline output to compare with Java result
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
diff
changeset
|
118 |
fac8e7fcc8b0
Simple test framework - capable of parsing Hg cmdline output to compare with Java result
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
diff
changeset
|
119 private List<String> proper(List<String> l) { |
fac8e7fcc8b0
Simple test framework - capable of parsing Hg cmdline output to compare with Java result
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
diff
changeset
|
120 if (l == null) { |
fac8e7fcc8b0
Simple test framework - capable of parsing Hg cmdline output to compare with Java result
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
diff
changeset
|
121 return Collections.emptyList(); |
fac8e7fcc8b0
Simple test framework - capable of parsing Hg cmdline output to compare with Java result
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
diff
changeset
|
122 } |
fac8e7fcc8b0
Simple test framework - capable of parsing Hg cmdline output to compare with Java result
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
diff
changeset
|
123 return Collections.unmodifiableList(l); |
fac8e7fcc8b0
Simple test framework - capable of parsing Hg cmdline output to compare with Java result
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
diff
changeset
|
124 } |
fac8e7fcc8b0
Simple test framework - capable of parsing Hg cmdline output to compare with Java result
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
diff
changeset
|
125 |
fac8e7fcc8b0
Simple test framework - capable of parsing Hg cmdline output to compare with Java result
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
diff
changeset
|
126 private List<String> doAdd(List<String> l, String s) { |
fac8e7fcc8b0
Simple test framework - capable of parsing Hg cmdline output to compare with Java result
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
diff
changeset
|
127 if (l == null) { |
fac8e7fcc8b0
Simple test framework - capable of parsing Hg cmdline output to compare with Java result
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
diff
changeset
|
128 l = new LinkedList<String>(); |
fac8e7fcc8b0
Simple test framework - capable of parsing Hg cmdline output to compare with Java result
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
diff
changeset
|
129 } |
fac8e7fcc8b0
Simple test framework - capable of parsing Hg cmdline output to compare with Java result
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
diff
changeset
|
130 if (winPathSeparator) { |
fac8e7fcc8b0
Simple test framework - capable of parsing Hg cmdline output to compare with Java result
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
diff
changeset
|
131 // Java impl always give slashed path, while Hg uses local, os-specific convention |
fac8e7fcc8b0
Simple test framework - capable of parsing Hg cmdline output to compare with Java result
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
diff
changeset
|
132 s = s.replace('\\', '/'); |
fac8e7fcc8b0
Simple test framework - capable of parsing Hg cmdline output to compare with Java result
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
diff
changeset
|
133 } |
fac8e7fcc8b0
Simple test framework - capable of parsing Hg cmdline output to compare with Java result
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
diff
changeset
|
134 l.add(s); |
fac8e7fcc8b0
Simple test framework - capable of parsing Hg cmdline output to compare with Java result
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
diff
changeset
|
135 return l; |
fac8e7fcc8b0
Simple test framework - capable of parsing Hg cmdline output to compare with Java result
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
diff
changeset
|
136 } |
fac8e7fcc8b0
Simple test framework - capable of parsing Hg cmdline output to compare with Java result
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
diff
changeset
|
137 } |