logger.error('Could not determine GIT_UPSTREAM_BRANCH')
exit_error()
+ # git-buildpackage uses only treeish object in v0.5.10,
+ # let's fetch it correctly:
+ GIT_UPSTREAM_BRANCH = git_helper.git_get_treeish(GIT_UPSTREAM_BRANCH)
+
repo = git.repo.Repo()
if GIT_DEBIAN_BRANCH != 'master':
logger.debug('changes for %s commited' %(' '.join(paths)))
return True
+def git_get_treeish(refname):
+ """
+ Return treeish reference as a string for any valid refspec.
+ """
+ cmd = [
+ GIT,
+ 'show --oneline',
+ '%s' % refname,
+ '|awk \'{print $1\}\''
+ ]
+ cmdobj = subprocess.Popen(
+ cmd,
+ stdout=subprocess.PIPE,
+ stderr=subprocess.PIPE,
+ shell=False,
+ env={'':''},
+ cwd=os.getcwd(),
+ close_fds=True
+ )
+
+ logger.debug(
+ 'calling "%s" ' %(' '.join(cmd))
+ )
+ ret = cmdobj.wait()
+ if ret:
+ error_str = cmdobj.stderr.read()
+ if not error_str:
+ error_str = cmdobj.stdout.read()
+ if not error_str:
+ error_str = 'No Error Msg found'
+ logger.error(
+ '%s returned with %s. Output was: %s'
+ %(' '.join(cmd), ret, error_str)
+ )
+ return None
+ else:
+ stdout_str = cmdobj.stdout.read()
+ logger.debug(
+ 'found treeish "%s" for refspec "%s"' % (refname, stdout_str)
+ )
+ return stdout_str
+
# vim: autoindent smartindent tabstop=4 expandtab shiftwidth=4 softtabstop=4 nu enc=utf-8 cinwords=if,elif,else,for,while,try,except,finally,def,class