[Commented On] D10358: sidedata: add a way of replacing an existing sidedata computer
baymax (Baymax, Your Personal Patch-care Companion)
phabricator at mercurial-scm.org
Tue May 4 01:05:14 UTC 2021
baymax added a comment.
baymax updated this revision to Diff 27453.
✅ refresh by Heptapod after a successful CI run (🐙 💚)
REPOSITORY
rHG Mercurial
CHANGES SINCE LAST UPDATE
https://phab.mercurial-scm.org/D10358?vs=27303&id=27453
BRANCH
default
CHANGES SINCE LAST ACTION
https://phab.mercurial-scm.org/D10358/new/
REVISION DETAIL
https://phab.mercurial-scm.org/D10358
AFFECTED FILES
mercurial/interfaces/repository.py
mercurial/localrepo.py
CHANGE DETAILS
diff --git a/mercurial/localrepo.py b/mercurial/localrepo.py
--- a/mercurial/localrepo.py
+++ b/mercurial/localrepo.py
@@ -3370,16 +3370,25 @@
return
self._wanted_sidedata.add(pycompat.bytestr(category))
- def register_sidedata_computer(self, kind, category, keys, computer, flags):
+ def register_sidedata_computer(
+ self, kind, category, keys, computer, flags, replace=False
+ ):
if kind not in revlogconst.ALL_KINDS:
msg = _(b"unexpected revlog kind '%s'.")
raise error.ProgrammingError(msg % kind)
category = pycompat.bytestr(category)
- if category in self._sidedata_computers.get(kind, []):
+ already_registered = category in self._sidedata_computers.get(kind, [])
+ if already_registered and not replace:
msg = _(
b"cannot register a sidedata computer twice for category '%s'."
)
raise error.ProgrammingError(msg % category)
+ if replace and not already_registered:
+ msg = _(
+ b"cannot replace a sidedata computer that isn't registered "
+ b"for category '%s'."
+ )
+ raise error.ProgrammingError(msg % category)
self._sidedata_computers.setdefault(kind, {})
self._sidedata_computers[kind][category] = (keys, computer, flags)
diff --git a/mercurial/interfaces/repository.py b/mercurial/interfaces/repository.py
--- a/mercurial/interfaces/repository.py
+++ b/mercurial/interfaces/repository.py
@@ -1856,7 +1856,9 @@
def savecommitmessage(text):
pass
- def register_sidedata_computer(kind, category, keys, computer, flags):
+ def register_sidedata_computer(
+ kind, category, keys, computer, flags, replace=False
+ ):
pass
def register_wanted_sidedata(category):
To: Alphare, #hg-reviewers, marmoute
Cc: mercurial-patches
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.mercurial-scm.org/pipermail/mercurial-patches/attachments/20210504/86141dd6/attachment-0002.html>
More information about the Mercurial-patches
mailing list