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

merge with stable

Changeset 5d96c93923ff

Parents 4d1d90deccb2

Parents d8d38b17809a

by Steve Borho

Changes to 3 files · Browse files at 5d96c93923ff Showing diff from parent 4d1d90deccb2 d8d38b17809a Diff from another changeset...

Change 1 of 1 Show Entire File hggtk/​clone.py Stacked
 
267
268
269
270
 
271
272
273
274
275
276
 
277
278
 
279
280
281
 
267
268
269
 
270
271
272
273
274
275
 
276
277
 
278
279
280
281
@@ -267,15 +267,15 @@
  cmdline += ['--config', 'http_proxy.host=']   if remotecmd:   cmdline.append('--remotecmd') - cmdline.append(remotecmd) + cmdline.append(hglib.fromutf(remotecmd))   if rev:   cmdline.append('--rev')   cmdline.append(rev)     cmdline.append('--verbose') - cmdline.append(src) + cmdline.append(hglib.fromutf(src))   if dest: - cmdline.append(dest) + cmdline.append(hglib.fromutf(dest))     dlg = hgcmd.CmdDialog(cmdline)   dlg.run()
Change 1 of 9 Show Entire File hggtk/​hgtk.py Stacked
 
46
47
48
 
 
49
50
51
 
61
62
63
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
64
65
66
 
245
246
247
 
248
249
250
 
258
259
260
 
261
262
263
 
269
270
271
 
272
273
274
275
276
 
277
278
279
280
281
282
 
283
284
285
 
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
 
361
362
363
 
364
365
366
367
368
 
369
370
371
 
402
403
404
405
 
 
 
 
 
 
 
 
406
407
408
 
462
463
464
465
466
467
468
469
470
471
 
 
 
 
 
472
473
474
475
476
477
478
 
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
 
508
509
510
 
46
47
48
49
50
51
52
53
 
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
 
263
264
265
266
267
268
269
 
277
278
279
280
281
282
283
 
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
 
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
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
 
397
398
399
400
401
402
403
404
405
406
407
408
409
 
440
441
442
 
443
444
445
446
447
448
449
450
451
452
453
 
507
508
509
 
 
 
 
 
 
 
510
511
512
513
514
515
516
517
 
518
519
 
520
521
522
523
524
525
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
526
527
 
528
529
530
531
@@ -46,6 +46,8 @@
  if '--debugger' in args:   pdb.set_trace()   return _runcatch(u, args) + except SystemExit: + pass   except:   from hggtk.bugreport import run   if '--debugger' in args: @@ -61,6 +63,22 @@
  else:   gtkrun(run(u, **opts))   +def portable_fork(ui): + fork = ui.configbool('tortoisehg', 'hgtkfork', True) + if not fork or 'THG_HGTK_SPAWN' in os.environ or '--nofork' in sys.argv: + return + # Spawn background process and exit + if hasattr(sys, "frozen"): + args = sys.argv + else: + args = [sys.executable] + sys.argv + if os.name == 'nt': + args = ['"%s"' % arg for arg in args] + env = os.environ.copy() + env['THG_HGTK_SPAWN'] = '1' + os.spawnve(os.P_NOWAIT, sys.executable, args, env) + sys.exit(0) +  def get_list_from_file(filename):   try:   if filename == '-': @@ -245,6 +263,7 @@
   def clone(ui, *pats, **opts):   """clone tool""" + portable_fork(ui)   from hggtk.clone import run   gtkrun(run(ui, *pats, **opts))   @@ -258,6 +277,7 @@
  except SystemExit:   pass   return + portable_fork(ui)   # move cwd to repo root if repo is merged, so we can show   # all the changed files   repo = hg.repository(ui, path=paths.find_root()) @@ -269,17 +289,20 @@
   def shelve(ui, *pats, **opts):   """shelve/unshelve tool""" + portable_fork(ui)   from hggtk.thgshelve import run   gtkrun(run(ui, *pats, **opts))    def userconfig(ui, *pats, **opts):   """user configuration editor""" + portable_fork(ui)   from hggtk.thgconfig import run   opts['repomode'] = False   gtkrun(run(ui, *pats, **opts))    def repoconfig(ui, *pats, **opts):   """repository configuration editor""" + portable_fork(ui)   from hggtk.thgconfig import run   opts['repomode'] = True   gtkrun(run(ui, *pats, **opts)) @@ -291,66 +314,79 @@
  gdialog.Prompt(_('Rename error'),   _('rename takes one or two path arguments'), None).run()   return + portable_fork(ui)   from hggtk.rename import run   gtkrun(run(ui, *pats, **opts))    def guess(ui, *pats, **opts):   """guess previous renames or copies""" + portable_fork(ui)   from hggtk.guess import run   gtkrun(run(ui, *pats, **opts))    def datamine(ui, *pats, **opts):   """repository search and annotate tool""" + portable_fork(ui)   from hggtk.datamine import run   gtkrun(run(ui, *pats, **opts))    def hgignore(ui, *pats, **opts):   """ignore filter editor""" + portable_fork(ui)   from hggtk.hgignore import run   gtkrun(run(ui, *pats, **opts))    def hginit(ui, *pats, **opts):   """repository initialization tool""" + portable_fork(ui)   from hggtk.hginit import run   gtkrun(run(ui, *pats, **opts))    def log(ui, *pats, **opts):   """changelog viewer""" + portable_fork(ui)   from hggtk.history import run   gtkrun(run(ui, *pats, **opts))    def merge(ui, *pats, **opts):   """merge tool""" + portable_fork(ui)   from hggtk.merge import run   gtkrun(run(ui, *pats, **opts))    def recovery(ui, *pats, **opts):   """recover, rollback & verify""" + portable_fork(ui)   from hggtk.recovery import run   gtkrun(run(ui, *pats, **opts))    def remove(ui, *pats, **opts):   """file status viewer in remove mode""" + portable_fork(ui)   from hggtk.status import run   gtkrun(run(ui, *pats, **opts))    def revert(ui, *pats, **opts):   """file status viewer in revert mode""" + portable_fork(ui)   from hggtk.status import run   gtkrun(run(ui, *pats, **opts))    def serve(ui, *pats, **opts):   """web server""" + portable_fork(ui)   from hggtk.serve import run   gtkrun(run(ui, *pats, **opts))    def status(ui, *pats, **opts):   """file status viewer""" + portable_fork(ui)   from hggtk.status import run   gtkrun(run(ui, *pats, **opts))    def synch(ui, *pats, **opts):   """repository synchronization tool""" + portable_fork(ui)   from hggtk.synch import run   cmd = sys.argv[1]   if 'push'.startswith(cmd) or 'outgoing'.startswith(cmd): @@ -361,11 +397,13 @@
   def update(ui, *pats, **opts):   """update/checkout tool""" + portable_fork(ui)   from hggtk.update import run   gtkrun(run(ui, *pats, **opts))    def vdiff(ui, *pats, **opts):   """launch configured visual diff tool""" + portable_fork(ui)   from hggtk.visdiff import run   gtkrun(run(ui, *pats, **opts))   @@ -402,7 +440,14 @@
  if with_version:   version(ui)   ui.write('\n') - aliases, i = cmdutil.findcmd(name, table) + + try: + aliases, i = cmdutil.findcmd(name, table, False) + except hglib.AmbiguousCommand, inst: + select = lambda c: c.lstrip('^').startswith(inst.args[0]) + helplist('list of commands:\n\n', select) + return +   # synopsis   ui.write("%s\n" % i[2])   @@ -462,49 +507,25 @@
  addglobalopts(True)     def helptopic(name): - v = None - for i in help.helptable: - l = i.split('|') - if name in l: - v = i - header = l[-1] - if not v: + from mercurial import help + for names, header, doc in help.helptable: + if name in names: + break + else:   raise hglib.UnknownCommand(name)     # description - doc = help.helptable[v]   if not doc:   doc = _("(No help text available)") - if callable(doc): + if hasattr(doc, '__call__'):   doc = doc()     ui.write("%s\n" % header)   ui.write("%s\n" % doc.rstrip())   - def helpext(name): - try: - mod = extensions.find(name) - except KeyError: - raise hglib.UnknownCommand(name) - - doc = (mod.__doc__ or _('No help text available')).splitlines(0) - ui.write(_('%s extension - %s\n') % (name.split('.')[-1], doc[0])) - for d in doc[1:]: - ui.write(d, '\n') - - ui.status('\n') - - try: - ct = mod.cmdtable - except AttributeError: - ct = {} - - modcmds = dict.fromkeys([c.split('|', 1)[0] for c in ct]) - helplist(_('list of commands:\n\n'), modcmds.has_key) -   if name and name != 'shortlist':   i = None - for f in (helpcmd, helptopic, helpext): + for f in (helpcmd, helptopic):   try:   f(name)   i = None
Change 1 of 4 Show Entire File hgtk Stacked
 
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
 
60
61
62
63
 
64
65
 
66
67
68
 
73
74
75
 
 
 
76
77
78
 
79
80
81
 
83
84
85
86
87
88
89
90
91
92
 
93
94
 
9
10
11
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
12
13
14
 
26
27
28
 
29
30
31
32
33
34
35
 
40
41
42
43
44
45
46
47
48
49
50
51
52
 
54
55
56
 
57
58
59
60
61
 
62
63
64
@@ -9,40 +9,6 @@
 import os  import sys   -def portable_fork(): - # Spawn background process and exit - if sys.platform[:3] == 'win': - if 'THG_HGTK_SPAWN' not in os.environ: - if hasattr(sys, "frozen"): - args = sys.argv - else: - args = [sys.executable] + sys.argv - args = ['"%s"' % arg for arg in args] - env = os.environ.copy() - env['THG_HGTK_SPAWN'] = '1' - os.spawnve(os.P_NOWAIT, sys.executable, args, env) - sys.exit(0) - else: - assert hasattr(os, 'fork') - if os.fork(): - sys.exit(0) - -from mercurial import ui - -_ui = ui.ui() -fork = _ui.configbool('tortoisehg', 'hgtkfork', True) -capt = _ui.configbool('tortoisehg', 'stderrcapt', True) - -if fork and '--nofork' not in sys.argv: - for i, arg in enumerate(sys.argv): - if 'hgtk' in arg and len(sys.argv) > i+1: - cmd = sys.argv[i+1] - break - else: - cmd = None - if cmd not in ('version', 'help'): - portable_fork() -  if hasattr(sys, "frozen"):   # Prepend C:\Program Files\TortoiseHg\gtk (equiv) to the path   from thgutil import paths @@ -60,9 +26,10 @@
 pygtk.require('2.0')  import gtk   -from mercurial import demandimport; +from mercurial import demandimport  demandimport.ignore.append('win32com.shell')  demandimport.enable() +from mercurial import ui  import cStringIO    try: @@ -73,9 +40,13 @@
  sys.stderr.write("(check your install and PYTHONPATH)\n")   sys.exit(-1)   +_ui = ui.ui() +capt = _ui.configbool('tortoisehg', 'stderrcapt', True) +  if not capt or 'THGDEBUG' in os.environ:   sys.exit(hggtk.hgtk.dispatch(sys.argv[1:]))  else: + import cStringIO   sys.stderr = cStringIO.StringIO()   ret = hggtk.hgtk.dispatch(sys.argv[1:])   sys.stderr.seek(0) @@ -83,12 +54,11 @@
  if l.startswith('Traceback') or l.startswith('TypeError'):   from hggtk.bugreport import run   from hggtk.hgtk import gtkrun - from mercurial import ui   sys.stderr.seek(0)   error = 'Recoverable runtime error (stderr):\n' + sys.stderr.read()   opts = {}   opts['cmd'] = ' '.join(sys.argv[1:])   opts['error'] = error - gtkrun(run(ui.ui(), **opts)) + gtkrun(run(_ui, **opts))   break   sys.exit(ret)