comparison fetch_command.py @ 59:430af23bef4a

Performance fix for branches-from-tags in real replay, which is tied up with changes that fix problems when trunk is not the oldest branch. Also includes fixes for copying from a tag that we chose not to create (eg tagging a vendor branch) and includes tests for all of those things.
author Augie Fackler <durin42@gmail.com>
date Tue, 04 Nov 2008 16:38:16 -0600
parents a8b9c7e7c2ac
children 2e30b59a9c19
comparison
equal deleted inserted replaced
58:a8b9c7e7c2ac 59:430af23bef4a
433 if f.startswith(p2 + '/')] 433 if f.startswith(p2 + '/')]
434 for d in d_files: 434 for d in d_files:
435 files_touched.add(d) 435 files_touched.add(d)
436 if delete_all_files: 436 if delete_all_files:
437 for p in hg_editor.repo[parent_ha].manifest().iterkeys(): 437 for p in hg_editor.repo[parent_ha].manifest().iterkeys():
438 files_touched.add(p) 438 if p:
439 files_touched.add(p)
439 if not used_diff: 440 if not used_diff:
440 for p in reduce(operator.add, [[os.path.join(x[0], y) for y in x[2]] 441 for p in reduce(operator.add, [[os.path.join(x[0], y) for y in x[2]]
441 for x in 442 for x in
442 list(os.walk(our_tempdir))]): 443 list(os.walk(our_tempdir))]):
443 p_real = p[len(our_tempdir)+1:] 444 p_real = p[len(our_tempdir)+1:]
445 link_files[p_real] = os.readlink(p) 446 link_files[p_real] = os.readlink(p)
446 exec_files[p_real] = (os.lstat(p).st_mode & 0100 != 0) 447 exec_files[p_real] = (os.lstat(p).st_mode & 0100 != 0)
447 files_touched.add(p_real) 448 files_touched.add(p_real)
448 for p in hg_editor.repo[parent_ha].manifest().iterkeys(): 449 for p in hg_editor.repo[parent_ha].manifest().iterkeys():
449 # TODO this might not be a required step. 450 # TODO this might not be a required step.
450 files_touched.add(p) 451 if p:
452 files_touched.add(p)
451 date = r.date.replace('T', ' ').replace('Z', '').split('.')[0] 453 date = r.date.replace('T', ' ').replace('Z', '').split('.')[0]
452 date += ' -0000' 454 date += ' -0000'
453 def filectxfn(repo, memctx, path): 455 def filectxfn(repo, memctx, path):
454 disk_path = os.path.join(our_tempdir, path) 456 disk_path = os.path.join(our_tempdir, path)
455 if path in link_files: 457 if path in link_files:
463 return context.memfilectx(path=path, data=fp.read(), islink=False, 465 return context.memfilectx(path=path, data=fp.read(), islink=False,
464 isexec=exe, copied=False) 466 isexec=exe, copied=False)
465 extra = {} 467 extra = {}
466 if b: 468 if b:
467 extra['branch'] = b 469 extra['branch'] = b
470 if '' in files_touched:
471 files_touched.remove('')
468 if parent_ha != node.nullid or files_touched: 472 if parent_ha != node.nullid or files_touched:
469 # TODO(augie) remove this debug code? Or maybe it's sane to have it. 473 # TODO(augie) remove this debug code? Or maybe it's sane to have it.
470 for f in files_touched: 474 for f in files_touched:
471 if f: 475 if f:
472 assert f[0] != '/' 476 assert f[0] != '/'