diff options
author | Guido Günther <agx@sigxcpu.org> | 2010-08-29 18:05:11 +0200 |
---|---|---|
committer | Guido Günther <agx@sigxcpu.org> | 2010-08-29 18:11:41 +0200 |
commit | 3262621bac0d06482d78d3a9c288c04f3627e341 (patch) | |
tree | 275c0a869b76e1d2b6410b34b8493cb1dea6c1ef | |
parent | 39b1a07b8db07154fc7d97d87be11aa4c03e8c62 (diff) | |
download | git-buildpackage-3262621bac0d06482d78d3a9c288c04f3627e341.tar.gz git-buildpackage-3262621bac0d06482d78d3a9c288c04f3627e341.tar.bz2 git-buildpackage-3262621bac0d06482d78d3a9c288c04f3627e341.zip |
Properly handle local only changes as no update needed
-rwxr-xr-x | gbp-pull | 1 | ||||
-rw-r--r-- | gbp/git.py | 25 |
2 files changed, 20 insertions, 6 deletions
@@ -58,6 +58,7 @@ def fast_forward_branch(branch, repo, options): print >>sys.stderr, "Warning: Skipping non-fast forward of '%s' - use --force" % branch if update: + print "Updating '%s'" % branch repo.set_branch(branch) GitMerge(remote)() return update @@ -156,19 +156,32 @@ class GitRepository(object): 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 or if the branch is uptodate already""" + """ + check if an update from from_branch to to_branch would be a fast + forward or if the branch is uptodate already + @return: can_fast_forward, up_to_date + @rtype: tuple + """ + has_local = False # local repo has new commits + has_remote = False # remote repo has new commits out = self.__git_getoutput('rev-list', ["--left-right", "%s...%s" % (from_branch, to_branch)])[0] - if not out: # already up to date + if not out: # both branches have the same commits return True, True for line in out: if line.startswith("<"): - return False, False - - return True, False + has_local = True + elif line.startswith(">"): + has_remote = True + + if has_local and has_remote: + return False, False + elif has_local: + return False, True + elif has_remote: + return True, False def set_branch(self, branch): """switch to branch 'branch'""" |