annotate src/org/tmatesoft/hg/core/StatusCommand.java @ 127:2e395db595e2

Moved HgStatus to toplevel
author Artem Tikhomirov <tikhomirov.artem@gmail.com>
date Wed, 16 Feb 2011 18:42:10 +0100
parents 4f509f5bc8cb
children 44b97930570c
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 /*
19e9e220bf68 Convenient commands constitute hi-level API. org.tmatesoft namespace, GPL2 statement
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
diff changeset
2 * Copyright (c) 2011 TMate Software Ltd
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.*;
109
dd4d2d0e42cd Handler for StatusCommand to get notifications in the form of HgStatus object
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents: 102
diff changeset
20 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
21
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
22 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
23
64
19e9e220bf68 Convenient commands constitute hi-level API. org.tmatesoft namespace, GPL2 statement
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
diff changeset
24 import org.tmatesoft.hg.core.Path.Matcher;
74
6f1b88693d48 Complete refactoring to org.tmatesoft
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents: 68
diff changeset
25 import org.tmatesoft.hg.repo.HgRepository;
109
dd4d2d0e42cd Handler for StatusCommand to get notifications in the form of HgStatus object
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents: 102
diff changeset
26 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
27 import org.tmatesoft.hg.repo.HgStatusInspector;
94
af1f3b78b918 *StatusCollector renamed to Hg*StatusCollector
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents: 93
diff changeset
28 import org.tmatesoft.hg.repo.HgWorkingCopyStatusCollector;
64
19e9e220bf68 Convenient commands constitute hi-level API. org.tmatesoft namespace, GPL2 statement
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
diff changeset
29
19e9e220bf68 Convenient commands constitute hi-level API. org.tmatesoft namespace, GPL2 statement
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
diff changeset
30 /**
19e9e220bf68 Convenient commands constitute hi-level API. org.tmatesoft namespace, GPL2 statement
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
diff changeset
31 *
19e9e220bf68 Convenient commands constitute hi-level API. org.tmatesoft namespace, GPL2 statement
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
diff changeset
32 * @author Artem Tikhomirov
19e9e220bf68 Convenient commands constitute hi-level API. org.tmatesoft namespace, GPL2 statement
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
diff changeset
33 * @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
34 */
19e9e220bf68 Convenient commands constitute hi-level API. org.tmatesoft namespace, GPL2 statement
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
diff changeset
35 public class StatusCommand {
19e9e220bf68 Convenient commands constitute hi-level API. org.tmatesoft namespace, GPL2 statement
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
diff changeset
36 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
37
68
0e499fed9b3d StatusCommand with tests. Extra constants to indicate common revision cases
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents: 64
diff changeset
38 private int startRevision = TIP;
0e499fed9b3d StatusCommand with tests. Extra constants to indicate common revision cases
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents: 64
diff changeset
39 private int endRevision = WORKING_COPY;
64
19e9e220bf68 Convenient commands constitute hi-level API. org.tmatesoft namespace, GPL2 statement
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
diff changeset
40 private boolean visitSubRepo = true;
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
41
109
dd4d2d0e42cd Handler for StatusCommand to get notifications in the form of HgStatus object
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents: 102
diff changeset
42 private Handler handler;
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
43 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
44
68
0e499fed9b3d StatusCommand with tests. Extra constants to indicate common revision cases
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents: 64
diff changeset
45 public StatusCommand(HgRepository hgRepo) {
0e499fed9b3d StatusCommand with tests. Extra constants to indicate common revision cases
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents: 64
diff changeset
46 repo = hgRepo;
0e499fed9b3d StatusCommand with tests. Extra constants to indicate common revision cases
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents: 64
diff changeset
47 defaults();
64
19e9e220bf68 Convenient commands constitute hi-level API. org.tmatesoft namespace, GPL2 statement
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
diff changeset
48 }
19e9e220bf68 Convenient commands constitute hi-level API. org.tmatesoft namespace, GPL2 statement
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
diff changeset
49
68
0e499fed9b3d StatusCommand with tests. Extra constants to indicate common revision cases
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents: 64
diff changeset
50 public StatusCommand 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
51 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
52 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
53 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
54 return this;
19e9e220bf68 Convenient commands constitute hi-level API. org.tmatesoft namespace, GPL2 statement
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
diff changeset
55 }
68
0e499fed9b3d StatusCommand with tests. Extra constants to indicate common revision cases
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents: 64
diff changeset
56 public StatusCommand 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
57 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
58 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
59 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
60 return this;
0e499fed9b3d StatusCommand with tests. Extra constants to indicate common revision cases
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents: 64
diff changeset
61 }
0e499fed9b3d StatusCommand with tests. Extra constants to indicate common revision cases
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents: 64
diff changeset
62
64
19e9e220bf68 Convenient commands constitute hi-level API. org.tmatesoft namespace, GPL2 statement
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
diff changeset
63
68
0e499fed9b3d StatusCommand with tests. Extra constants to indicate common revision cases
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents: 64
diff changeset
64 public StatusCommand 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
65 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
66 return this;
0e499fed9b3d StatusCommand with tests. Extra constants to indicate common revision cases
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents: 64
diff changeset
67 }
0e499fed9b3d StatusCommand with tests. Extra constants to indicate common revision cases
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents: 64
diff changeset
68 public StatusCommand 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
69 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
70 return this;
0e499fed9b3d StatusCommand with tests. Extra constants to indicate common revision cases
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents: 64
diff changeset
71 }
0e499fed9b3d StatusCommand with tests. Extra constants to indicate common revision cases
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents: 64
diff changeset
72 public StatusCommand 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
73 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
74 return this;
0e499fed9b3d StatusCommand with tests. Extra constants to indicate common revision cases
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents: 64
diff changeset
75 }
0e499fed9b3d StatusCommand with tests. Extra constants to indicate common revision cases
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents: 64
diff changeset
76 public StatusCommand 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
77 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
78 return this;
0e499fed9b3d StatusCommand with tests. Extra constants to indicate common revision cases
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents: 64
diff changeset
79 }
0e499fed9b3d StatusCommand with tests. Extra constants to indicate common revision cases
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents: 64
diff changeset
80 public StatusCommand 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
81 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
82 return this;
0e499fed9b3d StatusCommand with tests. Extra constants to indicate common revision cases
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents: 64
diff changeset
83 }
64
19e9e220bf68 Convenient commands constitute hi-level API. org.tmatesoft namespace, GPL2 statement
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
diff changeset
84 public StatusCommand 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
85 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
86 return this;
19e9e220bf68 Convenient commands constitute hi-level API. org.tmatesoft namespace, GPL2 statement
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
diff changeset
87 }
19e9e220bf68 Convenient commands constitute hi-level API. org.tmatesoft namespace, GPL2 statement
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
diff changeset
88 public StatusCommand 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
89 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
90 return this;
19e9e220bf68 Convenient commands constitute hi-level API. org.tmatesoft namespace, GPL2 statement
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
diff changeset
91 }
19e9e220bf68 Convenient commands constitute hi-level API. org.tmatesoft namespace, GPL2 statement
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
diff changeset
92
68
0e499fed9b3d StatusCommand with tests. Extra constants to indicate common revision cases
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents: 64
diff changeset
93 /**
0e499fed9b3d StatusCommand with tests. Extra constants to indicate common revision cases
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents: 64
diff changeset
94 * if set, either base:revision or base:workingdir
0e499fed9b3d StatusCommand with tests. Extra constants to indicate common revision cases
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents: 64
diff changeset
95 * to unset, pass {@link HgRepository#TIP} or {@link HgRepository#BAD_REVISION}
0e499fed9b3d StatusCommand with tests. Extra constants to indicate common revision cases
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents: 64
diff changeset
96 * @param revision
0e499fed9b3d StatusCommand with tests. Extra constants to indicate common revision cases
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents: 64
diff changeset
97 * @return
0e499fed9b3d StatusCommand with tests. Extra constants to indicate common revision cases
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents: 64
diff changeset
98 */
0e499fed9b3d StatusCommand with tests. Extra constants to indicate common revision cases
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents: 64
diff changeset
99
64
19e9e220bf68 Convenient commands constitute hi-level API. org.tmatesoft namespace, GPL2 statement
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
diff changeset
100 public StatusCommand base(int revision) {
68
0e499fed9b3d StatusCommand with tests. Extra constants to indicate common revision cases
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents: 64
diff changeset
101 if (revision == WORKING_COPY) {
0e499fed9b3d StatusCommand with tests. Extra constants to indicate common revision cases
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents: 64
diff changeset
102 throw new IllegalArgumentException();
0e499fed9b3d StatusCommand with tests. Extra constants to indicate common revision cases
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents: 64
diff changeset
103 }
0e499fed9b3d StatusCommand with tests. Extra constants to indicate common revision cases
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents: 64
diff changeset
104 if (revision == BAD_REVISION) {
0e499fed9b3d StatusCommand with tests. Extra constants to indicate common revision cases
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents: 64
diff changeset
105 revision = TIP;
0e499fed9b3d StatusCommand with tests. Extra constants to indicate common revision cases
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents: 64
diff changeset
106 }
64
19e9e220bf68 Convenient commands constitute hi-level API. org.tmatesoft namespace, GPL2 statement
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
diff changeset
107 startRevision = revision;
19e9e220bf68 Convenient commands constitute hi-level API. org.tmatesoft namespace, GPL2 statement
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
diff changeset
108 return this;
19e9e220bf68 Convenient commands constitute hi-level API. org.tmatesoft namespace, GPL2 statement
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
diff changeset
109 }
19e9e220bf68 Convenient commands constitute hi-level API. org.tmatesoft namespace, GPL2 statement
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
diff changeset
110
68
0e499fed9b3d StatusCommand with tests. Extra constants to indicate common revision cases
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents: 64
diff changeset
111 /**
0e499fed9b3d StatusCommand with tests. Extra constants to indicate common revision cases
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents: 64
diff changeset
112 * 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
113 * Pass {@link HgRepository#WORKING_COPY} or {@link HgRepository#BAD_REVISION} to reset
0e499fed9b3d StatusCommand with tests. Extra constants to indicate common revision cases
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents: 64
diff changeset
114 * @param revision
0e499fed9b3d StatusCommand with tests. Extra constants to indicate common revision cases
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents: 64
diff changeset
115 * @return
0e499fed9b3d StatusCommand with tests. Extra constants to indicate common revision cases
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents: 64
diff changeset
116 */
64
19e9e220bf68 Convenient commands constitute hi-level API. org.tmatesoft namespace, GPL2 statement
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
diff changeset
117 public StatusCommand revision(int revision) {
68
0e499fed9b3d StatusCommand with tests. Extra constants to indicate common revision cases
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents: 64
diff changeset
118 if (revision == BAD_REVISION) {
0e499fed9b3d StatusCommand with tests. Extra constants to indicate common revision cases
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents: 64
diff changeset
119 revision = WORKING_COPY;
0e499fed9b3d StatusCommand with tests. Extra constants to indicate common revision cases
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents: 64
diff changeset
120 }
0e499fed9b3d StatusCommand with tests. Extra constants to indicate common revision cases
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents: 64
diff changeset
121 // XXX negative values, except for predefined constants, shall throw IAE.
0e499fed9b3d StatusCommand with tests. Extra constants to indicate common revision cases
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents: 64
diff changeset
122 endRevision = revision;
64
19e9e220bf68 Convenient commands constitute hi-level API. org.tmatesoft namespace, GPL2 statement
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
diff changeset
123 return this;
19e9e220bf68 Convenient commands constitute hi-level API. org.tmatesoft namespace, GPL2 statement
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
diff changeset
124 }
19e9e220bf68 Convenient commands constitute hi-level API. org.tmatesoft namespace, GPL2 statement
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
diff changeset
125
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
126 // pass null to reset
64
19e9e220bf68 Convenient commands constitute hi-level API. org.tmatesoft namespace, GPL2 statement
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
diff changeset
127 public StatusCommand match(Path.Matcher pathMatcher) {
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
128 mediator.matcher = pathMatcher;
123
4f509f5bc8cb reflect status change in the todo content
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents: 109
diff changeset
129 return this;
64
19e9e220bf68 Convenient commands constitute hi-level API. org.tmatesoft namespace, GPL2 statement
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
diff changeset
130 }
19e9e220bf68 Convenient commands constitute hi-level API. org.tmatesoft namespace, GPL2 statement
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
diff changeset
131
19e9e220bf68 Convenient commands constitute hi-level API. org.tmatesoft namespace, GPL2 statement
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
diff changeset
132 public StatusCommand subrepo(boolean visit) {
19e9e220bf68 Convenient commands constitute hi-level API. org.tmatesoft namespace, GPL2 statement
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
diff changeset
133 visitSubRepo = visit;
19e9e220bf68 Convenient commands constitute hi-level API. org.tmatesoft namespace, GPL2 statement
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
diff changeset
134 throw HgRepository.notImplemented();
19e9e220bf68 Convenient commands constitute hi-level API. org.tmatesoft namespace, GPL2 statement
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
diff changeset
135 }
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
136
d55d4eedfc57 Switch to Path instead of String in filenames returned by various status operations
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents: 74
diff changeset
137 /**
d55d4eedfc57 Switch to Path instead of String in filenames returned by various status operations
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents: 74
diff changeset
138 * 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
139 *
d55d4eedfc57 Switch to Path instead of String in filenames returned by various status operations
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents: 74
diff changeset
140 * @param handler callback to get status information
d55d4eedfc57 Switch to Path instead of String in filenames returned by various status operations
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents: 74
diff changeset
141 * @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
142 * @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
143 */
109
dd4d2d0e42cd Handler for StatusCommand to get notifications in the form of HgStatus object
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents: 102
diff changeset
144 public void execute(Handler statusHandler) {
dd4d2d0e42cd Handler for StatusCommand to get notifications in the form of HgStatus object
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents: 102
diff changeset
145 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
146 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
147 }
109
dd4d2d0e42cd Handler for StatusCommand to get notifications in the form of HgStatus object
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents: 102
diff changeset
148 if (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
149 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
150 }
109
dd4d2d0e42cd Handler for StatusCommand to get notifications in the form of HgStatus object
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents: 102
diff changeset
151 handler = statusHandler;
94
af1f3b78b918 *StatusCollector renamed to Hg*StatusCollector
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents: 93
diff changeset
152 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
153 // 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
154 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
155 // 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
156 // I may use number of files in either rev1 or rev2 manifest edition
d55d4eedfc57 Switch to Path instead of String in filenames returned by various status operations
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents: 74
diff changeset
157 mediator.start();
d55d4eedfc57 Switch to Path instead of String in filenames returned by various status operations
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents: 74
diff changeset
158 if (endRevision == WORKING_COPY) {
94
af1f3b78b918 *StatusCollector renamed to Hg*StatusCollector
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents: 93
diff changeset
159 HgWorkingCopyStatusCollector wcsc = 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
160 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
161 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
162 } else {
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
163 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
164 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
165 } 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
166 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
167 }
d55d4eedfc57 Switch to Path instead of String in filenames returned by various status operations
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents: 74
diff changeset
168 }
d55d4eedfc57 Switch to Path instead of String in filenames returned by various status operations
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents: 74
diff changeset
169 } 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
170 mediator.done();
109
dd4d2d0e42cd Handler for StatusCommand to get notifications in the form of HgStatus object
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents: 102
diff changeset
171 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
172 }
d55d4eedfc57 Switch to Path instead of String in filenames returned by various status operations
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents: 74
diff changeset
173 }
d55d4eedfc57 Switch to Path instead of String in filenames returned by various status operations
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents: 74
diff changeset
174
109
dd4d2d0e42cd Handler for StatusCommand to get notifications in the form of HgStatus object
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents: 102
diff changeset
175 public interface Handler {
dd4d2d0e42cd Handler for StatusCommand to get notifications in the form of HgStatus object
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents: 102
diff changeset
176 void handleStatus(HgStatus s);
dd4d2d0e42cd Handler for StatusCommand to get notifications in the form of HgStatus object
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents: 102
diff changeset
177 }
dd4d2d0e42cd Handler for StatusCommand to get notifications in the form of HgStatus object
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents: 102
diff changeset
178
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
179 private class Mediator implements HgStatusInspector {
d55d4eedfc57 Switch to Path instead of String in filenames returned by various status operations
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents: 74
diff changeset
180 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
181 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
182 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
183 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
184 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
185 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
186 boolean needIgnored;
99
4d7bb95d553b StatusCommand().add should list copies
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents: 94
diff changeset
187 boolean needCopies;
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 Matcher matcher;
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
d55d4eedfc57 Switch to Path instead of String in filenames returned by various status operations
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents: 74
diff changeset
190 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
191 }
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
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 public void start() {
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
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 }
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 public void 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
197 }
d55d4eedfc57 Switch to Path instead of String in filenames returned by various status operations
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents: 74
diff changeset
198
d55d4eedfc57 Switch to Path instead of String in filenames returned by various status operations
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents: 74
diff changeset
199 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
200 if (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
201 if (matcher == null || matcher.accept(fname)) {
109
dd4d2d0e42cd Handler for StatusCommand to get notifications in the form of HgStatus object
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents: 102
diff changeset
202 handler.handleStatus(new HgStatus(Modified, fname));
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
203 }
68
0e499fed9b3d StatusCommand with tests. Extra constants to indicate common revision cases
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents: 64
diff changeset
204 }
0e499fed9b3d StatusCommand with tests. Extra constants to indicate common revision cases
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents: 64
diff changeset
205 }
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
206 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
207 if (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
208 if (matcher == null || matcher.accept(fname)) {
109
dd4d2d0e42cd Handler for StatusCommand to get notifications in the form of HgStatus object
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents: 102
diff changeset
209 handler.handleStatus(new HgStatus(Added, fname));
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 }
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 }
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 }
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 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
214 if (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
215 if (matcher == null || matcher.accept(fname)) {
109
dd4d2d0e42cd Handler for StatusCommand to get notifications in the form of HgStatus object
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents: 102
diff changeset
216 handler.handleStatus(new HgStatus(Removed, fname));
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
217 }
d55d4eedfc57 Switch to Path instead of String in filenames returned by various status operations
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents: 74
diff changeset
218 }
d55d4eedfc57 Switch to Path instead of String in filenames returned by various status operations
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents: 74
diff changeset
219 }
d55d4eedfc57 Switch to Path instead of String in filenames returned by various status operations
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents: 74
diff changeset
220 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
221 if (needCopies) {
d55d4eedfc57 Switch to Path instead of String in filenames returned by various status operations
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents: 74
diff changeset
222 if (matcher == null || matcher.accept(fnameAdded)) {
127
2e395db595e2 Moved HgStatus to toplevel
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents: 123
diff changeset
223 handler.handleStatus(new HgStatus(Added, fnameAdded, fnameOrigin));
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
224 }
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 }
d55d4eedfc57 Switch to Path instead of String in filenames returned by various status operations
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents: 74
diff changeset
227 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
228 if (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
229 if (matcher == null || matcher.accept(fname)) {
109
dd4d2d0e42cd Handler for StatusCommand to get notifications in the form of HgStatus object
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents: 102
diff changeset
230 handler.handleStatus(new HgStatus(Missing, fname));
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 }
d55d4eedfc57 Switch to Path instead of String in filenames returned by various status operations
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents: 74
diff changeset
232 }
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 }
d55d4eedfc57 Switch to Path instead of String in filenames returned by various status operations
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents: 74
diff changeset
234 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
235 if (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
236 if (matcher == null || matcher.accept(fname)) {
109
dd4d2d0e42cd Handler for StatusCommand to get notifications in the form of HgStatus object
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents: 102
diff changeset
237 handler.handleStatus(new HgStatus(Unknown, fname));
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
238 }
d55d4eedfc57 Switch to Path instead of String in filenames returned by various status operations
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents: 74
diff changeset
239 }
d55d4eedfc57 Switch to Path instead of String in filenames returned by various status operations
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents: 74
diff changeset
240 }
d55d4eedfc57 Switch to Path instead of String in filenames returned by various status operations
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents: 74
diff changeset
241 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
242 if (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
243 if (matcher == null || matcher.accept(fname)) {
109
dd4d2d0e42cd Handler for StatusCommand to get notifications in the form of HgStatus object
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents: 102
diff changeset
244 handler.handleStatus(new HgStatus(Clean, fname));
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
245 }
d55d4eedfc57 Switch to Path instead of String in filenames returned by various status operations
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents: 74
diff changeset
246 }
d55d4eedfc57 Switch to Path instead of String in filenames returned by various status operations
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents: 74
diff changeset
247 }
d55d4eedfc57 Switch to Path instead of String in filenames returned by various status operations
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents: 74
diff changeset
248 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
249 if (needIgnored) {
d55d4eedfc57 Switch to Path instead of String in filenames returned by various status operations
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents: 74
diff changeset
250 if (matcher == null || matcher.accept(fname)) {
109
dd4d2d0e42cd Handler for StatusCommand to get notifications in the form of HgStatus object
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents: 102
diff changeset
251 handler.handleStatus(new HgStatus(Ignored, fname));
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
252 }
d55d4eedfc57 Switch to Path instead of String in filenames returned by various status operations
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents: 74
diff changeset
253 }
d55d4eedfc57 Switch to Path instead of String in filenames returned by various status operations
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents: 74
diff changeset
254 }
64
19e9e220bf68 Convenient commands constitute hi-level API. org.tmatesoft namespace, GPL2 statement
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
diff changeset
255 }
19e9e220bf68 Convenient commands constitute hi-level API. org.tmatesoft namespace, GPL2 statement
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
diff changeset
256 }