Mercurial > hgsubversion
comparison hgsubversion/stupid.py @ 529:68667b627bd5
stupid: replace dicts with sets
author | Patrick Mezard <pmezard@gmail.com> |
---|---|
date | Fri, 29 Jan 2010 23:36:14 +0100 |
parents | 052050ca59d6 |
children | cf4fe45bf8fd |
comparison
equal
deleted
inserted
replaced
528:052050ca59d6 | 529:68667b627bd5 |
---|---|
132 raise | 132 raise |
133 raise BadPatchApply('previous revision does not exist') | 133 raise BadPatchApply('previous revision does not exist') |
134 if '\0' in d: | 134 if '\0' in d: |
135 raise BadPatchApply('binary diffs are not supported') | 135 raise BadPatchApply('binary diffs are not supported') |
136 files_data = {} | 136 files_data = {} |
137 binary_files = {} | 137 # we have to pull each binary file by hand as a fulltext, |
138 touched_files = {} | 138 # which sucks but we've got no choice |
139 for m in binary_file_re.findall(d): | 139 binary_files = set(binary_file_re.findall(d)) |
140 # we have to pull each binary file by hand as a fulltext, | 140 touched_files = set(binary_files) |
141 # which sucks but we've got no choice | |
142 binary_files[m] = 1 | |
143 touched_files[m] = 1 | |
144 d2 = empty_file_patch_wont_make_re.sub('', d) | 141 d2 = empty_file_patch_wont_make_re.sub('', d) |
145 d2 = property_exec_set_re.sub('', d2) | 142 d2 = property_exec_set_re.sub('', d2) |
146 d2 = property_exec_removed_re.sub('', d2) | 143 d2 = property_exec_removed_re.sub('', d2) |
147 for f in any_file_re.findall(d): | 144 # Here we ensure that all files, including the new empty ones |
148 # Here we ensure that all files, including the new empty ones | 145 # are marked as touched. Content is loaded on demand. |
149 # are marked as touched. Content is loaded on demand. | 146 touched_files.update(any_file_re.findall(d)) |
150 touched_files[f] = 1 | |
151 if d2.strip() and len(re.findall('\n[-+]', d2.strip())) > 0: | 147 if d2.strip() and len(re.findall('\n[-+]', d2.strip())) > 0: |
152 try: | 148 try: |
153 oldpatchfile = patch.patchfile | 149 oldpatchfile = patch.patchfile |
154 olditerhunks = patch.iterhunks | 150 olditerhunks = patch.iterhunks |
155 patch.patchfile = mempatchproxy(parentctx, files_data) | 151 patch.patchfile = mempatchproxy(parentctx, files_data) |
188 exec_files = {} | 184 exec_files = {} |
189 for m in property_exec_removed_re.findall(d): | 185 for m in property_exec_removed_re.findall(d): |
190 exec_files[m] = False | 186 exec_files[m] = False |
191 for m in property_exec_set_re.findall(d): | 187 for m in property_exec_set_re.findall(d): |
192 exec_files[m] = True | 188 exec_files[m] = True |
193 for m in exec_files: | 189 touched_files.update(exec_files) |
194 touched_files[m] = 1 | |
195 link_files = {} | 190 link_files = {} |
196 for m in property_special_set_re.findall(d): | 191 for m in property_special_set_re.findall(d): |
197 # TODO(augie) when a symlink is removed, patching will fail. | 192 # TODO(augie) when a symlink is removed, patching will fail. |
198 # We're seeing that above - there's gotta be a better | 193 # We're seeing that above - there's gotta be a better |
199 # workaround than just bailing like that. | 194 # workaround than just bailing like that. |
221 # Files were replaced, we don't know if they still exist | 216 # Files were replaced, we don't know if they still exist |
222 unknown_files.update(toucheds) | 217 unknown_files.update(toucheds) |
223 else: | 218 else: |
224 files_data.update((f, None) for f in toucheds) | 219 files_data.update((f, None) for f in toucheds) |
225 | 220 |
226 touched_files.update((f, 1) for f in files_data) | 221 touched_files.update(files_data) |
227 touched_files.update((f, 1) for f in unknown_files) | 222 touched_files.update(unknown_files) |
228 | 223 |
229 copies = getcopies(svn, meta, branch, diff_path, r, touched_files, | 224 copies = getcopies(svn, meta, branch, diff_path, r, touched_files, |
230 parentctx) | 225 parentctx) |
231 | 226 |
232 def filectxfn(repo, memctx, path): | 227 def filectxfn(repo, memctx, path): |