changeset 992:92d7702c19da

compat: add method for backwards compatible passwordmgr
author Sean Farley <sean@farley.io>
date Thu, 04 Aug 2016 14:16:06 -0700
parents 66336cb849b4
children 05c8aa7d3edc
files hggit/compat.py
diffstat 1 files changed, 13 insertions(+), 0 deletions(-) [+]
line wrap: on
line diff
--- a/hggit/compat.py
+++ b/hggit/compat.py
@@ -1,3 +1,8 @@
+from mercurial import (
+    url,
+    util as hgutil,
+)
+
 try:
     from mercurial import encoding
     hfsignoreclean = encoding.hfsignoreclean
@@ -22,3 +27,11 @@
             for c in _ignore:
                 s = s.replace(c, '')
         return s
+
+def passwordmgr(ui, passwddb):
+    try:
+        return url.passwordmgr(ui,
+                               hgutil.urlreq.httppasswordmgrwithdefaultrealm())
+    except TypeError:
+        # compat with hg < 3.9
+        return url.passwordmgr(ui)