If the branch.*.merge parameter does not name a valid remote head,
stgit would not rebase after a fetch, and would write instead
'Rebasing to "None" ... done'.
This patch makes this situation an error and tells the user what
to fix in his repo configuration.
elif policy == 'fetch-rebase':
out.info('Fetching from "%s"' % repository)
git.fetch(repository)
elif policy == 'fetch-rebase':
out.info('Fetching from "%s"' % repository)
git.fetch(repository)
- rebase(git.fetch_head())
+ try:
+ target = git.fetch_head()
+ except git.GitException:
+ out.error('Could not find the remote head to rebase onto, pushing any patches back...')
+ post_rebase(applied, False, False)
+ raise CmdException, 'Could not find the remote head to rebase onto - fix branch.%s.merge in .git/config' % crt_series.get_name()
+
+ rebase(target)
elif policy == 'rebase':
rebase(crt_series.get_parent_branch())
elif policy == 'rebase':
rebase(crt_series.get_parent_branch())
m = re.match('^([^\t]*)\t\t', line)
if m:
if fetch_head:
m = re.match('^([^\t]*)\t\t', line)
if m:
if fetch_head:
- raise GitException, "StGit does not support multiple FETCH_HEAD"
+ raise GitException, 'StGit does not support multiple FETCH_HEAD'
else:
fetch_head=m.group(1)
stream.close()
else:
fetch_head=m.group(1)
stream.close()
+ if not fetch_head:
+ raise GitException, 'No for-merge remote head found in FETCH_HEAD'
+
# here we are sure to have a single fetch_head
return fetch_head
# here we are sure to have a single fetch_head
return fetch_head