##// END OF EJS Templates
Docs with respect to meu
Marcin Kasperski -
r164:08bc236c default
parent child Browse files
Show More
@@ -1,206 +1,222 b''
1 .. -*- mode: rst -*-
1 .. -*- mode: rst; compile-command: "rst2html README.txt README.html" -*-
2
2
3 =================
3 =================
4 mercurial_keyring
4 mercurial_keyring
5 =================
5 =================
6
6
7 ``mercurial_keyring`` is a Mercurial_ extension used to securely save
7 ``mercurial_keyring`` is a Mercurial_ extension used to securely save
8 HTTP and SMTP authentication passwords in password databases (Gnome
8 HTTP and SMTP authentication passwords in password databases (Gnome
9 Keyring, KDE KWallet, OSXKeyChain, specific solutions for Win32 and
9 Keyring, KDE KWallet, OSXKeyChain, specific solutions for Win32 and
10 command line). This extension uses and wraps services of the keyring_
10 command line). This extension uses and wraps services of the keyring_
11 library.
11 library.
12
12
13 .. _keyring: http://pypi.python.org/pypi/keyring
13 .. _keyring: http://pypi.python.org/pypi/keyring
14 .. _Mercurial: http://mercurial.selenic.com
14 .. _Mercurial: http://mercurial.selenic.com
15
15
16 How does it work
16 How does it work
17 ================
17 ================
18
18
19 The extension prompts for the password on the first pull/push (in case
19 The extension prompts for the password on the first pull/push (in case
20 of HTTP) or first email (in case of SMTP), just like it is done by
20 of HTTP) or first email (in case of SMTP), just like it is done by
21 default, but saves the password. On successive runs it checks for the
21 default, but saves the password in password database. On successive
22 username in ``.hg/hgrc``, then for suitable password in the password
22 runs, whenever the password is needed, it checks for the username in
23 database, and uses those credentials (if found).
23 ``.hg/hgrc``, then for suitable password in the password database, and
24 uses those credentials (if found).
24
25
25 In case password turns out to be incorrect (either because it was
26 In case password turns out to be incorrect (either because it was
26 invalid, or because it was changed on the server) or missing it just
27 invalid, or because it was changed on the server) or missing, it just
27 prompts the user again.
28 prompts the user again.
28
29
29 Passwords are identified by the combination of username and remote
30 Passwords are identified by the combination of username and remote
30 address, so they can be reused between repositories if they access the
31 address, so they can be reused between repositories if they access the
31 same remote repository (or the same SMTP server).
32 same remote repository (or the same SMTP server).
32
33
33 Installation
34 Installation
34 ============
35 ============
35
36
36 Prerequisites
37 Prerequisites
37 -------------
38 -------------
38
39
39 Install the keyring_ library:
40 This extension requires keyring_ and `mercurial_extension_utils`_ to
41 work. In many cases both will be installed automatically while you
42 install `mercurial_keyring`_, but you may need to control the process.
43
44 The keyring_ library can usually be installed by::
40
45
41 ::
46 pip install --user keyring
42
47
43 easy_install keyring
48 (or ``easy_install keyring``), but on some systems it is preferable to
49 use official distribution archive. For example, on Debian and Ubuntu,
50 you may install ``python-keyring`` and either ``python-keyring-gnome``
51 or ``python-keyring-kwallet`` packages::
44
52
45 (or ``pip keyring``). On Debian "Sid" the library can be also
53 sudo apt-get install python-keyring python-keyring-gnome
46 installed from the official archive (packages ``python-keyring``
54
47 and either ``python-keyring-gnome`` or ``python-keyring-kwallet``).
55 (this will save you the need to provide working compiler and various
56 development libraries).
48
57
49 Note: keyring >= 0.3 is strongly recommended, especially in case text
58 The `mercurial_extension_utils`_ module is tiny Python-only module,
50 backend is to be used.
59 which can be installed by::
51
60
52 .. _this keyring fork: https://bitbucket.org/sborho/python-keyring-lib
61 pip install --user mercurial_extension_utils
62
63 but in some cases (Windows…) require more care. See `mercurial_extension_utils`_ documentation.
64
53
65
54 Extension installation
66 Extension installation
55 ----------------------
67 ----------------------
56
68
57 There are two possible ways of installing the extension: using PyPi package,
69 There are two possible ways of installing the extension: using PyPi package,
58 or using individual file.
70 or using source clone.
59
71
60 To install as a package use ``easy_install``:
72 To install as a package::
61
62 ::
63
73
64 easy_install mercurial_keyring
74 pip install --user mercurial_keyring
65
75
66 and then enable it in ``~/.hgrc`` (or ``/etc/mercurial/hgrc``) using:
76 (or ``sudo pip install mercurial_keyring`` for system-wide
67
77 installation) and then enable it in ``~/.hgrc`` (or
68 ::
78 ``/etc/mercurial/hgrc`` or ``Mercurial.ini``) using::
69
79
70 [extensions]
80 [extensions]
71 mercurial_keyring =
81 mercurial_keyring =
72
82
73 To install using individual file, download the
83 To install as source clone, install keyring_ according to instructions above, then
74 `mercurial_keyring.py`_ file, save it anywhere you like, and
84 clone::
75 put the following in ``~/.hgrc`` (or ``/etc/mercurial/hgrc``):
85
86 hg clone https://bitbucket.org/Mekk/mercurial_keyring/
87 hg clone https://bitbucket.org/Mekk/mercurial-extension_utils/
76
88
77 ::
89 and configure Mercurial by telling it full path to the extension
90 (in )::
78
91
79 [extensions]
92 [extensions]
80 hgext.mercurial_keyring = /path/to/mercurial_keyring.py
93 mercurial_keyring = /path/to/mercurial_keyring/mercurial_keyring.py
81
94
82 .. _the code:
95 .. _the code:
83 .. _mercurial_keyring.py: http://bitbucket.org/Mekk/mercurial_keyring/src/tip/mercurial_keyring.py
96 .. _mercurial_keyring.py: http://bitbucket.org/Mekk/mercurial_keyring/src/tip/mercurial_keyring.py
84
97
85 Password backend configuration
98 Password backend configuration
86 ==============================
99 ==============================
87
100
88 The library should usually pick the most appropriate password backend
101 The library should usually pick the most appropriate password backend
89 without configuration. Still, if necessary, it can be configured using
102 without configuration. Still, if necessary, it can be configured using
90 ``~/keyringrc.cfg`` file (``keyringrc.cfg`` in the home directory of
103 ``~/keyringrc.cfg`` file (``keyringrc.cfg`` in the home directory of
91 the current user). Refer to keyring_ docs for more details.
104 the current user). Refer to keyring_ docs for more details.
92
105
93 *I considered handling similar options in hgrc, but decided that
106 *I considered handling similar options in hgrc, but decided that
94 single user may use more than one keyring-based script. Still, I am
107 single user may use more than one keyring-based script. Still, I am
95 open to suggestions.*
108 open to suggestions.*
96
109
97 Repository configuration (HTTP)
110 Repository configuration (HTTP)
98 ===============================
111 ===============================
99
112
100 Edit repository-local ``.hg/hgrc`` and save there the remote
113 Edit repository-local ``.hg/hgrc`` and save there the remote
101 repository path and the username, but do not save the password. For
114 repository path and the username, but do not save the password. For
102 example:
115 example:
103
116
104 ::
117 ::
105
118
106 [paths]
119 [paths]
107 myremote = https://my.server.com/hgrepo/someproject
120 myremote = https://my.server.com/hgrepo/someproject
108
121
109 [auth]
122 [auth]
110 myremote.schemes = http https
123 myremote.schemes = http https
111 myremote.prefix = my.server.com/hgrepo
124 myremote.prefix = my.server.com/hgrepo
112 myremote.username = mekk
125 myremote.username = mekk
113
126
114 Simpler form with url-embedded name can also be used:
127 Simpler form with url-embedded name can also be used:
115
128
116 ::
129 ::
117
130
118 [paths]
131 [paths]
119 bitbucket = https://User@bitbucket.org/User/project_name/
132 bitbucket = https://User@bitbucket.org/User/project_name/
120
133
121 If prefix is specified, it is used to identify the password (so all
134 If prefix is specified, it is used to identify the password (so all
122 repositories with the same prefix and the same username will share the
135 repositories with the same prefix and the same username will share the
123 same password). Otherwise full repository URL is used for this
136 same password). Otherwise full repository URL is used for this
124 purpose.
137 purpose.
125
138
126 Note: if both username and password are given in ``.hg/hgrc``,
139 Note: if both username and password are given in ``.hg/hgrc``,
127 extension will use them without using the password database. If
140 extension will use them without using the password database. If
128 username is not given, extension will prompt for credentials every
141 username is not given, extension will prompt for credentials every
129 time, also without saving the password.
142 time, also without saving the password.
130
143
131 Finally, if you are consistent about remote repository nicknames,
144 Finally, if you are consistent about remote repository nicknames,
132 you can configure the username in your `~/.hgrc` (`.hgrc` in your
145 you can configure the username in your `~/.hgrc` (`.hgrc` in your
133 home directory). For example, write there::
146 home directory). For example, write there::
134
147
135 [auth]
148 [auth]
136 acme.prefix = hg.acme.com/repositories
149 acme.prefix = hg.acme.com/repositories
137 acme.username = johnny
150 acme.username = johnny
138 acme.schemes = http https
151 acme.schemes = http https
139
152
140 and as long as you will be using alias `acme` for repositories like
153 and as long as you will be using alias `acme` for repositories like
141 `https://hg.acme.com/repositories/my_beautiful_app`, username
154 `https://hg.acme.com/repositories/my_beautiful_app`, username
142 `johnnny` will be used, and the same password reused.
155 `johnnny` will be used, and the same password reused.
143
156
144 The advantage of this method is that it works also for `clone`.
157 The advantage of this method is that it works also for `clone`.
145
158
146 Repository configuration (SMTP)
159 Repository configuration (SMTP)
147 ===============================
160 ===============================
148
161
149 Edit either repository-local ``.hg/hgrc``, or ``~/.hgrc`` and set
162 Edit either repository-local ``.hg/hgrc``, or ``~/.hgrc`` and set
150 there all standard email and smtp properties, including SMTP
163 there all standard email and smtp properties, including SMTP
151 username, but without SMTP password. For example:
164 username, but without SMTP password. For example:
152
165
153 ::
166 ::
154
167
155 [email]
168 [email]
156 method = smtp
169 method = smtp
157 from = Joe Doe <Joe.Doe@remote.com>
170 from = Joe Doe <Joe.Doe@remote.com>
158
171
159 [smtp]
172 [smtp]
160 host = smtp.gmail.com
173 host = smtp.gmail.com
161 port = 587
174 port = 587
162 username = JoeDoe@gmail.com
175 username = JoeDoe@gmail.com
163 tls = true
176 tls = true
164
177
165 Just as in case of HTTP, you *must* set username, but *must not* set
178 Just as in case of HTTP, you *must* set username, but *must not* set
166 password here to use the extension, in other cases it will revert to
179 password here to use the extension, in other cases it will revert to
167 the default behavior.
180 the default behavior.
168
181
169 Usage
182 Usage
170 =====
183 =====
171
184
172 Configure the repository as above, then just ``hg pull``, ``hg push``,
185 Configure the repository as above, then just ``hg pull``, ``hg push``,
173 etc. You should be asked for the password only once (per every
186 etc. You should be asked for the password only once (per every
174 username and remote repository prefix or url combination).
187 username and remote repository prefix or url combination).
175
188
176
189
177 Similarly, for email, configure as above and just ``hg email``.
190 Similarly, for email, configure as above and just ``hg email``.
178 Again, you will be asked for the password once (per every username and
191 Again, you will be asked for the password once (per every username and
179 email server address combination).
192 email server address combination).
180
193
181 Implementation details
194 Implementation details
182 ======================
195 ======================
183
196
184 The extension is monkey-patching the mercurial ``passwordmgr`` class
197 The extension is monkey-patching the mercurial ``passwordmgr`` class
185 to replace the find_user_password method. Detailed order of operations
198 to replace the find_user_password method. Detailed order of operations
186 is described in the comments inside `the code`_.
199 is described in the comments inside `the code`_.
187
200
188 History
201 History
189 ==========
202 ==========
190
203
191 See `HISTORY.txt`_.
204 See `HISTORY.txt`_.
192
205
193 Development
206 Development
194 ===========
207 ===========
195
208
196 Development is tracked on BitBucket, see
209 Development is tracked on BitBucket, see
197 http://bitbucket.org/Mekk/mercurial_keyring/
210 http://bitbucket.org/Mekk/mercurial_keyring/
198
211
199
212
200 Additional notes
213 Additional notes
201 ================
214 ================
202
215
203 Information about this extension is also available
216 Information about this extension is also available
204 on Mercurial Wiki: http://mercurial.selenic.com/wiki/KeyringExtension
217 on Mercurial Wiki: http://mercurial.selenic.com/wiki/KeyringExtension
205
218
206 .. _HISTORY.txt: http://bitbucket.org/Mekk/mercurial_keyring/src/tip/HISTORY.txt
219 .. _HISTORY.txt: http://bitbucket.org/Mekk/mercurial_keyring/src/tip/HISTORY.txt
220 .. _TortoiseHg: http://tortoisehg.bitbucket.org/
221 .. _Mercurial: http://mercurial.selenic.com
222 .. _mercurial_extension_utils: https://bitbucket.org/Mekk/mercurial-extension_utils/
@@ -1,42 +1,42 b''
1
1
2 VERSION = '0.7.1'
2 VERSION = '0.7.1'
3
3
4 # pylint: disable=unused-import
4 # pylint: disable=unused-import
5
5
6 try:
6 try:
7 from setuptools import setup, find_packages
7 from setuptools import setup, find_packages
8 except ImportError:
8 except ImportError:
9 from ez_setup import use_setuptools
9 from ez_setup import use_setuptools
10 use_setuptools()
10 use_setuptools()
11 from setuptools import setup, find_packages
11 from setuptools import setup, find_packages
12
12
13 LONG_DESCRIPTION = open("README.txt").read()
13 LONG_DESCRIPTION = open("README.txt").read()
14
14
15 setup(
15 setup(
16 name="mercurial_keyring",
16 name="mercurial_keyring",
17 version=VERSION,
17 version=VERSION,
18 author='Marcin Kasperski',
18 author='Marcin Kasperski',
19 author_email='Marcin.Kasperski@mekk.waw.pl',
19 author_email='Marcin.Kasperski@mekk.waw.pl',
20 url='http://bitbucket.org/Mekk/mercurial_keyring',
20 url='http://bitbucket.org/Mekk/mercurial_keyring',
21 description='Mercurial Keyring Extension',
21 description='Mercurial Keyring Extension',
22 long_description=LONG_DESCRIPTION,
22 long_description=LONG_DESCRIPTION,
23 license='BSD',
23 license='BSD',
24 py_modules=['mercurial_keyring'],
24 py_modules=['mercurial_keyring'],
25 keywords="mercurial hg keyring password",
25 keywords="mercurial hg keyring password",
26 classifiers=[
26 classifiers=[
27 'Development Status :: 4 - Beta',
27 'Development Status :: 4 - Beta',
28 'Environment :: Console',
28 'Environment :: Console',
29 'Intended Audience :: Developers',
29 'Intended Audience :: Developers',
30 'License :: DFSG approved',
30 'License :: DFSG approved',
31 'License :: OSI Approved :: BSD License',
31 'License :: OSI Approved :: BSD License',
32 'Operating System :: OS Independent',
32 'Operating System :: OS Independent',
33 'Topic :: Software Development :: Libraries',
33 'Topic :: Software Development :: Libraries',
34 'Topic :: Software Development :: Libraries :: Python Modules',
34 'Topic :: Software Development :: Libraries :: Python Modules',
35 'Topic :: Software Development :: Version Control'
35 'Topic :: Software Development :: Version Control'
36 ],
36 ],
37 install_requires=[
37 install_requires=[
38 'keyring>=0.3',
38 'keyring>=0.3',
39 'mercurial_extension_utils>=0.9.0',
39 'mercurial_extension_utils>=0.10.0',
40 ],
40 ],
41 zip_safe=True,
41 zip_safe=True,
42 )
42 )
General Comments 0
You need to be logged in to leave comments. Login now