comparison src/org/tmatesoft/hg/core/HgDiffCommand.java @ 675:a20121a2bba6

Respect default range (0..tip)
author Artem Tikhomirov <tikhomirov.artem@gmail.com>
date Thu, 18 Jul 2013 18:02:36 +0200
parents 54e16ab771ec
children 98ff1fb49abe
comparison
equal deleted inserted replaced
674:cce0387c6041 675:a20121a2bba6
137 public void executeDiff(HgBlameInspector insp) throws HgCallbackTargetException, CancelledException, HgException { 137 public void executeDiff(HgBlameInspector insp) throws HgCallbackTargetException, CancelledException, HgException {
138 checkFile(); 138 checkFile();
139 final ProgressSupport progress = getProgressSupport(insp); 139 final ProgressSupport progress = getProgressSupport(insp);
140 progress.start(2); 140 progress.start(2);
141 try { 141 try {
142 final int startRevIndex = clogRevIndexStart.get(0);
143 final int endRevIndex = clogRevIndexEnd.get(TIP);
142 final CancelSupport cancel = getCancelSupport(insp, true); 144 final CancelSupport cancel = getCancelSupport(insp, true);
143 int fileRevIndex1 = fileRevIndex(df, clogRevIndexStart.get()); 145 int fileRevIndex1 = fileRevIndex(df, startRevIndex);
144 int fileRevIndex2 = fileRevIndex(df, clogRevIndexEnd.get()); 146 int fileRevIndex2 = fileRevIndex(df, endRevIndex);
145 BlameHelper bh = new BlameHelper(insp); 147 BlameHelper bh = new BlameHelper(insp);
146 bh.prepare(df, clogRevIndexStart.get(), clogRevIndexEnd.get()); 148 bh.prepare(df, startRevIndex, endRevIndex);
147 progress.worked(1); 149 progress.worked(1);
148 cancel.checkCancelled(); 150 cancel.checkCancelled();
149 bh.diff(fileRevIndex1, clogRevIndexStart.get(), fileRevIndex2, clogRevIndexEnd.get()); 151 bh.diff(fileRevIndex1, startRevIndex, fileRevIndex2, endRevIndex);
150 progress.worked(1); 152 progress.worked(1);
151 cancel.checkCancelled(); 153 cancel.checkCancelled();
152 } catch (HgRuntimeException ex) { 154 } catch (HgRuntimeException ex) {
153 throw new HgLibraryFailureException(ex); 155 throw new HgLibraryFailureException(ex);
154 } finally { 156 } finally {
170 if (!df.exists()) { 172 if (!df.exists()) {
171 return; 173 return;
172 } 174 }
173 final CancelSupport cancel = getCancelSupport(insp, true); 175 final CancelSupport cancel = getCancelSupport(insp, true);
174 BlameHelper bh = new BlameHelper(insp); 176 BlameHelper bh = new BlameHelper(insp);
175 FileHistory fileHistory = bh.prepare(df, clogRevIndexStart.get(), clogRevIndexEnd.get()); 177 final int startRevIndex = clogRevIndexStart.get(0);
178 final int endRevIndex = clogRevIndexEnd.get(TIP);
179 FileHistory fileHistory = bh.prepare(df, startRevIndex, endRevIndex);
176 // 180 //
177 cancel.checkCancelled(); 181 cancel.checkCancelled();
178 int totalWork = 0; 182 int totalWork = 0;
179 for (FileRevisionHistoryChunk fhc : fileHistory.iterate(iterateDirection)) { 183 for (FileRevisionHistoryChunk fhc : fileHistory.iterate(iterateDirection)) {
180 totalWork += fhc.revisionCount(); 184 totalWork += fhc.revisionCount();
187 int[] fileParentRevs = new int[2]; 191 int[] fileParentRevs = new int[2];
188 for (FileRevisionHistoryChunk fhc : fileHistory.iterate(iterateDirection)) { 192 for (FileRevisionHistoryChunk fhc : fileHistory.iterate(iterateDirection)) {
189 for (int fri : fhc.fileRevisions(iterateDirection)) { 193 for (int fri : fhc.fileRevisions(iterateDirection)) {
190 int clogRevIndex = fhc.changeset(fri); 194 int clogRevIndex = fhc.changeset(fri);
191 // the way we built fileHistory ensures we won't walk past [changelogRevIndexStart..changelogRevIndexEnd] 195 // the way we built fileHistory ensures we won't walk past [changelogRevIndexStart..changelogRevIndexEnd]
192 assert clogRevIndex >= clogRevIndexStart.get(); 196 assert clogRevIndex >= startRevIndex;
193 assert clogRevIndex <= clogRevIndexEnd.get(); 197 assert clogRevIndex <= endRevIndex;
194 fhc.fillFileParents(fri, fileParentRevs); 198 fhc.fillFileParents(fri, fileParentRevs);
195 fhc.fillCsetParents(fri, fileClogParentRevs); 199 fhc.fillCsetParents(fri, fileClogParentRevs);
196 bh.annotateChange(fri, clogRevIndex, fileParentRevs, fileClogParentRevs); 200 bh.annotateChange(fri, clogRevIndex, fileParentRevs, fileClogParentRevs);
197 progress.worked(1); 201 progress.worked(1);
198 cancel.checkCancelled(); 202 cancel.checkCancelled();