This will be useful for consistency and cache warming.
Details
Details
Diff Detail
Diff Detail
- Repository
- rHG Mercurial
- Branch
- default
- Lint
No Linters Available - Unit
No Unit Test Coverage
hg-reviewers |
This will be useful for consistency and cache warming.
No Linters Available |
No Unit Test Coverage |
โ refresh by Heptapod after a successful CI run (๐ ๐)
In D9826#149613, @pulkit wrote:Since the other version of this work got in, does this still need review?
nope, I'll clean that series up. I was mostly intended as a support for discussion.
In D9826#149616, @marmoute wrote:In D9826#149613, @pulkit wrote:Since the other version of this work got in, does this still need review?
nope, I'll clean that series up. I was mostly intended as a support for discussion.
Okay, seems like this stack can be abandoned then.
Path | Packages | |||
---|---|---|---|---|
M | mercurial/changelog.py (9 lines) | |||
M | mercurial/localrepo.py (4 lines) | |||
M | mercurial/transaction.py (6 lines) |
Commit | Parents | Author | Summary | Date |
---|---|---|---|---|
1f79b115970b | 56d8d1300209 | Pierre-Yves David | Jan 18 2021, 12:53 PM |
return encoding.tolocal(extra.get(b"branch")), b'close' in extra | return encoding.tolocal(extra.get(b"branch")), b'close' in extra | ||||
def _nodeduplicatecallback(self, transaction, node): | def _nodeduplicatecallback(self, transaction, node): | ||||
# keep track of revisions that got "re-added", eg: unbunde of know rev. | # keep track of revisions that got "re-added", eg: unbunde of know rev. | ||||
# | # | ||||
# We track them in a list to preserve their order from the source bundle | # We track them in a list to preserve their order from the source bundle | ||||
duplicates = transaction.changes.setdefault(b'revduplicates', []) | duplicates = transaction.changes.setdefault(b'revduplicates', []) | ||||
duplicates.append(self.rev(node)) | duplicates.append(self.rev(node)) | ||||
def _addrevision(self, node, rawtext, transaction, *args, **kwargs): | |||||
next_tip = len(self) | |||||
node = super(changelog, self)._addrevision( | |||||
node, rawtext, transaction, *args, **kwargs | |||||
) | |||||
if next_tip < len(self): | |||||
transaction.new_cl_rev_callback(next_tip) | |||||
return node |
b"journal", | b"journal", | ||||
b"undo", | b"undo", | ||||
aftertrans(renames), | aftertrans(renames), | ||||
self.store.createmode, | self.store.createmode, | ||||
validator=validate, | validator=validate, | ||||
releasefn=releasefn, | releasefn=releasefn, | ||||
checkambigfiles=_cachedfiles, | checkambigfiles=_cachedfiles, | ||||
name=desc, | name=desc, | ||||
new_cl_rev_callback=self.new_cl_rev_callback, | |||||
) | ) | ||||
tr.changes[b'origrepolen'] = len(self) | tr.changes[b'origrepolen'] = len(self) | ||||
tr.changes[b'obsmarkers'] = set() | tr.changes[b'obsmarkers'] = set() | ||||
tr.changes[b'phases'] = [] | tr.changes[b'phases'] = [] | ||||
tr.changes[b'bookmarks'] = {} | tr.changes[b'bookmarks'] = {} | ||||
tr.hookargs[b'txnid'] = txnid | tr.hookargs[b'txnid'] = txnid | ||||
tr.hookargs[b'txnname'] = desc | tr.hookargs[b'txnname'] = desc | ||||
reporef = weakref.ref(self) | reporef = weakref.ref(self) | ||||
def updater(tr): | def updater(tr): | ||||
repo = reporef() | repo = reporef() | ||||
repo.updatecaches(tr) | repo.updatecaches(tr) | ||||
return updater | return updater | ||||
def new_cl_rev_callback(self, rev): | |||||
"""called when new revision are added to the repository""" | |||||
@unfilteredmethod | @unfilteredmethod | ||||
def updatecaches(self, tr=None, full=False): | def updatecaches(self, tr=None, full=False): | ||||
"""warm appropriate caches | """warm appropriate caches | ||||
If this function is called after a transaction closed. The transaction | If this function is called after a transaction closed. The transaction | ||||
will be available in the 'tr' argument. This can be used to selectively | will be available in the 'tr' argument. This can be used to selectively | ||||
update caches relevant to the changes in that transaction. | update caches relevant to the changes in that transaction. | ||||
journalname, | journalname, | ||||
undoname=None, | undoname=None, | ||||
after=None, | after=None, | ||||
createmode=None, | createmode=None, | ||||
validator=None, | validator=None, | ||||
releasefn=None, | releasefn=None, | ||||
checkambigfiles=None, | checkambigfiles=None, | ||||
name='<unnamed>', | name='<unnamed>', | ||||
new_cl_rev_callback=None, | |||||
): | ): | ||||
"""Begin a new transaction | """Begin a new transaction | ||||
Begins a new transaction that allows rolling back writes in the event of | Begins a new transaction that allows rolling back writes in the event of | ||||
an exception. | an exception. | ||||
* `after`: called after the transaction has been committed | * `after`: called after the transaction has been committed | ||||
* `createmode`: the mode of the journal file that will be created | * `createmode`: the mode of the journal file that will be created | ||||
self._journal = journalname | self._journal = journalname | ||||
self._undoname = undoname | self._undoname = undoname | ||||
self._queue = [] | self._queue = [] | ||||
# A callback to do something just after releasing transaction. | # A callback to do something just after releasing transaction. | ||||
if releasefn is None: | if releasefn is None: | ||||
releasefn = lambda tr, success: None | releasefn = lambda tr, success: None | ||||
self._releasefn = releasefn | self._releasefn = releasefn | ||||
# A callback to do thing for any new changelog revision | |||||
if new_cl_rev_callback is None: | |||||
new_cl_rev_callback = lambda rev: None | |||||
self.new_cl_rev_callback = new_cl_rev_callback | |||||
self._checkambigfiles = set() | self._checkambigfiles = set() | ||||
if checkambigfiles: | if checkambigfiles: | ||||
self._checkambigfiles.update(checkambigfiles) | self._checkambigfiles.update(checkambigfiles) | ||||
self._names = [name] | self._names = [name] | ||||
# A dict dedicated to precisely tracking the changes introduced in the | # A dict dedicated to precisely tracking the changes introduced in the | ||||
# transaction. | # transaction. |