##// END OF EJS Templates
util: add helper to define proxy functions to utils.*
Yuya Nishihara -
r37096:b3079fea default
parent child Browse files
Show More
@@ -4326,48 +4326,22 b' def uvarintdecodestream(fh):'
4326 4326 # Deprecation warnings for util.py splitting
4327 4327 ###
4328 4328
4329 def _deprecatedfunc(func, version):
4330 def wrapped(*args, **kwargs):
4331 fn = pycompat.sysbytes(func.__name__)
4332 mn = pycompat.sysbytes(func.__module__)[len('mercurial.'):]
4333 msg = "'util.%s' is deprecated, use '%s.%s'" % (fn, mn, fn)
4334 nouideprecwarn(msg, version)
4335 return func(*args, **kwargs)
4336 wrapped.__name__ = func.__name__
4337 return wrapped
4338
4329 4339 defaultdateformats = dateutil.defaultdateformats
4330
4331 4340 extendeddateformats = dateutil.extendeddateformats
4332
4333 def makedate(*args, **kwargs):
4334 msg = ("'util.makedate' is deprecated, "
4335 "use 'utils.dateutil.makedate'")
4336 nouideprecwarn(msg, "4.6")
4337 return dateutil.makedate(*args, **kwargs)
4338
4339 def datestr(*args, **kwargs):
4340 msg = ("'util.datestr' is deprecated, "
4341 "use 'utils.dateutil.datestr'")
4342 nouideprecwarn(msg, "4.6")
4343 return dateutil.datestr(*args, **kwargs)
4344
4345 def shortdate(*args, **kwargs):
4346 msg = ("'util.shortdate' is deprecated, "
4347 "use 'utils.dateutil.shortdate'")
4348 nouideprecwarn(msg, "4.6")
4349 return dateutil.shortdate(*args, **kwargs)
4350
4351 def parsetimezone(*args, **kwargs):
4352 msg = ("'util.parsetimezone' is deprecated, "
4353 "use 'utils.dateutil.parsetimezone'")
4354 nouideprecwarn(msg, "4.6")
4355 return dateutil.parsetimezone(*args, **kwargs)
4356
4357 def strdate(*args, **kwargs):
4358 msg = ("'util.strdate' is deprecated, "
4359 "use 'utils.dateutil.strdate'")
4360 nouideprecwarn(msg, "4.6")
4361 return dateutil.strdate(*args, **kwargs)
4362
4363 def parsedate(*args, **kwargs):
4364 msg = ("'util.parsedate' is deprecated, "
4365 "use 'utils.dateutil.parsedate'")
4366 nouideprecwarn(msg, "4.6")
4367 return dateutil.parsedate(*args, **kwargs)
4368
4369 def matchdate(*args, **kwargs):
4370 msg = ("'util.matchdate' is deprecated, "
4371 "use 'utils.dateutil.matchdate'")
4372 nouideprecwarn(msg, "4.6")
4373 return dateutil.matchdate(*args, **kwargs)
4341 makedate = _deprecatedfunc(dateutil.makedate, '4.6')
4342 datestr = _deprecatedfunc(dateutil.datestr, '4.6')
4343 shortdate = _deprecatedfunc(dateutil.shortdate, '4.6')
4344 parsetimezone = _deprecatedfunc(dateutil.parsetimezone, '4.6')
4345 strdate = _deprecatedfunc(dateutil.strdate, '4.6')
4346 parsedate = _deprecatedfunc(dateutil.parsedate, '4.6')
4347 matchdate = _deprecatedfunc(dateutil.matchdate, '4.6')
General Comments 0
You need to be logged in to leave comments. Login now