Commits

David Golub  committed a6d1d44

hglib: properly handle the case where an older version of Mercurial is in use

  • Participants
  • Parent commits 38a0fe9
  • Branches stable

Comments (0)

Files changed (1)

File tortoisehg/util/hglib.py

     from mercurial.url import hidepassword, removeauth
 try:
     # hg >= 1.9
-    from mercurial.httpconnection import readauthforuri
+    from mercurial.httpconnection import readauthforuri as hgreadauthforuri
 except (ImportError, AttributeError):
     # hg <= 1.8
-    from mercurial.url import readauthforuri
+    from mercurial.url import readauthforuri as hgreadauthforuri
 try:
     # hg >= 1.9
     from mercurial.scmutil import revrange, expandpats, revpair, match, matchall
     from mercurial.cmdutil import revrange, expandpats, revpair, match, matchall
 demandimport.enable()
 
+def readauthforuri(ui, uri, user):
+    try:
+        return hgreadauthforuri(ui, uri, user)
+    except TypeError:
+        return hgreadauthforuri(ui, uri)
+
 def revsetmatch(ui, pattern):
     try:
         # hg >= 1.9