comparison hgext3rd/topic/discovery.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 db3e7f6b5ceb
children 079dbf36e884
comparison
equal deleted inserted replaced
4742:db3e7f6b5ceb 4743:92e3db149d7d
12 extensions, 12 extensions,
13 util, 13 util,
14 ) 14 )
15 from . import ( 15 from . import (
16 common, 16 common,
17 compat,
17 ) 18 )
18 19
19 try: 20 try:
20 from mercurial import wireproto 21 from mercurial import wireproto
21 wireproto.branchmap 22 wireproto.branchmap
47 rev = repo.unfiltered().changelog.nodemap.get 48 rev = repo.unfiltered().changelog.nodemap.get
48 49
49 def remotebranchmap(): 50 def remotebranchmap():
50 # drop topic information from changeset about to be published 51 # drop topic information from changeset about to be published
51 result = collections.defaultdict(list) 52 result = collections.defaultdict(list)
52 for branch, heads in origremotebranchmap().iteritems(): 53 for branch, heads in compat.branchmapitems(origremotebranchmap()):
53 if ':' not in branch: 54 if ':' not in branch:
54 result[branch].extend(heads) 55 result[branch].extend(heads)
55 else: 56 else:
56 namedbranch = branch.split(':', 1)[0] 57 namedbranch = branch.split(':', 1)[0]
57 for h in heads: 58 for h in heads: