comparison src/org/tmatesoft/hg/internal/Internals.java @ 663:46b56864b483

Pull: phase2 - update phases from remote, fncache with added files. Tests
author Artem Tikhomirov <tikhomirov.artem@gmail.com>
date Wed, 10 Jul 2013 16:41:49 +0200
parents c75297c17867
children fba85bc1dfb8
comparison
equal deleted inserted replaced
662:af5223b86dd3 663:46b56864b483
102 * patch applied) + 1M (third patch applied). 102 * patch applied) + 1M (third patch applied).
103 * <p> 103 * <p>
104 * Alternative approach, controlled with this option, first combines these there patches into one, 104 * Alternative approach, controlled with this option, first combines these there patches into one,
105 * and only then applies it to base revision, eliminating 2 intermediate elements. 105 * and only then applies it to base revision, eliminating 2 intermediate elements.
106 * <p> 106 * <p>
107 * Present default value for this option is <b>FALSE</b>, and will be changed in future, once 107 * Since 1.2, default value for this option is <em>TRUE</em>, (was <code>false</code> in <b>Hg4J 1.1</b>)
108 * tests prove support is fully functional (likely in v1.2).
109 * 108 *
110 * @since 1.1 109 * @since 1.1
111 */ 110 */
112 public static final String CFG_PROPERTY_PATCH_MERGE = "hg4j.repo.merge_revlog_patches"; 111 public static final String CFG_PROPERTY_PATCH_MERGE = "hg4j.repo.merge_revlog_patches";
112
113 /**
114 * Phases were introduced in Mercurial 2.1. Unless there's <code>phaseroots</code> file in the
115 * repository's storage area, <b>Hg4J</b> pretends phases are not enabled and doesn't update
116 * phase information on commit/push/pull. If, however, it's desired to keep phase information,
117 * this option may be set to <code>true</code>, and <code>phaseroots</code> file gets updated
118 * along with repository changes.
119 *
120 * <p>Default value: <code>false</code>
121 * @since 1.2
122 */
123 public static final String CFG_PROPERTY_CREATE_PHASEROOTS = "hg4j.repo.create_phaseroots";
113 124
114 public static final int REVLOGV1_RECORD_SIZE = 64; 125 public static final int REVLOGV1_RECORD_SIZE = 64;
115 126
116 private List<Filter.Factory> filterFactories; 127 private List<Filter.Factory> filterFactories;
117 private final HgRepository repo; 128 private final HgRepository repo;
124 135
125 private final PathRewrite dataPathHelper; // access to file storage area (usually under .hg/store/data/), with filenames mangled 136 private final PathRewrite dataPathHelper; // access to file storage area (usually under .hg/store/data/), with filenames mangled
126 private final PathRewrite repoPathHelper; // access to system files (under .hg/store if requires has 'store' flag) 137 private final PathRewrite repoPathHelper; // access to system files (under .hg/store if requires has 'store' flag)
127 138
128 private final boolean shallMergePatches; 139 private final boolean shallMergePatches;
140 private final boolean shallWritePhaseroots;
129 private final RevlogStreamFactory streamProvider; 141 private final RevlogStreamFactory streamProvider;
130 142
131 public Internals(HgRepository hgRepo, File hgDir, ImplAccess implementationAccess) throws HgRuntimeException { 143 public Internals(HgRepository hgRepo, File hgDir, ImplAccess implementationAccess) throws HgRuntimeException {
132 repo = hgRepo; 144 repo = hgRepo;
133 repoDir = hgDir; 145 repoDir = hgDir;
141 repoPathHelper = repoInit.buildStoreFilesHelper(); 153 repoPathHelper = repoInit.buildStoreFilesHelper();
142 final PropertyMarshal pm = new PropertyMarshal(ctx); 154 final PropertyMarshal pm = new PropertyMarshal(ctx);
143 boolean shallCacheRevlogsInRepo = pm.getBoolean(CFG_PROPERTY_REVLOG_STREAM_CACHE, true); 155 boolean shallCacheRevlogsInRepo = pm.getBoolean(CFG_PROPERTY_REVLOG_STREAM_CACHE, true);
144 streamProvider = new RevlogStreamFactory(this, shallCacheRevlogsInRepo); 156 streamProvider = new RevlogStreamFactory(this, shallCacheRevlogsInRepo);
145 shallMergePatches = pm.getBoolean(Internals.CFG_PROPERTY_PATCH_MERGE, true); 157 shallMergePatches = pm.getBoolean(Internals.CFG_PROPERTY_PATCH_MERGE, true);
158 shallWritePhaseroots = pm.getBoolean(Internals.CFG_PROPERTY_CREATE_PHASEROOTS, false);
146 } 159 }
147 160
148 public boolean isInvalid() { 161 public boolean isInvalid() {
149 return !repoDir.exists() || !repoDir.isDirectory(); 162 return !repoDir.exists() || !repoDir.isDirectory();
150 } 163 }
278 } 291 }
279 292
280 boolean shallMergePatches() { 293 boolean shallMergePatches() {
281 return shallMergePatches; 294 return shallMergePatches;
282 } 295 }
296
297 boolean shallCreatePhaseroots() {
298 return shallWritePhaseroots;
299 }
283 300
284 RevlogChangeMonitor getRevlogTracker(File f) { 301 RevlogChangeMonitor getRevlogTracker(File f) {
285 // TODO decide whether to use one monitor per multiple files or 302 // TODO decide whether to use one monitor per multiple files or
286 // an instance per file; and let SessionContext pass alternative implementation) 303 // an instance per file; and let SessionContext pass alternative implementation)
287 return new RevlogChangeMonitor(f); 304 return new RevlogChangeMonitor(f);