diff options
author | Guido Günther <agx@sigxcpu.org> | 2009-10-24 19:47:09 +0200 |
---|---|---|
committer | Guido Günther <agx@sigxcpu.org> | 2009-10-24 19:56:44 +0200 |
commit | b543f6731eea308e56fdf9f3d72ed3a907653be8 (patch) | |
tree | fd91ef582bb758876ffc10e00467e1fb77a9fd3f | |
parent | 6f03267aedaf7bf159af4016bdf46f21bc67cdd8 (diff) |
add GitRepository.is_fast_forward()
-rw-r--r-- | gbp/git.py | 9 |
1 files changed, 9 insertions, 0 deletions
@@ -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() |