[PATCH STABLE] largefiles: remove directories left empty after a move (issue3515)

Matt Harbison matt_harbison at yahoo.com
Fri Apr 25 22:18:03 CDT 2014


# HG changeset patch
# User Matt Harbison <matt_harbison at yahoo.com>
# Date 1398479649 14400
#      Fri Apr 25 22:34:09 2014 -0400
# Branch stable
# Node ID 8f81353efd714d12568dfabc77074f627a0f0ae6
# Parent  d36440d843284ba546858b241da9cc4817811fe5
largefiles: remove directories left empty after a move (issue3515)

Naming the standin for inexact matches is unfortunate, but an existing issue.
Maybe something similar to 7e2b9f6a2cd0 is a solution.

diff --git a/hgext/largefiles/overrides.py b/hgext/largefiles/overrides.py
--- a/hgext/largefiles/overrides.py
+++ b/hgext/largefiles/overrides.py
@@ -579,6 +579,7 @@
                         os.makedirs(destlfiledir)
                     if rename:
                         os.rename(repo.wjoin(srclfile), repo.wjoin(destlfile))
+                        util.unlinkpath(repo.wjoin(srclfile), True)
                         lfdirstate.remove(srclfile)
                     else:
                         util.copyfile(repo.wjoin(srclfile),
diff --git a/tests/test-largefiles.t b/tests/test-largefiles.t
--- a/tests/test-largefiles.t
+++ b/tests/test-largefiles.t
@@ -214,8 +214,19 @@
   ./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 . -not -path './.hg*' | 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


More information about the Mercurial-devel mailing list