comparison src/org/tmatesoft/hg/internal/CommitFacility.java @ 660:4fd317a2fecf

Pull: phase1 get remote changes and add local revisions
author Artem Tikhomirov <tikhomirov.artem@gmail.com>
date Tue, 09 Jul 2013 21:46:45 +0200
parents 12a4f60ea972
children ae2d439fbed3
comparison
equal deleted inserted replaced
658:d10399f80f4e 660:4fd317a2fecf
155 RevlogStream contentStream = repo.getImplAccess().getStream(df); 155 RevlogStream contentStream = repo.getImplAccess().getStream(df);
156 if (!df.exists()) { 156 if (!df.exists()) {
157 newlyAddedFiles.put(df.getPath(), contentStream); 157 newlyAddedFiles.put(df.getPath(), contentStream);
158 } 158 }
159 RevlogStreamWriter fileWriter = new RevlogStreamWriter(repo, contentStream, transaction); 159 RevlogStreamWriter fileWriter = new RevlogStreamWriter(repo, contentStream, transaction);
160 Nodeid fileRev = fileWriter.addRevision(bds, clogRevisionIndex, fp.first(), fp.second()); 160 Nodeid fileRev = fileWriter.addRevision(bds, clogRevisionIndex, fp.first(), fp.second()).second();
161 newManifestRevision.put(df.getPath(), fileRev); 161 newManifestRevision.put(df.getPath(), fileRev);
162 touchInDirstate.add(df.getPath()); 162 touchInDirstate.add(df.getPath());
163 } 163 }
164 // 164 //
165 // Manifest 165 // Manifest
166 final ManifestEntryBuilder manifestBuilder = new ManifestEntryBuilder(repo.buildFileNameEncodingHelper()); 166 final ManifestEntryBuilder manifestBuilder = new ManifestEntryBuilder(repo.buildFileNameEncodingHelper());
167 for (Map.Entry<Path, Nodeid> me : newManifestRevision.entrySet()) { 167 for (Map.Entry<Path, Nodeid> me : newManifestRevision.entrySet()) {
168 manifestBuilder.add(me.getKey().toString(), me.getValue()); 168 manifestBuilder.add(me.getKey().toString(), me.getValue());
169 } 169 }
170 RevlogStreamWriter manifestWriter = new RevlogStreamWriter(repo, repo.getImplAccess().getManifestStream(), transaction); 170 RevlogStreamWriter manifestWriter = new RevlogStreamWriter(repo, repo.getImplAccess().getManifestStream(), transaction);
171 Nodeid manifestRev = manifestWriter.addRevision(manifestBuilder, clogRevisionIndex, manifestParents.first(), manifestParents.second()); 171 Nodeid manifestRev = manifestWriter.addRevision(manifestBuilder, clogRevisionIndex, manifestParents.first(), manifestParents.second()).second();
172 // 172 //
173 // Changelog 173 // Changelog
174 final ChangelogEntryBuilder changelogBuilder = new ChangelogEntryBuilder(); 174 final ChangelogEntryBuilder changelogBuilder = new ChangelogEntryBuilder();
175 changelogBuilder.setModified(files.keySet()); 175 changelogBuilder.setModified(files.keySet());
176 changelogBuilder.branch(branch == null ? DEFAULT_BRANCH_NAME : branch); 176 changelogBuilder.branch(branch == null ? DEFAULT_BRANCH_NAME : branch);
177 changelogBuilder.user(String.valueOf(user)); 177 changelogBuilder.user(String.valueOf(user));
178 changelogBuilder.manifest(manifestRev).comment(message); 178 changelogBuilder.manifest(manifestRev).comment(message);
179 RevlogStreamWriter changelogWriter = new RevlogStreamWriter(repo, repo.getImplAccess().getChangelogStream(), transaction); 179 RevlogStreamWriter changelogWriter = new RevlogStreamWriter(repo, repo.getImplAccess().getChangelogStream(), transaction);
180 Nodeid changesetRev = changelogWriter.addRevision(changelogBuilder, clogRevisionIndex, p1Commit, p2Commit); 180 Nodeid changesetRev = changelogWriter.addRevision(changelogBuilder, clogRevisionIndex, p1Commit, p2Commit).second();
181 // TODO move fncache update to an external facility, along with dirstate and bookmark update 181 // TODO move fncache update to an external facility, along with dirstate and bookmark update
182 if (!newlyAddedFiles.isEmpty() && repo.fncacheInUse()) { 182 if (!newlyAddedFiles.isEmpty() && repo.fncacheInUse()) {
183 FNCacheFile fncache = new FNCacheFile(repo); 183 FNCacheFile fncache = new FNCacheFile(repo);
184 for (Path p : newlyAddedFiles.keySet()) { 184 for (Path p : newlyAddedFiles.keySet()) {
185 fncache.addIndex(p); 185 fncache.addIndex(p);