所以我正在使用gitpython问题:没有处理程序可以发现记录器“git.remote”
No handlers could be found for logger "git.remote"
我的代码
print repo_object.remote() # origin
print repo_object.active_branch # master
print repo_object.active_branch.name # master
refspec = repo_object.active_branch.name + ":refs/for/" + repo_object.active_branch.name
print refspeC# master:/refs/for/master
print "Push " + refspeC# push master:refs/for/master
print remote.push(refspec) # [<git.remote.PushInfo object at 0x....>]
remote.push(refspec)
pushed_repos.append(repo_name)
print pushed_repos # my project repo
我的目标是推动新添加的一个子模块(创建/更新)文件到gerrit。
编辑:请从@Arount
好了,我有一个函数调用
del_proj_gerrit(pushed_repos, commit_message, repo_path, repo_name, push)
的参数有以下值:
pushed_repos # []
commit_message # just a commit message
repo_name_path # path to my local repo
repo_name # name of the project repo
push # A value of True is set here
里面我del_proj_gerrit
功能我:
add_all_files("./")
if push == True:
commit_and_push(pushed_repos, commit_message, repo_path, repo_name)
里面我commit_and_push
功能我:
repo_path_new = repo_path+repo_name
repo_object = Repo(repo_path_new) # <git.Repo "C\localpath\.git\modules\repo-project">
if commit_command_line(commit_message, repo_object, repo_name):
# Inside the if-statement you have the code I posted before
里面的commit_command_line
功能我:
cmd = "git commit -m \"%s\"" % commit_message
errmsg = "Failed command:\n" + cmd
success = True
try:
execute_shell_process(cmd, errmsg, True, True)
except CommonProcessError as e:
print "Error during commit for repo '" + repo_name + "' (ret code " + \
str(e.returncode) + ")."
print "Assuming that there was no changes to last commit => continue"
success = False
return success
@Arount检查我的编辑 – user535081
之前从来没有真正使用的功能回溯。你建议'traceback.print_exc()'?因为当我这样做时,我得到无。从我读的文档看来,我似乎需要使用'try&except'。事情是我得到**推大师:参考/为/主 没有处理程序可以发现记录器“git.remote”**当我试图推它似乎。换句话说,我没有得到任何错误:(。我上面粘贴的函数是相关的一个(可能不是最好的格式)。 – user535081
@Arount'没有处理程序可以找到记录器...'是一个警告,而不是错误,所以没有回溯。 – phd