comparison 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
comparison
equal deleted inserted replaced
604:c3505001a42a 605:c56edf42be64
178 changelogBuilder.branch(branch == null ? HgRepository.DEFAULT_BRANCH_NAME : branch); 178 changelogBuilder.branch(branch == null ? HgRepository.DEFAULT_BRANCH_NAME : branch);
179 changelogBuilder.user(String.valueOf(user)); 179 changelogBuilder.user(String.valueOf(user));
180 byte[] clogContent = changelogBuilder.build(manifestRev, message); 180 byte[] clogContent = changelogBuilder.build(manifestRev, message);
181 RevlogStreamWriter changelogWriter = new RevlogStreamWriter(repo, repo.getImplAccess().getChangelogStream()); 181 RevlogStreamWriter changelogWriter = new RevlogStreamWriter(repo, repo.getImplAccess().getChangelogStream());
182 Nodeid changesetRev = changelogWriter.addRevision(clogContent, clogRevisionIndex, p1Commit, p2Commit); 182 Nodeid changesetRev = changelogWriter.addRevision(clogContent, clogRevisionIndex, p1Commit, p2Commit);
183 // FIXME move fncache update to an external facility, along with dirstate update 183 // FIXME move fncache update to an external facility, along with dirstate and bookmark update
184 if (!newlyAddedFiles.isEmpty() && repo.fncacheInUse()) { 184 if (!newlyAddedFiles.isEmpty() && repo.fncacheInUse()) {
185 FNCacheFile fncache = new FNCacheFile(repo); 185 FNCacheFile fncache = new FNCacheFile(repo);
186 for (Path p : newlyAddedFiles) { 186 for (Path p : newlyAddedFiles) {
187 fncache.add(p); 187 fncache.add(p);
188 } 188 }
202 for (Path p : touchInDirstate) { 202 for (Path p : touchInDirstate) {
203 dirstateBuilder.recordUncertain(p); 203 dirstateBuilder.recordUncertain(p);
204 } 204 }
205 dirstateBuilder.parents(changesetRev, Nodeid.NULL); 205 dirstateBuilder.parents(changesetRev, Nodeid.NULL);
206 dirstateBuilder.serialize(); 206 dirstateBuilder.serialize();
207 // update bookmarks
208 Nodeid p1Cset = p1Commit == NO_REVISION ? null : clog.getRevision(p1Commit);
209 Nodeid p2Cset = p2Commit == NO_REVISION ? null : clog.getRevision(p2Commit);
210 if (p1Commit != NO_REVISION || p2Commit != NO_REVISION) {
211 repo.getRepo().getBookmarks().updateActive(p1Cset, p2Cset, changesetRev);
212 }
207 return changesetRev; 213 return changesetRev;
208 } 214 }
209 /* 215 /*
210 private Pair<Integer, Integer> getManifestParents() { 216 private Pair<Integer, Integer> getManifestParents() {
211 return new Pair<Integer, Integer>(extractManifestRevisionIndex(p1Commit), extractManifestRevisionIndex(p2Commit)); 217 return new Pair<Integer, Integer>(extractManifestRevisionIndex(p1Commit), extractManifestRevisionIndex(p2Commit));