Kiln » TortoiseHg » TortoiseHg
Clone URL:  
Pushed to one repository · View In Graph Contained in 1.1, 1.1.1, and 1.1.2

Merge with stable

Changeset ca5e452dfae6

Parents 2548df5279b6

Parents ca6abee62f31

by Steve Borho

Changes to 32 files · Browse files at ca5e452dfae6 Showing diff from parent 2548df5279b6 ca6abee62f31 Diff from another changeset...

Change 1 of 1 Show Entire File contrib/​hgtk.cmd Stacked
 
1
2
 
 
3
4
5
6
7
8
9
10
 
 
11
12
13
14
15
 
16
 
1
2
3
4
5
6
7
8
9
10
 
 
11
12
13
14
15
16
 
17
18
@@ -1,16 +1,18 @@
 ::  :: Win32 batch file for running the TortoiseHg hgtk script. +:: Copy this file into the install directory and rename hgtk.exe +:: to e.g. hgtk-hidden.exe  ::    @echo off  setlocal    :: Uncomment the line below and modify accoringly -::set hgtkpath="C:\repos\tortoisehg-crew\hgtk" -if not exist %hgtkpath% goto :notfound +::set hgtkpath="C:\path\to\hgtk" +if not defined hgtkpath goto :notfound  python %hgtkpath% %*  goto end    :notfound -echo hgtk: Please configure kgtkpath in %~f0 +echo hgtk: Please configure hgtkpath in %~f0  :end
 
50
51
52
 
 
 
53
54
55
 
50
51
52
53
54
55
56
57
58
@@ -50,6 +50,9 @@
  Launch the web server dialog in a separate process   :guilabel:`Shelve`   Launch the shelve tool in a separate process + :guilabel:`Patch Branch` + Toggles the display of the Patch Branch pane. This button is only + visible when the pbranch extension has been enabled by the user.   :guilabel:`Load more`   Load the next N revisions into the graph   :guilabel:`Load all`
 
4
5
6
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
7
8
9
 
26
27
28
 
 
 
29
30
31
32
 
 
33
34
35
 
 
36
37
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
38
39
40
 
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
 
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
 
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
 
128
129
130
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
131
132
133
@@ -4,6 +4,30 @@
 .. module:: explorer   :synopsis: Windows explorer integration   +Context Menus +------------- + +TortoiseHg commands may be accessed via the context menu of Explorer +windows and other applications which use the standard File/Open dialogs. +Here is the context menu for a revisioned folder: + +.. figure:: figures/cmenu-nofiles.png + :alt: Context menu + + Context menu for a folder under Mercurial revision control + +And here is the context menu for selected files or folders: + +.. figure:: figures/cmenu-files.png + :alt: Context menu + + Context menu for file or folder selection + +TortoiseHg provides dialogs for the most regularly used Mercurial +commands. Less frequently used and newly added Mercurial commands +may be accessed from the CLI (command line interface) through +:file:`cmd.exe` on Windows. +  Overlay Icons  -------------   @@ -26,15 +50,77 @@
 directory icons will turn into question marks while this refresh is in  progress.   +Shell Configuration +------------------- +  The overlay handler and context menus are configurable. From any folder  background (even the desktop), right click and select -:menuselection:`TortoiseHg --> Explorer Extension Settings`. In the settings -dialog you can promote individual menu options to the top menu. +:menuselection:`TortoiseHg --> Explorer Extension Settings`. This opens the +TortoiseHg Shell Configuration dialog.   -.. figure:: figures/taskbarui.png - :alt: Shell Configuration dialog +On the tab "Context Menu" you can promote individual menu options to the +top level menu.   - Shell Configuration Dialog +.. figure:: figures/shell-config-cmenu.png + :alt: Shell Configuration dialog, Context Menu tab + + Shell Configuration Dialog, Context Menu tab + +On the "Icons" tab you configure settings related to the overlay icons and the +icon of the "Overlay Icons Server" in the taskbar (in the notification area of +Windows). + +.. figure:: figures/shell-config-icons.png + :alt: Shell Configuration dialog, Icons tab + + Shell Configuration Dialog, Icons tab + +:guilabel:`Enable overlays:` + If checked, overlay icons are shown on folders and files in the + working directory (woking copy) of Mercurial repositories. + (Default: checked) + +:guilabel:`Local disks only:` + If checked, overlay icons are only shown for volumes on local disks, not + on network shares. Scanning for Mercurial repositories over the network + may result in high latency in the user interface of explorer. Check this + option if browsing network shares becomes too slow and/or you do not need + overlay icons on non-local volumes. + (Default: not checked) + +:guilabel:`Enabled Overlay Handlers:` + These (per user) settings provide the possibility to disable overlay + icon handlers in the shared TortoiseOverlays component. + The TortoiseOverlays component is shared by all Tortoises (TortoiseHg, + TortoiseSVN, etc), with the goal to avoid registering too many icon slots, + by using a common set of icons slots for all Tortoises (thus using the + same set of icons for all Tortoises). + The total number of overlay slots available on Windows is fairly limited and + depends on the exact Windows version. For example, on a pristine install + of Windows 7, there are only 8 free overlay handler slots available. + This section allows to disable certain non-essential overlay + handlers, to reduce icon handler slot consumption by the TortoiseOverlays + component. Unchecking handlers in this section increases the chances that + important handlers like "Normal" (green checkmark) or "Modifed" (red + exclamation mark) will still get an icon slot, even if there are too many + handlers registered on a computer. + Unchecking handlers that are not used by TortoiseHg (that is: Locked, + Readonly, Ignored, Deleted) is highly recommended, if you know that no + other Tortoises (e.g. TortoiseSVN) uses them. + Make sure the "Added" and "Unversioned" handlers are enabled, as these + are used by TortoiseHg. + (Default: all checked) + +.. warning:: + The "Enabled Overlay Handlers" settings affect all Tortoises for a user. + A logoff/login is required to make changes in that section effective. + +:guilabel:`Taskbar:` + Checkmark "Show Icon" to show the icon of the Overlay Icon Server in the + taskbar in the notification area. "Highlight Icon" highlights that icon + using a light green color while the icon server is busy updating cache files + in the repository (files :file:`.hg\\dirstate` and :file:`.hg\\thgstatus`). + (Default: both checked)    One can selectively disable overlay icons in a specific repository by  editing the :file:`.hg\\thgstatus` file inside the repository and @@ -42,30 +128,6 @@
    @@noicons   -Context Menus -------------- - -TortoiseHg commands may be accessed via the context menu of Explorer -windows and other applications which use the standard File/Open dialogs. -Here is the context menu for a revisioned folder: - -.. figure:: figures/cmenu-nofiles.jpg - :alt: Context menu - - Context menu for a folder under Mercurial revision control - -And here is the context menu for selected files or folders: - -.. figure:: figures/cmenu-files.jpg - :alt: Context menu - - Context menu for file or folder selection - -TortoiseHg provides dialogs for the most regularly used Mercurial -commands. Less frequently used and newly added Mercurial commands -may be accessed from the CLI (command line interface) through -:file:`cmd.exe` on Windows. -  Nautilus  --------  
 
230
231
232
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
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
@@ -230,3 +230,44 @@
 remote_repository_url combination).    .. vim: noet ts=4 + +pbranch +======= + +Patch Branches (`pbranch <http://mercurial.selenic.com/wiki/PatchBranchExtension>`_) +is a way to develop a series of patches for submission into a main +repo. It is based on topic branches, one per patch, and is thus highly +suitable for collaborative and/or long-term patch development and +maintenance. + +'A detailed manual <http://arrenbrecht.ch/mercurial/pbranch/>'_ can be found online. + +It adds a number of commands which can be listed with +:command:`hg help pbranch`:: + + pbackout - backs out the current patch branch (undoes all its changes) + pdiff - prints the final diff for the current or given patch branch + peditmessage - edit the patch message + pemail - send patches by email + pexport - exports patches + pextdiff - combines pdiff and extdiff + pgraph - print an ASCII art rendering of the patch dependency graph + pmerge - merge pending heads from dependencies into patch branches + pmessage - print the patch message(s) + pnew - start a new patch branch + pstatus - print status of current (or given) patch branch + reapply - reverts the working copy of all files touched by REV to REV + +**Installation** + +To test the use of this plugin, you can specify it on the Mercurial +command line like this:: + + hg --config "extensions.pbranch=" pstatus + +You may want to add it to your Mercurial.ini or a repository's hgrc like this:: + + [extensions] + pbranch= + +If you do this, you can omit the --config command-line option.
Removed image
Added image
Removed image
Added image
Added image
Added image
Removed image
 
81
82
83
 
 
84
85
86
 
116
117
118
119
120
121
122
123
124
125
126
127
128
129
 
81
82
83
84
85
86
87
88
 
118
119
120
 
 
121
122
123
124
 
 
125
126
127
@@ -81,6 +81,8 @@
  ## use English backout message option   self.eng_msg = gtk.CheckButton(_('Use English backout message'))   self.eng_msg.connect('toggled', self.eng_msg_toggled) + engmsg = self.repo.ui.configbool('tortoisehg', 'engmsg', False) + self.eng_msg.set_active(engmsg)   hbox.pack_start(self.eng_msg, False, False)     ## merge after backout @@ -116,14 +118,10 @@
  self.cmd.set_result(_('Failed to backout'), style='error')     def load_settings(self): - checked = self.settings.get_value('english', False, True) - self.eng_msg.set_active(checked)   checked = self.settings.get_value('merge', True, True)   self.merge_button.set_active(checked)     def store_settings(self): - checked = self.eng_msg.get_active() - self.settings.set_value('english', checked)   checked = self.merge_button.get_active()   self.settings.set_value('merge', checked)   self.settings.write()
 
194
195
196
 
 
 
 
 
 
 
 
 
 
197
198
199
 
201
202
203
204
 
 
 
 
 
205
206
207
 
343
344
345
346
347
348
349
 
422
423
424
425
 
426
427
428
 
578
579
580
581
 
582
583
584
 
590
591
592
593
 
594
595
596
 
793
794
795
796
 
797
798
799
 
805
806
807
808
 
809
810
 
811
812
 
813
814
 
815
816
817
818
 
819
820
821
822
 
823
824
825
 
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
 
211
212
213
 
214
215
216
217
218
219
220
221
 
357
358
359
 
360
361
362
 
435
436
437
 
438
439
440
441
 
591
592
593
 
594
595
596
597
 
603
604
605
 
606
607
608
609
 
806
807
808
 
809
810
811
812
 
818
819
820
 
821
822
 
823
824
 
825
826
 
827
828
829
830
 
831
832
833
834
 
835
836
837
838
@@ -194,6 +194,16 @@
    def load_patch_details(self, patchfile):   'Load specified patch details into buffer and file list' + pf = open(patchfile) + self.load_patch_details_from_file_object(pf, patchfile) + + def load_patch_details_from_file_object(self, pf, patchfile, isTemp=False): + """ Load patch details into buffer and file list + :param pf: open file object + :param patchfile: path and name of patch file + :param isTemp: if True, then pf is a temporary file + and patchfile does not exist + """   self._filelist.clear()   self._filelist.append(('*', _('[All Files]'), ''))   @@ -201,7 +211,11 @@
  self.currev = -1   self.curphunks = {}   self.curpatch = patchfile - pf = open(self.curpatch) + if isTemp: + # pf is a temporary, so update panel cache while we can + patch_ctx = csinfo.patchctx(patchfile, self.repo, patchHandle=pf) + self.summarypanel.update(patch_ctx, self.patchstyle) + pf.seek(0)   def get_path(a, b):   type = (a == '/dev/null') and 'A' or 'M'   type = (b == '/dev/null') and 'R' or type @@ -343,7 +357,6 @@
  tags, lines = self.prepare_diff(lines, offset, wfile)   for l in lines:   buf.insert(eob, l) -   # inserts the tags   for name, p0, p1 in tags:   i0 = buf.get_iter_at_offset(p0) @@ -422,7 +435,7 @@
  tag = 'red'   l = hglib.diffexpand(l)   else: - tag = 'black' + tag = 'normal'   l = hglib.diffexpand(l)   l = l+"\n"   length = len(l.decode('utf-8')) @@ -578,7 +591,7 @@
  def widget_func(widget, item, markups):   def linkwidget(revnum, revid, summary, highlight=None, branch=None):   # revision label - opts = dict(underline='single', color='blue') + opts = dict(underline='single', color=gtklib.BLUE)   if highlight:   opts['weight'] = 'bold'   rev = '%s (%s)' % (gtklib.markup(revnum, **opts), @@ -590,7 +603,7 @@
  # summary & branch label   sum = gtklib.markup(summary)   if branch: - sum = gtklib.markup(branch, color='black', + sum = gtklib.markup(branch, color=gtklib.NORMAL,   background=gtklib.PGREEN) + ' ' + sum   sumlabel = gtk.Label()   sumlabel.set_markup(sum) @@ -793,7 +806,7 @@
  tag_table = self._buffer.get_tag_table()     tag_table.add(make_texttag('diff', font=self.rawfonts['fontdiff'])) - tag_table.add(make_texttag('blue', foreground='blue')) + tag_table.add(make_texttag('blue', foreground=gtklib.BLUE))   if self.colorstyle == 'background':   tag_table.add(make_texttag('red',   paragraph_background=gtklib.PRED)) @@ -805,21 +818,21 @@
  else:   tag_table.add(make_texttag('red', foreground=gtklib.DRED))   tag_table.add(make_texttag('green', foreground=gtklib.DGREEN)) - tag_table.add(make_texttag('black', foreground='black')) + tag_table.add(make_texttag('normal', foreground=gtklib.NORMAL))   tag_table.add(make_texttag('greybg', - paragraph_background='grey', + paragraph_background=gtklib.CHANGE_HEADER,   weight=pango.WEIGHT_BOLD)) - tag_table.add(make_texttag('yellowbg', background='yellow')) + tag_table.add(make_texttag('yellowbg', background=gtklib.YELLOW))   - issuelink_tag = make_texttag('issuelink', foreground='blue', + issuelink_tag = make_texttag('issuelink', foreground=gtklib.BLUE,   underline=pango.UNDERLINE_SINGLE)   issuelink_tag.connect('event', self.issuelink_event)   tag_table.add(issuelink_tag) - urllink_tag = make_texttag('urllink', foreground='blue', + urllink_tag = make_texttag('urllink', foreground=gtklib.BLUE,   underline=pango.UNDERLINE_SINGLE)   urllink_tag.connect('event', self.urllink_event)   tag_table.add(urllink_tag) - csetlink_tag = make_texttag('csetlink', foreground='blue', + csetlink_tag = make_texttag('csetlink', foreground=gtklib.BLUE,   underline=pango.UNDERLINE_SINGLE)   csetlink_tag.connect('event', self.csetlink_event)   tag_table.add(csetlink_tag)
 
19
20
21
22
 
 
 
23
24
25
 
782
783
784
785
786
787
788
 
 
 
 
 
 
789
790
791
 
824
825
826
827
 
828
829
830
 
1084
1085
1086
1087
 
1088
1089
1090
1091
1092
 
1299
1300
1301
1302
 
1303
1304
1305
1306
1307
 
19
20
21
 
22
23
24
25
26
27
 
784
785
786
 
 
 
 
787
788
789
790
791
792
793
794
795
 
828
829
830
 
831
832
833
834
 
1088
1089
1090
 
1091
1092
 
1093
1094
1095
 
1302
1303
1304
 
1305
1306
 
1307
1308
1309
@@ -19,7 +19,9 @@
 from mercurial import hg, util, patch, cmdutil, extensions    from tortoisehg.util.i18n import _ -from tortoisehg.util import shlib, hglib +from tortoisehg.util import shlib, hglib, i18n + +keep = i18n.keepgettext()    from tortoisehg.hgtk.status import GStatus, FM_STATUS, FM_CHECKED  from tortoisehg.hgtk.status import FM_PATH, FM_PATH_UTF8 @@ -782,10 +784,12 @@
    # pre-fill commit message, if not modified   buf = self.text.get_buffer() - if not buf.get_modified(): - buf.set_text(_('Merge ')) - buf.set_modified(False) - + if buf.get_modified(): + return + engmsg = self.repo.ui.configbool('tortoisehg', 'engmsg', False) + msgset = keep._('Merge ') + buf.set_text(engmsg and msgset['id'] or msgset['str']) + buf.set_modified(False)     def check_patch_queue(self):   'See if an MQ patch is applied, switch to qrefresh mode' @@ -824,7 +828,7 @@
  revs = cmdutil.revrange(self.repo, ['tip'])   fp = cStringIO.StringIO()   opts = patch.diffopts(self.ui, self.opts) - patch.export(self.repo, revs, fp=fp, opts=opts) + hglib.export(self.repo, revs, fp=fp, opts=opts)   text = fp.getvalue().splitlines(True)   buf = self.diff_highlight_buffer(text)   self.patch_text.set_buffer(buf) @@ -1084,9 +1088,8 @@
  # bring up the config dialog for user to enter their username.   # But since we can't be sure they will do it right, we will   # have them to retry, to re-trigger the checking mechanism. - dlg = thgconfig.ConfigDialog(False) + dlg = thgconfig.ConfigDialog(False, focus='ui.username')   dlg.show_all() - dlg.focus_field('ui.username')   dlg.run()   dlg.hide()   self.refreshui() @@ -1299,9 +1302,8 @@
  buf.set_text('\n'.join(lines))     def msg_config(self, sender): - dlg = thgconfig.ConfigDialog(True) + dlg = thgconfig.ConfigDialog(True, focus='tortoisehg.summarylen')   dlg.show_all() - dlg.focus_field('tortoisehg.summarylen')   dlg.run()   dlg.hide()   self.refreshui()
 
136
137
138
139
 
 
 
 
 
 
 
140
141
142
143
 
 
 
 
 
144
145
146
147
148
149
150
 
 
 
 
151
152
153
 
353
354
355
356
 
357
358
359
 
360
361
362
 
473
474
475
 
 
 
 
 
 
 
476
477
478
 
484
485
486
487
 
 
488
489
490
 
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
 
366
367
368
 
369
370
371
 
372
373
374
375
 
486
487
488
489
490
491
492
493
494
495
496
497
498
 
504
505
506
 
507
508
509
510
511
@@ -136,18 +136,31 @@
   class patchctx(object):   - def __init__(self, patchpath, repo): + def __init__(self, patchpath, repo, patchHandle=None): + """ Read patch context from file + :param patchHandle: If set, then the patch is a temporary. + The provided handle is used to read the patch and + the patchpath contains the name of the patch. + The handle is NOT closed. + """   self._path = patchpath   self._patchname = os.path.basename(patchpath)   self._repo = repo - pf = open(patchpath) + if patchHandle: + pf = patchHandle + pf_start_pos = pf.tell() + else: + pf = open(patchpath)   try:   data = patch.extract(self._repo.ui, pf)   tmpfile, msg, user, date, branch, node, p1, p2 = data   if tmpfile:   os.unlink(tmpfile)   finally: - pf.close() + if patchHandle: + pf.seek(pf_start_pos) + else: + pf.close()   if not msg and hasattr(repo, 'mq'):   # attempt to get commit message   from hgext import mq @@ -353,10 +366,10 @@
  elif item in ('revnum', 'p4', 'svn'):   return str(value)   elif item in ('rawbranch', 'branch'): - return gtklib.markup(' %s ' % value, color='black', + return gtklib.markup(' %s ' % value, color=gtklib.BLACK,   background=gtklib.PGREEN)   elif item in ('rawtags', 'tags'): - opts = dict(color='black', background=gtklib.PYELLOW) + opts = dict(color=gtklib.BLACK, background=gtklib.PYELLOW)   tags = [gtklib.markup(' %s ' % tag, **opts) for tag in value]   return ' '.join(tags)   elif item in ('desc', 'summary', 'user', 'shortuser', @@ -473,6 +486,13 @@
  return self.info.get_widget(item, self, self.ctx, self.custom, **kargs)     def update(self, target=None, custom=None, repo=None): + self.ctx = None + if type(target) == patchctx: + # If a patchctx is specified as target, use it instead + # of creating a context from revision or patch file + self.ctx = target + target = None + self.target = None   if target is None:   target = self.target   if target is not None: @@ -484,7 +504,8 @@
  repo = self.repo   if repo is not None:   self.repo = repo - self.ctx = create_context(repo, target) + if self.ctx is None: + self.ctx = create_context(repo, target)   if self.ctx is None:   return False # cannot update   return True
 
677
678
679
680
 
681
682
683
684
685
 
677
678
679
 
680
681
 
682
683
684
@@ -677,9 +677,8 @@
  if os.path.basename(editor) in ('vi', 'vim', 'hgeditor'):   Prompt(_('No visual editor configured'),   _('Please configure a visual editor.'), self).run() - dlg = thgconfig.ConfigDialog(False) + dlg = thgconfig.ConfigDialog(False, focus='tortoisehg.editor')   dlg.show_all() - dlg.focus_field('tortoisehg.editor')   dlg.run()   dlg.hide()   self.ui = ui.ui()
 
37
38
39
 
 
 
40
41
42
 
44
45
46
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
47
48
49
 
37
38
39
40
41
42
43
44
45
 
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
@@ -37,6 +37,9 @@
 DRED = '#900000'  DGREEN = '#006400'  DBLUE = '#000090' +DYELLOW = '#6A6A00' +DORANGE = '#AA5000' +# DORANGE = '#FF8000'    PRED = '#ffcccc'  PGREEN = '#aaffaa' @@ -44,6 +47,102 @@
 PYELLOW = '#ffffaa'  PORANGE = '#ffddaa'   +RED = 'red' +GREEN = 'green' +BLUE = 'blue' +YELLOW = 'yellow' +BLACK = 'black' +WHITE = 'white' +GREY = 'grey' + +NORMAL = BLACK +NEW_REV_COLOR = DGREEN +CHANGE_HEADER = GREY + +UP_ARROW_COLOR = '#feaf3e' +DOWN_ARROW_COLOR = '#8ae234' +STAR_COLOR = '#fce94f' +CELL_GREY = '#2e3436' +STATUS_HEADER = '#DDDDDD' +STATUS_REJECT_BACKGROUND = '#EEEEEE' +STATUS_REJECT_FOREGROUND = '#888888' + +# line colors +MAINLINE_COLOR = ( 0.0, 0.0, 0.0 ) +LINE_COLORS = [ + ( 1.0, 0.0, 0.0 ), + ( 1.0, 1.0, 0.0 ), + ( 0.0, 1.0, 0.0 ), + ( 0.0, 1.0, 1.0 ), + ( 0.0, 0.0, 1.0 ), + ( 1.0, 0.0, 1.0 ), + ] + +def get_gtk_colors(): + color_scheme = gtk.settings_get_default().get_property('gtk-color-scheme') + colors = {} + for color in color_scheme.split('\n'): + color = color.strip() + if color: + name, color = color.split(':') + colors[name.strip()] = gtk.gdk.color_parse(color.strip()) + return colors + +def _init_colors(): + global NORMAL, MAINLINE_COLOR + + gtk_colors = get_gtk_colors() + + try: + normal = gtk_colors['fg_color'] + except KeyError: + # TODO: find out how to log such errors + pass + else: + NORMAL = str(normal) + MAINLINE_COLOR = ( + normal.red_float, + normal.green_float, + normal.blue_float + ) + + # adjust colors for a dark color scheme: + if normal.value > 0.5: + global RED, GREEN, BLUE, BLACK, WHITE, \ + DRED, DGREEN, DBLUE, DYELLOW, DORANGE, \ + PRED, PGREEN, PBLUE, PYELLOW, PORANGE, \ + NEW_REV_COLOR, LINE_COLORS, CHANGE_HEADER + + RED = PRED + GREEN = NEW_REV_COLOR = PGREEN + BLUE = PBLUE + PRED = DRED + DRED = '#FF6161' +# DRED, PRED = PRED, DRED + DGREEN, PGREEN = PGREEN, DGREEN + DBLUE, PBLUE = PBLUE, DBLUE + DYELLOW, PYELLOW = PYELLOW, DYELLOW + DORANGE, PORANGE = PORANGE, DORANGE + BLACK, WHITE = WHITE, BLACK + + CHANGE_HEADER = '#404040' + + LINE_COLORS = [ + ( 1.0, 0.3804, 0.3804 ), + ( 1.0, 1.0, 0.0 ), + ( 0.0, 1.0, 0.0 ), + ( 0.0, 1.0, 1.0 ), + ( 0.2902, 0.4863, 0.851 ), + ( 1.0, 0.3882, 1.0 ), + ] + + # TODO: dark color scheme for: + # UP_ARROW_COLOR, DOWN_ARROW_COLOR, STAR_COLOR, + # CELL_GREY, STATUS_HEADER, STATUS_REJECT_BACKGROUND, + # STATUS_REJECT_FOREGROUND + +_init_colors() +  def set_tortoise_icon(window, thgicon):   ico = paths.get_tortoise_icon(thgicon)   if ico: window.set_icon_from_file(ico)
 
196
197
198
199
 
200
201
202
 
196
197
198
 
199
200
201
202
@@ -196,7 +196,7 @@
  self.buf = gtk.TextBuffer()   self.buf.create_tag('removed', foreground=gtklib.DRED)   self.buf.create_tag('added', foreground=gtklib.DGREEN) - self.buf.create_tag('position', foreground='#FF8000') + self.buf.create_tag('position', foreground=gtklib.DORANGE)   self.buf.create_tag('header', foreground=gtklib.DBLUE)   diffview = gtk.TextView(self.buf)   scroller.add(diffview)
 
406
407
408
409
 
410
411
412
 
406
407
408
 
409
410
411
412
@@ -406,7 +406,7 @@
  markup = markup % (gtklib.DRED, 'bold')   icons = {'error': True}   else: - markup = markup % ('black', 'normal') + markup = markup % (gtklib.NORMAL, 'normal')   icons = {}   text = gtklib.markup_escape_text(text)   self.rlabel.set_markup(markup % text)
 
245
246
247
248
 
249
250
251
252
253
 
291
292
293
294
 
295
296
297
298
299
 
245
246
247
 
248
249
 
250
251
252
 
290
291
292
 
293
294
 
295
296
297
@@ -245,9 +245,8 @@
  self._flaglist.append(['STABLE'])     def _on_conf_clicked(self, button): - dlg = thgconfig.ConfigDialog(False) + dlg = thgconfig.ConfigDialog(False, focus='email.from')   dlg.show_all() - dlg.focus_field('email.from')   dlg.run()   dlg.hide()   self._refresh(False) @@ -291,9 +290,8 @@
  if not self.repo.ui.config('smtp', 'host'):   dialog.info_dialog(self, _('Info required'),   _('You must configure SMTP')) - dlg = thgconfig.ConfigDialog(False) + dlg = thgconfig.ConfigDialog(False, focus='smtp.host')   dlg.show_all() - dlg.focus_field('smtp.host')   dlg.run()   dlg.hide()   self._refresh(False)
 
87
88
89
 
90
91
92
93
 
94
95
96
 
104
105
106
 
107
108
109
 
87
88
89
90
91
92
 
 
93
94
95
96
 
104
105
106
107
108
109
110
@@ -87,10 +87,10 @@
  else:   gtkrun(run, u, **opts)   +origwdir = os.getcwd()  def portable_fork(ui, opts):   if 'THG_HGTK_SPAWN' in os.environ or ( - not opts.get('fork') and ( - opts.get('nofork') or opts.get('repository'))): + not opts.get('fork') and opts.get('nofork')):   return   elif ui.configbool('tortoisehg', 'hgtkfork', None) is not None:   if not ui.configbool('tortoisehg', 'hgtkfork'): @@ -104,6 +104,7 @@
  args = [sys.executable] + sys.argv   os.environ['THG_HGTK_SPAWN'] = '1'   cmdline = subprocess.list2cmdline(args) + os.chdir(origwdir)   subprocess.Popen(cmdline,   close_fds=True,   creationflags=openflags,
 
28
29
30
 
31
32
33
 
251
252
253
254
 
 
 
 
 
 
 
 
 
 
 
255
256
257
 
360
361
362
 
 
 
 
 
 
363
364
365
 
372
373
374
375
 
376
377
378
 
864
865
866
867
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
868
869
870
 
938
939
940
941
 
942
 
943
944
945
 
971
972
973
 
 
 
 
 
 
 
974
975
976
 
992
993
994
 
 
995
996
997
 
1031
1032
1033
 
 
 
 
1034
1035
1036
 
1168
1169
1170
 
 
 
 
1171
1172
1173
 
1357
1358
1359
 
1360
1361
1362
 
1568
1569
1570
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1571
1572
1573
 
2071
2072
2073
 
 
2074
2075
2076
 
2692
2693
2694
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
2695
2696
2697
 
28
29
30
31
32
33
34
 
252
253
254
 
255
256
257
258
259
260
261
262
263
264
265
266
267
268
 
371
372
373
374
375
376
377
378
379
380
381
382
 
389
390
391
 
392
393
394
395
 
881
882
883
 
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
 
972
973
974
 
975
976
977
978
979
980
 
1006
1007
1008
1009
1010
1011
1012
1013
1014
1015
1016
1017
1018
 
1034
1035
1036
1037
1038
1039
1040
1041
 
1075
1076
1077
1078
1079
1080
1081
1082
1083
1084
 
1216
1217
1218
1219
1220
1221
1222
1223
1224
1225
 
1409
1410
1411
1412
1413
1414
1415
 
1621
1622
1623
1624
1625
1626
1627
1628
1629
1630
1631
1632
1633
1634
1635
1636
1637
1638
1639
1640
1641
1642
1643
1644
1645
 
2143
2144
2145
2146
2147
2148
2149
2150
 
2766
2767
2768
2769
2770
2771
2772
2773
2774
2775
2776
2777
2778
2779
2780
2781
2782
2783
2784
2785
2786
2787
2788
2789
2790
2791
@@ -28,6 +28,7 @@
 from tortoisehg.hgtk import backout, status, hgemail, tagadd, update, merge  from tortoisehg.hgtk import archive, changeset, thgconfig, thgmq, histdetails  from tortoisehg.hgtk import statusbar, bookmark, thgimport +from tortoisehg.hgtk import thgpbranch    MODE_REVRANGE = 0  MODE_FILEPATS = 1 @@ -251,7 +252,17 @@
  tip=_('Show/Hide Patch Queue'),   toggle=True,   icon='menupatch.ico') - tbar += [gtk.SeparatorToolItem(), self.mqtb] + tbar += [self.mqtb] + if 'pbranch' in self.exs: + self.pbranchtb = self.make_toolbutton(gtk.STOCK_DIRECTORY, + _('Patch Branch'), + self.pbranch_clicked, name='pbranch', + tip=_('Show/Hide Patch Branch'), + toggle=True, + icon='menupatch.ico') + tbar += [self.pbranchtb] + if 'mq' in self.exs or 'pbranch' in self.exs: + tbar += [gtk.SeparatorToolItem()]   sep = gtk.SeparatorToolItem()   sep.set_expand(True)   sep.set_draw(False) @@ -360,6 +371,12 @@
  else:   p4menu = []   + if 'pbranch' in self.exs: + pbranch_item = [dict(text=_('Patch Branch'), name='pbranch', ascheck=True, + func=self.pbranch_clicked, check=self.setting_pbranchvis) ] + else: + pbranch_item = [] +   return [   dict(text=_('_View'), subitems=[   dict(text=_('Load more Revisions'), name='load-more', @@ -372,7 +389,7 @@
  ] + sync_bar_item + [   dict(text=_('Filter Bar'), ascheck=True,   func=self.toggle_show_filterbar, check=self.show_filterbar), - ] + mq_item + [ + ] + mq_item + pbranch_item + [   dict(text='----'),   dict(text=_('Refresh'), func=refresh, args=[False],   icon=gtk.STOCK_REFRESH), @@ -864,7 +881,24 @@
  else:   self.goto_rev(revid)   - def repo_invalidated(self, mqwidget): + def pbranch_selected(self, pbranchwidget, revid, patchname): + 'if revid < 0 then the patch is listed in .hg/pgraph but not in repo' + self.stbar.set_text('') + pf = tempfile.TemporaryFile() + try: + try: + pf.writelines(pbranchwidget.pdiff(patchname)) + except (util.Abort, error.RepoError), e: + self.stbar.set_text(str(e)) + return + self.currevid = self.lastrevid = None + pf.seek(0) + self.changeview.load_patch_details_from_file_object(pf, patchname, isTemp=True) + finally: + pf.close() + + def repo_invalidated(self, widget): + 'Emitted from MQWidget and PBranchWidget'   self.reload_log()     def files_dropped(self, mqwidget, files, *args): @@ -938,8 +972,9 @@
  else:   item.set_sensitive(False)   - # enable MQ panel + # enable panels   self.enable_mqpanel() + self.enable_pbranchpanel()     def get_proxy_args(self):   item = self.get_menuitem('use-proxy-server') @@ -971,6 +1006,13 @@
  else:   settings['glog-mqpane'] = self.setting_mqhpos   settings['glog-mqvis'] = self.setting_mqvis + if hasattr(self, 'pbranchpaned') and self.pbranchwidget.has_patch(): + curpos = self.pbranchpaned.get_position() + settings['glog-pbranchpane'] = curpos or self.setting_pbranchhpos + settings['glog-pbranchvis'] = bool(curpos) + else: + settings['glog-pbranchpane'] = self.setting_pbranchhpos + settings['glog-pbranchvis'] = self.setting_pbranchvis   settings['branch-color'] = self.graphview.get_property('branch-color')   settings['show-output'] = self.showoutput   settings['show-toolbar'] = self.show_toolbar @@ -992,6 +1034,8 @@
  self.setting_hpos = settings.get('glog-hpane', -1)   self.setting_mqhpos = settings.get('glog-mqpane', 140) or 140   self.setting_mqvis = settings.get('glog-mqvis', False) + self.setting_pbranchhpos = settings.get('glog-pbranchpane', 140) or 140 + self.setting_pbranchvis = settings.get('glog-pbranchvis', False)   self.branch_color = settings.get('branch-color', False)   self.showoutput = settings.get('show-output', False)   self.show_toolbar = settings.get('show-toolbar', True) @@ -1031,6 +1075,10 @@
  if hasattr(self, 'mqwidget'):   self.mqwidget.refresh()   + # refresh pbranch widget if exists + if hasattr(self, 'pbranchwidget'): + self.pbranchwidget.refresh() +   # force a redraw of the visible rows   self.graphview.hide()   self.graphview.show() @@ -1168,6 +1216,10 @@
  # refresh filterbar   self.filterbar.refresh(hglib.getlivebranch(self.repo))   + # refresh pbranch widget if exists + if hasattr(self, 'pbranchwidget'): + self.pbranchwidget.refresh() +   # Remember options to next time reload_log is called   self.filteropts = opts   @@ -1357,6 +1409,7 @@
  # prepare statusbar   self.stbar = statusbar.StatusBar()   self.stbar.append_field('mq') + self.stbar.append_field('pbranch')   self.stbar.append_field('filter')   self.stbar.append_field('rev')   @@ -1568,6 +1621,25 @@
  midpane.pack_start(self.graphview)   midpane.show_all()   + # pbranch widget + if 'pbranch' in self.exs: + # create PBranchWidget + self.pbranchwidget = thgpbranch.PBranchWidget( + self, self.repo, self.stbar, accelgroup, self.tooltips) + self.pbranchwidget.connect('patch-selected', self.pbranch_selected) + self.pbranchwidget.connect('repo-invalidated', self.repo_invalidated) + + def wrapframe(widget): + frame = gtk.Frame() + frame.set_shadow_type(gtk.SHADOW_ETCHED_IN) + frame.add(widget) + return frame + self.pbranchpaned = gtk.HPaned() + self.pbranchpaned.add1(wrapframe(self.pbranchwidget)) + self.pbranchpaned.add2(wrapframe(midpane)) + + midpane = self.pbranchpaned +   # MQ widget   if 'mq' in self.exs:   # create MQWidget @@ -2071,6 +2143,8 @@
  self.hpaned.set_position(self.setting_hpos)   if hasattr(self, 'mqpaned') and self.mqtb.get_active():   self.mqpaned.set_position(self.setting_mqhpos) + if hasattr(self, 'pbranchpaned') and self.pbranchtb.get_active(): + self.pbranchpaned.set_position(self.setting_pbranchhpos)     def thgdiff(self, treeview):   'ctrl-d handler' @@ -2692,6 +2766,26 @@
  def mq_clicked(self, widget, *args):   self.enable_mqpanel(widget.get_active())   + def enable_pbranchpanel(self, enable=None): + if not hasattr(self, 'pbranchpaned'): + return + if enable is None: + enable = self.setting_pbranchvis and self.pbranchwidget.has_patch() + oldpos = self.pbranchpaned.get_position() + self.pbranchpaned.set_position(enable and self.setting_pbranchhpos or 0) + if not enable and oldpos: + self.setting_pbranchhpos = oldpos + + # set the state of PBranch toolbutton + if hasattr(self, 'pbranchtb'): + self.pbranchtb.handler_block_by_func(self.pbranch_clicked) + self.cmd_set_active('pbranch', enable) + self.pbranchtb.handler_unblock_by_func(self.pbranch_clicked) + self.cmd_set_sensitive('pbranch', self.pbranchwidget.has_pbranch()) + + def pbranch_clicked(self, widget, data=None): + self.enable_pbranchpanel(widget.get_active()) +   def tree_button_press(self, tree, event):   if event.button == 3 and not (event.state & (gtk.gdk.SHIFT_MASK |   gtk.gdk.CONTROL_MASK)):
 
19
20
21
 
 
22
23
24
 
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
 
106
107
 
108
109
110
 
189
190
191
192
 
193
194
195
 
198
199
200
201
 
202
203
204
205
206
 
207
208
209
 
218
219
220
221
 
222
223
224
 
19
20
21
22
23
24
25
26
 
89
90
91
 
 
 
 
 
 
 
 
 
92
93
94
95
96
97
 
98
99
 
100
101
102
103
 
182
183
184
 
185
186
187
188
 
191
192
193
 
194
195
196
197
198
 
199
200
201
202
 
211
212
213
 
214
215
216
217
@@ -19,6 +19,8 @@
 import pango  import cairo   +from tortoisehg.hgtk import gtklib +  # Styles used when rendering revision graph edges  style_SOLID = 0  style_DASHED = 1 @@ -87,24 +89,15 @@
  colours and the fg parameter provides the multiplier that should be   applied to the foreground colours.   """ - mainline_color = ( 0.0, 0.0, 0.0 ) - colours = [ - ( 1.0, 0.0, 0.0 ), - ( 1.0, 1.0, 0.0 ), - ( 0.0, 1.0, 0.0 ), - ( 0.0, 1.0, 1.0 ), - ( 0.0, 0.0, 1.0 ), - ( 1.0, 0.0, 1.0 ), - ]     if isinstance(colour, str):   r, g, b = colour[1:3], colour[3:5], colour[5:7]   colour_rgb = int(r, 16) / 255., int(g, 16) / 255., int(b, 16) / 255.   else:   if colour == 0: - colour_rgb = mainline_color + colour_rgb = gtklib.MAINLINE_COLOR   else: - colour_rgb = colours[colour % len(colours)] + colour_rgb = gtklib.LINE_COLORS[colour % len(gtklib.LINE_COLORS)]     red = (colour_rgb[0] * fg) or bg   green = (colour_rgb[1] * fg) or bg @@ -189,7 +182,7 @@
  # Possible node status   if status != 0:   def draw_arrow(x, y, dir): - self.set_colour(ctx, '#2e3436', 0.0, 1.0) + self.set_colour(ctx, gtklib.CELL_GREY, 0.0, 1.0)   ctx.rectangle(x, y, 2, 5)   ax, ay = x, y + (dir == 'down' and 5 or 0)   inc = 3 * (dir == 'up' and -1 or 1) @@ -198,12 +191,12 @@
  ctx.line_to(ax + 1, ay + inc)   ctx.line_to(ax - 2, ay)   ctx.stroke_preserve() - fillcolor = dir == 'up' and '#feaf3e' or '#8ae234' + fillcolor = dir == 'up' and gtklib.UP_ARROW_COLOR or gtklib.DOWN_ARROW_COLOR   self.set_colour(ctx, fillcolor, 0.0, 1.0)   ctx.fill()     def draw_star(x, y, radius, nodes, offset=False): - self.set_colour(ctx, '#2e3436', 0.0, 1.0) + self.set_colour(ctx, gtklib.CELL_GREY, 0.0, 1.0)   total_nodes = nodes * 2 #inner + outer nodes   angle = 2 * math.pi / total_nodes;   offset = offset and angle / 2 or 0 @@ -218,7 +211,7 @@
  else:   ctx.line_to(arc_x, arc_y)   ctx.stroke_preserve() - self.set_colour(ctx, '#fce94f', 0.0, 1.0) + self.set_colour(ctx, gtklib.STAR_COLOR, 0.0, 1.0)   ctx.fill()     arrow_y = arc_start_position_y - box_size / 4
 
179
180
181
182
 
183
184
185
 
217
218
219
220
 
221
222
223
224
225
226
 
227
228
229
 
295
296
297
298
 
299
300
301
 
303
304
305
306
 
307
308
309
 
179
180
181
 
182
183
184
185
 
217
218
219
 
220
221
222
223
224
225
 
226
227
228
229
 
295
296
297
 
298
299
300
301
 
303
304
305
 
306
307
308
309
@@ -179,7 +179,7 @@
  if parent is None:   parent = ctx.parents()[0].node()   M, A, R = self.repo.status(parent, ctx.node())[:3] - common = dict(color='black') + common = dict(color=gtklib.BLACK)   M = M and gtklib.markup(' %s ' % len(M),   background=gtklib.PORANGE, **common) or ''   A = A and gtklib.markup(' %s ' % len(A), @@ -217,13 +217,13 @@
  bg = gtklib.PORANGE   elif tag in self.mqpatches:   bg = gtklib.PBLUE - style = {'color': 'black', 'background': bg} + style = {'color': gtklib.BLACK, 'background': bg}   tstr += gtklib.markup(' %s ' % tag, **style) + ' '     branch = ctx.branch()   bstr = ''   if self.branchtags.get(branch) == node: - bstr += gtklib.markup(' %s ' % branch, color='black', + bstr += gtklib.markup(' %s ' % branch, color=gtklib.BLACK,   background=gtklib.PGREEN) + ' '     if revid in self.wcparents: @@ -295,7 +295,7 @@
  self.color_func = self.text_color_author     def text_color_default(self, rev, author): - return int(rev) >= self.origtip and 'darkgreen' or 'black' + return int(rev) >= self.origtip and gtklib.NEW_REV_COLOR or gtklib.NORMAL     colors = '''black blue deeppink mediumorchid blue burlywood4 goldenrod   slateblue red2 navy dimgrey'''.split() @@ -303,7 +303,7 @@
    def text_color_author(self, rev, author):   if int(rev) >= self.origtip: - return 'darkgreen' + return gtklib.NEW_REV_COLOR   for re, v in self.author_pats:   if (re.search(author)):   return v
 
214
215
216
217
 
218
219
220
221
222
 
214
215
216
 
217
218
 
219
220
221
@@ -214,9 +214,8 @@
  threading.Thread(target=start_browser).start()     def _on_conf_clicked(self, *args): - dlg = thgconfig.ConfigDialog(True) + dlg = thgconfig.ConfigDialog(True, focus='web.name')   dlg.show_all() - dlg.focus_field('web.name')   dlg.run()   dlg.hide()   self._get_config()
 
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
 
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
 
147
148
149
 
 
 
150
151
152
 
179
180
181
 
 
 
 
 
 
 
 
 
182
183
184
185
186
187
 
 
 
 
 
 
188
189
190
 
199
200
201
 
 
 
 
 
 
 
 
 
 
 
 
 
 
202
203
204
 
207
208
209
 
 
 
 
 
 
210
211
212
 
225
226
227
 
 
 
 
 
 
228
229
230
231
232
 
233
234
235
236
237
238
 
 
 
 
 
 
 
239
240
241
 
32
33
34
 
35
36
37
38
39
40
 
 
 
 
 
 
 
 
 
 
 
 
41
42
43
44
45
 
 
46
47
48
 
49
50
51
52
 
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
 
213
214
215
216
217
218
219
220
221
 
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
 
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
 
305
306
307
308
309
310
311
312
313
314
315
316
 
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
@@ -32,25 +32,21 @@
  vbox.set_border_width(5)   self.add(vbox)   - # Options page + # Create a new notebook, place the position of the tabs + self.notebook = notebook = gtk.Notebook() + notebook.set_tab_pos(gtk.POS_TOP) + vbox.pack_start(notebook, True, True) + notebook.show()   - ## Overlays group - ovframe = gtk.Frame(_('Overlays')) - ovframe.set_border_width(2) - vbox.pack_start(ovframe, False, False, 2) - ovcvbox = gtk.VBox() - ovframe.add(ovcvbox) - hbox = gtk.HBox() - ovcvbox.pack_start(hbox, False, False, 2) - self.ovenable = gtk.CheckButton(_('Enable overlays')) - hbox.pack_start(self.ovenable, False, False, 2) - self.lclonly = gtk.CheckButton(_('Local disks only')) - hbox.pack_start(self.lclonly, False, False, 2) + # Context Menu page + cmenuframe = self.add_page(notebook, _('Context Menu')) + cmenuvbox = gtk.VBox() + cmenuframe.add(cmenuvbox)   - ## Context Menu group - cmframe = gtk.Frame(_('Context Menu')) + ## Top/Sub Menu items group + cmframe = gtk.Frame(_('Menu Items'))   cmframe.set_border_width(2) - vbox.pack_start(cmframe, True, True, 2) + cmenuvbox.pack_start(cmframe, True, True, 2)     table = gtk.Table(2, 3)   cmframe.add(table) @@ -112,26 +108,96 @@
  subbutton.connect('clicked', self.sub_clicked)   mbbox.add(subbutton)   + # Icons page + iconsframe = self.add_page(notebook, _('Icons')) + iconsvbox = gtk.VBox() + iconsframe.add(iconsvbox) + + ## Overlays group + ovframe = gtk.Frame(_('Overlays')) + ovframe.set_border_width(2) + iconsvbox.pack_start(ovframe, False, False, 2) + ovcvbox = gtk.VBox() + ovframe.add(ovcvbox) + hbox = gtk.HBox() + ovcvbox.pack_start(hbox, False, False, 2) + self.ovenable = gtk.CheckButton(_('Enable overlays')) + hbox.pack_start(self.ovenable, False, False, 2) + self.lclonly = gtk.CheckButton(_('Local disks only')) + hbox.pack_start(self.lclonly, False, False, 2) + + ## Overlay icon handlers group + frame = gtk.Frame(_('Enabled Overlay Handlers')) + frame.set_border_width(2) + iconsvbox.pack_start(frame, False, False, 2) + tvbox = gtk.VBox() + frame.add(tvbox) + + hbox = gtk.HBox() + tvbox.pack_start(hbox, False, False, 2) + hbox.pack_start(gtk.Label( + _('Warning: affects all Tortoises, logoff required after change')), + False, False, 2) + + hbox = gtk.HBox() + tvbox.pack_start(hbox, False, False, 2) + + colvbox = gtk.VBox() + hbox.pack_start(colvbox, False, False, 2) + self.enableAddedHandler = gtk.CheckButton(_('Added')) + colvbox.pack_start(self.enableAddedHandler, False, False, 2) + self.enableUnversionedHandler = gtk.CheckButton(_('Unversioned')) + colvbox.pack_start(self.enableUnversionedHandler, False, False, 2) + + colvbox = gtk.VBox() + hbox.pack_start(colvbox, False, False, 2) + self.enableLockedHandler = gtk.CheckButton(_('Locked*')) + colvbox.pack_start(self.enableLockedHandler, False, False, 2) + self.enableReadonlyHandler = gtk.CheckButton(_('Readonly*')) + colvbox.pack_start(self.enableReadonlyHandler, False, False, 2) + + colvbox = gtk.VBox() + hbox.pack_start(colvbox, False, False, 2) + self.enableIgnoredHandler = gtk.CheckButton(_('Ignored*')) + colvbox.pack_start(self.enableIgnoredHandler, False, False, 2) + self.enableDeletedHandler = gtk.CheckButton(_('Deleted*')) + colvbox.pack_start(self.enableDeletedHandler, False, False, 2) + + def connect_apply(checkbutton): + checkbutton.connect('toggled', lambda x: self.apply.set_sensitive(True)) + connect_apply(self.enableAddedHandler) + connect_apply(self.enableUnversionedHandler) + connect_apply(self.enableIgnoredHandler) + connect_apply(self.enableLockedHandler) + connect_apply(self.enableReadonlyHandler) + connect_apply(self.enableDeletedHandler) + + hbox = gtk.HBox() + tvbox.pack_start(hbox, False, False, 2) + hbox.pack_start(gtk.Label( + _('*: not used by TortoiseHg')), + False, False, 2) +   ## Taskbar group   taskbarframe = gtk.Frame(_('Taskbar'))   taskbarframe.set_border_width(2) - vbox.pack_start(taskbarframe, False, False, 2) + iconsvbox.pack_start(taskbarframe, False, False, 2)   taskbarbox = gtk.VBox()   taskbarframe.add(taskbarbox)   hbox = gtk.HBox()   taskbarbox.pack_start(hbox, False, False, 2)   self.show_taskbaricon = gtk.CheckButton(_('Show Icon')) - hbox.pack_start(self.show_taskbaricon, False, False, 2) + hbox.pack_start(self.show_taskbaricon, False, False, 2)   self.hgighlight_taskbaricon = gtk.CheckButton(_('Highlight Icon')) - hbox.pack_start(self.hgighlight_taskbaricon, False, False, 2) + hbox.pack_start(self.hgighlight_taskbaricon, False, False, 2)     # Tooltips   tips = gtk.Tooltips()   - tooltip = _('Enable/Disable the overlay icons globally') + tooltip = _('Show overlay icons in Mercurial repositories')   tips.set_tip(self.ovenable, tooltip)   self.ovenable.connect('toggled', self.ovenable_toggled) - tooltip = _('Only enable overlays on local disks') + tooltip = _('Show overlays on local disks only')   tips.set_tip(self.lclonly, tooltip)   self.lclonly.connect('toggled', lambda x: self.apply.set_sensitive(True))   @@ -147,6 +213,9 @@
  accelgroup = gtk.AccelGroup()   self.add_accel_group(accelgroup)   + # Padding + vbox.pack_start(gtk.HBox(), False, False, 3) +   # Bottom buttons   bbox = gtk.HBox()   vbox.pack_start(bbox, False, False) @@ -179,12 +248,27 @@
  self.apply.set_sensitive(False)   righthbbox.pack_start(self.apply, False, False)   + def add_page(self, notebook, tab): + frame = gtk.Frame() + frame.set_border_width(5) + frame.set_shadow_type(gtk.SHADOW_NONE) + frame.show() + label = gtk.Label(tab) + notebook.append_page(frame, label) + return frame +   def load_shell_configs(self):   overlayenable = True   localdisks = False   promoteditems = 'commit'   show_taskbaricon = True   hgighlight_taskbaricon = True + enableUnversionedHandler = True + enableIgnoredHandler = True + enableLockedHandler = True + enableReadonlyHandler = True + enableDeletedHandler = True + enableAddedHandler = True   try:   from _winreg import HKEY_CURRENT_USER, OpenKey, QueryValueEx   hkey = OpenKey(HKEY_CURRENT_USER, r'Software\TortoiseHg') @@ -199,6 +283,20 @@
  except EnvironmentError: pass   try: promoteditems = QueryValueEx(hkey, 'PromotedItems')[0]   except EnvironmentError: pass + + hkey = OpenKey(HKEY_CURRENT_USER, r'Software\TortoiseOverlays') + try: enableUnversionedHandler = QueryValueEx(hkey, 'ShowUnversionedOverlay')[0] != 0 + except EnvironmentError: pass + try: enableIgnoredHandler = QueryValueEx(hkey, 'ShowIgnoredOverlay')[0] != 0 + except EnvironmentError: pass + try: enableLockedHandler = QueryValueEx(hkey, 'ShowLockedOverlay')[0] != 0 + except EnvironmentError: pass + try: enableReadonlyHandler = QueryValueEx(hkey, 'ShowReadonlyOverlay')[0] != 0 + except EnvironmentError: pass + try: enableDeletedHandler = QueryValueEx(hkey, 'ShowDeletedOverlay')[0] != 0 + except EnvironmentError: pass + try: enableAddedHandler = QueryValueEx(hkey, 'ShowAddedOverlay')[0] != 0 + except EnvironmentError: pass   except (ImportError, WindowsError):   pass   @@ -207,6 +305,12 @@
  self.lclonly.set_sensitive(overlayenable)   self.show_taskbaricon.set_active(show_taskbaricon)   self.hgighlight_taskbaricon.set_active(hgighlight_taskbaricon) + self.enableUnversionedHandler.set_active(enableUnversionedHandler) + self.enableIgnoredHandler.set_active(enableIgnoredHandler) + self.enableLockedHandler.set_active(enableLockedHandler) + self.enableReadonlyHandler.set_active(enableReadonlyHandler) + self.enableDeletedHandler.set_active(enableDeletedHandler) + self.enableAddedHandler.set_active(enableAddedHandler)     promoted = [pi.strip() for pi in promoteditems.split(',')]   self.submmodel.clear() @@ -225,17 +329,30 @@
  localdisks = self.lclonly.get_active() and '1' or '0'   show_taskbaricon = self.show_taskbaricon.get_active() and '1' or '0'   hgighlight_taskbaricon = self.hgighlight_taskbaricon.get_active() and '1' or '0' + enableUnversionedHandler = self.enableUnversionedHandler.get_active() and 1 or 0 + enableIgnoredHandler = self.enableIgnoredHandler.get_active() and 1 or 0 + enableLockedHandler = self.enableLockedHandler.get_active() and 1 or 0 + enableReadonlyHandler = self.enableReadonlyHandler.get_active() and 1 or 0 + enableDeletedHandler = self.enableDeletedHandler.get_active() and 1 or 0 + enableAddedHandler = self.enableAddedHandler.get_active() and 1 or 0   promoted = []   for row in self.topmmodel:   promoted.append(row[0])   try: - from _winreg import HKEY_CURRENT_USER, CreateKey, SetValueEx, REG_SZ + from _winreg import HKEY_CURRENT_USER, CreateKey, SetValueEx, REG_SZ, REG_DWORD   hkey = CreateKey(HKEY_CURRENT_USER, r"Software\TortoiseHg")   SetValueEx(hkey, 'EnableOverlays', 0, REG_SZ, overlayenable)   SetValueEx(hkey, 'LocalDisksOnly', 0, REG_SZ, localdisks)   SetValueEx(hkey, 'ShowTaskbarIcon', 0, REG_SZ, show_taskbaricon)   SetValueEx(hkey, 'HighlightTaskbarIcon', 0, REG_SZ, hgighlight_taskbaricon)   SetValueEx(hkey, 'PromotedItems', 0, REG_SZ, ','.join(promoted)) + hkey = CreateKey(HKEY_CURRENT_USER, r'Software\TortoiseOverlays') + SetValueEx(hkey, 'ShowUnversionedOverlay', 0, REG_DWORD, enableUnversionedHandler) + SetValueEx(hkey, 'ShowIgnoredOverlay', 0, REG_DWORD, enableIgnoredHandler) + SetValueEx(hkey, 'ShowLockedOverlay', 0, REG_DWORD, enableLockedHandler) + SetValueEx(hkey, 'ShowReadonlyOverlay', 0, REG_DWORD, enableReadonlyHandler) + SetValueEx(hkey, 'ShowDeletedOverlay', 0, REG_DWORD, enableDeletedHandler) + SetValueEx(hkey, 'ShowAddedOverlay', 0, REG_DWORD, enableAddedHandler)   except ImportError:   pass  
 
53
54
55
56
 
57
58
59
 
411
412
413
414
 
415
416
417
 
420
421
422
423
424
 
 
425
426
427
 
870
871
872
873
 
 
874
875
876
 
920
921
922
923
 
924
925
 
926
927
 
928
929
 
930
931
 
932
933
934
 
1096
1097
1098
1099
 
1100
1101
1102
 
53
54
55
 
56
57
58
59
 
411
412
413
 
414
415
416
417
 
420
421
422
 
 
423
424
425
426
427
 
870
871
872
 
873
874
875
876
877
 
921
922
923
 
924
925
 
926
927
 
928
929
 
930
931
 
932
933
934
935
 
1097
1098
1099
 
1100
1101
1102
1103
@@ -53,7 +53,7 @@
  elif line.startswith('+'):   hunk += gtklib.markup(line, color=gtklib.DGREEN)   elif line.startswith('@@'): - hunk = gtklib.markup(line, color='#FF8000') + hunk = gtklib.markup(line, color=gtklib.DORANGE)   else:   hunk += gtklib.markup(line)   return hunk @@ -411,7 +411,7 @@
  diffcol.add_attribute(cell, 'markup', DM_DISP_TEXT)     # differentiate header chunks - cell.set_property('cell-background', '#DDDDDD') + cell.set_property('cell-background', gtklib.STATUS_HEADER)   diffcol.add_attribute(cell, 'cell_background_set', DM_IS_HEADER)   self.headerfont = self.difffont.copy()   self.headerfont.set_weight(pango.WEIGHT_HEAVY) @@ -420,8 +420,8 @@
  self.rejfont = self.difffont.copy()   self.rejfont.set_weight(pango.WEIGHT_LIGHT)   diffcol.add_attribute(cell, 'font-desc', DM_FONT) - cell.set_property('background', '#EEEEEE') - cell.set_property('foreground', '#888888') + cell.set_property('background', gtklib.STATUS_REJECT_BACKGROUND) + cell.set_property('foreground', gtklib.STATUS_REJECT_FOREGROUND)   diffcol.add_attribute(cell, 'background-set', DM_REJECTED)   diffcol.add_attribute(cell, 'foreground-set', DM_REJECTED)   difftree.append_column(diffcol) @@ -870,7 +870,8 @@
  sel = lambda x: x >= lasthunk or not dmodel[hc+x+1][DM_REJECTED]   newtext = chunks[0].selpretty(sel)   if not selected: - newtext = "<span foreground='#888888'>" + newtext + "</span>" + newtext = "<span foreground='" + gtklib.STATUS_REJECT_FOREGROUND + \ + "'>" + newtext + "</span>"   dmodel[hc][DM_DISP_TEXT] = newtext     def updated_codes(self): @@ -920,15 +921,15 @@
  elif stat == 'R':   text_renderer.set_property('foreground', gtklib.DRED)   elif stat == 'C': - text_renderer.set_property('foreground', 'black') + text_renderer.set_property('foreground', gtklib.NORMAL)   elif stat == '!': - text_renderer.set_property('foreground', 'red') + text_renderer.set_property('foreground', gtklib.RED)   elif stat == '?': - text_renderer.set_property('foreground', '#AA5000') + text_renderer.set_property('foreground', gtklib.DORANGE)   elif stat == 'I': - text_renderer.set_property('foreground', 'black') + text_renderer.set_property('foreground', gtklib.NORMAL)   else: - text_renderer.set_property('foreground', 'black') + text_renderer.set_property('foreground', gtklib.NORMAL)       def rename_file(self, wfile): @@ -1096,7 +1097,7 @@
  else:   buf.create_tag('removed', foreground=gtklib.DRED)   buf.create_tag('added', foreground=gtklib.DGREEN) - buf.create_tag('position', foreground='#FF8000') + buf.create_tag('position', foreground=gtklib.DORANGE)   buf.create_tag('header', foreground=gtklib.DBLUE)     bufiter = buf.get_start_iter()
 
79
80
81
 
 
82
83
84
 
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
 
79
80
81
82
83
84
85
86
 
159
160
161
 
 
 
162
163
164
165
 
 
 
166
167
168
@@ -79,6 +79,8 @@
  self.replacechk.connect('toggled',   lambda *a: self.update_sensitives())   self.engchk = gtk.CheckButton(_('Use English commit message')) + engmsg = self.repo.ui.configbool('tortoisehg', 'engmsg', False) + self.engchk.set_active(engmsg)   table.add_row(self.localchk)   table.add_row(self.replacechk)   table.add_row(self.engchk) @@ -157,16 +159,10 @@
  expanded = self.settings.get_value('expanded', False, True)   self.expander.set_property('expanded', expanded)   - checked = self.settings.get_value('english', False, True) - self.engchk.set_active(checked) -   def store_settings(self):   expanded = self.expander.get_property('expanded')   self.settings.set_value('expanded', expanded)   - checked = self.engchk.get_active() - self.settings.set_value('english', checked) -   self.settings.write()     def local_tag_toggled(self, checkbutton):
Show Entire File tortoisehg/​hgtk/​thgconfig.py Stacked
This file's diff was not loaded because this changeset is very large. Load changes
 
725
726
727
728
 
729
730
 
731
732
 
733
734
735
 
725
726
727
 
728
729
 
730
731
 
732
733
734
735
@@ -725,11 +725,11 @@
    stat = row[MQ_STATUS]   if stat == 'A': - cell.set_property('foreground', 'blue') + cell.set_property('foreground', gtklib.BLUE)   elif stat == 'U': - cell.set_property('foreground', '#909090') + cell.set_property('foreground', gtklib.GREY)   else: - cell.set_property('foreground', 'black') + cell.set_property('foreground', gtklib.NORMAL)     patchname = row[MQ_NAME]   if self.is_qtip(patchname):
Show Entire File tortoisehg/​hgtk/​thgpbranch.py Stacked
This file's diff was not loaded because this changeset is very large. Load changes
 
11
12
13
14
 
15
16
17
 
452
453
454
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
11
12
13
 
14
15
16
17
 
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
@@ -11,7 +11,7 @@
 import time  import inspect   -from mercurial import ui, util, extensions, match, bundlerepo, url +from mercurial import ui, util, extensions, match, bundlerepo, url, cmdutil  from mercurial import dispatch, encoding, templatefilters, filemerge    _encoding = encoding.encoding @@ -452,3 +452,17 @@
  return hasattr(cls.__dict__[attr], '__get__')   return None   +def export(repo, revs, template='hg-%h.patch', fp=None, switch_parent=False, + opts=None): + ''' + export changesets as hg patches. + + Mercurial moved patch.export to cmdutil.export after version 1.5 + (change e764f24a45ee in mercurial). + ''' + + try: + return cmdutil.export(repo, revs, template, fp, switch_parent, opts) + except AttributeError: + from mercurial import patch + return patch.export(repo, revs, template, fp, switch_parent, opts)