comparison fetch_command.py @ 106:122b6037e5f9

fetch_command: simplify deleted files enumeration, bypass filesystem
author Patrick Mezard <pmezard@gmail.com>
date Tue, 25 Nov 2008 09:18:28 -0600
parents 607d72c12dee
children a8950157281a
comparison
equal deleted inserted replaced
105:607d72c12dee 106:122b6037e5f9
454 link_path = link_path[len('link '):] 454 link_path = link_path[len('link '):]
455 os.remove(path) 455 os.remove(path)
456 link_files[m] = link_path 456 link_files[m] = link_path
457 files_touched.add(m) 457 files_touched.add(m)
458 458
459 deleted_files = set()
459 for p in r.paths: 460 for p in r.paths:
460 if p.startswith(diff_path) and r.paths[p].action == 'D': 461 if p.startswith(diff_path) and r.paths[p].action == 'D':
461 p2 = p[len(diff_path)+1:] 462 p2 = p[len(diff_path)+1:].strip('/')
462 files_touched.add(p2) 463 if p2 in hg_editor.repo[parent_ha]:
463 p3 = os.path.join(our_tempdir, p2) 464 deleted_files.add(p2)
464 if os.path.exists(p3) and not os.path.isdir(p3): 465 continue
465 os.unlink(p3)
466 if p2 and p2[0] == '/':
467 p2 = p2[1:]
468 # If this isn't in the parent ctx, it must've been a dir 466 # If this isn't in the parent ctx, it must've been a dir
469 if not p2 in hg_editor.repo[parent_ha]: 467 deleted_files.update([f for f in hg_editor.repo[parent_ha]
470 d_files = [f for f in hg_editor.repo[parent_ha].manifest().iterkeys() 468 if f.startswith(p2 + '/')])
471 if f.startswith(p2 + '/')] 469 files_touched.update(deleted_files)
472 for d in d_files:
473 files_touched.add(d)
474 470
475 copies = getcopies(svn, hg_editor, b, branches[b], r, files_touched, 471 copies = getcopies(svn, hg_editor, b, branches[b], r, files_touched,
476 parent_ha) 472 parent_ha)
477 473
478 def filectxfn(repo, memctx, path): 474 def filectxfn(repo, memctx, path):
475 if path in deleted_files:
476 raise IOError()
479 disk_path = os.path.join(our_tempdir, path) 477 disk_path = os.path.join(our_tempdir, path)
480 if path in link_files: 478 if path in link_files:
481 return context.memfilectx(path=path, data=link_files[path], 479 return context.memfilectx(path=path, data=link_files[path],
482 islink=True, isexec=False, 480 islink=True, isexec=False,
483 copied=False) 481 copied=False)