Kiln » Dependencies » Dulwich Read More
Clone URL:  
Pushed to one repository · View In Graph Contained in master, master-1, and master-0

Mac OS X doesn't have os.fdatasync, use os.fsync instead.

Changeset a2e76a586dde

Parent 200721ba8acc

by Jelmer Vernooij

Changes to one file · Browse files at a2e76a586dde Showing diff from parent 200721ba8acc Diff from another changeset...

 
26
27
28
 
29
30
31
 
65
66
67
 
 
 
 
68
69
70
 
124
125
126
127
128
129
130
 
 
 
 
131
132
133
 
143
144
145
 
146
147
148
 
153
154
155
156
 
157
158
159
 
168
169
170
171
 
172
173
174
 
26
27
28
29
30
31
32
 
66
67
68
69
70
71
72
73
74
75
 
129
130
131
 
 
 
 
132
133
134
135
136
137
138
 
148
149
150
151
152
153
154
 
159
160
161
 
162
163
164
165
 
174
175
176
 
177
178
179
180
@@ -26,6 +26,7 @@
  ShaFile,   )  from dulwich.pack import ( + Pack,   iter_sha1,   load_packs,   write_pack, @@ -65,6 +66,10 @@
  if self._packs is None:   self._packs = list(load_packs(self.pack_dir()))   return self._packs + + def _add_known_pack(self, path): + if self._packs is not None: + self._packs.append(Pack(path))     def _get_shafile_path(self, sha):   dir = sha[:2] @@ -124,10 +129,10 @@
  sha_to_hex(urllib2.randombytes(20))+".temppack")   write_pack(temppath, p.iterobjects(self.get_raw), len(p))   pack_sha = PackIndex(temppath+".idx").objects_sha1() - os.rename(temppath+".pack", - os.path.join(self.pack_dir(), "pack-%s.pack" % pack_sha)) - os.rename(temppath+".idx", - os.path.join(self.pack_dir(), "pack-%s.idx" % pack_sha)) + newbasename = os.path.join(self.pack_dir(), "pack-%s" % pack_sha) + os.rename(temppath+".pack", newbasename+".pack") + os.rename(temppath+".idx", newbasename+".idx") + self._add_known_pack(newbasename)     def move_in_pack(self, path):   """Move a specific file containing a pack into the pack directory. @@ -143,6 +148,7 @@
  "pack-%s" % iter_sha1(entry[0] for entry in entries))   write_pack_index_v2(basename+".idx", entries, p.get_stored_checksum())   os.rename(path, basename + ".pack") + self._add_known_pack(basename)     def add_thin_pack(self):   """Add a new thin pack to this object store. @@ -153,7 +159,7 @@
  fd, path = tempfile.mkstemp(dir=self.pack_dir(), suffix=".pack")   f = os.fdopen(fd, 'w')   def commit(): - os.fdatasync(fd) + os.fsync(fd)   f.close()   if os.path.getsize(path) > 0:   self.move_in_thin_pack(path) @@ -168,7 +174,7 @@
  fd, path = tempfile.mkstemp(dir=self.pack_dir(), suffix=".pack")   f = os.fdopen(fd, 'w')   def commit(): - os.fdatasync(fd) + os.fsync(fd)   f.close()   if os.path.getsize(path) > 0:   self.move_in_pack(path)