# HG changeset patch # User Patrick Mezard # Date 1255037556 -7200 # Node ID 1f665246dab3140a72954fbd089a784224898462 # Parent 989cb39d1df455cec0ec47ab6ccfcc4810bef9a4 windows: fix unlink() not dropping empty tree (issue1861) diff -r 989cb39d1df4 -r 1f665246dab3 mercurial/windows.py --- 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: diff -r 989cb39d1df4 -r 1f665246dab3 tests/test-remove --- 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 diff -r 989cb39d1df4 -r 1f665246dab3 tests/test-remove.out --- 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