comparison src/org/tmatesoft/hg/repo/HgStatusCollector.java @ 367:2fadf8695f8a

Use 'revision index' instead of the vague 'local revision number' concept in the API
author Artem Tikhomirov <tikhomirov.artem@gmail.com>
date Fri, 16 Dec 2011 15:37:27 +0100
parents 189dc6dc1c3e
children 0ae53c32ecef 281cfb60e2ef
comparison
equal deleted inserted replaced
366:189dc6dc1c3e 367:2fadf8695f8a
292 292
293 /*package-local*/static Path getOriginIfCopy(HgRepository hgRepo, Path fname, Collection<Path> originals, int originalChangelogRevision) throws HgDataStreamException, HgInvalidControlFileException { 293 /*package-local*/static Path getOriginIfCopy(HgRepository hgRepo, Path fname, Collection<Path> originals, int originalChangelogRevision) throws HgDataStreamException, HgInvalidControlFileException {
294 HgDataFile df = hgRepo.getFileNode(fname); 294 HgDataFile df = hgRepo.getFileNode(fname);
295 if (!df.exists()) { 295 if (!df.exists()) {
296 String msg = String.format("Didn't find file '%s' in the repo. Perhaps, bad storage name conversion?", fname); 296 String msg = String.format("Didn't find file '%s' in the repo. Perhaps, bad storage name conversion?", fname);
297 throw new HgDataStreamException(fname, msg, null).setRevisionNumber(originalChangelogRevision); 297 throw new HgDataStreamException(fname, msg, null).setRevisionIndex(originalChangelogRevision);
298 } 298 }
299 while (df.isCopy()) { 299 while (df.isCopy()) {
300 Path original = df.getCopySourceName(); 300 Path original = df.getCopySourceName();
301 if (originals.contains(original)) { 301 if (originals.contains(original)) {
302 df = hgRepo.getFileNode(original); 302 df = hgRepo.getFileNode(original);
303 int changelogRevision = df.getChangesetLocalRevision(0); 303 int changelogRevision = df.getChangesetRevisionIndex(0);
304 if (changelogRevision <= originalChangelogRevision) { 304 if (changelogRevision <= originalChangelogRevision) {
305 // copy/rename source was known prior to rev1 305 // copy/rename source was known prior to rev1
306 // (both r1Files.contains is true and original was created earlier than rev1) 306 // (both r1Files.contains is true and original was created earlier than rev1)
307 // without r1Files.contains changelogRevision <= rev1 won't suffice as the file 307 // without r1Files.contains changelogRevision <= rev1 won't suffice as the file
308 // might get removed somewhere in between (changelogRevision < R < rev1) 308 // might get removed somewhere in between (changelogRevision < R < rev1)