mercurial/util.py
changeset 49190 4ff4e23de7df
parent 48995 7ccf3dac1a8f
child 49275 c6a3243567b6
--- 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"""