[PATCH STABLE] hghave: fix 'rmcwd' to ensure temporary directory is removed

Yuya Nishihara yuya at tcha.org
Tue Nov 1 12:44:05 UTC 2016


# HG changeset patch
# User Yuya Nishihara <yuya at tcha.org>
# Date 1478002473 -32400
#      Tue Nov 01 21:14:33 2016 +0900
# Branch stable
# Node ID 389cbfe63586d2b4c53e3220fcc01b211906ba85
# Parent  cac4ca036dff882c71f48f3130b72597d3e1fc64
hghave: fix 'rmcwd' to ensure temporary directory is removed

On platforms where cwd can't be removed, it should try rmdir() after chdir
to the original cwd.

diff --git a/tests/hghave.py b/tests/hghave.py
--- a/tests/hghave.py
+++ b/tests/hghave.py
@@ -360,6 +360,11 @@ def has_rmcwd():
         return False
     finally:
         os.chdir(ocwd)
+        # clean up temp dir on platforms where cwd can't be removed
+        try:
+            os.rmdir(temp)
+        except OSError:
+            pass
 
 @check("tla", "GNU Arch tla client")
 def has_tla():


More information about the Mercurial-devel mailing list