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

no need to have repoview.py depend on class FileRevModel

FileRevModel is a subclass of HgRepoListModel. repoview deals with HgRepoListModel's only and
doesn't need to know anything about FileRevModel's.

Changeset ece79e7cf485

Parent 1d3012298248

by Adrian Buehlmann

Changes to one file · Browse files at ece79e7cf485 Showing diff from parent 1d3012298248 Diff from another changeset...

 
76
77
78
79
 
80
81
82
 
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
 
76
77
78
 
79
80
81
82
 
462
463
464
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
@@ -76,7 +76,7 @@
   class HgRepoView(QtGui.QTableView):   """ - A QTableView for displaying a FileRevModel or a HgRepoListModel, + A QTableView for displaying a HgRepoListModel,   with actions, shortcuts, etc.   """   def __init__(self, parent=None): @@ -462,44 +462,3 @@
  desc = desc.replace('\n', '<br/>\n')   buf += '<div class="diff_desc"><p>%s</p></div>\n' % desc   self.setHtml(buf) - - -if __name__ == "__main__": - from mercurial import ui, hg - from optparse import OptionParser - from repomodel import FileRevModel, HgRepoListModel - p = OptionParser() - p.add_option('-R', '--root', default='.', - dest='root', - help="Repository main directory") - p.add_option('-f', '--file', default=None, - dest='filename', - help="display the revision graph of this file (if not given, display the whole rev graph)") - - opt, args = p.parse_args() - - u = ui.ui() - repo = hg.repository(u, opt.root) - app = QtGui.QApplication(sys.argv) - if opt.filename is not None: - model = FileRevModel(repo, opt.filename) - else: - model = HgRepoListModel(repo) - root = QtGui.QMainWindow() - w = QtGui.QWidget() - root.setCentralWidget(w) - l = QtGui.QVBoxLayout(w) - - view = HgRepoView(w) - view.setModel(model) - view.setWindowTitle("Simple Hg List Model") - - disp = RevDisplay(w) - connect(view, SIGNAL('revisionSelected'), lambda rev: disp.displayRevision(repo.changectx(rev))) - connect(disp, SIGNAL('revisionSelected'), view.goto) - #connect(view, SIGNAL('revisionActivated'), rev_act) - - l.addWidget(view, 2) - l.addWidget(disp) - root.show() - sys.exit(app.exec_())