diff --git a/hgext/largefiles/lfcommands.py b/hgext/largefiles/lfcommands.py --- a/hgext/largefiles/lfcommands.py +++ b/hgext/largefiles/lfcommands.py @@ -490,8 +490,8 @@ def _updatelfile(repo, lfdirstate, lfile abslfile = repo.wjoin(lfile) absstandin = repo.wjoin(lfutil.standin(lfile)) if os.path.exists(absstandin): - if os.path.exists(absstandin+'.orig'): - shutil.copyfile(abslfile, abslfile+'.orig') + if os.path.exists(absstandin + '.orig') and os.path.exists(abslfile): + shutil.copyfile(abslfile, abslfile + '.orig') expecthash = lfutil.readstandin(repo, lfile) if (expecthash != '' and (not os.path.exists(abslfile) or diff --git a/tests/test-largefiles.t b/tests/test-largefiles.t --- a/tests/test-largefiles.t +++ b/tests/test-largefiles.t @@ -1017,12 +1017,16 @@ Rollback on largefiles. abort: uncommitted local changes [255] -"update --clean" leaves correct largefiles in working copy. +"update --clean" leaves correct largefiles in working copy, even when there is +.orig files from revert in .hglf. + $ echo mistake > sub2/large7 + $ hg revert sub2/large7 + $ hg -q update --clean -r null $ hg update --clean - 0 files updated, 0 files merged, 0 files removed, 0 files unresolved + 5 files updated, 0 files merged, 0 files removed, 0 files unresolved getting changed largefiles - 1 largefiles updated, 0 removed + 3 largefiles updated, 0 removed $ cat normal3 normal3-modified $ cat sub/normal4 @@ -1033,6 +1037,20 @@ Rollback on largefiles. large6-modified $ cat sub2/large7 large7 + $ cat sub2/large7.orig + mistake + $ cat .hglf/sub2/large7.orig + 9dbfb2c79b1c40981b258c3efa1b10b03f18ad31 + +demonstrate misfeature: .orig file is overwritten on every update -C, +also when clean: + $ hg update --clean + 0 files updated, 0 files merged, 0 files removed, 0 files unresolved + getting changed largefiles + 0 largefiles updated, 0 removed + $ cat sub2/large7.orig + large7 + $ rm sub2/large7.orig .hglf/sub2/large7.orig Now "update check" is happy. $ hg update --check 8