# HG changeset patch # User Paul Morelle # Date 1521671347 -3600 # Node ID 8f55daa87ce418a466c9b899a80d90b9df83b966 # Parent 666ab5997802fd23578092b5a8b2c402845f1c00 git-handler: fix deprecated API in next hg version https://phab.mercurial-scm.org/D2003 Mercurial version 4.6 will introduce a refactoring of the utils.py file into smaller files, starting with dateutil.py. This change prepares this move so that the warnings won't break the tests. diff -r 666ab5997802 -r 8f55daa87ce4 hggit/git_handler.py --- a/hggit/git_handler.py Tue May 01 10:28:16 2018 -0500 +++ b/hggit/git_handler.py Wed Mar 21 23:29:07 2018 +0100 @@ -54,6 +54,13 @@ RE_AUTHOR_FILE = re.compile('\s*=\s*') +# mercurial.utils.dateutil functions were in mercurial.util in Mercurial < 4.6 +try: + from mercurial.utils import dateutil + dateutil.parsedate +except ImportError: + dateutil = hgutil + CALLBACK_BUFFER = '' @@ -1312,7 +1319,7 @@ return refs # filter refs older than min_timestamp - min_timestamp, min_offset = hgutil.parsedate(min_date) + min_timestamp, min_offset = dateutil.parsedate(min_date) def check_min_time(obj): if isinstance(obj, Tag):