Changeset 53f9750fa12b…
Parent e3f56b00872f…
by
Changes to 2 files · Browse files at 53f9750fa12b Showing diff from parent e3f56b00872f Diff from another changeset...
|
|
@@ -54,18 +54,20 @@ opts = {}
opts['cmd'] = ' '.join(sys.argv[1:])
opts['error'] = error
+ opts['nofork'] = True
if gtkmainalive:
dlg = run(u, **opts)
dlg.display()
dlg.show_all()
else:
- gtkrun(run(u, **opts))
+ 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:
+def portable_fork(ui, opts):
+ if 'THG_HGTK_SPAWN' in os.environ:
return
- if '--repository' in sys.argv or '-R' in sys.argv:
+ if opts.get('nofork') or opts.get('repository'):
+ return
+ if not ui.configbool('tortoisehg', 'hgtkfork', True):
return
# Spawn background process and exit
if hasattr(sys, "frozen"):
@@ -202,6 +204,8 @@ path = ui.expandpath(options['repository'])
cmdoptions['repository'] = path
os.chdir(path)
+ if options['nofork']:
+ cmdoptions['nofork'] = True
path = paths.find_root(os.getcwd())
if path:
try:
@@ -241,7 +245,9 @@ if mainwindow.should_live(): return
mainwindow.destroy()
-def gtkrun(win):
+def gtkrun(dlgfunc, ui, *args, **opts):
+ portable_fork(ui, opts)
+ win = dlgfunc(ui, *args, **opts)
global mainwindow, gtkmainalive
mainwindow = win
if hasattr(win, 'display'):
@@ -260,7 +266,7 @@def about(ui, *pats, **opts):
"""about TortoiseHg"""
from hggtk.about import run
- gtkrun(run(ui, *pats, **opts))
+ gtkrun(run, ui, *pats, **opts)
def add(ui, *pats, **opts):
"""add files"""
@@ -275,13 +281,11 @@
def clone(ui, *pats, **opts):
"""clone tool"""
- portable_fork(ui)
from hggtk.clone import run
- gtkrun(run(ui, *pats, **opts))
+ gtkrun(run, ui, *pats, **opts)
def commit(ui, *pats, **opts):
"""commit tool"""
- 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())
@@ -289,27 +293,24 @@ os.chdir(repo.root)
pats = []
from hggtk.commit import run
- gtkrun(run(ui, *pats, **opts))
+ gtkrun(run, ui, *pats, **opts)
def shelve(ui, *pats, **opts):
"""shelve/unshelve tool"""
- portable_fork(ui)
from hggtk.thgshelve import run
- gtkrun(run(ui, *pats, **opts))
+ 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))
+ 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))
+ gtkrun(run, ui, *pats, **opts)
def rename(ui, *pats, **opts):
"""rename a single file or directory"""
@@ -318,98 +319,83 @@ 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))
+ 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))
+ 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))
+ 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))
+ 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))
+ 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))
+ 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))
+ 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))
+ 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))
+ 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))
+ 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))
+ gtkrun(run, ui, *pats, **opts)
def status(ui, *pats, **opts):
"""file status & diff viewer"""
- portable_fork(ui)
from hggtk.status import run
- gtkrun(run(ui, *pats, **opts))
+ gtkrun(run, ui, *pats, **opts)
def synch(ui, *pats, **opts):
"""repository synchronization tool"""
- portable_fork(ui)
from hggtk.synch import run
cmd = opts['alias']
if cmd in ('push', 'outgoing', 'email'):
opts['pushmode'] = True
else:
opts['pushmode'] = False
- gtkrun(run(ui, *pats, **opts))
+ gtkrun(run, ui, *pats, **opts)
def update(ui, *pats, **opts):
"""update/checkout tool"""
- portable_fork(ui)
from hggtk.update import run
- gtkrun(run(ui, *pats, **opts))
+ 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))
+ gtkrun(run, ui, *pats, **opts)
### help management, adapted from mercurial.commands.help_()
def help_(ui, name=None, with_version=False):
|
@@ -59,6 +59,7 @@ opts = {}
opts['cmd'] = ' '.join(sys.argv[1:])
opts['error'] = error
- gtkrun(run(_ui, **opts))
+ opts['nofork'] = True
+ gtkrun(run, _ui, **opts)
break
sys.exit(ret)
|
Loading...