Since 'git fetch' already takes care of the branch.*.merge parameters,
resolves the new tip of the parent branch and puts it in FETCH_HEAD,
we're better just taking it from there.
This fixes the regression on t1200-push-modified.sh.
Signed-off-by: Yann Dirson <ydirson@altern.org>
print 'Pulling from "%s"...' % repository
git.fetch(repository)
if (config.get('stgit.pull-does-rebase') == 'yes'):
print 'Pulling from "%s"...' % repository
git.fetch(repository)
if (config.get('stgit.pull-does-rebase') == 'yes'):
- print "rebasing to '%s'..." % crt_series.get_parent_branch()
- git.reset(tree_id = git.rev_parse(crt_series.get_parent_branch()))
+ print 'rebasing to "%s"...' % git.fetch_head()
+ git.reset(tree_id = git.fetch_head())
print 'done'
# push the patches back
print 'done'
# push the patches back
for line in stream:
# Only consider Pull lines
m = re.match('^Pull: (.*)\n$', line)
for line in stream:
# Only consider Pull lines
m = re.match('^Pull: (.*)\n$', line)
- branches.append(refspec_localpart(m.group(1)))
+ if m:
+ branches.append(refspec_localpart(m.group(1)))
stream.close()
elif remote in __remotes_from_dir('branches'):
# old-style branches only declare one branch
stream.close()
elif remote in __remotes_from_dir('branches'):
# old-style branches only declare one branch
# if we get here we've found nothing
return None
# if we get here we've found nothing
return None
+
+def fetch_head():
+ """Return the git id for the tip of the parent branch as left by
+ 'git fetch'.
+ """
+
+ fetch_head=None
+ stream = open(os.path.join(basedir.get(), 'FETCH_HEAD'), "r")
+ for line in stream:
+ # Only consider lines not tagged not-for-merge
+ m = re.match('^([^\t]*)\t\t', line)
+ if m:
+ if fetch_head:
+ raise GitException, "StGit does not support multiple FETCH_HEAD"
+ else:
+ fetch_head=m.group(1)
+ stream.close()
+
+ # here we are sure to have a single fetch_head
+ return fetch_head