changeset 620:272ecffccc8a

Do not cache branch value of working copy as it's not possible to refresh it after commit now
author Artem Tikhomirov <tikhomirov.artem@gmail.com>
date Sat, 18 May 2013 21:55:31 +0200
parents 868b2ffdcd5c
children 99ad1e3a4e4d
files src/org/tmatesoft/hg/repo/HgRepository.java
diffstat 1 files changed, 7 insertions(+), 11 deletions(-) [+]
line wrap: on
line diff
--- a/src/org/tmatesoft/hg/repo/HgRepository.java	Fri May 17 22:04:23 2013 +0200
+++ b/src/org/tmatesoft/hg/repo/HgRepository.java	Sat May 18 21:55:31 2013 +0200
@@ -113,14 +113,6 @@
 
 	private final org.tmatesoft.hg.internal.Internals impl;
 	
-	/*
-	 * TODO [post-1.0] move to a better place, e.g. WorkingCopy container that tracks both dirstate and branches 
-	 * (and, perhaps, undo, lastcommit and other similar information), and is change listener so that we don't need to
-	 * worry about this cached value become stale
-	 */
-	private String wcBranch;
-
-	
 	HgRepository(String repositoryPath) {
 		workingDir = null;
 		repoLocation = repositoryPath;
@@ -274,9 +266,13 @@
 	 * @throws HgInvalidControlFileException if attempt to read branch name failed.
 	 */
 	public String getWorkingCopyBranchName() throws HgInvalidControlFileException {
-		if (wcBranch == null) {
-			wcBranch = DirstateReader.readBranch(impl);
-		}
+		/*
+		 * TODO [post-1.1] 1) cache value (now if cached, is not updated after commit)
+		 * 2) move to a better place, e.g. WorkingCopy container that tracks both dirstate and branches 
+		 * (and, perhaps, undo, lastcommit and other similar information), and is change listener so that we don't need to
+		 * worry about this cached value become stale
+		 */
+		String wcBranch = DirstateReader.readBranch(impl);
 		return wcBranch;
 	}