在python子流程中使用git shortlog获取每个文件的贡献者
当我试图获取以下命令的输出时,出现了一个问题:在python子流程中使用git shortlog获取每个文件的贡献者,git,python-3.x,Git,Python 3.x,当我试图获取以下命令的输出时,出现了一个问题: git shortlog-s--[文件路径] 使用Python3.6子流程模块 代码如下: import subprocess x = subprocess.Popen(['git shortlog -s -- ' + file_path], cwd=path, shell=True, stdin=subprocess.PIPE, stdout=subprocess.PIPE).communicate()[0] print(x) 执行的结果
git shortlog-s--[文件路径]
使用Python3.6子流程模块
代码如下:
import subprocess
x = subprocess.Popen(['git shortlog -s -- ' + file_path], cwd=path,
shell=True, stdin=subprocess.PIPE,
stdout=subprocess.PIPE).communicate()[0]
print(x)
执行的结果为空。
我做错了什么?你需要打电话给git shortlog HEAD
subprocess.Popen(['git shortlog HEAD -s -- ' + file_path],
cwd=path, shell=True, stdin=subprocess.PIPE,
stdout=subprocess.PIPE).communicate()[0]
要了解原因,请参见您需要调用git shortlog HEAD
subprocess.Popen(['git shortlog HEAD -s -- ' + file_path],
cwd=path, shell=True, stdin=subprocess.PIPE,
stdout=subprocess.PIPE).communicate()[0]
要了解原因,请参见您找到答案了吗?这也是我的问题。例如,当执行
git status
或git log
时,一切正常,但当执行git shortlog
时,它停止工作。不,我没有。我只是放弃了git-shortlog
,通过分析git-log
输出来获取必要的数据。你找到答案了吗?这也是我的问题。例如,当执行git status
或git log
时,一切正常,但当执行git shortlog
时,它停止工作。不,我没有。我只是放弃了git-shortlog
,从git-log
输出的解析中获取必要的数据。