Mercurial > jhg
comparison src/org/tmatesoft/hg/repo/HgWorkingCopyStatusCollector.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 | 5e95b0da26f2 |
comparison
equal
deleted
inserted
replaced
366:189dc6dc1c3e | 367:2fadf8695f8a |
---|---|
137 private void initDirstateParentManifest() throws HgInvalidControlFileException { | 137 private void initDirstateParentManifest() throws HgInvalidControlFileException { |
138 Nodeid dirstateParent = getDirstateImpl().parents().first(); | 138 Nodeid dirstateParent = getDirstateImpl().parents().first(); |
139 if (dirstateParent.isNull()) { | 139 if (dirstateParent.isNull()) { |
140 dirstateParentManifest = baseRevisionCollector != null ? baseRevisionCollector.raw(-1) : HgStatusCollector.createEmptyManifestRevision(); | 140 dirstateParentManifest = baseRevisionCollector != null ? baseRevisionCollector.raw(-1) : HgStatusCollector.createEmptyManifestRevision(); |
141 } else { | 141 } else { |
142 int changelogLocalRev = repo.getChangelog().getLocalRevision(dirstateParent); | 142 int changeloRevIndex = repo.getChangelog().getRevisionIndex(dirstateParent); |
143 dirstateParentManifest = getManifest(changelogLocalRev); | 143 dirstateParentManifest = getManifest(changeloRevIndex); |
144 } | 144 } |
145 } | 145 } |
146 | 146 |
147 // WC not necessarily points to TIP, but may be result of update to any previous revision. | 147 // WC not necessarily points to TIP, but may be result of update to any previous revision. |
148 // In such case, we need to compare local files not to their TIP content, but to specific version at the time of selected revision | 148 // In such case, we need to compare local files not to their TIP content, but to specific version at the time of selected revision |
151 } | 151 } |
152 | 152 |
153 // may be invoked few times, TIP or WORKING_COPY indicate comparison shall be run against working copy parent | 153 // may be invoked few times, TIP or WORKING_COPY indicate comparison shall be run against working copy parent |
154 // NOTE, use of TIP constant requires certain care. TIP here doesn't mean latest cset, but actual working copy parent. | 154 // NOTE, use of TIP constant requires certain care. TIP here doesn't mean latest cset, but actual working copy parent. |
155 public void walk(int baseRevision, HgStatusInspector inspector) throws HgInvalidControlFileException, IOException { | 155 public void walk(int baseRevision, HgStatusInspector inspector) throws HgInvalidControlFileException, IOException { |
156 if (HgInternals.wrongLocalRevision(baseRevision) || baseRevision == BAD_REVISION) { | 156 if (HgInternals.wrongRevisionIndex(baseRevision) || baseRevision == BAD_REVISION) { |
157 throw new IllegalArgumentException(String.valueOf(baseRevision)); | 157 throw new IllegalArgumentException(String.valueOf(baseRevision)); |
158 } | 158 } |
159 if (getDirstateImpl() == null) { | 159 if (getDirstateImpl() == null) { |
160 getDirstate(); | 160 getDirstate(); |
161 } | 161 } |
412 private boolean areTheSame(FileInfo f, HgDataFile dataFile, Nodeid revision) { | 412 private boolean areTheSame(FileInfo f, HgDataFile dataFile, Nodeid revision) { |
413 // XXX consider adding HgDataDile.compare(File/byte[]/whatever) operation to optimize comparison | 413 // XXX consider adding HgDataDile.compare(File/byte[]/whatever) operation to optimize comparison |
414 ByteArrayChannel bac = new ByteArrayChannel(); | 414 ByteArrayChannel bac = new ByteArrayChannel(); |
415 boolean ioFailed = false; | 415 boolean ioFailed = false; |
416 try { | 416 try { |
417 int localRevision = dataFile.getLocalRevision(revision); | 417 int fileRevisionIndex = dataFile.getRevisionIndex(revision); |
418 // need content with metadata striped off - although theoretically chances are metadata may be different, | 418 // need content with metadata striped off - although theoretically chances are metadata may be different, |
419 // WC doesn't have it anyway | 419 // WC doesn't have it anyway |
420 dataFile.content(localRevision, bac); | 420 dataFile.content(fileRevisionIndex, bac); |
421 } catch (CancelledException ex) { | 421 } catch (CancelledException ex) { |
422 // silently ignore - can't happen, ByteArrayChannel is not cancellable | 422 // silently ignore - can't happen, ByteArrayChannel is not cancellable |
423 } catch (HgException ex) { | 423 } catch (HgException ex) { |
424 repo.getContext().getLog().warn(getClass(), ex, null); | 424 repo.getContext().getLog().warn(getClass(), ex, null); |
425 ioFailed = true; | 425 ioFailed = true; |