comparison tests/test-extension.t @ 23871:b2d8f3685b06

dispatch: only check compatibility against major and minor versions (BC) Extensions can declare compatibility with Mercurial versions. If an error occurs, Mercurial will attempt to pin blame on an extension that isn't marked as compatible. While all bets are off when it comes to the internal API, my experience has shown that a monthly/patch release of Mercurial has never broken any of the extensions I've written. I think that expecting extensions to declare compatibility with every patch release of Mercurial is asking a bit much and adds little to no value. This patch changes the blame logic from exact version matching to only match on the major and minor Mercurial versions. This means that extensions only need to mark themselves as compatible with the major, quarterly releases and not the monthly ones in order to stay current and avoid what is almost certainly unfair blame. This will mean less work for extension authors and almost certainly fewer false positives in the blame attribution.
author Gregory Szorc <gregory.szorc@gmail.com>
date Thu, 15 Jan 2015 20:36:03 -0800
parents 9070e20057ae
children 042d95beeee8
comparison
equal deleted inserted replaced
23870:9070e20057ae 23871:b2d8f3685b06
856 abort: no such help topic: foo 856 abort: no such help topic: foo
857 (try "hg help --keyword foo") 857 (try "hg help --keyword foo")
858 [255] 858 [255]
859 859
860 $ cat > throw.py <<EOF 860 $ cat > throw.py <<EOF
861 > from mercurial import cmdutil, commands 861 > from mercurial import cmdutil, commands, util
862 > cmdtable = {} 862 > cmdtable = {}
863 > command = cmdutil.command(cmdtable) 863 > command = cmdutil.command(cmdtable)
864 > class Bogon(Exception): pass 864 > class Bogon(Exception): pass
865 > @command('throw', [], 'hg throw', norepo=True) 865 > @command('throw', [], 'hg throw', norepo=True)
866 > def throw(ui, **opts): 866 > def throw(ui, **opts):
908 $ echo "testedwith = '2.1.1'" >> throw.py 908 $ echo "testedwith = '2.1.1'" >> throw.py
909 $ rm -f throw.pyc throw.pyo 909 $ rm -f throw.pyc throw.pyo
910 $ hg --config extensions.throw=throw.py --config extensions.older=older.py \ 910 $ hg --config extensions.throw=throw.py --config extensions.older=older.py \
911 > throw 2>&1 | egrep '^\*\*' 911 > throw 2>&1 | egrep '^\*\*'
912 ** Unknown exception encountered with possibly-broken third-party extension older 912 ** Unknown exception encountered with possibly-broken third-party extension older
913 ** which supports versions 1.9.3 of Mercurial. 913 ** which supports versions 1.9 of Mercurial.
914 ** Please disable older and try your action again. 914 ** Please disable older and try your action again.
915 ** If that fixes the bug please report it to the extension author. 915 ** If that fixes the bug please report it to the extension author.
916 ** Python * (glob) 916 ** Python * (glob)
917 ** Mercurial Distributed SCM (version 2.2) 917 ** Mercurial Distributed SCM (version 2.2)
918 ** Extensions loaded: throw, older 918 ** Extensions loaded: throw, older
921 $ echo "util.version = lambda:'2.1'" >> older.py 921 $ echo "util.version = lambda:'2.1'" >> older.py
922 $ rm -f older.pyc older.pyo 922 $ rm -f older.pyc older.pyo
923 $ hg --config extensions.throw=throw.py --config extensions.older=older.py \ 923 $ hg --config extensions.throw=throw.py --config extensions.older=older.py \
924 > throw 2>&1 | egrep '^\*\*' 924 > throw 2>&1 | egrep '^\*\*'
925 ** Unknown exception encountered with possibly-broken third-party extension older 925 ** Unknown exception encountered with possibly-broken third-party extension older
926 ** which supports versions 1.9.3 of Mercurial. 926 ** which supports versions 1.9 of Mercurial.
927 ** Please disable older and try your action again. 927 ** Please disable older and try your action again.
928 ** If that fixes the bug please report it to the extension author. 928 ** If that fixes the bug please report it to the extension author.
929 ** Python * (glob) 929 ** Python * (glob)
930 ** Mercurial Distributed SCM (version 2.1) 930 ** Mercurial Distributed SCM (version 2.1)
931 ** Extensions loaded: throw, older 931 ** Extensions loaded: throw, older
934 $ echo "util.version = lambda:'1.9.3'" >> older.py 934 $ echo "util.version = lambda:'1.9.3'" >> older.py
935 $ rm -f older.pyc older.pyo 935 $ rm -f older.pyc older.pyo
936 $ hg --config extensions.throw=throw.py --config extensions.older=older.py \ 936 $ hg --config extensions.throw=throw.py --config extensions.older=older.py \
937 > throw 2>&1 | egrep '^\*\*' 937 > throw 2>&1 | egrep '^\*\*'
938 ** Unknown exception encountered with possibly-broken third-party extension throw 938 ** Unknown exception encountered with possibly-broken third-party extension throw
939 ** which supports versions 2.1.1 of Mercurial. 939 ** which supports versions 2.1 of Mercurial.
940 ** Please disable throw and try your action again. 940 ** Please disable throw and try your action again.
941 ** If that fixes the bug please report it to http://example.com/bts 941 ** If that fixes the bug please report it to http://example.com/bts
942 ** Python * (glob) 942 ** Python * (glob)
943 ** Mercurial Distributed SCM (version 1.9.3) 943 ** Mercurial Distributed SCM (version 1.9.3)
944 ** Extensions loaded: throw, older 944 ** Extensions loaded: throw, older
945 945
946 Declare the version as supporting this hg version, show regular bts link: 946 Declare the version as supporting this hg version, show regular bts link:
947 $ hgver=`$PYTHON -c 'from mercurial import util; print util.version().split("+")[0]'` 947 $ hgver=`$PYTHON -c 'from mercurial import util; print util.version().split("+")[0]'`
948 $ echo 'testedwith = """'"$hgver"'"""' >> throw.py 948 $ echo 'testedwith = """'"$hgver"'"""' >> throw.py
949 $ rm -f throw.pyc throw.pyo
950 $ hg --config extensions.throw=throw.py throw 2>&1 | egrep '^\*\*'
951 ** unknown exception encountered, please report by visiting
952 ** http://mercurial.selenic.com/wiki/BugTracker
953 ** Python * (glob)
954 ** Mercurial Distributed SCM (*) (glob)
955 ** Extensions loaded: throw
956
957 Patch version is ignored during compatibility check
958 $ echo "testedwith = '3.2'" >> throw.py
959 $ echo "util.version = lambda:'3.2.2'" >> throw.py
949 $ rm -f throw.pyc throw.pyo 960 $ rm -f throw.pyc throw.pyo
950 $ hg --config extensions.throw=throw.py throw 2>&1 | egrep '^\*\*' 961 $ hg --config extensions.throw=throw.py throw 2>&1 | egrep '^\*\*'
951 ** unknown exception encountered, please report by visiting 962 ** unknown exception encountered, please report by visiting
952 ** http://mercurial.selenic.com/wiki/BugTracker 963 ** http://mercurial.selenic.com/wiki/BugTracker
953 ** Python * (glob) 964 ** Python * (glob)