diff src/org/tmatesoft/hg/internal/CommitFacility.java @ 605:c56edf42be64

Commit: update active bookmark with new revision
author Artem Tikhomirov <tikhomirov.artem@gmail.com>
date Mon, 06 May 2013 20:28:21 +0200
parents e447384f3771
children 66f1cc23b906
line wrap: on
line diff
--- a/src/org/tmatesoft/hg/internal/CommitFacility.java	Mon May 06 18:53:04 2013 +0200
+++ b/src/org/tmatesoft/hg/internal/CommitFacility.java	Mon May 06 20:28:21 2013 +0200
@@ -180,7 +180,7 @@
 		byte[] clogContent = changelogBuilder.build(manifestRev, message);
 		RevlogStreamWriter changelogWriter = new RevlogStreamWriter(repo, repo.getImplAccess().getChangelogStream());
 		Nodeid changesetRev = changelogWriter.addRevision(clogContent, clogRevisionIndex, p1Commit, p2Commit);
-		// FIXME move fncache update to an external facility, along with dirstate update
+		// FIXME move fncache update to an external facility, along with dirstate and bookmark update
 		if (!newlyAddedFiles.isEmpty() && repo.fncacheInUse()) {
 			FNCacheFile fncache = new FNCacheFile(repo);
 			for (Path p : newlyAddedFiles) {
@@ -204,6 +204,12 @@
 		}
 		dirstateBuilder.parents(changesetRev, Nodeid.NULL);
 		dirstateBuilder.serialize();
+		// update bookmarks
+		Nodeid p1Cset = p1Commit == NO_REVISION ? null : clog.getRevision(p1Commit);
+		Nodeid p2Cset = p2Commit == NO_REVISION ? null : clog.getRevision(p2Commit);
+		if (p1Commit != NO_REVISION || p2Commit != NO_REVISION) {
+			repo.getRepo().getBookmarks().updateActive(p1Cset, p2Cset, changesetRev);
+		}
 		return changesetRev;
 	}
 /*