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

add thg log command

using adapted hgviewlib

Changeset 727ca6142730

Parent aa3c66d92013

by Adrian Buehlmann

Changes to 11 files · Browse files at 727ca6142730 Showing diff from parent aa3c66d92013 Diff from another changeset...

 
26
27
28
29
30
 
 
31
32
33
 
26
27
28
 
 
29
30
31
32
33
@@ -26,8 +26,8 @@
 from mercurial.node import nullrev  from mercurial import patch, util, match   -import hgviewlib # force apply monkeypatches -from hgviewlib.util import tounicode, isbfile +import tortoisehg.hgqt.hgviewlib # force apply monkeypatches +from tortoisehg.hgqt.hgviewlib.util import tounicode, isbfile    def diff(repo, ctx1, ctx2=None, files=None):   """
 
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 hgviewlib.qt4 import icon as geticon -from hgviewlib.qt4.hgdialogmixin import HgDialogMixin -from hgviewlib.hgviewhelp import help_msg, get_options_helpmsg +from tortoisehg.hgqt.hgviewlib.qt4 import icon as geticon +from tortoisehg.hgqt.hgviewlib.qt4.hgdialogmixin import HgDialogMixin +from tortoisehg.hgqt.hgviewlib.hgviewhelp import help_msg, get_options_helpmsg    Qt = QtCore.Qt  bold = QtGui.QFont.Bold
 
28
29
30
31
32
 
 
33
34
35
 
28
29
30
 
 
31
32
33
34
35
@@ -28,8 +28,8 @@
 SIGNAL = QtCore.SIGNAL  Qt = QtCore.Qt   -from hgviewlib.config import HgConfig -from hgviewlib.qt4 import should_rebuild +from tortoisehg.hgqt.hgviewlib.config import HgConfig +from tortoisehg.hgqt.hgviewlib.qt4 import should_rebuild    class HgDialogMixin(object):   """
 
28
29
30
31
 
32
33
34
35
36
37
38
 
 
 
 
 
 
39
40
41
 
28
29
30
 
31
32
 
 
 
 
 
 
33
34
35
36
37
38
39
40
41
@@ -28,14 +28,14 @@
 from PyQt4 import QtGui, QtCore, Qsci  from PyQt4.QtCore import Qt   -from hgviewlib.util import tounicode, rootpath +from tortoisehg.hgqt.hgviewlib.util import tounicode, rootpath   -from hgviewlib.qt4 import icon as geticon -from hgviewlib.qt4.hgdialogmixin import HgDialogMixin -from hgviewlib.qt4.hgrepomodel import FileRevModel -from hgviewlib.qt4.blockmatcher import BlockList, BlockMatch -from hgviewlib.qt4.lexers import get_lexer -from hgviewlib.qt4.quickbar import FindInGraphlogQuickBar +from tortoisehg.hgqt.hgviewlib.qt4 import icon as geticon +from tortoisehg.hgqt.hgviewlib.qt4.hgdialogmixin import HgDialogMixin +from tortoisehg.hgqt.hgviewlib.qt4.hgrepomodel import FileRevModel +from tortoisehg.hgqt.hgviewlib.qt4.blockmatcher import BlockList, BlockMatch +from tortoisehg.hgqt.hgviewlib.qt4.lexers import get_lexer +from tortoisehg.hgqt.hgviewlib.qt4.quickbar import FindInGraphlogQuickBar    connect = QtCore.QObject.connect  disconnect = QtCore.QObject.disconnect
 
32
33
34
35
36
37
 
 
 
38
39
40
41
42
43
44
 
 
 
 
 
 
45
46
47
 
32
33
34
 
 
 
35
36
37
38
 
 
 
 
 
 
39
40
41
42
43
44
45
46
47
@@ -32,16 +32,16 @@
 SIGNAL = QtCore.SIGNAL  nullvariant = QtCore.QVariant()   -from hgviewlib.decorators import timeit -from hgviewlib.util import exec_flag_changed, isbfile, bfilepath -from hgviewlib.config import HgConfig +from tortoisehg.hgqt.hgviewlib.decorators import timeit +from tortoisehg.hgqt.hgviewlib.util import exec_flag_changed, isbfile, bfilepath +from tortoisehg.hgqt.hgviewlib.config import HgConfig   -from hgviewlib.qt4 import icon as geticon -from hgviewlib.qt4.hgfiledialog import FileViewer, FileDiffViewer -from hgviewlib.qt4.hgmanifestdialog import ManifestViewer -from hgviewlib.qt4.quickbar import QuickBar -from hgviewlib.qt4.lexers import get_lexer -from hgviewlib.qt4.blockmatcher import BlockList +from tortoisehg.hgqt.hgviewlib.qt4 import icon as geticon +from tortoisehg.hgqt.hgviewlib.qt4.hgfiledialog import FileViewer, FileDiffViewer +from tortoisehg.hgqt.hgviewlib.qt4.hgmanifestdialog import ManifestViewer +from tortoisehg.hgqt.hgviewlib.qt4.quickbar import QuickBar +from tortoisehg.hgqt.hgviewlib.qt4.lexers import get_lexer +from tortoisehg.hgqt.hgviewlib.qt4.blockmatcher import BlockList    qsci = Qsci.QsciScintilla  
 
27
28
29
30
 
31
32
33
34
35
 
 
 
 
36
37
38
 
27
28
29
 
30
31
 
 
 
 
32
33
34
35
36
37
38
@@ -27,12 +27,12 @@
 from PyQt4 import QtGui, QtCore, Qsci  from PyQt4.QtCore import Qt   -from hgviewlib.util import tounicode +from tortoisehg.hgqt.hgviewlib.util import tounicode   -from hgviewlib.qt4 import icon as geticon -from hgviewlib.qt4.hgdialogmixin import HgDialogMixin -from hgviewlib.qt4.hgrepomodel import ManifestModel -from hgviewlib.qt4.lexers import get_lexer +from tortoisehg.hgqt.hgviewlib.qt4 import icon as geticon +from tortoisehg.hgqt.hgviewlib.qt4.hgdialogmixin import HgDialogMixin +from tortoisehg.hgqt.hgviewlib.qt4.hgrepomodel import ManifestModel +from tortoisehg.hgqt.hgviewlib.qt4.lexers import get_lexer    connect = QtCore.QObject.connect  disconnect = QtCore.QObject.disconnect
 
26
27
28
29
30
31
32
33
34
 
 
 
 
 
 
35
36
37
 
26
27
28
 
 
 
 
 
 
29
30
31
32
33
34
35
36
37
@@ -26,12 +26,12 @@
 from mercurial.revlog import LookupError  from mercurial import util, error   -from hgviewlib.hggraph import Graph, ismerge, diff as revdiff -from hgviewlib.hggraph import revision_grapher, filelog_grapher -from hgviewlib.config import HgConfig -from hgviewlib.util import tounicode, isbfile, Curry -from hgviewlib.qt4 import icon as geticon -from hgviewlib.decorators import timeit +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.util import tounicode, isbfile, Curry +from tortoisehg.hgqt.hgviewlib.qt4 import icon as geticon +from tortoisehg.hgqt.hgviewlib.decorators import timeit    from PyQt4 import QtCore, QtGui  connect = QtCore.QObject.connect
 
30
31
32
33
34
35
36
37
38
 
 
 
 
 
 
39
40
41
 
30
31
32
 
 
 
 
 
 
33
34
35
36
37
38
39
40
41
@@ -30,12 +30,12 @@
 SIGNAL = QtCore.SIGNAL  nullvariant = QtCore.QVariant()   -from hgviewlib.decorators import timeit -from hgviewlib.config import HgConfig -from hgviewlib.util import format_desc, xml_escape -from hgviewlib.qt4 import icon as geticon -from hgviewlib.qt4.hgmanifestdialog import ManifestViewer -from hgviewlib.qt4.quickbar import QuickBar +from tortoisehg.hgqt.hgviewlib.decorators import timeit +from tortoisehg.hgqt.hgviewlib.config import HgConfig +from tortoisehg.hgqt.hgviewlib.util import format_desc, xml_escape +from tortoisehg.hgqt.hgviewlib.qt4 import icon as geticon +from tortoisehg.hgqt.hgviewlib.qt4.hgmanifestdialog import ManifestViewer +from tortoisehg.hgqt.hgviewlib.qt4.quickbar import QuickBar    class GotoQuickBar(QuickBar):   def __init__(self, parent):
 
17
18
19
20
21
22
23
 
 
 
 
24
25
26
27
28
29
30
31
 
 
 
 
 
 
 
 
 
32
33
34
 
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
 
 
 
 
 
 
17
18
19
 
 
 
 
20
21
22
23
24
 
 
 
 
 
 
 
25
26
27
28
29
30
31
32
33
34
35
36
 
519
520
521
 
522
 
 
 
523
524
525
526
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
527
528
529
530
531
@@ -17,18 +17,20 @@
 from mercurial import ui, hg  from mercurial import util   -from hgviewlib.util import tounicode, has_closed_branch_support -from hgviewlib.util import rootpath, find_repository -from hgviewlib.hggraph import diff as revdiff -from hgviewlib.decorators import timeit +from tortoisehg.hgqt.hgviewlib.util import tounicode, has_closed_branch_support +from tortoisehg.hgqt.hgviewlib.util import rootpath, find_repository +from tortoisehg.hgqt.hgviewlib.hggraph import diff as revdiff +from tortoisehg.hgqt.hgviewlib.decorators import timeit   -from hgviewlib.qt4 import icon as geticon -from hgviewlib.qt4.hgrepomodel import HgRepoListModel, HgFileListModel -from hgviewlib.qt4.hgfiledialog import FileViewer, FileDiffViewer -from hgviewlib.qt4.hgmanifestdialog import ManifestViewer -from hgviewlib.qt4.hgdialogmixin import HgDialogMixin -from hgviewlib.qt4.quickbar import FindInGraphlogQuickBar -from hgviewlib.qt4.helpviewer import HelpViewer +from tortoisehg.hgqt.hgviewlib.qt4 import icon as geticon +from tortoisehg.hgqt.hgviewlib.qt4.hgrepomodel import HgRepoListModel, HgFileListModel +from tortoisehg.hgqt.hgviewlib.qt4.hgfiledialog import FileViewer, FileDiffViewer +from tortoisehg.hgqt.hgviewlib.qt4.hgmanifestdialog import ManifestViewer +from tortoisehg.hgqt.hgviewlib.qt4.hgdialogmixin import HgDialogMixin +from tortoisehg.hgqt.hgviewlib.qt4.quickbar import FindInGraphlogQuickBar +from tortoisehg.hgqt.hgviewlib.qt4.helpviewer import HelpViewer + +from tortoisehg.util import paths    try:   from mercurial.error import RepoError @@ -517,90 +519,13 @@
  w.show()   w.raise_()   w.activateWindow() -   -def main(): - from optparse import OptionParser - usage = '''%prog [options] [filename] +def run(ui, *pats, **opts): + from tortoisehg.hgqt.hgviewlib.qt4 import setup_font_substitutions + setup_font_substitutions()   - Starts a visual hg repository navigator. - - - With no options, starts the main repository navigator. - - - If a filename is given, starts in filelog diff mode (or in - filelog navigation mode if -n option is set). - - - With -r option, starts in manifest viewer mode for given - revision. - ''' - - parser = OptionParser(usage) - parser.add_option('-R', '--repository', dest='repo', - help='location of the repository to explore') - parser.add_option('-r', '--rev', dest='rev', default=None, - help='start in manifest navigation mode at rev R') - parser.add_option('-n', '--navigate', dest='navigate', default=False, - action="store_true", - help='(with filename) start in navigation mode') - - opts, args = parser.parse_args() - - if opts.navigate and len(args) != 1: - parser.error("You must provide a filename to start in navigate mode") - - if len(args) > 1: - parser.error("Provide at most one file name") - - dir_ = None - if opts.repo: - dir_ = opts.repo - else: - dir_ = os.getcwd() - dir_ = find_repository(dir_) - - try: - u = ui.ui() - repo = hg.repository(u, dir_) - except: - parser.error("You are not in a repo, are you?") - - # make Ctrl+C works - import signal - signal.signal(signal.SIGINT, signal.SIG_DFL) - - app = QtGui.QApplication(sys.argv) - from hgviewlib.qt4 import setup_font_substitutions - setup_font_substitutions() - - if len(args) == 1: - filename = rootpath(repo, opts.rev, args[0]) - if filename is None: - parser.error("%s is not a tracked file" % args[0]) - - # should be a filename of a file managed in the repo - if opts.navigate: - mainwindow = FileViewer(repo, filename) - else: - mainwindow = FileDiffViewer(repo, filename) - else: - rev = opts.rev - if rev is not None: - try: - repo.changectx(rev) - except RepoError, e: - parser.error("Cannot find revision %s" % rev) - else: - mainwindow = ManifestViewer(repo, rev) - else: - mainwindow = HgRepoViewer(repo) - - mainwindow.show() - sys.exit(app.exec_()) - - -if __name__ == "__main__": - # remove current dir from sys.path - while sys.path.count('.'): - sys.path.remove('.') - print 'removed' - main() + repo = None + root = paths.find_root() + if root: + repo = hg.repository(ui, path=root) + return HgRepoViewer(repo)
 
21
22
23
24
25
 
 
26
27
28
 
21
22
23
 
 
24
25
26
27
28
@@ -21,8 +21,8 @@
   from PyQt4 import QtCore, QtGui   -from hgviewlib.util import Curry -from hgviewlib.qt4 import icon as geticon +from tortoisehg.hgqt.hgviewlib.util import Curry +from tortoisehg.hgqt.hgviewlib.qt4 import icon as geticon    Qt = QtCore.Qt  connect = QtCore.QObject.connect
 
359
360
361
 
 
 
 
 
362
363
364
 
587
588
589
 
 
 
590
591
592
 
359
360
361
362
363
364
365
366
367
368
369
 
592
593
594
595
596
597
598
599
600
@@ -359,6 +359,11 @@
  from tortoisehg.hgqt.update import run   qtrun(run, ui, *pats, **opts)   +def log(ui, *pats, **opts): + """Repository Explorer (changelog viewer)""" + from tortoisehg.hgqt.hgviewlib.qt4.hgrepoviewer import run + qtrun(run, ui, *pats, **opts) +  ### help management, adapted from mercurial.commands.help_()  def help_(ui, name=None, with_version=False, **opts):   """show help for a command, extension, or list of commands @@ -587,6 +592,9 @@
  _('use uncompressed transfer (fast over LAN)')),],   _('thg clone [OPTION]... SOURCE [DEST]')),   "bug": (bug, [], _('thg bug [MESSAGE]')), + "^log|history|explorer": (log, + [('l', 'limit', '', _('limit number of changes displayed'))], + _('thg log [OPTIONS] [FILE]')),   "test": (test, [], _('thg test')),   "help": (help_, [], _('thg help [COMMAND]')),   "^update|checkout|co":