Mercurial > jhg
comparison src/org/tmatesoft/hg/internal/FileAnnotation.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 | 8ed4f4f4f0a6 |
children | 6526d8adbc0f |
comparison
equal
deleted
inserted
replaced
602:e3717fc7d26f | 603:707b5c7c6fa4 |
---|---|
17 package org.tmatesoft.hg.internal; | 17 package org.tmatesoft.hg.internal; |
18 | 18 |
19 | 19 |
20 import org.tmatesoft.hg.core.HgCallbackTargetException; | 20 import org.tmatesoft.hg.core.HgCallbackTargetException; |
21 import org.tmatesoft.hg.core.HgIterateDirection; | 21 import org.tmatesoft.hg.core.HgIterateDirection; |
22 import org.tmatesoft.hg.repo.HgBlameFacility; | 22 import org.tmatesoft.hg.repo.HgBlameInspector; |
23 import org.tmatesoft.hg.repo.HgBlameInspector.RevisionDescriptor; | |
24 import org.tmatesoft.hg.repo.HgDataFile; | |
23 import org.tmatesoft.hg.repo.HgInvalidStateException; | 25 import org.tmatesoft.hg.repo.HgInvalidStateException; |
24 import org.tmatesoft.hg.repo.HgBlameFacility.AddBlock; | |
25 import org.tmatesoft.hg.repo.HgBlameFacility.BlockData; | |
26 import org.tmatesoft.hg.repo.HgBlameFacility.ChangeBlock; | |
27 import org.tmatesoft.hg.repo.HgBlameFacility.DeleteBlock; | |
28 import org.tmatesoft.hg.repo.HgBlameFacility.EqualBlock; | |
29 import org.tmatesoft.hg.repo.HgBlameFacility.RevisionDescriptor; | |
30 import org.tmatesoft.hg.repo.HgDataFile; | |
31 | 26 |
32 /** | 27 /** |
33 * Produce output like 'hg annotate' does | 28 * Produce output like 'hg annotate' does |
34 * | 29 * |
35 * @author Artem Tikhomirov | 30 * @author Artem Tikhomirov |
36 * @author TMate Software Ltd. | 31 * @author TMate Software Ltd. |
37 */ | 32 */ |
38 public class FileAnnotation implements HgBlameFacility.Inspector, RevisionDescriptor.Recipient { | 33 public class FileAnnotation implements HgBlameInspector, RevisionDescriptor.Recipient { |
39 | 34 |
40 @Experimental(reason="The line-by-line inspector likely to become part of core/command API") | 35 @Experimental(reason="The line-by-line inspector likely to become part of core/command API") |
41 @Callback | 36 @Callback |
42 public interface LineInspector { | 37 public interface LineInspector { |
43 /** | 38 /** |
56 public static void annotate(HgDataFile df, int changelogRevisionIndex, LineInspector insp) throws HgCallbackTargetException { | 51 public static void annotate(HgDataFile df, int changelogRevisionIndex, LineInspector insp) throws HgCallbackTargetException { |
57 if (!df.exists()) { | 52 if (!df.exists()) { |
58 return; | 53 return; |
59 } | 54 } |
60 FileAnnotation fa = new FileAnnotation(insp); | 55 FileAnnotation fa = new FileAnnotation(insp); |
61 HgBlameFacility af = new HgBlameFacility(df); | 56 df.annotate(changelogRevisionIndex, fa, HgIterateDirection.NewToOld); |
62 af.annotate(changelogRevisionIndex, fa, HgIterateDirection.NewToOld); | |
63 } | 57 } |
64 | 58 |
65 // keeps <startSeq1, startSeq2, len> of equal blocks, origin to target, from some previous step | 59 // keeps <startSeq1, startSeq2, len> of equal blocks, origin to target, from some previous step |
66 private RangeSeq activeEquals; | 60 private RangeSeq activeEquals; |
67 // equal blocks of the current iteration, to be recalculated before next step | 61 // equal blocks of the current iteration, to be recalculated before next step |