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

eliminate /hgqt/hgviewlib subdirectory

Changeset 8ef38b068ffd

Parent 437926385476

by Adrian Buehlmann

Changes to 47 files · Browse files at 8ef38b068ffd Showing diff from parent 437926385476 Diff from another changeset...

Show Entire File tortoisehg/​hgqt/​__init__.py Stacked
renamed from tortoisehg/hgqt/hgviewlib/__init__.py
(No changes)
Show Entire File tortoisehg/​hgqt/​blockmatcher.py Stacked
renamed from tortoisehg/hgqt/hgviewlib/blockmatcher.py
(No changes)
Show Entire File tortoisehg/​hgqt/​config.py Stacked
renamed from tortoisehg/hgqt/hgviewlib/config.py
(No changes)
Show Entire File tortoisehg/​hgqt/​decorators.py Stacked
renamed from tortoisehg/hgqt/hgviewlib/decorators.py
(No changes)
Show Entire File tortoisehg/​hgqt/​filediffviewer.ui Stacked
renamed from tortoisehg/hgqt/hgviewlib/filediffviewer.ui
(No changes)
Show Entire File tortoisehg/​hgqt/​fileviewer.ui Stacked
renamed from tortoisehg/hgqt/hgviewlib/fileviewer.ui
(No changes)
Change 1 of 1 Show Entire File tortoisehg/​hgqt/​helpviewer.py Stacked
renamed from tortoisehg/hgqt/hgviewlib/helpviewer.py
 
14
15
16
17
18
19
 
 
 
20
21
22
 
14
15
16
 
 
 
17
18
19
20
21
22
@@ -14,9 +14,9 @@
   from PyQt4 import QtCore, QtGui, Qsci   -from tortoisehg.hgqt.hgviewlib import icon as geticon -from tortoisehg.hgqt.hgviewlib.hgdialogmixin import HgDialogMixin -from tortoisehg.hgqt.hgviewlib.hgviewhelp import help_msg, get_options_helpmsg +from tortoisehg.hgqt import icon as geticon +from tortoisehg.hgqt.hgdialogmixin import HgDialogMixin +from tortoisehg.hgqt.hgviewhelp import help_msg, get_options_helpmsg    Qt = QtCore.Qt  bold = QtGui.QFont.Bold
Show Entire File tortoisehg/​hgqt/​helpviewer.ui Stacked
renamed from tortoisehg/hgqt/hgviewlib/helpviewer.ui
(No changes)
Show Entire File tortoisehg/​hgqt/​helpviewer_ui.py Stacked
renamed from tortoisehg/hgqt/hgviewlib/helpviewer_ui.py
(No changes)
Change 1 of 2 Show Entire File tortoisehg/​hgqt/​hgdialogmixin.py Stacked
renamed from tortoisehg/hgqt/hgviewlib/hgdialogmixin.py
 
28
29
30
31
32
 
 
33
34
35
 
50
51
52
53
 
54
55
56
 
28
29
30
 
 
31
32
33
34
35
 
50
51
52
 
53
54
55
56
@@ -28,8 +28,8 @@
 SIGNAL = QtCore.SIGNAL  Qt = QtCore.Qt   -from tortoisehg.hgqt.hgviewlib.config import HgConfig -from tortoisehg.hgqt.hgviewlib import should_rebuild +from tortoisehg.hgqt.config import HgConfig +from tortoisehg.hgqt import should_rebuild    class HgDialogMixin(object):   """ @@ -50,7 +50,7 @@
  os.system('pyuic4 %s -o %s' % (uifile, pyfile))   try:   modname = osp.splitext(osp.basename(uifile))[0] + "_ui" - modname = "hgviewlib.%s" % modname + modname = "tortoisehg.hgqt.%s" % modname   mod = __import__(modname, fromlist=['*'])   classnames = [x for x in dir(mod) if x.startswith('Ui_')]   if len(classnames) == 1:
Change 1 of 2 Show Entire File tortoisehg/​hgqt/​hgfiledialog.py Stacked
renamed from tortoisehg/hgqt/hgviewlib/hgfiledialog.py
 
30
31
32
33
34
35
36
37
38
 
 
 
 
 
 
39
40
41
 
104
105
106
107
 
108
109
110
 
30
31
32
 
 
 
 
 
 
33
34
35
36
37
38
39
40
41
 
104
105
106
 
107
108
109
110
@@ -30,12 +30,12 @@
   from tortoisehg.util.util import tounicode, rootpath   -from tortoisehg.hgqt.hgviewlib import icon as geticon -from tortoisehg.hgqt.hgviewlib.hgdialogmixin import HgDialogMixin -from tortoisehg.hgqt.hgviewlib.hgrepomodel import FileRevModel -from tortoisehg.hgqt.hgviewlib.blockmatcher import BlockList, BlockMatch -from tortoisehg.hgqt.hgviewlib.lexers import get_lexer -from tortoisehg.hgqt.hgviewlib.quickbar import FindInGraphlogQuickBar +from tortoisehg.hgqt import icon as geticon +from tortoisehg.hgqt.hgdialogmixin import HgDialogMixin +from tortoisehg.hgqt.hgrepomodel import FileRevModel +from tortoisehg.hgqt.blockmatcher import BlockList, BlockMatch +from tortoisehg.hgqt.lexers import get_lexer +from tortoisehg.hgqt.quickbar import FindInGraphlogQuickBar    connect = QtCore.QObject.connect  disconnect = QtCore.QObject.disconnect @@ -104,7 +104,7 @@
  """   if self.repoviewer is None:   # prevent recursive import - from hgviewlib.hgrepoviewer import HgRepoViewer + from hgrepoviewer import HgRepoViewer   self.repoviewer = HgRepoViewer(self.repo)   self.repoviewer.goto(rev)   self.repoviewer.show()
Change 1 of 1 Show Changes Only tortoisehg/​hgqt/​hgfileview.py Stacked
renamed from tortoisehg/hgqt/hgviewlib/hgfileview.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
 
 
39
40
41
42
43
44
45
 
 
 
 
 
 
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
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
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
 
 
37
38
39
 
 
 
 
 
 
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
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
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
 # Copyright (c) 2009-2010 LOGILAB S.A. (Paris, FRANCE).  # http://www.logilab.fr/ -- mailto:contact@logilab.fr  #  # This program is free software; you can redistribute it and/or modify it under  # the terms of the GNU General Public License as published by the Free Software  # Foundation; either version 2 of the License, or (at your option) any later  # version.  #  # This program is distributed in the hope that it will be useful, but WITHOUT  # ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS  # FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.  #  # You should have received a copy of the GNU General Public License along with  # this program; if not, write to the Free Software Foundation, Inc.,  # 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.  """  Qt4 high level widgets for hg repo changelogs and filelogs  """  import sys  import difflib    from mercurial.node import hex, short as short_hex, bin as short_bin  from mercurial import util  try:   from mercurial.error import LookupError  except ImportError:   from mercurial.revlog import LookupError    from PyQt4 import QtCore, QtGui, Qsci  Qt = QtCore.Qt  connect = QtCore.QObject.connect  SIGNAL = QtCore.SIGNAL  nullvariant = QtCore.QVariant()    from tortoisehg.util.util import exec_flag_changed, isbfile, bfilepath   -from tortoisehg.hgqt.hgviewlib.decorators import timeit -from tortoisehg.hgqt.hgviewlib.config import HgConfig +from tortoisehg.hgqt.decorators import timeit +from tortoisehg.hgqt.config import HgConfig   -from tortoisehg.hgqt.hgviewlib import icon as geticon -from tortoisehg.hgqt.hgviewlib.hgfiledialog import FileViewer, FileDiffViewer -from tortoisehg.hgqt.hgviewlib.hgmanifestdialog import ManifestViewer -from tortoisehg.hgqt.hgviewlib.quickbar import QuickBar -from tortoisehg.hgqt.hgviewlib.lexers import get_lexer -from tortoisehg.hgqt.hgviewlib.blockmatcher import BlockList +from tortoisehg.hgqt import icon as geticon +from tortoisehg.hgqt.hgfiledialog import FileViewer, FileDiffViewer +from tortoisehg.hgqt.hgmanifestdialog import ManifestViewer +from tortoisehg.hgqt.quickbar import QuickBar +from tortoisehg.hgqt.lexers import get_lexer +from tortoisehg.hgqt.blockmatcher import BlockList    qsci = Qsci.QsciScintilla    class Annotator(qsci):   # we use a QScintilla for the annotater cause it makes   # it much easier to keep the text area and the annotater sync   # (same font rendering etc). However, it have the drawback of making much   # more difficult to implement things like QTextBrowser.anchorClicked, which   # would have been nice to directly go to the annotated revision...   def __init__(self, textarea, parent=None):   qsci.__init__(self, parent)     self.setFrameStyle(0)   self.setVerticalScrollBarPolicy(Qt.ScrollBarAlwaysOff)   self.setHorizontalScrollBarPolicy(Qt.ScrollBarAlwaysOff)   self.setReadOnly(True)   self.sizePolicy().setControlType(QtGui.QSizePolicy.Slider)   self.setMinimumWidth(20)   self.setMaximumWidth(40) # XXX TODO make this computed   self.setFont(textarea.font())   self.setMarginWidth(0, '')   self.setMarginWidth(1, '')     self.SendScintilla(qsci.SCI_SETCURSOR, 2)   self.SendScintilla(qsci.SCI_SETCARETSTYLE, 0)     # used to set a background color for every annotating rev   N = 32   self.markers = []   for i in range(N):   marker = self.markerDefine(qsci.Background)   color = 0x7FFF00 + (i-N/2)*256/N*256*256 - i*256/N*256 + i*256/N   self.SendScintilla(qsci.SCI_MARKERSETBACK, marker, color)   self.markers.append(marker)     connect(textarea.verticalScrollBar(),   SIGNAL('valueChanged(int)'),   self.verticalScrollBar().setValue)     def setFilectx(self, fctx):   self.fctx = fctx   ann = [f.rev() for f, line in fctx.annotate(follow=True)]   self.setText('\n'.join(map(str, ann)))   allrevs = list(sorted(set(ann)))   for i, rev in enumerate(ann):   idx = allrevs.index(rev)   self.markerAdd(i, self.markers[idx % len(self.markers)])        class HgFileView(QtGui.QFrame):   def __init__(self, parent=None):   QtGui.QFrame.__init__(self, parent)   framelayout = QtGui.QVBoxLayout(self)   framelayout.setContentsMargins(0,0,0,0)   framelayout.setSpacing(0)     l = QtGui.QHBoxLayout()   l.setContentsMargins(0,0,0,0)   l.setSpacing(0)     self.topLayout = QtGui.QVBoxLayout()   self.filenamelabel = QtGui.QLabel()   self.filenamelabel.setWordWrap(True)   self.execflaglabel = QtGui.QLabel()   self.execflaglabel.setWordWrap(True)   self.topLayout.addWidget(self.filenamelabel)   self.topLayout.addWidget(self.execflaglabel)   self.execflaglabel.hide()   framelayout.addLayout(self.topLayout)   framelayout.addLayout(l, 1)     self.sci = qsci(self)   self.sci.setFrameStyle(0)   l.addWidget(self.sci, 1)   self.sci.setHorizontalScrollBarPolicy(QtCore.Qt.ScrollBarAlwaysOn)   self.sci.setReadOnly(True)     self.sci.SendScintilla(qsci.SCI_SETCARETSTYLE, 0)     self.sci.SendScintilla(qsci.SCI_INDICSETSTYLE, 8, qsci.INDIC_ROUNDBOX)   self.sci.SendScintilla(qsci.SCI_INDICSETUNDER, 8, True)   self.sci.SendScintilla(qsci.SCI_INDICSETFORE, 8, 0xBBFFFF)   self.sci.SendScintilla(qsci.SCI_INDICSETSTYLE, 9, qsci.INDIC_ROUNDBOX)   self.sci.SendScintilla(qsci.SCI_INDICSETUNDER, 9, True)   self.sci.SendScintilla(qsci.SCI_INDICSETFORE, 9, 0x58A8FF)     # hide margin 0 (markers)   self.sci.SendScintilla(qsci.SCI_SETMARGINTYPEN, 0, 0)   self.sci.SendScintilla(qsci.SCI_SETMARGINWIDTHN, 0, 0)     # define markers for colorize zones of diff   self.markerplus = self.sci.markerDefine(qsci.Background)   self.sci.SendScintilla(qsci.SCI_MARKERSETBACK, self.markerplus, 0xB0FFA0)   self.markerminus = self.sci.markerDefine(qsci.Background)   self.sci.SendScintilla(qsci.SCI_MARKERSETBACK, self.markerminus, 0xA0A0FF)   self.markertriangle = self.sci.markerDefine(qsci.Background)   self.sci.SendScintilla(qsci.SCI_MARKERSETBACK, self.markertriangle, 0xFFA0A0)     ll = QtGui.QVBoxLayout()   ll.setContentsMargins(0, 0, 0, 0)   ll.setSpacing(0)   l.insertLayout(0, ll)     ll2 = QtGui.QHBoxLayout()   ll2.setContentsMargins(0, 0, 0, 0)   ll2.setSpacing(0)   ll.addLayout(ll2)     # used to fill height of the horizontal scroll bar   w = QtGui.QWidget(self)   ll.addWidget(w)   self._spacer = w     self.blk = BlockList(self)   self.blk.linkScrollBar(self.sci.verticalScrollBar())   ll2.addWidget(self.blk)   self.blk.setVisible(False)     self.ann = Annotator(self.sci, self)   ll2.addWidget(self.ann)   self.ann.setVisible(False)     self._model = None   self._ctx = None   self._filename = None   self._annotate = False   self._find_text = None   self._mode = "diff" # can be 'diff' or 'file'   self.filedata = None     self.timer = QtCore.QTimer()   self.timer.setSingleShot(False)   self.connect(self.timer, QtCore.SIGNAL("timeout()"),   self.idle_fill_files)     def resizeEvent(self, event):   QtGui.QFrame.resizeEvent(self, event)   h = self.sci.horizontalScrollBar().height()   self._spacer.setMinimumHeight(h)   self._spacer.setMaximumHeight(h)     def setMode(self, mode):   if isinstance(mode, bool):   mode = ['file', 'diff'][mode]   assert mode in ('diff', 'file')   if mode != self._mode:   self._mode = mode   self.blk.setVisible(self._mode == 'file')   self.ann.setVisible(self._mode == 'file' and self._annotate)     self.displayFile()     def setAnnotate(self, ann):   self._annotate = ann   if ann:   self.displayFile()     def setModel(self, model):   # XXX we really need only the "Graph" instance   self._model = model   self.sci.clear()     def setContext(self, ctx):   self._ctx = ctx   self._p_rev = None   self.sci.clear()     def rev(self):   return self._ctx.rev()     def filename(self):   return self._filename     def displayDiff(self, rev):   if rev != self._p_rev:   self.displayFile(rev=rev)     def displayFile(self, filename=None, rev=None):   if self._mode == 'diff':   self.sci.setMarginLineNumbers(1, False)   self.sci.setMarginWidth(1, '')   else:   # margin 1 is used for line numbers   self.sci.setMarginLineNumbers(1, True)   self.sci.setMarginWidth(1, '000')     if filename is None:   filename = self._filename     self._realfilename = filename   if isbfile(filename):   self._filename = bfilepath(filename)   else:   self._filename = filename     if rev is not None:   self._p_rev = rev   self.emit(SIGNAL('revForDiffChanged'), rev)   self.sci.clear()   self.ann.clear()   self.filenamelabel.setText(" ")   self.execflaglabel.clear()   if filename is None:   return   try:   filectx = self._ctx.filectx(self._realfilename)     except LookupError: # occur on deleted files   return   if self._mode == 'diff' and self._p_rev is not None:   mode = self._p_rev   else:   mode = self._mode   flag, data = self._model.graph.filedata(filename, self._ctx.rev(), mode)   if flag == '-':   return   if flag == '':   return     cfg = HgConfig(self._model.repo.ui)   lexer = get_lexer(filename, data, flag, cfg)   if flag == "+":   nlines = data.count('\n')   self.sci.setMarginWidth(1, str(nlines)+'0')   self.sci.setLexer(lexer)   self._cur_lexer = lexer   if data not in ('file too big', 'binary file'):   self.filedata = data   else:   self.filedata = None     flag = exec_flag_changed(filectx)   if flag:   self.execflaglabel.setText("<b>exec mode has been <font color='red'>%s</font></b>" % flag)   self.execflaglabel.show()   else:   self.execflaglabel.hide()     labeltxt = ''   if isbfile(self._realfilename):   labeltxt += '[bfile tracked] '   labeltxt += "<b>%s</b>" % self._filename     if self._p_rev is not None:   labeltxt += ' (diff from rev %s)' % self._p_rev   renamed = filectx.renamed()   if renamed:   labeltxt += ' <i>(renamed from %s)</i>' % bfilepath(renamed[0])   self.filenamelabel.setText(labeltxt)     self.sci.setText(data)   if self._find_text:   self.highlightSearchString(self._find_text)   self.emit(SIGNAL('fileDisplayed'), self._filename)   self.updateDiffDecorations()   if self._mode == 'file' and self._annotate:   if filectx.rev() is None: # XXX hide also for binary files   self.ann.setVisible(False)   else:   self.ann.setVisible(self._annotate)   if lexer is not None:   self.ann.setFont(lexer.font(0))   else:   self.ann.setFont(self.sci.font())   self.ann.setFilectx(filectx)   return True     def updateDiffDecorations(self):   """   Recompute the diff and starts the timer   responsible for filling diff decoration markers   """   self.blk.clear()   if self._mode == 'file' and self.filedata is not None:   if self.timer.isActive():   self.timer.stop()     parent = self._model.graph.fileparent(self._filename, self._ctx.rev())   if parent is None:   return   m = self._ctx.filectx(self._filename).renamed()   if m:   pfilename, pnode = m   else:   pfilename = self._filename   _, parentdata = self._model.graph.filedata(pfilename,   parent, 'file')   if parentdata is not None:   filedata = self.filedata.splitlines()   parentdata = parentdata.splitlines()   self._diff = difflib.SequenceMatcher(None,   parentdata,   filedata,)   self._diffs = []   self.blk.syncPageStep()   self.timer.start()     def nextDiff(self):   if self._mode == 'file':   row, column = self.sci.getCursorPosition()   for i, (lo, hi) in enumerate(self._diffs):   if lo > row:   last = (i == (len(self._diffs)-1))   break   else:   return False   self.sci.setCursorPosition(lo, 0)   self.sci.verticalScrollBar().setValue(lo)   return not last     def prevDiff(self):   if self._mode == 'file':   row, column = self.sci.getCursorPosition()   for i, (lo, hi) in enumerate(reversed(self._diffs)):   if hi < row:   first = (i == (len(self._diffs)-1))   break   else:   return False   self.sci.setCursorPosition(lo, 0)   self.sci.verticalScrollBar().setValue(lo)   return not first     def nextLine(self):   x, y = self.sci.getCursorPosition()   self.sci.setCursorPosition(x+1, y)     def prevLine(self):   x, y = self.sci.getCursorPosition()   self.sci.setCursorPosition(x-1, y)     def nextCol(self):   x, y = self.sci.getCursorPosition()   self.sci.setCursorPosition(x, y+1)     def prevCol(self):   x, y = self.sci.getCursorPosition()   self.sci.setCursorPosition(x, y-1)     def nDiffs(self):   return len(self._diffs)     def diffMode(self):   return self._mode == 'diff'   def fileMode(self):   return self._mode == 'file'     def searchString(self, text):   self._find_text = text   self.clearHighlights()   findpos = self.highlightSearchString(self._find_text)   if findpos:   def finditer(self, findpos):   if self._find_text:   for pos in findpos:   self.highlightCurrentSearchString(pos, self._find_text)   yield self._ctx.rev(), self._filename, pos   return finditer(self, findpos)     def clearHighlights(self):   n = self.sci.length()   self.sci.SendScintilla(qsci.SCI_SETINDICATORCURRENT, 8) # highlight   self.sci.SendScintilla(qsci.SCI_INDICATORCLEARRANGE, 0, n)   self.sci.SendScintilla(qsci.SCI_SETINDICATORCURRENT, 9) # current found occurrence   self.sci.SendScintilla(qsci.SCI_INDICATORCLEARRANGE, 0, n)     def highlightSearchString(self, text):   data = unicode(self.sci.text())   self.sci.SendScintilla(qsci.SCI_SETINDICATORCURRENT, 8)   pos = [data.find(text)]   n = len(text)   while pos[-1] > -1:   self.sci.SendScintilla(qsci.SCI_INDICATORFILLRANGE, pos[-1], n)   pos.append(data.find(text, pos[-1]+1))   pos = [x for x in pos if x > -1]   self.emit(SIGNAL('showMessage'),   "Found %d occurrences of '%s' in current file or diff" % (len(pos), text),   2000)   return pos     def highlightCurrentSearchString(self, pos, text):   line = self.sci.SendScintilla(qsci.SCI_LINEFROMPOSITION, pos)   #line, idx = w.lineIndexFromPosition(nextpos)   self.sci.ensureLineVisible(line)   self.sci.SendScintilla(qsci.SCI_SETINDICATORCURRENT, 9)   self.sci.SendScintilla(qsci.SCI_INDICATORCLEARRANGE, 0, pos)   self.sci.SendScintilla(qsci.SCI_INDICATORFILLRANGE, pos, len(text))     def verticalScrollBar(self):   return self.sci.verticalScrollBar()       def idle_fill_files(self):   # we make a burst of diff-lines computed at once, but we   # disable GUI updates for efficiency reasons, then only   # refresh GUI at the end of the burst   self.sci.setUpdatesEnabled(False)   self.blk.setUpdatesEnabled(False)   for n in range(30): # burst pool   if self._diff is None or not self._diff.get_opcodes():   self._diff = None   self.timer.stop()   self.emit(SIGNAL('filled'))   break     tag, alo, ahi, blo, bhi = self._diff.get_opcodes().pop(0)   if tag == 'replace':   self._diffs.append([blo, bhi])   self.blk.addBlock('x', blo, bhi)   for i in range(blo, bhi):   self.sci.markerAdd(i, self.markertriangle)     elif tag == 'delete':   pass   # self.block['left'].addBlock('-', alo, ahi)   # self.diffblock.addBlock('-', alo, ahi, blo, bhi)   # w = self.viewers['left']   # for i in range(alo, ahi):   # w.markerAdd(i, self.markerminus)     elif tag == 'insert':   self._diffs.append([blo, bhi])   self.blk.addBlock('+', blo, bhi)   for i in range(blo, bhi):   self.sci.markerAdd(i, self.markerplus)     elif tag == 'equal':   pass     else:   raise ValueError, 'unknown tag %r' % (tag,)     # ok, let's enable GUI refresh for code viewers and diff-block displayers   self.sci.setUpdatesEnabled(True)   self.blk.setUpdatesEnabled(True)      class HgFileListView(QtGui.QTableView):   """   A QTableView for displaying a HgFileListModel   """   def __init__(self, parent=None):   QtGui.QTableView.__init__(self, parent)   self.setShowGrid(False)   self.verticalHeader().hide()   self.verticalHeader().setDefaultSectionSize(20)   self.setSelectionMode(QtGui.QAbstractItemView.SingleSelection)   self.setSelectionBehavior(QtGui.QAbstractItemView.SelectRows)   self.setAlternatingRowColors(True)   self.setTextElideMode(Qt.ElideLeft)     self.horizontalHeader().setToolTip('Double click to toggle merge mode')     self.createActions()     connect(self.horizontalHeader(), SIGNAL('sectionDoubleClicked(int)'),   self.toggleFullFileList)   connect(self,   SIGNAL('doubleClicked (const QModelIndex &)'),   self.fileActivated)     connect(self.horizontalHeader(),   SIGNAL('sectionResized(int, int, int)'),   self.sectionResized)   self._diff_dialogs = {}   self._nav_dialogs = {}     def setModel(self, model):   QtGui.QTableView.setModel(self, model)   connect(model, SIGNAL('layoutChanged()'),   self.fileSelected)   connect(self.selectionModel(),   SIGNAL('currentRowChanged (const QModelIndex & , const QModelIndex & )'),   self.fileSelected)   self.horizontalHeader().setResizeMode(1, QtGui.QHeaderView.Stretch)     def currentFile(self):   index = self.currentIndex()   return self.model().fileFromIndex(index)     def fileSelected(self, index=None, *args):   if index is None:   index = self.currentIndex()   sel_file = self.model().fileFromIndex(index)   from_rev = self.model().revFromIndex(index)   self.emit(SIGNAL('fileSelected'), sel_file, from_rev)     def selectFile(self, filename):   self.setCurrentIndex(self.model().indexFromFile(filename))     def fileActivated(self, index, alternate=False):   sel_file = self.model().fileFromIndex(index)   if alternate:   self.navigate(sel_file)   else:   self.diffNavigate(sel_file)     def toggleFullFileList(self, *args):   self.model().toggleFullFileList()     def navigate(self, filename=None):   self._navigate(filename, FileViewer, self._nav_dialogs)     def diffNavigate(self, filename=None):   self._navigate(filename, FileDiffViewer, self._diff_dialogs)     def _navigate(self, filename, dlgclass, dlgdict):   if filename is None:   filename = self.currentFile()   model = self.model()   if filename is not None and len(model.repo.file(filename))>0:   if filename not in dlgdict:   dlg = dlgclass(model.repo, filename,   repoviewer=self.window())   dlgdict[filename] = dlg     dlg.setWindowTitle('Hg file log viewer')   dlg = dlgdict[filename]   dlg.goto(model.current_ctx.rev())   dlg.show()   dlg.raise_()   dlg.activateWindow()     def _action_defs(self):   a = [("navigate", self.tr("Navigate"), None ,   self.tr('Navigate the revision tree of this file'), None, self.navigate),   ("diffnavigate", self.tr("Diff-mode navigate"), None,   self.tr('Navigate the revision tree of this file in diff mode'), None, self.diffNavigate),   ]   return a     def createActions(self):   self._actions = {}   for name, desc, icon, tip, key, cb in self._action_defs():   act = QtGui.QAction(desc, self)   if icon:   act.setIcon(geticon(icon))   if tip:   act.setStatusTip(tip)   if key:   act.setShortcut(key)   if cb:   connect(act, SIGNAL('triggered()'), cb)   self._actions[name] = act   self.addAction(act)     def contextMenuEvent(self, event):   menu = QtGui.QMenu(self)   for act in ['navigate', 'diffnavigate']:   if act:   menu.addAction(self._actions[act])   else:   menu.addSeparator()   menu.exec_(event.globalPos())     def resizeEvent(self, event):   vp_width = self.viewport().width()   col_widths = [self.columnWidth(i) \   for i in range(1, self.model().columnCount())]   col_width = vp_width - sum(col_widths)   col_width = max(col_width, 50)   self.setColumnWidth(0, col_width)   QtGui.QTableView.resizeEvent(self, event)     def sectionResized(self, idx, oldsize, newsize):   if idx == 1:   self.model().setDiffWidth(newsize)     def nextFile(self):   row = self.currentIndex().row()   self.setCurrentIndex(self.model().index(min(row+1,   self.model().rowCount() - 1), 0))   def prevFile(self):   row = self.currentIndex().row()   self.setCurrentIndex(self.model().index(max(row - 1, 0), 0))
Change 1 of 1 Show Entire File tortoisehg/​hgqt/​hggraph.py Stacked
renamed from tortoisehg/hgqt/hgviewlib/hggraph.py
 
28
29
30
31
 
32
33
34
 
28
29
30
 
31
32
33
34
@@ -28,7 +28,7 @@
   from tortoisehg.util.util import tounicode, isbfile   -import tortoisehg.hgqt.hgviewlib # force apply monkeypatches +import tortoisehg.hgqt # force apply monkeypatches    def diff(repo, ctx1, ctx2=None, files=None):   """
Change 1 of 1 Show Entire File tortoisehg/​hgqt/​hgmanifestdialog.py Stacked
renamed from tortoisehg/hgqt/hgviewlib/hgmanifestdialog.py
 
29
30
31
32
33
34
35
 
 
 
 
36
37
38
 
29
30
31
 
 
 
 
32
33
34
35
36
37
38
@@ -29,10 +29,10 @@
   from tortoisehg.util.util import tounicode   -from tortoisehg.hgqt.hgviewlib import icon as geticon -from tortoisehg.hgqt.hgviewlib.hgdialogmixin import HgDialogMixin -from tortoisehg.hgqt.hgviewlib.hgrepomodel import ManifestModel -from tortoisehg.hgqt.hgviewlib.lexers import get_lexer +from tortoisehg.hgqt import icon as geticon +from tortoisehg.hgqt.hgdialogmixin import HgDialogMixin +from tortoisehg.hgqt.hgrepomodel import ManifestModel +from tortoisehg.hgqt.lexers import get_lexer    connect = QtCore.QObject.connect  disconnect = QtCore.QObject.disconnect
Show Entire File tortoisehg/​hgqt/​hgqv.qrc Stacked
renamed from tortoisehg/hgqt/hgviewlib/hgqv.qrc
(No changes)
Show Entire File tortoisehg/​hgqt/​hgqv.ui Stacked
renamed from tortoisehg/hgqt/hgviewlib/hgqv.ui
(No changes)
Show Entire File tortoisehg/​hgqt/​hgqv_rc.py Stacked
renamed from tortoisehg/hgqt/hgviewlib/hgqv_rc.py
(No changes)
Show Entire File tortoisehg/​hgqt/​hgqv_ui.py Stacked
renamed from tortoisehg/hgqt/hgviewlib/hgqv_ui.py
(No changes)
Change 1 of 1 Show Entire File tortoisehg/​hgqt/​hgrepomodel.py Stacked
renamed from tortoisehg/hgqt/hgviewlib/hgrepomodel.py
 
28
29
30
31
32
33
34
35
 
 
 
 
 
36
37
38
 
28
29
30
 
 
 
 
 
31
32
33
34
35
36
37
38
@@ -28,11 +28,11 @@
   from tortoisehg.util.util import tounicode, isbfile, Curry   -from tortoisehg.hgqt.hgviewlib.hggraph import Graph, ismerge, diff as revdiff -from tortoisehg.hgqt.hgviewlib.hggraph import revision_grapher, filelog_grapher -from tortoisehg.hgqt.hgviewlib.config import HgConfig -from tortoisehg.hgqt.hgviewlib import icon as geticon -from tortoisehg.hgqt.hgviewlib.decorators import timeit +from tortoisehg.hgqt.hggraph import Graph, ismerge, diff as revdiff +from tortoisehg.hgqt.hggraph import revision_grapher, filelog_grapher +from tortoisehg.hgqt.config import HgConfig +from tortoisehg.hgqt import icon as geticon +from tortoisehg.hgqt.decorators import timeit    from PyQt4 import QtCore, QtGui  connect = QtCore.QObject.connect
Change 1 of 2 Show Entire File tortoisehg/​hgqt/​hgrepoview.py Stacked
renamed from tortoisehg/hgqt/hgviewlib/hgrepoview.py
 
32
33
34
35
36
37
38
39
 
 
 
 
 
40
41
42
 
467
468
469
470
 
471
472
473
 
32
33
34
 
 
 
 
 
35
36
37
38
39
40
41
42
 
467
468
469
 
470
471
472
473
@@ -32,11 +32,11 @@
   from tortoisehg.util.util import format_desc, xml_escape   -from tortoisehg.hgqt.hgviewlib.decorators import timeit -from tortoisehg.hgqt.hgviewlib.config import HgConfig -from tortoisehg.hgqt.hgviewlib import icon as geticon -from tortoisehg.hgqt.hgviewlib.hgmanifestdialog import ManifestViewer -from tortoisehg.hgqt.hgviewlib.quickbar import QuickBar +from tortoisehg.hgqt.decorators import timeit +from tortoisehg.hgqt.config import HgConfig +from tortoisehg.hgqt import icon as geticon +from tortoisehg.hgqt.hgmanifestdialog import ManifestViewer +from tortoisehg.hgqt.quickbar import QuickBar    class GotoQuickBar(QuickBar):   def __init__(self, parent): @@ -467,7 +467,7 @@
 if __name__ == "__main__":   from mercurial import ui, hg   from optparse import OptionParser - from hgviewlib.qt4.hgrepomodel import FileRevModel, HgRepoListModel + from hgrepomodel import FileRevModel, HgRepoListModel   p = OptionParser()   p.add_option('-R', '--root', default='.',   dest='root',
Change 1 of 3 Show Entire File tortoisehg/​hgqt/​hgrepoviewer.py Stacked
renamed from tortoisehg/hgqt/hgviewlib/hgrepoviewer.py
 
20
21
22
23
24
 
 
25
26
27
28
29
30
31
32
 
 
 
 
 
 
 
33
34
35
 
502
503
504
505
 
506
507
508
 
522
523
524
525
 
526
527
528
 
20
21
22
 
 
23
24
25
 
 
 
 
 
 
 
26
27
28
29
30
31
32
33
34
35
 
502
503
504
 
505
506
507
508
 
522
523
524
 
525
526
527
528
@@ -20,16 +20,16 @@
 from tortoisehg.util.util import tounicode, has_closed_branch_support  from tortoisehg.util.util import rootpath, find_repository   -from tortoisehg.hgqt.hgviewlib.hggraph import diff as revdiff -from tortoisehg.hgqt.hgviewlib.decorators import timeit +from tortoisehg.hgqt.hggraph import diff as revdiff +from tortoisehg.hgqt.decorators import timeit   -from tortoisehg.hgqt.hgviewlib import icon as geticon -from tortoisehg.hgqt.hgviewlib.hgrepomodel import HgRepoListModel, HgFileListModel -from tortoisehg.hgqt.hgviewlib.hgfiledialog import FileViewer, FileDiffViewer -from tortoisehg.hgqt.hgviewlib.hgmanifestdialog import ManifestViewer -from tortoisehg.hgqt.hgviewlib.hgdialogmixin import HgDialogMixin -from tortoisehg.hgqt.hgviewlib.quickbar import FindInGraphlogQuickBar -from tortoisehg.hgqt.hgviewlib.helpviewer import HelpViewer +from tortoisehg.hgqt import icon as geticon +from tortoisehg.hgqt.hgrepomodel import HgRepoListModel, HgFileListModel +from tortoisehg.hgqt.hgfiledialog import FileViewer, FileDiffViewer +from tortoisehg.hgqt.hgmanifestdialog import ManifestViewer +from tortoisehg.hgqt.hgdialogmixin import HgDialogMixin +from tortoisehg.hgqt.quickbar import FindInGraphlogQuickBar +from tortoisehg.hgqt.helpviewer import HelpViewer    from tortoisehg.util import paths   @@ -502,7 +502,7 @@
    def on_about(self, *args):   """ Display about dialog """ - from hgviewlib.__pkginfo__ import modname, version, short_desc, long_desc + from __pkginfo__ import modname, version, short_desc, long_desc   try:   from mercurial.version import get_version   hgversion = get_version() @@ -522,7 +522,7 @@
  w.activateWindow()    def run(ui, *pats, **opts): - from tortoisehg.hgqt.hgviewlib import setup_font_substitutions + from tortoisehg.hgqt import setup_font_substitutions   setup_font_substitutions()     repo = None
Show Entire File tortoisehg/​hgqt/​hgviewhelp.py Stacked
renamed from tortoisehg/hgqt/hgviewlib/hgviewhelp.py
(No changes)
Show Entire File tortoisehg/​hgqt/​icons/​README Stacked
renamed from tortoisehg/hgqt/hgviewlib/icons/README
(No changes)
Show Entire File tortoisehg/​hgqt/​icons/​back.svg Stacked
renamed from tortoisehg/hgqt/hgviewlib/icons/back.svg
(No changes)
Show Entire File tortoisehg/​hgqt/​icons/​clean.svg Stacked
renamed from tortoisehg/hgqt/hgviewlib/icons/clean.svg
(No changes)
tortoisehg/​hgqt/​icons/​close.png Side by side
renamed from tortoisehg/hgqt/hgviewlib/icons/close.png
Removed image
Added image
Subtracted image Added image
Show Entire File tortoisehg/​hgqt/​icons/​down.svg Stacked
renamed from tortoisehg/hgqt/hgviewlib/icons/down.svg
(No changes)
Show Entire File tortoisehg/​hgqt/​icons/​find.svg Stacked
renamed from tortoisehg/hgqt/hgviewlib/icons/find.svg
(No changes)
Show Entire File tortoisehg/​hgqt/​icons/​forward.svg Stacked
renamed from tortoisehg/hgqt/hgviewlib/icons/forward.svg
(No changes)
Show Entire File tortoisehg/​hgqt/​icons/​goto.svg Stacked
renamed from tortoisehg/hgqt/hgviewlib/icons/goto.svg
(No changes)
Show Entire File tortoisehg/​hgqt/​icons/​help.svg Stacked
renamed from tortoisehg/hgqt/hgviewlib/icons/help.svg
(No changes)
Show Entire File tortoisehg/​hgqt/​icons/​left.svg Stacked
renamed from tortoisehg/hgqt/hgviewlib/icons/left.svg
(No changes)
Show Entire File tortoisehg/​hgqt/​icons/​leftright.svg Stacked
renamed from tortoisehg/hgqt/hgviewlib/icons/leftright.svg
(No changes)
Show Entire File tortoisehg/​hgqt/​icons/​modified.svg Stacked
renamed from tortoisehg/hgqt/hgviewlib/icons/modified.svg
(No changes)
Show Entire File tortoisehg/​hgqt/​icons/​mqdiff.svg Stacked
renamed from tortoisehg/hgqt/hgviewlib/icons/mqdiff.svg
(No changes)
Show Entire File tortoisehg/​hgqt/​icons/​mqdiff_x.svg Stacked
renamed from tortoisehg/hgqt/hgviewlib/icons/mqdiff_x.svg
(No changes)
Show Entire File tortoisehg/​hgqt/​icons/​mqpatch.svg Stacked
renamed from tortoisehg/hgqt/hgviewlib/icons/mqpatch.svg
(No changes)
Show Entire File tortoisehg/​hgqt/​icons/​mqpatch_x.svg Stacked
renamed from tortoisehg/hgqt/hgviewlib/icons/mqpatch_x.svg
(No changes)
Show Entire File tortoisehg/​hgqt/​icons/​quit.svg Stacked
renamed from tortoisehg/hgqt/hgviewlib/icons/quit.svg
(No changes)
Show Entire File tortoisehg/​hgqt/​icons/​reload.svg Stacked
renamed from tortoisehg/hgqt/hgviewlib/icons/reload.svg
(No changes)
Show Entire File tortoisehg/​hgqt/​icons/​right.svg Stacked
renamed from tortoisehg/hgqt/hgviewlib/icons/right.svg
(No changes)
Show Entire File tortoisehg/​hgqt/​icons/​up.svg Stacked
renamed from tortoisehg/hgqt/hgviewlib/icons/up.svg
(No changes)
Show Entire File tortoisehg/​hgqt/​lexers.py Stacked
renamed from tortoisehg/hgqt/hgviewlib/lexers.py
(No changes)
Show Entire File tortoisehg/​hgqt/​manifestviewer.ui Stacked
renamed from tortoisehg/hgqt/hgviewlib/manifestviewer.ui
(No changes)
Show Entire File tortoisehg/​hgqt/​manifestviewer_ui.py Stacked
renamed from tortoisehg/hgqt/hgviewlib/manifestviewer_ui.py
(No changes)
Change 1 of 2 Show Entire File tortoisehg/​hgqt/​quickbar.py Stacked
renamed from tortoisehg/hgqt/hgviewlib/quickbar.py
 
23
24
25
26
 
27
28
29
 
318
319
320
321
 
322
323
324
 
23
24
25
 
26
27
28
29
 
318
319
320
 
321
322
323
324
@@ -23,7 +23,7 @@
   from tortoisehg.util.util import Curry   -from tortoisehg.hgqt.hgviewlib import icon as geticon +from tortoisehg.hgqt import icon as geticon    Qt = QtCore.Qt  connect = QtCore.QObject.connect @@ -318,7 +318,7 @@
   if __name__ == "__main__":   import sys - import hgviewlib # to force importation of resource module w/ icons + # import hgviewlib # to force importation of resource module w/ icons   app = QtGui.QApplication(sys.argv)   root = QtGui.QMainWindow()   w = QtGui.QFrame()
 
361
362
363
364
 
365
366
367
 
361
362
363
 
364
365
366
367
@@ -361,7 +361,7 @@
   def log(ui, *pats, **opts):   """Repository Explorer (changelog viewer)""" - from tortoisehg.hgqt.hgviewlib.hgrepoviewer import run + from tortoisehg.hgqt.hgrepoviewer import run   qtrun(run, ui, *pats, **opts)    ### help management, adapted from mercurial.commands.help_()