Mercurial > jhg
annotate hg4j/src/main/java/org/tmatesoft/hg/repo/HgRepository.java @ 213:6ec4af642ba8 gradle
Project uses Gradle for build - actual changes
author | Alexander Kitaev <kitaev@gmail.com> |
---|---|
date | Tue, 10 May 2011 10:52:53 +0200 |
parents | |
children |
rev | line source |
---|---|
213
6ec4af642ba8
Project uses Gradle for build - actual changes
Alexander Kitaev <kitaev@gmail.com>
parents:
diff
changeset
|
1 /* |
6ec4af642ba8
Project uses Gradle for build - actual changes
Alexander Kitaev <kitaev@gmail.com>
parents:
diff
changeset
|
2 * Copyright (c) 2010-2011 TMate Software Ltd |
6ec4af642ba8
Project uses Gradle for build - actual changes
Alexander Kitaev <kitaev@gmail.com>
parents:
diff
changeset
|
3 * |
6ec4af642ba8
Project uses Gradle for build - actual changes
Alexander Kitaev <kitaev@gmail.com>
parents:
diff
changeset
|
4 * This program is free software; you can redistribute it and/or modify |
6ec4af642ba8
Project uses Gradle for build - actual changes
Alexander Kitaev <kitaev@gmail.com>
parents:
diff
changeset
|
5 * it under the terms of the GNU General Public License as published by |
6ec4af642ba8
Project uses Gradle for build - actual changes
Alexander Kitaev <kitaev@gmail.com>
parents:
diff
changeset
|
6 * the Free Software Foundation; version 2 of the License. |
6ec4af642ba8
Project uses Gradle for build - actual changes
Alexander Kitaev <kitaev@gmail.com>
parents:
diff
changeset
|
7 * |
6ec4af642ba8
Project uses Gradle for build - actual changes
Alexander Kitaev <kitaev@gmail.com>
parents:
diff
changeset
|
8 * This program is distributed in the hope that it will be useful, |
6ec4af642ba8
Project uses Gradle for build - actual changes
Alexander Kitaev <kitaev@gmail.com>
parents:
diff
changeset
|
9 * but WITHOUT ANY WARRANTY; without even the implied warranty of |
6ec4af642ba8
Project uses Gradle for build - actual changes
Alexander Kitaev <kitaev@gmail.com>
parents:
diff
changeset
|
10 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
6ec4af642ba8
Project uses Gradle for build - actual changes
Alexander Kitaev <kitaev@gmail.com>
parents:
diff
changeset
|
11 * GNU General Public License for more details. |
6ec4af642ba8
Project uses Gradle for build - actual changes
Alexander Kitaev <kitaev@gmail.com>
parents:
diff
changeset
|
12 * |
6ec4af642ba8
Project uses Gradle for build - actual changes
Alexander Kitaev <kitaev@gmail.com>
parents:
diff
changeset
|
13 * For information on how to redistribute this software under |
6ec4af642ba8
Project uses Gradle for build - actual changes
Alexander Kitaev <kitaev@gmail.com>
parents:
diff
changeset
|
14 * the terms of a license other than GNU General Public License |
6ec4af642ba8
Project uses Gradle for build - actual changes
Alexander Kitaev <kitaev@gmail.com>
parents:
diff
changeset
|
15 * contact TMate Software at support@hg4j.com |
6ec4af642ba8
Project uses Gradle for build - actual changes
Alexander Kitaev <kitaev@gmail.com>
parents:
diff
changeset
|
16 */ |
6ec4af642ba8
Project uses Gradle for build - actual changes
Alexander Kitaev <kitaev@gmail.com>
parents:
diff
changeset
|
17 package org.tmatesoft.hg.repo; |
6ec4af642ba8
Project uses Gradle for build - actual changes
Alexander Kitaev <kitaev@gmail.com>
parents:
diff
changeset
|
18 |
6ec4af642ba8
Project uses Gradle for build - actual changes
Alexander Kitaev <kitaev@gmail.com>
parents:
diff
changeset
|
19 import java.io.File; |
6ec4af642ba8
Project uses Gradle for build - actual changes
Alexander Kitaev <kitaev@gmail.com>
parents:
diff
changeset
|
20 import java.io.IOException; |
6ec4af642ba8
Project uses Gradle for build - actual changes
Alexander Kitaev <kitaev@gmail.com>
parents:
diff
changeset
|
21 import java.lang.ref.SoftReference; |
6ec4af642ba8
Project uses Gradle for build - actual changes
Alexander Kitaev <kitaev@gmail.com>
parents:
diff
changeset
|
22 import java.util.ArrayList; |
6ec4af642ba8
Project uses Gradle for build - actual changes
Alexander Kitaev <kitaev@gmail.com>
parents:
diff
changeset
|
23 import java.util.Collections; |
6ec4af642ba8
Project uses Gradle for build - actual changes
Alexander Kitaev <kitaev@gmail.com>
parents:
diff
changeset
|
24 import java.util.HashMap; |
6ec4af642ba8
Project uses Gradle for build - actual changes
Alexander Kitaev <kitaev@gmail.com>
parents:
diff
changeset
|
25 import java.util.List; |
6ec4af642ba8
Project uses Gradle for build - actual changes
Alexander Kitaev <kitaev@gmail.com>
parents:
diff
changeset
|
26 |
6ec4af642ba8
Project uses Gradle for build - actual changes
Alexander Kitaev <kitaev@gmail.com>
parents:
diff
changeset
|
27 import org.tmatesoft.hg.internal.ConfigFile; |
6ec4af642ba8
Project uses Gradle for build - actual changes
Alexander Kitaev <kitaev@gmail.com>
parents:
diff
changeset
|
28 import org.tmatesoft.hg.internal.DataAccessProvider; |
6ec4af642ba8
Project uses Gradle for build - actual changes
Alexander Kitaev <kitaev@gmail.com>
parents:
diff
changeset
|
29 import org.tmatesoft.hg.internal.Filter; |
6ec4af642ba8
Project uses Gradle for build - actual changes
Alexander Kitaev <kitaev@gmail.com>
parents:
diff
changeset
|
30 import org.tmatesoft.hg.internal.RelativePathRewrite; |
6ec4af642ba8
Project uses Gradle for build - actual changes
Alexander Kitaev <kitaev@gmail.com>
parents:
diff
changeset
|
31 import org.tmatesoft.hg.internal.RequiresFile; |
6ec4af642ba8
Project uses Gradle for build - actual changes
Alexander Kitaev <kitaev@gmail.com>
parents:
diff
changeset
|
32 import org.tmatesoft.hg.internal.RevlogStream; |
6ec4af642ba8
Project uses Gradle for build - actual changes
Alexander Kitaev <kitaev@gmail.com>
parents:
diff
changeset
|
33 import org.tmatesoft.hg.util.FileIterator; |
6ec4af642ba8
Project uses Gradle for build - actual changes
Alexander Kitaev <kitaev@gmail.com>
parents:
diff
changeset
|
34 import org.tmatesoft.hg.util.FileWalker; |
6ec4af642ba8
Project uses Gradle for build - actual changes
Alexander Kitaev <kitaev@gmail.com>
parents:
diff
changeset
|
35 import org.tmatesoft.hg.util.Path; |
6ec4af642ba8
Project uses Gradle for build - actual changes
Alexander Kitaev <kitaev@gmail.com>
parents:
diff
changeset
|
36 import org.tmatesoft.hg.util.PathRewrite; |
6ec4af642ba8
Project uses Gradle for build - actual changes
Alexander Kitaev <kitaev@gmail.com>
parents:
diff
changeset
|
37 |
6ec4af642ba8
Project uses Gradle for build - actual changes
Alexander Kitaev <kitaev@gmail.com>
parents:
diff
changeset
|
38 |
6ec4af642ba8
Project uses Gradle for build - actual changes
Alexander Kitaev <kitaev@gmail.com>
parents:
diff
changeset
|
39 |
6ec4af642ba8
Project uses Gradle for build - actual changes
Alexander Kitaev <kitaev@gmail.com>
parents:
diff
changeset
|
40 /** |
6ec4af642ba8
Project uses Gradle for build - actual changes
Alexander Kitaev <kitaev@gmail.com>
parents:
diff
changeset
|
41 * Shall be as state-less as possible, all the caching happens outside the repo, in commands/walkers |
6ec4af642ba8
Project uses Gradle for build - actual changes
Alexander Kitaev <kitaev@gmail.com>
parents:
diff
changeset
|
42 * |
6ec4af642ba8
Project uses Gradle for build - actual changes
Alexander Kitaev <kitaev@gmail.com>
parents:
diff
changeset
|
43 * @author Artem Tikhomirov |
6ec4af642ba8
Project uses Gradle for build - actual changes
Alexander Kitaev <kitaev@gmail.com>
parents:
diff
changeset
|
44 * @author TMate Software Ltd. |
6ec4af642ba8
Project uses Gradle for build - actual changes
Alexander Kitaev <kitaev@gmail.com>
parents:
diff
changeset
|
45 */ |
6ec4af642ba8
Project uses Gradle for build - actual changes
Alexander Kitaev <kitaev@gmail.com>
parents:
diff
changeset
|
46 public final class HgRepository { |
6ec4af642ba8
Project uses Gradle for build - actual changes
Alexander Kitaev <kitaev@gmail.com>
parents:
diff
changeset
|
47 |
6ec4af642ba8
Project uses Gradle for build - actual changes
Alexander Kitaev <kitaev@gmail.com>
parents:
diff
changeset
|
48 // if new constants added, consider fixing HgInternals#wrongLocalRevision |
6ec4af642ba8
Project uses Gradle for build - actual changes
Alexander Kitaev <kitaev@gmail.com>
parents:
diff
changeset
|
49 public static final int TIP = -3; |
6ec4af642ba8
Project uses Gradle for build - actual changes
Alexander Kitaev <kitaev@gmail.com>
parents:
diff
changeset
|
50 public static final int BAD_REVISION = Integer.MIN_VALUE; |
6ec4af642ba8
Project uses Gradle for build - actual changes
Alexander Kitaev <kitaev@gmail.com>
parents:
diff
changeset
|
51 public static final int WORKING_COPY = -2; |
6ec4af642ba8
Project uses Gradle for build - actual changes
Alexander Kitaev <kitaev@gmail.com>
parents:
diff
changeset
|
52 |
6ec4af642ba8
Project uses Gradle for build - actual changes
Alexander Kitaev <kitaev@gmail.com>
parents:
diff
changeset
|
53 // temp aux marker method |
6ec4af642ba8
Project uses Gradle for build - actual changes
Alexander Kitaev <kitaev@gmail.com>
parents:
diff
changeset
|
54 public static IllegalStateException notImplemented() { |
6ec4af642ba8
Project uses Gradle for build - actual changes
Alexander Kitaev <kitaev@gmail.com>
parents:
diff
changeset
|
55 return new IllegalStateException("Not implemented"); |
6ec4af642ba8
Project uses Gradle for build - actual changes
Alexander Kitaev <kitaev@gmail.com>
parents:
diff
changeset
|
56 } |
6ec4af642ba8
Project uses Gradle for build - actual changes
Alexander Kitaev <kitaev@gmail.com>
parents:
diff
changeset
|
57 |
6ec4af642ba8
Project uses Gradle for build - actual changes
Alexander Kitaev <kitaev@gmail.com>
parents:
diff
changeset
|
58 private final File repoDir; // .hg folder |
6ec4af642ba8
Project uses Gradle for build - actual changes
Alexander Kitaev <kitaev@gmail.com>
parents:
diff
changeset
|
59 private final String repoLocation; |
6ec4af642ba8
Project uses Gradle for build - actual changes
Alexander Kitaev <kitaev@gmail.com>
parents:
diff
changeset
|
60 private final DataAccessProvider dataAccess; |
6ec4af642ba8
Project uses Gradle for build - actual changes
Alexander Kitaev <kitaev@gmail.com>
parents:
diff
changeset
|
61 private final PathRewrite normalizePath; |
6ec4af642ba8
Project uses Gradle for build - actual changes
Alexander Kitaev <kitaev@gmail.com>
parents:
diff
changeset
|
62 private final PathRewrite dataPathHelper; |
6ec4af642ba8
Project uses Gradle for build - actual changes
Alexander Kitaev <kitaev@gmail.com>
parents:
diff
changeset
|
63 private final PathRewrite repoPathHelper; |
6ec4af642ba8
Project uses Gradle for build - actual changes
Alexander Kitaev <kitaev@gmail.com>
parents:
diff
changeset
|
64 |
6ec4af642ba8
Project uses Gradle for build - actual changes
Alexander Kitaev <kitaev@gmail.com>
parents:
diff
changeset
|
65 private HgChangelog changelog; |
6ec4af642ba8
Project uses Gradle for build - actual changes
Alexander Kitaev <kitaev@gmail.com>
parents:
diff
changeset
|
66 private HgManifest manifest; |
6ec4af642ba8
Project uses Gradle for build - actual changes
Alexander Kitaev <kitaev@gmail.com>
parents:
diff
changeset
|
67 private HgTags tags; |
6ec4af642ba8
Project uses Gradle for build - actual changes
Alexander Kitaev <kitaev@gmail.com>
parents:
diff
changeset
|
68 // XXX perhaps, shall enable caching explicitly |
6ec4af642ba8
Project uses Gradle for build - actual changes
Alexander Kitaev <kitaev@gmail.com>
parents:
diff
changeset
|
69 private final HashMap<Path, SoftReference<RevlogStream>> streamsCache = new HashMap<Path, SoftReference<RevlogStream>>(); |
6ec4af642ba8
Project uses Gradle for build - actual changes
Alexander Kitaev <kitaev@gmail.com>
parents:
diff
changeset
|
70 |
6ec4af642ba8
Project uses Gradle for build - actual changes
Alexander Kitaev <kitaev@gmail.com>
parents:
diff
changeset
|
71 private final org.tmatesoft.hg.internal.Internals impl = new org.tmatesoft.hg.internal.Internals(); |
6ec4af642ba8
Project uses Gradle for build - actual changes
Alexander Kitaev <kitaev@gmail.com>
parents:
diff
changeset
|
72 private HgIgnore ignore; |
6ec4af642ba8
Project uses Gradle for build - actual changes
Alexander Kitaev <kitaev@gmail.com>
parents:
diff
changeset
|
73 private ConfigFile configFile; |
6ec4af642ba8
Project uses Gradle for build - actual changes
Alexander Kitaev <kitaev@gmail.com>
parents:
diff
changeset
|
74 |
6ec4af642ba8
Project uses Gradle for build - actual changes
Alexander Kitaev <kitaev@gmail.com>
parents:
diff
changeset
|
75 HgRepository(String repositoryPath) { |
6ec4af642ba8
Project uses Gradle for build - actual changes
Alexander Kitaev <kitaev@gmail.com>
parents:
diff
changeset
|
76 repoDir = null; |
6ec4af642ba8
Project uses Gradle for build - actual changes
Alexander Kitaev <kitaev@gmail.com>
parents:
diff
changeset
|
77 repoLocation = repositoryPath; |
6ec4af642ba8
Project uses Gradle for build - actual changes
Alexander Kitaev <kitaev@gmail.com>
parents:
diff
changeset
|
78 dataAccess = null; |
6ec4af642ba8
Project uses Gradle for build - actual changes
Alexander Kitaev <kitaev@gmail.com>
parents:
diff
changeset
|
79 dataPathHelper = repoPathHelper = null; |
6ec4af642ba8
Project uses Gradle for build - actual changes
Alexander Kitaev <kitaev@gmail.com>
parents:
diff
changeset
|
80 normalizePath = null; |
6ec4af642ba8
Project uses Gradle for build - actual changes
Alexander Kitaev <kitaev@gmail.com>
parents:
diff
changeset
|
81 } |
6ec4af642ba8
Project uses Gradle for build - actual changes
Alexander Kitaev <kitaev@gmail.com>
parents:
diff
changeset
|
82 |
6ec4af642ba8
Project uses Gradle for build - actual changes
Alexander Kitaev <kitaev@gmail.com>
parents:
diff
changeset
|
83 HgRepository(String repositoryPath, File repositoryRoot) { |
6ec4af642ba8
Project uses Gradle for build - actual changes
Alexander Kitaev <kitaev@gmail.com>
parents:
diff
changeset
|
84 assert ".hg".equals(repositoryRoot.getName()) && repositoryRoot.isDirectory(); |
6ec4af642ba8
Project uses Gradle for build - actual changes
Alexander Kitaev <kitaev@gmail.com>
parents:
diff
changeset
|
85 assert repositoryPath != null; |
6ec4af642ba8
Project uses Gradle for build - actual changes
Alexander Kitaev <kitaev@gmail.com>
parents:
diff
changeset
|
86 assert repositoryRoot != null; |
6ec4af642ba8
Project uses Gradle for build - actual changes
Alexander Kitaev <kitaev@gmail.com>
parents:
diff
changeset
|
87 repoDir = repositoryRoot; |
6ec4af642ba8
Project uses Gradle for build - actual changes
Alexander Kitaev <kitaev@gmail.com>
parents:
diff
changeset
|
88 repoLocation = repositoryPath; |
6ec4af642ba8
Project uses Gradle for build - actual changes
Alexander Kitaev <kitaev@gmail.com>
parents:
diff
changeset
|
89 dataAccess = new DataAccessProvider(); |
6ec4af642ba8
Project uses Gradle for build - actual changes
Alexander Kitaev <kitaev@gmail.com>
parents:
diff
changeset
|
90 final boolean runningOnWindows = System.getProperty("os.name").indexOf("Windows") != -1; |
6ec4af642ba8
Project uses Gradle for build - actual changes
Alexander Kitaev <kitaev@gmail.com>
parents:
diff
changeset
|
91 if (runningOnWindows) { |
6ec4af642ba8
Project uses Gradle for build - actual changes
Alexander Kitaev <kitaev@gmail.com>
parents:
diff
changeset
|
92 normalizePath = new PathRewrite() { |
6ec4af642ba8
Project uses Gradle for build - actual changes
Alexander Kitaev <kitaev@gmail.com>
parents:
diff
changeset
|
93 |
6ec4af642ba8
Project uses Gradle for build - actual changes
Alexander Kitaev <kitaev@gmail.com>
parents:
diff
changeset
|
94 public String rewrite(String path) { |
6ec4af642ba8
Project uses Gradle for build - actual changes
Alexander Kitaev <kitaev@gmail.com>
parents:
diff
changeset
|
95 // TODO handle . and .. (although unlikely to face them from GUI client) |
6ec4af642ba8
Project uses Gradle for build - actual changes
Alexander Kitaev <kitaev@gmail.com>
parents:
diff
changeset
|
96 path = path.replace('\\', '/').replace("//", "/"); |
6ec4af642ba8
Project uses Gradle for build - actual changes
Alexander Kitaev <kitaev@gmail.com>
parents:
diff
changeset
|
97 if (path.startsWith("/")) { |
6ec4af642ba8
Project uses Gradle for build - actual changes
Alexander Kitaev <kitaev@gmail.com>
parents:
diff
changeset
|
98 path = path.substring(1); |
6ec4af642ba8
Project uses Gradle for build - actual changes
Alexander Kitaev <kitaev@gmail.com>
parents:
diff
changeset
|
99 } |
6ec4af642ba8
Project uses Gradle for build - actual changes
Alexander Kitaev <kitaev@gmail.com>
parents:
diff
changeset
|
100 return path; |
6ec4af642ba8
Project uses Gradle for build - actual changes
Alexander Kitaev <kitaev@gmail.com>
parents:
diff
changeset
|
101 } |
6ec4af642ba8
Project uses Gradle for build - actual changes
Alexander Kitaev <kitaev@gmail.com>
parents:
diff
changeset
|
102 }; |
6ec4af642ba8
Project uses Gradle for build - actual changes
Alexander Kitaev <kitaev@gmail.com>
parents:
diff
changeset
|
103 } else { |
6ec4af642ba8
Project uses Gradle for build - actual changes
Alexander Kitaev <kitaev@gmail.com>
parents:
diff
changeset
|
104 normalizePath = new PathRewrite.Empty(); // or strip leading slash, perhaps? |
6ec4af642ba8
Project uses Gradle for build - actual changes
Alexander Kitaev <kitaev@gmail.com>
parents:
diff
changeset
|
105 } |
6ec4af642ba8
Project uses Gradle for build - actual changes
Alexander Kitaev <kitaev@gmail.com>
parents:
diff
changeset
|
106 parseRequires(); |
6ec4af642ba8
Project uses Gradle for build - actual changes
Alexander Kitaev <kitaev@gmail.com>
parents:
diff
changeset
|
107 dataPathHelper = impl.buildDataFilesHelper(); |
6ec4af642ba8
Project uses Gradle for build - actual changes
Alexander Kitaev <kitaev@gmail.com>
parents:
diff
changeset
|
108 repoPathHelper = impl.buildRepositoryFilesHelper(); |
6ec4af642ba8
Project uses Gradle for build - actual changes
Alexander Kitaev <kitaev@gmail.com>
parents:
diff
changeset
|
109 } |
6ec4af642ba8
Project uses Gradle for build - actual changes
Alexander Kitaev <kitaev@gmail.com>
parents:
diff
changeset
|
110 |
6ec4af642ba8
Project uses Gradle for build - actual changes
Alexander Kitaev <kitaev@gmail.com>
parents:
diff
changeset
|
111 @Override |
6ec4af642ba8
Project uses Gradle for build - actual changes
Alexander Kitaev <kitaev@gmail.com>
parents:
diff
changeset
|
112 public String toString() { |
6ec4af642ba8
Project uses Gradle for build - actual changes
Alexander Kitaev <kitaev@gmail.com>
parents:
diff
changeset
|
113 return getClass().getSimpleName() + "[" + getLocation() + (isInvalid() ? "(BAD)" : "") + "]"; |
6ec4af642ba8
Project uses Gradle for build - actual changes
Alexander Kitaev <kitaev@gmail.com>
parents:
diff
changeset
|
114 } |
6ec4af642ba8
Project uses Gradle for build - actual changes
Alexander Kitaev <kitaev@gmail.com>
parents:
diff
changeset
|
115 |
6ec4af642ba8
Project uses Gradle for build - actual changes
Alexander Kitaev <kitaev@gmail.com>
parents:
diff
changeset
|
116 public String getLocation() { |
6ec4af642ba8
Project uses Gradle for build - actual changes
Alexander Kitaev <kitaev@gmail.com>
parents:
diff
changeset
|
117 return repoLocation; |
6ec4af642ba8
Project uses Gradle for build - actual changes
Alexander Kitaev <kitaev@gmail.com>
parents:
diff
changeset
|
118 } |
6ec4af642ba8
Project uses Gradle for build - actual changes
Alexander Kitaev <kitaev@gmail.com>
parents:
diff
changeset
|
119 |
6ec4af642ba8
Project uses Gradle for build - actual changes
Alexander Kitaev <kitaev@gmail.com>
parents:
diff
changeset
|
120 public boolean isInvalid() { |
6ec4af642ba8
Project uses Gradle for build - actual changes
Alexander Kitaev <kitaev@gmail.com>
parents:
diff
changeset
|
121 return repoDir == null || !repoDir.exists() || !repoDir.isDirectory(); |
6ec4af642ba8
Project uses Gradle for build - actual changes
Alexander Kitaev <kitaev@gmail.com>
parents:
diff
changeset
|
122 } |
6ec4af642ba8
Project uses Gradle for build - actual changes
Alexander Kitaev <kitaev@gmail.com>
parents:
diff
changeset
|
123 |
6ec4af642ba8
Project uses Gradle for build - actual changes
Alexander Kitaev <kitaev@gmail.com>
parents:
diff
changeset
|
124 public HgChangelog getChangelog() { |
6ec4af642ba8
Project uses Gradle for build - actual changes
Alexander Kitaev <kitaev@gmail.com>
parents:
diff
changeset
|
125 if (this.changelog == null) { |
6ec4af642ba8
Project uses Gradle for build - actual changes
Alexander Kitaev <kitaev@gmail.com>
parents:
diff
changeset
|
126 String storagePath = repoPathHelper.rewrite("00changelog.i"); |
6ec4af642ba8
Project uses Gradle for build - actual changes
Alexander Kitaev <kitaev@gmail.com>
parents:
diff
changeset
|
127 RevlogStream content = resolve(Path.create(storagePath), true); |
6ec4af642ba8
Project uses Gradle for build - actual changes
Alexander Kitaev <kitaev@gmail.com>
parents:
diff
changeset
|
128 this.changelog = new HgChangelog(this, content); |
6ec4af642ba8
Project uses Gradle for build - actual changes
Alexander Kitaev <kitaev@gmail.com>
parents:
diff
changeset
|
129 } |
6ec4af642ba8
Project uses Gradle for build - actual changes
Alexander Kitaev <kitaev@gmail.com>
parents:
diff
changeset
|
130 return this.changelog; |
6ec4af642ba8
Project uses Gradle for build - actual changes
Alexander Kitaev <kitaev@gmail.com>
parents:
diff
changeset
|
131 } |
6ec4af642ba8
Project uses Gradle for build - actual changes
Alexander Kitaev <kitaev@gmail.com>
parents:
diff
changeset
|
132 |
6ec4af642ba8
Project uses Gradle for build - actual changes
Alexander Kitaev <kitaev@gmail.com>
parents:
diff
changeset
|
133 public HgManifest getManifest() { |
6ec4af642ba8
Project uses Gradle for build - actual changes
Alexander Kitaev <kitaev@gmail.com>
parents:
diff
changeset
|
134 if (this.manifest == null) { |
6ec4af642ba8
Project uses Gradle for build - actual changes
Alexander Kitaev <kitaev@gmail.com>
parents:
diff
changeset
|
135 RevlogStream content = resolve(Path.create(repoPathHelper.rewrite("00manifest.i")), true); |
6ec4af642ba8
Project uses Gradle for build - actual changes
Alexander Kitaev <kitaev@gmail.com>
parents:
diff
changeset
|
136 this.manifest = new HgManifest(this, content); |
6ec4af642ba8
Project uses Gradle for build - actual changes
Alexander Kitaev <kitaev@gmail.com>
parents:
diff
changeset
|
137 } |
6ec4af642ba8
Project uses Gradle for build - actual changes
Alexander Kitaev <kitaev@gmail.com>
parents:
diff
changeset
|
138 return this.manifest; |
6ec4af642ba8
Project uses Gradle for build - actual changes
Alexander Kitaev <kitaev@gmail.com>
parents:
diff
changeset
|
139 } |
6ec4af642ba8
Project uses Gradle for build - actual changes
Alexander Kitaev <kitaev@gmail.com>
parents:
diff
changeset
|
140 |
6ec4af642ba8
Project uses Gradle for build - actual changes
Alexander Kitaev <kitaev@gmail.com>
parents:
diff
changeset
|
141 public final HgTags getTags() { |
6ec4af642ba8
Project uses Gradle for build - actual changes
Alexander Kitaev <kitaev@gmail.com>
parents:
diff
changeset
|
142 if (tags == null) { |
6ec4af642ba8
Project uses Gradle for build - actual changes
Alexander Kitaev <kitaev@gmail.com>
parents:
diff
changeset
|
143 tags = new HgTags(); |
6ec4af642ba8
Project uses Gradle for build - actual changes
Alexander Kitaev <kitaev@gmail.com>
parents:
diff
changeset
|
144 try { |
6ec4af642ba8
Project uses Gradle for build - actual changes
Alexander Kitaev <kitaev@gmail.com>
parents:
diff
changeset
|
145 tags.readGlobal(new File(repoDir.getParentFile(), ".hgtags")); |
6ec4af642ba8
Project uses Gradle for build - actual changes
Alexander Kitaev <kitaev@gmail.com>
parents:
diff
changeset
|
146 tags.readLocal(new File(repoDir, "localtags")); |
6ec4af642ba8
Project uses Gradle for build - actual changes
Alexander Kitaev <kitaev@gmail.com>
parents:
diff
changeset
|
147 } catch (IOException ex) { |
6ec4af642ba8
Project uses Gradle for build - actual changes
Alexander Kitaev <kitaev@gmail.com>
parents:
diff
changeset
|
148 ex.printStackTrace(); // FIXME log or othewise report |
6ec4af642ba8
Project uses Gradle for build - actual changes
Alexander Kitaev <kitaev@gmail.com>
parents:
diff
changeset
|
149 } |
6ec4af642ba8
Project uses Gradle for build - actual changes
Alexander Kitaev <kitaev@gmail.com>
parents:
diff
changeset
|
150 } |
6ec4af642ba8
Project uses Gradle for build - actual changes
Alexander Kitaev <kitaev@gmail.com>
parents:
diff
changeset
|
151 return tags; |
6ec4af642ba8
Project uses Gradle for build - actual changes
Alexander Kitaev <kitaev@gmail.com>
parents:
diff
changeset
|
152 } |
6ec4af642ba8
Project uses Gradle for build - actual changes
Alexander Kitaev <kitaev@gmail.com>
parents:
diff
changeset
|
153 |
6ec4af642ba8
Project uses Gradle for build - actual changes
Alexander Kitaev <kitaev@gmail.com>
parents:
diff
changeset
|
154 public HgDataFile getFileNode(String path) { |
6ec4af642ba8
Project uses Gradle for build - actual changes
Alexander Kitaev <kitaev@gmail.com>
parents:
diff
changeset
|
155 String nPath = normalizePath.rewrite(path); |
6ec4af642ba8
Project uses Gradle for build - actual changes
Alexander Kitaev <kitaev@gmail.com>
parents:
diff
changeset
|
156 String storagePath = dataPathHelper.rewrite(nPath); |
6ec4af642ba8
Project uses Gradle for build - actual changes
Alexander Kitaev <kitaev@gmail.com>
parents:
diff
changeset
|
157 RevlogStream content = resolve(Path.create(storagePath), false); |
6ec4af642ba8
Project uses Gradle for build - actual changes
Alexander Kitaev <kitaev@gmail.com>
parents:
diff
changeset
|
158 Path p = Path.create(nPath); |
6ec4af642ba8
Project uses Gradle for build - actual changes
Alexander Kitaev <kitaev@gmail.com>
parents:
diff
changeset
|
159 if (content == null) { |
6ec4af642ba8
Project uses Gradle for build - actual changes
Alexander Kitaev <kitaev@gmail.com>
parents:
diff
changeset
|
160 return new HgDataFile(this, p); |
6ec4af642ba8
Project uses Gradle for build - actual changes
Alexander Kitaev <kitaev@gmail.com>
parents:
diff
changeset
|
161 } |
6ec4af642ba8
Project uses Gradle for build - actual changes
Alexander Kitaev <kitaev@gmail.com>
parents:
diff
changeset
|
162 return new HgDataFile(this, p, content); |
6ec4af642ba8
Project uses Gradle for build - actual changes
Alexander Kitaev <kitaev@gmail.com>
parents:
diff
changeset
|
163 } |
6ec4af642ba8
Project uses Gradle for build - actual changes
Alexander Kitaev <kitaev@gmail.com>
parents:
diff
changeset
|
164 |
6ec4af642ba8
Project uses Gradle for build - actual changes
Alexander Kitaev <kitaev@gmail.com>
parents:
diff
changeset
|
165 public HgDataFile getFileNode(Path path) { |
6ec4af642ba8
Project uses Gradle for build - actual changes
Alexander Kitaev <kitaev@gmail.com>
parents:
diff
changeset
|
166 String storagePath = dataPathHelper.rewrite(path.toString()); |
6ec4af642ba8
Project uses Gradle for build - actual changes
Alexander Kitaev <kitaev@gmail.com>
parents:
diff
changeset
|
167 RevlogStream content = resolve(Path.create(storagePath), false); |
6ec4af642ba8
Project uses Gradle for build - actual changes
Alexander Kitaev <kitaev@gmail.com>
parents:
diff
changeset
|
168 // XXX no content when no file? or HgDataFile.exists() to detect that? |
6ec4af642ba8
Project uses Gradle for build - actual changes
Alexander Kitaev <kitaev@gmail.com>
parents:
diff
changeset
|
169 if (content == null) { |
6ec4af642ba8
Project uses Gradle for build - actual changes
Alexander Kitaev <kitaev@gmail.com>
parents:
diff
changeset
|
170 return new HgDataFile(this, path); |
6ec4af642ba8
Project uses Gradle for build - actual changes
Alexander Kitaev <kitaev@gmail.com>
parents:
diff
changeset
|
171 } |
6ec4af642ba8
Project uses Gradle for build - actual changes
Alexander Kitaev <kitaev@gmail.com>
parents:
diff
changeset
|
172 return new HgDataFile(this, path, content); |
6ec4af642ba8
Project uses Gradle for build - actual changes
Alexander Kitaev <kitaev@gmail.com>
parents:
diff
changeset
|
173 } |
6ec4af642ba8
Project uses Gradle for build - actual changes
Alexander Kitaev <kitaev@gmail.com>
parents:
diff
changeset
|
174 |
6ec4af642ba8
Project uses Gradle for build - actual changes
Alexander Kitaev <kitaev@gmail.com>
parents:
diff
changeset
|
175 /* clients need to rewrite path from their FS to a repository-friendly paths, and, perhaps, vice versa*/ |
6ec4af642ba8
Project uses Gradle for build - actual changes
Alexander Kitaev <kitaev@gmail.com>
parents:
diff
changeset
|
176 public PathRewrite getToRepoPathHelper() { |
6ec4af642ba8
Project uses Gradle for build - actual changes
Alexander Kitaev <kitaev@gmail.com>
parents:
diff
changeset
|
177 return normalizePath; |
6ec4af642ba8
Project uses Gradle for build - actual changes
Alexander Kitaev <kitaev@gmail.com>
parents:
diff
changeset
|
178 } |
6ec4af642ba8
Project uses Gradle for build - actual changes
Alexander Kitaev <kitaev@gmail.com>
parents:
diff
changeset
|
179 |
6ec4af642ba8
Project uses Gradle for build - actual changes
Alexander Kitaev <kitaev@gmail.com>
parents:
diff
changeset
|
180 // local to hide use of io.File. |
6ec4af642ba8
Project uses Gradle for build - actual changes
Alexander Kitaev <kitaev@gmail.com>
parents:
diff
changeset
|
181 /*package-local*/ File getRepositoryRoot() { |
6ec4af642ba8
Project uses Gradle for build - actual changes
Alexander Kitaev <kitaev@gmail.com>
parents:
diff
changeset
|
182 return repoDir; |
6ec4af642ba8
Project uses Gradle for build - actual changes
Alexander Kitaev <kitaev@gmail.com>
parents:
diff
changeset
|
183 } |
6ec4af642ba8
Project uses Gradle for build - actual changes
Alexander Kitaev <kitaev@gmail.com>
parents:
diff
changeset
|
184 |
6ec4af642ba8
Project uses Gradle for build - actual changes
Alexander Kitaev <kitaev@gmail.com>
parents:
diff
changeset
|
185 // XXX package-local, unless there are cases when required from outside (guess, working dir/revision walkers may hide dirstate access and no public visibility needed) |
6ec4af642ba8
Project uses Gradle for build - actual changes
Alexander Kitaev <kitaev@gmail.com>
parents:
diff
changeset
|
186 /*package-local*/ final HgDirstate loadDirstate() { |
6ec4af642ba8
Project uses Gradle for build - actual changes
Alexander Kitaev <kitaev@gmail.com>
parents:
diff
changeset
|
187 return new HgDirstate(getDataAccess(), new File(repoDir, "dirstate")); |
6ec4af642ba8
Project uses Gradle for build - actual changes
Alexander Kitaev <kitaev@gmail.com>
parents:
diff
changeset
|
188 } |
6ec4af642ba8
Project uses Gradle for build - actual changes
Alexander Kitaev <kitaev@gmail.com>
parents:
diff
changeset
|
189 |
6ec4af642ba8
Project uses Gradle for build - actual changes
Alexander Kitaev <kitaev@gmail.com>
parents:
diff
changeset
|
190 // package-local, see comment for loadDirstate |
6ec4af642ba8
Project uses Gradle for build - actual changes
Alexander Kitaev <kitaev@gmail.com>
parents:
diff
changeset
|
191 /*package-local*/ final HgIgnore getIgnore() { |
6ec4af642ba8
Project uses Gradle for build - actual changes
Alexander Kitaev <kitaev@gmail.com>
parents:
diff
changeset
|
192 // TODO read config for additional locations |
6ec4af642ba8
Project uses Gradle for build - actual changes
Alexander Kitaev <kitaev@gmail.com>
parents:
diff
changeset
|
193 if (ignore == null) { |
6ec4af642ba8
Project uses Gradle for build - actual changes
Alexander Kitaev <kitaev@gmail.com>
parents:
diff
changeset
|
194 ignore = new HgIgnore(); |
6ec4af642ba8
Project uses Gradle for build - actual changes
Alexander Kitaev <kitaev@gmail.com>
parents:
diff
changeset
|
195 try { |
6ec4af642ba8
Project uses Gradle for build - actual changes
Alexander Kitaev <kitaev@gmail.com>
parents:
diff
changeset
|
196 File ignoreFile = new File(repoDir.getParentFile(), ".hgignore"); |
6ec4af642ba8
Project uses Gradle for build - actual changes
Alexander Kitaev <kitaev@gmail.com>
parents:
diff
changeset
|
197 ignore.read(ignoreFile); |
6ec4af642ba8
Project uses Gradle for build - actual changes
Alexander Kitaev <kitaev@gmail.com>
parents:
diff
changeset
|
198 } catch (IOException ex) { |
6ec4af642ba8
Project uses Gradle for build - actual changes
Alexander Kitaev <kitaev@gmail.com>
parents:
diff
changeset
|
199 ex.printStackTrace(); // log warn |
6ec4af642ba8
Project uses Gradle for build - actual changes
Alexander Kitaev <kitaev@gmail.com>
parents:
diff
changeset
|
200 } |
6ec4af642ba8
Project uses Gradle for build - actual changes
Alexander Kitaev <kitaev@gmail.com>
parents:
diff
changeset
|
201 } |
6ec4af642ba8
Project uses Gradle for build - actual changes
Alexander Kitaev <kitaev@gmail.com>
parents:
diff
changeset
|
202 return ignore; |
6ec4af642ba8
Project uses Gradle for build - actual changes
Alexander Kitaev <kitaev@gmail.com>
parents:
diff
changeset
|
203 } |
6ec4af642ba8
Project uses Gradle for build - actual changes
Alexander Kitaev <kitaev@gmail.com>
parents:
diff
changeset
|
204 |
6ec4af642ba8
Project uses Gradle for build - actual changes
Alexander Kitaev <kitaev@gmail.com>
parents:
diff
changeset
|
205 /*package-local*/ DataAccessProvider getDataAccess() { |
6ec4af642ba8
Project uses Gradle for build - actual changes
Alexander Kitaev <kitaev@gmail.com>
parents:
diff
changeset
|
206 return dataAccess; |
6ec4af642ba8
Project uses Gradle for build - actual changes
Alexander Kitaev <kitaev@gmail.com>
parents:
diff
changeset
|
207 } |
6ec4af642ba8
Project uses Gradle for build - actual changes
Alexander Kitaev <kitaev@gmail.com>
parents:
diff
changeset
|
208 |
6ec4af642ba8
Project uses Gradle for build - actual changes
Alexander Kitaev <kitaev@gmail.com>
parents:
diff
changeset
|
209 // FIXME not sure repository shall create walkers |
6ec4af642ba8
Project uses Gradle for build - actual changes
Alexander Kitaev <kitaev@gmail.com>
parents:
diff
changeset
|
210 /*package-local*/ FileIterator createWorkingDirWalker() { |
6ec4af642ba8
Project uses Gradle for build - actual changes
Alexander Kitaev <kitaev@gmail.com>
parents:
diff
changeset
|
211 File repoRoot = repoDir.getParentFile(); |
6ec4af642ba8
Project uses Gradle for build - actual changes
Alexander Kitaev <kitaev@gmail.com>
parents:
diff
changeset
|
212 Path.Source pathSrc = new Path.SimpleSource(new PathRewrite.Composite(new RelativePathRewrite(repoRoot), getToRepoPathHelper())); |
6ec4af642ba8
Project uses Gradle for build - actual changes
Alexander Kitaev <kitaev@gmail.com>
parents:
diff
changeset
|
213 // Impl note: simple source is enough as files in the working dir are all unique |
6ec4af642ba8
Project uses Gradle for build - actual changes
Alexander Kitaev <kitaev@gmail.com>
parents:
diff
changeset
|
214 // even if they might get reused (i.e. after FileIterator#reset() and walking once again), |
6ec4af642ba8
Project uses Gradle for build - actual changes
Alexander Kitaev <kitaev@gmail.com>
parents:
diff
changeset
|
215 // path caching is better to be done in the code which knows that path are being reused |
6ec4af642ba8
Project uses Gradle for build - actual changes
Alexander Kitaev <kitaev@gmail.com>
parents:
diff
changeset
|
216 return new FileWalker(repoRoot, pathSrc); |
6ec4af642ba8
Project uses Gradle for build - actual changes
Alexander Kitaev <kitaev@gmail.com>
parents:
diff
changeset
|
217 } |
6ec4af642ba8
Project uses Gradle for build - actual changes
Alexander Kitaev <kitaev@gmail.com>
parents:
diff
changeset
|
218 |
6ec4af642ba8
Project uses Gradle for build - actual changes
Alexander Kitaev <kitaev@gmail.com>
parents:
diff
changeset
|
219 /** |
6ec4af642ba8
Project uses Gradle for build - actual changes
Alexander Kitaev <kitaev@gmail.com>
parents:
diff
changeset
|
220 * Perhaps, should be separate interface, like ContentLookup |
6ec4af642ba8
Project uses Gradle for build - actual changes
Alexander Kitaev <kitaev@gmail.com>
parents:
diff
changeset
|
221 * path - repository storage path (i.e. one usually with .i or .d) |
6ec4af642ba8
Project uses Gradle for build - actual changes
Alexander Kitaev <kitaev@gmail.com>
parents:
diff
changeset
|
222 */ |
6ec4af642ba8
Project uses Gradle for build - actual changes
Alexander Kitaev <kitaev@gmail.com>
parents:
diff
changeset
|
223 /*package-local*/ RevlogStream resolve(Path path, boolean shallFakeNonExistent) { |
6ec4af642ba8
Project uses Gradle for build - actual changes
Alexander Kitaev <kitaev@gmail.com>
parents:
diff
changeset
|
224 final SoftReference<RevlogStream> ref = streamsCache.get(path); |
6ec4af642ba8
Project uses Gradle for build - actual changes
Alexander Kitaev <kitaev@gmail.com>
parents:
diff
changeset
|
225 RevlogStream cached = ref == null ? null : ref.get(); |
6ec4af642ba8
Project uses Gradle for build - actual changes
Alexander Kitaev <kitaev@gmail.com>
parents:
diff
changeset
|
226 if (cached != null) { |
6ec4af642ba8
Project uses Gradle for build - actual changes
Alexander Kitaev <kitaev@gmail.com>
parents:
diff
changeset
|
227 return cached; |
6ec4af642ba8
Project uses Gradle for build - actual changes
Alexander Kitaev <kitaev@gmail.com>
parents:
diff
changeset
|
228 } |
6ec4af642ba8
Project uses Gradle for build - actual changes
Alexander Kitaev <kitaev@gmail.com>
parents:
diff
changeset
|
229 File f = new File(repoDir, path.toString()); |
6ec4af642ba8
Project uses Gradle for build - actual changes
Alexander Kitaev <kitaev@gmail.com>
parents:
diff
changeset
|
230 if (f.exists()) { |
6ec4af642ba8
Project uses Gradle for build - actual changes
Alexander Kitaev <kitaev@gmail.com>
parents:
diff
changeset
|
231 RevlogStream s = new RevlogStream(dataAccess, f); |
6ec4af642ba8
Project uses Gradle for build - actual changes
Alexander Kitaev <kitaev@gmail.com>
parents:
diff
changeset
|
232 streamsCache.put(path, new SoftReference<RevlogStream>(s)); |
6ec4af642ba8
Project uses Gradle for build - actual changes
Alexander Kitaev <kitaev@gmail.com>
parents:
diff
changeset
|
233 return s; |
6ec4af642ba8
Project uses Gradle for build - actual changes
Alexander Kitaev <kitaev@gmail.com>
parents:
diff
changeset
|
234 } else { |
6ec4af642ba8
Project uses Gradle for build - actual changes
Alexander Kitaev <kitaev@gmail.com>
parents:
diff
changeset
|
235 if (shallFakeNonExistent) { |
6ec4af642ba8
Project uses Gradle for build - actual changes
Alexander Kitaev <kitaev@gmail.com>
parents:
diff
changeset
|
236 try { |
6ec4af642ba8
Project uses Gradle for build - actual changes
Alexander Kitaev <kitaev@gmail.com>
parents:
diff
changeset
|
237 File fake = File.createTempFile(f.getName(), null); |
6ec4af642ba8
Project uses Gradle for build - actual changes
Alexander Kitaev <kitaev@gmail.com>
parents:
diff
changeset
|
238 fake.deleteOnExit(); |
6ec4af642ba8
Project uses Gradle for build - actual changes
Alexander Kitaev <kitaev@gmail.com>
parents:
diff
changeset
|
239 return new RevlogStream(dataAccess, fake); |
6ec4af642ba8
Project uses Gradle for build - actual changes
Alexander Kitaev <kitaev@gmail.com>
parents:
diff
changeset
|
240 } catch (IOException ex) { |
6ec4af642ba8
Project uses Gradle for build - actual changes
Alexander Kitaev <kitaev@gmail.com>
parents:
diff
changeset
|
241 ex.printStackTrace(); // FIXME report in debug |
6ec4af642ba8
Project uses Gradle for build - actual changes
Alexander Kitaev <kitaev@gmail.com>
parents:
diff
changeset
|
242 } |
6ec4af642ba8
Project uses Gradle for build - actual changes
Alexander Kitaev <kitaev@gmail.com>
parents:
diff
changeset
|
243 } |
6ec4af642ba8
Project uses Gradle for build - actual changes
Alexander Kitaev <kitaev@gmail.com>
parents:
diff
changeset
|
244 } |
6ec4af642ba8
Project uses Gradle for build - actual changes
Alexander Kitaev <kitaev@gmail.com>
parents:
diff
changeset
|
245 return null; // XXX empty stream instead? |
6ec4af642ba8
Project uses Gradle for build - actual changes
Alexander Kitaev <kitaev@gmail.com>
parents:
diff
changeset
|
246 } |
6ec4af642ba8
Project uses Gradle for build - actual changes
Alexander Kitaev <kitaev@gmail.com>
parents:
diff
changeset
|
247 |
6ec4af642ba8
Project uses Gradle for build - actual changes
Alexander Kitaev <kitaev@gmail.com>
parents:
diff
changeset
|
248 // can't expose internal class, otherwise seems reasonable to have it in API |
6ec4af642ba8
Project uses Gradle for build - actual changes
Alexander Kitaev <kitaev@gmail.com>
parents:
diff
changeset
|
249 /*package-local*/ ConfigFile getConfigFile() { |
6ec4af642ba8
Project uses Gradle for build - actual changes
Alexander Kitaev <kitaev@gmail.com>
parents:
diff
changeset
|
250 if (configFile == null) { |
6ec4af642ba8
Project uses Gradle for build - actual changes
Alexander Kitaev <kitaev@gmail.com>
parents:
diff
changeset
|
251 configFile = impl.newConfigFile(); |
6ec4af642ba8
Project uses Gradle for build - actual changes
Alexander Kitaev <kitaev@gmail.com>
parents:
diff
changeset
|
252 configFile.addLocation(new File(System.getProperty("user.home"), ".hgrc")); |
6ec4af642ba8
Project uses Gradle for build - actual changes
Alexander Kitaev <kitaev@gmail.com>
parents:
diff
changeset
|
253 // last one, overrides anything else |
6ec4af642ba8
Project uses Gradle for build - actual changes
Alexander Kitaev <kitaev@gmail.com>
parents:
diff
changeset
|
254 // <repo>/.hg/hgrc |
6ec4af642ba8
Project uses Gradle for build - actual changes
Alexander Kitaev <kitaev@gmail.com>
parents:
diff
changeset
|
255 configFile.addLocation(new File(getRepositoryRoot(), "hgrc")); |
6ec4af642ba8
Project uses Gradle for build - actual changes
Alexander Kitaev <kitaev@gmail.com>
parents:
diff
changeset
|
256 } |
6ec4af642ba8
Project uses Gradle for build - actual changes
Alexander Kitaev <kitaev@gmail.com>
parents:
diff
changeset
|
257 return configFile; |
6ec4af642ba8
Project uses Gradle for build - actual changes
Alexander Kitaev <kitaev@gmail.com>
parents:
diff
changeset
|
258 } |
6ec4af642ba8
Project uses Gradle for build - actual changes
Alexander Kitaev <kitaev@gmail.com>
parents:
diff
changeset
|
259 |
6ec4af642ba8
Project uses Gradle for build - actual changes
Alexander Kitaev <kitaev@gmail.com>
parents:
diff
changeset
|
260 /*package-local*/ List<Filter> getFiltersFromRepoToWorkingDir(Path p) { |
6ec4af642ba8
Project uses Gradle for build - actual changes
Alexander Kitaev <kitaev@gmail.com>
parents:
diff
changeset
|
261 return instantiateFilters(p, new Filter.Options(Filter.Direction.FromRepo)); |
6ec4af642ba8
Project uses Gradle for build - actual changes
Alexander Kitaev <kitaev@gmail.com>
parents:
diff
changeset
|
262 } |
6ec4af642ba8
Project uses Gradle for build - actual changes
Alexander Kitaev <kitaev@gmail.com>
parents:
diff
changeset
|
263 |
6ec4af642ba8
Project uses Gradle for build - actual changes
Alexander Kitaev <kitaev@gmail.com>
parents:
diff
changeset
|
264 /*package-local*/ List<Filter> getFiltersFromWorkingDirToRepo(Path p) { |
6ec4af642ba8
Project uses Gradle for build - actual changes
Alexander Kitaev <kitaev@gmail.com>
parents:
diff
changeset
|
265 return instantiateFilters(p, new Filter.Options(Filter.Direction.ToRepo)); |
6ec4af642ba8
Project uses Gradle for build - actual changes
Alexander Kitaev <kitaev@gmail.com>
parents:
diff
changeset
|
266 } |
6ec4af642ba8
Project uses Gradle for build - actual changes
Alexander Kitaev <kitaev@gmail.com>
parents:
diff
changeset
|
267 |
6ec4af642ba8
Project uses Gradle for build - actual changes
Alexander Kitaev <kitaev@gmail.com>
parents:
diff
changeset
|
268 private List<Filter> instantiateFilters(Path p, Filter.Options opts) { |
6ec4af642ba8
Project uses Gradle for build - actual changes
Alexander Kitaev <kitaev@gmail.com>
parents:
diff
changeset
|
269 List<Filter.Factory> factories = impl.getFilters(this, getConfigFile()); |
6ec4af642ba8
Project uses Gradle for build - actual changes
Alexander Kitaev <kitaev@gmail.com>
parents:
diff
changeset
|
270 if (factories.isEmpty()) { |
6ec4af642ba8
Project uses Gradle for build - actual changes
Alexander Kitaev <kitaev@gmail.com>
parents:
diff
changeset
|
271 return Collections.emptyList(); |
6ec4af642ba8
Project uses Gradle for build - actual changes
Alexander Kitaev <kitaev@gmail.com>
parents:
diff
changeset
|
272 } |
6ec4af642ba8
Project uses Gradle for build - actual changes
Alexander Kitaev <kitaev@gmail.com>
parents:
diff
changeset
|
273 ArrayList<Filter> rv = new ArrayList<Filter>(factories.size()); |
6ec4af642ba8
Project uses Gradle for build - actual changes
Alexander Kitaev <kitaev@gmail.com>
parents:
diff
changeset
|
274 for (Filter.Factory ff : factories) { |
6ec4af642ba8
Project uses Gradle for build - actual changes
Alexander Kitaev <kitaev@gmail.com>
parents:
diff
changeset
|
275 Filter f = ff.create(p, opts); |
6ec4af642ba8
Project uses Gradle for build - actual changes
Alexander Kitaev <kitaev@gmail.com>
parents:
diff
changeset
|
276 if (f != null) { |
6ec4af642ba8
Project uses Gradle for build - actual changes
Alexander Kitaev <kitaev@gmail.com>
parents:
diff
changeset
|
277 rv.add(f); |
6ec4af642ba8
Project uses Gradle for build - actual changes
Alexander Kitaev <kitaev@gmail.com>
parents:
diff
changeset
|
278 } |
6ec4af642ba8
Project uses Gradle for build - actual changes
Alexander Kitaev <kitaev@gmail.com>
parents:
diff
changeset
|
279 } |
6ec4af642ba8
Project uses Gradle for build - actual changes
Alexander Kitaev <kitaev@gmail.com>
parents:
diff
changeset
|
280 return rv; |
6ec4af642ba8
Project uses Gradle for build - actual changes
Alexander Kitaev <kitaev@gmail.com>
parents:
diff
changeset
|
281 } |
6ec4af642ba8
Project uses Gradle for build - actual changes
Alexander Kitaev <kitaev@gmail.com>
parents:
diff
changeset
|
282 |
6ec4af642ba8
Project uses Gradle for build - actual changes
Alexander Kitaev <kitaev@gmail.com>
parents:
diff
changeset
|
283 private void parseRequires() { |
6ec4af642ba8
Project uses Gradle for build - actual changes
Alexander Kitaev <kitaev@gmail.com>
parents:
diff
changeset
|
284 new RequiresFile().parse(impl, new File(repoDir, "requires")); |
6ec4af642ba8
Project uses Gradle for build - actual changes
Alexander Kitaev <kitaev@gmail.com>
parents:
diff
changeset
|
285 } |
6ec4af642ba8
Project uses Gradle for build - actual changes
Alexander Kitaev <kitaev@gmail.com>
parents:
diff
changeset
|
286 |
6ec4af642ba8
Project uses Gradle for build - actual changes
Alexander Kitaev <kitaev@gmail.com>
parents:
diff
changeset
|
287 } |