Bug 3515 - hg move will leave empty directory if it contains largefile
Summary: hg move will leave empty directory if it contains largefile
Status: RESOLVED FIXED
Alias: None
Product: Mercurial
Classification: Unclassified
Component: largefiles (show other bugs)
Version: earlier
Hardware: Macintosh Mac OS
: normal bug
Assignee: Bugzilla
URL:
Keywords:
: 3514 (view as bug list)
Depends on:
Blocks:
 
Reported: 2012-06-24 10:01 UTC by Michal Sznajder
Modified: 2017-11-01 18:05 UTC (History)
4 users (show)

See Also:
Python Version: ---


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Michal Sznajder 2012-06-24 10:01 UTC
Consider following script where two directories are created and then moved. One has largefile, the other not.

$ hg --version
Mercurial Distributed SCM (version 2.2.2+161-efd2e14f7235)

# init repo
$ hg init mv_test_dir
$ cd mv_test_dir
$ printf "[extensions]\n\rlargefiles=" > .hg/hgrc

# create dir with large file
$ mkdir dir_large
$ touch dir_large/largefile
$ hg add --large dir_large/largefile

# create dir with regular file
$ mkdir dir
$ touch dir/file
$ hg add dir/file

$ hg commit -m "added"

$ hg mv dir_large moved_dir_large
moving .hglf/dir_large/largefile to .hglf/moved_dir_large/largefile

$ hg mv dir moved_dir
moving dir/file to moved_dir/file

$ hg commit -m "moved"
$ ls
dir_large       moved_dir       moved_dir_large

In the end "dir_large" remains on drive despite it is empty. I think it should disappear the same way as "dir" that has no files in it.
Comment 1 Michal Sznajder 2012-06-24 15:42 UTC
*** Bug 3514 has been marked as a duplicate of this bug. ***
Comment 2 Patrick Mézard 2012-07-26 10:52 UTC
Slightly improved version of the test script, retested against 2.2.3+ (67f56ff5afcd):

  $ echo "[extensions]" >> $HGRCPATH
  $ echo "largefiles=" >> $HGRCPATH

  $ hg init mv_test_dir
  $ cd mv_test_dir
 
Create dir with large file

  $ mkdir dir_large
  $ touch dir_large/largefile
  $ hg add --large dir_large/largefile

Create dir with regular file

  $ mkdir dir
  $ touch dir/file
  $ hg add dir/file 
  $ hg commit -m "added"
 
  $ hg mv dir_large moved_dir_large
  moving .hglf/dir_large/largefile to .hglf/moved_dir_large/largefile
  $ hg mv dir moved_dir
  moving dir/file to moved_dir/file
  $ hg commit -m "moved"
  $ test -d dir_large && echo 'dir_large should have been deleted!'
Comment 3 HG Bot 2014-04-29 15:45 UTC
Fixed by http://selenic.com/repo/hg/rev/5c0d5b95b824
Matt Harbison <matt_harbison@yahoo.com>
largefiles: remove directories emptied after their files are moved (issue3515)

(please test the fix)