Mercurial > hg
changeset 15598:a77ce45584ef stable
largefiles: fix rename (issue3093)
author | Na'Tosha Bard <natosha@unity3d.com> |
---|---|
date | Wed, 30 Nov 2011 15:11:00 +0100 |
parents | bc0778f5619a |
children | c6be93a4c378 |
files | hgext/largefiles/overrides.py tests/test-largefiles.t |
diffstat | 2 files changed, 29 insertions(+), 9 deletions(-) [+] |
line wrap: on
line diff
--- a/hgext/largefiles/overrides.py Thu Dec 01 14:17:17 2011 +0100 +++ b/hgext/largefiles/overrides.py Wed Nov 30 15:11:00 2011 +0100 @@ -373,7 +373,8 @@ 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 @@ 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':
--- a/tests/test-largefiles.t Thu Dec 01 14:17:17 2011 +0100 +++ b/tests/test-largefiles.t Wed Nov 30 15:11:00 2011 +0100 @@ -51,10 +51,13 @@ $ 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 @@ 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