##// END OF EJS Templates
clone: use better names for temp files...
Arseniy Alekseyev -
r50085:4ff4e23d default
parent child Browse files
Show More
@@ -558,11 +558,15 b' def _filterfull(entry, copy, vfsmap):'
558 558 @contextlib.contextmanager
559 559 def maketempcopies():
560 560 """return a function to temporary copy file"""
561
561 562 files = []
563 dst_dir = pycompat.mkdtemp(prefix=b'hg-clone-')
562 564 try:
563 565
564 566 def copy(src):
565 fd, dst = pycompat.mkstemp()
567 fd, dst = pycompat.mkstemp(
568 prefix=os.path.basename(src), dir=dst_dir
569 )
566 570 os.close(fd)
567 571 files.append(dst)
568 572 util.copyfiles(src, dst, hardlink=True)
@@ -572,6 +576,7 b' def maketempcopies():'
572 576 finally:
573 577 for tmp in files:
574 578 util.tryunlink(tmp)
579 util.tryrmdir(dst_dir)
575 580
576 581
577 582 def _makemap(repo):
@@ -2592,6 +2592,14 b' class atomictempfile:'
2592 2592 self.close()
2593 2593
2594 2594
2595 def tryrmdir(f):
2596 try:
2597 removedirs(f)
2598 except OSError as e:
2599 if e.errno != errno.ENOENT and e.errno != errno.ENOTEMPTY:
2600 raise
2601
2602
2595 2603 def unlinkpath(f, ignoremissing=False, rmdir=True):
2596 2604 # type: (bytes, bool, bool) -> None
2597 2605 """unlink and remove the directory if it is empty"""
General Comments 0
You need to be logged in to leave comments. Login now