##// END OF EJS Templates
Always run the OS X loop even if no windows....
Always run the OS X loop even if no windows. Otherwise this can trigger infinite Python-Icon-In-Dock bouncing. See #10137. I will guess that this is because application on OS X may not have windows and still need to process events. It may be that an alternative is to run the loop only once the first time, but I'm unsure. at_least_once = False def inputhook(context): """Inputhook for Cocoa (NSApp)""" NSApp = _NSApp() window_count = msg( msg(NSApp, n('windows')), n('count') ) if not window_count and not at_least_once: at_least_once = True return _stop_on_read(context.fileno()) msg(NSApp, n('run')) if not _triggered.is_set(): # app closed without firing callback, # probably due to last window being closed. # Run the loop manually in this case, # since there may be events still to process (#9734) CoreFoundation.CFRunLoopRun() Closes #10137

File last commit:

r5931:4f2ef554
r23167:260e9884
Show More
git-mrb
80 lines | 2.3 KiB | text/plain | TextLexer
#!/usr/bin/env python
"""git-mrb: merge remote branch.
git mrb [remote:branch OR remote-branch] [onto] [upstream]
remote must be locally available, and branch must exist in that remote.
If 'onto' branch isn't given, default is 'master'.
If 'upstream' repository isn't given, default is 'origin'.
You can separate the remote and branch spec with either a : or a -.
"""
#-----------------------------------------------------------------------------
# Imports
#-----------------------------------------------------------------------------
from subprocess import check_call
import sys
#-----------------------------------------------------------------------------
# Functions
#-----------------------------------------------------------------------------
def sh(cmd):
cmd = cmd.format(**shvars)
print '$', cmd
check_call(cmd, shell=True)
#-----------------------------------------------------------------------------
# Main Script
#-----------------------------------------------------------------------------
argv = sys.argv[1:]
narg = len(argv)
try:
branch_spec = argv[0]
sep = ':' if ':' in branch_spec else '-'
remote, branch = branch_spec.split(':', 1)
if not branch:
raise ValueError('Branch spec %s invalid, branch not found' %
branch_spec)
except:
import traceback as tb
tb.print_exc()
print __doc__
sys.exit(1)
onto = argv[1] if narg >= 2 else 'master'
upstream = argv[1] if narg == 3 else 'origin'
# Git doesn't like ':' in branch names.
if sep == ':':
branch_spec = branch_spec.replace(':', '-')
# Global used by sh
shvars = dict(remote=remote, branch_spec=branch_spec, branch=branch,
onto=onto, upstream=upstream)
# Start git calls.
sh('git fetch {remote}')
sh('git checkout -b {branch_spec} {onto}')
sh('git merge {remote}/{branch}')
print """
*************************************************************
Run test suite. If tests pass, run the following to merge:
git checkout {onto}
git merge {branch_spec}
git push {upstream} {onto}
*************************************************************
""".format(**shvars)
ans = raw_input("Revert to master and delete temporary branch? [Y/n]: ")
if ans.strip().lower() in ('', 'y', 'yes'):
sh('git checkout {onto}')
sh('git branch -D {branch_spec}')