Mercurial > public > mercurial-scm > hg
comparison mercurial/manifest.py @ 6765:be142cb994ff
manifest: make checkforbidden take a list
author | Matt Mackall <mpm@selenic.com> |
---|---|
date | Fri, 27 Jun 2008 19:27:00 -0500 |
parents | f67d1468ac50 |
children | 6db4a2ccef3a |
comparison
equal
deleted
inserted
replaced
6764:8db64464d136 | 6765:be142cb994ff |
---|---|
117 else: | 117 else: |
118 del addlist[start:end] | 118 del addlist[start:end] |
119 return "".join([struct.pack(">lll", d[0], d[1], len(d[2])) + d[2] | 119 return "".join([struct.pack(">lll", d[0], d[1], len(d[2])) + d[2] |
120 for d in x ]) | 120 for d in x ]) |
121 | 121 |
122 def checkforbidden(f): | 122 def checkforbidden(l): |
123 if '\n' in f or '\r' in f: | 123 for f in l: |
124 raise RevlogError(_("'\\n' and '\\r' disallowed in filenames")) | 124 if '\n' in f or '\r' in f: |
125 raise RevlogError(_("'\\n' and '\\r' disallowed in filenames")) | |
125 | 126 |
126 # if we're using the listcache, make sure it is valid and | 127 # if we're using the listcache, make sure it is valid and |
127 # parented by the same node we're diffing against | 128 # parented by the same node we're diffing against |
128 if not (changed and self.listcache and p1 and self.mapcache[0] == p1): | 129 if not (changed and self.listcache and p1 and self.mapcache[0] == p1): |
129 files = util.sort(map) | 130 files = util.sort(map) |
130 for f in files: | 131 checkforbidden(files) |
131 checkforbidden(f) | |
132 | 132 |
133 # if this is changed to support newlines in filenames, | 133 # if this is changed to support newlines in filenames, |
134 # be sure to check the templates/ dir again (especially *-raw.tmpl) | 134 # be sure to check the templates/ dir again (especially *-raw.tmpl) |
135 text = ["%s\000%s%s\n" % (f, hex(map[f]), map.flags(f)) | 135 text = ["%s\000%s%s\n" % (f, hex(map[f]), map.flags(f)) |
136 for f in files] | 136 for f in files] |
137 self.listcache = array.array('c', "".join(text)) | 137 self.listcache = array.array('c', "".join(text)) |
138 cachedelta = None | 138 cachedelta = None |
139 else: | 139 else: |
140 addlist = self.listcache | 140 addlist = self.listcache |
141 | 141 |
142 for f in changed[0]: | 142 checkforbidden(changed[0]) |
143 checkforbidden(f) | |
144 # combine the changed lists into one list for sorting | 143 # combine the changed lists into one list for sorting |
145 work = [[x, 0] for x in changed[0]] | 144 work = [[x, 0] for x in changed[0]] |
146 work[len(work):] = [[x, 1] for x in changed[1]] | 145 work[len(work):] = [[x, 1] for x in changed[1]] |
147 work.sort() | 146 work.sort() |
148 | 147 |