Show More
@@ -59,8 +59,6 b' class basestore(object):' | |||||
59 | missing = [] |
|
59 | missing = [] | |
60 | ui = self.ui |
|
60 | ui = self.ui | |
61 |
|
61 | |||
62 | util.makedirs(lfutil.storepath(self.repo, '')) |
|
|||
63 |
|
||||
64 | at = 0 |
|
62 | at = 0 | |
65 | available = self.exists(set(hash for (_filename, hash) in files)) |
|
63 | available = self.exists(set(hash for (_filename, hash) in files)) | |
66 | for filename, hash in files: |
|
64 | for filename, hash in files: | |
@@ -75,32 +73,44 b' class basestore(object):' | |||||
75 | missing.append(filename) |
|
73 | missing.append(filename) | |
76 | continue |
|
74 | continue | |
77 |
|
75 | |||
78 | storefilename = lfutil.storepath(self.repo, hash) |
|
76 | if self._gethash(filename, hash): | |
79 | tmpfile = util.atomictempfile(storefilename + '.tmp', |
|
77 | success.append((filename, hash)) | |
80 | createmode=self.repo.store.createmode) |
|
78 | else: | |
81 |
|
||||
82 | try: |
|
|||
83 | hhash = self._getfile(tmpfile, filename, hash) |
|
|||
84 | except StoreError, err: |
|
|||
85 | ui.warn(err.longmessage()) |
|
|||
86 | hhash = "" |
|
|||
87 | tmpfile.close() |
|
|||
88 |
|
||||
89 | if hhash != hash: |
|
|||
90 | if hhash != "": |
|
|||
91 | ui.warn(_('%s: data corruption (expected %s, got %s)\n') |
|
|||
92 | % (filename, hash, hhash)) |
|
|||
93 | util.unlink(storefilename + '.tmp') |
|
|||
94 | missing.append(filename) |
|
79 | missing.append(filename) | |
95 | continue |
|
|||
96 |
|
||||
97 | util.rename(storefilename + '.tmp', storefilename) |
|
|||
98 | lfutil.linktousercache(self.repo, hash) |
|
|||
99 | success.append((filename, hhash)) |
|
|||
100 |
|
80 | |||
101 | ui.progress(_('getting largefiles'), None) |
|
81 | ui.progress(_('getting largefiles'), None) | |
102 | return (success, missing) |
|
82 | return (success, missing) | |
103 |
|
83 | |||
|
84 | def _gethash(self, filename, hash): | |||
|
85 | """Get file with the provided hash and store it in the local repo's | |||
|
86 | store and in the usercache. | |||
|
87 | filename is for informational messages only. | |||
|
88 | """ | |||
|
89 | util.makedirs(lfutil.storepath(self.repo, '')) | |||
|
90 | storefilename = lfutil.storepath(self.repo, hash) | |||
|
91 | ||||
|
92 | tmpname = storefilename + '.tmp' | |||
|
93 | tmpfile = util.atomictempfile(tmpname, | |||
|
94 | createmode=self.repo.store.createmode) | |||
|
95 | ||||
|
96 | try: | |||
|
97 | gothash = self._getfile(tmpfile, filename, hash) | |||
|
98 | except StoreError, err: | |||
|
99 | self.ui.warn(err.longmessage()) | |||
|
100 | gothash = "" | |||
|
101 | tmpfile.close() | |||
|
102 | ||||
|
103 | if gothash != hash: | |||
|
104 | if gothash != "": | |||
|
105 | self.ui.warn(_('%s: data corruption (expected %s, got %s)\n') | |||
|
106 | % (filename, hash, gothash)) | |||
|
107 | util.unlink(tmpname) | |||
|
108 | return False | |||
|
109 | ||||
|
110 | util.rename(tmpname, storefilename) | |||
|
111 | lfutil.linktousercache(self.repo, hash) | |||
|
112 | return True | |||
|
113 | ||||
104 | def verify(self, revs, contents=False): |
|
114 | def verify(self, revs, contents=False): | |
105 | '''Verify the existence (and, optionally, contents) of every big |
|
115 | '''Verify the existence (and, optionally, contents) of every big | |
106 | file revision referenced by every changeset in revs. |
|
116 | file revision referenced by every changeset in revs. |
General Comments 0
You need to be logged in to leave comments.
Login now