Kiln » TortoiseHg » TortoiseHg
Clone URL:  
Pushed to one repository · View In Graph Contained in 0.9, 0.9.1, and 0.9.1.1

use gtklib.idle_add_single_call

Changeset 33a1a07adece

Parent ea119f5700cb

by Adrian Buehlmann

Changes to 17 files · Browse files at 33a1a07adece Showing diff from parent ea119f5700cb Diff from another changeset...

 
40
41
42
43
 
44
45
46
 
100
101
102
103
 
104
105
106
 
40
41
42
 
43
44
45
46
 
100
101
102
 
103
104
105
106
@@ -40,7 +40,7 @@
  try:   repo = hg.repository(ui.ui(), path=paths.find_root())   except hglib.RepoError: - gobject.idle_add(self.destroy) + gtklib.idle_add_single_call(self.destroy)   return   self.repo = repo   self.set_title(_('Archive - %s') % hglib.get_reponame(repo)) @@ -100,7 +100,7 @@
  # prepare to show   self.update_path(hglib.toutf(repo.root))   self.archivebtn.grab_focus() - gobject.idle_add(self.after_init) + gtklib.idle_add_single_call(self.after_init)     def after_init(self):   # CmdWidget
 
44
45
46
47
 
48
49
50
 
103
104
105
106
 
107
108
109
 
44
45
46
 
47
48
49
50
 
103
104
105
 
106
107
108
109
@@ -44,7 +44,7 @@
  try:   repo = hg.repository(ui.ui(), path=paths.find_root())   except hglib.RepoError: - gobject.idle_add(self.destroy) + gtklib.idle_add_single_call(self.destroy)   return     # message @@ -103,7 +103,7 @@
  # prepare to show   self.load_settings()   self.backoutbtn.grab_focus() - gobject.idle_add(self.after_init) + gtklib.idle_add_single_call(self.after_init)     def after_init(self):   # CmdWidget
 
152
153
154
155
 
156
157
158
 
152
153
154
 
155
156
157
158
@@ -152,7 +152,7 @@
  # prepare to show   self.load_settings()   destcombo.grab_focus() - gobject.idle_add(self.after_init) + gtklib.idle_add_single_call(self.after_init)     def after_init(self):   #CmdWidget
 
388
389
390
391
 
392
393
394
 
388
389
390
 
391
392
393
394
@@ -388,7 +388,7 @@
  self.vpaned = gtk.VPaned()   self.vpaned.pack1(vbox, shrink=False)   self.vpaned.pack2(vbox2, shrink=False) - gobject.idle_add(self.realize_settings) + gtklib.idle_add_single_call(self.realize_settings)   return self.vpaned     def get_preview_tab_name(self):
 
45
46
47
48
 
49
50
51
 
217
218
219
220
 
221
222
223
 
45
46
47
 
48
49
50
51
 
217
218
219
 
220
221
222
223
@@ -45,7 +45,7 @@
  try:   repo = hg.repository(ui.ui(), path=paths.find_root())   except hglib.RepoError: - gobject.idle_add(self.destroy) + gtklib.idle_add_single_call(self.destroy)   return   self.repo = repo   self.notify_func = None @@ -217,7 +217,7 @@
  self.cantree.connect('row-activated', lambda b: self.accept_match())   self.cantree.get_selection().connect('changed', self.show_diff)   self.connect('delete-event', lambda *a: self.save_settings()) - gobject.idle_add(self.refresh) + gtklib.idle_add_single_call(self.refresh)     def set_notify_func(self, func):   self.notify_func = func
 
319
320
321
322
 
323
324
325
 
520
521
522
523
 
524
525
526
 
319
320
321
 
322
323
324
325
 
520
521
522
 
523
524
525
526
@@ -319,7 +319,7 @@
  self.show_log(False)   if self.is_compact:   self.set_pbar(False) - gobject.idle_add(after_init) + gtklib.idle_add_single_call(after_init)     ### public functions ###   @@ -520,7 +520,7 @@
  def call_callback():   callback(returncode, self.useraborted, *args, **kargs)   self.useraborted = False - gobject.idle_add(call_callback) + gtklib.idle_add_single_call(call_callback)   return False # Stop polling this function   else:   return True # Continue polling
 
209
210
211
212
 
213
214
215
 
209
210
211
 
212
213
214
215
@@ -209,7 +209,7 @@
  frame.add(eventbox)   self._eventbox = eventbox   mainvbox.pack_start(frame, True, True, 4) - gobject.idle_add(self._refresh, True) + gtklib.idle_add_single_call(self._refresh, True)     def _toolbutton(self, stock, label, handler, tip):   tbutton = gtk.ToolButton(stock)
 
29
30
31
32
 
33
34
35
 
146
147
148
149
 
150
151
152
 
29
30
31
 
32
33
34
35
 
146
147
148
 
149
150
151
152
@@ -29,7 +29,7 @@
  try:   repo = hg.repository(ui.ui(), path=paths.find_root())   except hglib.RepoError: - gobject.idle_add(self.destroy) + gtklib.idle_add_single_call(self.destroy)   return   self.repo = repo   self.set_title(_('Ignore filter - %s') % hglib.get_reponame(repo)) @@ -146,7 +146,7 @@
    # prepare to show   self.glob_entry.grab_focus() - gobject.idle_add(self.refresh) + gtklib.idle_add_single_call(self.refresh)     def file_selected(self, combo):   'select another ignore file'
 
969
970
971
972
 
973
974
975
 
969
970
971
 
972
973
974
975
@@ -969,7 +969,7 @@
  self.vpaned = gtk.VPaned()   self.vpaned.pack1(midpane, True, False)   self.vpaned.pack2(self.hpaned) - gobject.idle_add(self.realize_settings) + gtklib.idle_add_single_call(self.realize_settings)     vbox = gtk.VBox()   vbox.pack_start(self.vpaned, True, True)
 
39
40
41
42
 
43
44
45
46
47
48
 
49
50
51
 
94
95
96
97
 
98
99
100
 
39
40
41
 
42
43
44
45
46
47
 
48
49
50
51
 
94
95
96
 
97
98
99
100
@@ -39,13 +39,13 @@
  if not rev:   gdialog.Prompt(_('Unable to merge'),   _('Must supply a target revision'), self).run() - gobject.idle_add(self.destroy) + gtklib.idle_add_single_call(self.destroy)   return     try:   repo = hg.repository(ui.ui(), path=paths.find_root())   except hglib.RepoError: - gobject.idle_add(self.destroy) + gtklib.idle_add_single_call(self.destroy)   return   self.set_title(_('Merging in %s') % hglib.get_reponame(repo))   @@ -94,7 +94,7 @@
  self.mergebtn.grab_focus()   self.commitbtn.set_sensitive(False)   self.undobtn.set_sensitive(False) - gobject.idle_add(self.after_init) + gtklib.idle_add_single_call(self.after_init)     def after_init(self):   # CmdWidget
 
35
36
37
38
 
39
40
41
 
157
158
159
160
 
161
162
163
164
165
166
 
167
168
169
 
244
245
246
247
 
248
249
250
 
35
36
37
 
38
39
40
41
 
157
158
159
 
160
161
162
163
164
165
 
166
167
168
169
 
244
245
246
 
247
248
249
250
@@ -35,7 +35,7 @@
  try:   repo = hg.repository(ui.ui(), path=paths.find_root())   except hglib.RepoError: - gobject.idle_add(self.destroy) + gtklib.idle_add_single_call(self.destroy)   return     # Handle rm alias @@ -157,13 +157,13 @@
  if not len(fm):   gdialog.Prompt(_('No appropriate files'),   _('No files found for this operation'), self).run() - gobject.idle_add(self.destroy) + gtklib.idle_add_single_call(self.destroy)   self.hide()   return     # prepare to show   self.gobutton.grab_focus() - gobject.idle_add(self.after_init) + gtklib.idle_add_single_call(self.after_init)     def after_init(self):   # CmdWidget @@ -244,7 +244,7 @@
  pass     if not list: - gobject.idle_add(self.response, gtk.RESPONSE_CLOSE) + gtklib.idle_add_single_call(self.response, gtk.RESPONSE_CLOSE)   return     cmdline = ['hg', self.command, '--verbose'] + list
 
33
34
35
36
 
37
38
39
 
33
34
35
 
36
37
38
39
@@ -33,7 +33,7 @@
  try:   repo = hg.repository(ui.ui(), path=paths.find_root())   except hglib.RepoError: - gobject.idle_add(self.destroy) + gtklib.idle_add_single_call(self.destroy)   return   self.repo = repo   self.reponame = hglib.get_reponame(repo)
 
467
468
469
470
 
471
472
473
 
467
468
469
 
470
471
472
473
@@ -467,7 +467,7 @@
  def prepare_display(self):   val = self.repo.ui.config('tortoisehg', 'ciexclude', '')   self.excludes = [i.strip() for i in val.split(',') if i.strip()] - gobject.idle_add(self.realize_status_settings) + gtklib.idle_add_single_call(self.realize_status_settings)     def refresh_complete(self):   pass
 
261
262
263
264
 
265
266
267
 
313
314
315
316
 
317
318
319
 
261
262
263
 
264
265
266
267
 
313
314
315
 
316
317
318
319
@@ -261,7 +261,7 @@
  # prepare to show   self.load_settings()   self.update_pull_setting() - gobject.idle_add(self.finalize_startup) + gtklib.idle_add_single_call(self.finalize_startup)     def create_bottombox(self):   self.buttonhbox = gtk.HBox() @@ -313,7 +313,7 @@
  def _drag_receive(self, widget, context, x, y, selection, targetType, time):   if time != self.last_drop_time:   files = selection.get_uris() - gobject.idle_add(self._set_path, files[0]) + gtklib.idle_add_single_call(self._set_path, files[0])   self.last_drop_time = time     def _set_path(self, uri):
 
121
122
123
124
 
125
126
127
 
651
652
653
654
 
655
656
657
 
121
122
123
 
124
125
126
127
 
651
652
653
 
654
655
656
657
@@ -121,7 +121,7 @@
  self.btn['menu'] = menubtn   def after_init():   menubtn.child.get_children()[0].hide() - gobject.idle_add(after_init) + gtklib.idle_add_single_call(after_init)   self.pack_start(tbar, False, False)     # center pane @@ -651,7 +651,7 @@
  def unselect():   selection = list.get_selection()   selection.unselect_all() - gobject.idle_add(unselect) + gtklib.idle_add_single_call(unselect)   elif event.button == 3:   if pathinfo:   self.show_patch_cmenu(self.list, pathinfo[0])
 
36
37
38
39
 
40
41
42
 
96
97
98
99
 
100
101
102
 
36
37
38
 
39
40
41
42
 
96
97
98
 
99
100
101
102
@@ -36,7 +36,7 @@
  try:   repo = hg.repository(ui.ui(), path=paths.find_root())   except hglib.RepoError: - gobject.idle_add(self.destroy) + gtklib.idle_add_single_call(self.destroy)   return   self.repo = repo   self.set_title(_('Update - %s') % hglib.get_reponame(repo)) @@ -96,7 +96,7 @@
    # prepare to show   self.updatebtn.grab_focus() - gobject.idle_add(self.after_init) + gtklib.idle_add_single_call(self.after_init)     def after_init(self):   # CmdWidget
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
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
 # visdiff.py - launch external visual diff tools  #  # Copyright 2009 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 gtk  import gobject  import os  import shlex  import subprocess  import shutil  import tempfile    from mercurial import hg, ui, cmdutil, util    from tortoisehg.util.i18n import _  from tortoisehg.util import hglib, settings, paths    from tortoisehg.hgtk import gdialog, gtklib    try:   import win32con   openflags = win32con.CREATE_NO_WINDOW  except ImportError:   openflags = 0    def snapshot_node(repo, files, node, tmproot):   '''snapshot files as of some revision'''   dirname = os.path.basename(repo.root)   if dirname == "":   dirname = "root"   dirname = '%s.%s' % (dirname, str(repo[node]))   base = os.path.join(tmproot, dirname)   os.mkdir(base)   ctx = repo[node]   for fn in files:   wfn = util.pconvert(fn)   if not wfn in ctx:   # skipping new file after a merge ?   continue   dest = os.path.join(base, wfn)   destdir = os.path.dirname(dest)   if not os.path.isdir(destdir):   os.makedirs(destdir)   data = repo.wwritedata(wfn, ctx[wfn].data())   open(dest, 'wb').write(data)   return dirname    class FileSelectionDialog(gtk.Dialog):   'Dialog for selecting visual diff candidates'   def __init__(self, canonpats, opts):   'Initialize the Dialog'   gtk.Dialog.__init__(self, title=_('Visual Diffs'))   gtklib.set_tortoise_icon(self, 'menushowchanged.ico')   gtklib.set_tortoise_keys(self)     self.set_default_size(400, 150)   self.set_has_separator(False)     lbl = gtk.Label(_('Temporary files are removed when this dialog'   ' is closed'))   self.vbox.pack_start(lbl, False, False, 2)     scroller = gtk.ScrolledWindow()   scroller.set_shadow_type(gtk.SHADOW_IN)   scroller.set_policy(gtk.POLICY_AUTOMATIC, gtk.POLICY_AUTOMATIC)   model = gtk.ListStore(str, str)   treeview = gtk.TreeView(model)   treeview.get_selection().set_mode(gtk.SELECTION_SINGLE)   treeview.set_search_equal_func(self.search_filelist)   scroller.add(treeview)   self.vbox.pack_start(scroller, True, True, 2)     hbox = gtk.HBox()   self.vbox.pack_start(hbox, False, False, 2)   vsettings = settings.Settings('visdiff')   single = vsettings.get_value('launchsingle', False)   check = gtk.CheckButton(_('Always launch single files'))   check.set_active(single)   hbox.pack_start(check, True, True, 2)   self.singlecheck = check     treeview.connect('row-activated', self.rowactivated)   treeview.set_headers_visible(False)   treeview.set_property('enable-grid-lines', True)   treeview.set_enable_search(False)     cell = gtk.CellRendererText()   stcol = gtk.TreeViewColumn('Status', cell)   stcol.set_resizable(True)   stcol.add_attribute(cell, 'text', 0)   treeview.append_column(stcol)     cell = gtk.CellRendererText()   fcol = gtk.TreeViewColumn('Filename', cell)   fcol.set_resizable(True)   fcol.add_attribute(cell, 'text', 1)   treeview.append_column(fcol)     try:   path = opts.get('bundle') or paths.find_root()   repo = hg.repository(ui.ui(), path=path)   except hglib.RepoError:   # hgtk should catch this earlier   gdialog.Prompt(_('No repository'),   _('No repository found here'), None).run()   return     tools = readtools(repo.ui)   preferred = repo.ui.config('tortoisehg', 'vdiff', 'vdiff')   if preferred and preferred in tools:   if len(tools) > 1:   lbl = gtk.Label(_('Select diff tool'))   combo = gtk.combo_box_new_text()   for i, name in enumerate(tools.iterkeys()):   combo.append_text(name)   if name == preferred:   defrow = i   combo.connect('changed', self.toolselect, tools)   combo.set_active(defrow)   hbox.pack_start(lbl, False, False, 2)   hbox.pack_start(combo, False, False, 2)   else:   self.diffpath, self.diffopts = tools[preferred]   cwd = os.getcwd()   try:   os.chdir(repo.root)   self.find_files(repo, canonpats, opts, model)   finally:   os.chdir(cwd)   else:   gdialog.Prompt(_('No visual diff tool'),   _('No visual diff tool has been configured'), None).run()   from tortoisehg.hgtk import thgconfig   dlg = thgconfig.ConfigDialog(False)   dlg.show_all()   dlg.focus_field('tortoisehg.vdiff')   dlg.run()   dlg.hide() - gobject.idle_add(self.destroy) + gtklib.idle_add_single_call(self.destroy)     def search_filelist(self, model, column, key, iter):   'case insensitive filename search'   key = key.lower()   if key in model.get_value(iter, 1).lower():   return False   return True     def toolselect(self, combo, tools):   sel = combo.get_active_text()   if sel in tools:   self.diffpath, self.diffopts = tools[sel]     def find_files(self, repo, pats, opts, model):   revs = opts.get('rev')   change = opts.get('change')     if change:   title = _('changeset ') + str(change)   node2 = repo.lookup(change)   node1 = repo[node2].parents()[0].node()   else:   if revs:   title = _('revisions ') + ' to '.join(revs)   else:   title = _('working changes')   node1, node2 = cmdutil.revpair(repo, revs)     title = _('Visual Diffs - ') + title   if pats:   title += ' filtered'   self.set_title(title)     matcher = cmdutil.match(repo, pats, opts)   modified, added, removed = repo.status(node1, node2, matcher)[:3]   if not (modified or added or removed):   gdialog.Prompt(_('No file changes'),   _('There are no file changes to view'), self).run()   # GTK+ locks up if this is done immediately here - gobject.idle_add(self.destroy) + gtklib.idle_add_single_call(self.destroy)   return     tmproot = tempfile.mkdtemp(prefix='extdiff.')   self.connect('destroy', self.delete_tmproot, tmproot)   dir2 = ''   dir2root = ''   # Always make a copy of node1   dir1 = snapshot_node(repo, modified + removed, node1, tmproot)     # If node2 in not the wc or there is >1 change, copy it   if node2:   dir2 = snapshot_node(repo, modified + added, node2, tmproot)   else:   # This lets the diff tool open the changed file directly   dir2root = repo.root     self.dirs = (dir1, dir2, dir2root, tmproot)     for m in modified:   model.append(['M', hglib.toutf(m)])   for a in added:   model.append(['A', hglib.toutf(a)])   for r in removed:   model.append(['R', hglib.toutf(r)])   if len(model) == 1 and self.singlecheck.get_active():   self.launch(*model[0])     def delete_tmproot(self, window, tmproot):   vsettings = settings.Settings('visdiff')   vsettings.set_value('launchsingle', self.singlecheck.get_active())   vsettings.write()   while True:   try:   shutil.rmtree(tmproot)   return   except (IOError, OSError), e:   resp = gdialog.CustomPrompt(_('Unable to delete temp files'),   _('Close diff tools and try again, or quit to leak files?'),   self, (_('Try &Again'), _('&Quit')), 1).run()   if resp == 0:   continue   else:   return     def rowactivated(self, tree, path, column):   selection = tree.get_selection()   if selection.count_selected_rows() != 1:   return False   model, paths = selection.get_selected_rows()   self.launch(*model[paths[0]])     def launch(self, st, fname):   fname = hglib.fromutf(fname)   dir1, dir2, dir2root, tmproot = self.dirs   if st == 'A':   dir1 = os.devnull   dir2 = os.path.join(dir2root, dir2, util.localpath(fname))   elif st == 'R':   dir1 = os.path.join(dir1, util.localpath(fname))   dir2 = os.devnull   else:   dir1 = os.path.join(dir1, util.localpath(fname))   dir2 = os.path.join(dir2root, dir2, util.localpath(fname))   if os.name == 'nt':   cmdline = ('%s %s %s %s' %   (util.shellquote(self.diffpath), ' '.join(self.diffopts),   util.shellquote(dir1), util.shellquote(dir2)))   else:   cmdline = [self.diffpath] + self.diffopts + [dir1, dir2]   try:   subprocess.Popen(cmdline, shell=False, cwd=tmproot,   creationflags=openflags,   stderr=subprocess.PIPE,   stdout=subprocess.PIPE,   stdin=subprocess.PIPE)   except (OSError, EnvironmentError), e:   gdialog.Prompt(_('Tool launch failure'),   _('%s : %s') % (self.diffpath, str(e)), None).run()    def readtools(ui):   tools = {}   for cmd, path in ui.configitems('extdiff'):   if cmd.startswith('cmd.'):   cmd = cmd[4:]   if not path:   path = cmd   diffopts = ui.config('extdiff', 'opts.' + cmd, '')   diffopts = diffopts and [diffopts] or []   tools[cmd] = [path, diffopts]   elif cmd.startswith('opts.'):   continue   else:   # command = path opts   if path:   diffopts = shlex.split(path)   path = diffopts.pop(0)   else:   path, diffopts = cmd, []   tools[cmd] = [path, diffopts]   return tools    def rawextdiff(ui, *pats, **opts):   'launch raw extdiff command, block until finish'   from hgext import extdiff   try:   path = opts.get('bundle') or paths.find_root()   repo = hg.repository(ui, path=path)   except hglib.RepoError:   # hgtk should catch this earlier   ui.warn(_('No repository found here') + '\n')   return   tools = readtools(ui)   preferred = ui.config('tortoisehg', 'vdiff', 'vdiff')   try:   diffcmd, diffopts = tools[preferred]   except KeyError:   ui.warn(_('Extdiff command not recognized\n'))   return   pats = hglib.canonpaths(pats)   try:   ret = extdiff.dodiff(ui, repo, diffcmd, diffopts, pats, opts)   except OSError, e:   ui.warn(str(e) + '\n')   return   if ret == 0:   gdialog.Prompt(_('No file changes'),   _('There are no file changes to view'), None).run()    def run(ui, *pats, **opts):   if ui.configbool('tortoisehg', 'vdiffnowin'):   import sys   # Spawn background process and exit   if hasattr(sys, "frozen"):   args = [sys.argv[0]]   else:   args = [sys.executable] + [sys.argv[0]]   args.extend(['vdiff', '--nofork', '--raw'])   revs = opts.get('rev', [])   change = opts.get('change')   if change:   args.extend(['--change', str(change)])   for r in revs:   args.extend(['--rev', str(r)])   bfile = opts.get('bundle')   if bfile:   args.extend(['--bundle', bfile])   args.extend(pats)   args.extend(opts.get('canonpats', []))   if os.name == 'nt':   args = ['"%s"' % arg for arg in args]   oldcwd = os.getcwd()   root = paths.find_root(oldcwd)   try:   os.chdir(root)   os.spawnv(os.P_NOWAIT, sys.executable, args)   finally:   os.chdir(oldcwd)   return None   else:   pats = hglib.canonpaths(pats)   if opts.get('canonpats'):   pats = list(pats) + opts['canonpats']   return FileSelectionDialog(pats, opts)