Mercurial > hg4j
annotate cmdline/org/tmatesoft/hg/console/Status.java @ 235:fd845a53f53d
Experimental access to working dir parents
author | Artem Tikhomirov <tikhomirov.artem@gmail.com> |
---|---|
date | Tue, 07 Jun 2011 04:54:13 +0200 |
parents | d5268ca7715b |
children | 23e3ea855097 |
rev | line source |
---|---|
10
382cfe9463db
Dirstate parsing. DataAccess refactored to allow reuse and control over constants
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
diff
changeset
|
1 /* |
72
9a03a80a0f2f
Command-line frontend moved to separate source root with new package statement
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
59
diff
changeset
|
2 * Copyright (c) 2010-2011 TMate Software Ltd |
9a03a80a0f2f
Command-line frontend moved to separate source root with new package statement
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
59
diff
changeset
|
3 * |
9a03a80a0f2f
Command-line frontend moved to separate source root with new package statement
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
59
diff
changeset
|
4 * This program is free software; you can redistribute it and/or modify |
9a03a80a0f2f
Command-line frontend moved to separate source root with new package statement
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
59
diff
changeset
|
5 * it under the terms of the GNU General Public License as published by |
9a03a80a0f2f
Command-line frontend moved to separate source root with new package statement
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
59
diff
changeset
|
6 * the Free Software Foundation; version 2 of the License. |
9a03a80a0f2f
Command-line frontend moved to separate source root with new package statement
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
59
diff
changeset
|
7 * |
9a03a80a0f2f
Command-line frontend moved to separate source root with new package statement
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
59
diff
changeset
|
8 * This program is distributed in the hope that it will be useful, |
9a03a80a0f2f
Command-line frontend moved to separate source root with new package statement
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
59
diff
changeset
|
9 * but WITHOUT ANY WARRANTY; without even the implied warranty of |
9a03a80a0f2f
Command-line frontend moved to separate source root with new package statement
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
59
diff
changeset
|
10 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
9a03a80a0f2f
Command-line frontend moved to separate source root with new package statement
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
59
diff
changeset
|
11 * GNU General Public License for more details. |
9a03a80a0f2f
Command-line frontend moved to separate source root with new package statement
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
59
diff
changeset
|
12 * |
9a03a80a0f2f
Command-line frontend moved to separate source root with new package statement
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
59
diff
changeset
|
13 * For information on how to redistribute this software under |
9a03a80a0f2f
Command-line frontend moved to separate source root with new package statement
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
59
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:
96
diff
changeset
|
15 * contact TMate Software at support@hg4j.com |
10
382cfe9463db
Dirstate parsing. DataAccess refactored to allow reuse and control over constants
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
diff
changeset
|
16 */ |
72
9a03a80a0f2f
Command-line frontend moved to separate source root with new package statement
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
59
diff
changeset
|
17 package org.tmatesoft.hg.console; |
10
382cfe9463db
Dirstate parsing. DataAccess refactored to allow reuse and control over constants
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
diff
changeset
|
18 |
143
b9700740553a
Command line tools parse and respect most of command-line arguments
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
133
diff
changeset
|
19 import static org.tmatesoft.hg.repo.HgRepository.BAD_REVISION; |
18
02ee376bee79
status operation against current working directory
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
10
diff
changeset
|
20 |
55
05829a70b30b
Status operation extracted into separate, cache-friendly class
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
22
diff
changeset
|
21 import java.util.ArrayList; |
05829a70b30b
Status operation extracted into separate, cache-friendly class
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
22
diff
changeset
|
22 import java.util.Collections; |
143
b9700740553a
Command line tools parse and respect most of command-line arguments
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
133
diff
changeset
|
23 import java.util.HashMap; |
b9700740553a
Command line tools parse and respect most of command-line arguments
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
133
diff
changeset
|
24 import java.util.LinkedList; |
55
05829a70b30b
Status operation extracted into separate, cache-friendly class
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
22
diff
changeset
|
25 import java.util.List; |
74
6f1b88693d48
Complete refactoring to org.tmatesoft
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
72
diff
changeset
|
26 import java.util.Map; |
143
b9700740553a
Command line tools parse and respect most of command-line arguments
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
133
diff
changeset
|
27 import java.util.TreeMap; |
55
05829a70b30b
Status operation extracted into separate, cache-friendly class
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
22
diff
changeset
|
28 |
143
b9700740553a
Command line tools parse and respect most of command-line arguments
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
133
diff
changeset
|
29 import org.tmatesoft.hg.core.HgRepoFacade; |
b9700740553a
Command line tools parse and respect most of command-line arguments
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
133
diff
changeset
|
30 import org.tmatesoft.hg.core.HgStatus; |
b9700740553a
Command line tools parse and respect most of command-line arguments
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
133
diff
changeset
|
31 import org.tmatesoft.hg.core.HgStatus.Kind; |
b9700740553a
Command line tools parse and respect most of command-line arguments
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
133
diff
changeset
|
32 import org.tmatesoft.hg.core.HgStatusCommand; |
133
4a948ec83980
core.Path to util.Path as it's not Hg repo dependant
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
117
diff
changeset
|
33 import org.tmatesoft.hg.util.Path; |
10
382cfe9463db
Dirstate parsing. DataAccess refactored to allow reuse and control over constants
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
diff
changeset
|
34 |
382cfe9463db
Dirstate parsing. DataAccess refactored to allow reuse and control over constants
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
diff
changeset
|
35 /** |
382cfe9463db
Dirstate parsing. DataAccess refactored to allow reuse and control over constants
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
diff
changeset
|
36 * |
72
9a03a80a0f2f
Command-line frontend moved to separate source root with new package statement
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
59
diff
changeset
|
37 * @author Artem Tikhomirov |
9a03a80a0f2f
Command-line frontend moved to separate source root with new package statement
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
59
diff
changeset
|
38 * @author TMate Software Ltd. |
10
382cfe9463db
Dirstate parsing. DataAccess refactored to allow reuse and control over constants
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
diff
changeset
|
39 */ |
382cfe9463db
Dirstate parsing. DataAccess refactored to allow reuse and control over constants
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
diff
changeset
|
40 public class Status { |
382cfe9463db
Dirstate parsing. DataAccess refactored to allow reuse and control over constants
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
diff
changeset
|
41 |
382cfe9463db
Dirstate parsing. DataAccess refactored to allow reuse and control over constants
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
diff
changeset
|
42 public static void main(String[] args) throws Exception { |
74
6f1b88693d48
Complete refactoring to org.tmatesoft
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
72
diff
changeset
|
43 Options cmdLineOpts = Options.parse(args); |
143
b9700740553a
Command line tools parse and respect most of command-line arguments
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
133
diff
changeset
|
44 HgRepoFacade hgRepo = new HgRepoFacade(); |
b9700740553a
Command line tools parse and respect most of command-line arguments
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
133
diff
changeset
|
45 if (!hgRepo.init(cmdLineOpts.findRepository())) { |
b9700740553a
Command line tools parse and respect most of command-line arguments
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
133
diff
changeset
|
46 System.err.printf("Can't find repository in: %s\n", hgRepo.getRepository().getLocation()); |
10
382cfe9463db
Dirstate parsing. DataAccess refactored to allow reuse and control over constants
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
diff
changeset
|
47 return; |
382cfe9463db
Dirstate parsing. DataAccess refactored to allow reuse and control over constants
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
diff
changeset
|
48 } |
74
6f1b88693d48
Complete refactoring to org.tmatesoft
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
72
diff
changeset
|
49 // |
143
b9700740553a
Command line tools parse and respect most of command-line arguments
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
133
diff
changeset
|
50 HgStatusCommand cmd = hgRepo.createStatusCommand(); |
157
d5268ca7715b
Merged branch wrap-data-access into default for resource-friendly data access. Updated API to promote that friendliness to clients (channels, not byte[]). More exceptions
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
143
diff
changeset
|
51 if (cmdLineOpts.getBoolean("-A", "--all")) { |
143
b9700740553a
Command line tools parse and respect most of command-line arguments
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
133
diff
changeset
|
52 cmd.all(); |
b9700740553a
Command line tools parse and respect most of command-line arguments
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
133
diff
changeset
|
53 } else { |
b9700740553a
Command line tools parse and respect most of command-line arguments
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
133
diff
changeset
|
54 // default: mardu |
b9700740553a
Command line tools parse and respect most of command-line arguments
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
133
diff
changeset
|
55 cmd.modified(cmdLineOpts.getBoolean(true, "-m", "--modified")); |
b9700740553a
Command line tools parse and respect most of command-line arguments
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
133
diff
changeset
|
56 cmd.added(cmdLineOpts.getBoolean(true, "-a", "--added")); |
b9700740553a
Command line tools parse and respect most of command-line arguments
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
133
diff
changeset
|
57 cmd.removed(cmdLineOpts.getBoolean(true, "-r", "--removed")); |
b9700740553a
Command line tools parse and respect most of command-line arguments
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
133
diff
changeset
|
58 cmd.deleted(cmdLineOpts.getBoolean(true, "-d", "--deleted")); |
b9700740553a
Command line tools parse and respect most of command-line arguments
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
133
diff
changeset
|
59 cmd.unknown(cmdLineOpts.getBoolean(true, "-u", "--unknonwn")); |
b9700740553a
Command line tools parse and respect most of command-line arguments
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
133
diff
changeset
|
60 cmd.clean(cmdLineOpts.getBoolean("-c", "--clean")); |
b9700740553a
Command line tools parse and respect most of command-line arguments
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
133
diff
changeset
|
61 cmd.ignored(cmdLineOpts.getBoolean("-i", "--ignored")); |
b9700740553a
Command line tools parse and respect most of command-line arguments
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
133
diff
changeset
|
62 } |
b9700740553a
Command line tools parse and respect most of command-line arguments
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
133
diff
changeset
|
63 // cmd.subrepo(cmdLineOpts.getBoolean("-S", "--subrepos")) |
b9700740553a
Command line tools parse and respect most of command-line arguments
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
133
diff
changeset
|
64 final boolean noStatusPrefix = cmdLineOpts.getBoolean("-n", "--no-status"); |
b9700740553a
Command line tools parse and respect most of command-line arguments
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
133
diff
changeset
|
65 final boolean showCopies = cmdLineOpts.getBoolean("-C", "--copies"); |
b9700740553a
Command line tools parse and respect most of command-line arguments
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
133
diff
changeset
|
66 class StatusHandler implements HgStatusCommand.Handler { |
b9700740553a
Command line tools parse and respect most of command-line arguments
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
133
diff
changeset
|
67 |
b9700740553a
Command line tools parse and respect most of command-line arguments
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
133
diff
changeset
|
68 final Map<HgStatus.Kind, List<Path>> data = new TreeMap<HgStatus.Kind, List<Path>>(); |
b9700740553a
Command line tools parse and respect most of command-line arguments
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
133
diff
changeset
|
69 final Map<Path, Path> copies = showCopies ? new HashMap<Path,Path>() : null; |
b9700740553a
Command line tools parse and respect most of command-line arguments
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
133
diff
changeset
|
70 |
b9700740553a
Command line tools parse and respect most of command-line arguments
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
133
diff
changeset
|
71 public void handleStatus(HgStatus s) { |
b9700740553a
Command line tools parse and respect most of command-line arguments
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
133
diff
changeset
|
72 List<Path> l = data.get(s.getKind()); |
b9700740553a
Command line tools parse and respect most of command-line arguments
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
133
diff
changeset
|
73 if (l == null) { |
b9700740553a
Command line tools parse and respect most of command-line arguments
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
133
diff
changeset
|
74 l = new LinkedList<Path>(); |
b9700740553a
Command line tools parse and respect most of command-line arguments
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
133
diff
changeset
|
75 data.put(s.getKind(), l); |
b9700740553a
Command line tools parse and respect most of command-line arguments
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
133
diff
changeset
|
76 } |
b9700740553a
Command line tools parse and respect most of command-line arguments
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
133
diff
changeset
|
77 l.add(s.getPath()); |
b9700740553a
Command line tools parse and respect most of command-line arguments
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
133
diff
changeset
|
78 if (s.isCopy() && showCopies) { |
b9700740553a
Command line tools parse and respect most of command-line arguments
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
133
diff
changeset
|
79 copies.put(s.getPath(), s.getOriginalPath()); |
b9700740553a
Command line tools parse and respect most of command-line arguments
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
133
diff
changeset
|
80 } |
b9700740553a
Command line tools parse and respect most of command-line arguments
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
133
diff
changeset
|
81 } |
b9700740553a
Command line tools parse and respect most of command-line arguments
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
133
diff
changeset
|
82 |
b9700740553a
Command line tools parse and respect most of command-line arguments
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
133
diff
changeset
|
83 public void dump() { |
b9700740553a
Command line tools parse and respect most of command-line arguments
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
133
diff
changeset
|
84 sortAndPrint('M', data.get(Kind.Modified), null); |
b9700740553a
Command line tools parse and respect most of command-line arguments
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
133
diff
changeset
|
85 sortAndPrint('A', data.get(Kind.Added), copies); |
b9700740553a
Command line tools parse and respect most of command-line arguments
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
133
diff
changeset
|
86 sortAndPrint('R', data.get(Kind.Removed), null); |
b9700740553a
Command line tools parse and respect most of command-line arguments
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
133
diff
changeset
|
87 sortAndPrint('?', data.get(Kind.Unknown), null); |
b9700740553a
Command line tools parse and respect most of command-line arguments
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
133
diff
changeset
|
88 sortAndPrint('I', data.get(Kind.Ignored), null); |
b9700740553a
Command line tools parse and respect most of command-line arguments
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
133
diff
changeset
|
89 sortAndPrint('C', data.get(Kind.Clean), null); |
b9700740553a
Command line tools parse and respect most of command-line arguments
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
133
diff
changeset
|
90 sortAndPrint('!', data.get(Kind.Missing), null); |
b9700740553a
Command line tools parse and respect most of command-line arguments
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
133
diff
changeset
|
91 } |
74
6f1b88693d48
Complete refactoring to org.tmatesoft
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
72
diff
changeset
|
92 |
143
b9700740553a
Command line tools parse and respect most of command-line arguments
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
133
diff
changeset
|
93 private void sortAndPrint(char prefix, List<Path> ul, Map<Path, Path> copies) { |
b9700740553a
Command line tools parse and respect most of command-line arguments
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
133
diff
changeset
|
94 if (ul == null) { |
b9700740553a
Command line tools parse and respect most of command-line arguments
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
133
diff
changeset
|
95 return; |
b9700740553a
Command line tools parse and respect most of command-line arguments
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
133
diff
changeset
|
96 } |
b9700740553a
Command line tools parse and respect most of command-line arguments
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
133
diff
changeset
|
97 ArrayList<Path> sortList = new ArrayList<Path>(ul); |
b9700740553a
Command line tools parse and respect most of command-line arguments
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
133
diff
changeset
|
98 Collections.sort(sortList); |
b9700740553a
Command line tools parse and respect most of command-line arguments
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
133
diff
changeset
|
99 for (Path s : sortList) { |
b9700740553a
Command line tools parse and respect most of command-line arguments
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
133
diff
changeset
|
100 if (!noStatusPrefix) { |
b9700740553a
Command line tools parse and respect most of command-line arguments
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
133
diff
changeset
|
101 System.out.print(prefix); |
b9700740553a
Command line tools parse and respect most of command-line arguments
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
133
diff
changeset
|
102 System.out.print(' '); |
b9700740553a
Command line tools parse and respect most of command-line arguments
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
133
diff
changeset
|
103 } |
b9700740553a
Command line tools parse and respect most of command-line arguments
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
133
diff
changeset
|
104 System.out.println(s); |
b9700740553a
Command line tools parse and respect most of command-line arguments
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
133
diff
changeset
|
105 if (copies != null && copies.containsKey(s)) { |
b9700740553a
Command line tools parse and respect most of command-line arguments
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
133
diff
changeset
|
106 System.out.println(" " + copies.get(s)); |
b9700740553a
Command line tools parse and respect most of command-line arguments
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
133
diff
changeset
|
107 } |
b9700740553a
Command line tools parse and respect most of command-line arguments
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
133
diff
changeset
|
108 } |
b9700740553a
Command line tools parse and respect most of command-line arguments
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
133
diff
changeset
|
109 } |
b9700740553a
Command line tools parse and respect most of command-line arguments
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
133
diff
changeset
|
110 }; |
b9700740553a
Command line tools parse and respect most of command-line arguments
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
133
diff
changeset
|
111 |
b9700740553a
Command line tools parse and respect most of command-line arguments
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
133
diff
changeset
|
112 StatusHandler statusHandler = new StatusHandler(); |
b9700740553a
Command line tools parse and respect most of command-line arguments
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
133
diff
changeset
|
113 int changeRev = cmdLineOpts.getSingleInt(BAD_REVISION, "--change"); |
b9700740553a
Command line tools parse and respect most of command-line arguments
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
133
diff
changeset
|
114 if (changeRev != BAD_REVISION) { |
b9700740553a
Command line tools parse and respect most of command-line arguments
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
133
diff
changeset
|
115 cmd.change(changeRev); |
b9700740553a
Command line tools parse and respect most of command-line arguments
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
133
diff
changeset
|
116 } else { |
b9700740553a
Command line tools parse and respect most of command-line arguments
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
133
diff
changeset
|
117 List<String> revisions = cmdLineOpts.getList("--rev"); |
b9700740553a
Command line tools parse and respect most of command-line arguments
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
133
diff
changeset
|
118 int size = revisions.size(); |
b9700740553a
Command line tools parse and respect most of command-line arguments
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
133
diff
changeset
|
119 if (size > 1) { |
b9700740553a
Command line tools parse and respect most of command-line arguments
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
133
diff
changeset
|
120 cmd.base(Integer.parseInt(revisions.get(size - 2))).revision(Integer.parseInt(revisions.get(size - 1))); |
b9700740553a
Command line tools parse and respect most of command-line arguments
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
133
diff
changeset
|
121 } else if (size > 0) { |
b9700740553a
Command line tools parse and respect most of command-line arguments
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
133
diff
changeset
|
122 cmd.base(Integer.parseInt(revisions.get(0))); |
74
6f1b88693d48
Complete refactoring to org.tmatesoft
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
72
diff
changeset
|
123 } |
55
05829a70b30b
Status operation extracted into separate, cache-friendly class
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
22
diff
changeset
|
124 } |
143
b9700740553a
Command line tools parse and respect most of command-line arguments
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
133
diff
changeset
|
125 cmd.execute(statusHandler); |
b9700740553a
Command line tools parse and respect most of command-line arguments
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
133
diff
changeset
|
126 statusHandler.dump(); |
10
382cfe9463db
Dirstate parsing. DataAccess refactored to allow reuse and control over constants
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
diff
changeset
|
127 } |
382cfe9463db
Dirstate parsing. DataAccess refactored to allow reuse and control over constants
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
diff
changeset
|
128 } |