diff src/org/tmatesoft/hg/core/HgFileRevision.java @ 689:5050ee565bd1

Issue 44: Renames/copies other than for the very first revision of a file are not recognized
author Artem Tikhomirov <tikhomirov.artem@gmail.com>
date Sat, 27 Jul 2013 22:06:14 +0200
parents 6526d8adbc0f
children
line wrap: on
line diff
--- a/src/org/tmatesoft/hg/core/HgFileRevision.java	Sat Jul 27 20:15:37 2013 +0200
+++ b/src/org/tmatesoft/hg/core/HgFileRevision.java	Sat Jul 27 22:06:14 2013 +0200
@@ -168,14 +168,12 @@
 	}
 
 	private void checkCopy() throws HgRuntimeException {
-		HgDataFile fn = repo.getFileNode(path);
-		if (fn.isCopy()) {
-			if (fn.getRevision(0).equals(revision)) {
-				// this HgFileRevision represents first revision of the copy
-				isCopy = Boolean.TRUE;
-				origin = fn.getCopySourceName();
-				return;
-			}
+		HgDataFile df = repo.getFileNode(path);
+		int revIdx = df.getRevisionIndex(revision);
+		if (df.isCopy(revIdx)) {
+			isCopy = Boolean.TRUE;
+			origin = df.getCopySource(revIdx).getPath();
+			return;
 		}
 		isCopy = Boolean.FALSE;
 	}