Mercurial > hg4j
annotate src/org/tmatesoft/hg/core/HgChangesetFileSneaker.java @ 666:27a3ddedd6cc
Added tag v1.2m1 for changeset dde18bc7053b
author | Artem Tikhomirov <tikhomirov.artem@gmail.com> |
---|---|
date | Wed, 10 Jul 2013 20:22:07 +0200 |
parents | 3ca4ae7bdd38 |
children | b286222158be |
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; |
423
9c9c442b5f2e
Major refactoring of exception handling. Low-level API uses RuntimeExceptions, while checked are left for higher level
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
417
diff
changeset
|
21 import org.tmatesoft.hg.repo.HgInvalidStateException; |
415
ee8264d80747
Explicit constant for regular file flags, access to flags for a given file revision
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
396
diff
changeset
|
22 import org.tmatesoft.hg.repo.HgManifest; |
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
|
23 import org.tmatesoft.hg.repo.HgRepository; |
423
9c9c442b5f2e
Major refactoring of exception handling. Low-level API uses RuntimeExceptions, while checked are left for higher level
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
417
diff
changeset
|
24 import org.tmatesoft.hg.repo.HgRuntimeException; |
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
|
25 import org.tmatesoft.hg.util.Path; |
454
36fd1fd06492
oth.util.Status renamed to Outcome as the noun is too overloaded, especially in scm
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
434
diff
changeset
|
26 import org.tmatesoft.hg.util.Outcome; |
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
|
27 |
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
|
28 /** |
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
|
29 * 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
|
30 * 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
|
31 * |
8c951645bea0
Some javadoc to explain HgFileInformer
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
248
diff
changeset
|
32 * <p>Sample: |
8c951645bea0
Some javadoc to explain HgFileInformer
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
248
diff
changeset
|
33 * <pre><code> |
417
ccd7d25e5aea
New and better name for HgFileInformer - HgChangesetFileSneaker. Explain (comments) ties between HgManifest, HgDataFile, HgChangesetFileSneaker and reasons for method placement
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
415
diff
changeset
|
34 * HgChangesetFileSneaker i = new HgChangesetFileSneaker(hgRepo).changeset(Nodeid.fromString("<40 digits>")).followRenames(true); |
251
8c951645bea0
Some javadoc to explain HgFileInformer
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
248
diff
changeset
|
35 * if (i.check(file)) { |
8c951645bea0
Some javadoc to explain HgFileInformer
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
248
diff
changeset
|
36 * HgCatCommand catCmd = new HgCatCommand(hgRepo).revision(i.getFileRevision()); |
8c951645bea0
Some javadoc to explain HgFileInformer
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
248
diff
changeset
|
37 * catCmd.execute(...); |
8c951645bea0
Some javadoc to explain HgFileInformer
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
248
diff
changeset
|
38 * ... |
8c951645bea0
Some javadoc to explain HgFileInformer
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
248
diff
changeset
|
39 * } |
8c951645bea0
Some javadoc to explain HgFileInformer
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
248
diff
changeset
|
40 * </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
|
41 * |
417
ccd7d25e5aea
New and better name for HgFileInformer - HgChangesetFileSneaker. Explain (comments) ties between HgManifest, HgDataFile, HgChangesetFileSneaker and reasons for method placement
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
415
diff
changeset
|
42 * 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
|
43 * |
417
ccd7d25e5aea
New and better name for HgFileInformer - HgChangesetFileSneaker. Explain (comments) ties between HgManifest, HgDataFile, HgChangesetFileSneaker and reasons for method placement
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
415
diff
changeset
|
44 * <p>Unlike {@link HgManifest#getFileRevision(int, Path)}, this class is useful when few files from the same changeset have to be inspected |
ccd7d25e5aea
New and better name for HgFileInformer - HgChangesetFileSneaker. Explain (comments) ties between HgManifest, HgDataFile, HgChangesetFileSneaker and reasons for method placement
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
415
diff
changeset
|
45 * |
ccd7d25e5aea
New and better name for HgFileInformer - HgChangesetFileSneaker. Explain (comments) ties between HgManifest, HgDataFile, HgChangesetFileSneaker and reasons for method placement
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
415
diff
changeset
|
46 * @see HgManifest#getFileRevision(int, Path) |
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
|
47 * @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
|
48 * @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
|
49 */ |
434
7e1912b4ce99
Record few known issues while skimming through TODOs
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
427
diff
changeset
|
50 public final class HgChangesetFileSneaker { |
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
|
51 |
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
|
52 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
|
53 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
|
54 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
|
55 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
|
56 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
|
57 private boolean renamed; |
454
36fd1fd06492
oth.util.Status renamed to Outcome as the noun is too overloaded, especially in scm
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
434
diff
changeset
|
58 private Outcome 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
|
59 |
417
ccd7d25e5aea
New and better name for HgFileInformer - HgChangesetFileSneaker. Explain (comments) ties between HgManifest, HgDataFile, HgChangesetFileSneaker and reasons for method placement
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
415
diff
changeset
|
60 public HgChangesetFileSneaker(HgRepository hgRepo) { |
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
|
61 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
|
62 } |
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
|
63 |
251
8c951645bea0
Some javadoc to explain HgFileInformer
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
248
diff
changeset
|
64 /** |
8c951645bea0
Some javadoc to explain HgFileInformer
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
248
diff
changeset
|
65 * Select specific changelog revision |
8c951645bea0
Some javadoc to explain HgFileInformer
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
248
diff
changeset
|
66 * |
8c951645bea0
Some javadoc to explain HgFileInformer
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
248
diff
changeset
|
67 * @param nid changeset identifier |
8c951645bea0
Some javadoc to explain HgFileInformer
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
248
diff
changeset
|
68 * @return <code>this</code> for convenience |
8c951645bea0
Some javadoc to explain HgFileInformer
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
248
diff
changeset
|
69 */ |
417
ccd7d25e5aea
New and better name for HgFileInformer - HgChangesetFileSneaker. Explain (comments) ties between HgManifest, HgDataFile, HgChangesetFileSneaker and reasons for method placement
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
415
diff
changeset
|
70 public HgChangesetFileSneaker changeset(Nodeid nid) { |
274
9fb50c04f03c
Use Nodeid.isNull check instead of NULL.equals
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
251
diff
changeset
|
71 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
|
72 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
|
73 } |
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
|
74 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
|
75 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
|
76 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
|
77 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
|
78 } |
251
8c951645bea0
Some javadoc to explain HgFileInformer
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
248
diff
changeset
|
79 |
8c951645bea0
Some javadoc to explain HgFileInformer
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
248
diff
changeset
|
80 /** |
8c951645bea0
Some javadoc to explain HgFileInformer
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
248
diff
changeset
|
81 * 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
|
82 * |
8c951645bea0
Some javadoc to explain HgFileInformer
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
248
diff
changeset
|
83 * @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
|
84 * @return <code>this</code> for convenience |
8c951645bea0
Some javadoc to explain HgFileInformer
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
248
diff
changeset
|
85 */ |
417
ccd7d25e5aea
New and better name for HgFileInformer - HgChangesetFileSneaker. Explain (comments) ties between HgManifest, HgDataFile, HgChangesetFileSneaker and reasons for method placement
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
415
diff
changeset
|
86 public HgChangesetFileSneaker followRenames(boolean follow) { |
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
|
87 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
|
88 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
|
89 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
|
90 } |
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
|
91 |
251
8c951645bea0
Some javadoc to explain HgFileInformer
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
248
diff
changeset
|
92 /** |
454
36fd1fd06492
oth.util.Status renamed to Outcome as the noun is too overloaded, especially in scm
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
434
diff
changeset
|
93 * Shortcut to perform {@link #check(Path)} and {@link #exists()}. Result of the check may be accessed via {@link #getCheckResult()}. |
427
31a89587eb04
FIXMEs: consistent names, throws for commands and their handlers. Use of checked exceptions in hi-level api
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
423
diff
changeset
|
94 * Errors during the check, if any, are reported through exception. |
251
8c951645bea0
Some javadoc to explain HgFileInformer
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
248
diff
changeset
|
95 * |
8c951645bea0
Some javadoc to explain HgFileInformer
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
248
diff
changeset
|
96 * @param file name of the file in question |
8c951645bea0
Some javadoc to explain HgFileInformer
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
248
diff
changeset
|
97 * @return <code>true</code> if file is known at the selected changeset. |
427
31a89587eb04
FIXMEs: consistent names, throws for commands and their handlers. Use of checked exceptions in hi-level api
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
423
diff
changeset
|
98 * @throws HgException subclass thereof to indicate specific issue with the command arguments or repository state |
251
8c951645bea0
Some javadoc to explain HgFileInformer
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
248
diff
changeset
|
99 * @throws IllegalArgumentException if {@link #changeset(Nodeid)} not specified or file argument is bad. |
8c951645bea0
Some javadoc to explain HgFileInformer
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
248
diff
changeset
|
100 */ |
427
31a89587eb04
FIXMEs: consistent names, throws for commands and their handlers. Use of checked exceptions in hi-level api
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
423
diff
changeset
|
101 public boolean checkExists(Path file) throws HgException { |
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
|
102 check(file); |
427
31a89587eb04
FIXMEs: consistent names, throws for commands and their handlers. Use of checked exceptions in hi-level api
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
423
diff
changeset
|
103 // next seems reasonable, however renders boolean return value useless. perhaps void or distinct method? |
31a89587eb04
FIXMEs: consistent names, throws for commands and their handlers. Use of checked exceptions in hi-level api
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
423
diff
changeset
|
104 // if (checkResult.isOk() && !exists()) { |
31a89587eb04
FIXMEs: consistent names, throws for commands and their handlers. Use of checked exceptions in hi-level api
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
423
diff
changeset
|
105 // throw new HgPathNotFoundException(checkResult.getMessage(), file); |
31a89587eb04
FIXMEs: consistent names, throws for commands and their handlers. Use of checked exceptions in hi-level api
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
423
diff
changeset
|
106 // } |
31a89587eb04
FIXMEs: consistent names, throws for commands and their handlers. Use of checked exceptions in hi-level api
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
423
diff
changeset
|
107 if (!checkResult.isOk() && checkResult.getException() instanceof HgRuntimeException) { |
31a89587eb04
FIXMEs: consistent names, throws for commands and their handlers. Use of checked exceptions in hi-level api
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
423
diff
changeset
|
108 throw new HgLibraryFailureException((HgRuntimeException) checkResult.getException()); |
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
|
109 } |
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 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
|
111 } |
8099939af5fa
Utilize status object to supply more information about manifest check for specific file
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
354
diff
changeset
|
112 |
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 /** |
8099939af5fa
Utilize status object to supply more information about manifest check for specific file
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
354
diff
changeset
|
114 * 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
|
115 * |
8099939af5fa
Utilize status object to supply more information about manifest check for specific file
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
354
diff
changeset
|
116 * @param file name of the file in question |
454
36fd1fd06492
oth.util.Status renamed to Outcome as the noun is too overloaded, especially in scm
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
434
diff
changeset
|
117 * @return status object that describes outcome, {@link Outcome#isOk() Ok} status indicates successful completion of the operation, but doesn't imply |
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
|
118 * 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
|
119 * @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
|
120 */ |
454
36fd1fd06492
oth.util.Status renamed to Outcome as the noun is too overloaded, especially in scm
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
434
diff
changeset
|
121 public Outcome 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
|
122 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
|
123 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
|
124 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
|
125 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
|
126 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
|
127 } |
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
|
128 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
|
129 if (!dataFile.exists()) { |
454
36fd1fd06492
oth.util.Status renamed to Outcome as the noun is too overloaded, especially in scm
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
434
diff
changeset
|
130 checkResult = new Outcome(Outcome.Kind.Success, String.format("File named %s is not known in the repository", file)); |
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 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
|
132 } |
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
|
133 Nodeid toExtract = null; |
415
ee8264d80747
Explicit constant for regular file flags, access to flags for a given file revision
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
396
diff
changeset
|
134 HgManifest.Flags extractRevFlags = 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
|
135 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
|
136 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
|
137 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
|
138 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
|
139 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
|
140 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
|
141 // 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
|
142 } |
8099939af5fa
Utilize status object to supply more information about manifest check for specific file
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
354
diff
changeset
|
143 toExtract = cachedManifest.nodeid(file); |
415
ee8264d80747
Explicit constant for regular file flags, access to flags for a given file revision
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
396
diff
changeset
|
144 extractRevFlags = cachedManifest.flags(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
|
145 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
|
146 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
|
147 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
|
148 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
|
149 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
|
150 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
|
151 toExtract = cachedManifest.nodeid(file); |
415
ee8264d80747
Explicit constant for regular file flags, access to flags for a given file revision
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
396
diff
changeset
|
152 extractRevFlags = cachedManifest.flags(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
|
153 } |
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
|
154 } |
423
9c9c442b5f2e
Major refactoring of exception handling. Low-level API uses RuntimeExceptions, while checked are left for higher level
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
417
diff
changeset
|
155 } catch (HgRuntimeException ex) { |
454
36fd1fd06492
oth.util.Status renamed to Outcome as the noun is too overloaded, especially in scm
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
434
diff
changeset
|
156 checkResult = new Outcome(Outcome.Kind.Failure, 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
|
157 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
|
158 } |
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
|
159 if (toExtract != null) { |
415
ee8264d80747
Explicit constant for regular file flags, access to flags for a given file revision
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
396
diff
changeset
|
160 fileRevision = new HgFileRevision(repo, toExtract, extractRevFlags, dataFile.getPath()); |
454
36fd1fd06492
oth.util.Status renamed to Outcome as the noun is too overloaded, especially in scm
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
434
diff
changeset
|
161 checkResult = new Outcome(Outcome.Kind.Success, String.format("File %s, revision %s found at changeset %s", dataFile.getPath(), toExtract.shortNotation(), 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
|
162 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
|
163 } |
454
36fd1fd06492
oth.util.Status renamed to Outcome as the noun is too overloaded, especially in scm
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
434
diff
changeset
|
164 checkResult = new Outcome(Outcome.Kind.Success, 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
|
165 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
|
166 } |
8099939af5fa
Utilize status object to supply more information about manifest check for specific file
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
354
diff
changeset
|
167 |
8099939af5fa
Utilize status object to supply more information about manifest check for specific file
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
354
diff
changeset
|
168 /** |
8099939af5fa
Utilize status object to supply more information about manifest check for specific file
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
354
diff
changeset
|
169 * 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
|
170 */ |
454
36fd1fd06492
oth.util.Status renamed to Outcome as the noun is too overloaded, especially in scm
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
434
diff
changeset
|
171 public Outcome getCheckResult() { |
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
|
172 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
|
173 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
|
174 } |
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 |
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 /** |
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 * @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
|
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 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
|
180 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
|
181 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
|
182 } |
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 |
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 /** |
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 * @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
|
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 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
|
188 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
|
189 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
|
190 } |
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 /** |
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 * @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
|
194 */ |
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 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
|
196 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
|
197 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
|
198 } |
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 /** |
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 * 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
|
202 * |
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 * @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
|
204 */ |
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 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
|
206 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
|
207 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
|
208 } |
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 |
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 * 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
|
212 * |
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
|
213 * @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
|
214 */ |
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
|
215 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
|
216 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
|
217 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
|
218 } |
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
|
219 |
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
|
220 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
|
221 if (checkResult == null) { |
423
9c9c442b5f2e
Major refactoring of exception handling. Low-level API uses RuntimeExceptions, while checked are left for higher level
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
417
diff
changeset
|
222 throw new HgInvalidStateException("Shall invoke #check(Path) first"); |
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
|
223 } |
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
|
224 } |
417
ccd7d25e5aea
New and better name for HgFileInformer - HgChangesetFileSneaker. Explain (comments) ties between HgManifest, HgDataFile, HgChangesetFileSneaker and reasons for method placement
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
415
diff
changeset
|
225 |
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
|
226 } |