largefiles: make update with backup files in .hglf slightly less broken

Largefiles update would try to copy f to f.orig if there was a .hglf/f.orig .
That is in many many ways very very wrong, but it also caused an abort if f
didn't exist.

Now it only tries to copy f if it exists.
This commit is contained in:
Mads Kiilerich 2013-01-10 15:33:14 +01:00
parent ed7bbaa14c
commit 79e0196dc6
2 changed files with 23 additions and 5 deletions

View File

@ -483,8 +483,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

View File

@ -1005,12 +1005,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
@ -1021,6 +1025,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