Show More
@@ -1060,6 +1060,16 b' class ui(object):' | |||||
1060 | self.write_err('%s at: %s:%s (%s)\n' |
|
1060 | self.write_err('%s at: %s:%s (%s)\n' | |
1061 | % ((msg,) + calframe[stacklevel][1:4])) |
|
1061 | % ((msg,) + calframe[stacklevel][1:4])) | |
1062 |
|
1062 | |||
|
1063 | def deprecwarn(self, msg, version): | |||
|
1064 | """issue a deprecation warning | |||
|
1065 | ||||
|
1066 | - msg: message explaining what is deprecated and how to upgrade, | |||
|
1067 | - version: last version where the API will be supported, | |||
|
1068 | """ | |||
|
1069 | msg += ("\n(compatibility will be dropped after Mercurial-%s," | |||
|
1070 | " update your code.)") % version | |||
|
1071 | self.develwarn(msg, stacklevel=2) | |||
|
1072 | ||||
1063 | class paths(dict): |
|
1073 | class paths(dict): | |
1064 | """Represents a collection of paths and their configs. |
|
1074 | """Represents a collection of paths and their configs. | |
1065 |
|
1075 |
@@ -47,6 +47,12 b'' | |||||
47 | > repair.strip(repo.ui, repo, [repo['.'].node()]) |
|
47 | > repair.strip(repo.ui, repo, [repo['.'].node()]) | |
48 | > finally: |
|
48 | > finally: | |
49 | > lo.release() |
|
49 | > lo.release() | |
|
50 | > @command('oldanddeprecated', [], '') | |||
|
51 | > def oldanddeprecated(ui, repo): | |||
|
52 | > """test deprecation warning API""" | |||
|
53 | > def foobar(ui): | |||
|
54 | > ui.deprecwarn('foorbar is deprecated, go shopping', '42.1337') | |||
|
55 | > foobar(ui) | |||
50 | > |
|
56 | > | |
51 | > def oldstylerevset(repo, subset, x): |
|
57 | > def oldstylerevset(repo, subset, x): | |
52 | > return list(subset) |
|
58 | > return list(subset) | |
@@ -114,5 +120,22 b'' | |||||
114 | $ hg log -r "oldstyle()" -T '{rev}\n' |
|
120 | $ hg log -r "oldstyle()" -T '{rev}\n' | |
115 | devel-warn: revset "oldstyle" use list instead of smartset, (upgrade your code) at: */mercurial/revset.py:* (mfunc) (glob) |
|
121 | devel-warn: revset "oldstyle" use list instead of smartset, (upgrade your code) at: */mercurial/revset.py:* (mfunc) (glob) | |
116 | 0 |
|
122 | 0 | |
|
123 | $ hg oldanddeprecated | |||
|
124 | devel-warn: foorbar is deprecated, go shopping | |||
|
125 | (compatibility will be dropped after Mercurial-42.1337, update your code.) at: $TESTTMP/buggylocking.py:53 (oldanddeprecated) | |||
117 |
|
126 | |||
|
127 | $ hg oldanddeprecated --traceback | |||
|
128 | devel-warn: foorbar is deprecated, go shopping | |||
|
129 | (compatibility will be dropped after Mercurial-42.1337, update your code.) at: | |||
|
130 | */hg:* in <module> (glob) | |||
|
131 | */mercurial/dispatch.py:* in run (glob) | |||
|
132 | */mercurial/dispatch.py:* in dispatch (glob) | |||
|
133 | */mercurial/dispatch.py:* in _runcatch (glob) | |||
|
134 | */mercurial/dispatch.py:* in _dispatch (glob) | |||
|
135 | */mercurial/dispatch.py:* in runcommand (glob) | |||
|
136 | */mercurial/dispatch.py:* in _runcommand (glob) | |||
|
137 | */mercurial/dispatch.py:* in checkargs (glob) | |||
|
138 | */mercurial/dispatch.py:* in <lambda> (glob) | |||
|
139 | */mercurial/util.py:* in check (glob) | |||
|
140 | $TESTTMP/buggylocking.py:* in oldanddeprecated (glob) | |||
118 |
$ |
|
141 | $ cd .. |
General Comments 0
You need to be logged in to leave comments.
Login now