{"thread":{"id":"10165","subject":"[StGIT PATCH] Better diagnostic for wrong branch configuration.","startedAt":"2007-10-05T20:44:52Z","lastAt":"2007-10-08T13:00:48Z","messageCount":6,"participants":["Yann Dirson","Karl Hasselström","Catalin Marinas"],"isPatch":true,"patchVersion":1,"patchTotal":null},"messages":[{"id":"55002","messageId":"20071005204452.30902.60246.stgit@gandelf.nowhere.earth","threadId":"10165","inReplyTo":null,"subject":"[StGIT PATCH] Better diagnostic for wrong branch configuration.","fromName":"Yann Dirson","fromEmail":"ydirson@altern.org","sentAt":"2007-10-05T20:44:52Z","receivedAt":"2007-10-05T20:44:52Z","isPatch":true,"sender":{"key":"ydirson@altern.org","avatar":"https://avatars.githubusercontent.com/u/1190950?v=4"},"body":"If the branch.*.merge parameter does not name a valid remote head,\nstgit would not rebase after a fetch, and would write instead\n'Rebasing to \"None\" ... done'.\n\nThis patch makes this situation an error and tells the user what\nto fix in his repo configuration.\n---\n\n stgit/commands/pull.py |    9 ++++++++-\n stgit/git.py           |    5 ++++-\n 2 files changed, 12 insertions(+), 2 deletions(-)\n\ndiff --git a/stgit/commands/pull.py b/stgit/commands/pull.py\nindex 052ea2b..070db99 100644\n--- a/stgit/commands/pull.py\n+++ b/stgit/commands/pull.py\n@@ -90,7 +90,14 @@ def func(parser, options, args):\n     elif policy == 'fetch-rebase':\n         out.info('Fetching from \"%s\"' % repository)\n         git.fetch(repository)\n-        rebase(git.fetch_head())\n+        try:\n+            target = git.fetch_head()\n+        except git.GitException:\n+            out.error('Could not find the remote head to rebase onto, pushing any patches back...')\n+            post_rebase(applied, False, False)\n+            raise CmdException, 'Could not find the remote head to rebase onto - fix branch.%s.merge in .git/config' % crt_series.get_name()\n+\n+        rebase(target)\n     elif policy == 'rebase':\n         rebase(crt_series.get_parent_branch())\n \ndiff --git a/stgit/git.py b/stgit/git.py\nindex 9e0f771..a0493bc 100644\n--- a/stgit/git.py\n+++ b/stgit/git.py\n@@ -1003,11 +1003,14 @@ def fetch_head():\n         m = re.match('^([^\\t]*)\\t\\t', line)\n         if m:\n             if fetch_head:\n-                raise GitException, \"StGit does not support multiple FETCH_HEAD\"\n+                raise GitException, 'StGit does not support multiple FETCH_HEAD'\n             else:\n                 fetch_head=m.group(1)\n     stream.close()\n \n+    if not fetch_head:\n+        raise GitException, 'No for-merge remote head found in FETCH_HEAD'\n+\n     # here we are sure to have a single fetch_head\n     return fetch_head\n \n"},{"id":"55045","messageId":"20071007131417.GA28492@diana.vm.bytemark.co.uk","threadId":"10165","inReplyTo":"20071005204452.30902.60246.stgit@gandelf.nowhere.earth","subject":"Re: [StGIT PATCH] Better diagnostic for wrong branch configuration.","fromName":"Karl Hasselström","fromEmail":"kha@treskal.com","sentAt":"2007-10-07T13:14:17Z","receivedAt":"2007-10-07T13:14:17Z","isPatch":true,"sender":{"key":"kha@treskal.com","avatar":"https://gravatar.com/avatar/f0120c734b5279b345075a28521e1ac66acb20c9913ffe9bf6ae97e53f7f3f13?d=mp&s=160"},"body":"On 2007-10-05 22:44:52 +0200, Yann Dirson wrote:\n\n> If the branch.*.merge parameter does not name a valid remote head,\n> stgit would not rebase after a fetch, and would write instead\n> 'Rebasing to \"None\" ... done'.\n>\n> This patch makes this situation an error and tells the user what to\n> fix in his repo configuration.\n\nGood. Sign-off?\n\n> -                raise GitException, \"StGit does not support multiple FETCH_HEAD\"\n> +                raise GitException, 'StGit does not support multiple FETCH_HEAD'\n\nUnrelated quote fixup. No big deal, though.\n\n-- \nKarl Hasselström, kha@treskal.com\n      www.treskal.com/kalle\n"},{"id":"55047","messageId":"20071007141744.GY26436@nan92-1-81-57-214-146.fbx.proxad.net","threadId":"10165","inReplyTo":"20071007131417.GA28492@diana.vm.bytemark.co.uk","subject":"Re: [StGIT PATCH] Better diagnostic for wrong branch configuration.","fromName":"Yann Dirson","fromEmail":"ydirson@altern.org","sentAt":"2007-10-07T14:17:44Z","receivedAt":"2007-10-07T14:17:44Z","isPatch":true,"sender":{"key":"ydirson@altern.org","avatar":"https://avatars.githubusercontent.com/u/1190950?v=4"},"body":"On Sun, Oct 07, 2007 at 03:14:17PM +0200, Karl Hasselström wrote:\n> On 2007-10-05 22:44:52 +0200, Yann Dirson wrote:\n> \n> > If the branch.*.merge parameter does not name a valid remote head,\n> > stgit would not rebase after a fetch, and would write instead\n> > 'Rebasing to \"None\" ... done'.\n> >\n> > This patch makes this situation an error and tells the user what to\n> > fix in his repo configuration.\n> \n> Good. Sign-off?\n\nOops, sorry - \"Signed-off-by: Yann Dirson <ydirson@altern.org>\"\n\n> > -                raise GitException, \"StGit does not support multiple FETCH_HEAD\"\n> > +                raise GitException, 'StGit does not support multiple FETCH_HEAD'\n> \n> Unrelated quote fixup. No big deal, though.\n\nRight - did not seem to warrant a patch of its own :)\n\nBest regards,\n-- \nYann\n"},{"id":"55053","messageId":"20071007152502.GA29566@diana.vm.bytemark.co.uk","threadId":"10165","inReplyTo":"20071007141744.GY26436@nan92-1-81-57-214-146.fbx.proxad.net","subject":"Re: [StGIT PATCH] Better diagnostic for wrong branch configuration.","fromName":"Karl Hasselström","fromEmail":"kha@treskal.com","sentAt":"2007-10-07T15:25:02Z","receivedAt":"2007-10-07T15:25:02Z","isPatch":true,"sender":{"key":"kha@treskal.com","avatar":"https://gravatar.com/avatar/f0120c734b5279b345075a28521e1ac66acb20c9913ffe9bf6ae97e53f7f3f13?d=mp&s=160"},"body":"On 2007-10-07 16:17:44 +0200, Yann Dirson wrote:\n\n> Oops, sorry - \"Signed-off-by: Yann Dirson <ydirson@altern.org>\"\n\nThanks; I'll include that when I push out my branches tonight.\n\n-- \nKarl Hasselström, kha@treskal.com\n      www.treskal.com/kalle\n"},{"id":"55085","messageId":"b0943d9e0710071404i549f4290u4f5ba7ada355bb54@mail.gmail.com","threadId":"10165","inReplyTo":"20071005204452.30902.60246.stgit@gandelf.nowhere.earth","subject":"Re: [StGIT PATCH] Better diagnostic for wrong branch configuration.","fromName":"Catalin Marinas","fromEmail":"catalin.marinas@gmail.com","sentAt":"2007-10-07T21:04:21Z","receivedAt":"2007-10-07T21:04:21Z","isPatch":true,"sender":{"key":"catalin.marinas@gmail.com","avatar":null},"body":"On 05/10/2007, Yann Dirson <ydirson@altern.org> wrote:\n> If the branch.*.merge parameter does not name a valid remote head,\n> stgit would not rebase after a fetch, and would write instead\n> 'Rebasing to \"None\" ... done'.\n\nApplied, thanks. I'll try it tomorrow with my StGIT over SVN\nconfiguration as well (it works OK with the latter patches).\n\n-- \nCatalin\n"},{"id":"55185","messageId":"b0943d9e0710080600y55aeeeeei8dbd27d069c681e@mail.gmail.com","threadId":"10165","inReplyTo":"20071005204452.30902.60246.stgit@gandelf.nowhere.earth","subject":"Re: [StGIT PATCH] Better diagnostic for wrong branch configuration.","fromName":"Catalin Marinas","fromEmail":"catalin.marinas@gmail.com","sentAt":"2007-10-08T13:00:48Z","receivedAt":"2007-10-08T13:00:48Z","isPatch":true,"sender":{"key":"catalin.marinas@gmail.com","avatar":null},"body":"On 05/10/2007, Yann Dirson <ydirson@altern.org> wrote:\n> --- a/stgit/git.py\n> +++ b/stgit/git.py\n> @@ -1003,11 +1003,14 @@ def fetch_head():\n>          m = re.match('^([^\\t]*)\\t\\t', line)\n>          if m:\n>              if fetch_head:\n> -                raise GitException, \"StGit does not support multiple FETCH_HEAD\"\n> +                raise GitException, 'StGit does not support multiple FETCH_HEAD'\n>              else:\n>                  fetch_head=m.group(1)\n>      stream.close()\n>\n> +    if not fetch_head:\n> +        raise GitException, 'No for-merge remote head found in FETCH_HEAD'\n\nOK, I tried and it doesn't work with my StGIT over SVN configuration.\n\nWhat I did is defining 'pull-policy' as 'fetch-rebase', 'fetchcmd' as\n'git svn fetch' which doesn't create any FETCH_HEAD. The 'pullcmd' is\ndefined as 'git svn rebase' and it doesn't use any argument if\ngit.fetch_head() return None.\n\nI also think it is better for the pull command to re-raise the\ngit.fetch_head exception as this one contains more detailed\ninformation about the error (after the out.error call). It currently\nshows that the remote head couldn't be found but there is the multiple\nheads case raised by git.fetch_head.\n\n-- \nCatalin\n"}]}