##// END OF EJS Templates
largefiles: don't allow corruption to propagate after detection...
Mads Kiilerich -
r18483:ce5f529d stable
parent child Browse files
Show More
@@ -67,7 +67,7 b' class basestore(object):'
67 ui.note(_('getting %s:%s\n') % (filename, hash))
67 ui.note(_('getting %s:%s\n') % (filename, hash))
68
68
69 storefilename = lfutil.storepath(self.repo, hash)
69 storefilename = lfutil.storepath(self.repo, hash)
70 tmpfile = util.atomictempfile(storefilename,
70 tmpfile = util.atomictempfile(storefilename + '.tmp',
71 createmode=self.repo.store.createmode)
71 createmode=self.repo.store.createmode)
72
72
73 try:
73 try:
@@ -75,16 +75,17 b' class basestore(object):'
75 except StoreError, err:
75 except StoreError, err:
76 ui.warn(err.longmessage())
76 ui.warn(err.longmessage())
77 hhash = ""
77 hhash = ""
78 tmpfile.close() # has probably already been closed!
78
79
79 if hhash != hash:
80 if hhash != hash:
80 if hhash != "":
81 if hhash != "":
81 ui.warn(_('%s: data corruption (expected %s, got %s)\n')
82 ui.warn(_('%s: data corruption (expected %s, got %s)\n')
82 % (filename, hash, hhash))
83 % (filename, hash, hhash))
83 tmpfile.discard() # no-op if it's already closed
84 util.unlink(storefilename + '.tmp')
84 missing.append(filename)
85 missing.append(filename)
85 continue
86 continue
86
87
87 tmpfile.close()
88 util.rename(storefilename + '.tmp', storefilename)
88 lfutil.linktousercache(self.repo, hash)
89 lfutil.linktousercache(self.repo, hash)
89 success.append((filename, hhash))
90 success.append((filename, hhash))
90
91
@@ -1584,14 +1584,12 b' largefiles pulled on update - a largefil'
1584 $ hg -R http-clone up --config largefiles.usercache=http-clone-usercache
1584 $ hg -R http-clone up --config largefiles.usercache=http-clone-usercache
1585 getting changed largefiles
1585 getting changed largefiles
1586 f1: data corruption (expected 02a439e5c31c526465ab1a0ca1f431f76b827b90, got 6a7bb2556144babe3899b25e5428123735bb1e27)
1586 f1: data corruption (expected 02a439e5c31c526465ab1a0ca1f431f76b827b90, got 6a7bb2556144babe3899b25e5428123735bb1e27)
1587 1 largefiles updated, 0 removed
1587 0 largefiles updated, 0 removed
1588 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
1588 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
1589 $ hg -R http-clone st
1589 $ hg -R http-clone st
1590 M f1
1590 ! f1
1591 $ cat http-clone/.hg/largefiles/02a439e5c31c526465ab1a0ca1f431f76b827b90
1591 $ [ ! -f http-clone/.hg/largefiles/02a439e5c31c526465ab1a0ca1f431f76b827b90 ]
1592 corruption
1592 $ [ ! -f http-clone/f1 ]
1593 $ cat http-clone/f1
1594 corruption
1595 $ [ ! -f http-clone-usercache ]
1593 $ [ ! -f http-clone-usercache ]
1596 $ hg -R http-clone verify --large --lfc
1594 $ hg -R http-clone verify --large --lfc
1597 checking changesets
1595 checking changesets
General Comments 0
You need to be logged in to leave comments. Login now