equal
deleted
inserted
replaced
45 |
45 |
46 ''' |
46 ''' |
47 |
47 |
48 from mercurial.i18n import _ |
48 from mercurial.i18n import _ |
49 from mercurial.url import passwordmgr |
49 from mercurial.url import passwordmgr |
50 from mercurial import httpconnection, util |
50 from mercurial import httpconnection, error |
51 import os, urllib2 |
51 import os, urllib2 |
52 |
52 |
53 ERRMAX = 128 |
53 ERRMAX = 128 |
54 |
54 |
55 _executable = _mountpoint = _service = None |
55 _executable = _mountpoint = _service = None |
56 |
56 |
57 def auth_getkey(self, params): |
57 def auth_getkey(self, params): |
58 if not self.ui.interactive(): |
58 if not self.ui.interactive(): |
59 raise util.Abort(_('factotum not interactive')) |
59 raise error.Abort(_('factotum not interactive')) |
60 if 'user=' not in params: |
60 if 'user=' not in params: |
61 params = '%s user?' % params |
61 params = '%s user?' % params |
62 params = '%s !password?' % params |
62 params = '%s !password?' % params |
63 os.system("%s -g '%s'" % (_executable, params)) |
63 os.system("%s -g '%s'" % (_executable, params)) |
64 |
64 |
75 if status == 'ok': |
75 if status == 'ok': |
76 if passwd.startswith("'"): |
76 if passwd.startswith("'"): |
77 if passwd.endswith("'"): |
77 if passwd.endswith("'"): |
78 passwd = passwd[1:-1].replace("''", "'") |
78 passwd = passwd[1:-1].replace("''", "'") |
79 else: |
79 else: |
80 raise util.Abort(_('malformed password string')) |
80 raise error.Abort(_('malformed password string')) |
81 return (user, passwd) |
81 return (user, passwd) |
82 except (OSError, IOError): |
82 except (OSError, IOError): |
83 raise util.Abort(_('factotum not responding')) |
83 raise error.Abort(_('factotum not responding')) |
84 finally: |
84 finally: |
85 os.close(fd) |
85 os.close(fd) |
86 getkey(self, params) |
86 getkey(self, params) |
87 |
87 |
88 def monkeypatch_method(cls): |
88 def monkeypatch_method(cls): |