Show More
@@ -8,8 +8,6 b'' | |||||
8 |
|
8 | |||
9 | '''base class for store implementations and store-related utility code''' |
|
9 | '''base class for store implementations and store-related utility code''' | |
10 |
|
10 | |||
11 | import os |
|
|||
12 | import tempfile |
|
|||
13 | import binascii |
|
11 | import binascii | |
14 | import re |
|
12 | import re | |
15 |
|
13 | |||
@@ -75,13 +73,8 b' class basestore(object):' | |||||
75 | ui.note(_('getting %s:%s\n') % (filename, hash)) |
|
73 | ui.note(_('getting %s:%s\n') % (filename, hash)) | |
76 |
|
74 | |||
77 | storefilename = lfutil.storepath(self.repo, hash) |
|
75 | storefilename = lfutil.storepath(self.repo, hash) | |
78 |
|
|
76 | tmpfile = util.atomictempfile(storefilename, | |
79 |
|
77 | createmode=self.repo.store.createmode) | ||
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') |
|
|||
85 |
|
78 | |||
86 | try: |
|
79 | try: | |
87 | hhash = binascii.hexlify(self._getfile(tmpfile, filename, hash)) |
|
80 | hhash = binascii.hexlify(self._getfile(tmpfile, filename, hash)) | |
@@ -93,14 +86,11 b' class basestore(object):' | |||||
93 | if hhash != "": |
|
86 | if hhash != "": | |
94 | ui.warn(_('%s: data corruption (expected %s, got %s)\n') |
|
87 | ui.warn(_('%s: data corruption (expected %s, got %s)\n') | |
95 | % (filename, hash, hhash)) |
|
88 | % (filename, hash, hhash)) | |
96 |
tmpfile. |
|
89 | tmpfile.discard() # no-op if it's already closed | |
97 | os.remove(tmpfilename) |
|
|||
98 | missing.append(filename) |
|
90 | missing.append(filename) | |
99 | continue |
|
91 | continue | |
100 |
|
92 | |||
101 | if os.path.exists(storefilename): # Windows |
|
93 | tmpfile.close() | |
102 | os.remove(storefilename) |
|
|||
103 | os.rename(tmpfilename, storefilename) |
|
|||
104 | lfutil.linktousercache(self.repo, hash) |
|
94 | lfutil.linktousercache(self.repo, hash) | |
105 | success.append((filename, hhash)) |
|
95 | success.append((filename, hhash)) | |
106 |
|
96 |
@@ -94,3 +94,12 b' from file in working copy:' | |||||
94 | $ hg commit -m change |
|
94 | $ hg commit -m change | |
95 | $ ../ls-l.py .hg/largefiles/e151b474069de4ca6898f67ce2f2a7263adf8fea |
|
95 | $ ../ls-l.py .hg/largefiles/e151b474069de4ca6898f67ce2f2a7263adf8fea | |
96 | 640 |
|
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