Mercurial > hg4j
annotate src/org/tmatesoft/hg/core/HgFileInformer.java @ 396:0ae53c32ecef
Straighten out exceptions thrown when file access failed - three is too much
author | Artem Tikhomirov <tikhomirov.artem@gmail.com> |
---|---|
date | Thu, 23 Feb 2012 01:06:24 +0100 |
parents | c7a513d8ce20 |
children | ee8264d80747 |
rev | line source |
---|---|
248
3fbfce107f94
Issue 8: Means to find out information about given file at specific changeset. Inner ManifestRevisionInspector got promoted to ManifestRevision
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
diff
changeset
|
1 /* |
396
0ae53c32ecef
Straighten out exceptions thrown when file access failed - three is too much
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
374
diff
changeset
|
2 * Copyright (c) 2011-2012 TMate Software Ltd |
248
3fbfce107f94
Issue 8: Means to find out information about given file at specific changeset. Inner ManifestRevisionInspector got promoted to ManifestRevision
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
diff
changeset
|
3 * |
3fbfce107f94
Issue 8: Means to find out information about given file at specific changeset. Inner ManifestRevisionInspector got promoted to ManifestRevision
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
diff
changeset
|
4 * This program is free software; you can redistribute it and/or modify |
3fbfce107f94
Issue 8: Means to find out information about given file at specific changeset. Inner ManifestRevisionInspector got promoted to ManifestRevision
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
diff
changeset
|
5 * it under the terms of the GNU General Public License as published by |
3fbfce107f94
Issue 8: Means to find out information about given file at specific changeset. Inner ManifestRevisionInspector got promoted to ManifestRevision
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
diff
changeset
|
6 * the Free Software Foundation; version 2 of the License. |
3fbfce107f94
Issue 8: Means to find out information about given file at specific changeset. Inner ManifestRevisionInspector got promoted to ManifestRevision
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
diff
changeset
|
7 * |
3fbfce107f94
Issue 8: Means to find out information about given file at specific changeset. Inner ManifestRevisionInspector got promoted to ManifestRevision
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
diff
changeset
|
8 * This program is distributed in the hope that it will be useful, |
3fbfce107f94
Issue 8: Means to find out information about given file at specific changeset. Inner ManifestRevisionInspector got promoted to ManifestRevision
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
diff
changeset
|
9 * but WITHOUT ANY WARRANTY; without even the implied warranty of |
3fbfce107f94
Issue 8: Means to find out information about given file at specific changeset. Inner ManifestRevisionInspector got promoted to ManifestRevision
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
diff
changeset
|
10 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
3fbfce107f94
Issue 8: Means to find out information about given file at specific changeset. Inner ManifestRevisionInspector got promoted to ManifestRevision
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
diff
changeset
|
11 * GNU General Public License for more details. |
3fbfce107f94
Issue 8: Means to find out information about given file at specific changeset. Inner ManifestRevisionInspector got promoted to ManifestRevision
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
diff
changeset
|
12 * |
3fbfce107f94
Issue 8: Means to find out information about given file at specific changeset. Inner ManifestRevisionInspector got promoted to ManifestRevision
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
diff
changeset
|
13 * For information on how to redistribute this software under |
3fbfce107f94
Issue 8: Means to find out information about given file at specific changeset. Inner ManifestRevisionInspector got promoted to ManifestRevision
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
diff
changeset
|
14 * the terms of a license other than GNU General Public License |
3fbfce107f94
Issue 8: Means to find out information about given file at specific changeset. Inner ManifestRevisionInspector got promoted to ManifestRevision
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
diff
changeset
|
15 * contact TMate Software at support@hg4j.com |
3fbfce107f94
Issue 8: Means to find out information about given file at specific changeset. Inner ManifestRevisionInspector got promoted to ManifestRevision
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
diff
changeset
|
16 */ |
3fbfce107f94
Issue 8: Means to find out information about given file at specific changeset. Inner ManifestRevisionInspector got promoted to ManifestRevision
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
diff
changeset
|
17 package org.tmatesoft.hg.core; |
3fbfce107f94
Issue 8: Means to find out information about given file at specific changeset. Inner ManifestRevisionInspector got promoted to ManifestRevision
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
diff
changeset
|
18 |
3fbfce107f94
Issue 8: Means to find out information about given file at specific changeset. Inner ManifestRevisionInspector got promoted to ManifestRevision
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
diff
changeset
|
19 import org.tmatesoft.hg.internal.ManifestRevision; |
3fbfce107f94
Issue 8: Means to find out information about given file at specific changeset. Inner ManifestRevisionInspector got promoted to ManifestRevision
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
diff
changeset
|
20 import org.tmatesoft.hg.repo.HgDataFile; |
3fbfce107f94
Issue 8: Means to find out information about given file at specific changeset. Inner ManifestRevisionInspector got promoted to ManifestRevision
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
diff
changeset
|
21 import org.tmatesoft.hg.repo.HgRepository; |
3fbfce107f94
Issue 8: Means to find out information about given file at specific changeset. Inner ManifestRevisionInspector got promoted to ManifestRevision
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
diff
changeset
|
22 import org.tmatesoft.hg.util.Path; |
361
8099939af5fa
Utilize status object to supply more information about manifest check for specific file
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
354
diff
changeset
|
23 import org.tmatesoft.hg.util.Status; |
248
3fbfce107f94
Issue 8: Means to find out information about given file at specific changeset. Inner ManifestRevisionInspector got promoted to ManifestRevision
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
diff
changeset
|
24 |
3fbfce107f94
Issue 8: Means to find out information about given file at specific changeset. Inner ManifestRevisionInspector got promoted to ManifestRevision
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
diff
changeset
|
25 /** |
3fbfce107f94
Issue 8: Means to find out information about given file at specific changeset. Inner ManifestRevisionInspector got promoted to ManifestRevision
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
diff
changeset
|
26 * Primary purpose is to provide information about file revisions at specific changeset. Multiple {@link #check(Path)} calls |
3fbfce107f94
Issue 8: Means to find out information about given file at specific changeset. Inner ManifestRevisionInspector got promoted to ManifestRevision
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
diff
changeset
|
27 * are possible once {@link #changeset(Nodeid)} (and optionally, {@link #followRenames(boolean)}) were set. |
251
8c951645bea0
Some javadoc to explain HgFileInformer
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
248
diff
changeset
|
28 * |
8c951645bea0
Some javadoc to explain HgFileInformer
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
248
diff
changeset
|
29 * <p>Sample: |
8c951645bea0
Some javadoc to explain HgFileInformer
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
248
diff
changeset
|
30 * <pre><code> |
8c951645bea0
Some javadoc to explain HgFileInformer
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
248
diff
changeset
|
31 * HgFileInformer i = new HgFileInformer(hgRepo).changeset(Nodeid.fromString("<40 digits>")).followRenames(true); |
8c951645bea0
Some javadoc to explain HgFileInformer
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
248
diff
changeset
|
32 * if (i.check(file)) { |
8c951645bea0
Some javadoc to explain HgFileInformer
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
248
diff
changeset
|
33 * HgCatCommand catCmd = new HgCatCommand(hgRepo).revision(i.getFileRevision()); |
8c951645bea0
Some javadoc to explain HgFileInformer
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
248
diff
changeset
|
34 * catCmd.execute(...); |
8c951645bea0
Some javadoc to explain HgFileInformer
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
248
diff
changeset
|
35 * ... |
8c951645bea0
Some javadoc to explain HgFileInformer
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
248
diff
changeset
|
36 * } |
8c951645bea0
Some javadoc to explain HgFileInformer
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
248
diff
changeset
|
37 * </pre></code> |
248
3fbfce107f94
Issue 8: Means to find out information about given file at specific changeset. Inner ManifestRevisionInspector got promoted to ManifestRevision
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
diff
changeset
|
38 * |
354
5f9073eabf06
Propagate errors with exceptions up to a end client
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
295
diff
changeset
|
39 * FIXME need better name. It's more about manifest of specific changeset, rather than informing (about) files |
361
8099939af5fa
Utilize status object to supply more information about manifest check for specific file
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
354
diff
changeset
|
40 * TODO may add #manifest(Nodeid) to select manifest according to its revision (not only changeset revision as it's now) |
354
5f9073eabf06
Propagate errors with exceptions up to a end client
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
295
diff
changeset
|
41 * |
248
3fbfce107f94
Issue 8: Means to find out information about given file at specific changeset. Inner ManifestRevisionInspector got promoted to ManifestRevision
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
diff
changeset
|
42 * @author Artem Tikhomirov |
3fbfce107f94
Issue 8: Means to find out information about given file at specific changeset. Inner ManifestRevisionInspector got promoted to ManifestRevision
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
diff
changeset
|
43 * @author TMate Software Ltd. |
3fbfce107f94
Issue 8: Means to find out information about given file at specific changeset. Inner ManifestRevisionInspector got promoted to ManifestRevision
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
diff
changeset
|
44 */ |
3fbfce107f94
Issue 8: Means to find out information about given file at specific changeset. Inner ManifestRevisionInspector got promoted to ManifestRevision
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
diff
changeset
|
45 public class HgFileInformer { |
3fbfce107f94
Issue 8: Means to find out information about given file at specific changeset. Inner ManifestRevisionInspector got promoted to ManifestRevision
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
diff
changeset
|
46 |
3fbfce107f94
Issue 8: Means to find out information about given file at specific changeset. Inner ManifestRevisionInspector got promoted to ManifestRevision
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
diff
changeset
|
47 private final HgRepository repo; |
3fbfce107f94
Issue 8: Means to find out information about given file at specific changeset. Inner ManifestRevisionInspector got promoted to ManifestRevision
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
diff
changeset
|
48 private boolean followRenames; |
3fbfce107f94
Issue 8: Means to find out information about given file at specific changeset. Inner ManifestRevisionInspector got promoted to ManifestRevision
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
diff
changeset
|
49 private Nodeid cset; |
3fbfce107f94
Issue 8: Means to find out information about given file at specific changeset. Inner ManifestRevisionInspector got promoted to ManifestRevision
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
diff
changeset
|
50 private ManifestRevision cachedManifest; |
3fbfce107f94
Issue 8: Means to find out information about given file at specific changeset. Inner ManifestRevisionInspector got promoted to ManifestRevision
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
diff
changeset
|
51 private HgFileRevision fileRevision; |
361
8099939af5fa
Utilize status object to supply more information about manifest check for specific file
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
354
diff
changeset
|
52 private boolean renamed; |
8099939af5fa
Utilize status object to supply more information about manifest check for specific file
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
354
diff
changeset
|
53 private Status checkResult; |
248
3fbfce107f94
Issue 8: Means to find out information about given file at specific changeset. Inner ManifestRevisionInspector got promoted to ManifestRevision
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
diff
changeset
|
54 |
3fbfce107f94
Issue 8: Means to find out information about given file at specific changeset. Inner ManifestRevisionInspector got promoted to ManifestRevision
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
diff
changeset
|
55 public HgFileInformer(HgRepository hgRepo) { |
3fbfce107f94
Issue 8: Means to find out information about given file at specific changeset. Inner ManifestRevisionInspector got promoted to ManifestRevision
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
diff
changeset
|
56 repo = hgRepo; |
3fbfce107f94
Issue 8: Means to find out information about given file at specific changeset. Inner ManifestRevisionInspector got promoted to ManifestRevision
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
diff
changeset
|
57 } |
3fbfce107f94
Issue 8: Means to find out information about given file at specific changeset. Inner ManifestRevisionInspector got promoted to ManifestRevision
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
diff
changeset
|
58 |
251
8c951645bea0
Some javadoc to explain HgFileInformer
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
248
diff
changeset
|
59 /** |
8c951645bea0
Some javadoc to explain HgFileInformer
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
248
diff
changeset
|
60 * Select specific changelog revision |
8c951645bea0
Some javadoc to explain HgFileInformer
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
248
diff
changeset
|
61 * |
8c951645bea0
Some javadoc to explain HgFileInformer
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
248
diff
changeset
|
62 * @param nid changeset identifier |
8c951645bea0
Some javadoc to explain HgFileInformer
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
248
diff
changeset
|
63 * @return <code>this</code> for convenience |
8c951645bea0
Some javadoc to explain HgFileInformer
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
248
diff
changeset
|
64 */ |
248
3fbfce107f94
Issue 8: Means to find out information about given file at specific changeset. Inner ManifestRevisionInspector got promoted to ManifestRevision
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
diff
changeset
|
65 public HgFileInformer changeset(Nodeid nid) { |
274
9fb50c04f03c
Use Nodeid.isNull check instead of NULL.equals
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
251
diff
changeset
|
66 if (nid == null || nid.isNull()) { |
248
3fbfce107f94
Issue 8: Means to find out information about given file at specific changeset. Inner ManifestRevisionInspector got promoted to ManifestRevision
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
diff
changeset
|
67 throw new IllegalArgumentException(); |
3fbfce107f94
Issue 8: Means to find out information about given file at specific changeset. Inner ManifestRevisionInspector got promoted to ManifestRevision
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
diff
changeset
|
68 } |
3fbfce107f94
Issue 8: Means to find out information about given file at specific changeset. Inner ManifestRevisionInspector got promoted to ManifestRevision
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
diff
changeset
|
69 cset = nid; |
3fbfce107f94
Issue 8: Means to find out information about given file at specific changeset. Inner ManifestRevisionInspector got promoted to ManifestRevision
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
diff
changeset
|
70 cachedManifest = null; |
3fbfce107f94
Issue 8: Means to find out information about given file at specific changeset. Inner ManifestRevisionInspector got promoted to ManifestRevision
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
diff
changeset
|
71 fileRevision = null; |
3fbfce107f94
Issue 8: Means to find out information about given file at specific changeset. Inner ManifestRevisionInspector got promoted to ManifestRevision
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
diff
changeset
|
72 return this; |
3fbfce107f94
Issue 8: Means to find out information about given file at specific changeset. Inner ManifestRevisionInspector got promoted to ManifestRevision
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
diff
changeset
|
73 } |
251
8c951645bea0
Some javadoc to explain HgFileInformer
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
248
diff
changeset
|
74 |
8c951645bea0
Some javadoc to explain HgFileInformer
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
248
diff
changeset
|
75 /** |
8c951645bea0
Some javadoc to explain HgFileInformer
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
248
diff
changeset
|
76 * Whether to check file origins, default is false (look up only the name supplied) |
8c951645bea0
Some javadoc to explain HgFileInformer
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
248
diff
changeset
|
77 * |
8c951645bea0
Some javadoc to explain HgFileInformer
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
248
diff
changeset
|
78 * @param follow <code>true</code> to check copy/rename origin of the file if it is a copy. |
8c951645bea0
Some javadoc to explain HgFileInformer
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
248
diff
changeset
|
79 * @return <code>this</code> for convenience |
8c951645bea0
Some javadoc to explain HgFileInformer
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
248
diff
changeset
|
80 */ |
248
3fbfce107f94
Issue 8: Means to find out information about given file at specific changeset. Inner ManifestRevisionInspector got promoted to ManifestRevision
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
diff
changeset
|
81 public HgFileInformer followRenames(boolean follow) { |
3fbfce107f94
Issue 8: Means to find out information about given file at specific changeset. Inner ManifestRevisionInspector got promoted to ManifestRevision
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
diff
changeset
|
82 followRenames = follow; |
3fbfce107f94
Issue 8: Means to find out information about given file at specific changeset. Inner ManifestRevisionInspector got promoted to ManifestRevision
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
diff
changeset
|
83 fileRevision = null; |
3fbfce107f94
Issue 8: Means to find out information about given file at specific changeset. Inner ManifestRevisionInspector got promoted to ManifestRevision
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
diff
changeset
|
84 return this; |
3fbfce107f94
Issue 8: Means to find out information about given file at specific changeset. Inner ManifestRevisionInspector got promoted to ManifestRevision
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
diff
changeset
|
85 } |
3fbfce107f94
Issue 8: Means to find out information about given file at specific changeset. Inner ManifestRevisionInspector got promoted to ManifestRevision
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
diff
changeset
|
86 |
251
8c951645bea0
Some javadoc to explain HgFileInformer
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
248
diff
changeset
|
87 /** |
361
8099939af5fa
Utilize status object to supply more information about manifest check for specific file
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
354
diff
changeset
|
88 * Shortcut to perform {@link #check(Path)} and {@link #exists()}. Result of the check may be accessed via {@link #getCheckStatus()}. |
251
8c951645bea0
Some javadoc to explain HgFileInformer
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
248
diff
changeset
|
89 * |
8c951645bea0
Some javadoc to explain HgFileInformer
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
248
diff
changeset
|
90 * @param file name of the file in question |
8c951645bea0
Some javadoc to explain HgFileInformer
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
248
diff
changeset
|
91 * @return <code>true</code> if file is known at the selected changeset. |
8c951645bea0
Some javadoc to explain HgFileInformer
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
248
diff
changeset
|
92 * @throws IllegalArgumentException if {@link #changeset(Nodeid)} not specified or file argument is bad. |
361
8099939af5fa
Utilize status object to supply more information about manifest check for specific file
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
354
diff
changeset
|
93 * @throws HgInvalidControlFileException if access to revlog index/data entry failed |
251
8c951645bea0
Some javadoc to explain HgFileInformer
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
248
diff
changeset
|
94 */ |
361
8099939af5fa
Utilize status object to supply more information about manifest check for specific file
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
354
diff
changeset
|
95 public boolean checkExists(Path file) throws HgInvalidControlFileException { |
8099939af5fa
Utilize status object to supply more information about manifest check for specific file
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
354
diff
changeset
|
96 check(file); |
8099939af5fa
Utilize status object to supply more information about manifest check for specific file
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
354
diff
changeset
|
97 if (!checkResult.isOk() && checkResult.getException() instanceof HgInvalidControlFileException) { |
8099939af5fa
Utilize status object to supply more information about manifest check for specific file
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
354
diff
changeset
|
98 throw (HgInvalidControlFileException) checkResult.getException(); |
8099939af5fa
Utilize status object to supply more information about manifest check for specific file
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
354
diff
changeset
|
99 } |
8099939af5fa
Utilize status object to supply more information about manifest check for specific file
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
354
diff
changeset
|
100 return checkResult.isOk() && exists(); |
8099939af5fa
Utilize status object to supply more information about manifest check for specific file
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
354
diff
changeset
|
101 } |
8099939af5fa
Utilize status object to supply more information about manifest check for specific file
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
354
diff
changeset
|
102 |
8099939af5fa
Utilize status object to supply more information about manifest check for specific file
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
354
diff
changeset
|
103 /** |
8099939af5fa
Utilize status object to supply more information about manifest check for specific file
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
354
diff
changeset
|
104 * Find file (or its origin, if {@link #followRenames(boolean)} was set to <code>true</code>) among files known at specified {@link #changeset(Nodeid)}. |
8099939af5fa
Utilize status object to supply more information about manifest check for specific file
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
354
diff
changeset
|
105 * |
8099939af5fa
Utilize status object to supply more information about manifest check for specific file
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
354
diff
changeset
|
106 * @param file name of the file in question |
8099939af5fa
Utilize status object to supply more information about manifest check for specific file
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
354
diff
changeset
|
107 * @return status object that describes outcome, {@link Status#isOk() Ok} status indicates successful completion of the operation, but doesn't imply |
8099939af5fa
Utilize status object to supply more information about manifest check for specific file
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
354
diff
changeset
|
108 * file existence, use {@link #exists()} for that purpose. Message of the status may provide further hints on what exactly had happened. |
8099939af5fa
Utilize status object to supply more information about manifest check for specific file
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
354
diff
changeset
|
109 * @throws IllegalArgumentException if {@link #changeset(Nodeid)} not specified or file argument is bad. |
8099939af5fa
Utilize status object to supply more information about manifest check for specific file
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
354
diff
changeset
|
110 */ |
8099939af5fa
Utilize status object to supply more information about manifest check for specific file
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
354
diff
changeset
|
111 public Status check(Path file) { |
248
3fbfce107f94
Issue 8: Means to find out information about given file at specific changeset. Inner ManifestRevisionInspector got promoted to ManifestRevision
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
diff
changeset
|
112 fileRevision = null; |
361
8099939af5fa
Utilize status object to supply more information about manifest check for specific file
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
354
diff
changeset
|
113 checkResult = null; |
248
3fbfce107f94
Issue 8: Means to find out information about given file at specific changeset. Inner ManifestRevisionInspector got promoted to ManifestRevision
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
diff
changeset
|
114 renamed = false; |
3fbfce107f94
Issue 8: Means to find out information about given file at specific changeset. Inner ManifestRevisionInspector got promoted to ManifestRevision
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
diff
changeset
|
115 if (cset == null || file == null || file.isDirectory()) { |
3fbfce107f94
Issue 8: Means to find out information about given file at specific changeset. Inner ManifestRevisionInspector got promoted to ManifestRevision
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
diff
changeset
|
116 throw new IllegalArgumentException(); |
3fbfce107f94
Issue 8: Means to find out information about given file at specific changeset. Inner ManifestRevisionInspector got promoted to ManifestRevision
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
diff
changeset
|
117 } |
3fbfce107f94
Issue 8: Means to find out information about given file at specific changeset. Inner ManifestRevisionInspector got promoted to ManifestRevision
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
diff
changeset
|
118 HgDataFile dataFile = repo.getFileNode(file); |
3fbfce107f94
Issue 8: Means to find out information about given file at specific changeset. Inner ManifestRevisionInspector got promoted to ManifestRevision
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
diff
changeset
|
119 if (!dataFile.exists()) { |
361
8099939af5fa
Utilize status object to supply more information about manifest check for specific file
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
354
diff
changeset
|
120 checkResult = new Status(Status.Kind.OK, String.format("File named %s is not known in the repository", file)); |
8099939af5fa
Utilize status object to supply more information about manifest check for specific file
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
354
diff
changeset
|
121 return checkResult; |
248
3fbfce107f94
Issue 8: Means to find out information about given file at specific changeset. Inner ManifestRevisionInspector got promoted to ManifestRevision
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
diff
changeset
|
122 } |
361
8099939af5fa
Utilize status object to supply more information about manifest check for specific file
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
354
diff
changeset
|
123 Nodeid toExtract = null; |
396
0ae53c32ecef
Straighten out exceptions thrown when file access failed - three is too much
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
374
diff
changeset
|
124 String phaseMsg = "Extract manifest revision failed"; |
248
3fbfce107f94
Issue 8: Means to find out information about given file at specific changeset. Inner ManifestRevisionInspector got promoted to ManifestRevision
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
diff
changeset
|
125 try { |
361
8099939af5fa
Utilize status object to supply more information about manifest check for specific file
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
354
diff
changeset
|
126 if (cachedManifest == null) { |
367
2fadf8695f8a
Use 'revision index' instead of the vague 'local revision number' concept in the API
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
361
diff
changeset
|
127 int csetRev = repo.getChangelog().getRevisionIndex(cset); |
361
8099939af5fa
Utilize status object to supply more information about manifest check for specific file
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
354
diff
changeset
|
128 cachedManifest = new ManifestRevision(null, null); // XXX how about context and cached manifest revisions |
8099939af5fa
Utilize status object to supply more information about manifest check for specific file
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
354
diff
changeset
|
129 repo.getManifest().walk(csetRev, csetRev, cachedManifest); |
367
2fadf8695f8a
Use 'revision index' instead of the vague 'local revision number' concept in the API
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
361
diff
changeset
|
130 // cachedManifest shall be meaningful - changelog.getRevisionIndex() above ensures we've got version that exists. |
361
8099939af5fa
Utilize status object to supply more information about manifest check for specific file
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
354
diff
changeset
|
131 } |
8099939af5fa
Utilize status object to supply more information about manifest check for specific file
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
354
diff
changeset
|
132 toExtract = cachedManifest.nodeid(file); |
396
0ae53c32ecef
Straighten out exceptions thrown when file access failed - three is too much
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
374
diff
changeset
|
133 phaseMsg = "Follow copy/rename failed"; |
248
3fbfce107f94
Issue 8: Means to find out information about given file at specific changeset. Inner ManifestRevisionInspector got promoted to ManifestRevision
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
diff
changeset
|
134 if (toExtract == null && followRenames) { |
3fbfce107f94
Issue 8: Means to find out information about given file at specific changeset. Inner ManifestRevisionInspector got promoted to ManifestRevision
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
diff
changeset
|
135 while (toExtract == null && dataFile.isCopy()) { |
3fbfce107f94
Issue 8: Means to find out information about given file at specific changeset. Inner ManifestRevisionInspector got promoted to ManifestRevision
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
diff
changeset
|
136 renamed = true; |
3fbfce107f94
Issue 8: Means to find out information about given file at specific changeset. Inner ManifestRevisionInspector got promoted to ManifestRevision
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
diff
changeset
|
137 file = dataFile.getCopySourceName(); |
3fbfce107f94
Issue 8: Means to find out information about given file at specific changeset. Inner ManifestRevisionInspector got promoted to ManifestRevision
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
diff
changeset
|
138 dataFile = repo.getFileNode(file); |
285
6dbbc53fc46d
Use Path instead of plain String for manifest file names
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
274
diff
changeset
|
139 toExtract = cachedManifest.nodeid(file); |
248
3fbfce107f94
Issue 8: Means to find out information about given file at specific changeset. Inner ManifestRevisionInspector got promoted to ManifestRevision
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
diff
changeset
|
140 } |
3fbfce107f94
Issue 8: Means to find out information about given file at specific changeset. Inner ManifestRevisionInspector got promoted to ManifestRevision
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
diff
changeset
|
141 } |
396
0ae53c32ecef
Straighten out exceptions thrown when file access failed - three is too much
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
374
diff
changeset
|
142 } catch (HgException ex) { |
0ae53c32ecef
Straighten out exceptions thrown when file access failed - three is too much
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
374
diff
changeset
|
143 checkResult = new Status(Status.Kind.ERROR, phaseMsg, ex); |
361
8099939af5fa
Utilize status object to supply more information about manifest check for specific file
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
354
diff
changeset
|
144 return checkResult; |
248
3fbfce107f94
Issue 8: Means to find out information about given file at specific changeset. Inner ManifestRevisionInspector got promoted to ManifestRevision
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
diff
changeset
|
145 } |
3fbfce107f94
Issue 8: Means to find out information about given file at specific changeset. Inner ManifestRevisionInspector got promoted to ManifestRevision
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
diff
changeset
|
146 if (toExtract != null) { |
3fbfce107f94
Issue 8: Means to find out information about given file at specific changeset. Inner ManifestRevisionInspector got promoted to ManifestRevision
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
diff
changeset
|
147 fileRevision = new HgFileRevision(repo, toExtract, dataFile.getPath()); |
361
8099939af5fa
Utilize status object to supply more information about manifest check for specific file
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
354
diff
changeset
|
148 checkResult = new Status(Status.Kind.OK, String.format("File %s, revision %s found at changeset %s", dataFile.getPath(), toExtract.shortNotation(), cset.shortNotation())); |
8099939af5fa
Utilize status object to supply more information about manifest check for specific file
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
354
diff
changeset
|
149 return checkResult; |
8099939af5fa
Utilize status object to supply more information about manifest check for specific file
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
354
diff
changeset
|
150 } |
374
c7a513d8ce20
Bad message fixed
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
367
diff
changeset
|
151 checkResult = new Status(Status.Kind.OK, String.format("File %s nor its origins were known at repository %s revision", file, cset.shortNotation())); |
361
8099939af5fa
Utilize status object to supply more information about manifest check for specific file
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
354
diff
changeset
|
152 return checkResult; |
8099939af5fa
Utilize status object to supply more information about manifest check for specific file
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
354
diff
changeset
|
153 } |
8099939af5fa
Utilize status object to supply more information about manifest check for specific file
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
354
diff
changeset
|
154 |
8099939af5fa
Utilize status object to supply more information about manifest check for specific file
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
354
diff
changeset
|
155 /** |
8099939af5fa
Utilize status object to supply more information about manifest check for specific file
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
354
diff
changeset
|
156 * Re-get latest check status object |
8099939af5fa
Utilize status object to supply more information about manifest check for specific file
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
354
diff
changeset
|
157 */ |
8099939af5fa
Utilize status object to supply more information about manifest check for specific file
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
354
diff
changeset
|
158 public Status getCheckStatus() { |
8099939af5fa
Utilize status object to supply more information about manifest check for specific file
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
354
diff
changeset
|
159 assertCheckRan(); |
8099939af5fa
Utilize status object to supply more information about manifest check for specific file
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
354
diff
changeset
|
160 return checkResult; |
248
3fbfce107f94
Issue 8: Means to find out information about given file at specific changeset. Inner ManifestRevisionInspector got promoted to ManifestRevision
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
diff
changeset
|
161 } |
3fbfce107f94
Issue 8: Means to find out information about given file at specific changeset. Inner ManifestRevisionInspector got promoted to ManifestRevision
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
diff
changeset
|
162 |
3fbfce107f94
Issue 8: Means to find out information about given file at specific changeset. Inner ManifestRevisionInspector got promoted to ManifestRevision
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
diff
changeset
|
163 /** |
3fbfce107f94
Issue 8: Means to find out information about given file at specific changeset. Inner ManifestRevisionInspector got promoted to ManifestRevision
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
diff
changeset
|
164 * @return result of the last {@link #check(Path)} call. |
3fbfce107f94
Issue 8: Means to find out information about given file at specific changeset. Inner ManifestRevisionInspector got promoted to ManifestRevision
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
diff
changeset
|
165 */ |
3fbfce107f94
Issue 8: Means to find out information about given file at specific changeset. Inner ManifestRevisionInspector got promoted to ManifestRevision
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
diff
changeset
|
166 public boolean exists() { |
3fbfce107f94
Issue 8: Means to find out information about given file at specific changeset. Inner ManifestRevisionInspector got promoted to ManifestRevision
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
diff
changeset
|
167 assertCheckRan(); |
3fbfce107f94
Issue 8: Means to find out information about given file at specific changeset. Inner ManifestRevisionInspector got promoted to ManifestRevision
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
diff
changeset
|
168 return fileRevision != null; |
3fbfce107f94
Issue 8: Means to find out information about given file at specific changeset. Inner ManifestRevisionInspector got promoted to ManifestRevision
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
diff
changeset
|
169 } |
3fbfce107f94
Issue 8: Means to find out information about given file at specific changeset. Inner ManifestRevisionInspector got promoted to ManifestRevision
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
diff
changeset
|
170 |
3fbfce107f94
Issue 8: Means to find out information about given file at specific changeset. Inner ManifestRevisionInspector got promoted to ManifestRevision
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
diff
changeset
|
171 /** |
3fbfce107f94
Issue 8: Means to find out information about given file at specific changeset. Inner ManifestRevisionInspector got promoted to ManifestRevision
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
diff
changeset
|
172 * @return <code>true</code> if checked file was known by another name at the time of specified changeset. |
3fbfce107f94
Issue 8: Means to find out information about given file at specific changeset. Inner ManifestRevisionInspector got promoted to ManifestRevision
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
diff
changeset
|
173 */ |
3fbfce107f94
Issue 8: Means to find out information about given file at specific changeset. Inner ManifestRevisionInspector got promoted to ManifestRevision
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
diff
changeset
|
174 public boolean hasAnotherName() { |
3fbfce107f94
Issue 8: Means to find out information about given file at specific changeset. Inner ManifestRevisionInspector got promoted to ManifestRevision
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
diff
changeset
|
175 assertCheckRan(); |
3fbfce107f94
Issue 8: Means to find out information about given file at specific changeset. Inner ManifestRevisionInspector got promoted to ManifestRevision
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
diff
changeset
|
176 return renamed; |
3fbfce107f94
Issue 8: Means to find out information about given file at specific changeset. Inner ManifestRevisionInspector got promoted to ManifestRevision
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
diff
changeset
|
177 } |
3fbfce107f94
Issue 8: Means to find out information about given file at specific changeset. Inner ManifestRevisionInspector got promoted to ManifestRevision
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
diff
changeset
|
178 |
3fbfce107f94
Issue 8: Means to find out information about given file at specific changeset. Inner ManifestRevisionInspector got promoted to ManifestRevision
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
diff
changeset
|
179 /** |
3fbfce107f94
Issue 8: Means to find out information about given file at specific changeset. Inner ManifestRevisionInspector got promoted to ManifestRevision
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
diff
changeset
|
180 * @return holder for file revision information |
3fbfce107f94
Issue 8: Means to find out information about given file at specific changeset. Inner ManifestRevisionInspector got promoted to ManifestRevision
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
diff
changeset
|
181 */ |
3fbfce107f94
Issue 8: Means to find out information about given file at specific changeset. Inner ManifestRevisionInspector got promoted to ManifestRevision
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
diff
changeset
|
182 public HgFileRevision getFileRevision() { |
3fbfce107f94
Issue 8: Means to find out information about given file at specific changeset. Inner ManifestRevisionInspector got promoted to ManifestRevision
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
diff
changeset
|
183 assertCheckRan(); |
3fbfce107f94
Issue 8: Means to find out information about given file at specific changeset. Inner ManifestRevisionInspector got promoted to ManifestRevision
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
diff
changeset
|
184 return fileRevision; |
3fbfce107f94
Issue 8: Means to find out information about given file at specific changeset. Inner ManifestRevisionInspector got promoted to ManifestRevision
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
diff
changeset
|
185 } |
3fbfce107f94
Issue 8: Means to find out information about given file at specific changeset. Inner ManifestRevisionInspector got promoted to ManifestRevision
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
diff
changeset
|
186 |
3fbfce107f94
Issue 8: Means to find out information about given file at specific changeset. Inner ManifestRevisionInspector got promoted to ManifestRevision
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
diff
changeset
|
187 /** |
3fbfce107f94
Issue 8: Means to find out information about given file at specific changeset. Inner ManifestRevisionInspector got promoted to ManifestRevision
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
diff
changeset
|
188 * Name of the checked file as it was known at the time of the specified changeset. |
3fbfce107f94
Issue 8: Means to find out information about given file at specific changeset. Inner ManifestRevisionInspector got promoted to ManifestRevision
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
diff
changeset
|
189 * |
3fbfce107f94
Issue 8: Means to find out information about given file at specific changeset. Inner ManifestRevisionInspector got promoted to ManifestRevision
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
diff
changeset
|
190 * @return handy shortcut for <code>getFileRevision().getPath()</code> |
3fbfce107f94
Issue 8: Means to find out information about given file at specific changeset. Inner ManifestRevisionInspector got promoted to ManifestRevision
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
diff
changeset
|
191 */ |
3fbfce107f94
Issue 8: Means to find out information about given file at specific changeset. Inner ManifestRevisionInspector got promoted to ManifestRevision
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
diff
changeset
|
192 public Path filename() { |
3fbfce107f94
Issue 8: Means to find out information about given file at specific changeset. Inner ManifestRevisionInspector got promoted to ManifestRevision
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
diff
changeset
|
193 assertCheckRan(); |
3fbfce107f94
Issue 8: Means to find out information about given file at specific changeset. Inner ManifestRevisionInspector got promoted to ManifestRevision
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
diff
changeset
|
194 return fileRevision.getPath(); |
3fbfce107f94
Issue 8: Means to find out information about given file at specific changeset. Inner ManifestRevisionInspector got promoted to ManifestRevision
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
diff
changeset
|
195 } |
3fbfce107f94
Issue 8: Means to find out information about given file at specific changeset. Inner ManifestRevisionInspector got promoted to ManifestRevision
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
diff
changeset
|
196 |
3fbfce107f94
Issue 8: Means to find out information about given file at specific changeset. Inner ManifestRevisionInspector got promoted to ManifestRevision
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
diff
changeset
|
197 /** |
3fbfce107f94
Issue 8: Means to find out information about given file at specific changeset. Inner ManifestRevisionInspector got promoted to ManifestRevision
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
diff
changeset
|
198 * Revision of the checked file |
3fbfce107f94
Issue 8: Means to find out information about given file at specific changeset. Inner ManifestRevisionInspector got promoted to ManifestRevision
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
diff
changeset
|
199 * |
3fbfce107f94
Issue 8: Means to find out information about given file at specific changeset. Inner ManifestRevisionInspector got promoted to ManifestRevision
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
diff
changeset
|
200 * @return handy shortcut for <code>getFileRevision().getRevision()</code> |
3fbfce107f94
Issue 8: Means to find out information about given file at specific changeset. Inner ManifestRevisionInspector got promoted to ManifestRevision
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
diff
changeset
|
201 */ |
3fbfce107f94
Issue 8: Means to find out information about given file at specific changeset. Inner ManifestRevisionInspector got promoted to ManifestRevision
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
diff
changeset
|
202 public Nodeid revision() { |
3fbfce107f94
Issue 8: Means to find out information about given file at specific changeset. Inner ManifestRevisionInspector got promoted to ManifestRevision
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
diff
changeset
|
203 assertCheckRan(); |
3fbfce107f94
Issue 8: Means to find out information about given file at specific changeset. Inner ManifestRevisionInspector got promoted to ManifestRevision
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
diff
changeset
|
204 return fileRevision.getRevision(); |
3fbfce107f94
Issue 8: Means to find out information about given file at specific changeset. Inner ManifestRevisionInspector got promoted to ManifestRevision
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
diff
changeset
|
205 } |
3fbfce107f94
Issue 8: Means to find out information about given file at specific changeset. Inner ManifestRevisionInspector got promoted to ManifestRevision
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
diff
changeset
|
206 |
3fbfce107f94
Issue 8: Means to find out information about given file at specific changeset. Inner ManifestRevisionInspector got promoted to ManifestRevision
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
diff
changeset
|
207 private void assertCheckRan() { |
361
8099939af5fa
Utilize status object to supply more information about manifest check for specific file
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
354
diff
changeset
|
208 if (checkResult == null) { |
248
3fbfce107f94
Issue 8: Means to find out information about given file at specific changeset. Inner ManifestRevisionInspector got promoted to ManifestRevision
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
diff
changeset
|
209 throw new HgBadStateException("Shall invoke #check(Path) first"); |
3fbfce107f94
Issue 8: Means to find out information about given file at specific changeset. Inner ManifestRevisionInspector got promoted to ManifestRevision
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
diff
changeset
|
210 } |
3fbfce107f94
Issue 8: Means to find out information about given file at specific changeset. Inner ManifestRevisionInspector got promoted to ManifestRevision
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
diff
changeset
|
211 } |
3fbfce107f94
Issue 8: Means to find out information about given file at specific changeset. Inner ManifestRevisionInspector got promoted to ManifestRevision
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
diff
changeset
|
212 } |