largefiles: remove directories emptied after their files are moved (
issue3515)
--- a/hgext/largefiles/overrides.py Sat Apr 26 18:13:06 2014 +0900
+++ b/hgext/largefiles/overrides.py Fri Apr 25 22:34:09 2014 -0400
@@ -579,6 +579,10 @@
os.makedirs(destlfiledir)
if rename:
os.rename(repo.wjoin(srclfile), repo.wjoin(destlfile))
+
+ # The file is gone, but this deletes any empty parent
+ # directories as a side-effect.
+ util.unlinkpath(repo.wjoin(srclfile), True)
lfdirstate.remove(srclfile)
else:
util.copyfile(repo.wjoin(srclfile),
--- a/tests/test-largefiles.t Sat Apr 26 18:13:06 2014 +0900
+++ b/tests/test-largefiles.t Fri Apr 25 22:34:09 2014 -0400
@@ -214,8 +214,18 @@
./baz/largefile
./dirb
./dirb/largefile
- ./foo
- $ cd ../../a
+ $ cd ..
+ $ hg mv dira dirc
+ moving .hglf/dira/baz/largefile to .hglf/dirc/baz/largefile (glob)
+ moving .hglf/dira/dirb/largefile to .hglf/dirc/dirb/largefile (glob)
+ $ find * | sort
+ dirc
+ dirc/baz
+ dirc/baz/largefile
+ dirc/dirb
+ dirc/dirb/largefile
+ $ hg up -qC
+ $ cd ../a
#if serve
Test display of largefiles in hgweb