Mercurial > hg
comparison mercurial/ignore.py @ 7622:4dd7b28003d2
use dict.iteritems() rather than dict.items()
This should be faster and more future-proof. Calls where the result is to be
sorted using util.sort() have been left unchanged. Calls to .items() on
configparser objects have been left as-is, too.
author | Dirkjan Ochtman <dirkjan@ochtman.nl> |
---|---|
date | Mon, 12 Jan 2009 09:16:03 +0100 |
parents | 04c76f296ad6 |
children | 46293a0c7e9f |
comparison
equal
deleted
inserted
replaced
7621:6d891df43a5f | 7622:4dd7b28003d2 |
---|---|
58 syntax = syntaxes[s] | 58 syntax = syntaxes[s] |
59 except KeyError: | 59 except KeyError: |
60 warn(_("%s: ignoring invalid syntax '%s'\n") % (f, s)) | 60 warn(_("%s: ignoring invalid syntax '%s'\n") % (f, s)) |
61 continue | 61 continue |
62 pat = syntax + line | 62 pat = syntax + line |
63 for s, rels in syntaxes.items(): | 63 for s, rels in syntaxes.iteritems(): |
64 if line.startswith(rels): | 64 if line.startswith(rels): |
65 pat = line | 65 pat = line |
66 break | 66 break |
67 elif line.startswith(s+':'): | 67 elif line.startswith(s+':'): |
68 pat = rels + line[len(s)+1:] | 68 pat = rels + line[len(s)+1:] |
81 try: | 81 try: |
82 files, ignorefunc, anypats = ( | 82 files, ignorefunc, anypats = ( |
83 util.matcher(root, inc=allpats, src='.hgignore')) | 83 util.matcher(root, inc=allpats, src='.hgignore')) |
84 except util.Abort: | 84 except util.Abort: |
85 # Re-raise an exception where the src is the right file | 85 # Re-raise an exception where the src is the right file |
86 for f, patlist in pats.items(): | 86 for f, patlist in pats.iteritems(): |
87 files, ignorefunc, anypats = ( | 87 files, ignorefunc, anypats = ( |
88 util.matcher(root, inc=patlist, src=f)) | 88 util.matcher(root, inc=patlist, src=f)) |
89 | 89 |
90 return ignorefunc | 90 return ignorefunc |