Skip to content
Find file
Fetching contributors…
Cannot retrieve contributors at this time
59 lines (43 sloc) 1.08 KB
import string
from subprocess import *
import sys
import os
def split_branches(bl):
lines = string.split(bl, '\n')
others = []
current = None
for l in lines:
if not l:
if l[0] == '*':
current = l[2:]
if current == None:
print 'eek could not find current branch!'
return (others, current)
def runcmd(c):
print 'SHELL: ' + c
p = Popen(c, shell=True)
sts = os.waitpid(, 0)[1]
if sts != 0:
print 'ERROR'
blist = Popen(["git", "branch"], stdout=PIPE).communicate()[0]
(others, current) = split_branches(blist)
dopop = False
status = Popen(["git", "status", "-s"], stdout=PIPE).communicate()[0]
if status:
print 'Please do a git stash'
runcmd('git stash save')
dopop = True
for o in others:
runcmd('git checkout ' + o)
runcmd('git-p4 rebase')
runcmd('git checkout ' + current)
runcmd('git-p4 rebase')
if dopop:
runcmd('git stash pop')
Something went wrong with that request. Please try again.