Show More
@@ -11,6 +11,12 b' 1) in ~/.hgrc (or /etc/hgext/...)' | |||||
11 | ... |
|
11 | ... | |
12 | hgext.mercurial_keyring = /path/to/mercurial_keyring.py |
|
12 | hgext.mercurial_keyring = /path/to/mercurial_keyring.py | |
13 |
|
13 | |||
|
14 | ||||
|
15 | 2) Drop this file to hgext directory and in ~/.hgrc | |||
|
16 | ||||
|
17 | [extensions] | |||
|
18 | hgext.mercurial_keyring = | |||
|
19 | ||||
14 | """ |
|
20 | """ | |
15 |
|
21 | |||
16 | from mercurial import hg, repo, util |
|
22 | from mercurial import hg, repo, util | |
@@ -24,7 +30,7 b' import keyring' | |||||
24 | import getpass |
|
30 | import getpass | |
25 | from urlparse import urlparse |
|
31 | from urlparse import urlparse | |
26 |
|
32 | |||
27 |
KEYRING_ |
|
33 | KEYRING_SERVICE = "Mercurial" | |
28 |
|
34 | |||
29 | def monkeypatch_method(cls): |
|
35 | def monkeypatch_method(cls): | |
30 | def decorator(func): |
|
36 | def decorator(func): | |
@@ -44,9 +50,25 b' def find_user_password(self, realm, auth' | |||||
44 | # https://repo.machine.com/repos/apps/module?pairs=0000000000000000000000000000000000000000-0000000000000000000000000000000000000000&cmd=between |
|
50 | # https://repo.machine.com/repos/apps/module?pairs=0000000000000000000000000000000000000000-0000000000000000000000000000000000000000&cmd=between | |
45 | parsed_url = urlparse(authuri) |
|
51 | parsed_url = urlparse(authuri) | |
46 | base_url = "%s://%s%s" % (parsed_url.scheme, parsed_url.netloc, parsed_url.path) |
|
52 | base_url = "%s://%s%s" % (parsed_url.scheme, parsed_url.netloc, parsed_url.path) | |
47 |
|
||||
48 | print "find_user_password", realm, base_url |
|
53 | print "find_user_password", realm, base_url | |
49 |
|
54 | |||
50 | # return user, password |
|
55 | ||
51 | return None, None |
|
56 | # TODO: odczyt danych z cache w procesie | |
|
57 | ||||
|
58 | # TODO: odczyt danych już obecnych w keyring-u | |||
|
59 | ||||
|
60 | if not self.ui.interactive(): | |||
|
61 | raise util.Abort(_('mercurial_keyring: http authorization required')) | |||
|
62 | self.ui.write(_("http authorization required\n")) | |||
|
63 | self.ui.status(_("realm: %s, url: %s\n" % (realm, base_url))) | |||
|
64 | username = self.ui.prompt(_("user:"), default = None) | |||
|
65 | password = self.ui.getpass(_("password for user %s:" % username)) | |||
52 |
|
66 | |||
|
67 | # TODO: zapis w keyringu | |||
|
68 | ||||
|
69 | # TODO: zapis w cache w procesie | |||
|
70 | ||||
|
71 | ||||
|
72 | return username, password | |||
|
73 | #return None, None | |||
|
74 |
General Comments 0
You need to be logged in to leave comments.
Login now