这个 python 脚本是迄今为止我想出的最好的脚本。我只是将它组合在一起,在粗略的前几次使用中,似乎表现得正确,但我忍不住觉得有一种更简单的方法可以做到这一点,甚至是内置的东西(尽管我已经搜索了一遍)。
谢谢您的帮助。
#!/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)
在考虑了格雷格的建议后,我得出了这样的结论:
git log remotes/trunk.. --oneline
我将使用别名或将其包装在一个小脚本中。
这有效而他的建议无效的原因是我的远程 svn 分支是remotes/trunk
not git-svn
。我不知道这是否是标准的,特别是因为格雷格假设git-svn
.
本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系:hwhale#tublm.com(使用前将#替换为@)