comparison src/org/tmatesoft/hg/repo/HgRepository.java @ 231:1792b37650f2

Introduced access to conflict resolution information (merge state)
author Artem Tikhomirov <tikhomirov.artem@gmail.com>
date Wed, 01 Jun 2011 05:44:25 +0200
parents 1ec6b327a6ac
children b2cfbe46f9b6
comparison
equal deleted inserted replaced
230:0dd9da7489dc 231:1792b37650f2
24 import java.util.HashMap; 24 import java.util.HashMap;
25 import java.util.List; 25 import java.util.List;
26 26
27 import org.tmatesoft.hg.internal.ConfigFile; 27 import org.tmatesoft.hg.internal.ConfigFile;
28 import org.tmatesoft.hg.internal.DataAccessProvider; 28 import org.tmatesoft.hg.internal.DataAccessProvider;
29 import org.tmatesoft.hg.internal.Experimental;
29 import org.tmatesoft.hg.internal.Filter; 30 import org.tmatesoft.hg.internal.Filter;
30 import org.tmatesoft.hg.internal.RequiresFile; 31 import org.tmatesoft.hg.internal.RequiresFile;
31 import org.tmatesoft.hg.internal.RevlogStream; 32 import org.tmatesoft.hg.internal.RevlogStream;
32 import org.tmatesoft.hg.util.Path; 33 import org.tmatesoft.hg.util.Path;
33 import org.tmatesoft.hg.util.PathRewrite; 34 import org.tmatesoft.hg.util.PathRewrite;
62 63
63 private HgChangelog changelog; 64 private HgChangelog changelog;
64 private HgManifest manifest; 65 private HgManifest manifest;
65 private HgTags tags; 66 private HgTags tags;
66 private HgBranches branches; 67 private HgBranches branches;
68 private HgMergeState mergeState;
67 69
68 // XXX perhaps, shall enable caching explicitly 70 // XXX perhaps, shall enable caching explicitly
69 private final HashMap<Path, SoftReference<RevlogStream>> streamsCache = new HashMap<Path, SoftReference<RevlogStream>>(); 71 private final HashMap<Path, SoftReference<RevlogStream>> streamsCache = new HashMap<Path, SoftReference<RevlogStream>>();
70 72
71 private final org.tmatesoft.hg.internal.Internals impl = new org.tmatesoft.hg.internal.Internals(); 73 private final org.tmatesoft.hg.internal.Internals impl = new org.tmatesoft.hg.internal.Internals();
136 this.manifest = new HgManifest(this, content); 138 this.manifest = new HgManifest(this, content);
137 } 139 }
138 return this.manifest; 140 return this.manifest;
139 } 141 }
140 142
141 public final HgTags getTags() { 143 public HgTags getTags() {
142 if (tags == null) { 144 if (tags == null) {
143 tags = new HgTags(); 145 tags = new HgTags();
144 try { 146 try {
145 tags.readGlobal(new File(repoDir.getParentFile(), ".hgtags")); 147 tags.readGlobal(new File(repoDir.getParentFile(), ".hgtags"));
146 tags.readLocal(new File(repoDir, "localtags")); 148 tags.readLocal(new File(repoDir, "localtags"));
149 } 151 }
150 } 152 }
151 return tags; 153 return tags;
152 } 154 }
153 155
154 public final HgBranches getBranches() { 156 public HgBranches getBranches() {
155 if (branches == null) { 157 if (branches == null) {
156 branches = new HgBranches(this); 158 branches = new HgBranches(this);
157 branches.collect(ProgressSupport.Factory.get(null)); 159 branches.collect(ProgressSupport.Factory.get(null));
158 } 160 }
159 return branches; 161 return branches;
162 }
163
164 @Experimental(reason="Perhaps, shall not cache instance, and provide loadMergeState as it may change often")
165 public HgMergeState getMergeState() {
166 if (mergeState == null) {
167 mergeState = new HgMergeState(this);
168 }
169 return mergeState;
160 } 170 }
161 171
162 public HgDataFile getFileNode(String path) { 172 public HgDataFile getFileNode(String path) {
163 String nPath = normalizePath.rewrite(path); 173 String nPath = normalizePath.rewrite(path);
164 String storagePath = dataPathHelper.rewrite(nPath); 174 String storagePath = dataPathHelper.rewrite(nPath);