diff hggit/git_handler.py @ 391:9b6597b70839

Improve error reporting in get_refs With this patch, attempts to push (or run outgoing) to read-only git URLs at github return github's helpful error message instead of just saying the remote end hung up.
author Brendan Cully <brendan@kublai.com>
date Tue, 17 May 2011 16:26:13 -0700
parents ed28dd69df61
children 8bb058d6a9ee
line wrap: on
line diff
--- a/hggit/git_handler.py	Sun May 15 17:04:05 2011 -0500
+++ b/hggit/git_handler.py	Tue May 17 16:26:13 2011 -0700
@@ -1,6 +1,6 @@
 import os, math, urllib, re
 
-from dulwich.errors import HangupException
+from dulwich.errors import HangupException, GitProtocolError
 from dulwich.index import commit_tree
 from dulwich.objects import Blob, Commit, Tag, Tree, parse_timezone
 from dulwich.pack import create_delta, apply_delta
@@ -151,8 +151,8 @@
                        for r in old_refs)
 
             return old, new
-        except HangupException:
-            raise hgutil.Abort("the remote end hung up unexpectedly")
+        except (HangupException, GitProtocolError), e:
+            raise hgutil.Abort(_("git remote error: ") + str(e))
 
     def push(self, remote, revs, force):
         self.export_commits()