Mercurial > hgsubversion
comparison fetch_command.py @ 128:bab5bcbbb3dc
fetch_command: in stupid mode, load binary files when necessary
| author | Patrick Mezard <pmezard@gmail.com> |
|---|---|
| date | Wed, 10 Dec 2008 11:03:20 -0600 |
| parents | 7e45bcf52b64 |
| children | 59f8603a6641 |
comparison
equal
deleted
inserted
replaced
| 127:7e45bcf52b64 | 128:bab5bcbbb3dc |
|---|---|
| 223 except core.SubversionException, e: | 223 except core.SubversionException, e: |
| 224 if (hasattr(e, 'apr_err') and e.apr_err != 160013): | 224 if (hasattr(e, 'apr_err') and e.apr_err != 160013): |
| 225 raise | 225 raise |
| 226 raise BadPatchApply('previous revision does not exist') | 226 raise BadPatchApply('previous revision does not exist') |
| 227 files_data = {} | 227 files_data = {} |
| 228 binary_files = {} | |
| 228 for m in binary_file_re.findall(d): | 229 for m in binary_file_re.findall(d): |
| 229 # we have to pull each binary file by hand as a fulltext, | 230 # we have to pull each binary file by hand as a fulltext, |
| 230 # which sucks but we've got no choice | 231 # which sucks but we've got no choice |
| 231 try: | 232 binary_files[m] = 1 |
| 232 files_data[m] = svn.get_file(diff_path+'/'+m, r.revnum)[0] | 233 files_data[m] = '' |
| 233 except IOError: | |
| 234 files_data[m] = None | |
| 235 d2 = empty_file_patch_wont_make_re.sub('', d) | 234 d2 = empty_file_patch_wont_make_re.sub('', d) |
| 236 d2 = property_exec_set_re.sub('', d2) | 235 d2 = property_exec_set_re.sub('', d2) |
| 237 d2 = property_exec_removed_re.sub('', d2) | 236 d2 = property_exec_removed_re.sub('', d2) |
| 238 for f in any_file_re.findall(d): | 237 for f in any_file_re.findall(d): |
| 239 if f in files_data: | 238 if f in files_data: |
| 319 | 318 |
| 320 def filectxfn(repo, memctx, path): | 319 def filectxfn(repo, memctx, path): |
| 321 data = files_data[path] | 320 data = files_data[path] |
| 322 if data is None: | 321 if data is None: |
| 323 raise IOError() | 322 raise IOError() |
| 324 if path in link_files: | 323 if path not in binary_files: |
| 325 return context.memfilectx(path=path, data=data, | 324 isexe = exec_files.get(path, 'x' in parentctx.flags(path)) |
| 326 islink=True, isexec=False, | 325 islink = path in link_files |
| 327 copied=False) | 326 else: |
| 328 exe = exec_files.get(path, 'x' in parentctx.flags(path)) | 327 data, mode = svn.get_file(diff_path + '/' + path, r.revnum) |
| 328 isexe = 'x' in mode | |
| 329 islink = 'l' in mode | |
| 329 copied = copies.get(path) | 330 copied = copies.get(path) |
| 330 return context.memfilectx(path=path, data=data, islink=False, | 331 return context.memfilectx(path=path, data=data, islink=islink, |
| 331 isexec=exe, copied=copied) | 332 isexec=isexe, copied=copied) |
| 332 | 333 |
| 333 return list(files_data), filectxfn | 334 return list(files_data), filectxfn |
| 334 | 335 |
| 335 def makecopyfinder(r, branchpath, rootdir): | 336 def makecopyfinder(r, branchpath, rootdir): |
| 336 """Return a function detecting copies. | 337 """Return a function detecting copies. |
