From: Catalin Marinas Date: Wed, 17 Oct 2007 20:35:21 +0000 (+0100) Subject: Do not raise an exception if no FETCH_HEAD X-Git-Tag: v0.14~38 X-Git-Url: http://www.chiark.greenend.org.uk/ucgi/~mdw/git/stgit/commitdiff_plain/b029e3cca0ccda94c9256a4b86efc8d679235a1d Do not raise an exception if no FETCH_HEAD 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 --- diff --git a/stgit/commands/pull.py b/stgit/commands/pull.py index e5ee17d..0078e55 100644 --- a/stgit/commands/pull.py +++ b/stgit/commands/pull.py @@ -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': diff --git a/stgit/git.py b/stgit/git.py index cc6acb1..78aae05 100644 --- a/stgit/git.py +++ b/stgit/git.py @@ -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