diff src/org/tmatesoft/hg/repo/HgRepository.java @ 239:df9d2854d3d6

Initial access to subrepositories
author Artem Tikhomirov <tikhomirov.artem@gmail.com>
date Thu, 16 Jun 2011 04:23:51 +0200
parents 6e1373b54e9b
children a6d19adc2636
line wrap: on
line diff
--- a/src/org/tmatesoft/hg/repo/HgRepository.java	Wed Jun 15 18:06:39 2011 +0200
+++ b/src/org/tmatesoft/hg/repo/HgRepository.java	Thu Jun 16 04:23:51 2011 +0200
@@ -36,6 +36,7 @@
 import org.tmatesoft.hg.internal.Filter;
 import org.tmatesoft.hg.internal.RequiresFile;
 import org.tmatesoft.hg.internal.RevlogStream;
+import org.tmatesoft.hg.internal.SubrepoManager;
 import org.tmatesoft.hg.util.CancelledException;
 import org.tmatesoft.hg.util.Pair;
 import org.tmatesoft.hg.util.Path;
@@ -75,6 +76,7 @@
 	private HgTags tags;
 	private HgBranches branches;
 	private HgMergeState mergeState;
+	private SubrepoManager subRepos;
 
 	// XXX perhaps, shall enable caching explicitly
 	private final HashMap<Path, SoftReference<RevlogStream>> streamsCache = new HashMap<Path, SoftReference<RevlogStream>>();
@@ -241,6 +243,18 @@
 	public File getWorkingDir() {
 		return workingDir;
 	}
+	
+	/**
+	 * Provides access to sub-repositories defined in this repository. Enumerated  sub-repositories are those directly
+	 * known, not recursive collection of all nested sub-repositories.
+	 * @return list of all known sub-repositories in this repository, or empty list if none found.
+	 */
+	public List<HgSubrepoLocation> getSubrepositories() {
+		if (subRepos == null) {
+			subRepos = new SubrepoManager(this);
+		}
+		return subRepos.all();
+	}
 
 	// shall be of use only for internal classes 
 	/*package-local*/ File getRepositoryRoot() {