comparison hgext3rd/topic/flow.py @ 4743:92e3db149d7d

py3: call branchmap.items() on py3 and continue to call iteritems() on py2 Mercurial's source transformer also replaces the 'def iteritems(' in branchmap by 'def items(', so we need to call whichever version is there.
author Martin von Zweigbergk <martinvonz@google.com>
date Sat, 13 Jul 2019 00:17:03 -0700
parents 228caeb8b7af
children 14c12df16ab5
comparison
equal deleted inserted replaced
4742:db3e7f6b5ceb 4743:92e3db149d7d
9 phases, 9 phases,
10 ) 10 )
11 11
12 from mercurial.i18n import _ 12 from mercurial.i18n import _
13 13
14 from . import (
15 compat,
16 )
17
14 def enforcesinglehead(repo, tr): 18 def enforcesinglehead(repo, tr):
15 for name, heads in repo.filtered('visible').branchmap().iteritems(): 19 branchmap = repo.filtered('visible').branchmap()
20 for name, heads in compat.branchmapitems(branchmap):
16 if len(heads) > 1: 21 if len(heads) > 1:
17 hexs = [node.short(n) for n in heads] 22 hexs = [node.short(n) for n in heads]
18 raise error.Abort(_('%d heads on "%s"') % (len(heads), name), 23 raise error.Abort(_('%d heads on "%s"') % (len(heads), name),
19 hint=(', '.join(hexs))) 24 hint=(', '.join(hexs)))
20 25