Mercurial > hgsubversion
comparison fetch_command.py @ 107:a8950157281a
fetch_command: use the opener to read touched files
| author | Patrick Mezard <pmezard@gmail.com> |
|---|---|
| date | Tue, 25 Nov 2008 09:18:28 -0600 |
| parents | 122b6037e5f9 |
| children | de19a13edfa8 |
comparison
equal
deleted
inserted
replaced
| 106:122b6037e5f9 | 107:a8950157281a |
|---|---|
| 472 parent_ha) | 472 parent_ha) |
| 473 | 473 |
| 474 def filectxfn(repo, memctx, path): | 474 def filectxfn(repo, memctx, path): |
| 475 if path in deleted_files: | 475 if path in deleted_files: |
| 476 raise IOError() | 476 raise IOError() |
| 477 disk_path = os.path.join(our_tempdir, path) | |
| 478 if path in link_files: | 477 if path in link_files: |
| 479 return context.memfilectx(path=path, data=link_files[path], | 478 return context.memfilectx(path=path, data=link_files[path], |
| 480 islink=True, isexec=False, | 479 islink=True, isexec=False, |
| 481 copied=False) | 480 copied=False) |
| 482 fp = open(disk_path) | 481 data = opener(path).read() |
| 483 exe = exec_files.get(path, None) | 482 exe = exec_files.get(path, None) |
| 484 if exe is None and path in hg_editor.repo[parent_ha]: | 483 if exe is None and path in hg_editor.repo[parent_ha]: |
| 485 exe = 'x' in hg_editor.repo[parent_ha].filectx(path).flags() | 484 exe = 'x' in hg_editor.repo[parent_ha].filectx(path).flags() |
| 486 copied = copies.get(path) | 485 copied = copies.get(path) |
| 487 return context.memfilectx(path=path, data=fp.read(), islink=False, | 486 return context.memfilectx(path=path, data=data, islink=False, |
| 488 isexec=exe, copied=copied) | 487 isexec=exe, copied=copied) |
| 489 except (core.SubversionException, | 488 except (core.SubversionException, |
| 490 BadPatchApply, | 489 BadPatchApply, |
| 491 svnwrap.SubversionRepoCanNotDiff), e: | 490 svnwrap.SubversionRepoCanNotDiff), e: |
| 492 if (hasattr(e, 'apr_err') and e.apr_err != 160013): | 491 if (hasattr(e, 'apr_err') and e.apr_err != 160013): |
