Show More
@@ -258,9 +258,23 b' class changelogrevision(object):' | |||||
258 | return encoding.tolocal(self._text[self._offsets[3] + 2:]) |
|
258 | return encoding.tolocal(self._text[self._offsets[3] + 2:]) | |
259 |
|
259 | |||
260 | class changelog(revlog.revlog): |
|
260 | class changelog(revlog.revlog): | |
261 | def __init__(self, opener): |
|
261 | def __init__(self, opener, trypending=False): | |
262 | revlog.revlog.__init__(self, opener, "00changelog.i", |
|
262 | """Load a changelog revlog using an opener. | |
263 | checkambig=True) |
|
263 | ||
|
264 | If ``trypending`` is true, we attempt to load the index from a | |||
|
265 | ``00changelog.i.a`` file instead of the default ``00changelog.i``. | |||
|
266 | The ``00changelog.i.a`` file contains index (and possibly inline | |||
|
267 | revision) data for a transaction that hasn't been finalized yet. | |||
|
268 | It exists in a separate file to facilitate readers (such as | |||
|
269 | hooks processes) accessing data before a transaction is finalized. | |||
|
270 | """ | |||
|
271 | if trypending and opener.exists('00changelog.i.a'): | |||
|
272 | indexfile = '00changelog.i.a' | |||
|
273 | else: | |||
|
274 | indexfile = '00changelog.i' | |||
|
275 | ||||
|
276 | revlog.revlog.__init__(self, opener, indexfile, checkambig=True) | |||
|
277 | ||||
264 | if self._initempty: |
|
278 | if self._initempty: | |
265 | # changelogs don't benefit from generaldelta |
|
279 | # changelogs don't benefit from generaldelta | |
266 | self.version &= ~revlog.REVLOGGENERALDELTA |
|
280 | self.version &= ~revlog.REVLOGGENERALDELTA | |
@@ -401,27 +415,6 b' class changelog(revlog.revlog):' | |||||
401 | # split when we're done |
|
415 | # split when we're done | |
402 | self.checkinlinesize(tr) |
|
416 | self.checkinlinesize(tr) | |
403 |
|
417 | |||
404 | def readpending(self, file): |
|
|||
405 | """read index data from a "pending" file |
|
|||
406 |
|
||||
407 | During a transaction, the actual changeset data is already stored in the |
|
|||
408 | main file, but not yet finalized in the on-disk index. Instead, a |
|
|||
409 | "pending" index is written by the transaction logic. If this function |
|
|||
410 | is running, we are likely in a subprocess invoked in a hook. The |
|
|||
411 | subprocess is informed that it is within a transaction and needs to |
|
|||
412 | access its content. |
|
|||
413 |
|
||||
414 | This function will read all the index data out of the pending file and |
|
|||
415 | overwrite the main index.""" |
|
|||
416 |
|
||||
417 | if not self.opener.exists(file): |
|
|||
418 | return # no pending data for changelog |
|
|||
419 | r = revlog.revlog(self.opener, file) |
|
|||
420 | self.index = r.index |
|
|||
421 | self.nodemap = r.nodemap |
|
|||
422 | self._nodecache = r._nodecache |
|
|||
423 | self._chunkcache = r._chunkcache |
|
|||
424 |
|
||||
425 | def _writepending(self, tr): |
|
418 | def _writepending(self, tr): | |
426 | "create a file containing the unfinalized state for pretxnchangegroup" |
|
419 | "create a file containing the unfinalized state for pretxnchangegroup" | |
427 | if self._delaybuf: |
|
420 | if self._delaybuf: |
@@ -528,10 +528,8 b' class localrepository(object):' | |||||
528 |
|
528 | |||
529 | @storecache('00changelog.i') |
|
529 | @storecache('00changelog.i') | |
530 | def changelog(self): |
|
530 | def changelog(self): | |
531 |
|
|
531 | return changelog.changelog(self.svfs, | |
532 |
|
|
532 | trypending=txnutil.mayhavepending(self.root)) | |
533 | c.readpending('00changelog.i.a') |
|
|||
534 | return c |
|
|||
535 |
|
533 | |||
536 | def _constructmanifest(self): |
|
534 | def _constructmanifest(self): | |
537 | # This is a temporary function while we migrate from manifest to |
|
535 | # This is a temporary function while we migrate from manifest to |
General Comments 0
You need to be logged in to leave comments.
Login now