diff src/org/tmatesoft/hg/repo/ext/MqManager.java @ 493:ba36f66c32b4

Refactor to keep knowledge about repository control files and their location in respect to .hg/ in a single place (facilitate future adoption of shared repositories)
author Artem Tikhomirov <tikhomirov.artem@gmail.com>
date Thu, 18 Oct 2012 18:36:13 +0200
parents b3c16d1aede0
children d2f6ab541330
line wrap: on
line diff
--- a/src/org/tmatesoft/hg/repo/ext/MqManager.java	Thu Oct 18 16:27:32 2012 +0200
+++ b/src/org/tmatesoft/hg/repo/ext/MqManager.java	Thu Oct 18 18:36:13 2012 +0200
@@ -28,6 +28,7 @@
 import java.util.Map;
 
 import org.tmatesoft.hg.core.Nodeid;
+import org.tmatesoft.hg.internal.Internals;
 import org.tmatesoft.hg.internal.LineReader;
 import org.tmatesoft.hg.repo.HgInternals;
 import org.tmatesoft.hg.repo.HgInvalidControlFileException;
@@ -63,16 +64,16 @@
 	public void refresh() throws HgInvalidControlFileException {
 		applied = allKnown = Collections.emptyList();
 		queueNames = Collections.emptyList();
-		File repoDir = HgInternals.getRepositoryDir(repo);
+		Internals repoImpl = HgInternals.getImplementationRepo(repo);
 		final LogFacility log = repo.getSessionContext().getLog();
 		try {
-			File queues = new File(repoDir, "patches.queues");
+			File queues = repoImpl.getFileFromRepoDir("patches.queues");
 			if (queues.isFile()) {
 				LineReader lr = new LineReader(queues, log).trimLines(true).skipEmpty(true);
 				lr.read(new LineReader.SimpleLineCollector(), queueNames = new LinkedList<String>());
 			}
 			final String queueLocation; // path under .hg to patch queue information (status, series and diff files)
-			File activeQueueFile = new File(repoDir, "patches.queue");
+			File activeQueueFile = repoImpl.getFileFromRepoDir("patches.queue");
 			// file is there only if it's not default queue ('patches') that is active
 			if (activeQueueFile.isFile()) {
 				ArrayList<String> contents = new ArrayList<String>();
@@ -99,8 +100,8 @@
 					return Path.create(sb);
 				}
 			};
-			final File fileStatus = new File(repoDir, queueLocation + "status");
-			final File fileSeries = new File(repoDir, queueLocation + "series");
+			final File fileStatus = repoImpl.getFileFromRepoDir(queueLocation + "status");
+			final File fileSeries = repoImpl.getFileFromRepoDir(queueLocation + "series");
 			if (fileStatus.isFile()) {
 				new LineReader(fileStatus, log).read(new LineReader.LineConsumer<List<PatchRecord>>() {