chiark / gitweb /
Do not raise an exception if no FETCH_HEAD
authorCatalin Marinas <catalin.marinas@gmail.com>
Wed, 17 Oct 2007 20:35:21 +0000 (21:35 +0100)
committerCatalin Marinas <catalin.marinas@gmail.com>
Wed, 17 Oct 2007 20:35:21 +0000 (21:35 +0100)
The fetchcmd option in .git/config can be set to a command that
doesn't generate a FETCH_HEAD file (like 'git svn fetch'). With this
patch, StGIT will only warn if no FETCH_HEAD is found as it is quite
likely that the rebasecmd doesn't need one ('git svn rebase'). The
patch also modifies the 'fetch-rebase' case in pull.py so that it
re-raises the exception initially raised by git.fetch_head() as this
function has the correct information about the type of exception.

Signed-off-by: Catalin Marinas <catalin.marinas@gmail.com>
stgit/commands/pull.py
stgit/git.py

index e5ee17dd3231f49fb92543608d0d5897501d80ac..0078e5514dcfa967bc9df6f7e4310e40fe6041c1 100644 (file)
@@ -91,9 +91,10 @@ def func(parser, options, args):
         try:
             target = git.fetch_head()
         except git.GitException:
-            out.error('Could not find the remote head to rebase onto, pushing any patches back...')
+            out.error('Could not find the remote head to rebase onto - fix branch.%s.merge in .git/config' % crt_series.get_name())
+            out.error('Pushing any patches back...')
             post_rebase(crt_series, 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()
+            raise
 
         rebase(crt_series, target)
     elif policy == 'rebase':
index cc6acb14a64003c896d45a75bb7199960783f433..78aae05ea57f4b3de71ed9929af5a6aedd0fcf33 100644 (file)
@@ -1022,7 +1022,7 @@ def fetch_head():
     stream.close()
 
     if not fetch_head:
-        raise GitException, 'No for-merge remote head found in FETCH_HEAD'
+        out.warn('No for-merge remote head found in FETCH_HEAD')
 
     # here we are sure to have a single fetch_head
     return fetch_head