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