comparison hggit/git_handler.py @ 1125:8f55daa87ce4

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.
author Paul Morelle <paul.morelle@octobus.net>
date Wed, 21 Mar 2018 23:29:07 +0100
parents 666ab5997802
children 108d9303ef71
comparison
equal deleted inserted replaced
1124:666ab5997802 1125:8f55daa87ce4
51 51
52 RE_NEWLINES = re.compile('[\r\n]') 52 RE_NEWLINES = re.compile('[\r\n]')
53 RE_GIT_PROGRESS = re.compile('\((\d+)/(\d+)\)') 53 RE_GIT_PROGRESS = re.compile('\((\d+)/(\d+)\)')
54 54
55 RE_AUTHOR_FILE = re.compile('\s*=\s*') 55 RE_AUTHOR_FILE = re.compile('\s*=\s*')
56
57 # mercurial.utils.dateutil functions were in mercurial.util in Mercurial < 4.6
58 try:
59 from mercurial.utils import dateutil
60 dateutil.parsedate
61 except ImportError:
62 dateutil = hgutil
56 63
57 CALLBACK_BUFFER = '' 64 CALLBACK_BUFFER = ''
58 65
59 66
60 class GitProgress(object): 67 class GitProgress(object):
1310 min_date = compat.config(self.ui, 'string', 'git', 'mindate') 1317 min_date = compat.config(self.ui, 'string', 'git', 'mindate')
1311 if min_date is None: 1318 if min_date is None:
1312 return refs 1319 return refs
1313 1320
1314 # filter refs older than min_timestamp 1321 # filter refs older than min_timestamp
1315 min_timestamp, min_offset = hgutil.parsedate(min_date) 1322 min_timestamp, min_offset = dateutil.parsedate(min_date)
1316 1323
1317 def check_min_time(obj): 1324 def check_min_time(obj):
1318 if isinstance(obj, Tag): 1325 if isinstance(obj, Tag):
1319 return obj.tag_time >= min_timestamp 1326 return obj.tag_time >= min_timestamp
1320 else: 1327 else: