Alphare created this revision.
Herald added a reviewer: hg-reviewers.
Herald added a subscriber: mercurial-patches.
During a `pull` operation where the server does not provide sidedata, the client
that requires it should generate them on-the-fly. In the generic case, we need
to wait for the changelog + manifests + filelogs to be added, since we don't
know what the sidedata computers might need: this means rewriting the index
entries from within the pull transaction (and no further back) right after we've
The Python implementation does not guard against the accidental replacement of
an entry that is not within the transaction, but the C implementation does.
diff --git a/mercurial/pure/parsers.py b/mercurial/pure/parsers.py
@@ -116,6 +116,23 @@
r = (offset_type(0, gettype(r)),) + r[1:]
+ def replace(self, i, tup):
+ Replace an existing index entry with a new value. This should
+ not be used outside of the context of sidedata rewriting, inside the
+ transaction that creates the revision `i`.
+ if i < 0:
+ raise KeyError
+ if i >= self._lgt:
+ self._extra[i - self._lgt] = _pack(self.index_format, *tup)
+ index = self._calculate_index(i)
+ self._data[index : index + self.index_size] = _pack(
+ self.index_format, *tup