Skip to content
This repository
Fetching contributors…

Cannot retrieve contributors at this time

executable file 47 lines (39 sloc) 0.848 kb
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
#!/usr/bin/python

import os

def commit(msg):
git_cmd = 'git add .; git commit -a -m "{0}"'.format(msg)
os.system(git_cmd)
hg_cmd = 'hg commit -A -m "{0}"'.format(msg)
os.system(hg_cmd)

def push():
git_cmd = 'git push'
os.system(git_cmd)
hg_cmd = 'hg push'
os.system(hg_cmd)

def pull():
git_cmd = 'git fetch; git merge origin/master'
os.system(git_cmd)
hg_cmd = 'hg pull; hg up'
os.system(hg_cmd)

def one_step(*msg):
        commit(msg or '(^_^)')
        push()

cmd_table = {
'commit': commit,
'co': commit,
'push': push,
'pull': pull,
        'all': one_step
}

def print_help():
print("""python scm.py push
python scm.py co/commit "your message"
""")

def main(args):
if len(args) > 1 and args[1] in cmd_table:
cmd_table[args[1]](*args[2:])
else:
print_help()
if __name__ == '__main__':
import sys
main(sys.argv)
Something went wrong with that request. Please try again.