summaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
authorGuido Günther <agx@sigxcpu.org>2010-08-29 18:05:11 +0200
committerGuido Günther <agx@sigxcpu.org>2010-08-29 18:11:41 +0200
commit3262621bac0d06482d78d3a9c288c04f3627e341 (patch)
tree275c0a869b76e1d2b6410b34b8493cb1dea6c1ef
parent39b1a07b8db07154fc7d97d87be11aa4c03e8c62 (diff)
Properly handle local only changes as no update needed
-rwxr-xr-xgbp-pull1
-rw-r--r--gbp/git.py25
2 files changed, 20 insertions, 6 deletions
diff --git a/gbp-pull b/gbp-pull
index 6f23dbe5..79c12a43 100755
--- a/gbp-pull
+++ b/gbp-pull
@@ -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
diff --git a/gbp/git.py b/gbp/git.py
index 7547d154..391dff3f 100644
--- a/gbp/git.py
+++ b/gbp/git.py
@@ -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'"""