Show More
@@ -8,8 +8,6 b'' | |||
|
8 | 8 | |
|
9 | 9 | '''base class for store implementations and store-related utility code''' |
|
10 | 10 | |
|
11 | import os | |
|
12 | import tempfile | |
|
13 | 11 | import binascii |
|
14 | 12 | import re |
|
15 | 13 | |
@@ -75,13 +73,8 b' class basestore(object):' | |||
|
75 | 73 | ui.note(_('getting %s:%s\n') % (filename, hash)) |
|
76 | 74 | |
|
77 | 75 | storefilename = lfutil.storepath(self.repo, hash) |
|
78 |
|
|
|
79 | ||
|
80 | # No need to pass mode='wb' to fdopen(), since mkstemp() already | |
|
81 | # opened the file in binary mode. | |
|
82 | (tmpfd, tmpfilename) = tempfile.mkstemp( | |
|
83 | dir=storedir, prefix=os.path.basename(filename)) | |
|
84 | tmpfile = os.fdopen(tmpfd, 'w') | |
|
76 | tmpfile = util.atomictempfile(storefilename, | |
|
77 | createmode=self.repo.store.createmode) | |
|
85 | 78 | |
|
86 | 79 | try: |
|
87 | 80 | hhash = binascii.hexlify(self._getfile(tmpfile, filename, hash)) |
@@ -93,14 +86,11 b' class basestore(object):' | |||
|
93 | 86 | if hhash != "": |
|
94 | 87 | ui.warn(_('%s: data corruption (expected %s, got %s)\n') |
|
95 | 88 | % (filename, hash, hhash)) |
|
96 |
tmpfile. |
|
|
97 | os.remove(tmpfilename) | |
|
89 | tmpfile.discard() # no-op if it's already closed | |
|
98 | 90 | missing.append(filename) |
|
99 | 91 | continue |
|
100 | 92 | |
|
101 | if os.path.exists(storefilename): # Windows | |
|
102 | os.remove(storefilename) | |
|
103 | os.rename(tmpfilename, storefilename) | |
|
93 | tmpfile.close() | |
|
104 | 94 | lfutil.linktousercache(self.repo, hash) |
|
105 | 95 | success.append((filename, hhash)) |
|
106 | 96 |
@@ -94,3 +94,12 b' from file in working copy:' | |||
|
94 | 94 | $ hg commit -m change |
|
95 | 95 | $ ../ls-l.py .hg/largefiles/e151b474069de4ca6898f67ce2f2a7263adf8fea |
|
96 | 96 | 640 |
|
97 | ||
|
98 | Test permission of with files in .hg/largefiles created by update: | |
|
99 | ||
|
100 | $ cd ../mirror | |
|
101 | $ rm -r "$USERCACHE" .hg/largefiles # avoid links | |
|
102 | $ chmod 750 .hg/store | |
|
103 | $ hg pull ../src --update -q | |
|
104 | $ ../ls-l.py .hg/largefiles/e151b474069de4ca6898f67ce2f2a7263adf8fea | |
|
105 | 640 |
General Comments 0
You need to be logged in to leave comments.
Login now