aboutsummaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
authorGuido Günther <agx@sigxcpu.org>2009-10-24 19:47:09 +0200
committerGuido Günther <agx@sigxcpu.org>2009-10-24 19:56:44 +0200
commitb543f6731eea308e56fdf9f3d72ed3a907653be8 (patch)
treefd91ef582bb758876ffc10e00467e1fb77a9fd3f
parent6f03267aedaf7bf159af4016bdf46f21bc67cdd8 (diff)
add GitRepository.is_fast_forward()
-rw-r--r--gbp/git.py9
1 files changed, 9 insertions, 0 deletions
diff --git a/gbp/git.py b/gbp/git.py
index fea10f99..5bd7feef 100644
--- a/gbp/git.py
+++ b/gbp/git.py
@@ -83,6 +83,15 @@ class GitRepository(object):
remote += merge.replace("refs/heads","", 1)
return remote
+ def is_fast_forward(self, from_branch, to_branch):
+ """check if an update from from_branch to to_branch would be a fast forward"""
+ out = self.__git_getoutput('rev-list', ["--left-right",
+ "%s...%s" % (from_branch, to_branch)])[0]
+ for line in out:
+ if line.startswith("<"):
+ return False
+ return True
+
def set_branch(self, branch):
"""switch to branch 'branch'"""
self.__check_path()