comparison src/org/tmatesoft/hg/repo/HgRepository.java @ 220:8de327242aa0

Basic information about branches
author Artem Tikhomirov <tikhomirov.artem@gmail.com>
date Thu, 19 May 2011 04:14:45 +0200
parents 706bcc7cfee4
children 1ec6b327a6ac
comparison
equal deleted inserted replaced
219:d63583b47bfa 220:8de327242aa0
32 import org.tmatesoft.hg.internal.RevlogStream; 32 import org.tmatesoft.hg.internal.RevlogStream;
33 import org.tmatesoft.hg.util.FileIterator; 33 import org.tmatesoft.hg.util.FileIterator;
34 import org.tmatesoft.hg.util.FileWalker; 34 import org.tmatesoft.hg.util.FileWalker;
35 import org.tmatesoft.hg.util.Path; 35 import org.tmatesoft.hg.util.Path;
36 import org.tmatesoft.hg.util.PathRewrite; 36 import org.tmatesoft.hg.util.PathRewrite;
37 import org.tmatesoft.hg.util.ProgressSupport;
37 38
38 39
39 40
40 /** 41 /**
41 * Shall be as state-less as possible, all the caching happens outside the repo, in commands/walkers 42 * Shall be as state-less as possible, all the caching happens outside the repo, in commands/walkers
63 private final PathRewrite repoPathHelper; 64 private final PathRewrite repoPathHelper;
64 65
65 private HgChangelog changelog; 66 private HgChangelog changelog;
66 private HgManifest manifest; 67 private HgManifest manifest;
67 private HgTags tags; 68 private HgTags tags;
69 private HgBranches branches;
70
68 // XXX perhaps, shall enable caching explicitly 71 // XXX perhaps, shall enable caching explicitly
69 private final HashMap<Path, SoftReference<RevlogStream>> streamsCache = new HashMap<Path, SoftReference<RevlogStream>>(); 72 private final HashMap<Path, SoftReference<RevlogStream>> streamsCache = new HashMap<Path, SoftReference<RevlogStream>>();
70 73
71 private final org.tmatesoft.hg.internal.Internals impl = new org.tmatesoft.hg.internal.Internals(); 74 private final org.tmatesoft.hg.internal.Internals impl = new org.tmatesoft.hg.internal.Internals();
72 private HgIgnore ignore; 75 private HgIgnore ignore;
73 private ConfigFile configFile; 76 private ConfigFile configFile;
74 77
75 HgRepository(String repositoryPath) { 78 HgRepository(String repositoryPath) {
76 repoDir = null; 79 repoDir = null;
77 repoLocation = repositoryPath; 80 repoLocation = repositoryPath;
78 dataAccess = null; 81 dataAccess = null;
79 dataPathHelper = repoPathHelper = null; 82 dataPathHelper = repoPathHelper = null;
149 } 152 }
150 } 153 }
151 return tags; 154 return tags;
152 } 155 }
153 156
157 public final HgBranches getBranches() {
158 if (branches == null) {
159 branches = new HgBranches(this);
160 branches.collect(ProgressSupport.Factory.get(null));
161 }
162 return branches;
163 }
164
154 public HgDataFile getFileNode(String path) { 165 public HgDataFile getFileNode(String path) {
155 String nPath = normalizePath.rewrite(path); 166 String nPath = normalizePath.rewrite(path);
156 String storagePath = dataPathHelper.rewrite(nPath); 167 String storagePath = dataPathHelper.rewrite(nPath);
157 RevlogStream content = resolve(Path.create(storagePath), false); 168 RevlogStream content = resolve(Path.create(storagePath), false);
158 Path p = Path.create(nPath); 169 Path p = Path.create(nPath);