diff --git a/hgext/largefiles/overrides.py b/hgext/largefiles/overrides.py --- a/hgext/largefiles/overrides.py +++ b/hgext/largefiles/overrides.py @@ -515,14 +515,16 @@ def overridecopy(orig, ui, repo, pats, o dest.startswith(repo.wjoin(lfutil.shortname))): srclfile = src.replace(repo.wjoin(lfutil.standin('')), '') destlfile = dest.replace(repo.wjoin(lfutil.standin('')), '') - destlfiledir = os.path.dirname(destlfile) or '.' + destlfiledir = os.path.dirname(repo.wjoin(destlfile)) or '.' if not os.path.isdir(destlfiledir): os.makedirs(destlfiledir) if rename: os.rename(repo.wjoin(srclfile), repo.wjoin(destlfile)) lfdirstate.remove(srclfile) else: - util.copyfile(srclfile, destlfile) + util.copyfile(repo.wjoin(srclfile), + repo.wjoin(destlfile)) + lfdirstate.add(destlfile) lfdirstate.write() except util.Abort, e: diff --git a/tests/test-largefiles.t b/tests/test-largefiles.t --- a/tests/test-largefiles.t +++ b/tests/test-largefiles.t @@ -141,6 +141,43 @@ Test moving largefiles and verify that n $ cat sub/large4 large22 +Test copies and moves from a directory other than root (issue3516) + + $ cd .. + $ hg init lf_cpmv + $ cd lf_cpmv + $ mkdir dira + $ mkdir dira/dirb + $ touch dira/dirb/largefile + $ hg add --large dira/dirb/largefile + $ hg commit -m "added" + Invoking status precommit hook + A dira/dirb/largefile + $ cd dira + $ hg cp dirb/largefile foo/largefile + $ hg ci -m "deep copy" + Invoking status precommit hook + A dira/foo/largefile + $ find . | sort + . + ./dirb + ./dirb/largefile + ./foo + ./foo/largefile + $ hg mv foo/largefile baz/largefile + $ hg ci -m "moved" + Invoking status precommit hook + A dira/baz/largefile + R dira/foo/largefile + $ find . | sort + . + ./baz + ./baz/largefile + ./dirb + ./dirb/largefile + ./foo + $ cd ../../a + #if hgweb Test display of largefiles in hgweb