changeset 675:a20121a2bba6

Respect default range (0..tip)
author Artem Tikhomirov <tikhomirov.artem@gmail.com>
date Thu, 18 Jul 2013 18:02:36 +0200
parents cce0387c6041
children 3219cfadda49
files src/org/tmatesoft/hg/core/HgDiffCommand.java src/org/tmatesoft/hg/internal/CsetParamKeeper.java
diffstat 2 files changed, 12 insertions(+), 8 deletions(-) [+]
line wrap: on
line diff
--- a/src/org/tmatesoft/hg/core/HgDiffCommand.java	Wed Jul 17 15:40:51 2013 +0200
+++ b/src/org/tmatesoft/hg/core/HgDiffCommand.java	Thu Jul 18 18:02:36 2013 +0200
@@ -139,14 +139,16 @@
 		final ProgressSupport progress = getProgressSupport(insp);
 		progress.start(2);
 		try {
+			final int startRevIndex = clogRevIndexStart.get(0);
+			final int endRevIndex = clogRevIndexEnd.get(TIP);
 			final CancelSupport cancel = getCancelSupport(insp, true);
-			int fileRevIndex1 = fileRevIndex(df, clogRevIndexStart.get());
-			int fileRevIndex2 = fileRevIndex(df, clogRevIndexEnd.get());
+			int fileRevIndex1 = fileRevIndex(df, startRevIndex);
+			int fileRevIndex2 = fileRevIndex(df, endRevIndex);
 			BlameHelper bh = new BlameHelper(insp);
-			bh.prepare(df, clogRevIndexStart.get(), clogRevIndexEnd.get());
+			bh.prepare(df, startRevIndex, endRevIndex);
 			progress.worked(1);
 			cancel.checkCancelled();
-			bh.diff(fileRevIndex1, clogRevIndexStart.get(), fileRevIndex2, clogRevIndexEnd.get());
+			bh.diff(fileRevIndex1, startRevIndex, fileRevIndex2, endRevIndex);
 			progress.worked(1);
 			cancel.checkCancelled();
 		} catch (HgRuntimeException ex) {
@@ -172,7 +174,9 @@
 			}
 			final CancelSupport cancel = getCancelSupport(insp, true);
 			BlameHelper bh = new BlameHelper(insp);
-			FileHistory fileHistory = bh.prepare(df, clogRevIndexStart.get(), clogRevIndexEnd.get());
+			final int startRevIndex = clogRevIndexStart.get(0);
+			final int endRevIndex = clogRevIndexEnd.get(TIP);
+			FileHistory fileHistory = bh.prepare(df, startRevIndex, endRevIndex);
 			//
 			cancel.checkCancelled();
 			int totalWork = 0;
@@ -189,8 +193,8 @@
 				for (int fri : fhc.fileRevisions(iterateDirection)) {
 					int clogRevIndex = fhc.changeset(fri);
 					// the way we built fileHistory ensures we won't walk past [changelogRevIndexStart..changelogRevIndexEnd]
-					assert clogRevIndex >= clogRevIndexStart.get();
-					assert clogRevIndex <= clogRevIndexEnd.get();
+					assert clogRevIndex >= startRevIndex;
+					assert clogRevIndex <= endRevIndex;
 					fhc.fillFileParents(fri, fileParentRevs);
 					fhc.fillCsetParents(fri, fileClogParentRevs);
 					bh.annotateChange(fri, clogRevIndex, fileParentRevs, fileClogParentRevs);
--- a/src/org/tmatesoft/hg/internal/CsetParamKeeper.java	Wed Jul 17 15:40:51 2013 +0200
+++ b/src/org/tmatesoft/hg/internal/CsetParamKeeper.java	Thu Jul 18 18:02:36 2013 +0200
@@ -83,7 +83,7 @@
 	 */
 	public int get(int defaultRevisionIndex) throws HgRuntimeException {
 		// XXX perhaps, shall translate other predefined constants (like WORKING COPY) here, too (e.g. for HgRevertCommand)
-		if (changelogRevisionIndex != BAD_REVISION || changelogRevisionIndex != TIP) {
+		if (changelogRevisionIndex != BAD_REVISION && changelogRevisionIndex != TIP) {
 			return changelogRevisionIndex;
 		}
 		if (changelogRevisionIndex == TIP || defaultRevisionIndex == TIP) {