comparison src/org/tmatesoft/hg/core/StatusCommand.java @ 64:19e9e220bf68

Convenient commands constitute hi-level API. org.tmatesoft namespace, GPL2 statement
author Artem Tikhomirov <tikhomirov.artem@gmail.com>
date Fri, 21 Jan 2011 05:56:43 +0100
parents
children 0e499fed9b3d
comparison
equal deleted inserted replaced
63:a47530a2ea12 64:19e9e220bf68
1 /*
2 * Copyright (c) 2011 TMate Software Ltd
3 *
4 * This program is free software; you can redistribute it and/or modify
5 * it under the terms of the GNU General Public License as published by
6 * the Free Software Foundation; version 2 of the License.
7 *
8 * This program is distributed in the hope that it will be useful,
9 * but WITHOUT ANY WARRANTY; without even the implied warranty of
10 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11 * GNU General Public License for more details.
12 *
13 * For information on how to redistribute this software under
14 * the terms of a license other than GNU General Public License
15 * contact TMate Software at support@svnkit.com
16 */
17 package org.tmatesoft.hg.core;
18
19 import org.tmatesoft.hg.core.Path.Matcher;
20
21 import com.tmate.hgkit.ll.HgRepository;
22
23 /**
24 *
25 * @author Artem Tikhomirov
26 * @author TMate Software Ltd.
27 */
28 public class StatusCommand {
29 private final HgRepository repo;
30
31 private boolean needClean = false;
32 private boolean needIgnored = false;
33 private Matcher matcher;
34 private int startRevision;
35 private Integer endRevision; // need three states, set, -1 or actual rev number
36 private boolean visitSubRepo = true;
37
38 public StatusCommand(HgRepository hgRepo) {
39 this.repo = hgRepo;
40 }
41
42 public StatusCommand all() {
43 needClean = true;
44 return this;
45 }
46
47 public StatusCommand clean(boolean include) {
48 needClean = include;
49 return this;
50 }
51 public StatusCommand ignored(boolean include) {
52 needIgnored = include;
53 return this;
54 }
55
56 // if set, either base:revision or base:workingdir
57 public StatusCommand base(int revision) {
58 startRevision = revision;
59 return this;
60 }
61
62 // revision without base == --change
63 public StatusCommand revision(int revision) {
64 // XXX how to clear endRevision, if needed.
65 // Perhaps, use of WC_REVISION or BAD_REVISION == -2 or Int.MIN_VALUE?
66 endRevision = new Integer(revision);
67 return this;
68 }
69
70 public StatusCommand match(Path.Matcher pathMatcher) {
71 matcher = pathMatcher;
72 return this;
73 }
74
75 public StatusCommand subrepo(boolean visit) {
76 visitSubRepo = visit;
77 throw HgRepository.notImplemented();
78 }
79
80 public void execute() {
81 throw HgRepository.notImplemented();
82 }
83 }