Mercurial > hg
annotate contrib/win32/mercurial.ini @ 27142:060f83d219b9
extensions: refuse to load extensions if minimum hg version not met
As the author of several 3rd party extensions, I frequently see bug
reports from users attempting to run my extension with an old version
of Mercurial that I no longer support in my extension. Oftentimes, the
extension will import just fine. But as soon as we run extsetup(),
reposetup(), or get into the guts of a wrapped function, we encounter
an exception and abort. Today, Mercurial will print a message about
extensions that don't have a "testedwith" declaring explicit
compatibility with the current version.
The existing mechanism is a good start. But it isn't as robust as I
would like. Specifically, Mercurial assumes compatibility by default.
This means extension authors must perform compatibility checking in
their extsetup() or we wait and see if we encounter an abort at
runtime. And, compatibility checking can involve a lot of code and
lots of error checking. It's a lot of effort for extension authors.
Oftentimes, extension authors know which versions of Mercurial there
extension works on and more importantly where it is broken.
This patch introduces a magic "minimumhgversion" attribute in
extensions. When found, the extension loading mechanism will compare
the declared version against the current Mercurial version. If the
extension explicitly states we require a newer Mercurial version, a
warning is printed and the extension isn't loaded beyond importing
the Python module. This causes a graceful failure while alerting
the user of the compatibility issue.
I would be receptive to the idea of making the failure more fatal.
However, care would need to be taken to not criple every hg command.
e.g. the user may use `hg config` to fix the hgrc and if we aborted
trying to run that, the user would effectively be locked out of `hg`!
A potential future improvement to this functionality would be to catch
ImportError for the extension/module and parse the source code for
"minimumhgversion = 'XXX'" and do similar checking. This way we could
give more information about why the extension failed to load.
author | Gregory Szorc <gregory.szorc@gmail.com> |
---|---|
date | Tue, 24 Nov 2015 15:16:25 -0800 |
parents | a5354990502d |
children | 5a3197cbe415 |
rev | line source |
---|---|
9322
81900431589f
mercurial.ini: provide more useful info
Steve Borho <steve@borho.org>
parents:
7663
diff
changeset
|
1 ; System-wide Mercurial config file. |
81900431589f
mercurial.ini: provide more useful info
Steve Borho <steve@borho.org>
parents:
7663
diff
changeset
|
2 ; |
81900431589f
mercurial.ini: provide more useful info
Steve Borho <steve@borho.org>
parents:
7663
diff
changeset
|
3 ; !!! Do Not Edit This File !!! |
81900431589f
mercurial.ini: provide more useful info
Steve Borho <steve@borho.org>
parents:
7663
diff
changeset
|
4 ; |
81900431589f
mercurial.ini: provide more useful info
Steve Borho <steve@borho.org>
parents:
7663
diff
changeset
|
5 ; This file will be replaced by the installer on every upgrade. |
81900431589f
mercurial.ini: provide more useful info
Steve Borho <steve@borho.org>
parents:
7663
diff
changeset
|
6 ; Editing this file can cause strange side effects on Vista. |
81900431589f
mercurial.ini: provide more useful info
Steve Borho <steve@borho.org>
parents:
7663
diff
changeset
|
7 ; |
81900431589f
mercurial.ini: provide more useful info
Steve Borho <steve@borho.org>
parents:
7663
diff
changeset
|
8 ; http://bitbucket.org/tortoisehg/stable/issue/135 |
81900431589f
mercurial.ini: provide more useful info
Steve Borho <steve@borho.org>
parents:
7663
diff
changeset
|
9 ; |
81900431589f
mercurial.ini: provide more useful info
Steve Borho <steve@borho.org>
parents:
7663
diff
changeset
|
10 ; To change settings you see in this file, override (or enable) them in |
81900431589f
mercurial.ini: provide more useful info
Steve Borho <steve@borho.org>
parents:
7663
diff
changeset
|
11 ; your user Mercurial.ini file, where USERNAME is your Windows user name: |
81900431589f
mercurial.ini: provide more useful info
Steve Borho <steve@borho.org>
parents:
7663
diff
changeset
|
12 ; |
81900431589f
mercurial.ini: provide more useful info
Steve Borho <steve@borho.org>
parents:
7663
diff
changeset
|
13 ; XP or older - C:\Documents and Settings\USERNAME\Mercurial.ini |
81900431589f
mercurial.ini: provide more useful info
Steve Borho <steve@borho.org>
parents:
7663
diff
changeset
|
14 ; Vista or later - C:\Users\USERNAME\Mercurial.ini |
81900431589f
mercurial.ini: provide more useful info
Steve Borho <steve@borho.org>
parents:
7663
diff
changeset
|
15 |
4749
778bab992732
Convert default mercurial.ini file to Windows line endings
Lee Cantey <lcantey@gmail.com>
parents:
3432
diff
changeset
|
16 |
5142 | 17 [ui] |
9322
81900431589f
mercurial.ini: provide more useful info
Steve Borho <steve@borho.org>
parents:
7663
diff
changeset
|
18 ; editor used to enter commit logs, etc. Most text editors will work. |
4749
778bab992732
Convert default mercurial.ini file to Windows line endings
Lee Cantey <lcantey@gmail.com>
parents:
3432
diff
changeset
|
19 editor = notepad |
7662
8aa338cd0df3
Update mercurial.ini file packaged in win32 installer
Pascal Quantin <pascal.quantin@wavecom.com>
parents:
5142
diff
changeset
|
20 ; show changed files and be a bit more verbose if True |
8aa338cd0df3
Update mercurial.ini file packaged in win32 installer
Pascal Quantin <pascal.quantin@wavecom.com>
parents:
5142
diff
changeset
|
21 ; verbose = True |
9322
81900431589f
mercurial.ini: provide more useful info
Steve Borho <steve@borho.org>
parents:
7663
diff
changeset
|
22 |
7662
8aa338cd0df3
Update mercurial.ini file packaged in win32 installer
Pascal Quantin <pascal.quantin@wavecom.com>
parents:
5142
diff
changeset
|
23 ; username data to appear in commits |
8aa338cd0df3
Update mercurial.ini file packaged in win32 installer
Pascal Quantin <pascal.quantin@wavecom.com>
parents:
5142
diff
changeset
|
24 ; it usually takes the form: Joe User <joe.user@host.com> |
8aa338cd0df3
Update mercurial.ini file packaged in win32 installer
Pascal Quantin <pascal.quantin@wavecom.com>
parents:
5142
diff
changeset
|
25 ; username = Joe User <j.user@example.com> |
8aa338cd0df3
Update mercurial.ini file packaged in win32 installer
Pascal Quantin <pascal.quantin@wavecom.com>
parents:
5142
diff
changeset
|
26 |
9322
81900431589f
mercurial.ini: provide more useful info
Steve Borho <steve@borho.org>
parents:
7663
diff
changeset
|
27 ; In order to push/pull over ssh you must specify an ssh tool |
81900431589f
mercurial.ini: provide more useful info
Steve Borho <steve@borho.org>
parents:
7663
diff
changeset
|
28 ;ssh = "C:\Progra~1\TortoiseSVN\bin\TortoisePlink.exe" -ssh -2 |
81900431589f
mercurial.ini: provide more useful info
Steve Borho <steve@borho.org>
parents:
7663
diff
changeset
|
29 ;ssh = C:\cygwin\bin\ssh |
4749
778bab992732
Convert default mercurial.ini file to Windows line endings
Lee Cantey <lcantey@gmail.com>
parents:
3432
diff
changeset
|
30 |
9322
81900431589f
mercurial.ini: provide more useful info
Steve Borho <steve@borho.org>
parents:
7663
diff
changeset
|
31 ; |
81900431589f
mercurial.ini: provide more useful info
Steve Borho <steve@borho.org>
parents:
7663
diff
changeset
|
32 ; For more information about mercurial extensions, start here |
81900431589f
mercurial.ini: provide more useful info
Steve Borho <steve@borho.org>
parents:
7663
diff
changeset
|
33 ; http://www.selenic.com/mercurial/wiki/index.cgi/UsingExtensions |
81900431589f
mercurial.ini: provide more useful info
Steve Borho <steve@borho.org>
parents:
7663
diff
changeset
|
34 ; |
81900431589f
mercurial.ini: provide more useful info
Steve Borho <steve@borho.org>
parents:
7663
diff
changeset
|
35 ; Extensions shipped with Mercurial |
81900431589f
mercurial.ini: provide more useful info
Steve Borho <steve@borho.org>
parents:
7663
diff
changeset
|
36 ; |
4749
778bab992732
Convert default mercurial.ini file to Windows line endings
Lee Cantey <lcantey@gmail.com>
parents:
3432
diff
changeset
|
37 [extensions] |
9322
81900431589f
mercurial.ini: provide more useful info
Steve Borho <steve@borho.org>
parents:
7663
diff
changeset
|
38 ;acl = |
19512
f84036df71ad
win32: update Inno Setup installer script and extensions list
Pascal Quantin <pascal.quantin@gmail.com>
parents:
17278
diff
changeset
|
39 ;blackbox = |
9322
81900431589f
mercurial.ini: provide more useful info
Steve Borho <steve@borho.org>
parents:
7663
diff
changeset
|
40 ;bugzilla = |
81900431589f
mercurial.ini: provide more useful info
Steve Borho <steve@borho.org>
parents:
7663
diff
changeset
|
41 ;children = |
81900431589f
mercurial.ini: provide more useful info
Steve Borho <steve@borho.org>
parents:
7663
diff
changeset
|
42 ;churn = |
81900431589f
mercurial.ini: provide more useful info
Steve Borho <steve@borho.org>
parents:
7663
diff
changeset
|
43 ;color = |
81900431589f
mercurial.ini: provide more useful info
Steve Borho <steve@borho.org>
parents:
7663
diff
changeset
|
44 ;convert = |
11269
5f01fd602542
win32text: mark this extension as deprecated
Martin Geisler <mg@aragost.com>
parents:
10474
diff
changeset
|
45 ;eol = |
9322
81900431589f
mercurial.ini: provide more useful info
Steve Borho <steve@borho.org>
parents:
7663
diff
changeset
|
46 ;extdiff = |
81900431589f
mercurial.ini: provide more useful info
Steve Borho <steve@borho.org>
parents:
7663
diff
changeset
|
47 ;fetch = |
81900431589f
mercurial.ini: provide more useful info
Steve Borho <steve@borho.org>
parents:
7663
diff
changeset
|
48 ;gpg = |
81900431589f
mercurial.ini: provide more useful info
Steve Borho <steve@borho.org>
parents:
7663
diff
changeset
|
49 ;hgcia = |
81900431589f
mercurial.ini: provide more useful info
Steve Borho <steve@borho.org>
parents:
7663
diff
changeset
|
50 ;hgk = |
81900431589f
mercurial.ini: provide more useful info
Steve Borho <steve@borho.org>
parents:
7663
diff
changeset
|
51 ;highlight = |
17278
ef5d70655143
win32: update Inno Setup installer extensions list
Pascal Quantin <pascal.quantin@gmail.com>
parents:
16242
diff
changeset
|
52 ;histedit = |
9322
81900431589f
mercurial.ini: provide more useful info
Steve Borho <steve@borho.org>
parents:
7663
diff
changeset
|
53 ;interhg = |
17278
ef5d70655143
win32: update Inno Setup installer extensions list
Pascal Quantin <pascal.quantin@gmail.com>
parents:
16242
diff
changeset
|
54 ;largefiles = |
9322
81900431589f
mercurial.ini: provide more useful info
Steve Borho <steve@borho.org>
parents:
7663
diff
changeset
|
55 ;keyword = |
81900431589f
mercurial.ini: provide more useful info
Steve Borho <steve@borho.org>
parents:
7663
diff
changeset
|
56 ;mq = |
81900431589f
mercurial.ini: provide more useful info
Steve Borho <steve@borho.org>
parents:
7663
diff
changeset
|
57 ;notify = |
81900431589f
mercurial.ini: provide more useful info
Steve Borho <steve@borho.org>
parents:
7663
diff
changeset
|
58 ;pager = |
81900431589f
mercurial.ini: provide more useful info
Steve Borho <steve@borho.org>
parents:
7663
diff
changeset
|
59 ;patchbomb = |
10474
601a9d67825a
Add progress extension to win32 default config file
Pascal Quantin <pascal.quantin@gmail.com>
parents:
9322
diff
changeset
|
60 ;progress = |
9322
81900431589f
mercurial.ini: provide more useful info
Steve Borho <steve@borho.org>
parents:
7663
diff
changeset
|
61 ;purge = |
81900431589f
mercurial.ini: provide more useful info
Steve Borho <steve@borho.org>
parents:
7663
diff
changeset
|
62 ;rebase = |
81900431589f
mercurial.ini: provide more useful info
Steve Borho <steve@borho.org>
parents:
7663
diff
changeset
|
63 ;record = |
17278
ef5d70655143
win32: update Inno Setup installer extensions list
Pascal Quantin <pascal.quantin@gmail.com>
parents:
16242
diff
changeset
|
64 ;relink = |
ef5d70655143
win32: update Inno Setup installer extensions list
Pascal Quantin <pascal.quantin@gmail.com>
parents:
16242
diff
changeset
|
65 ;schemes = |
ef5d70655143
win32: update Inno Setup installer extensions list
Pascal Quantin <pascal.quantin@gmail.com>
parents:
16242
diff
changeset
|
66 ;share = |
19946
b7aec4c881d1
win32: add shelve extension to mercurial.ini
Pascal Quantin <pascal.quantin@gmail.com>
parents:
19512
diff
changeset
|
67 ;shelve = |
9322
81900431589f
mercurial.ini: provide more useful info
Steve Borho <steve@borho.org>
parents:
7663
diff
changeset
|
68 ;transplant = |
81900431589f
mercurial.ini: provide more useful info
Steve Borho <steve@borho.org>
parents:
7663
diff
changeset
|
69 ;win32mbcs = |
81900431589f
mercurial.ini: provide more useful info
Steve Borho <steve@borho.org>
parents:
7663
diff
changeset
|
70 ;zeroconf = |
4749
778bab992732
Convert default mercurial.ini file to Windows line endings
Lee Cantey <lcantey@gmail.com>
parents:
3432
diff
changeset
|
71 |
9322
81900431589f
mercurial.ini: provide more useful info
Steve Borho <steve@borho.org>
parents:
7663
diff
changeset
|
72 ; |
81900431589f
mercurial.ini: provide more useful info
Steve Borho <steve@borho.org>
parents:
7663
diff
changeset
|
73 ; Define external diff commands |
81900431589f
mercurial.ini: provide more useful info
Steve Borho <steve@borho.org>
parents:
7663
diff
changeset
|
74 ; |
81900431589f
mercurial.ini: provide more useful info
Steve Borho <steve@borho.org>
parents:
7663
diff
changeset
|
75 [extdiff] |
81900431589f
mercurial.ini: provide more useful info
Steve Borho <steve@borho.org>
parents:
7663
diff
changeset
|
76 ;cmd.bc3diff = C:\Program Files\Beyond Compare 3\BCompare.exe |
81900431589f
mercurial.ini: provide more useful info
Steve Borho <steve@borho.org>
parents:
7663
diff
changeset
|
77 ;cmd.vdiff = C:\Progra~1\TortoiseSVN\bin\TortoiseMerge.exe |
81900431589f
mercurial.ini: provide more useful info
Steve Borho <steve@borho.org>
parents:
7663
diff
changeset
|
78 ;cmd.vimdiff = gvim.exe |
16242
55174ab81973
extdiff: escape filenames with vim/DirDiff and make quoting work with Windows
Thomas Arendsen Hein <thomas@intevation.de>
parents:
14159
diff
changeset
|
79 ;opts.vimdiff = -f "+next" "+execute 'DirDiff' fnameescape(argv(0)) fnameescape(argv(1))" |
9322
81900431589f
mercurial.ini: provide more useful info
Steve Borho <steve@borho.org>
parents:
7663
diff
changeset
|
80 |
81900431589f
mercurial.ini: provide more useful info
Steve Borho <steve@borho.org>
parents:
7663
diff
changeset
|
81 |
7663
b0a0eb28a933
Package hgk Tcl/Tk script in win32 installer
Pascal Quantin <pascal.quantin@wavecom.com>
parents:
7662
diff
changeset
|
82 [hgk] |
b0a0eb28a933
Package hgk Tcl/Tk script in win32 installer
Pascal Quantin <pascal.quantin@wavecom.com>
parents:
7662
diff
changeset
|
83 ; Replace the following with your path to hgk, uncomment it and |
9322
81900431589f
mercurial.ini: provide more useful info
Steve Borho <steve@borho.org>
parents:
7663
diff
changeset
|
84 ; install ActiveTcl (or another win32 port like tclkit) |
7663
b0a0eb28a933
Package hgk Tcl/Tk script in win32 installer
Pascal Quantin <pascal.quantin@wavecom.com>
parents:
7662
diff
changeset
|
85 ; path="C:\Program Files\Mercurial\Contrib\hgk.tcl" |
9322
81900431589f
mercurial.ini: provide more useful info
Steve Borho <steve@borho.org>
parents:
7663
diff
changeset
|
86 ; vdiff=vdiff |
81900431589f
mercurial.ini: provide more useful info
Steve Borho <steve@borho.org>
parents:
7663
diff
changeset
|
87 |
4749
778bab992732
Convert default mercurial.ini file to Windows line endings
Lee Cantey <lcantey@gmail.com>
parents:
3432
diff
changeset
|
88 |
9322
81900431589f
mercurial.ini: provide more useful info
Steve Borho <steve@borho.org>
parents:
7663
diff
changeset
|
89 ; |
81900431589f
mercurial.ini: provide more useful info
Steve Borho <steve@borho.org>
parents:
7663
diff
changeset
|
90 ; The git extended diff format can represent binary files, file |
81900431589f
mercurial.ini: provide more useful info
Steve Borho <steve@borho.org>
parents:
7663
diff
changeset
|
91 ; permission changes, and rename information that the normal patch format |
81900431589f
mercurial.ini: provide more useful info
Steve Borho <steve@borho.org>
parents:
7663
diff
changeset
|
92 ; cannot describe. However it is also not compatible with tools which |
81900431589f
mercurial.ini: provide more useful info
Steve Borho <steve@borho.org>
parents:
7663
diff
changeset
|
93 ; expect normal patches. so enable git patches at your own risk. |
81900431589f
mercurial.ini: provide more useful info
Steve Borho <steve@borho.org>
parents:
7663
diff
changeset
|
94 ; |
81900431589f
mercurial.ini: provide more useful info
Steve Borho <steve@borho.org>
parents:
7663
diff
changeset
|
95 [diff] |
81900431589f
mercurial.ini: provide more useful info
Steve Borho <steve@borho.org>
parents:
7663
diff
changeset
|
96 ;git = false |
81900431589f
mercurial.ini: provide more useful info
Steve Borho <steve@borho.org>
parents:
7663
diff
changeset
|
97 ;nodates = false |
7662
8aa338cd0df3
Update mercurial.ini file packaged in win32 installer
Pascal Quantin <pascal.quantin@wavecom.com>
parents:
5142
diff
changeset
|
98 |