# HG changeset patch
# User Matt Harbison <matt_harbison@yahoo.com>
# Date 2018-09-08 03:39:49
# Node ID c4a7ba10cdd7da058627e23c461ecbe7240a789c
# Parent  8eb2145ff0fb2257eaec40f9bfcbd332bedea820

tests: conditionalize an error message about unlinking a non empty directory

The message on Windows comes from win32.unlink().  It looks like os.unlink() on
posix platforms is a simple call to unlink(3), which turns into unlinkat(2).
Since there's a comment in one of the tests that the message should be improved,
I don't think it's worth adding a check in win32.unlink() to see if it's empty,
if that function is always going to fail on a directory.  (It seems like the
POSIX spec allows unlinking directories though.)

diff --git a/tests/test-merge1.t b/tests/test-merge1.t
--- a/tests/test-merge1.t
+++ b/tests/test-merge1.t
@@ -30,7 +30,8 @@ of the files in a commit we're updating 
 
   $ mkdir b && touch b/nonempty
   $ hg up
-  abort: Directory not empty: '$TESTTMP/t/b'
+  abort: Unlinking directory not permitted: '$TESTTMP/t/b' (windows !)
+  abort: Directory not empty: '$TESTTMP/t/b' (no-windows !)
   [255]
   $ hg ci
   abort: last update was interrupted
diff --git a/tests/test-update-names.t b/tests/test-update-names.t
--- a/tests/test-update-names.t
+++ b/tests/test-update-names.t
@@ -50,7 +50,8 @@ make sure that this does not erase untra
   $ hg st
   ? name/file
   $ hg up 1
-  abort: Directory not empty: '$TESTTMP/r1/r2/name'
+  abort: Unlinking directory not permitted: '$TESTTMP/r1/r2/name' (windows !)
+  abort: Directory not empty: '$TESTTMP/r1/r2/name' (no-windows !)
   [255]
   $ cat name/file
   text