Mercurial > hg4j
annotate src/org/tmatesoft/hg/internal/ManifestRevision.java @ 624:507602cb4fb3
FIXMEs and TODOs: pay some technical debt
author | Artem Tikhomirov <tikhomirov.artem@gmail.com> |
---|---|
date | Mon, 20 May 2013 20:34:33 +0200 |
parents | dd4f6311af52 |
children | 7743a9c10bfa |
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 /* |
537
5a455624be4f
Update javadoc for HgManifest.Inspector and fix erroneous internal API
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
431
diff
changeset
|
2 * Copyright (c) 2011-2013 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.internal; |
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 |
538
dd4f6311af52
Commit: first working version
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
537
diff
changeset
|
19 import static org.tmatesoft.hg.repo.HgRepository.NO_REVISION; |
dd4f6311af52
Commit: first working version
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
537
diff
changeset
|
20 |
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
|
21 import java.util.Collection; |
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 java.util.TreeMap; |
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 |
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 import org.tmatesoft.hg.core.Nodeid; |
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.repo.HgManifest; |
431
12f668401613
FIXMEs: awkward API refactored, what need to be internal got hidden; public aspects got captured in slim interfaces
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
424
diff
changeset
|
26 import org.tmatesoft.hg.util.Convertor; |
285
6dbbc53fc46d
Use Path instead of plain String for manifest file names
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
248
diff
changeset
|
27 import org.tmatesoft.hg.util.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
|
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 /** |
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 * Specific revision of the manifest. |
537
5a455624be4f
Update javadoc for HgManifest.Inspector and fix erroneous internal API
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
431
diff
changeset
|
31 * Note, suited to keep single revision only ({@link #revision()}), which is linked to changeset {@link #changesetRevisionIndex()}. |
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
|
32 * |
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
|
33 * @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
|
34 * @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
|
35 */ |
424
6437d261048a
Deprecated code removed
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
423
diff
changeset
|
36 public final class ManifestRevision implements HgManifest.Inspector { |
285
6dbbc53fc46d
Use Path instead of plain String for manifest file names
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
248
diff
changeset
|
37 private final TreeMap<Path, Nodeid> idsMap; |
6dbbc53fc46d
Use Path instead of plain String for manifest file names
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
248
diff
changeset
|
38 private final TreeMap<Path, HgManifest.Flags> flagsMap; |
431
12f668401613
FIXMEs: awkward API refactored, what need to be internal got hidden; public aspects got captured in slim interfaces
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
424
diff
changeset
|
39 private final Convertor<Nodeid> idsPool; |
12f668401613
FIXMEs: awkward API refactored, what need to be internal got hidden; public aspects got captured in slim interfaces
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
424
diff
changeset
|
40 private final Convertor<Path> namesPool; |
538
dd4f6311af52
Commit: first working version
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
537
diff
changeset
|
41 private Nodeid manifestRev = Nodeid.NULL; |
dd4f6311af52
Commit: first working version
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
537
diff
changeset
|
42 private int changelogRevIndex = NO_REVISION, manifestRevIndex = NO_REVISION; |
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
|
43 |
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 // optional pools for effective management of nodeids and filenames (they are likely |
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 // to be duplicated among different manifest revisions |
431
12f668401613
FIXMEs: awkward API refactored, what need to be internal got hidden; public aspects got captured in slim interfaces
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
424
diff
changeset
|
46 public ManifestRevision(Pool<Nodeid> nodeidPool, Convertor<Path> filenamePool) { |
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 idsPool = nodeidPool; |
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 namesPool = filenamePool; |
285
6dbbc53fc46d
Use Path instead of plain String for manifest file names
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
248
diff
changeset
|
49 idsMap = new TreeMap<Path, Nodeid>(); |
6dbbc53fc46d
Use Path instead of plain String for manifest file names
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
248
diff
changeset
|
50 flagsMap = new TreeMap<Path, HgManifest.Flags>(); |
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 |
285
6dbbc53fc46d
Use Path instead of plain String for manifest file names
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
248
diff
changeset
|
53 public Collection<Path> files() { |
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 return idsMap.keySet(); |
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 } |
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 |
285
6dbbc53fc46d
Use Path instead of plain String for manifest file names
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
248
diff
changeset
|
57 public Nodeid nodeid(Path fname) { |
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
|
58 return idsMap.get(fname); |
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 } |
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
|
60 |
285
6dbbc53fc46d
Use Path instead of plain String for manifest file names
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
248
diff
changeset
|
61 public HgManifest.Flags flags(Path fname) { |
415
ee8264d80747
Explicit constant for regular file flags, access to flags for a given file revision
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
285
diff
changeset
|
62 HgManifest.Flags f = flagsMap.get(fname); |
ee8264d80747
Explicit constant for regular file flags, access to flags for a given file revision
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
285
diff
changeset
|
63 return f == null ? HgManifest.Flags.RegularFile : f; |
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
|
64 } |
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 |
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
|
66 /** |
537
5a455624be4f
Update javadoc for HgManifest.Inspector and fix erroneous internal API
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
431
diff
changeset
|
67 * @return identifier of this manifest revision |
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
|
68 */ |
537
5a455624be4f
Update javadoc for HgManifest.Inspector and fix erroneous internal API
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
431
diff
changeset
|
69 public Nodeid revision() { |
5a455624be4f
Update javadoc for HgManifest.Inspector and fix erroneous internal API
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
431
diff
changeset
|
70 return manifestRev; |
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
|
71 } |
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 |
537
5a455624be4f
Update javadoc for HgManifest.Inspector and fix erroneous internal API
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
431
diff
changeset
|
73 public int revisionIndex() { |
5a455624be4f
Update javadoc for HgManifest.Inspector and fix erroneous internal API
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
431
diff
changeset
|
74 return manifestRevIndex; |
5a455624be4f
Update javadoc for HgManifest.Inspector and fix erroneous internal API
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
431
diff
changeset
|
75 } |
5a455624be4f
Update javadoc for HgManifest.Inspector and fix erroneous internal API
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
431
diff
changeset
|
76 |
5a455624be4f
Update javadoc for HgManifest.Inspector and fix erroneous internal API
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
431
diff
changeset
|
77 /** |
5a455624be4f
Update javadoc for HgManifest.Inspector and fix erroneous internal API
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
431
diff
changeset
|
78 * @return revision index for the changelog this manifest revision is linked to |
5a455624be4f
Update javadoc for HgManifest.Inspector and fix erroneous internal API
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
431
diff
changeset
|
79 */ |
5a455624be4f
Update javadoc for HgManifest.Inspector and fix erroneous internal API
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
431
diff
changeset
|
80 public int changesetRevisionIndex() { |
5a455624be4f
Update javadoc for HgManifest.Inspector and fix erroneous internal API
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
431
diff
changeset
|
81 return changelogRevIndex; |
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
|
82 } |
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 |
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 // |
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 |
285
6dbbc53fc46d
Use Path instead of plain String for manifest file names
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
248
diff
changeset
|
86 public boolean next(Nodeid nid, Path fname, HgManifest.Flags flags) { |
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 if (namesPool != null) { |
431
12f668401613
FIXMEs: awkward API refactored, what need to be internal got hidden; public aspects got captured in slim interfaces
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
424
diff
changeset
|
88 fname = namesPool.mangle(fname); |
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
|
89 } |
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 if (idsPool != null) { |
431
12f668401613
FIXMEs: awkward API refactored, what need to be internal got hidden; public aspects got captured in slim interfaces
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
424
diff
changeset
|
91 nid = idsPool.mangle(nid); |
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
|
92 } |
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
|
93 idsMap.put(fname, nid); |
415
ee8264d80747
Explicit constant for regular file flags, access to flags for a given file revision
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
285
diff
changeset
|
94 if (flags != HgManifest.Flags.RegularFile) { |
ee8264d80747
Explicit constant for regular file flags, access to flags for a given file revision
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
285
diff
changeset
|
95 // TreeMap$Entry takes 32 bytes. No reason to keep regular file attribute (in fact, no flags state) |
ee8264d80747
Explicit constant for regular file flags, access to flags for a given file revision
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
285
diff
changeset
|
96 // for such price |
285
6dbbc53fc46d
Use Path instead of plain String for manifest file names
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
248
diff
changeset
|
97 // Alternatively, Map<Path, Pair<Nodeid, Flags>> might come as a solution |
6dbbc53fc46d
Use Path instead of plain String for manifest file names
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
248
diff
changeset
|
98 // however, with low rate of elements with flags this would consume more memory |
6dbbc53fc46d
Use Path instead of plain String for manifest file names
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
248
diff
changeset
|
99 // than two distinct maps (sizeof(Pair) == 16). |
6dbbc53fc46d
Use Path instead of plain String for manifest file names
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
248
diff
changeset
|
100 // Map<Pair>: n*(32+16) |
6dbbc53fc46d
Use Path instead of plain String for manifest file names
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
248
diff
changeset
|
101 // 2 Maps: n*32 + m*32 <-- consumes more with m>n/2 |
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
|
102 flagsMap.put(fname, flags); |
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
|
103 } |
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
|
104 return 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
|
105 } |
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
|
106 |
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
|
107 public boolean end(int 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
|
108 // in fact, this class cares about single 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
|
109 return 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
|
110 } |
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
|
111 |
537
5a455624be4f
Update javadoc for HgManifest.Inspector and fix erroneous internal API
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
431
diff
changeset
|
112 public boolean begin(int revisionIndex, Nodeid revision, int changelogRevisionIndex) { |
5a455624be4f
Update javadoc for HgManifest.Inspector and fix erroneous internal API
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
431
diff
changeset
|
113 if (manifestRev != 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 idsMap.clear(); |
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 flagsMap.clear(); |
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 } |
537
5a455624be4f
Update javadoc for HgManifest.Inspector and fix erroneous internal API
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
431
diff
changeset
|
117 manifestRev = revision; |
5a455624be4f
Update javadoc for HgManifest.Inspector and fix erroneous internal API
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
431
diff
changeset
|
118 manifestRevIndex = revisionIndex; |
5a455624be4f
Update javadoc for HgManifest.Inspector and fix erroneous internal API
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
431
diff
changeset
|
119 changelogRevIndex = changelogRevisionIndex; |
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
|
120 return 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
|
121 } |
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 } |