Kiln » TortoiseHg » TortoiseHg
Clone URL:  
Pushed to one repository · View In Graph Contained in 2.1, 2.1.1, and 2.1.2

Merge with stable

Changeset fa4af62c8e59

Parents bfb34f3aaa50

Parents 4862de17b8dd

by Steve Borho

Changes to 3 files · Browse files at fa4af62c8e59 Showing diff from parent bfb34f3aaa50 4862de17b8dd Diff from another changeset...

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
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
 # htmlui.py - mercurial.ui.ui class which emits HTML/Rich Text  #  # Copyright 2010 Steve Borho <steve@borho.org>  #  # This software may be used and distributed according to the terms of the  # GNU General Public License version 2, incorporated herein by reference.    import os, time    from mercurial import ui  from PyQt4 import QtCore  from tortoisehg.hgqt import qtlib  from tortoisehg.util import hglib    BEGINTAG = '\033' + str(time.time())  ENDTAG = '\032' + str(time.time())    class htmlui(ui.ui):   def __init__(self, src=None):   super(htmlui, self).__init__(src)   self.setconfig('ui', 'interactive', 'off')   self.setconfig('progress', 'disable', 'True')   self.output, self.error = [], [] - os.environ['TERM'] = 'dumb'     def write(self, *args, **opts):   label = opts.get('label', '')   if self._buffers:   self._buffers[-1].extend([(str(a), label) for a in args])   else:   self.output.extend(self.smartlabel(''.join(args), label))     def write_err(self, *args, **opts):   label = opts.get('label', 'ui.error')   self.error.extend(self.smartlabel(''.join(args), label))     def label(self, msg, label):   '''   Called by Mercurial to apply styling (formatting) to a piece of   text. Our implementation wraps tags around the data so we can   find it later when it is passed to ui.write()   '''   return BEGINTAG + self.style(msg, label) + ENDTAG     def style(self, msg, label):   'Escape message for safe HTML, then apply specified style'   msg = QtCore.Qt.escape(msg)   msg = msg.replace('\n', '<br />')   style = qtlib.geteffect(label)   return '<span style="%s">%s</span>' % (style, msg)     def smartlabel(self, text, label):   '''   Escape and apply style, excluding any text between BEGINTAG and   ENDTAG. That text has already been escaped and styled.   '''   parts = []   try:   while True:   b = text.index(BEGINTAG)   e = text.index(ENDTAG)   if e > b:   if b:   parts.append(self.style(text[:b], label))   parts.append(text[b + len(BEGINTAG):e])   text = text[e + len(ENDTAG):]   else:   # invalid range, assume ENDTAG and BEGINTAG   # are naturually occuring. Style, append, and   # consume up to the BEGINTAG and repeat.   parts.append(self.style(text[:b], label))   text = text[b:]   except ValueError:   pass   if text:   parts.append(self.style(text, label))   return parts     def popbuffer(self, labeled=False):   b = self._buffers.pop()   if labeled:   return ''.join(self.style(a, label) for a, label in b)   return ''.join(a for a, label in b)     def plain(self):   return True     def getdata(self):   d, e = ''.join(self.output), ''.join(self.error)   self.output, self.error = [], []   return d, e    if __name__ == "__main__":   from mercurial import hg   u = htmlui()   repo = hg.repository(u)   repo.status()   print u.getdata()[0]
 
14
15
16
17
 
18
19
20
 
40
41
42
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
43
44
45
 
14
15
16
 
17
18
19
20
 
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
@@ -14,7 +14,7 @@
   from tortoisehg.util import hglib  from tortoisehg.hgqt.i18n import _ -from tortoisehg.hgqt import qtlib, cmdui, visdiff, thgrepo +from tortoisehg.hgqt import qtlib, cmdui, csinfo, visdiff, thgrepo    MARGINS = (8, 0, 0, 0)   @@ -40,6 +40,40 @@
  hbox.addWidget(tb)   hbox.addWidget(self.stlabel)   + def revisionInfoLayout(repo): + """ + Return a layout containg the revision information (local and other) + """ + hbox = QHBoxLayout() + hbox.setSpacing(0) + hbox.setContentsMargins(*MARGINS) + + vbox = QVBoxLayout() + vbox.setContentsMargins(*MARGINS) + hbox.addLayout(vbox) + localrevtitle = qtlib.LabeledSeparator(_('Local revision information')) + localrevinfo = csinfo.create(repo) + localrevinfo.update(repo[None].p1()) + vbox.addWidget(localrevtitle) + vbox.addWidget(localrevinfo) + vbox.addStretch() + + vbox = QVBoxLayout() + vbox.setContentsMargins(*MARGINS) + hbox.addLayout(vbox) + otherrevtitle = qtlib.LabeledSeparator(_('Other revision information')) + otherrevinfo = csinfo.create(repo) + otherrevinfo.update(repo[None].p2()) + + vbox.addWidget(otherrevtitle) + vbox.addWidget(otherrevinfo) + vbox.addStretch() + + return hbox + + if len(self.repo[None].parents()) > 1: + self.layout().addLayout(revisionInfoLayout(self.repo)) +   unres = qtlib.LabeledSeparator(_('Unresolved conflicts'))   self.layout().addWidget(unres)  
 
101
102
103
104
105
106
107
 
101
102
103
 
104
105
106
@@ -101,7 +101,6 @@
    self.setconfig('ui', 'interactive', 'on')   self.setconfig('progress', 'disable', 'True') - os.environ['TERM'] = 'dumb'     def write(self, *args, **opts):   if self._buffers: