changeset 140:1c1891ad1c73

Slight optimization
author Artem Tikhomirov <tikhomirov.artem@gmail.com>
date Wed, 16 Feb 2011 22:33:04 +0100
parents f3c387ea0a34
children 8248aae33f7d
files src/org/tmatesoft/hg/core/HgStatus.java src/org/tmatesoft/hg/internal/ChangelogHelper.java
diffstat 2 files changed, 6 insertions(+), 1 deletions(-) [+]
line wrap: on
line diff
--- a/src/org/tmatesoft/hg/core/HgStatus.java	Wed Feb 16 22:28:29 2011 +0100
+++ b/src/org/tmatesoft/hg/core/HgStatus.java	Wed Feb 16 22:33:04 2011 +0100
@@ -73,6 +73,7 @@
 		Changeset cset = logHelper.findLatestChangeWith(path);
 		if (cset == null) {
 			if (kind == Kind.Modified || kind == Kind.Added || kind == Kind.Removed /*&& RightBoundary is TIP*/) {
+				// perhaps, also for Kind.Missing?
 				return logHelper.getNextCommitUsername();
 			}
 		} else {
--- a/src/org/tmatesoft/hg/internal/ChangelogHelper.java	Wed Feb 16 22:28:29 2011 +0100
+++ b/src/org/tmatesoft/hg/internal/ChangelogHelper.java	Wed Feb 16 22:33:04 2011 +0100
@@ -33,6 +33,7 @@
 	private final int leftBoundary;
 	private final HgRepository repo;
 	private final TreeMap<Integer, Changeset> cache = new TreeMap<Integer, Changeset>();
+	private String nextCommitAuthor;
 
 	/**
 	 * @param hgRepo
@@ -74,6 +75,9 @@
 	}
 
 	public String getNextCommitUsername() {
-		return new HgInternals(repo).getNextCommitUsername();
+		if (nextCommitAuthor == null) {
+			nextCommitAuthor = new HgInternals(repo).getNextCommitUsername();
+		}
+		return nextCommitAuthor;
 	}
 }