2 Author: Marco Costalba (C) 2005-2007
4 Copyright: See COPYING file that comes with this distribution
12 #include "exceptionmanager.h"
22 ReachInfo(SCRef s
, int i
, int t
) : sha(s
), id(i
), type(t
) {}
27 typedef QVector
<ReachInfo
> ReachList
;
31 RangeInfo() { clear(); }
32 RangeInfo(int s
, int e
, bool m
) : start(s
), end(e
), modified(m
) {}
33 void clear() { start
= end
= 0; modified
= false; }
34 int start
, end
; // ranges count file lines from 1 like patches diffs
37 typedef QHash
<QString
, RangeInfo
> Ranges
;
39 class Annotate
: public QObject
{
42 Annotate(Git
* parent
, QObject
* guiObj
);
43 void deleteWhenDone();
44 const FileAnnotation
* lookupAnnotation(SCRef sha
);
45 bool start(const FileHistory
* fh
);
46 bool isCanceled() { return canceled
; }
47 const QString
getAncestor(SCRef sha
, int* shaIdx
);
48 bool getRange(SCRef sha
, RangeInfo
* r
);
49 bool seekPosition(int* rangeStart
, int* rangeEnd
, SCRef fromSha
, SCRef toSha
);
50 const QString
computeRanges(SCRef sha
, int paraFrom
, int paraTo
, SCRef target
= "");
53 void annotateReady(Annotate
*, bool, const QString
&);
56 void on_deleteWhenDone();
57 void slotComputeDiffs();
60 void annotateFileHistory();
61 void doAnnotate(const ShaString
& sha
);
62 FileAnnotation
* getFileAnnotation(SCRef sha
);
63 void setInitialAnnotation(SCRef fileSha
, FileAnnotation
* fa
);
64 const QString
setupAuthor(SCRef origAuthor
, int annId
);
65 bool setAnnotation(SCRef diff
, SCRef aut
, SCList pAnn
, SList nAnn
, int ofs
= 0);
66 bool getNextLine(SCRef d
, int& idx
, QString
& line
);
67 static void unify(SList dst
, SCList src
);
68 const QString
getPatch(SCRef sha
, int parentNum
= 0);
69 bool getNextSection(SCRef d
, int& idx
, QString
& sec
, SCRef target
);
70 void updateRange(RangeInfo
* r
, SCRef diff
, bool reverse
);
71 void updateCrossRanges(SCRef cnk
, bool rev
, int oStart
, int oLineCnt
, RangeInfo
* r
);
72 bool isDescendant(SCRef sha
, SCRef target
);
74 EM_DECLARE(exAnnCanceled
);
78 const FileHistory
* fh
;
80 bool cancelingAnnotate
;
82 bool annotateActivity
;
87 ShaVect histRevOrder
; // TODO use reference