changeset 9572:1f665246dab3

windows: fix unlink() not dropping empty tree (issue1861)
author Patrick Mezard <pmezard@gmail.com>
date Thu, 08 Oct 2009 23:32:36 +0200
parents 989cb39d1df4
children b8352a3617f3
files mercurial/windows.py tests/test-remove tests/test-remove.out
diffstat 3 files changed, 15 insertions(+), 1 deletions(-) [+]
line wrap: on
line diff
--- a/mercurial/windows.py	Wed Oct 07 18:52:01 2009 +0200
+++ b/mercurial/windows.py	Thu Oct 08 23:32:36 2009 +0200
@@ -258,7 +258,7 @@
         head, tail = os.path.split(head)
     while head and tail:
         try:
-            if osutil.listdir(name):
+            if osutil.listdir(head):
                 return
             os.rmdir(head)
         except:
--- a/tests/test-remove	Wed Oct 07 18:52:01 2009 +0200
+++ b/tests/test-remove	Thu Oct 08 23:32:36 2009 +0200
@@ -108,3 +108,12 @@
 echo % dir, options -Af
 rm test/bar
 remove -Af test
+
+echo 'test remove dropping empty trees (issue1861)'
+mkdir -p issue1861/b/c
+echo x > issue1861/x
+echo y > issue1861/b/c/y
+hg ci -Am add
+hg rm issue1861/b
+hg ci -m remove
+ls issue1861
--- a/tests/test-remove.out	Wed Oct 07 18:52:01 2009 +0200
+++ b/tests/test-remove.out	Thu Oct 08 23:32:36 2009 +0200
@@ -111,3 +111,8 @@
 ./foo
 ./test/foo
 2 files updated, 0 files merged, 0 files removed, 0 files unresolved
+test remove dropping empty trees (issue1861)
+adding issue1861/b/c/y
+adding issue1861/x
+removing issue1861/b/c/y
+x