Mercurial > jhg
comparison src/org/tmatesoft/hg/internal/CommitFacility.java @ 621:99ad1e3a4e4d
RevlogStream: be aware of existence (not HgDataFile), facilitate use of an added HgDataFile over a commit; Rollback: be more sensitive about file changes (file size is not enough: write/rollback leaves it intact); tests
author | Artem Tikhomirov <tikhomirov.artem@gmail.com> |
---|---|
date | Sat, 18 May 2013 22:23:57 +0200 |
parents | 868b2ffdcd5c |
children | 4e6179bde4fc |
comparison
equal
deleted
inserted
replaced
620:272ecffccc8a | 621:99ad1e3a4e4d |
---|---|
144 Pair<Integer, Integer> fp = fileParents.get(df.getPath()); | 144 Pair<Integer, Integer> fp = fileParents.get(df.getPath()); |
145 if (fp == null) { | 145 if (fp == null) { |
146 // NEW FILE | 146 // NEW FILE |
147 fp = new Pair<Integer, Integer>(NO_REVISION, NO_REVISION); | 147 fp = new Pair<Integer, Integer>(NO_REVISION, NO_REVISION); |
148 } | 148 } |
149 RevlogStream contentStream; | 149 RevlogStream contentStream = repo.getImplAccess().getStream(df); |
150 if (df.exists()) { | 150 if (!df.exists()) { |
151 contentStream = repo.getImplAccess().getStream(df); | |
152 } else { | |
153 contentStream = repo.createStoreFile(df.getPath()); | |
154 newlyAddedFiles.put(df.getPath(), contentStream); | 151 newlyAddedFiles.put(df.getPath(), contentStream); |
155 // FIXME df doesn't get df.content updated, and clients | |
156 // that would attempt to access newly added file after commit would fail | |
157 // (despite the fact the file is in there) | |
158 } | 152 } |
159 RevlogStreamWriter fileWriter = new RevlogStreamWriter(repo, contentStream, transaction); | 153 RevlogStreamWriter fileWriter = new RevlogStreamWriter(repo, contentStream, transaction); |
160 Nodeid fileRev = fileWriter.addRevision(bds, clogRevisionIndex, fp.first(), fp.second()); | 154 Nodeid fileRev = fileWriter.addRevision(bds, clogRevisionIndex, fp.first(), fp.second()); |
161 newManifestRevision.put(df.getPath(), fileRev); | 155 newManifestRevision.put(df.getPath(), fileRev); |
162 touchInDirstate.add(df.getPath()); | 156 touchInDirstate.add(df.getPath()); |