Mercurial > hg
comparison tests/test-extension.t @ 28623:38dc3f28f478
dispatch: show deprecation warning if command has no attributes (issue5137)
norepo/optionalrepo/inferrepo were removed by aa73d6a5d9ea, which would be
significant API change. This patch tries to avoid crash even if ancient
third-party extensions are enabled.
author | Yuya Nishihara <yuya@tcha.org> |
---|---|
date | Sat, 09 Jan 2016 22:46:26 +0900 |
parents | 6fb1d3c936d2 |
children | a3e5e1fb257c |
comparison
equal
deleted
inserted
replaced
28622:527cf881d000 | 28623:38dc3f28f478 |
---|---|
1201 C sub2/sub21/21 | 1201 C sub2/sub21/21 |
1202 C sub3/3 | 1202 C sub3/3 |
1203 | 1203 |
1204 $ cd .. | 1204 $ cd .. |
1205 | 1205 |
1206 Test compatibility with extension commands that don't use @command (issue5137) | |
1207 | |
1208 $ hg init deprecated | |
1209 $ cd deprecated | |
1210 | |
1211 $ cat <<EOF > deprecatedcmd.py | |
1212 > def deprecatedcmd(repo, ui): | |
1213 > pass | |
1214 > cmdtable = { | |
1215 > 'deprecatedcmd': (deprecatedcmd, [], ''), | |
1216 > } | |
1217 > EOF | |
1218 $ cat <<EOF > .hg/hgrc | |
1219 > [extensions] | |
1220 > deprecatedcmd = `pwd`/deprecatedcmd.py | |
1221 > mq = ! | |
1222 > hgext.mq = ! | |
1223 > hgext/mq = ! | |
1224 > [alias] | |
1225 > deprecatedalias = deprecatedcmd | |
1226 > EOF | |
1227 | |
1228 $ hg deprecatedcmd | |
1229 devel-warn: missing attribute 'norepo', use @command decorator to register 'deprecatedcmd' | |
1230 (compatibility will be dropped after Mercurial-3.8, update your code.) at: * (glob) | |
1231 | |
1232 $ hg deprecatedalias | |
1233 devel-warn: missing attribute 'norepo', use @command decorator to register 'deprecatedalias' | |
1234 (compatibility will be dropped after Mercurial-3.8, update your code.) at: * (glob) | |
1235 | |
1236 no warning unless command is executed: | |
1237 | |
1238 $ hg paths | |
1239 | |
1240 but mq iterates over command table: | |
1241 | |
1242 $ hg --config extensions.mq= paths | |
1243 devel-warn: missing attribute 'norepo', use @command decorator to register 'deprecatedcmd' | |
1244 (compatibility will be dropped after Mercurial-3.8, update your code.) at: * (glob) | |
1245 | |
1246 $ cd .. | |
1247 | |
1206 Test synopsis and docstring extending | 1248 Test synopsis and docstring extending |
1207 | 1249 |
1208 $ hg init exthelp | 1250 $ hg init exthelp |
1209 $ cat > exthelp.py <<EOF | 1251 $ cat > exthelp.py <<EOF |
1210 > from mercurial import commands, extensions | 1252 > from mercurial import commands, extensions |