comparison cmdline/org/tmatesoft/hg/console/Manifest.java @ 415:ee8264d80747

Explicit constant for regular file flags, access to flags for a given file revision
author Artem Tikhomirov <tikhomirov.artem@gmail.com>
date Thu, 22 Mar 2012 18:54:11 +0100
parents 45dc79e545f5
children 9c9c442b5f2e
comparison
equal deleted inserted replaced
414:bb278ccf9866 415:ee8264d80747
1 /* 1 /*
2 * Copyright (c) 2010-2011 TMate Software Ltd 2 * Copyright (c) 2010-2012 TMate Software Ltd
3 * 3 *
4 * This program is free software; you can redistribute it and/or modify 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 5 * it under the terms of the GNU General Public License as published by
6 * the Free Software Foundation; version 2 of the License. 6 * the Free Software Foundation; version 2 of the License.
7 * 7 *
18 18
19 import static org.tmatesoft.hg.console.Options.asSet; 19 import static org.tmatesoft.hg.console.Options.asSet;
20 import static org.tmatesoft.hg.repo.HgRepository.TIP; 20 import static org.tmatesoft.hg.repo.HgRepository.TIP;
21 21
22 import org.tmatesoft.hg.core.HgFileRevision; 22 import org.tmatesoft.hg.core.HgFileRevision;
23 import org.tmatesoft.hg.core.HgInvalidControlFileException;
24 import org.tmatesoft.hg.core.HgInvalidRevisionException;
23 import org.tmatesoft.hg.core.HgManifestCommand; 25 import org.tmatesoft.hg.core.HgManifestCommand;
24 import org.tmatesoft.hg.core.Nodeid; 26 import org.tmatesoft.hg.core.Nodeid;
27 import org.tmatesoft.hg.repo.HgManifest;
25 import org.tmatesoft.hg.repo.HgRepository; 28 import org.tmatesoft.hg.repo.HgRepository;
26 import org.tmatesoft.hg.util.Path; 29 import org.tmatesoft.hg.util.Path;
27 30
28 31
29 /** 32 /**
47 public void begin(Nodeid manifestRevision) { 50 public void begin(Nodeid manifestRevision) {
48 } 51 }
49 public void dir(Path p) { 52 public void dir(Path p) {
50 } 53 }
51 public void file(HgFileRevision fileRevision) { 54 public void file(HgFileRevision fileRevision) {
52 if (debug) { 55 try {
53 System.out.print(fileRevision.getRevision());; 56 if (debug) {
57 System.out.print(fileRevision.getRevision());;
58 }
59 if (debug || verbose) {
60 HgManifest.Flags flags = fileRevision.getFileFlags();
61 Object s;
62 if (flags == HgManifest.Flags.RegularFile) {
63 s = Integer.toOctalString(0644);
64 } else if (flags == HgManifest.Flags.Exec) {
65 s = Integer.toOctalString(0755);
66 } else if (flags == HgManifest.Flags.Link) {
67 s = "lnk";
68 } else {
69 s = String.valueOf(flags);
70 }
71 System.out.printf(" %s ", s);
72 }
73 System.out.println(fileRevision.getPath());
74 } catch (HgInvalidControlFileException e) {
75 e.printStackTrace();
76 } catch (HgInvalidRevisionException e) {
77 e.printStackTrace();
54 } 78 }
55 if (debug || verbose) {
56 System.out.print(" 644"); // FIXME real flags!
57 System.out.print(" ");
58 }
59 System.out.println(fileRevision.getPath());
60 } 79 }
61 80
62 public void end(Nodeid manifestRevision) { 81 public void end(Nodeid manifestRevision) {
63 } 82 }
64 }; 83 };