Mercurial > public > mercurial-scm > hg
comparison mercurial/revlog.py @ 39886:debc4ee597e7
revlog: add a callback "tracking" duplicate node addition
If a changegroup contains node already added to the repository, they will be
skipped. Skipping them is the right behavior (we don't need to store things
twice), but it can hide some information to the code doing the unbundle (eg:
shelve looking for the tip of the bundle).
The first step to improve this situation is to add a low level callback. We do
not need this tracking on all revlog, so actual tracking will be added in the
next changeset.
author | Boris Feld <boris.feld@octobus.net> |
---|---|
date | Wed, 19 Sep 2018 21:02:47 +0200 |
parents | d63153611ed5 |
children | d70e620ee8c9 |
comparison
equal
deleted
inserted
replaced
39885:566cc633e637 | 39886:debc4ee597e7 |
---|---|
1743 # manager | 1743 # manager |
1744 | 1744 |
1745 tr.replace(self.indexfile, trindex * self._io.size) | 1745 tr.replace(self.indexfile, trindex * self._io.size) |
1746 self._chunkclear() | 1746 self._chunkclear() |
1747 | 1747 |
1748 def _nodeduplicatecallback(self, transaction, node): | |
1749 """called when trying to add a node already stored. | |
1750 """ | |
1751 | |
1748 def addrevision(self, text, transaction, link, p1, p2, cachedelta=None, | 1752 def addrevision(self, text, transaction, link, p1, p2, cachedelta=None, |
1749 node=None, flags=REVIDX_DEFAULT_FLAGS, deltacomputer=None): | 1753 node=None, flags=REVIDX_DEFAULT_FLAGS, deltacomputer=None): |
1750 """add a revision to the log | 1754 """add a revision to the log |
1751 | 1755 |
1752 text - the revision data to add | 1756 text - the revision data to add |
2024 flags = flags or REVIDX_DEFAULT_FLAGS | 2028 flags = flags or REVIDX_DEFAULT_FLAGS |
2025 | 2029 |
2026 nodes.append(node) | 2030 nodes.append(node) |
2027 | 2031 |
2028 if node in self.nodemap: | 2032 if node in self.nodemap: |
2033 self._nodeduplicatecallback(transaction, node) | |
2029 # this can happen if two branches make the same change | 2034 # this can happen if two branches make the same change |
2030 continue | 2035 continue |
2031 | 2036 |
2032 for p in (p1, p2): | 2037 for p in (p1, p2): |
2033 if p not in self.nodemap: | 2038 if p not in self.nodemap: |