diff src/org/tmatesoft/hg/repo/HgRepository.java @ 636:ffce73efa2c2

HgCommitCommand: save last commit message
author Artem Tikhomirov <tikhomirov.artem@gmail.com>
date Thu, 06 Jun 2013 19:39:06 +0200
parents 6526d8adbc0f
children c75297c17867
line wrap: on
line diff
--- a/src/org/tmatesoft/hg/repo/HgRepository.java	Thu Jun 06 18:42:38 2013 +0200
+++ b/src/org/tmatesoft/hg/repo/HgRepository.java	Thu Jun 06 19:39:06 2013 +0200
@@ -32,6 +32,7 @@
 import org.tmatesoft.hg.core.SessionContext;
 import org.tmatesoft.hg.internal.ConfigFile;
 import org.tmatesoft.hg.internal.DirstateReader;
+import org.tmatesoft.hg.internal.FileUtils;
 import org.tmatesoft.hg.internal.Filter;
 import org.tmatesoft.hg.internal.Internals;
 import org.tmatesoft.hg.internal.PropertyMarshal;
@@ -359,7 +360,7 @@
 	 * @throws HgRuntimeException subclass thereof to indicate issues with the library. <em>Runtime exception</em>
 	 */
 	public String getCommitLastMessage() throws HgInvalidControlFileException {
-		File lastMessage = impl.getFileFromRepoDir(LastMessage.getPath());
+		File lastMessage = impl.getRepositoryFile(LastMessage);
 		if (!lastMessage.canRead()) {
 			return null;
 		}
@@ -372,13 +373,7 @@
 		} catch (IOException ex) {
 			throw new HgInvalidControlFileException("Can't retrieve message of last commit attempt", ex, lastMessage);
 		} finally {
-			if (fr != null) {
-				try {
-					fr.close();
-				} catch (IOException ex) {
-					getSessionContext().getLog().dump(getClass(), Warn, "Failed to close %s after read", lastMessage);
-				}
-			}
+			new FileUtils(getSessionContext().getLog()).closeQuietly(fr, lastMessage);
 		}
 	}