Show More
@@ -1808,9 +1808,8 b' class localrepository(repo.repository):' | |||||
1808 | self.ui.warn(_('updating %s to public failed!\n') |
|
1808 | self.ui.warn(_('updating %s to public failed!\n') | |
1809 | % newremotehead) |
|
1809 | % newremotehead) | |
1810 | if 'obsolete' in self.listkeys('namespaces') and self.obsstore: |
|
1810 | if 'obsolete' in self.listkeys('namespaces') and self.obsstore: | |
1811 |
data = self. |
|
1811 | data = self.listkeys('obsolete')['dump'] | |
1812 | r = remote.pushkey('obsolete', 'dump', '', |
|
1812 | r = remote.pushkey('obsolete', 'dump', '', data) | |
1813 | base85.b85encode(data)) |
|
|||
1814 | if not r: |
|
1813 | if not r: | |
1815 | self.ui.warn(_('failed to push obsolete markers!\n')) |
|
1814 | self.ui.warn(_('failed to push obsolete markers!\n')) | |
1816 | finally: |
|
1815 | finally: |
@@ -209,12 +209,14 b' class obsstore(object):' | |||||
209 | """Write all markers on disk |
|
209 | """Write all markers on disk | |
210 |
|
210 | |||
211 | After this operation, "new" markers are considered "known".""" |
|
211 | After this operation, "new" markers are considered "known".""" | |
|
212 | # XXX: transaction logic should be used | |||
212 | if self._new: |
|
213 | if self._new: | |
213 | # XXX: transaction logic should be used here. But for |
|
214 | f = self.sopener('obsstore', 'ab') | |
214 | # now rewriting the whole file is good enough. |
|
|||
215 | f = self.sopener('obsstore', 'wb', atomictemp=True) |
|
|||
216 | try: |
|
215 | try: | |
217 | self._writemarkers(f) |
|
216 | if f.tell() == 0: | |
|
217 | # plain new obsstore | |||
|
218 | f.write(_pack('>B', _fmversion)) | |||
|
219 | _writemarkers(f.write, self._new) | |||
218 | f.close() |
|
220 | f.close() | |
219 | self._new[:] = [] |
|
221 | self._new[:] = [] | |
220 | except: # re-raises |
|
222 | except: # re-raises | |
@@ -228,32 +230,25 b' class obsstore(object):' | |||||
228 | for suc in sucs: |
|
230 | for suc in sucs: | |
229 | self.successors.setdefault(suc, set()).add(marker) |
|
231 | self.successors.setdefault(suc, set()).add(marker) | |
230 |
|
232 | |||
231 |
|
|
233 | def _writemarkers(write, markers): | |
232 |
|
|
234 | # Kept separate from flushmarkers(), it will be reused for | |
233 |
|
|
235 | # markers exchange. | |
234 | if stream is None: |
|
236 | for marker in markers: | |
235 | final = [] |
|
237 | pre, sucs, flags, metadata = marker | |
236 | w = final.append |
|
238 | nbsuc = len(sucs) | |
237 | else: |
|
239 | format = _fmfixed + (_fmnode * nbsuc) | |
238 | w = stream.write |
|
240 | data = [nbsuc, len(metadata), flags, pre] | |
239 | w(_pack('>B', _fmversion)) |
|
241 | data.extend(sucs) | |
240 | for marker in self._all: |
|
242 | write(_pack(format, *data)) | |
241 | pre, sucs, flags, metadata = marker |
|
243 | write(metadata) | |
242 | nbsuc = len(sucs) |
|
|||
243 | format = _fmfixed + (_fmnode * nbsuc) |
|
|||
244 | data = [nbsuc, len(metadata), flags, pre] |
|
|||
245 | data.extend(sucs) |
|
|||
246 | w(_pack(format, *data)) |
|
|||
247 | w(metadata) |
|
|||
248 | if stream is None: |
|
|||
249 | return ''.join(final) |
|
|||
250 |
|
244 | |||
251 | def listmarkers(repo): |
|
245 | def listmarkers(repo): | |
252 | """List markers over pushkey""" |
|
246 | """List markers over pushkey""" | |
253 | if not repo.obsstore: |
|
247 | if not repo.obsstore: | |
254 | return {} |
|
248 | return {} | |
255 | data = repo.obsstore._writemarkers() |
|
249 | data = [_pack('>B', _fmversion)] | |
256 | return {'dump': base85.b85encode(data)} |
|
250 | _writemarkers(data.append, repo.obsstore) | |
|
251 | return {'dump': base85.b85encode(''.join(data))} | |||
257 |
|
252 | |||
258 | def pushmarker(repo, key, old, new): |
|
253 | def pushmarker(repo, key, old, new): | |
259 | """Push markers over pushkey""" |
|
254 | """Push markers over pushkey""" |
General Comments 0
You need to be logged in to leave comments.
Login now