Mercurial > hg4j
comparison src/org/tmatesoft/hg/internal/BlameHelper.java @ 603:707b5c7c6fa4
Refactor HgBlameFacility: relevant action methods moved to proper home (HgDataFile), as facility doesn't provide anything but packaging of relevant methods/interfaces
author | Artem Tikhomirov <tikhomirov.artem@gmail.com> |
---|---|
date | Mon, 06 May 2013 18:29:57 +0200 |
parents | c4fd1037bc6f |
children | b4948b159ab1 |
comparison
equal
deleted
inserted
replaced
602:e3717fc7d26f | 603:707b5c7c6fa4 |
---|---|
22 import java.util.ListIterator; | 22 import java.util.ListIterator; |
23 | 23 |
24 import org.tmatesoft.hg.core.HgCallbackTargetException; | 24 import org.tmatesoft.hg.core.HgCallbackTargetException; |
25 import org.tmatesoft.hg.internal.DiffHelper.LineSequence; | 25 import org.tmatesoft.hg.internal.DiffHelper.LineSequence; |
26 import org.tmatesoft.hg.internal.DiffHelper.LineSequence.ByteChain; | 26 import org.tmatesoft.hg.internal.DiffHelper.LineSequence.ByteChain; |
27 import org.tmatesoft.hg.repo.HgBlameFacility.Block; | 27 import org.tmatesoft.hg.repo.HgBlameInspector.Block; |
28 import org.tmatesoft.hg.repo.HgBlameFacility.BlockData; | 28 import org.tmatesoft.hg.repo.HgBlameInspector.BlockData; |
29 import org.tmatesoft.hg.repo.HgBlameFacility.ChangeBlock; | 29 import org.tmatesoft.hg.repo.HgBlameInspector.ChangeBlock; |
30 import org.tmatesoft.hg.repo.HgBlameFacility.EqualBlock; | 30 import org.tmatesoft.hg.repo.HgBlameInspector.EqualBlock; |
31 import org.tmatesoft.hg.repo.HgBlameFacility.Inspector; | 31 import org.tmatesoft.hg.repo.HgBlameInspector.RevisionDescriptor; |
32 import org.tmatesoft.hg.repo.HgBlameFacility.RevisionDescriptor; | 32 import org.tmatesoft.hg.repo.HgBlameInspector.RevisionDescriptor.Recipient; |
33 import org.tmatesoft.hg.repo.HgBlameFacility.RevisionDescriptor.Recipient; | 33 import org.tmatesoft.hg.repo.HgBlameInspector; |
34 import org.tmatesoft.hg.repo.HgBlameFacility; | |
35 import org.tmatesoft.hg.repo.HgDataFile; | 34 import org.tmatesoft.hg.repo.HgDataFile; |
36 import org.tmatesoft.hg.repo.HgInvalidStateException; | 35 import org.tmatesoft.hg.repo.HgInvalidStateException; |
37 import org.tmatesoft.hg.util.Adaptable; | 36 import org.tmatesoft.hg.util.Adaptable; |
38 import org.tmatesoft.hg.util.CancelledException; | 37 import org.tmatesoft.hg.util.CancelledException; |
39 import org.tmatesoft.hg.util.Pair; | 38 import org.tmatesoft.hg.util.Pair; |
40 | 39 |
41 /** | 40 /** |
42 * Blame implementation | 41 * Blame implementation |
43 * @see HgBlameFacility | 42 * @see HgBlameInspector |
44 * @author Artem Tikhomirov | 43 * @author Artem Tikhomirov |
45 * @author TMate Software Ltd. | 44 * @author TMate Software Ltd. |
46 */ | 45 */ |
47 public class BlameHelper { | 46 public class BlameHelper { |
48 | 47 |
49 private final Inspector insp; | 48 private final HgBlameInspector insp; |
50 private FileLinesCache linesCache; | 49 private FileLinesCache linesCache; |
51 | 50 |
52 // FIXME exposing internals (use of FileLinesCache through cons arg and #useFileUpTo) smells bad, refactor! | 51 // FIXME exposing internals (use of FileLinesCache through cons arg and #useFileUpTo) smells bad, refactor! |
53 | 52 |
54 public BlameHelper(Inspector inspector, int cacheHint) { | 53 public BlameHelper(HgBlameInspector inspector, int cacheHint) { |
55 insp = inspector; | 54 insp = inspector; |
56 linesCache = new FileLinesCache(cacheHint); | 55 linesCache = new FileLinesCache(cacheHint); |
57 } | 56 } |
58 | 57 |
59 public void useFileUpTo(HgDataFile df, int clogRevIndex) { | 58 public void useFileUpTo(HgDataFile df, int clogRevIndex) { |
190 return rv; | 189 return rv; |
191 } | 190 } |
192 } | 191 } |
193 | 192 |
194 private static class BlameBlockInspector extends DiffHelper.DeltaInspector<LineSequence> { | 193 private static class BlameBlockInspector extends DiffHelper.DeltaInspector<LineSequence> { |
195 private final Inspector insp; | 194 private final HgBlameInspector insp; |
196 private final int csetOrigin; | 195 private final int csetOrigin; |
197 private final int csetTarget; | 196 private final int csetTarget; |
198 private EqualBlocksCollector p2MergeCommon; | 197 private EqualBlocksCollector p2MergeCommon; |
199 private int csetMergeParent; | 198 private int csetMergeParent; |
200 private IntVector mergeRanges; | 199 private IntVector mergeRanges; |
201 private final AnnotateRev annotatedRevision; | 200 private final AnnotateRev annotatedRevision; |
202 private HgCallbackTargetException error; | 201 private HgCallbackTargetException error; |
203 | 202 |
204 public BlameBlockInspector(HgDataFile df, int fileRevIndex, Inspector inspector, int originCset, int targetCset) { | 203 public BlameBlockInspector(HgDataFile df, int fileRevIndex, HgBlameInspector inspector, int originCset, int targetCset) { |
205 assert inspector != null; | 204 assert inspector != null; |
206 insp = inspector; | 205 insp = inspector; |
207 annotatedRevision = new AnnotateRev(); | 206 annotatedRevision = new AnnotateRev(); |
208 annotatedRevision.set(df, fileRevIndex); | 207 annotatedRevision.set(df, fileRevIndex); |
209 csetOrigin = originCset; | 208 csetOrigin = originCset; |