Mercurial > hg
diff mercurial/util.py @ 49190:4ff4e23de7df
clone: use better names for temp files
Before this commit, the file names are /tmp/tmpn8smvlr8
After this commit, they are more like /tmp/hg-clone-n8smvlr8/00manifest.ndb3qj52v6,
which makes it much clearer what these files correspond to.
Differential Revision: https://phab.mercurial-scm.org/D12623
author | Arseniy Alekseyev <aalekseyev@janestreet.com> |
---|---|
date | Tue, 10 May 2022 20:30:26 +0100 |
parents | 7ccf3dac1a8f |
children | c6a3243567b6 |
line wrap: on
line diff
--- a/mercurial/util.py Mon May 02 16:27:14 2022 +0400 +++ b/mercurial/util.py Tue May 10 20:30:26 2022 +0100 @@ -2592,6 +2592,14 @@ self.close() +def tryrmdir(f): + try: + removedirs(f) + except OSError as e: + if e.errno != errno.ENOENT and e.errno != errno.ENOTEMPTY: + raise + + def unlinkpath(f, ignoremissing=False, rmdir=True): # type: (bytes, bool, bool) -> None """unlink and remove the directory if it is empty"""