Show More
@@ -213,7 +213,7 b' def analyze(ui, repo, *revs, **opts):' | |||
|
213 | 213 | for filename, mar, lineadd, lineremove, isbin in parsegitdiff(diff): |
|
214 | 214 | if isbin: |
|
215 | 215 | continue |
|
216 |
added = sum( |
|
|
216 | added = sum(pycompat.itervalues(lineadd), 0) | |
|
217 | 217 | if mar == 'm': |
|
218 | 218 | if added and lineremove: |
|
219 | 219 | lineschanged[ |
@@ -164,7 +164,7 b' def _mergeentriesiter(*iterables, **kwar' | |||
|
164 | 164 | pass |
|
165 | 165 | |
|
166 | 166 | while iterable_map: |
|
167 |
value, key, it = order( |
|
|
167 | value, key, it = order(pycompat.itervalues(iterable_map)) | |
|
168 | 168 | yield value |
|
169 | 169 | try: |
|
170 | 170 | iterable_map[key][0] = next(it) |
@@ -2288,7 +2288,7 b' def summaryhook(ui, repo):' | |||
|
2288 | 2288 | msg = _(b'rebase: (use "hg rebase --abort" to clear broken state)\n') |
|
2289 | 2289 | ui.write(msg) |
|
2290 | 2290 | return |
|
2291 |
numrebased = len([i for i in |
|
|
2291 | numrebased = len([i for i in pycompat.itervalues(state) if i >= 0]) | |
|
2292 | 2292 | # i18n: column positioning for "hg summary" |
|
2293 | 2293 | ui.write( |
|
2294 | 2294 | _(b'rebase: %s, %s (rebase --continue)\n') |
@@ -10,6 +10,7 b' from __future__ import absolute_import' | |||
|
10 | 10 | from mercurial import ( |
|
11 | 11 | extensions, |
|
12 | 12 | hg, |
|
13 | pycompat, | |
|
13 | 14 | sshpeer, |
|
14 | 15 | util, |
|
15 | 16 | ) |
@@ -59,7 +60,7 b' class connectionpool(object):' | |||
|
59 | 60 | return conn |
|
60 | 61 | |
|
61 | 62 | def close(self): |
|
62 |
for pathpool in self._pool |
|
|
63 | for pathpool in pycompat.itervalues(self._pool): | |
|
63 | 64 | for conn in pathpool: |
|
64 | 65 | conn.close() |
|
65 | 66 | del pathpool[:] |
@@ -207,7 +207,7 b' def verifyremotefilelog(ui, path, **opts' | |||
|
207 | 207 | continue |
|
208 | 208 | filepath = os.path.join(root, file) |
|
209 | 209 | size, firstnode, mapping = parsefileblob(filepath, decompress) |
|
210 |
for p1, p2, linknode, copyfrom in |
|
|
210 | for p1, p2, linknode, copyfrom in pycompat.itervalues(mapping): | |
|
211 | 211 | if linknode == nullid: |
|
212 | 212 | actualpath = os.path.relpath(root, path) |
|
213 | 213 | key = fileserverclient.getcachekey( |
@@ -598,7 +598,7 b' class repacker(object):' | |||
|
598 | 598 | maxchainlen = ui.configint(b'packs', b'maxchainlen', 1000) |
|
599 | 599 | |
|
600 | 600 | byfile = {} |
|
601 |
for entry in ledger.entries |
|
|
601 | for entry in pycompat.itervalues(ledger.entries): | |
|
602 | 602 | if entry.datasource: |
|
603 | 603 | byfile.setdefault(entry.filename, {})[entry.node] = entry |
|
604 | 604 | |
@@ -753,7 +753,7 b' class repacker(object):' | |||
|
753 | 753 | ui = self.repo.ui |
|
754 | 754 | |
|
755 | 755 | byfile = {} |
|
756 |
for entry in ledger.entries |
|
|
756 | for entry in pycompat.itervalues(ledger.entries): | |
|
757 | 757 | if entry.historysource: |
|
758 | 758 | byfile.setdefault(entry.filename, {})[entry.node] = entry |
|
759 | 759 |
@@ -100,7 +100,7 b' class transplants(object):' | |||
|
100 | 100 | if not os.path.isdir(self.path): |
|
101 | 101 | os.mkdir(self.path) |
|
102 | 102 | fp = self.opener(self.transplantfile, b'w') |
|
103 |
for list in self.transplants |
|
|
103 | for list in pycompat.itervalues(self.transplants): | |
|
104 | 104 | for t in list: |
|
105 | 105 | l, r = map(nodemod.hex, (t.lnode, t.rnode)) |
|
106 | 106 | fp.write(l + b':' + r + b'\n') |
@@ -117,7 +117,7 b' if sys.version_info[0] >= 3:' | |||
|
117 | 117 | |
|
118 | 118 | # It changes iteritems/values to items/values as they are not |
|
119 | 119 | # present in Python 3 world. |
|
120 |
if fn |
|
|
120 | if fn == 'iteritems' and not ( | |
|
121 | 121 | tokens[i - 1].type == token.NAME |
|
122 | 122 | and tokens[i - 1].string == 'def' |
|
123 | 123 | ): |
@@ -131,7 +131,7 b' if sys.version_info[0] >= 3:' | |||
|
131 | 131 | # ``replacetoken`` or any mechanism that changes semantics of module |
|
132 | 132 | # loading is changed. Otherwise cached bytecode may get loaded without |
|
133 | 133 | # the new transformation mechanisms applied. |
|
134 |
BYTECODEHEADER = b'HG\x00\x1 |
|
|
134 | BYTECODEHEADER = b'HG\x00\x15' | |
|
135 | 135 | |
|
136 | 136 | class hgloader(importlib.machinery.SourceFileLoader): |
|
137 | 137 | """Custom module loader that transforms source code. |
@@ -91,7 +91,7 b' class BranchMapCache(object):' | |||
|
91 | 91 | clbranchinfo = cl.branchinfo |
|
92 | 92 | rbheads = [] |
|
93 | 93 | closed = [] |
|
94 |
for bheads in |
|
|
94 | for bheads in pycompat.itervalues(remotebranchmap): | |
|
95 | 95 | rbheads += bheads |
|
96 | 96 | for h in bheads: |
|
97 | 97 | r = clrev(h) |
@@ -350,7 +350,7 b' class branchcache(object):' | |||
|
350 | 350 | def iterheads(self): |
|
351 | 351 | """ returns all the heads """ |
|
352 | 352 | self._verifyall() |
|
353 |
return self._entries |
|
|
353 | return pycompat.itervalues(self._entries) | |
|
354 | 354 | |
|
355 | 355 | def copy(self): |
|
356 | 356 | """return an deep copy of the branchcache object""" |
@@ -607,7 +607,7 b' def _fetchfiles(repo, tr, remote, fnodes' | |||
|
607 | 607 | progress = repo.ui.makeprogress( |
|
608 | 608 | _(b'files'), |
|
609 | 609 | unit=_(b'chunks'), |
|
610 |
total=sum(len(v) for v in |
|
|
610 | total=sum(len(v) for v in pycompat.itervalues(fnodes)), | |
|
611 | 611 | ) |
|
612 | 612 | |
|
613 | 613 | # TODO make batch size configurable |
@@ -706,7 +706,7 b' def _fetchfilesfromcsets(' | |||
|
706 | 706 | progress = repo.ui.makeprogress( |
|
707 | 707 | _(b'files'), |
|
708 | 708 | unit=_(b'chunks'), |
|
709 |
total=sum(len(v) for v in |
|
|
709 | total=sum(len(v) for v in pycompat.itervalues(fnodes)), | |
|
710 | 710 | ) |
|
711 | 711 | |
|
712 | 712 | commandmeta = remote.apidescriptor[b'commands'][b'filesdata'] |
@@ -1763,7 +1763,7 b' class localrepository(object):' | |||
|
1763 | 1763 | nodetagscache = {} |
|
1764 | 1764 | for t, n in self._tagscache.tags.iteritems(): |
|
1765 | 1765 | nodetagscache.setdefault(n, []).append(t) |
|
1766 |
for tags in |
|
|
1766 | for tags in pycompat.itervalues(nodetagscache): | |
|
1767 | 1767 | tags.sort() |
|
1768 | 1768 | self._tagscache.nodetagscache = nodetagscache |
|
1769 | 1769 | return self._tagscache.nodetagscache.get(node, []) |
@@ -702,7 +702,7 b' class mergestate(object):' | |||
|
702 | 702 | """return counts for updated, merged and removed files in this |
|
703 | 703 | session""" |
|
704 | 704 | updated, merged, removed = 0, 0, 0 |
|
705 |
for r, action in self._results |
|
|
705 | for r, action in pycompat.itervalues(self._results): | |
|
706 | 706 | if r is None: |
|
707 | 707 | updated += 1 |
|
708 | 708 | elif r == 0: |
@@ -1331,7 +1331,11 b' the hunk is left unchanged.' | |||
|
1331 | 1331 | fixoffset += chunk.removed - chunk.added |
|
1332 | 1332 | return ( |
|
1333 | 1333 | sum( |
|
1334 | [h for h in applied.itervalues() if h[0].special() or len(h) > 1], | |
|
1334 | [ | |
|
1335 | h | |
|
1336 | for h in pycompat.itervalues(applied) | |
|
1337 | if h[0].special() or len(h) > 1 | |
|
1338 | ], | |
|
1335 | 1339 | [], |
|
1336 | 1340 | ), |
|
1337 | 1341 | {}, |
@@ -337,6 +337,7 b' if ispy3:' | |||
|
337 | 337 | ret = shlex.split(s.decode('latin-1'), comments, posix) |
|
338 | 338 | return [a.encode('latin-1') for a in ret] |
|
339 | 339 | |
|
340 | itervalues = lambda x: x.values() | |
|
340 | 341 | |
|
341 | 342 | else: |
|
342 | 343 | import cStringIO |
@@ -413,6 +414,7 b' else:' | |||
|
413 | 414 | ziplist = zip |
|
414 | 415 | rawinput = raw_input |
|
415 | 416 | getargspec = inspect.getargspec |
|
417 | itervalues = lambda x: x.itervalues() | |
|
416 | 418 | |
|
417 | 419 | isjython = sysplatform.startswith(b'java') |
|
418 | 420 |
@@ -475,7 +475,7 b' class SiteStats(object):' | |||
|
475 | 475 | if i == 0: |
|
476 | 476 | sitestat.addself() |
|
477 | 477 | |
|
478 |
return [s for s in |
|
|
478 | return [s for s in pycompat.itervalues(stats)] | |
|
479 | 479 | |
|
480 | 480 | |
|
481 | 481 | class DisplayFormats: |
@@ -744,7 +744,7 b' def display_hotpath(data, fp, limit=0.05' | |||
|
744 | 744 | site = node.site |
|
745 | 745 | visiblechildren = [ |
|
746 | 746 | c |
|
747 |
for c in node.children |
|
|
747 | for c in pycompat.itervalues(node.children) | |
|
748 | 748 | if c.count >= (limit * root.count) |
|
749 | 749 | ] |
|
750 | 750 | if site: |
@@ -752,7 +752,7 b' def display_hotpath(data, fp, limit=0.05' | |||
|
752 | 752 | filename = b'' |
|
753 | 753 | function = b'' |
|
754 | 754 | if len(node.children) > 0: |
|
755 |
childsite = list(node.children |
|
|
755 | childsite = list(pycompat.itervalues(node.children))[0].site | |
|
756 | 756 | filename = (childsite.filename() + b':').ljust(15) |
|
757 | 757 | function = childsite.function |
|
758 | 758 | |
@@ -777,7 +777,9 b' def display_hotpath(data, fp, limit=0.05' | |||
|
777 | 777 | ) |
|
778 | 778 | |
|
779 | 779 | finalstring = liststring + codestring |
|
780 | childrensamples = sum([c.count for c in node.children.itervalues()]) | |
|
780 | childrensamples = sum( | |
|
781 | [c.count for c in pycompat.itervalues(node.children)] | |
|
782 | ) | |
|
781 | 783 | # Make frames that performed more than 10% of the operation red |
|
782 | 784 | if node.count - childrensamples > (0.1 * root.count): |
|
783 | 785 | finalstring = b'\033[91m' + finalstring + b'\033[0m' |
@@ -1966,7 +1966,7 b' class ui(object):' | |||
|
1966 | 1966 | if not self._loggers: |
|
1967 | 1967 | return |
|
1968 | 1968 | activeloggers = [ |
|
1969 |
l for l in self._loggers |
|
|
1969 | l for l in pycompat.itervalues(self._loggers) if l.tracked(event) | |
|
1970 | 1970 | ] |
|
1971 | 1971 | if not activeloggers: |
|
1972 | 1972 | return |
@@ -67,7 +67,7 b" def buildprobtable(fp, cmd='hg manifest " | |||
|
67 | 67 | counts[c] += 1 |
|
68 | 68 | for c in '\r/\n': |
|
69 | 69 | counts.pop(c, None) |
|
70 |
t = sum( |
|
|
70 | t = sum(pycompat.itervalues(counts)) / 100.0 | |
|
71 | 71 | fp.write('probtable = (') |
|
72 | 72 | for i, (k, v) in enumerate( |
|
73 | 73 | sorted(counts.items(), key=lambda x: x[1], reverse=True) |
General Comments 0
You need to be logged in to leave comments.
Login now