Show More
@@ -726,7 +726,7 b' class fixupstate(object):' | |||
|
726 | 726 | |
|
727 | 727 | def apply(self): |
|
728 | 728 | """apply fixups to individual filefixupstates""" |
|
729 |
for path, state in self.fixupmap |
|
|
729 | for path, state in pycompat.iteritems(self.fixupmap): | |
|
730 | 730 | if self.ui.debugflag: |
|
731 | 731 | self.ui.write(_(b'applying fixups to %s\n') % path) |
|
732 | 732 | state.apply() |
@@ -736,7 +736,7 b' class fixupstate(object):' | |||
|
736 | 736 | """-> {path: chunkstats}. collect chunkstats from filefixupstates""" |
|
737 | 737 | return dict( |
|
738 | 738 | (path, state.chunkstats) |
|
739 |
for path, state in self.fixupmap |
|
|
739 | for path, state in pycompat.iteritems(self.fixupmap) | |
|
740 | 740 | ) |
|
741 | 741 | |
|
742 | 742 | def commit(self): |
@@ -755,7 +755,7 b' class fixupstate(object):' | |||
|
755 | 755 | chunkstats = self.chunkstats |
|
756 | 756 | if ui.verbose: |
|
757 | 757 | # chunkstats for each file |
|
758 |
for path, stat in |
|
|
758 | for path, stat in pycompat.iteritems(chunkstats): | |
|
759 | 759 | if stat[0]: |
|
760 | 760 | ui.write( |
|
761 | 761 | _(b'%s: %d of %d chunk(s) applied\n') |
@@ -831,7 +831,7 b' class fixupstate(object):' | |||
|
831 | 831 | repo = self.repo |
|
832 | 832 | needupdate = [ |
|
833 | 833 | (name, self.replacemap[hsh]) |
|
834 |
for name, hsh in repo._bookmarks |
|
|
834 | for name, hsh in pycompat.iteritems(repo._bookmarks) | |
|
835 | 835 | if hsh in self.replacemap |
|
836 | 836 | ] |
|
837 | 837 | changes = [] |
@@ -890,7 +890,7 b' class fixupstate(object):' | |||
|
890 | 890 | # ctx changes more files (not a subset of memworkingcopy) |
|
891 | 891 | if not set(ctx.files()).issubset(set(memworkingcopy)): |
|
892 | 892 | return False |
|
893 |
for path, content in |
|
|
893 | for path, content in pycompat.iteritems(memworkingcopy): | |
|
894 | 894 | if path not in pctx or path not in ctx: |
|
895 | 895 | return False |
|
896 | 896 | fctx = ctx[path] |
@@ -922,7 +922,7 b' class fixupstate(object):' | |||
|
922 | 922 | def _cleanupoldcommits(self): |
|
923 | 923 | replacements = { |
|
924 | 924 | k: ([v] if v is not None else []) |
|
925 |
for k, v in self.replacemap |
|
|
925 | for k, v in pycompat.iteritems(self.replacemap) | |
|
926 | 926 | } |
|
927 | 927 | if replacements: |
|
928 | 928 | scmutil.cleanupnodes( |
@@ -968,7 +968,7 b' def overlaydiffcontext(ctx, chunks):' | |||
|
968 | 968 | if not path or not info: |
|
969 | 969 | continue |
|
970 | 970 | patchmap[path].append(info) |
|
971 |
for path, patches in p |
|
|
971 | for path, patches in pycompat.iteritems(patchmap): | |
|
972 | 972 | if path not in ctx or not patches: |
|
973 | 973 | continue |
|
974 | 974 | patches.sort(reverse=True) |
@@ -12,7 +12,11 b' from __future__ import absolute_import' | |||
|
12 | 12 | import os |
|
13 | 13 | |
|
14 | 14 | from mercurial.i18n import _ |
|
15 |
from mercurial import |
|
|
15 | from mercurial import ( | |
|
16 | demandimport, | |
|
17 | error, | |
|
18 | pycompat, | |
|
19 | ) | |
|
16 | 20 | from . import common |
|
17 | 21 | |
|
18 | 22 | # these do not work with demandimport, blacklist |
@@ -195,7 +199,7 b' class bzr_source(common.converter_source' | |||
|
195 | 199 | if not branch.supports_tags(): |
|
196 | 200 | return {} |
|
197 | 201 | tagdict = branch.tags.get_tag_dict() |
|
198 |
for name, rev in |
|
|
202 | for name, rev in pycompat.iteritems(tagdict): | |
|
199 | 203 | bytetags[self.recode(name)] = rev |
|
200 | 204 | return bytetags |
|
201 | 205 |
@@ -411,7 +411,7 b' class commandline(object):' | |||
|
411 | 411 | def _cmdline(self, cmd, *args, **kwargs): |
|
412 | 412 | kwargs = pycompat.byteskwargs(kwargs) |
|
413 | 413 | cmdline = [self.command, cmd] + list(args) |
|
414 |
for k, v in |
|
|
414 | for k, v in pycompat.iteritems(kwargs): | |
|
415 | 415 | if len(k) == 1: |
|
416 | 416 | cmdline.append(b'-' + k) |
|
417 | 417 | else: |
@@ -581,7 +581,7 b' class converter(object):' | |||
|
581 | 581 | # previous one so we don't end up with extra tag heads |
|
582 | 582 | tagsparents = [ |
|
583 | 583 | e |
|
584 |
for e in self.map |
|
|
584 | for e in pycompat.iteritems(self.map) | |
|
585 | 585 | if e[1] == tagsparent |
|
586 | 586 | ] |
|
587 | 587 | if tagsparents: |
@@ -19,6 +19,7 b' from mercurial.pycompat import (' | |||
|
19 | 19 | from mercurial import ( |
|
20 | 20 | encoding, |
|
21 | 21 | error, |
|
22 | pycompat, | |
|
22 | 23 | util, |
|
23 | 24 | ) |
|
24 | 25 | from mercurial.utils import ( |
@@ -319,7 +320,7 b' class convert_cvs(converter_source):' | |||
|
319 | 320 | if full: |
|
320 | 321 | raise error.Abort(_(b"convert from cvs does not support --full")) |
|
321 | 322 | self._parse() |
|
322 |
return sorted(self.files[rev] |
|
|
323 | return sorted(pycompat.iteritems(self.files[rev])), {}, set() | |
|
323 | 324 | |
|
324 | 325 | def getcommit(self, rev): |
|
325 | 326 | self._parse() |
@@ -470,7 +470,7 b' def createlog(ui, directory=None, root=b' | |||
|
470 | 470 | |
|
471 | 471 | # find the branches starting from this revision |
|
472 | 472 | branchpoints = set() |
|
473 |
for branch, revision in |
|
|
473 | for branch, revision in pycompat.iteritems(branchmap): | |
|
474 | 474 | revparts = tuple([int(i) for i in revision.split(b'.')]) |
|
475 | 475 | if len(revparts) < 2: # bad tags |
|
476 | 476 | continue |
@@ -126,7 +126,7 b' class filemapper(object):' | |||
|
126 | 126 | repo belong to the source repo and what parts don't.""" |
|
127 | 127 | if self.targetprefixes is None: |
|
128 | 128 | self.targetprefixes = set() |
|
129 |
for before, after in self.rename |
|
|
129 | for before, after in pycompat.iteritems(self.rename): | |
|
130 | 130 | self.targetprefixes.add(after) |
|
131 | 131 | |
|
132 | 132 | # If "." is a target, then all target files are considered from the |
@@ -34,6 +34,7 b' from mercurial import (' | |||
|
34 | 34 | merge as mergemod, |
|
35 | 35 | node as nodemod, |
|
36 | 36 | phases, |
|
37 | pycompat, | |
|
37 | 38 | scmutil, |
|
38 | 39 | util, |
|
39 | 40 | ) |
@@ -133,7 +134,7 b' class mercurial_sink(common.converter_si' | |||
|
133 | 134 | |
|
134 | 135 | if missings: |
|
135 | 136 | self.after() |
|
136 |
for pbranch, heads in sorted( |
|
|
137 | for pbranch, heads in sorted(pycompat.iteritems(missings)): | |
|
137 | 138 | pbranchpath = os.path.join(self.path, pbranch) |
|
138 | 139 | prepo = hg.peer(self.ui, {}, pbranchpath) |
|
139 | 140 | self.ui.note( |
@@ -227,7 +228,7 b' class mercurial_sink(common.converter_si' | |||
|
227 | 228 | followcopies=False, |
|
228 | 229 | ) |
|
229 | 230 | |
|
230 |
for file, (action, info, msg) in a |
|
|
231 | for file, (action, info, msg) in pycompat.iteritems(actions): | |
|
231 | 232 | if source.targetfilebelongstosource(file): |
|
232 | 233 | # If the file belongs to the source repo, ignore the p2 |
|
233 | 234 | # since it will be covered by the existing fileset. |
@@ -417,7 +418,7 b' class mercurial_sink(common.converter_si' | |||
|
417 | 418 | tagparent = tagparent or nodemod.nullid |
|
418 | 419 | |
|
419 | 420 | oldlines = set() |
|
420 |
for branch, heads in self.repo.branchmap() |
|
|
421 | for branch, heads in pycompat.iteritems(self.repo.branchmap()): | |
|
421 | 422 | for h in heads: |
|
422 | 423 | if b'.hgtags' in self.repo[h]: |
|
423 | 424 | oldlines.update( |
@@ -589,7 +590,7 b' class mercurial_source(common.converter_' | |||
|
589 | 590 | maappend = ma.append |
|
590 | 591 | rappend = r.append |
|
591 | 592 | d = ctx1.manifest().diff(ctx2.manifest()) |
|
592 |
for f, ((node1, flag1), (node2, flag2)) in |
|
|
593 | for f, ((node1, flag1), (node2, flag2)) in pycompat.iteritems(d): | |
|
593 | 594 | if node2 is None: |
|
594 | 595 | rappend(f) |
|
595 | 596 | else: |
@@ -615,7 +616,7 b' class mercurial_source(common.converter_' | |||
|
615 | 616 | cleanp2 = set() |
|
616 | 617 | if len(parents) == 2: |
|
617 | 618 | d = parents[1].manifest().diff(ctx.manifest(), clean=True) |
|
618 |
for f, value in |
|
|
619 | for f, value in pycompat.iteritems(d): | |
|
619 | 620 | if value is None: |
|
620 | 621 | cleanp2.add(f) |
|
621 | 622 | changes = [(f, rev) for f in files if f not in self.ignored] |
@@ -103,7 +103,7 b' class monotone_source(common.converter_s' | |||
|
103 | 103 | # Prepare the command in automate stdio format |
|
104 | 104 | kwargs = pycompat.byteskwargs(kwargs) |
|
105 | 105 | command = [] |
|
106 |
for k, v in |
|
|
106 | for k, v in pycompat.iteritems(kwargs): | |
|
107 | 107 | command.append(b"%d:%s" % (len(k), k)) |
|
108 | 108 | if v: |
|
109 | 109 | command.append(b"%d:%s" % (len(v), v)) |
@@ -151,7 +151,7 b' def get_log_child(' | |||
|
151 | 151 | def receiver(orig_paths, revnum, author, date, message, pool): |
|
152 | 152 | paths = {} |
|
153 | 153 | if orig_paths is not None: |
|
154 |
for k, v in |
|
|
154 | for k, v in pycompat.iteritems(orig_paths): | |
|
155 | 155 | paths[k] = changedpath(v) |
|
156 | 156 | pickle.dump((paths, revnum, author, date, message), fp, protocol) |
|
157 | 157 | |
@@ -245,7 +245,7 b' class directlogstream(list):' | |||
|
245 | 245 | def receiver(orig_paths, revnum, author, date, message, pool): |
|
246 | 246 | paths = {} |
|
247 | 247 | if orig_paths is not None: |
|
248 |
for k, v in |
|
|
248 | for k, v in pycompat.iteritems(orig_paths): | |
|
249 | 249 | paths[k] = changedpath(v) |
|
250 | 250 | self.append((paths, revnum, author, date, message)) |
|
251 | 251 | |
@@ -591,7 +591,7 b' class svn_source(converter_source):' | |||
|
591 | 591 | ) |
|
592 | 592 | files = [ |
|
593 | 593 | n |
|
594 |
for n, e in |
|
|
594 | for n, e in pycompat.iteritems(entries) | |
|
595 | 595 | if e.kind == svn.core.svn_node_file |
|
596 | 596 | ] |
|
597 | 597 | self.removed = set() |
@@ -681,7 +681,7 b' class svn_source(converter_source):' | |||
|
681 | 681 | origpaths = [] |
|
682 | 682 | copies = [ |
|
683 | 683 | (e.copyfrom_path, e.copyfrom_rev, p) |
|
684 |
for p, e in |
|
|
684 | for p, e in pycompat.iteritems(origpaths) | |
|
685 | 685 | if e.copyfrom_path |
|
686 | 686 | ] |
|
687 | 687 | # Apply moves/copies from more specific to general |
@@ -712,7 +712,7 b' class svn_source(converter_source):' | |||
|
712 | 712 | # be represented in mercurial. |
|
713 | 713 | addeds = dict( |
|
714 | 714 | (p, e.copyfrom_path) |
|
715 |
for p, e in |
|
|
715 | for p, e in pycompat.iteritems(origpaths) | |
|
716 | 716 | if e.action == b'A' and e.copyfrom_path |
|
717 | 717 | ) |
|
718 | 718 | badroots = set() |
@@ -1001,7 +1001,7 b' class svn_source(converter_source):' | |||
|
1001 | 1001 | parents = [] |
|
1002 | 1002 | # check whether this revision is the start of a branch or part |
|
1003 | 1003 | # of a branch renaming |
|
1004 |
orig_paths = sorted( |
|
|
1004 | orig_paths = sorted(pycompat.iteritems(orig_paths)) | |
|
1005 | 1005 | root_paths = [ |
|
1006 | 1006 | (p, e) for p, e in orig_paths if self.module.startswith(p) |
|
1007 | 1007 | ] |
@@ -1168,7 +1168,7 b' class svn_source(converter_source):' | |||
|
1168 | 1168 | path += b'/' |
|
1169 | 1169 | return ( |
|
1170 | 1170 | (path + p) |
|
1171 |
for p, e in |
|
|
1171 | for p, e in pycompat.iteritems(entries) | |
|
1172 | 1172 | if e.kind == svn.core.svn_node_file |
|
1173 | 1173 | ) |
|
1174 | 1174 |
@@ -367,7 +367,7 b' def reposetup(ui, repo):' | |||
|
367 | 367 | |
|
368 | 368 | if not repo.local(): |
|
369 | 369 | return |
|
370 |
for name, fn in |
|
|
370 | for name, fn in pycompat.iteritems(filters): | |
|
371 | 371 | repo.adddatafilter(name, fn) |
|
372 | 372 | |
|
373 | 373 | ui.setconfig(b'patch', b'eol', b'auto', b'eol') |
@@ -169,7 +169,7 b' class annotateopts(object):' | |||
|
169 | 169 | |
|
170 | 170 | def __init__(self, **opts): |
|
171 | 171 | opts = pycompat.byteskwargs(opts) |
|
172 |
for k, v in self.defaults |
|
|
172 | for k, v in pycompat.iteritems(self.defaults): | |
|
173 | 173 | setattr(self, k, opts.get(k, v)) |
|
174 | 174 | |
|
175 | 175 | @util.propertycache |
@@ -578,7 +578,7 b' class _annotatecontext(object):' | |||
|
578 | 578 | # find an unresolved line and its linelog rev to annotate |
|
579 | 579 | hsh = None |
|
580 | 580 | try: |
|
581 |
for (rev, _linenum), idxs in |
|
|
581 | for (rev, _linenum), idxs in pycompat.iteritems(key2idxs): | |
|
582 | 582 | if revmap.rev2flag(rev) & revmapmod.sidebranchflag: |
|
583 | 583 | continue |
|
584 | 584 | hsh = annotateresult[idxs[0]][0] |
@@ -589,7 +589,7 b' class _annotatecontext(object):' | |||
|
589 | 589 | # the remaining key2idxs are not in main branch, resolving them |
|
590 | 590 | # using the hard way... |
|
591 | 591 | revlines = {} |
|
592 |
for (rev, linenum), idxs in |
|
|
592 | for (rev, linenum), idxs in pycompat.iteritems(key2idxs): | |
|
593 | 593 | if rev not in revlines: |
|
594 | 594 | hsh = annotateresult[idxs[0]][0] |
|
595 | 595 | if self.ui.debugflag: |
@@ -15,6 +15,7 b' from mercurial import (' | |||
|
15 | 15 | error, |
|
16 | 16 | extensions, |
|
17 | 17 | hg, |
|
18 | pycompat, | |
|
18 | 19 | util, |
|
19 | 20 | wireprotov1peer, |
|
20 | 21 | wireprotov1server, |
@@ -188,7 +189,7 b' def clientfetch(repo, paths, lastnodemap' | |||
|
188 | 189 | for result in results: |
|
189 | 190 | r = result.result() |
|
190 | 191 | # TODO: pconvert these paths on the server? |
|
191 |
r = {util.pconvert(p): v for p, v in |
|
|
192 | r = {util.pconvert(p): v for p, v in pycompat.iteritems(r)} | |
|
192 | 193 | for path in sorted(r): |
|
193 | 194 | # ignore malicious paths |
|
194 | 195 | if not path.startswith(b'fastannotate/') or b'/../' in ( |
@@ -353,7 +353,9 b' def cleanup(repo, replacements, wdirwrit' | |||
|
353 | 353 | Useful as a hook point for extending "hg fix" with output summarizing the |
|
354 | 354 | effects of the command, though we choose not to output anything here. |
|
355 | 355 | """ |
|
356 | replacements = {prec: [succ] for prec, succ in replacements.iteritems()} | |
|
356 | replacements = { | |
|
357 | prec: [succ] for prec, succ in pycompat.iteritems(replacements) | |
|
358 | } | |
|
357 | 359 | scmutil.cleanupnodes(repo, replacements, b'fix', fixphase=True) |
|
358 | 360 | |
|
359 | 361 | |
@@ -619,7 +621,7 b' def fixfile(ui, repo, opts, fixers, fixc' | |||
|
619 | 621 | """ |
|
620 | 622 | metadata = {} |
|
621 | 623 | newdata = fixctx[path].data() |
|
622 |
for fixername, fixer in |
|
|
624 | for fixername, fixer in pycompat.iteritems(fixers): | |
|
623 | 625 | if fixer.affects(opts, fixctx, path): |
|
624 | 626 | ranges = lineranges(opts, path, basectxs, fixctx, newdata) |
|
625 | 627 | command = fixer.command(ui, path, ranges) |
@@ -695,7 +697,7 b' def writeworkingdir(repo, ctx, filedata,' | |||
|
695 | 697 | |
|
696 | 698 | Directly updates the dirstate for the affected files. |
|
697 | 699 | """ |
|
698 |
for path, data in |
|
|
700 | for path, data in pycompat.iteritems(filedata): | |
|
699 | 701 | fctx = ctx[path] |
|
700 | 702 | fctx.write(data, fctx.flags()) |
|
701 | 703 | if repo.dirstate[path] == b'n': |
@@ -467,12 +467,14 b' def overridewalk(orig, self, match, subr' | |||
|
467 | 467 | visit.update(f for f in copymap if f not in results and matchfn(f)) |
|
468 | 468 | else: |
|
469 | 469 | if matchalways: |
|
470 | visit.update(f for f, st in dmap.iteritems() if f not in results) | |
|
470 | visit.update( | |
|
471 | f for f, st in pycompat.iteritems(dmap) if f not in results | |
|
472 | ) | |
|
471 | 473 | visit.update(f for f in copymap if f not in results) |
|
472 | 474 | else: |
|
473 | 475 | visit.update( |
|
474 | 476 | f |
|
475 |
for f, st in |
|
|
477 | for f, st in pycompat.iteritems(dmap) | |
|
476 | 478 | if f not in results and matchfn(f) |
|
477 | 479 | ) |
|
478 | 480 | visit.update(f for f in copymap if f not in results and matchfn(f)) |
@@ -116,7 +116,7 b' def parseoptions(ui, cmdoptions, args):' | |||
|
116 | 116 | opts = dict( |
|
117 | 117 | [ |
|
118 | 118 | (k, convert(v)) if isinstance(v, str) else (k, v) |
|
119 |
for k, v in opt |
|
|
119 | for k, v in pycompat.iteritems(opts) | |
|
120 | 120 | ] |
|
121 | 121 | ) |
|
122 | 122 | |
@@ -132,7 +132,7 b' class Command(object):' | |||
|
132 | 132 | def __bytes__(self): |
|
133 | 133 | cmd = b"hg " + self.name |
|
134 | 134 | if self.opts: |
|
135 |
for k, values in sorted(self.opts |
|
|
135 | for k, values in sorted(pycompat.iteritems(self.opts)): | |
|
136 | 136 | for v in values: |
|
137 | 137 | if v: |
|
138 | 138 | if isinstance(v, int): |
@@ -376,7 +376,9 b' def view(ui, repo, *etc, **opts):' | |||
|
376 | 376 | b"start interactive history viewer" |
|
377 | 377 | opts = pycompat.byteskwargs(opts) |
|
378 | 378 | os.chdir(repo.root) |
|
379 | optstr = b' '.join([b'--%s %s' % (k, v) for k, v in opts.iteritems() if v]) | |
|
379 | optstr = b' '.join( | |
|
380 | [b'--%s %s' % (k, v) for k, v in pycompat.iteritems(opts) if v] | |
|
381 | ) | |
|
380 | 382 | if repo.filtername is None: |
|
381 | 383 | optstr += b'--hidden' |
|
382 | 384 |
@@ -2013,7 +2013,7 b' def _finishhistedit(ui, repo, state, fm)' | |||
|
2013 | 2013 | |
|
2014 | 2014 | mapping, tmpnodes, created, ntm = processreplacement(state) |
|
2015 | 2015 | if mapping: |
|
2016 |
for prec, succs in |
|
|
2016 | for prec, succs in pycompat.iteritems(mapping): | |
|
2017 | 2017 | if not succs: |
|
2018 | 2018 | ui.debug(b'histedit: %s is dropped\n' % node.short(prec)) |
|
2019 | 2019 | else: |
@@ -2051,7 +2051,7 b' def _finishhistedit(ui, repo, state, fm)' | |||
|
2051 | 2051 | nodechanges = fd( |
|
2052 | 2052 | { |
|
2053 | 2053 | hf(oldn): fl([hf(n) for n in newn], name=b'node') |
|
2054 |
for oldn, newn in |
|
|
2054 | for oldn, newn in pycompat.iteritems(mapping) | |
|
2055 | 2055 | }, |
|
2056 | 2056 | key=b"oldnode", |
|
2057 | 2057 | value=b"newnodes", |
@@ -2311,7 +2311,7 b' def ruleeditor(repo, ui, actions, editco' | |||
|
2311 | 2311 | tsum = summary[len(fword) + 1 :].lstrip() |
|
2312 | 2312 | # safe but slow: reverse iterate over the actions so we |
|
2313 | 2313 | # don't clash on two commits having the same summary |
|
2314 |
for na, l in reversed(list( |
|
|
2314 | for na, l in reversed(list(pycompat.iteritems(newact))): | |
|
2315 | 2315 | actx = repo[na.node] |
|
2316 | 2316 | asum = _getsummary(actx) |
|
2317 | 2317 | if asum == tsum: |
@@ -2324,7 +2324,7 b' def ruleeditor(repo, ui, actions, editco' | |||
|
2324 | 2324 | |
|
2325 | 2325 | # copy over and flatten the new list |
|
2326 | 2326 | actions = [] |
|
2327 |
for na, l in |
|
|
2327 | for na, l in pycompat.iteritems(newact): | |
|
2328 | 2328 | actions.append(na) |
|
2329 | 2329 | actions += l |
|
2330 | 2330 |
@@ -378,7 +378,7 b' def _checkheads(orig, pushop):' | |||
|
378 | 378 | |
|
379 | 379 | def wireprotolistkeyspatterns(repo, proto, namespace, patterns): |
|
380 | 380 | patterns = wireprototypes.decodelist(patterns) |
|
381 |
d = repo.listkeys(encoding.tolocal(namespace), patterns) |
|
|
381 | d = pycompat.iteritems(repo.listkeys(encoding.tolocal(namespace), patterns)) | |
|
382 | 382 | return pushkey.encodekeys(d) |
|
383 | 383 | |
|
384 | 384 | |
@@ -392,7 +392,7 b' def localrepolistkeys(orig, self, namesp' | |||
|
392 | 392 | if pattern.endswith(b'*'): |
|
393 | 393 | pattern = b're:^' + pattern[:-1] + b'.*' |
|
394 | 394 | kind, pat, matcher = stringutil.stringmatcher(pattern) |
|
395 |
for bookmark, node in |
|
|
395 | for bookmark, node in pycompat.iteritems(bookmarks): | |
|
396 | 396 | if matcher(bookmark): |
|
397 | 397 | results[bookmark] = node |
|
398 | 398 | return results |
@@ -514,7 +514,7 b' def _generateoutputparts(head, bundlerep' | |||
|
514 | 514 | if part.type == b'changegroup': |
|
515 | 515 | haschangegroup = True |
|
516 | 516 | newpart = bundle2.bundlepart(part.type, data=part.read()) |
|
517 |
for key, value in part.params |
|
|
517 | for key, value in pycompat.iteritems(part.params): | |
|
518 | 518 | newpart.addparam(key, value) |
|
519 | 519 | parts.append(newpart) |
|
520 | 520 | |
@@ -757,7 +757,7 b' def _saveremotebookmarks(repo, newbookma' | |||
|
757 | 757 | # saveremotenames expects 20 byte binary nodes for branches |
|
758 | 758 | branches[rname].append(bin(hexnode)) |
|
759 | 759 | |
|
760 |
for bookmark, hexnode in |
|
|
760 | for bookmark, hexnode in pycompat.iteritems(newbookmarks): | |
|
761 | 761 | bookmarks[bookmark] = hexnode |
|
762 | 762 | remotenamesext.saveremotenames(repo, remotepath, branches, bookmarks) |
|
763 | 763 | |
@@ -767,7 +767,7 b' def _savelocalbookmarks(repo, bookmarks)' | |||
|
767 | 767 | return |
|
768 | 768 | with repo.wlock(), repo.lock(), repo.transaction(b'bookmark') as tr: |
|
769 | 769 | changes = [] |
|
770 |
for scratchbook, node in |
|
|
770 | for scratchbook, node in pycompat.iteritems(bookmarks): | |
|
771 | 771 | changectx = repo[node] |
|
772 | 772 | changes.append((scratchbook, changectx.node())) |
|
773 | 773 | repo._bookmarks.applychanges(repo, tr, changes) |
@@ -1005,7 +1005,7 b' def storetobundlestore(orig, repo, op, u' | |||
|
1005 | 1005 | bundle2._processpart(op, part) |
|
1006 | 1006 | else: |
|
1007 | 1007 | bundlepart = bundle2.bundlepart(part.type, data=part.read()) |
|
1008 |
for key, value in part.params |
|
|
1008 | for key, value in pycompat.iteritems(part.params): | |
|
1009 | 1009 | bundlepart.addparam(key, value) |
|
1010 | 1010 | |
|
1011 | 1011 | # Certain parts require a response |
@@ -1092,7 +1092,7 b' def processparts(orig, repo, op, unbundl' | |||
|
1092 | 1092 | # differs from previous behavior, we need to put it behind a |
|
1093 | 1093 | # config flag for incremental rollout. |
|
1094 | 1094 | bundlepart = bundle2.bundlepart(part.type, data=part.read()) |
|
1095 |
for key, value in part.params |
|
|
1095 | for key, value in pycompat.iteritems(part.params): | |
|
1096 | 1096 | bundlepart.addparam(key, value) |
|
1097 | 1097 | |
|
1098 | 1098 | # Certain parts require a response |
@@ -1273,7 +1273,9 b' def _maybeaddpushbackpart(op, bookmark, ' | |||
|
1273 | 1273 | b'new': newnode, |
|
1274 | 1274 | b'old': oldnode, |
|
1275 | 1275 | } |
|
1276 | op.reply.newpart(b'pushkey', mandatoryparams=params.iteritems()) | |
|
1276 | op.reply.newpart( | |
|
1277 | b'pushkey', mandatoryparams=pycompat.iteritems(params) | |
|
1278 | ) | |
|
1277 | 1279 | |
|
1278 | 1280 | |
|
1279 | 1281 | def bundle2pushkey(orig, op, part): |
@@ -13,6 +13,7 b' from mercurial import (' | |||
|
13 | 13 | error, |
|
14 | 14 | extensions, |
|
15 | 15 | node as nodemod, |
|
16 | pycompat, | |
|
16 | 17 | revsetlang, |
|
17 | 18 | util, |
|
18 | 19 | ) |
@@ -67,7 +68,7 b' def getscratchbranchparts(repo, peer, ou' | |||
|
67 | 68 | parts.append( |
|
68 | 69 | bundle2.bundlepart( |
|
69 | 70 | scratchbranchparttype.upper(), |
|
70 |
advisoryparams=p |
|
|
71 | advisoryparams=pycompat.iteritems(params), | |
|
71 | 72 | data=cg, |
|
72 | 73 | ) |
|
73 | 74 | ) |
@@ -14,6 +14,8 b' import time' | |||
|
14 | 14 | import warnings |
|
15 | 15 | import mysql.connector |
|
16 | 16 | |
|
17 | from mercurial import pycompat | |
|
18 | ||
|
17 | 19 | from . import indexapi |
|
18 | 20 | |
|
19 | 21 | |
@@ -178,7 +180,7 b' class sqlindexapi(indexapi.indexapi):' | |||
|
178 | 180 | self.sqlconnect() |
|
179 | 181 | args = [] |
|
180 | 182 | values = [] |
|
181 |
for bookmark, node in |
|
|
183 | for bookmark, node in pycompat.iteritems(bookmarks): | |
|
182 | 184 | args.append(b'(%s, %s, %s)') |
|
183 | 185 | values.extend((bookmark, node, self.reponame)) |
|
184 | 186 | args = b','.join(args) |
@@ -126,7 +126,7 b' def recordbookmarks(orig, store, fp):' | |||
|
126 | 126 | repo = store._repo |
|
127 | 127 | if util.safehasattr(repo, b'journal'): |
|
128 | 128 | oldmarks = bookmarks.bmstore(repo) |
|
129 |
for mark, value in |
|
|
129 | for mark, value in pycompat.iteritems(store): | |
|
130 | 130 | oldvalue = oldmarks.get(mark, node.nullid) |
|
131 | 131 | if value != oldvalue: |
|
132 | 132 | repo.journal.record(bookmarktype, mark, oldvalue, value) |
@@ -507,7 +507,7 b' def demo(ui, repo, *args, **opts):' | |||
|
507 | 507 | kwmaps = _defaultkwmaps(ui) |
|
508 | 508 | if uikwmaps: |
|
509 | 509 | ui.status(_(b'\tdisabling current template maps\n')) |
|
510 |
for k, v in |
|
|
510 | for k, v in pycompat.iteritems(kwmaps): | |
|
511 | 511 | ui.setconfig(b'keywordmaps', k, v, b'keyword') |
|
512 | 512 | else: |
|
513 | 513 | ui.status(_(b'\n\tconfiguration using current keyword template maps\n')) |
@@ -521,7 +521,7 b' def demo(ui, repo, *args, **opts):' | |||
|
521 | 521 | ui.writenoi18n(b'[extensions]\nkeyword =\n') |
|
522 | 522 | demoitems(b'keyword', ui.configitems(b'keyword')) |
|
523 | 523 | demoitems(b'keywordset', ui.configitems(b'keywordset')) |
|
524 |
demoitems(b'keywordmaps', |
|
|
524 | demoitems(b'keywordmaps', pycompat.iteritems(kwmaps)) | |
|
525 | 525 | keywords = b'$' + b'$\n$'.join(sorted(kwmaps.keys())) + b'$\n' |
|
526 | 526 | repo.wvfs.write(fn, keywords) |
|
527 | 527 | repo[None].add([fn]) |
@@ -688,7 +688,7 b' def copiespathcopies(orig, ctx1, ctx2, m' | |||
|
688 | 688 | copies = orig(ctx1, ctx2, match=match) |
|
689 | 689 | updated = {} |
|
690 | 690 | |
|
691 |
for k, v in |
|
|
691 | for k, v in pycompat.iteritems(copies): | |
|
692 | 692 | updated[lfutil.splitstandin(k) or k] = lfutil.splitstandin(v) or v |
|
693 | 693 | |
|
694 | 694 | return updated |
@@ -11,6 +11,7 b' from mercurial.i18n import _' | |||
|
11 | 11 | |
|
12 | 12 | from mercurial import ( |
|
13 | 13 | error, |
|
14 | pycompat, | |
|
14 | 15 | util, |
|
15 | 16 | ) |
|
16 | 17 | |
@@ -49,7 +50,9 b' class remotestore(basestore.basestore):' | |||
|
49 | 50 | def exists(self, hashes): |
|
50 | 51 | return dict( |
|
51 | 52 | (h, s == 0) |
|
52 |
for (h, s) in |
|
|
53 | for (h, s) in pycompat.iteritems( | |
|
54 | self._stat(hashes) | |
|
55 | ) # dict-from-generator | |
|
53 | 56 | ) |
|
54 | 57 | |
|
55 | 58 | def sendfile(self, filename, hash): |
@@ -381,7 +381,7 b' def lfsfiles(context, mapping):' | |||
|
381 | 381 | def pointer(v): |
|
382 | 382 | # In the file spec, version is first and the other keys are sorted. |
|
383 | 383 | sortkeyfunc = lambda x: (x[0] != b'version', x) |
|
384 |
items = sorted(pointers[v] |
|
|
384 | items = sorted(pycompat.iteritems(pointers[v]), key=sortkeyfunc) | |
|
385 | 385 | return util.sortdict(items) |
|
386 | 386 | |
|
387 | 387 | makemap = lambda v: { |
@@ -41,7 +41,7 b' class gitlfspointer(dict):' | |||
|
41 | 41 | |
|
42 | 42 | def serialize(self): |
|
43 | 43 | sortkeyfunc = lambda x: (x[0] != b'version', x) |
|
44 |
items = sorted(self.validate() |
|
|
44 | items = sorted(pycompat.iteritems(self.validate()), key=sortkeyfunc) | |
|
45 | 45 | return b''.join(b'%s %s\n' % (k, v) for k, v in items) |
|
46 | 46 | |
|
47 | 47 | def oid(self): |
@@ -63,7 +63,7 b' class gitlfspointer(dict):' | |||
|
63 | 63 | def validate(self): |
|
64 | 64 | """raise InvalidPointer on error. return self if there is no error""" |
|
65 | 65 | requiredcount = 0 |
|
66 |
for k, v in |
|
|
66 | for k, v in pycompat.iteritems(self): | |
|
67 | 67 | if k in self._requiredre: |
|
68 | 68 | if not self._requiredre[k].match(v): |
|
69 | 69 | raise InvalidPointer( |
@@ -25,6 +25,7 b' from mercurial import (' | |||
|
25 | 25 | exchange, |
|
26 | 26 | exthelper, |
|
27 | 27 | localrepo, |
|
28 | pycompat, | |
|
28 | 29 | revlog, |
|
29 | 30 | scmutil, |
|
30 | 31 | upgrade, |
@@ -138,7 +139,7 b' def writetostore(self, text, sidedata):' | |||
|
138 | 139 | |
|
139 | 140 | # translate hg filelog metadata to lfs metadata with "x-hg-" prefix |
|
140 | 141 | if hgmeta is not None: |
|
141 |
for k, v in |
|
|
142 | for k, v in pycompat.iteritems(hgmeta): | |
|
142 | 143 | metadata[b'x-hg-%s' % k] = v |
|
143 | 144 | |
|
144 | 145 | rawtext = metadata.serialize() |
@@ -2001,7 +2001,7 b' class queue(object):' | |||
|
2001 | 2001 | # we can't copy a file created by the patch itself |
|
2002 | 2002 | if dst in copies: |
|
2003 | 2003 | del copies[dst] |
|
2004 |
for src, dsts in |
|
|
2004 | for src, dsts in pycompat.iteritems(copies): | |
|
2005 | 2005 | for dst in dsts: |
|
2006 | 2006 | repo.dirstate.copy(src, dst) |
|
2007 | 2007 | else: |
@@ -4263,7 +4263,7 b' def extsetup(ui):' | |||
|
4263 | 4263 | entry[1].extend(mqopt) |
|
4264 | 4264 | |
|
4265 | 4265 | def dotable(cmdtable): |
|
4266 |
for cmd, entry in |
|
|
4266 | for cmd, entry in pycompat.iteritems(cmdtable): | |
|
4267 | 4267 | cmd = cmdutil.parsealiases(cmd)[0] |
|
4268 | 4268 | func = entry[0] |
|
4269 | 4269 | if func.norepo: |
@@ -151,7 +151,7 b' def _ctxdesc(ctx):' | |||
|
151 | 151 | ) |
|
152 | 152 | repo = ctx.repo() |
|
153 | 153 | names = [] |
|
154 |
for nsname, ns in repo.names |
|
|
154 | for nsname, ns in pycompat.iteritems(repo.names): | |
|
155 | 155 | if nsname == b'branches': |
|
156 | 156 | continue |
|
157 | 157 | names.extend(ns.names(repo, ctx.node())) |
@@ -239,7 +239,7 b' class rebaseruntime(object):' | |||
|
239 | 239 | f.write(b'%d\n' % int(self.keepbranchesf)) |
|
240 | 240 | f.write(b'%s\n' % (self.activebookmark or b'')) |
|
241 | 241 | destmap = self.destmap |
|
242 |
for d, v in self.state |
|
|
242 | for d, v in pycompat.iteritems(self.state): | |
|
243 | 243 | oldrev = repo[d].hex() |
|
244 | 244 | if v >= 0: |
|
245 | 245 | newrev = repo[v].hex() |
@@ -489,7 +489,7 b' class rebaseruntime(object):' | |||
|
489 | 489 | # commits. |
|
490 | 490 | self.storestatus(tr) |
|
491 | 491 | |
|
492 |
cands = [k for k, v in self.state |
|
|
492 | cands = [k for k, v in pycompat.iteritems(self.state) if v == revtodo] | |
|
493 | 493 | p = repo.ui.makeprogress( |
|
494 | 494 | _(b"rebasing"), unit=_(b'changesets'), total=len(cands) |
|
495 | 495 | ) |
@@ -1326,7 +1326,7 b' def _definedestmap(' | |||
|
1326 | 1326 | # emulate the old behavior, showing "nothing to rebase" (a better |
|
1327 | 1327 | # behavior may be abort with "cannot find branching point" error) |
|
1328 | 1328 | bpbase.clear() |
|
1329 |
for bp, bs in |
|
|
1329 | for bp, bs in pycompat.iteritems(bpbase): # calculate roots | |
|
1330 | 1330 | roots += list(repo.revs(b'children(%d) & ancestors(%ld)', bp, bs)) |
|
1331 | 1331 | |
|
1332 | 1332 | rebaseset = repo.revs(b'%ld::', roots) |
@@ -1970,7 +1970,7 b' def needupdate(repo, state):' | |||
|
1970 | 1970 | |
|
1971 | 1971 | # We should be standing on the first as-of-yet unrebased commit. |
|
1972 | 1972 | firstunrebased = min( |
|
1973 |
[old for old, new in |
|
|
1973 | [old for old, new in pycompat.iteritems(state) if new == nullrev] | |
|
1974 | 1974 | ) |
|
1975 | 1975 | if firstunrebased in parents: |
|
1976 | 1976 | return True |
@@ -2121,7 +2121,7 b' def clearrebased(' | |||
|
2121 | 2121 | fl = fm.formatlist |
|
2122 | 2122 | fd = fm.formatdict |
|
2123 | 2123 | changes = {} |
|
2124 |
for oldns, newn in |
|
|
2124 | for oldns, newn in pycompat.iteritems(replacements): | |
|
2125 | 2125 | for oldn in oldns: |
|
2126 | 2126 | changes[hf(oldn)] = fl([hf(n) for n in newn], name=b'node') |
|
2127 | 2127 | nodechanges = fd(changes, key=b"oldnode", value=b"newnodes") |
@@ -161,7 +161,7 b' class releasenotessections(object):' | |||
|
161 | 161 | custom_sections = getcustomadmonitions(repo) |
|
162 | 162 | if custom_sections: |
|
163 | 163 | sections.update(custom_sections) |
|
164 |
self._sections = list( |
|
|
164 | self._sections = list(pycompat.iteritems(sections)) | |
|
165 | 165 | else: |
|
166 | 166 | self._sections = list(DEFAULT_SECTIONS) |
|
167 | 167 |
@@ -502,7 +502,7 b' def checkunknownfiles(orig, repo, wctx, ' | |||
|
502 | 502 | if isenabled(repo): |
|
503 | 503 | files = [] |
|
504 | 504 | sparsematch = repo.maybesparsematch(mctx.rev()) |
|
505 |
for f, (m, actionargs, msg) in a |
|
|
505 | for f, (m, actionargs, msg) in pycompat.iteritems(actions): | |
|
506 | 506 | if sparsematch and not sparsematch(f): |
|
507 | 507 | continue |
|
508 | 508 | if m in (b'c', b'dc', b'cm'): |
@@ -148,7 +148,7 b' class basestore(object):' | |||
|
148 | 148 | |
|
149 | 149 | filenamemap = self._resolvefilenames(existing.keys()) |
|
150 | 150 | |
|
151 |
for filename, sha in |
|
|
151 | for filename, sha in pycompat.iteritems(filenamemap): | |
|
152 | 152 | yield (filename, existing[sha]) |
|
153 | 153 | |
|
154 | 154 | def _resolvefilenames(self, hashes): |
@@ -452,7 +452,7 b' class mutabledatapack(basepack.mutableba' | |||
|
452 | 452 | |
|
453 | 453 | def createindex(self, nodelocations, indexoffset): |
|
454 | 454 | entries = sorted( |
|
455 |
(n, db, o, s) for n, (db, o, s) in self.entries |
|
|
455 | (n, db, o, s) for n, (db, o, s) in pycompat.iteritems(self.entries) | |
|
456 | 456 | ) |
|
457 | 457 | |
|
458 | 458 | rawindex = b'' |
@@ -518,7 +518,7 b' class mutablehistorypack(basepack.mutabl' | |||
|
518 | 518 | |
|
519 | 519 | files = ( |
|
520 | 520 | (hashlib.sha1(filename).digest(), filename, offset, size) |
|
521 |
for filename, (offset, size) in self.files |
|
|
521 | for filename, (offset, size) in pycompat.iteritems(self.files) | |
|
522 | 522 | ) |
|
523 | 523 | files = sorted(files) |
|
524 | 524 | |
@@ -554,7 +554,7 b' class mutablehistorypack(basepack.mutabl' | |||
|
554 | 554 | ) |
|
555 | 555 | nodeindexoffset += constants.FILENAMESIZE + len(filename) |
|
556 | 556 | |
|
557 |
for node, location in sorted( |
|
|
557 | for node, location in sorted(pycompat.iteritems(nodelocations)): | |
|
558 | 558 | nodeindexentries.append( |
|
559 | 559 | struct.pack(nodeindexformat, node, location) |
|
560 | 560 | ) |
@@ -21,6 +21,7 b' from mercurial import (' | |||
|
21 | 21 | ancestor, |
|
22 | 22 | error, |
|
23 | 23 | mdiff, |
|
24 | pycompat, | |
|
24 | 25 | revlog, |
|
25 | 26 | util, |
|
26 | 27 | ) |
@@ -428,7 +429,7 b' class remotefilelog(object):' | |||
|
428 | 429 | return nullid |
|
429 | 430 | |
|
430 | 431 | revmap, parentfunc = self._buildrevgraph(a, b) |
|
431 |
nodemap = dict(((v, k) for (k, v) in |
|
|
432 | nodemap = dict(((v, k) for (k, v) in pycompat.iteritems(revmap))) | |
|
432 | 433 | |
|
433 | 434 | ancs = ancestor.ancestors(parentfunc, revmap[a], revmap[b]) |
|
434 | 435 | if ancs: |
@@ -443,7 +444,7 b' class remotefilelog(object):' | |||
|
443 | 444 | return nullid |
|
444 | 445 | |
|
445 | 446 | revmap, parentfunc = self._buildrevgraph(a, b) |
|
446 |
nodemap = dict(((v, k) for (k, v) in |
|
|
447 | nodemap = dict(((v, k) for (k, v) in pycompat.iteritems(revmap))) | |
|
447 | 448 | |
|
448 | 449 | ancs = ancestor.commonancestorsheads(parentfunc, revmap[a], revmap[b]) |
|
449 | 450 | return map(nodemap.__getitem__, ancs) |
@@ -459,7 +460,7 b' class remotefilelog(object):' | |||
|
459 | 460 | parentsmap = collections.defaultdict(list) |
|
460 | 461 | allparents = set() |
|
461 | 462 | for mapping in (amap, bmap): |
|
462 |
for node, pdata in |
|
|
463 | for node, pdata in pycompat.iteritems(mapping): | |
|
463 | 464 | parents = parentsmap[node] |
|
464 | 465 | p1, p2, linknode, copyfrom = pdata |
|
465 | 466 | # Don't follow renames (copyfrom). |
@@ -22,6 +22,7 b' from mercurial import (' | |||
|
22 | 22 | error, |
|
23 | 23 | extensions, |
|
24 | 24 | match, |
|
25 | pycompat, | |
|
25 | 26 | store, |
|
26 | 27 | streamclone, |
|
27 | 28 | util, |
@@ -417,7 +418,7 b' def gcserver(ui, repo):' | |||
|
417 | 418 | cachepath = repo.vfs.join(b"remotefilelogcache") |
|
418 | 419 | for head in heads: |
|
419 | 420 | mf = repo[head].manifest() |
|
420 |
for filename, filenode in |
|
|
421 | for filename, filenode in pycompat.iteritems(mf): | |
|
421 | 422 | filecachepath = os.path.join(cachepath, filename, hex(filenode)) |
|
422 | 423 | neededfiles.add(filecachepath) |
|
423 | 424 |
@@ -491,12 +491,12 b' def keepset(repo, keyfn, lastkeepkeys=No' | |||
|
491 | 491 | if type(m) is dict: |
|
492 | 492 | # m is a result of diff of two manifests and is a dictionary that |
|
493 | 493 | # maps filename to ((newnode, newflag), (oldnode, oldflag)) tuple |
|
494 | for filename, diff in m.iteritems(): | |
|
494 | for filename, diff in pycompat.iteritems(m): | |
|
495 | 495 | if diff[0][0] is not None: |
|
496 | 496 | keepkeys.add(keyfn(filename, diff[0][0])) |
|
497 | 497 | else: |
|
498 | 498 | # m is a manifest object |
|
499 | for filename, filenode in m.iteritems(): | |
|
499 | for filename, filenode in pycompat.iteritems(m): | |
|
500 | 500 | keepkeys.add(keyfn(filename, filenode)) |
|
501 | 501 | |
|
502 | 502 | return keepkeys |
@@ -606,7 +606,7 b' class repacker(object):' | |||
|
606 | 606 | repackprogress = ui.makeprogress( |
|
607 | 607 | _(b"repacking data"), unit=self.unit, total=len(byfile) |
|
608 | 608 | ) |
|
609 |
for filename, entries in sorted( |
|
|
609 | for filename, entries in sorted(pycompat.iteritems(byfile)): | |
|
610 | 610 | repackprogress.update(count) |
|
611 | 611 | |
|
612 | 612 | ancestors = {} |
@@ -760,7 +760,7 b' class repacker(object):' | |||
|
760 | 760 | progress = ui.makeprogress( |
|
761 | 761 | _(b"repacking history"), unit=self.unit, total=len(byfile) |
|
762 | 762 | ) |
|
763 |
for filename, entries in sorted( |
|
|
763 | for filename, entries in sorted(pycompat.iteritems(byfile)): | |
|
764 | 764 | ancestors = {} |
|
765 | 765 | nodes = list(node for node in entries) |
|
766 | 766 |
@@ -15,6 +15,7 b' from mercurial import (' | |||
|
15 | 15 | error, |
|
16 | 16 | localrepo, |
|
17 | 17 | match, |
|
18 | pycompat, | |
|
18 | 19 | scmutil, |
|
19 | 20 | sparse, |
|
20 | 21 | util, |
@@ -271,7 +272,7 b' def wraprepo(repo):' | |||
|
271 | 272 | mfrevlog = mfl.getstorage(b'') |
|
272 | 273 | if base is not None: |
|
273 | 274 | mfdict = mfl[repo[base].manifestnode()].read() |
|
274 |
skip = set( |
|
|
275 | skip = set(pycompat.iteritems(mfdict)) | |
|
275 | 276 | else: |
|
276 | 277 | skip = set() |
|
277 | 278 | |
@@ -301,7 +302,7 b' def wraprepo(repo):' | |||
|
301 | 302 | else: |
|
302 | 303 | mfdict = mfl[mfnode].read() |
|
303 | 304 | |
|
304 |
diff = |
|
|
305 | diff = pycompat.iteritems(mfdict) | |
|
305 | 306 | if pats: |
|
306 | 307 | diff = (pf for pf in diff if m(pf[0])) |
|
307 | 308 | if sparsematch: |
@@ -103,7 +103,7 b' def sumdicts(*dicts):' | |||
|
103 | 103 | """ |
|
104 | 104 | result = collections.defaultdict(lambda: 0) |
|
105 | 105 | for dict in dicts: |
|
106 |
for k, v in |
|
|
106 | for k, v in pycompat.iteritems(dict): | |
|
107 | 107 | result[k] += v |
|
108 | 108 | return result |
|
109 | 109 | |
@@ -111,7 +111,7 b' def sumdicts(*dicts):' | |||
|
111 | 111 | def prefixkeys(dict, prefix): |
|
112 | 112 | """Returns ``dict`` with ``prefix`` prepended to all its keys.""" |
|
113 | 113 | result = {} |
|
114 |
for k, v in |
|
|
114 | for k, v in pycompat.iteritems(dict): | |
|
115 | 115 | result[prefix + k] = v |
|
116 | 116 | return result |
|
117 | 117 | |
@@ -160,7 +160,7 b' def _buildpackmeta(metadict):' | |||
|
160 | 160 | length limit is exceeded |
|
161 | 161 | """ |
|
162 | 162 | metabuf = b'' |
|
163 |
for k, v in sorted((metadict or {}) |
|
|
163 | for k, v in sorted(pycompat.iteritems((metadict or {}))): | |
|
164 | 164 | if len(k) != 1: |
|
165 | 165 | raise error.ProgrammingError(b'packmeta: illegal key: %s' % k) |
|
166 | 166 | if len(v) > 0xFFFE: |
@@ -188,7 +188,7 b' def buildpackmeta(metadict):' | |||
|
188 | 188 | and METAKEYFLAG will be dropped if its value is 0. |
|
189 | 189 | """ |
|
190 | 190 | newmeta = {} |
|
191 |
for k, v in (metadict or {}) |
|
|
191 | for k, v in pycompat.iteritems(metadict or {}): | |
|
192 | 192 | expectedtype = _metaitemtypes.get(k, (bytes,)) |
|
193 | 193 | if not isinstance(v, expectedtype): |
|
194 | 194 | raise error.ProgrammingError(b'packmeta: wrong type of key %s' % k) |
@@ -209,7 +209,7 b' def parsepackmeta(metabuf):' | |||
|
209 | 209 | integers. |
|
210 | 210 | """ |
|
211 | 211 | metadict = _parsepackmeta(metabuf) |
|
212 |
for k, v in |
|
|
212 | for k, v in pycompat.iteritems(metadict): | |
|
213 | 213 | if k in _metaitemtypes and int in _metaitemtypes[k]: |
|
214 | 214 | metadict[k] = bin2int(v) |
|
215 | 215 | return metadict |
@@ -165,7 +165,7 b' class lazyremotenamedict(mutablemapping)' | |||
|
165 | 165 | if not self.loaded: |
|
166 | 166 | self._load() |
|
167 | 167 | |
|
168 |
for k, vtup in self.potentialentries |
|
|
168 | for k, vtup in pycompat.iteritems(self.potentialentries): | |
|
169 | 169 | yield (k, [bin(vtup[0])]) |
|
170 | 170 | |
|
171 | 171 | items = iteritems |
@@ -202,7 +202,7 b' class remotenames(object):' | |||
|
202 | 202 | if not self._nodetobmarks: |
|
203 | 203 | bmarktonodes = self.bmarktonodes() |
|
204 | 204 | self._nodetobmarks = {} |
|
205 |
for name, node in |
|
|
205 | for name, node in pycompat.iteritems(bmarktonodes): | |
|
206 | 206 | self._nodetobmarks.setdefault(node[0], []).append(name) |
|
207 | 207 | return self._nodetobmarks |
|
208 | 208 | |
@@ -213,7 +213,7 b' class remotenames(object):' | |||
|
213 | 213 | if not self._nodetobranch: |
|
214 | 214 | branchtonodes = self.branchtonodes() |
|
215 | 215 | self._nodetobranch = {} |
|
216 |
for name, nodes in |
|
|
216 | for name, nodes in pycompat.iteritems(branchtonodes): | |
|
217 | 217 | for node in nodes: |
|
218 | 218 | self._nodetobranch.setdefault(node, []).append(name) |
|
219 | 219 | return self._nodetobranch |
@@ -223,7 +223,7 b' class remotenames(object):' | |||
|
223 | 223 | marktonodes = self.bmarktonodes() |
|
224 | 224 | self._hoisttonodes = {} |
|
225 | 225 | hoist += b'/' |
|
226 |
for name, node in ma |
|
|
226 | for name, node in pycompat.iteritems(marktonodes): | |
|
227 | 227 | if name.startswith(hoist): |
|
228 | 228 | name = name[len(hoist) :] |
|
229 | 229 | self._hoisttonodes[name] = node |
@@ -234,7 +234,7 b' class remotenames(object):' | |||
|
234 | 234 | marktonodes = self.bmarktonodes() |
|
235 | 235 | self._nodetohoists = {} |
|
236 | 236 | hoist += b'/' |
|
237 |
for name, node in ma |
|
|
237 | for name, node in pycompat.iteritems(marktonodes): | |
|
238 | 238 | if name.startswith(hoist): |
|
239 | 239 | name = name[len(hoist) :] |
|
240 | 240 | self._nodetohoists.setdefault(node[0], []).append(name) |
@@ -206,7 +206,7 b' def stripcmd(ui, repo, *revs, **opts):' | |||
|
206 | 206 | # a revision we have to only delete the bookmark and not strip |
|
207 | 207 | # anything. revsets cannot detect that case. |
|
208 | 208 | nodetobookmarks = {} |
|
209 |
for mark, node in |
|
|
209 | for mark, node in pycompat.iteritems(repomarks): | |
|
210 | 210 | nodetobookmarks.setdefault(node, []).append(mark) |
|
211 | 211 | for marks in nodetobookmarks.values(): |
|
212 | 212 | if bookmarks.issuperset(marks): |
@@ -78,7 +78,9 b' def _commitfiltered(' | |||
|
78 | 78 | files = initialfiles - exclude |
|
79 | 79 | # Filter copies |
|
80 | 80 | copied = copiesmod.pathcopies(base, ctx) |
|
81 | copied = dict((dst, src) for dst, src in copied.iteritems() if dst in files) | |
|
81 | copied = dict( | |
|
82 | (dst, src) for dst, src in pycompat.iteritems(copied) if dst in files | |
|
83 | ) | |
|
82 | 84 | |
|
83 | 85 | def filectxfn(repo, memctx, path, contentctx=ctx, redirect=()): |
|
84 | 86 | if path not in contentctx: |
@@ -209,7 +209,7 b' def forbidcr(ui, repo, hooktype, node, *' | |||
|
209 | 209 | def reposetup(ui, repo): |
|
210 | 210 | if not repo.local(): |
|
211 | 211 | return |
|
212 |
for name, fn in |
|
|
212 | for name, fn in pycompat.iteritems(_filters): | |
|
213 | 213 | repo.adddatafilter(name, fn) |
|
214 | 214 | |
|
215 | 215 |
@@ -31,7 +31,7 b' if sys.version_info[0] >= 3:' | |||
|
31 | 31 | |
|
32 | 32 | def find_spec(self, fullname, path, target=None): |
|
33 | 33 | # Only handle Mercurial-related modules. |
|
34 |
if not fullname.startswith( |
|
|
34 | if not fullname.startswith('mercurial.'): | |
|
35 | 35 | return None |
|
36 | 36 | # don't try to parse binary |
|
37 | 37 | if fullname.startswith('mercurial.cext.'): |
@@ -46,9 +46,6 b' if sys.version_info[0] >= 3:' | |||
|
46 | 46 | # don't try and mangle it |
|
47 | 47 | if fullname.startswith('mercurial.rustext'): |
|
48 | 48 | return None |
|
49 | # pywatchman is already dual-version clean, don't try and mangle it | |
|
50 | if fullname.startswith('hgext.fsmonitor.pywatchman'): | |
|
51 | return None | |
|
52 | 49 | |
|
53 | 50 | # Try to find the module using other registered finders. |
|
54 | 51 | spec = None |
@@ -131,7 +128,7 b' if sys.version_info[0] >= 3:' | |||
|
131 | 128 | # ``replacetoken`` or any mechanism that changes semantics of module |
|
132 | 129 | # loading is changed. Otherwise cached bytecode may get loaded without |
|
133 | 130 | # the new transformation mechanisms applied. |
|
134 |
BYTECODEHEADER = b'HG\x00\x1 |
|
|
131 | BYTECODEHEADER = b'HG\x00\x16' | |
|
135 | 132 | |
|
136 | 133 | class hgloader(importlib.machinery.SourceFileLoader): |
|
137 | 134 | """Custom module loader that transforms source code. |
@@ -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 | iteritems = lambda x: x.items() | |
|
340 | 341 | itervalues = lambda x: x.values() |
|
341 | 342 | |
|
342 | 343 | else: |
@@ -414,6 +415,7 b' else:' | |||
|
414 | 415 | ziplist = zip |
|
415 | 416 | rawinput = raw_input |
|
416 | 417 | getargspec = inspect.getargspec |
|
418 | iteritems = lambda x: x.iteritems() | |
|
417 | 419 | itervalues = lambda x: x.itervalues() |
|
418 | 420 | |
|
419 | 421 | isjython = sysplatform.startswith(b'java') |
General Comments 0
You need to be logged in to leave comments.
Login now