Patchwork [1,of,2] tests: conditionalize an error message about unlinking a non empty directory

login
register
mail settings
Submitter Matt Harbison
Date Sept. 8, 2018, 4:04 a.m.
Message ID <cf6130dd324b0eed4c90.1536379481@Envy>
Download mbox | patch
Permalink /patch/34411/
State Accepted
Headers show

Comments

Matt Harbison - Sept. 8, 2018, 4:04 a.m.
# HG changeset patch
# User Matt Harbison <matt_harbison@yahoo.com>
# Date 1536377989 14400
#      Fri Sep 07 23:39:49 2018 -0400
# Node ID cf6130dd324b0eed4c902b45df503be429fe413f
# Parent  a60dae060bc83e773bdbafb2432bc4cf387ebce2
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.)
Yuya Nishihara - Sept. 8, 2018, 8:20 a.m.
On Sat, 08 Sep 2018 00:04:41 -0400, Matt Harbison wrote:
> # HG changeset patch
> # User Matt Harbison <matt_harbison@yahoo.com>
> # Date 1536377989 14400
> #      Fri Sep 07 23:39:49 2018 -0400
> # Node ID cf6130dd324b0eed4c902b45df503be429fe413f
> # Parent  a60dae060bc83e773bdbafb2432bc4cf387ebce2
> tests: conditionalize an error message about unlinking a non empty directory

Queued, thanks.

Patch

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