Kiln » TortoiseHg » TortoiseHg
Clone URL:  
Pushed to one repository · View In Graph Contained in 1.9, 1.9.1, and 1.9.2

annotate: emit revision summaries to parent revision

Moving the mouse over a line will cause that line's revision summary to
be displayed in the status bar.

Changeset 2282f8439229

Parent ed5208684d51

by Steve Borho

Changes to one file · Browse files at 2282f8439229 Showing diff from parent ed5208684d51 Diff from another changeset...

 
22
23
24
 
25
26
27
 
42
43
44
 
45
46
47
 
50
51
52
 
 
 
53
54
55
 
65
66
67
68
 
69
70
71
72
 
 
 
 
 
 
 
 
 
 
73
74
75
 
77
78
79
 
80
81
82
 
97
98
99
 
100
101
102
 
119
120
121
 
122
123
124
125
126
127
 
128
 
 
129
 
 
 
 
 
 
 
 
 
 
 
 
130
131
132
 
133
134
135
 
227
228
229
 
230
231
232
 
22
23
24
25
26
27
28
 
43
44
45
46
47
48
49
 
52
53
54
55
56
57
58
59
60
 
70
71
72
 
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
 
92
93
94
95
96
97
98
 
113
114
115
116
117
118
119
 
136
137
138
139
140
141
142
143
144
 
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
 
164
165
166
167
 
259
260
261
262
263
264
265
@@ -22,6 +22,7 @@
  loadComplete = pyqtSignal()   errorMessage = pyqtSignal(QString)   revSelected = pyqtSignal(int) + revisionHint = pyqtSignal(QString)     class RevArea(QWidget):   'Display user@rev in front of each line' @@ -42,6 +43,7 @@
    class TextArea(QPlainTextEdit):   'Display lines of annotation text' + revisionHint = pyqtSignal(QString)   def __init__(self, parent=None):   QPlainTextEdit.__init__(self, parent)   self.document().setDefaultStyleSheet(qtlib.thgstylesheet) @@ -50,6 +52,9 @@
  self.charwidth = tm.width('9')   self.charheight = tm.height()   self.revs = [] + self.summaries = [] + self.setMouseTracking(True) + self.lastrev = None     def paintRevArea(self, revarea, event):   painter = QPainter(revarea) @@ -65,11 +70,21 @@
  break   painter.setPen(Qt.black)   rect = QRect(0, top, revarea.width, self.charheight) - painter.drawText(rect, Qt.AlignRight, self.revs[line]) + painter.drawText(rect, Qt.AlignRight, str(self.revs[line]))   block = block.next()   top += self.blockBoundingGeometry(block).height()   line += 1   + def mouseMoveEvent(self, event): + cursor = self.cursorForPosition(event.pos()) + line = cursor.block() + if not line.isValid(): + return + rev = self.revs[line.blockNumber()] + if rev != self.lastrev: + self.revisionHint.emit(self.summaries[rev]) + self.lastrev = rev +   def __init__(self, parent=None):   super(AnnotateView, self).__init__(parent)   @@ -77,6 +92,7 @@
  self.edit = self.TextArea(self)   self.revarea = self.RevArea(self.edit)   self.edit.updateRequest.connect(self.revarea.updateContents) + self.edit.revisionHint.connect(lambda h: self.revisionHint.emit(h))     hbox = QHBoxLayout(self)   hbox.setSpacing(10) @@ -97,6 +113,7 @@
  self.cm = colormap.AnnotateColorSaturation(agedays)   self.curdate = curdate   self.repo = repo + self.annfile = wfile   self.loadBegin.emit()   self.thread = AnnotateThread(fctx)   self.thread.done.connect(self.finished) @@ -119,17 +136,32 @@
    def fillModel(self, data):   revs, lines, lpos, sels = [], [], [], [] + sums = {}   pos = 0   for fctx, origline, text in data:   rev = fctx.linkrev()   lines.append(text)   lpos.append(pos) - revs.append(str(rev)) + revs.append(rev)   pos += len(text) + if rev in sums: + continue   + author = hglib.username(fctx.user()) + date = hglib.age(fctx.date()) + l = fctx.description().replace(u'\0', '').splitlines() + summary = l and l[0] or '' + if fctx.path() == self.annfile: + source = '' + else: + source = '(%s)' % fctx.path() + desc = '%s@%s%s:%s "%s"' % (author, rev, source, date, summary) + sums[rev] = desc + + self.edit.summaries = sums   self.edit.setPlainText(''.join(lines))   self.edit.revs = revs - width = max([len(r) for r in revs]) * self.edit.charwidth + 3 + width = max([len(str(r)) for r in revs]) * self.edit.charwidth + 3   self.revarea.width = width   self.revarea.setFixedWidth(width)   @@ -227,6 +259,7 @@
    status = QLabel()   mainvbox.addWidget(status) + av.revisionHint.connect(status.setText)   self.status = status     self.opts = opts