diff src/org/tmatesoft/hg/core/Cset.java @ 124:cea84c5995e6

Changeset to access parent nodeids
author Artem Tikhomirov <tikhomirov.artem@gmail.com>
date Tue, 15 Feb 2011 06:30:05 +0100
parents a3a2e5deb320
children 26ad21b250e4
line wrap: on
line diff
--- a/src/org/tmatesoft/hg/core/Cset.java	Fri Feb 04 04:06:44 2011 +0100
+++ b/src/org/tmatesoft/hg/core/Cset.java	Tue Feb 15 06:30:05 2011 +0100
@@ -117,6 +117,22 @@
 		return deletedFiles;
 	}
 
+	// XXX do I need boolean isMergeRevision()?
+	
+	public Nodeid getFirstParentRevision() {
+		// XXX may read once for both p1 and p2 
+		// or use ParentWalker to minimize reads even more.
+		byte[] p1 = new byte[20];
+		statusHelper.getRepo().getChangelog().parents(revNumber, new int[2], p1, null);
+		return Nodeid.fromBinary(p1, 0);
+	}
+	
+	public Nodeid getSecondParentRevision() {
+		byte[] p2 = new byte[20];
+		statusHelper.getRepo().getChangelog().parents(revNumber, new int[2], null, p2);
+		return Nodeid.fromBinary(p2, 0);
+	}
+
 	@Override
 	public Cset clone() {
 		try {
@@ -150,6 +166,7 @@
 			added.add(new FileRevision(repo, nid, s));
 		}
 		for (Path s : r.getRemoved()) {
+			// with Path from getRemoved, may just copy
 			deleted.add(s);
 		}
 		modified.trimToSize();