changeset 517:9922d1f7cb2a

Update test to use new command configuration argument (used to have followAncestry == true by default)
author Artem Tikhomirov <tikhomirov.artem@gmail.com>
date Tue, 18 Dec 2012 19:08:00 +0100
parents 0ae5768081aa
children 0d5e1ea7955e
files src/org/tmatesoft/hg/core/HgLogCommand.java test/org/tmatesoft/hg/test/TestHistory.java
diffstat 2 files changed, 8 insertions(+), 7 deletions(-) [+]
line wrap: on
line diff
--- a/src/org/tmatesoft/hg/core/HgLogCommand.java	Tue Dec 18 18:57:03 2012 +0100
+++ b/src/org/tmatesoft/hg/core/HgLogCommand.java	Tue Dec 18 19:08:00 2012 +0100
@@ -353,6 +353,7 @@
 		final HgFileRenameHandlerMixin renameHandler = Adaptable.Factory.getAdapter(handler, HgFileRenameHandlerMixin.class, null);
 
 		
+		// XXX rename. dispatcher is not a proper name (most of the job done - managing history chunk interconnection)
 		final HandlerDispatcher dispatcher = new HandlerDispatcher() {
 
 			@Override
@@ -365,6 +366,8 @@
 		// renamed files in the queue are placed with respect to #iterateDirection
 		// i.e. if we iterate from new to old, recent filenames come first
 		List<Pair<HgDataFile, Nodeid>> fileRenamesQueue = buildFileRenamesQueue();
+		// XXX perhaps, makes sense to look at selected file's revision when followAncestry is true
+		// to ensure file we attempt to trace is in the WC's parent. Native hg aborts if not.
 		progressHelper.start(4 * fileRenamesQueue.size());
 		for (int namesIndex = 0, renamesQueueSize = fileRenamesQueue.size(); namesIndex < renamesQueueSize; namesIndex++) {
  
@@ -825,14 +828,12 @@
 		
 		/**
 		 * method to merge two history chunks for renamed file so that
-		 * this node's history continues with that of child
+		 * this node's history continues (or forks, if we don't followAncestry)
+		 * with that of child
 		 * @param child
 		 */
 		public void bindChild(HistoryNode child) {
 			assert child.parent1 == null && child.parent2 == null;
-			// for the last element in history empty children are by construction:
-			// we don't iterate further than last element of interest in TreeBuildInspector#go
-			assert children == null || children.isEmpty();
 			child.parent1 = this;
 			addChild(child);
 		}
--- a/test/org/tmatesoft/hg/test/TestHistory.java	Tue Dec 18 18:57:03 2012 +0100
+++ b/test/org/tmatesoft/hg/test/TestHistory.java	Tue Dec 18 19:08:00 2012 +0100
@@ -157,7 +157,7 @@
 			}
 		});
 		h.checkPrevInParents = true;
-		new HgLogCommand(repo).file(fname, true).execute(h);
+		new HgLogCommand(repo).file(fname, true, true).execute(h);
 
 		assertEquals(1, h.getAdapterUse(HgFileRenameHandlerMixin.class));
 		
@@ -368,12 +368,12 @@
 			//
 			if (checkPrevInChildren && !cmdResult.isEmpty()) {
 				HgChangeset prevChangeset = reverseResult ? cmdResult.getFirst() : cmdResult.getLast();
-				String msg = String.format("No parent-child bind betwee revisions %d and %d", prevChangeset.getRevisionIndex(), entry.changeset().getRevisionIndex());
+				String msg = String.format("No parent-child bind between revisions %d and %d", prevChangeset.getRevisionIndex(), entry.changeset().getRevisionIndex());
 				errorCollector.assertTrue(msg, entry.children().contains(prevChangeset));
 			}
 			if (checkPrevInParents && !cmdResult.isEmpty()) {
 				HgChangeset prevChangeset = reverseResult ? cmdResult.getFirst() : cmdResult.getLast();
-				String msg = String.format("No parent-child bind betwee revisions %d and %d", prevChangeset.getRevisionIndex(), entry.changeset().getRevisionIndex());
+				String msg = String.format("No parent-child bind between revisions %d and %d", prevChangeset.getRevisionIndex(), entry.changeset().getRevisionIndex());
 				errorCollector.assertTrue(msg, p.first() == prevChangeset || p.second() == prevChangeset);
 			}
 			//