diff --git a/hgext/largefiles/overrides.py b/hgext/largefiles/overrides.py --- a/hgext/largefiles/overrides.py +++ b/hgext/largefiles/overrides.py @@ -373,7 +373,8 @@ def override_copy(orig, ui, repo, pats, origcopyfile = util.copyfile copiedfiles = [] def override_copyfile(src, dest): - if lfutil.shortname in src and lfutil.shortname in dest: + if (lfutil.shortname in src and + dest.startswith(repo.wjoin(lfutil.shortname))): destlfile = dest.replace(lfutil.shortname, '') if not opts['force'] and os.path.exists(destlfile): raise IOError('', @@ -388,18 +389,19 @@ def override_copy(orig, ui, repo, pats, lfdirstate = lfutil.openlfdirstate(ui, repo) for (src, dest) in copiedfiles: - if lfutil.shortname in src and lfutil.shortname in dest: - srclfile = src.replace(lfutil.shortname, '') - destlfile = dest.replace(lfutil.shortname, '') + if (lfutil.shortname in src and + 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 '.' if not os.path.isdir(destlfiledir): os.makedirs(destlfiledir) if rename: - os.rename(srclfile, destlfile) - lfdirstate.remove(repo.wjoin(srclfile)) + os.rename(repo.wjoin(srclfile), repo.wjoin(destlfile)) + lfdirstate.remove(srclfile) else: util.copyfile(srclfile, destlfile) - lfdirstate.add(repo.wjoin(destlfile)) + lfdirstate.add(destlfile) lfdirstate.write() except util.Abort, e: if str(e) != 'no files to copy': diff --git a/tests/test-largefiles.t b/tests/test-largefiles.t --- a/tests/test-largefiles.t +++ b/tests/test-largefiles.t @@ -51,10 +51,13 @@ Remove both largefiles and normal files. $ ls sub -Copy both largefiles and normal files. +Copy both largefiles and normal files (testing that status output is correct). $ hg cp sub/normal2 normal1 $ hg cp sub/large2 large1 + $ hg st + A large1 + A normal1 $ hg commit -m "copy files" $ cat normal1 normal22 @@ -693,7 +696,22 @@ Test that transplanting a largefile chan large6-modified $ cat sub2/large7 large7 - $ cd .. + +Test that renaming a largefile results in correct output for status + + $ hg rename sub/large4 large4-renamed + $ hg st + A large4-renamed + R sub/large4 + $ hg commit -m "test rename output" + $ cat large4-renamed + large4-modified + $ cd sub2 + $ hg rename large6 large6-renamed + $ hg st + A sub2/large6-renamed + R sub2/large6 + $ cd ../.. vanilla clients not locked out from largefiles servers on vanilla repos $ mkdir r1