comparison hg4j-cli/src/main/java/org/tmatesoft/hg/console/Manifest.java @ 213:6ec4af642ba8 gradle

Project uses Gradle for build - actual changes
author Alexander Kitaev <kitaev@gmail.com>
date Tue, 10 May 2011 10:52:53 +0200
parents
children
comparison
equal deleted inserted replaced
212:edb2e2829352 213:6ec4af642ba8
1 /*
2 * Copyright (c) 2010-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@hg4j.com
16 */
17 package org.tmatesoft.hg.console;
18
19 import static org.tmatesoft.hg.repo.HgRepository.TIP;
20
21 import org.tmatesoft.hg.core.HgLogCommand.FileRevision;
22 import org.tmatesoft.hg.core.HgManifestCommand;
23 import org.tmatesoft.hg.core.Nodeid;
24 import org.tmatesoft.hg.repo.HgRepository;
25 import org.tmatesoft.hg.util.Path;
26
27
28 /**
29 *
30 * @author Artem Tikhomirov
31 * @author TMate Software Ltd.
32 */
33 public class Manifest {
34
35 public static void main(String[] args) throws Exception {
36 Options cmdLineOpts = Options.parse(args);
37 HgRepository hgRepo = cmdLineOpts.findRepository();
38 if (hgRepo.isInvalid()) {
39 System.err.printf("Can't find repository in: %s\n", hgRepo.getLocation());
40 return;
41 }
42 final boolean debug = cmdLineOpts.getBoolean("--debug");
43 final boolean verbose = cmdLineOpts.getBoolean("-v", "--verbose");
44 HgManifestCommand.Handler h = new HgManifestCommand.Handler() {
45
46 public void begin(Nodeid manifestRevision) {
47 }
48 public void dir(Path p) {
49 }
50 public void file(FileRevision fileRevision) {
51 if (debug) {
52 System.out.print(fileRevision.getRevision());;
53 }
54 if (debug || verbose) {
55 System.out.print(" 644"); // FIXME real flags!
56 System.out.print(" ");
57 }
58 System.out.println(fileRevision.getPath());
59 }
60
61 public void end(Nodeid manifestRevision) {
62 }
63 };
64 int rev = cmdLineOpts.getSingleInt(TIP, "-r", "--rev");
65 new HgManifestCommand(hgRepo).dirs(false).revision(rev).execute(h);
66 }
67 }