Kiln » TortoiseHg » TortoiseHg
Clone URL:  
Pushed to one repository · View In Graph Contained in 1.0, 1.0.1, and 1.0.2

Merge with stable

Changeset 3372580e0163

Parents 0d30a9d62bbb

Parents 01cfbbba74b0

by Steve Borho

Changes to 4 files · Browse files at 3372580e0163 Showing diff from parent 0d30a9d62bbb 01cfbbba74b0 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
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
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
 # hgemail.py - TortoiseHg's dialog for sending patches via email  #  # Copyright 2007 TK Soh <teekaysoh@gmail.com>  # Copyright 2007 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  import sys  import gobject  import gtk  import pango  import tempfile    from mercurial import hg, ui, extensions, error    from tortoisehg.util.i18n import _  from tortoisehg.util import hglib, settings    from tortoisehg.hgtk import gtklib, dialog, thgconfig, hgcmd    class EmailDialog(gtk.Window):   """ Send patches or bundles via email """   def __init__(self, root='', revargs=[]):   """ Initialize the Dialog """   gtk.Window.__init__(self, gtk.WINDOW_TOPLEVEL)     gtklib.set_tortoise_icon(self, 'hg.ico')   gtklib.set_tortoise_keys(self)   self.root = root   self.revargs = revargs     self.tbar = gtk.Toolbar()   self.tips = gtk.Tooltips()     tbuttons = [   self._toolbutton(gtk.STOCK_GOTO_LAST, _('Send'),   self._on_send_clicked,   _('Send emails')),   self._toolbutton(gtk.STOCK_FIND, _('Test'),   self._on_test_clicked,   _('Show emails which would be sent')),   gtk.SeparatorToolItem(),   self._toolbutton(gtk.STOCK_PREFERENCES, _('Configure'),   self._on_conf_clicked,   _('Configure email settings'))   ]   for btn in tbuttons:   self.tbar.insert(btn, -1)   mainvbox = gtk.VBox()   self.add(mainvbox)   mainvbox.pack_start(self.tbar, False, False, 2)     # set dialog title   if revargs[0] in ('--outgoing', '-o'):   self.set_title(_('Email outgoing changes'))   elif revargs[0] in ('--rev', '-r'):   self.set_title(_('Email revisions ') + ' '.join(revargs[1:]))   else:   self.set_title(_('Email Mercurial Patches'))   self.set_default_size(650, 450)     hbox = gtk.HBox()   envframe = gtk.Frame(_('Envelope'))   flagframe = gtk.Frame(_('Options'))   hbox.pack_start(envframe, True, True, 4)   hbox.pack_start(flagframe, False, False, 4)   mainvbox.pack_start(hbox, False, True, 4)     vbox = gtk.VBox()   envframe.add(vbox)     # To: combo box   hbox = gtk.HBox()   self._tolist = gtk.ListStore(str)   self._tobox = gtk.ComboBoxEntry(self._tolist, 0)   lbl = gtk.Label(_('To:'))   lbl.set_property('width-chars', 10)   lbl.set_alignment(1.0, 0.5)   hbox.pack_start(lbl, False, False, 4)   hbox.pack_start(self._tobox, True, True, 4)   vbox.pack_start(hbox, False, False, 4)     # Cc: combo box   hbox = gtk.HBox()   self._cclist = gtk.ListStore(str)   self._ccbox = gtk.ComboBoxEntry(self._cclist, 0)   lbl = gtk.Label(_('Cc:'))   lbl.set_property('width-chars', 10)   lbl.set_alignment(1.0, 0.5)   hbox.pack_start(lbl, False, False, 4)   hbox.pack_start(self._ccbox, True, True, 4)   vbox.pack_start(hbox, False, False, 4)     # From: combo box   hbox = gtk.HBox()   self._fromlist = gtk.ListStore(str)   self._frombox = gtk.ComboBoxEntry(self._fromlist, 0)   lbl = gtk.Label(_('From:'))   lbl.set_property('width-chars', 10)   lbl.set_alignment(1.0, 0.5)   hbox.pack_start(lbl, False, False, 4)   hbox.pack_start(self._frombox, True, True, 4)   vbox.pack_start(hbox, False, False, 4)     hbox = gtk.HBox()   self._replyto = gtk.Entry()   lbl = gtk.Label(_('In-Reply-To:'))   lbl.set_property('width-chars', 10)   lbl.set_alignment(1.0, 0.5)   hbox.pack_start(lbl, False, False, 4)   hbox.pack_start(self._replyto, True, True, 4)   vbox.pack_start(hbox, False, False, 4)   self.tips.set_tip(self._replyto,   _('Message identifier to reply to, for threading'))     vbox = gtk.VBox()   flagframe.add(vbox)     self.tooltips = gtk.Tooltips()   self._normal = gtk.RadioButton(None, _('Send changesets as HG patches'))   vbox.pack_start(self._normal, True, True, 4)   self.tooltips.set_tip(self._normal,   _('HG patches (as generated by export command) are compatible'   ' with most patch programs. They include a header which'   ' contains the most important changeset metadata.'))     self._git = gtk.RadioButton(self._normal,   _('Use extended (git) patch format'))   vbox.pack_start(self._git, True, True, 4)   self.tooltips.set_tip(self._git,   _('Git patches can describe binary files, copies, and'   ' permission changes, but recipients may not be able to'   ' use them if they are not using git or Mercurial.'))     self._plain = gtk.RadioButton(self._normal,   _('Plain, do not prepend HG header'))   vbox.pack_start(self._plain, True, True, 4)   self.tooltips.set_tip(self._plain,   _('Stripping Mercurial header removes username and parent'   ' information. Only useful if recipient is not using'   ' Mercurial (and does not like to see the headers).'))     self._bundle = gtk.RadioButton(self._normal,   _('Send single binary bundle, not patches'))   vbox.pack_start(self._bundle, True, True, 4)   if revargs[0] in ('--outgoing', '-o'):   self.tooltips.set_tip(self._bundle,   _('Bundles store complete changesets in binary form.'   ' Upstream users can pull from them. This is the safest'   ' way to send changes to recipient Mercurial users.'))   else:   self._bundle.set_sensitive(False)   self.tooltips.set_tip(self._bundle,   _('This feature is only available when sending outgoing'   ' changesets. It is not applicable with revision ranges.'))     hbox = gtk.HBox()   vbox.pack_start(hbox, False, False, 2)     self._attach = gtk.CheckButton(_('attach'))   self.tooltips.set_tip(self._attach,   _('send patches as attachments'))   self._inline = gtk.CheckButton(_('inline'))   self.tooltips.set_tip(self._inline,   _('send patches as inline attachments'))   self._diffstat = gtk.CheckButton(_('diffstat'))   self.tooltips.set_tip(self._diffstat,   _('add diffstat output to messages'))   hbox.pack_start(self._attach, True, True, 2)   hbox.pack_start(self._inline, True, True, 2)   hbox.pack_start(self._diffstat, True, True, 2)     vbox = gtk.VBox()   hbox = gtk.HBox()   self._subjlist = gtk.ListStore(str)   self._subjbox = gtk.ComboBoxEntry(self._subjlist, 0)   hbox.pack_start(gtk.Label(_('Subject:')), False, False, 4)   hbox.pack_start(self._subjbox, True, True, 4)   - extensions.load(ui.ui(), 'patchbomb', None) + hglib.loadextension(ui.ui(), 'patchbomb')     # --flags was added after hg 1.3   hasflags = False   for arg in extensions.find('patchbomb').emailopts:   if arg[1] == 'flag':   hasflags = True   break   self._flaglist = gtk.ListStore(str)   self._flagbox = gtk.ComboBoxEntry(self._flaglist, 0)   if hasflags:   hbox.pack_start(gtk.Label(_('Flags:')), False, False, 4)   hbox.pack_start(self._flagbox, False, False, 4)   vbox.pack_start(hbox, False, False, 4)     self.descview = gtk.TextView(buffer=None)   self.descview.set_editable(True)   self.descview.modify_font(pango.FontDescription('Monospace'))   self.descbuffer = self.descview.get_buffer()   scrolledwindow = gtk.ScrolledWindow()   scrolledwindow.set_shadow_type(gtk.SHADOW_ETCHED_IN)   scrolledwindow.set_policy(gtk.POLICY_AUTOMATIC, gtk.POLICY_AUTOMATIC)   scrolledwindow.add(self.descview)   frame = gtk.Frame(_('Patch Series (Bundle) Description'))   frame.set_border_width(4)   vbox.pack_start(scrolledwindow, True, True, 4)   vbox.set_border_width(4)   eventbox = gtk.EventBox()   eventbox.add(vbox)   frame.add(eventbox)   self._eventbox = eventbox   mainvbox.pack_start(frame, True, True, 4)   gtklib.idle_add_single_call(self._refresh, True)     def _toolbutton(self, stock, label, handler, tip):   tbutton = gtk.ToolButton(stock)   tbutton.set_label(label)   tbutton.set_tooltip(self.tips, tip)   tbutton.connect('clicked', handler)   return tbutton     def _refresh(self, initial):   def fill_history(history, vlist, cpath):   vlist.clear()   if cpath not in history.get_keys():   return   for v in history.get_value(cpath):   vlist.append([v])     history = settings.Settings('email')   try:   repo = hg.repository(ui.ui(), path=self.root)   self.repo = repo   except error.RepoError:   self.repo = None   return     if initial:   # Only zap these fields at startup   self._tobox.child.set_text(hglib.fromutf(repo.ui.config('email', 'to', '')))   self._ccbox.child.set_text(hglib.fromutf(repo.ui.config('email', 'cc', '')))   self._frombox.child.set_text(hglib.fromutf(repo.ui.config('email', 'from', '')))   self._subjbox.child.set_text(hglib.fromutf(repo.ui.config('email', 'subject', '')))   self.tooltips.set_tip(self._eventbox,   _('Patch series description is sent in initial summary'   ' email with [PATCH 0 of N] subject. It should describe'   ' the effects of the entire patch series. When emailing'   ' a bundle, these fields make up the message subject and'   ' body. Flags is a comma separated list of tags'   ' which are inserted into the message subject prefix.')   )   gtklib.addspellcheck(self.descview, self.repo.ui)   fill_history(history, self._tolist, 'email.to')   fill_history(history, self._cclist, 'email.cc')   fill_history(history, self._fromlist, 'email.from')   fill_history(history, self._subjlist, 'email.subject')   fill_history(history, self._flaglist, 'email.flags')   if len(self._flaglist) == 0:   self._flaglist.append(['STABLE'])     def _on_conf_clicked(self, button):   dlg = thgconfig.ConfigDialog(False)   dlg.show_all()   dlg.focus_field('email.from')   dlg.run()   dlg.hide()   self._refresh(False)     def _on_send_clicked(self, button):   self.send()     def _on_test_clicked(self, button):   self.send(True)     def send(self, test = False):   def record_new_value(cpath, history, newvalue):   if not newvalue: return   if cpath not in history.get_keys():   history.set_value(cpath, [])   elif newvalue in history.get_value(cpath):   history.get_value(cpath).remove(newvalue)   history.get_value(cpath).insert(0, newvalue)     totext = hglib.fromutf(self._tobox.child.get_text())   cctext = hglib.fromutf(self._ccbox.child.get_text())   fromtext = hglib.fromutf(self._frombox.child.get_text())   subjtext = hglib.fromutf(self._subjbox.child.get_text())   flagtext = hglib.fromutf(self._flagbox.child.get_text())   inreplyto = hglib.fromutf(self._replyto.get_text())     if not totext:   dialog.info_dialog(self, _('Info required'),   _('You must specify a recipient'))   self._tobox.grab_focus()   return   if not fromtext:   dialog.info_dialog(self, _('Info required'),   _('You must specify a sender address'))   self._frombox.grab_focus()   return   if not self.repo:   return     if self.repo.ui.config('email', 'method', 'smtp') == 'smtp' and not test:   if not self.repo.ui.config('smtp', 'host'):   dialog.info_dialog(self, _('Info required'),   _('You must configure SMTP'))   dlg = thgconfig.ConfigDialog(False)   dlg.show_all()   dlg.focus_field('smtp.host')   dlg.run()   dlg.hide()   self._refresh(False)   return     if not test:   history = settings.Settings('email')   record_new_value('email.to', history, totext)   record_new_value('email.cc', history, cctext)   record_new_value('email.from', history, fromtext)   record_new_value('email.subject', history, subjtext)   record_new_value('email.flags', history, flagtext)   history.write()     cmdline = ['hg', 'email', '-f', fromtext, '-t', totext, '-c', cctext]   oldpager = os.environ.get('PAGER')   if test:   if oldpager:   del os.environ['PAGER']   cmdline.insert(2, '--test')   if flagtext:   flags = [f.strip() for f in flagtext.split(',') if f.strip()]   for f in flags:   cmdline += ['--flag', f]   if subjtext:   cmdline += ['--subject', subjtext]   if self._bundle.get_active():   cmdline += ['--bundle']   if '--outgoing' in self.revargs:   self.revargs.remove('--outgoing')   elif self._plain.get_active(): cmdline += ['--plain']   elif self._git.get_active(): cmdline += ['--git']   if self._inline.get_active(): cmdline += ['--inline']   if self._attach.get_active(): cmdline += ['--attach']   if self._diffstat.get_active(): cmdline += ['--diffstat']   if inreplyto:   cmdline += ['--in-reply-to', inreplyto]   start = self.descbuffer.get_start_iter()   end = self.descbuffer.get_end_iter()   desc = self.descbuffer.get_text(start, end)   if desc:   cmdline += ['--intro']   tmpfile = None   try:   fd, tmpfile = tempfile.mkstemp(prefix="thg_emaildesc_")   os.write(fd, desc)   os.close(fd)   cmdline += ['--desc', tmpfile]   cmdline.extend(self.revargs)     dlg = hgcmd.CmdDialog(cmdline)   dlg.show_all()   dlg.run()   dlg.hide()   finally:   if oldpager:   os.environ['PAGER'] = oldpager   if tmpfile:   os.unlink(tmpfile)
 
139
140
141
142
143
144
145
146
147
 
1247
1248
1249
1250
 
1251
1252
1253
 
1255
1256
1257
1258
 
1259
1260
1261
 
1419
1420
1421
1422
 
1423
1424
1425
 
1427
1428
1429
1430
 
1431
1432
1433
 
139
140
141
 
 
 
142
143
144
 
1244
1245
1246
 
1247
1248
1249
1250
 
1252
1253
1254
 
1255
1256
1257
1258
 
1416
1417
1418
 
1419
1420
1421
1422
 
1424
1425
1426
 
1427
1428
1429
1430
@@ -139,9 +139,6 @@
  self.bundle_autoreject = False   self.runner = hgcmd.CmdRunner()   os.chdir(self.repo.root) - - # Load extension support for commands which need it - extensions.loadall(self.ui)   self.exs = [ name for name, module in extensions.extensions() ]     def get_help_url(self): @@ -1247,7 +1244,7 @@
  if ppull == 'fetch':   cmd = ['fetch', '--message', 'merge']   # load the fetch extension explicitly - extensions.load(self.ui, 'fetch', None) + hglib.loadextension(self.ui, 'fetch')   else:   cmd = ['pull']   if ppull == 'update': @@ -1255,7 +1252,7 @@
  elif ppull == 'rebase':   cmd.append('--rebase')   # load the rebase extension explicitly - extensions.load(self.ui, 'rebase', None) + hglib.loadextension(self.ui, 'rebase')     cmdline = ['hg'] + cmd + [self.bfile]   dlg = hgcmd.CmdDialog(cmdline) @@ -1419,7 +1416,7 @@
  if ppull == 'fetch':   cmd = ['fetch', '--message', 'merge']   # load the fetch extension explicitly - extensions.load(self.ui, 'fetch', None) + hglib.loadextension(self.ui, 'fetch')   else:   cmd = ['pull']   if ppull == 'update': @@ -1427,7 +1424,7 @@
  elif ppull == 'rebase':   cmd.append('--rebase')   # load the rebase extension explicitly - extensions.load(self.ui, 'rebase', None) + hglib.loadextension(self.ui, 'rebase')     path = hglib.fromutf(self.pathentry.get_text()).strip()   remote_path = hglib.validate_synch_path(path, self.repo)
 
147
148
149
150
151
152
153
 
445
446
447
448
 
449
450
451
 
455
456
457
458
 
459
460
461
 
147
148
149
 
150
151
152
 
444
445
446
 
447
448
449
450
 
454
455
456
 
457
458
459
460
@@ -147,7 +147,6 @@
  elif defrow is not None:   self.pathbox.set_active(defrow)   - extensions.loadall(self.ui)   exs = [ name for name, module in extensions.extensions() ]     # Post Pull Operation @@ -445,7 +444,7 @@
  if ppull == 'fetch':   cmd = ['fetch', '--message', 'merge']   # load the fetch extension explicitly - extensions.load(self.ui, 'fetch', None) + hglib.loadextension(self.ui, 'fetch')   else:   cmd = ['pull']   cmd += aopts.get('force', []) @@ -455,7 +454,7 @@
  elif ppull == 'rebase':   cmd.append('--rebase')   # load the rebase extension explicitly - extensions.load(self.ui, 'rebase', None) + hglib.loadextension(self.ui, 'rebase')   cmd += aopts.get('rev', [])   self.exec_cmd(cmd)  
 
125
126
127
 
 
 
 
 
 
 
 
 
 
128
129
130
 
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
@@ -125,6 +125,16 @@
  if 'mq' in repo.__dict__: #do not create if it does not exist   repo.mq.invalidate()   +def loadextension(ui, name): + # Between Mercurial revisions 1.2 and 1.3, extensions.load() stopped + # calling uisetup() after loading an extension. This could do + # unexpected things if you use an hg version < 1.3 + extensions.load(ui, name, None) + mod = extensions.find(name) + uisetup = getattr(mod, 'uisetup', None) + if uisetup: + uisetup(ui) +  def canonpaths(list):   'Get canonical paths (relative to root) for list of files'   # This is a horrible hack. Please remove this when HG acquires a