Mercurial > hg4j
annotate src/org/tmatesoft/hg/core/HgStatusCommand.java @ 457:d78cb5ca3053
Get rid of ambiguity in method name
author | Artem Tikhomirov <tikhomirov.artem@gmail.com> |
---|---|
date | Mon, 18 Jun 2012 17:06:42 +0200 |
parents | 36fd1fd06492 |
children | 2f9ed6bcefa2 |
rev | line source |
---|---|
64
19e9e220bf68
Convenient commands constitute hi-level API. org.tmatesoft namespace, GPL2 statement
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
diff
changeset
|
1 /* |
419
7f136a3fa671
Clean javadoc to fix obvious warnings
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
418
diff
changeset
|
2 * Copyright (c) 2011-2012 TMate Software Ltd |
64
19e9e220bf68
Convenient commands constitute hi-level API. org.tmatesoft namespace, GPL2 statement
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
diff
changeset
|
3 * |
19e9e220bf68
Convenient commands constitute hi-level API. org.tmatesoft namespace, GPL2 statement
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
diff
changeset
|
4 * This program is free software; you can redistribute it and/or modify |
19e9e220bf68
Convenient commands constitute hi-level API. org.tmatesoft namespace, GPL2 statement
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
diff
changeset
|
5 * it under the terms of the GNU General Public License as published by |
19e9e220bf68
Convenient commands constitute hi-level API. org.tmatesoft namespace, GPL2 statement
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
diff
changeset
|
6 * the Free Software Foundation; version 2 of the License. |
19e9e220bf68
Convenient commands constitute hi-level API. org.tmatesoft namespace, GPL2 statement
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
diff
changeset
|
7 * |
19e9e220bf68
Convenient commands constitute hi-level API. org.tmatesoft namespace, GPL2 statement
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
diff
changeset
|
8 * This program is distributed in the hope that it will be useful, |
19e9e220bf68
Convenient commands constitute hi-level API. org.tmatesoft namespace, GPL2 statement
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
diff
changeset
|
9 * but WITHOUT ANY WARRANTY; without even the implied warranty of |
19e9e220bf68
Convenient commands constitute hi-level API. org.tmatesoft namespace, GPL2 statement
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
diff
changeset
|
10 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
19e9e220bf68
Convenient commands constitute hi-level API. org.tmatesoft namespace, GPL2 statement
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
diff
changeset
|
11 * GNU General Public License for more details. |
19e9e220bf68
Convenient commands constitute hi-level API. org.tmatesoft namespace, GPL2 statement
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
diff
changeset
|
12 * |
19e9e220bf68
Convenient commands constitute hi-level API. org.tmatesoft namespace, GPL2 statement
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
diff
changeset
|
13 * For information on how to redistribute this software under |
19e9e220bf68
Convenient commands constitute hi-level API. org.tmatesoft namespace, GPL2 statement
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
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:
99
diff
changeset
|
15 * contact TMate Software at support@hg4j.com |
64
19e9e220bf68
Convenient commands constitute hi-level API. org.tmatesoft namespace, GPL2 statement
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
diff
changeset
|
16 */ |
19e9e220bf68
Convenient commands constitute hi-level API. org.tmatesoft namespace, GPL2 statement
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
diff
changeset
|
17 package org.tmatesoft.hg.core; |
19e9e220bf68
Convenient commands constitute hi-level API. org.tmatesoft namespace, GPL2 statement
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
diff
changeset
|
18 |
127
2e395db595e2
Moved HgStatus to toplevel
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
123
diff
changeset
|
19 import static org.tmatesoft.hg.core.HgStatus.Kind.*; |
367
2fadf8695f8a
Use 'revision index' instead of the vague 'local revision number' concept in the API
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
360
diff
changeset
|
20 import static org.tmatesoft.hg.repo.HgInternals.wrongRevisionIndex; |
109
dd4d2d0e42cd
Handler for StatusCommand to get notifications in the form of HgStatus object
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
102
diff
changeset
|
21 import static org.tmatesoft.hg.repo.HgRepository.*; |
68
0e499fed9b3d
StatusCommand with tests. Extra constants to indicate common revision cases
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
64
diff
changeset
|
22 |
350
33eaed1ad130
Allow FileIterator report any errors from the underlaying file system up to the client
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
275
diff
changeset
|
23 import java.io.IOException; |
93
d55d4eedfc57
Switch to Path instead of String in filenames returned by various status operations
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
74
diff
changeset
|
24 import java.util.ConcurrentModificationException; |
d55d4eedfc57
Switch to Path instead of String in filenames returned by various status operations
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
74
diff
changeset
|
25 |
128
44b97930570c
Introduced ChangelogHelper to look up changesets files were modified in
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
127
diff
changeset
|
26 import org.tmatesoft.hg.internal.ChangelogHelper; |
74
6f1b88693d48
Complete refactoring to org.tmatesoft
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
68
diff
changeset
|
27 import org.tmatesoft.hg.repo.HgRepository; |
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:
424
diff
changeset
|
28 import org.tmatesoft.hg.repo.HgRuntimeException; |
109
dd4d2d0e42cd
Handler for StatusCommand to get notifications in the form of HgStatus object
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
102
diff
changeset
|
29 import org.tmatesoft.hg.repo.HgStatusCollector; |
93
d55d4eedfc57
Switch to Path instead of String in filenames returned by various status operations
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
74
diff
changeset
|
30 import org.tmatesoft.hg.repo.HgStatusInspector; |
94
af1f3b78b918
*StatusCollector renamed to Hg*StatusCollector
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
93
diff
changeset
|
31 import org.tmatesoft.hg.repo.HgWorkingCopyStatusCollector; |
423
9c9c442b5f2e
Major refactoring of exception handling. Low-level API uses RuntimeExceptions, while checked are left for higher level
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
419
diff
changeset
|
32 import org.tmatesoft.hg.util.CancelSupport; |
9c9c442b5f2e
Major refactoring of exception handling. Low-level API uses RuntimeExceptions, while checked are left for higher level
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
419
diff
changeset
|
33 import org.tmatesoft.hg.util.CancelledException; |
133
4a948ec83980
core.Path to util.Path as it's not Hg repo dependant
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
131
diff
changeset
|
34 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:
429
diff
changeset
|
35 import org.tmatesoft.hg.util.Outcome; |
64
19e9e220bf68
Convenient commands constitute hi-level API. org.tmatesoft namespace, GPL2 statement
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
diff
changeset
|
36 |
19e9e220bf68
Convenient commands constitute hi-level API. org.tmatesoft namespace, GPL2 statement
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
diff
changeset
|
37 /** |
131
aa1629f36482
Renamed .core classes to start with Hg prefix
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
128
diff
changeset
|
38 * Command to obtain file status information, 'hg status' counterpart. |
aa1629f36482
Renamed .core classes to start with Hg prefix
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
128
diff
changeset
|
39 * |
64
19e9e220bf68
Convenient commands constitute hi-level API. org.tmatesoft namespace, GPL2 statement
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
diff
changeset
|
40 * @author Artem Tikhomirov |
19e9e220bf68
Convenient commands constitute hi-level API. org.tmatesoft namespace, GPL2 statement
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
diff
changeset
|
41 * @author TMate Software Ltd. |
19e9e220bf68
Convenient commands constitute hi-level API. org.tmatesoft namespace, GPL2 statement
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
diff
changeset
|
42 */ |
215
41a778e3fd31
Issue 5: Facilities for progress and cancellation. More specific exceptions. Exceptions from callbacks as RuntimeException
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
164
diff
changeset
|
43 public class HgStatusCommand extends HgAbstractCommand<HgStatusCommand> { |
64
19e9e220bf68
Convenient commands constitute hi-level API. org.tmatesoft namespace, GPL2 statement
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
diff
changeset
|
44 private final HgRepository repo; |
19e9e220bf68
Convenient commands constitute hi-level API. org.tmatesoft namespace, GPL2 statement
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
diff
changeset
|
45 |
68
0e499fed9b3d
StatusCommand with tests. Extra constants to indicate common revision cases
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
64
diff
changeset
|
46 private int startRevision = TIP; |
229
1ec6b327a6ac
Scope for status reworked: explicit files or a general matcher
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
215
diff
changeset
|
47 private int endRevision = WORKING_COPY; |
1ec6b327a6ac
Scope for status reworked: explicit files or a general matcher
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
215
diff
changeset
|
48 private Path.Matcher scope; |
93
d55d4eedfc57
Switch to Path instead of String in filenames returned by various status operations
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
74
diff
changeset
|
49 |
d55d4eedfc57
Switch to Path instead of String in filenames returned by various status operations
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
74
diff
changeset
|
50 private final Mediator mediator = new Mediator(); |
64
19e9e220bf68
Convenient commands constitute hi-level API. org.tmatesoft namespace, GPL2 statement
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
diff
changeset
|
51 |
131
aa1629f36482
Renamed .core classes to start with Hg prefix
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
128
diff
changeset
|
52 public HgStatusCommand(HgRepository hgRepo) { |
68
0e499fed9b3d
StatusCommand with tests. Extra constants to indicate common revision cases
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
64
diff
changeset
|
53 repo = hgRepo; |
0e499fed9b3d
StatusCommand with tests. Extra constants to indicate common revision cases
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
64
diff
changeset
|
54 defaults(); |
64
19e9e220bf68
Convenient commands constitute hi-level API. org.tmatesoft namespace, GPL2 statement
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
diff
changeset
|
55 } |
19e9e220bf68
Convenient commands constitute hi-level API. org.tmatesoft namespace, GPL2 statement
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
diff
changeset
|
56 |
131
aa1629f36482
Renamed .core classes to start with Hg prefix
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
128
diff
changeset
|
57 public HgStatusCommand defaults() { |
93
d55d4eedfc57
Switch to Path instead of String in filenames returned by various status operations
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
74
diff
changeset
|
58 final Mediator m = mediator; |
d55d4eedfc57
Switch to Path instead of String in filenames returned by various status operations
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
74
diff
changeset
|
59 m.needModified = m.needAdded = m.needRemoved = m.needUnknown = m.needMissing = true; |
99
4d7bb95d553b
StatusCommand().add should list copies
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
94
diff
changeset
|
60 m.needCopies = m.needClean = m.needIgnored = false; |
64
19e9e220bf68
Convenient commands constitute hi-level API. org.tmatesoft namespace, GPL2 statement
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
diff
changeset
|
61 return this; |
19e9e220bf68
Convenient commands constitute hi-level API. org.tmatesoft namespace, GPL2 statement
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
diff
changeset
|
62 } |
131
aa1629f36482
Renamed .core classes to start with Hg prefix
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
128
diff
changeset
|
63 public HgStatusCommand all() { |
93
d55d4eedfc57
Switch to Path instead of String in filenames returned by various status operations
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
74
diff
changeset
|
64 final Mediator m = mediator; |
d55d4eedfc57
Switch to Path instead of String in filenames returned by various status operations
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
74
diff
changeset
|
65 m.needModified = m.needAdded = m.needRemoved = m.needUnknown = m.needMissing = true; |
99
4d7bb95d553b
StatusCommand().add should list copies
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
94
diff
changeset
|
66 m.needCopies = m.needClean = m.needIgnored = true; |
68
0e499fed9b3d
StatusCommand with tests. Extra constants to indicate common revision cases
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
64
diff
changeset
|
67 return this; |
0e499fed9b3d
StatusCommand with tests. Extra constants to indicate common revision cases
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
64
diff
changeset
|
68 } |
0e499fed9b3d
StatusCommand with tests. Extra constants to indicate common revision cases
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
64
diff
changeset
|
69 |
64
19e9e220bf68
Convenient commands constitute hi-level API. org.tmatesoft namespace, GPL2 statement
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
diff
changeset
|
70 |
131
aa1629f36482
Renamed .core classes to start with Hg prefix
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
128
diff
changeset
|
71 public HgStatusCommand modified(boolean include) { |
93
d55d4eedfc57
Switch to Path instead of String in filenames returned by various status operations
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
74
diff
changeset
|
72 mediator.needModified = include; |
68
0e499fed9b3d
StatusCommand with tests. Extra constants to indicate common revision cases
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
64
diff
changeset
|
73 return this; |
0e499fed9b3d
StatusCommand with tests. Extra constants to indicate common revision cases
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
64
diff
changeset
|
74 } |
131
aa1629f36482
Renamed .core classes to start with Hg prefix
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
128
diff
changeset
|
75 public HgStatusCommand added(boolean include) { |
93
d55d4eedfc57
Switch to Path instead of String in filenames returned by various status operations
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
74
diff
changeset
|
76 mediator.needAdded = include; |
68
0e499fed9b3d
StatusCommand with tests. Extra constants to indicate common revision cases
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
64
diff
changeset
|
77 return this; |
0e499fed9b3d
StatusCommand with tests. Extra constants to indicate common revision cases
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
64
diff
changeset
|
78 } |
131
aa1629f36482
Renamed .core classes to start with Hg prefix
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
128
diff
changeset
|
79 public HgStatusCommand removed(boolean include) { |
93
d55d4eedfc57
Switch to Path instead of String in filenames returned by various status operations
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
74
diff
changeset
|
80 mediator.needRemoved = include; |
68
0e499fed9b3d
StatusCommand with tests. Extra constants to indicate common revision cases
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
64
diff
changeset
|
81 return this; |
0e499fed9b3d
StatusCommand with tests. Extra constants to indicate common revision cases
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
64
diff
changeset
|
82 } |
131
aa1629f36482
Renamed .core classes to start with Hg prefix
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
128
diff
changeset
|
83 public HgStatusCommand deleted(boolean include) { |
93
d55d4eedfc57
Switch to Path instead of String in filenames returned by various status operations
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
74
diff
changeset
|
84 mediator.needMissing = include; |
68
0e499fed9b3d
StatusCommand with tests. Extra constants to indicate common revision cases
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
64
diff
changeset
|
85 return this; |
0e499fed9b3d
StatusCommand with tests. Extra constants to indicate common revision cases
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
64
diff
changeset
|
86 } |
131
aa1629f36482
Renamed .core classes to start with Hg prefix
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
128
diff
changeset
|
87 public HgStatusCommand unknown(boolean include) { |
93
d55d4eedfc57
Switch to Path instead of String in filenames returned by various status operations
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
74
diff
changeset
|
88 mediator.needUnknown = include; |
68
0e499fed9b3d
StatusCommand with tests. Extra constants to indicate common revision cases
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
64
diff
changeset
|
89 return this; |
0e499fed9b3d
StatusCommand with tests. Extra constants to indicate common revision cases
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
64
diff
changeset
|
90 } |
131
aa1629f36482
Renamed .core classes to start with Hg prefix
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
128
diff
changeset
|
91 public HgStatusCommand clean(boolean include) { |
93
d55d4eedfc57
Switch to Path instead of String in filenames returned by various status operations
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
74
diff
changeset
|
92 mediator.needClean = include; |
64
19e9e220bf68
Convenient commands constitute hi-level API. org.tmatesoft namespace, GPL2 statement
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
diff
changeset
|
93 return this; |
19e9e220bf68
Convenient commands constitute hi-level API. org.tmatesoft namespace, GPL2 statement
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
diff
changeset
|
94 } |
131
aa1629f36482
Renamed .core classes to start with Hg prefix
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
128
diff
changeset
|
95 public HgStatusCommand ignored(boolean include) { |
93
d55d4eedfc57
Switch to Path instead of String in filenames returned by various status operations
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
74
diff
changeset
|
96 mediator.needIgnored = include; |
64
19e9e220bf68
Convenient commands constitute hi-level API. org.tmatesoft namespace, GPL2 statement
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
diff
changeset
|
97 return this; |
19e9e220bf68
Convenient commands constitute hi-level API. org.tmatesoft namespace, GPL2 statement
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
diff
changeset
|
98 } |
19e9e220bf68
Convenient commands constitute hi-level API. org.tmatesoft namespace, GPL2 statement
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
diff
changeset
|
99 |
68
0e499fed9b3d
StatusCommand with tests. Extra constants to indicate common revision cases
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
64
diff
changeset
|
100 /** |
148
1a7a9a20e1f9
Exceptions, javadoc. Initial cancel and progress support
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
143
diff
changeset
|
101 * If set, either base:revision or base:workingdir |
68
0e499fed9b3d
StatusCommand with tests. Extra constants to indicate common revision cases
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
64
diff
changeset
|
102 * to unset, pass {@link HgRepository#TIP} or {@link HgRepository#BAD_REVISION} |
367
2fadf8695f8a
Use 'revision index' instead of the vague 'local revision number' concept in the API
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
360
diff
changeset
|
103 * @param changesetRevisionIndex - local index of a changeset to base status from |
148
1a7a9a20e1f9
Exceptions, javadoc. Initial cancel and progress support
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
143
diff
changeset
|
104 * @return <code>this</code> for convenience |
1a7a9a20e1f9
Exceptions, javadoc. Initial cancel and progress support
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
143
diff
changeset
|
105 * @throws IllegalArgumentException when revision is negative or {@link HgRepository#WORKING_COPY} |
68
0e499fed9b3d
StatusCommand with tests. Extra constants to indicate common revision cases
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
64
diff
changeset
|
106 */ |
367
2fadf8695f8a
Use 'revision index' instead of the vague 'local revision number' concept in the API
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
360
diff
changeset
|
107 public HgStatusCommand base(int changesetRevisionIndex) { |
2fadf8695f8a
Use 'revision index' instead of the vague 'local revision number' concept in the API
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
360
diff
changeset
|
108 if (changesetRevisionIndex == WORKING_COPY || wrongRevisionIndex(changesetRevisionIndex)) { |
2fadf8695f8a
Use 'revision index' instead of the vague 'local revision number' concept in the API
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
360
diff
changeset
|
109 throw new IllegalArgumentException(String.valueOf(changesetRevisionIndex)); |
68
0e499fed9b3d
StatusCommand with tests. Extra constants to indicate common revision cases
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
64
diff
changeset
|
110 } |
367
2fadf8695f8a
Use 'revision index' instead of the vague 'local revision number' concept in the API
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
360
diff
changeset
|
111 if (changesetRevisionIndex == BAD_REVISION) { |
2fadf8695f8a
Use 'revision index' instead of the vague 'local revision number' concept in the API
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
360
diff
changeset
|
112 changesetRevisionIndex = TIP; |
68
0e499fed9b3d
StatusCommand with tests. Extra constants to indicate common revision cases
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
64
diff
changeset
|
113 } |
367
2fadf8695f8a
Use 'revision index' instead of the vague 'local revision number' concept in the API
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
360
diff
changeset
|
114 startRevision = changesetRevisionIndex; |
64
19e9e220bf68
Convenient commands constitute hi-level API. org.tmatesoft namespace, GPL2 statement
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
diff
changeset
|
115 return this; |
19e9e220bf68
Convenient commands constitute hi-level API. org.tmatesoft namespace, GPL2 statement
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
diff
changeset
|
116 } |
19e9e220bf68
Convenient commands constitute hi-level API. org.tmatesoft namespace, GPL2 statement
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
diff
changeset
|
117 |
68
0e499fed9b3d
StatusCommand with tests. Extra constants to indicate common revision cases
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
64
diff
changeset
|
118 /** |
0e499fed9b3d
StatusCommand with tests. Extra constants to indicate common revision cases
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
64
diff
changeset
|
119 * Revision without base == --change |
0e499fed9b3d
StatusCommand with tests. Extra constants to indicate common revision cases
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
64
diff
changeset
|
120 * Pass {@link HgRepository#WORKING_COPY} or {@link HgRepository#BAD_REVISION} to reset |
368
8107b95f4280
Update Javadoc with 'revision index'
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
367
diff
changeset
|
121 * @param changesetRevisionIndex - non-negative changeset revision local index, or any of {@link HgRepository#BAD_REVISION}, {@link HgRepository#WORKING_COPY} or {@link HgRepository#TIP} |
148
1a7a9a20e1f9
Exceptions, javadoc. Initial cancel and progress support
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
143
diff
changeset
|
122 * @return <code>this</code> for convenience |
368
8107b95f4280
Update Javadoc with 'revision index'
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
367
diff
changeset
|
123 * @throws IllegalArgumentException if revision index doesn't specify legitimate revision. |
68
0e499fed9b3d
StatusCommand with tests. Extra constants to indicate common revision cases
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
64
diff
changeset
|
124 */ |
367
2fadf8695f8a
Use 'revision index' instead of the vague 'local revision number' concept in the API
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
360
diff
changeset
|
125 public HgStatusCommand revision(int changesetRevisionIndex) { |
2fadf8695f8a
Use 'revision index' instead of the vague 'local revision number' concept in the API
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
360
diff
changeset
|
126 if (changesetRevisionIndex == BAD_REVISION) { |
2fadf8695f8a
Use 'revision index' instead of the vague 'local revision number' concept in the API
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
360
diff
changeset
|
127 changesetRevisionIndex = WORKING_COPY; |
68
0e499fed9b3d
StatusCommand with tests. Extra constants to indicate common revision cases
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
64
diff
changeset
|
128 } |
367
2fadf8695f8a
Use 'revision index' instead of the vague 'local revision number' concept in the API
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
360
diff
changeset
|
129 if (wrongRevisionIndex(changesetRevisionIndex)) { |
2fadf8695f8a
Use 'revision index' instead of the vague 'local revision number' concept in the API
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
360
diff
changeset
|
130 throw new IllegalArgumentException(String.valueOf(changesetRevisionIndex)); |
143
b9700740553a
Command line tools parse and respect most of command-line arguments
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
133
diff
changeset
|
131 } |
367
2fadf8695f8a
Use 'revision index' instead of the vague 'local revision number' concept in the API
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
360
diff
changeset
|
132 endRevision = changesetRevisionIndex; |
64
19e9e220bf68
Convenient commands constitute hi-level API. org.tmatesoft namespace, GPL2 statement
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
diff
changeset
|
133 return this; |
19e9e220bf68
Convenient commands constitute hi-level API. org.tmatesoft namespace, GPL2 statement
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
diff
changeset
|
134 } |
19e9e220bf68
Convenient commands constitute hi-level API. org.tmatesoft namespace, GPL2 statement
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
diff
changeset
|
135 |
143
b9700740553a
Command line tools parse and respect most of command-line arguments
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
133
diff
changeset
|
136 /** |
b9700740553a
Command line tools parse and respect most of command-line arguments
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
133
diff
changeset
|
137 * Shorthand for {@link #base(int) cmd.base(BAD_REVISION)}{@link #change(int) .revision(revision)} |
b9700740553a
Command line tools parse and respect most of command-line arguments
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
133
diff
changeset
|
138 * |
457
d78cb5ca3053
Get rid of ambiguity in method name
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
454
diff
changeset
|
139 * @param changesetRevisionIndex compare given revision against its parent |
148
1a7a9a20e1f9
Exceptions, javadoc. Initial cancel and progress support
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
143
diff
changeset
|
140 * @return <code>this</code> for convenience |
143
b9700740553a
Command line tools parse and respect most of command-line arguments
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
133
diff
changeset
|
141 */ |
457
d78cb5ca3053
Get rid of ambiguity in method name
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
454
diff
changeset
|
142 public HgStatusCommand change(int changesetRevisionIndex) { |
143
b9700740553a
Command line tools parse and respect most of command-line arguments
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
133
diff
changeset
|
143 base(BAD_REVISION); |
457
d78cb5ca3053
Get rid of ambiguity in method name
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
454
diff
changeset
|
144 return revision(changesetRevisionIndex); |
143
b9700740553a
Command line tools parse and respect most of command-line arguments
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
133
diff
changeset
|
145 } |
b9700740553a
Command line tools parse and respect most of command-line arguments
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
133
diff
changeset
|
146 |
148
1a7a9a20e1f9
Exceptions, javadoc. Initial cancel and progress support
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
143
diff
changeset
|
147 /** |
1a7a9a20e1f9
Exceptions, javadoc. Initial cancel and progress support
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
143
diff
changeset
|
148 * Limit status operation to certain sub-tree. |
1a7a9a20e1f9
Exceptions, javadoc. Initial cancel and progress support
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
143
diff
changeset
|
149 * |
419
7f136a3fa671
Clean javadoc to fix obvious warnings
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
418
diff
changeset
|
150 * @param scopeMatcher - matcher to use, pass <code>null/<code> to reset |
148
1a7a9a20e1f9
Exceptions, javadoc. Initial cancel and progress support
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
143
diff
changeset
|
151 * @return <code>this</code> for convenience |
1a7a9a20e1f9
Exceptions, javadoc. Initial cancel and progress support
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
143
diff
changeset
|
152 */ |
229
1ec6b327a6ac
Scope for status reworked: explicit files or a general matcher
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
215
diff
changeset
|
153 public HgStatusCommand match(Path.Matcher scopeMatcher) { |
1ec6b327a6ac
Scope for status reworked: explicit files or a general matcher
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
215
diff
changeset
|
154 scope = scopeMatcher; |
123
4f509f5bc8cb
reflect status change in the todo content
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
109
diff
changeset
|
155 return this; |
64
19e9e220bf68
Convenient commands constitute hi-level API. org.tmatesoft namespace, GPL2 statement
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
diff
changeset
|
156 } |
19e9e220bf68
Convenient commands constitute hi-level API. org.tmatesoft namespace, GPL2 statement
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
diff
changeset
|
157 |
131
aa1629f36482
Renamed .core classes to start with Hg prefix
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
128
diff
changeset
|
158 public HgStatusCommand subrepo(boolean visit) { |
64
19e9e220bf68
Convenient commands constitute hi-level API. org.tmatesoft namespace, GPL2 statement
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
diff
changeset
|
159 throw HgRepository.notImplemented(); |
19e9e220bf68
Convenient commands constitute hi-level API. org.tmatesoft namespace, GPL2 statement
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
diff
changeset
|
160 } |
93
d55d4eedfc57
Switch to Path instead of String in filenames returned by various status operations
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
74
diff
changeset
|
161 |
d55d4eedfc57
Switch to Path instead of String in filenames returned by various status operations
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
74
diff
changeset
|
162 /** |
d55d4eedfc57
Switch to Path instead of String in filenames returned by various status operations
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
74
diff
changeset
|
163 * Perform status operation according to parameters set. |
d55d4eedfc57
Switch to Path instead of String in filenames returned by various status operations
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
74
diff
changeset
|
164 * |
419
7f136a3fa671
Clean javadoc to fix obvious warnings
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
418
diff
changeset
|
165 * @param statusHandler callback to get status information |
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:
424
diff
changeset
|
166 * @throws HgCallbackTargetException propagated exception from the handler |
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:
424
diff
changeset
|
167 * @throws HgException subclass thereof to indicate specific issue with the command arguments or repository state |
429
cd658b24a620
FIXMEs: javadoc, proper use of constants
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
427
diff
changeset
|
168 * @throws IOException if there are (further unspecified) errors while walking working copy |
423
9c9c442b5f2e
Major refactoring of exception handling. Low-level API uses RuntimeExceptions, while checked are left for higher level
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
419
diff
changeset
|
169 * @throws CancelledException if execution of the command was cancelled |
93
d55d4eedfc57
Switch to Path instead of String in filenames returned by various status operations
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
74
diff
changeset
|
170 * @throws IllegalArgumentException if handler is <code>null</code> |
d55d4eedfc57
Switch to Path instead of String in filenames returned by various status operations
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
74
diff
changeset
|
171 * @throws ConcurrentModificationException if this command already runs (i.e. being used from another thread) |
d55d4eedfc57
Switch to Path instead of String in filenames returned by various status operations
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
74
diff
changeset
|
172 */ |
429
cd658b24a620
FIXMEs: javadoc, proper use of constants
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
427
diff
changeset
|
173 public void execute(HgStatusHandler statusHandler) throws HgCallbackTargetException, HgException, IOException, CancelledException { |
109
dd4d2d0e42cd
Handler for StatusCommand to get notifications in the form of HgStatus object
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
102
diff
changeset
|
174 if (statusHandler == null) { |
93
d55d4eedfc57
Switch to Path instead of String in filenames returned by various status operations
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
74
diff
changeset
|
175 throw new IllegalArgumentException(); |
d55d4eedfc57
Switch to Path instead of String in filenames returned by various status operations
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
74
diff
changeset
|
176 } |
128
44b97930570c
Introduced ChangelogHelper to look up changesets files were modified in
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
127
diff
changeset
|
177 if (mediator.busy()) { |
93
d55d4eedfc57
Switch to Path instead of String in filenames returned by various status operations
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
74
diff
changeset
|
178 throw new ConcurrentModificationException(); |
d55d4eedfc57
Switch to Path instead of String in filenames returned by various status operations
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
74
diff
changeset
|
179 } |
94
af1f3b78b918
*StatusCollector renamed to Hg*StatusCollector
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
93
diff
changeset
|
180 HgStatusCollector sc = new HgStatusCollector(repo); // TODO from CommandContext |
93
d55d4eedfc57
Switch to Path instead of String in filenames returned by various status operations
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
74
diff
changeset
|
181 // PathPool pathHelper = new PathPool(repo.getPathHelper()); // TODO from CommandContext |
d55d4eedfc57
Switch to Path instead of String in filenames returned by various status operations
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
74
diff
changeset
|
182 try { |
d55d4eedfc57
Switch to Path instead of String in filenames returned by various status operations
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
74
diff
changeset
|
183 // XXX if I need a rough estimation (for ProgressMonitor) of number of work units, |
d55d4eedfc57
Switch to Path instead of String in filenames returned by various status operations
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
74
diff
changeset
|
184 // I may use number of files in either rev1 or rev2 manifest edition |
423
9c9c442b5f2e
Major refactoring of exception handling. Low-level API uses RuntimeExceptions, while checked are left for higher level
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
419
diff
changeset
|
185 mediator.start(statusHandler, getCancelSupport(statusHandler, true), new ChangelogHelper(repo, startRevision)); |
93
d55d4eedfc57
Switch to Path instead of String in filenames returned by various status operations
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
74
diff
changeset
|
186 if (endRevision == WORKING_COPY) { |
229
1ec6b327a6ac
Scope for status reworked: explicit files or a general matcher
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
215
diff
changeset
|
187 HgWorkingCopyStatusCollector wcsc = scope != null ? HgWorkingCopyStatusCollector.create(repo, scope) : new HgWorkingCopyStatusCollector(repo); |
93
d55d4eedfc57
Switch to Path instead of String in filenames returned by various status operations
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
74
diff
changeset
|
188 wcsc.setBaseRevisionCollector(sc); |
d55d4eedfc57
Switch to Path instead of String in filenames returned by various status operations
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
74
diff
changeset
|
189 wcsc.walk(startRevision, mediator); |
68
0e499fed9b3d
StatusCommand with tests. Extra constants to indicate common revision cases
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
64
diff
changeset
|
190 } else { |
229
1ec6b327a6ac
Scope for status reworked: explicit files or a general matcher
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
215
diff
changeset
|
191 sc.setScope(scope); // explicitly set, even if null - would be handy once we reuse StatusCollector |
93
d55d4eedfc57
Switch to Path instead of String in filenames returned by various status operations
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
74
diff
changeset
|
192 if (startRevision == TIP) { |
d55d4eedfc57
Switch to Path instead of String in filenames returned by various status operations
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
74
diff
changeset
|
193 sc.change(endRevision, mediator); |
d55d4eedfc57
Switch to Path instead of String in filenames returned by various status operations
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
74
diff
changeset
|
194 } else { |
d55d4eedfc57
Switch to Path instead of String in filenames returned by various status operations
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
74
diff
changeset
|
195 sc.walk(startRevision, endRevision, mediator); |
d55d4eedfc57
Switch to Path instead of String in filenames returned by various status operations
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
74
diff
changeset
|
196 } |
d55d4eedfc57
Switch to Path instead of String in filenames returned by various status operations
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
74
diff
changeset
|
197 } |
423
9c9c442b5f2e
Major refactoring of exception handling. Low-level API uses RuntimeExceptions, while checked are left for higher level
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
419
diff
changeset
|
198 } catch (CancelledException ex) { |
9c9c442b5f2e
Major refactoring of exception handling. Low-level API uses RuntimeExceptions, while checked are left for higher level
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
419
diff
changeset
|
199 // this is our exception, thrown from Mediator. |
9c9c442b5f2e
Major refactoring of exception handling. Low-level API uses RuntimeExceptions, while checked are left for higher level
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
419
diff
changeset
|
200 // next check shall throw original cause of the stop - either HgCallbackTargetException or original CancelledException |
9c9c442b5f2e
Major refactoring of exception handling. Low-level API uses RuntimeExceptions, while checked are left for higher level
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
419
diff
changeset
|
201 mediator.checkFailure(); |
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:
424
diff
changeset
|
202 } catch (HgRuntimeException ex) { |
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:
424
diff
changeset
|
203 throw new HgLibraryFailureException(ex); |
93
d55d4eedfc57
Switch to Path instead of String in filenames returned by various status operations
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
74
diff
changeset
|
204 } finally { |
d55d4eedfc57
Switch to Path instead of String in filenames returned by various status operations
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
74
diff
changeset
|
205 mediator.done(); |
d55d4eedfc57
Switch to Path instead of String in filenames returned by various status operations
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
74
diff
changeset
|
206 } |
d55d4eedfc57
Switch to Path instead of String in filenames returned by various status operations
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
74
diff
changeset
|
207 } |
d55d4eedfc57
Switch to Path instead of String in filenames returned by various status operations
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
74
diff
changeset
|
208 |
423
9c9c442b5f2e
Major refactoring of exception handling. Low-level API uses RuntimeExceptions, while checked are left for higher level
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
419
diff
changeset
|
209 private class Mediator implements HgStatusInspector, CancelSupport { |
93
d55d4eedfc57
Switch to Path instead of String in filenames returned by various status operations
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
74
diff
changeset
|
210 boolean needModified; |
d55d4eedfc57
Switch to Path instead of String in filenames returned by various status operations
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
74
diff
changeset
|
211 boolean needAdded; |
d55d4eedfc57
Switch to Path instead of String in filenames returned by various status operations
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
74
diff
changeset
|
212 boolean needRemoved; |
d55d4eedfc57
Switch to Path instead of String in filenames returned by various status operations
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
74
diff
changeset
|
213 boolean needUnknown; |
d55d4eedfc57
Switch to Path instead of String in filenames returned by various status operations
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
74
diff
changeset
|
214 boolean needMissing; |
d55d4eedfc57
Switch to Path instead of String in filenames returned by various status operations
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
74
diff
changeset
|
215 boolean needClean; |
d55d4eedfc57
Switch to Path instead of String in filenames returned by various status operations
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
74
diff
changeset
|
216 boolean needIgnored; |
99
4d7bb95d553b
StatusCommand().add should list copies
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
94
diff
changeset
|
217 boolean needCopies; |
360
150500515714
Report non-critical errors during status operation to handler/inspector
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
350
diff
changeset
|
218 HgStatusHandler handler; |
128
44b97930570c
Introduced ChangelogHelper to look up changesets files were modified in
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
127
diff
changeset
|
219 private ChangelogHelper logHelper; |
423
9c9c442b5f2e
Major refactoring of exception handling. Low-level API uses RuntimeExceptions, while checked are left for higher level
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
419
diff
changeset
|
220 private CancelSupport handlerCancelSupport; |
9c9c442b5f2e
Major refactoring of exception handling. Low-level API uses RuntimeExceptions, while checked are left for higher level
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
419
diff
changeset
|
221 private HgCallbackTargetException failure; |
9c9c442b5f2e
Major refactoring of exception handling. Low-level API uses RuntimeExceptions, while checked are left for higher level
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
419
diff
changeset
|
222 private CancelledException cancellation; |
93
d55d4eedfc57
Switch to Path instead of String in filenames returned by various status operations
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
74
diff
changeset
|
223 |
d55d4eedfc57
Switch to Path instead of String in filenames returned by various status operations
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
74
diff
changeset
|
224 Mediator() { |
d55d4eedfc57
Switch to Path instead of String in filenames returned by various status operations
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
74
diff
changeset
|
225 } |
d55d4eedfc57
Switch to Path instead of String in filenames returned by various status operations
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
74
diff
changeset
|
226 |
423
9c9c442b5f2e
Major refactoring of exception handling. Low-level API uses RuntimeExceptions, while checked are left for higher level
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
419
diff
changeset
|
227 public void start(HgStatusHandler h, CancelSupport hcs, ChangelogHelper changelogHelper) { |
128
44b97930570c
Introduced ChangelogHelper to look up changesets files were modified in
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
127
diff
changeset
|
228 handler = h; |
423
9c9c442b5f2e
Major refactoring of exception handling. Low-level API uses RuntimeExceptions, while checked are left for higher level
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
419
diff
changeset
|
229 handlerCancelSupport = hcs; |
128
44b97930570c
Introduced ChangelogHelper to look up changesets files were modified in
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
127
diff
changeset
|
230 logHelper = changelogHelper; |
93
d55d4eedfc57
Switch to Path instead of String in filenames returned by various status operations
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
74
diff
changeset
|
231 } |
128
44b97930570c
Introduced ChangelogHelper to look up changesets files were modified in
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
127
diff
changeset
|
232 |
93
d55d4eedfc57
Switch to Path instead of String in filenames returned by various status operations
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
74
diff
changeset
|
233 public void done() { |
128
44b97930570c
Introduced ChangelogHelper to look up changesets files were modified in
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
127
diff
changeset
|
234 handler = null; |
423
9c9c442b5f2e
Major refactoring of exception handling. Low-level API uses RuntimeExceptions, while checked are left for higher level
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
419
diff
changeset
|
235 handlerCancelSupport = null; |
128
44b97930570c
Introduced ChangelogHelper to look up changesets files were modified in
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
127
diff
changeset
|
236 logHelper = null; |
423
9c9c442b5f2e
Major refactoring of exception handling. Low-level API uses RuntimeExceptions, while checked are left for higher level
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
419
diff
changeset
|
237 failure = null; |
9c9c442b5f2e
Major refactoring of exception handling. Low-level API uses RuntimeExceptions, while checked are left for higher level
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
419
diff
changeset
|
238 cancellation = null; |
128
44b97930570c
Introduced ChangelogHelper to look up changesets files were modified in
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
127
diff
changeset
|
239 } |
44b97930570c
Introduced ChangelogHelper to look up changesets files were modified in
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
127
diff
changeset
|
240 |
44b97930570c
Introduced ChangelogHelper to look up changesets files were modified in
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
127
diff
changeset
|
241 public boolean busy() { |
44b97930570c
Introduced ChangelogHelper to look up changesets files were modified in
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
127
diff
changeset
|
242 return handler != null; |
93
d55d4eedfc57
Switch to Path instead of String in filenames returned by various status operations
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
74
diff
changeset
|
243 } |
d55d4eedfc57
Switch to Path instead of String in filenames returned by various status operations
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
74
diff
changeset
|
244 |
423
9c9c442b5f2e
Major refactoring of exception handling. Low-level API uses RuntimeExceptions, while checked are left for higher level
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
419
diff
changeset
|
245 // XXX copy from ChangesetTransformer. Perhaps, can share the code? |
9c9c442b5f2e
Major refactoring of exception handling. Low-level API uses RuntimeExceptions, while checked are left for higher level
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
419
diff
changeset
|
246 public void checkFailure() throws HgCallbackTargetException, CancelledException { |
9c9c442b5f2e
Major refactoring of exception handling. Low-level API uses RuntimeExceptions, while checked are left for higher level
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
419
diff
changeset
|
247 // do not forget to clear exceptions for reuse of this instance |
9c9c442b5f2e
Major refactoring of exception handling. Low-level API uses RuntimeExceptions, while checked are left for higher level
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
419
diff
changeset
|
248 if (failure != null) { |
9c9c442b5f2e
Major refactoring of exception handling. Low-level API uses RuntimeExceptions, while checked are left for higher level
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
419
diff
changeset
|
249 HgCallbackTargetException toThrow = failure; |
9c9c442b5f2e
Major refactoring of exception handling. Low-level API uses RuntimeExceptions, while checked are left for higher level
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
419
diff
changeset
|
250 failure = null; |
9c9c442b5f2e
Major refactoring of exception handling. Low-level API uses RuntimeExceptions, while checked are left for higher level
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
419
diff
changeset
|
251 throw toThrow; |
9c9c442b5f2e
Major refactoring of exception handling. Low-level API uses RuntimeExceptions, while checked are left for higher level
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
419
diff
changeset
|
252 } |
9c9c442b5f2e
Major refactoring of exception handling. Low-level API uses RuntimeExceptions, while checked are left for higher level
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
419
diff
changeset
|
253 if (cancellation != null) { |
9c9c442b5f2e
Major refactoring of exception handling. Low-level API uses RuntimeExceptions, while checked are left for higher level
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
419
diff
changeset
|
254 CancelledException toThrow = cancellation; |
9c9c442b5f2e
Major refactoring of exception handling. Low-level API uses RuntimeExceptions, while checked are left for higher level
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
419
diff
changeset
|
255 cancellation = null; |
9c9c442b5f2e
Major refactoring of exception handling. Low-level API uses RuntimeExceptions, while checked are left for higher level
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
419
diff
changeset
|
256 throw toThrow; |
9c9c442b5f2e
Major refactoring of exception handling. Low-level API uses RuntimeExceptions, while checked are left for higher level
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
419
diff
changeset
|
257 } |
9c9c442b5f2e
Major refactoring of exception handling. Low-level API uses RuntimeExceptions, while checked are left for higher level
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
419
diff
changeset
|
258 } |
9c9c442b5f2e
Major refactoring of exception handling. Low-level API uses RuntimeExceptions, while checked are left for higher level
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
419
diff
changeset
|
259 |
9c9c442b5f2e
Major refactoring of exception handling. Low-level API uses RuntimeExceptions, while checked are left for higher level
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
419
diff
changeset
|
260 // XXX copy from ChangesetTransformer. code sharing note above applies |
9c9c442b5f2e
Major refactoring of exception handling. Low-level API uses RuntimeExceptions, while checked are left for higher level
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
419
diff
changeset
|
261 public void checkCancelled() throws CancelledException { |
9c9c442b5f2e
Major refactoring of exception handling. Low-level API uses RuntimeExceptions, while checked are left for higher level
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
419
diff
changeset
|
262 if (failure != null || cancellation != null) { |
9c9c442b5f2e
Major refactoring of exception handling. Low-level API uses RuntimeExceptions, while checked are left for higher level
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
419
diff
changeset
|
263 // stop status iteration. Our exception is for the purposes of cancellation only, |
9c9c442b5f2e
Major refactoring of exception handling. Low-level API uses RuntimeExceptions, while checked are left for higher level
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
419
diff
changeset
|
264 // the one we have stored (this.cancellation) is for user |
9c9c442b5f2e
Major refactoring of exception handling. Low-level API uses RuntimeExceptions, while checked are left for higher level
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
419
diff
changeset
|
265 throw new CancelledException(); |
9c9c442b5f2e
Major refactoring of exception handling. Low-level API uses RuntimeExceptions, while checked are left for higher level
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
419
diff
changeset
|
266 } |
9c9c442b5f2e
Major refactoring of exception handling. Low-level API uses RuntimeExceptions, while checked are left for higher level
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
419
diff
changeset
|
267 } |
9c9c442b5f2e
Major refactoring of exception handling. Low-level API uses RuntimeExceptions, while checked are left for higher level
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
419
diff
changeset
|
268 |
9c9c442b5f2e
Major refactoring of exception handling. Low-level API uses RuntimeExceptions, while checked are left for higher level
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
419
diff
changeset
|
269 private void dispatch(HgStatus s) { |
9c9c442b5f2e
Major refactoring of exception handling. Low-level API uses RuntimeExceptions, while checked are left for higher level
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
419
diff
changeset
|
270 try { |
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:
424
diff
changeset
|
271 handler.status(s); |
423
9c9c442b5f2e
Major refactoring of exception handling. Low-level API uses RuntimeExceptions, while checked are left for higher level
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
419
diff
changeset
|
272 handlerCancelSupport.checkCancelled(); |
9c9c442b5f2e
Major refactoring of exception handling. Low-level API uses RuntimeExceptions, while checked are left for higher level
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
419
diff
changeset
|
273 } catch (HgCallbackTargetException ex) { |
9c9c442b5f2e
Major refactoring of exception handling. Low-level API uses RuntimeExceptions, while checked are left for higher level
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
419
diff
changeset
|
274 failure = ex; |
9c9c442b5f2e
Major refactoring of exception handling. Low-level API uses RuntimeExceptions, while checked are left for higher level
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
419
diff
changeset
|
275 } catch (CancelledException ex) { |
9c9c442b5f2e
Major refactoring of exception handling. Low-level API uses RuntimeExceptions, while checked are left for higher level
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
419
diff
changeset
|
276 cancellation = ex; |
9c9c442b5f2e
Major refactoring of exception handling. Low-level API uses RuntimeExceptions, while checked are left for higher level
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
419
diff
changeset
|
277 } |
9c9c442b5f2e
Major refactoring of exception handling. Low-level API uses RuntimeExceptions, while checked are left for higher level
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
419
diff
changeset
|
278 } |
9c9c442b5f2e
Major refactoring of exception handling. Low-level API uses RuntimeExceptions, while checked are left for higher level
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
419
diff
changeset
|
279 |
93
d55d4eedfc57
Switch to Path instead of String in filenames returned by various status operations
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
74
diff
changeset
|
280 public void modified(Path fname) { |
d55d4eedfc57
Switch to Path instead of String in filenames returned by various status operations
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
74
diff
changeset
|
281 if (needModified) { |
423
9c9c442b5f2e
Major refactoring of exception handling. Low-level API uses RuntimeExceptions, while checked are left for higher level
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
419
diff
changeset
|
282 dispatch(new HgStatus(Modified, fname, logHelper)); |
68
0e499fed9b3d
StatusCommand with tests. Extra constants to indicate common revision cases
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
64
diff
changeset
|
283 } |
0e499fed9b3d
StatusCommand with tests. Extra constants to indicate common revision cases
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
64
diff
changeset
|
284 } |
93
d55d4eedfc57
Switch to Path instead of String in filenames returned by various status operations
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
74
diff
changeset
|
285 public void added(Path fname) { |
d55d4eedfc57
Switch to Path instead of String in filenames returned by various status operations
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
74
diff
changeset
|
286 if (needAdded) { |
423
9c9c442b5f2e
Major refactoring of exception handling. Low-level API uses RuntimeExceptions, while checked are left for higher level
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
419
diff
changeset
|
287 dispatch(new HgStatus(Added, fname, logHelper)); |
93
d55d4eedfc57
Switch to Path instead of String in filenames returned by various status operations
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
74
diff
changeset
|
288 } |
d55d4eedfc57
Switch to Path instead of String in filenames returned by various status operations
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
74
diff
changeset
|
289 } |
d55d4eedfc57
Switch to Path instead of String in filenames returned by various status operations
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
74
diff
changeset
|
290 public void removed(Path fname) { |
d55d4eedfc57
Switch to Path instead of String in filenames returned by various status operations
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
74
diff
changeset
|
291 if (needRemoved) { |
423
9c9c442b5f2e
Major refactoring of exception handling. Low-level API uses RuntimeExceptions, while checked are left for higher level
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
419
diff
changeset
|
292 dispatch(new HgStatus(Removed, fname, logHelper)); |
93
d55d4eedfc57
Switch to Path instead of String in filenames returned by various status operations
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
74
diff
changeset
|
293 } |
d55d4eedfc57
Switch to Path instead of String in filenames returned by various status operations
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
74
diff
changeset
|
294 } |
d55d4eedfc57
Switch to Path instead of String in filenames returned by various status operations
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
74
diff
changeset
|
295 public void copied(Path fnameOrigin, Path fnameAdded) { |
d55d4eedfc57
Switch to Path instead of String in filenames returned by various status operations
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
74
diff
changeset
|
296 if (needCopies) { |
418
528b6780a8bd
A bit of FIXME cleanup (mostly degraded to TODO post 1.0), comments and javadoc
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
368
diff
changeset
|
297 // TODO post-1.0 in fact, merged files may report 'copied from' as well, correct status kind thus may differ from Added |
423
9c9c442b5f2e
Major refactoring of exception handling. Low-level API uses RuntimeExceptions, while checked are left for higher level
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
419
diff
changeset
|
298 dispatch(new HgStatus(Added, fnameAdded, fnameOrigin, logHelper)); |
93
d55d4eedfc57
Switch to Path instead of String in filenames returned by various status operations
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
74
diff
changeset
|
299 } |
d55d4eedfc57
Switch to Path instead of String in filenames returned by various status operations
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
74
diff
changeset
|
300 } |
d55d4eedfc57
Switch to Path instead of String in filenames returned by various status operations
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
74
diff
changeset
|
301 public void missing(Path fname) { |
d55d4eedfc57
Switch to Path instead of String in filenames returned by various status operations
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
74
diff
changeset
|
302 if (needMissing) { |
423
9c9c442b5f2e
Major refactoring of exception handling. Low-level API uses RuntimeExceptions, while checked are left for higher level
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
419
diff
changeset
|
303 dispatch(new HgStatus(Missing, fname, logHelper)); |
93
d55d4eedfc57
Switch to Path instead of String in filenames returned by various status operations
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
74
diff
changeset
|
304 } |
d55d4eedfc57
Switch to Path instead of String in filenames returned by various status operations
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
74
diff
changeset
|
305 } |
d55d4eedfc57
Switch to Path instead of String in filenames returned by various status operations
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
74
diff
changeset
|
306 public void unknown(Path fname) { |
d55d4eedfc57
Switch to Path instead of String in filenames returned by various status operations
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
74
diff
changeset
|
307 if (needUnknown) { |
423
9c9c442b5f2e
Major refactoring of exception handling. Low-level API uses RuntimeExceptions, while checked are left for higher level
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
419
diff
changeset
|
308 dispatch(new HgStatus(Unknown, fname, logHelper)); |
93
d55d4eedfc57
Switch to Path instead of String in filenames returned by various status operations
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
74
diff
changeset
|
309 } |
d55d4eedfc57
Switch to Path instead of String in filenames returned by various status operations
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
74
diff
changeset
|
310 } |
d55d4eedfc57
Switch to Path instead of String in filenames returned by various status operations
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
74
diff
changeset
|
311 public void clean(Path fname) { |
d55d4eedfc57
Switch to Path instead of String in filenames returned by various status operations
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
74
diff
changeset
|
312 if (needClean) { |
423
9c9c442b5f2e
Major refactoring of exception handling. Low-level API uses RuntimeExceptions, while checked are left for higher level
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
419
diff
changeset
|
313 dispatch(new HgStatus(Clean, fname, logHelper)); |
93
d55d4eedfc57
Switch to Path instead of String in filenames returned by various status operations
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
74
diff
changeset
|
314 } |
d55d4eedfc57
Switch to Path instead of String in filenames returned by various status operations
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
74
diff
changeset
|
315 } |
d55d4eedfc57
Switch to Path instead of String in filenames returned by various status operations
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
74
diff
changeset
|
316 public void ignored(Path fname) { |
d55d4eedfc57
Switch to Path instead of String in filenames returned by various status operations
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
74
diff
changeset
|
317 if (needIgnored) { |
423
9c9c442b5f2e
Major refactoring of exception handling. Low-level API uses RuntimeExceptions, while checked are left for higher level
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
419
diff
changeset
|
318 dispatch(new HgStatus(Ignored, fname, logHelper)); |
93
d55d4eedfc57
Switch to Path instead of String in filenames returned by various status operations
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
74
diff
changeset
|
319 } |
d55d4eedfc57
Switch to Path instead of String in filenames returned by various status operations
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
74
diff
changeset
|
320 } |
360
150500515714
Report non-critical errors during status operation to handler/inspector
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
350
diff
changeset
|
321 |
423
9c9c442b5f2e
Major refactoring of exception handling. Low-level API uses RuntimeExceptions, while checked are left for higher level
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
419
diff
changeset
|
322 public void invalid(Path fname, Exception err) { |
9c9c442b5f2e
Major refactoring of exception handling. Low-level API uses RuntimeExceptions, while checked are left for higher level
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
419
diff
changeset
|
323 try { |
454
36fd1fd06492
oth.util.Status renamed to Outcome as the noun is too overloaded, especially in scm
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
429
diff
changeset
|
324 handler.error(fname, new Outcome(Outcome.Kind.Failure, "Failed to get file status", err)); |
423
9c9c442b5f2e
Major refactoring of exception handling. Low-level API uses RuntimeExceptions, while checked are left for higher level
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
419
diff
changeset
|
325 handlerCancelSupport.checkCancelled(); |
9c9c442b5f2e
Major refactoring of exception handling. Low-level API uses RuntimeExceptions, while checked are left for higher level
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
419
diff
changeset
|
326 } catch (HgCallbackTargetException ex) { |
9c9c442b5f2e
Major refactoring of exception handling. Low-level API uses RuntimeExceptions, while checked are left for higher level
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
419
diff
changeset
|
327 failure = ex; |
9c9c442b5f2e
Major refactoring of exception handling. Low-level API uses RuntimeExceptions, while checked are left for higher level
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
419
diff
changeset
|
328 } catch (CancelledException ex) { |
9c9c442b5f2e
Major refactoring of exception handling. Low-level API uses RuntimeExceptions, while checked are left for higher level
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
419
diff
changeset
|
329 cancellation = ex; |
9c9c442b5f2e
Major refactoring of exception handling. Low-level API uses RuntimeExceptions, while checked are left for higher level
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
419
diff
changeset
|
330 } |
360
150500515714
Report non-critical errors during status operation to handler/inspector
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
350
diff
changeset
|
331 } |
64
19e9e220bf68
Convenient commands constitute hi-level API. org.tmatesoft namespace, GPL2 statement
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
diff
changeset
|
332 } |
19e9e220bf68
Convenient commands constitute hi-level API. org.tmatesoft namespace, GPL2 statement
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
diff
changeset
|
333 } |