This python script is the best I have come up with so far. I just hacked it together and on a cursory first couple uses, seems to be acting correctly, but I can’t help but feel there is an easier way to do this or even something built in (though I have searched and searched).
Thanks for the help.
#!/usr/bin/env python
import sys
import subprocess
s = subprocess.Popen("git svn log --show-commit --oneline".split(" "),
stdout=subprocess.PIPE)
# Grab the last svn commit's data
revision, sha, message = s.stdout.readlines().pop(0).split(" | ")
# Grab display of commits since svn rebase
s = subprocess.Popen(("git log %s..HEAD --oneline" % sha).split(" "),
stdout=subprocess.PIPE)
log = s.stdout.read().strip()
if len(log.splitlines()) > 0:
print ("%d commits ahead of svn. To push them to svn, use 'git svn dcommit'.\n"
% len(log.splitlines()))
print log
else:
print "No local commits that need 'git svn dcommit'"
sys.exit(0)
First, do a
git branch -ato list all the remote branches:For me, only the
git-svnbranch is listed, but you may have different names depending on what options you passed togit svn clone. Then, use(substituting your appropriate name for
git-svn). The above command (note the two trailing dots..) shows all the commits on the current branch since the nearest common ancestor of the current branch and thegit-svnbranch.