Patchwork D10361: sidedata: move documentation about sidedata helpers to sidedata module

login
register
mail settings
Submitter phabricator
Date April 10, 2021, 7:16 p.m.
Message ID <differential-rev-PHID-DREV-gtv5wj6n3a7tpuoqm2cm-req@mercurial-scm.org>
Download mbox | patch
Permalink /patch/48677/
State Superseded
Headers show

Comments

phabricator - April 10, 2021, 7:16 p.m.
Alphare created this revision.
Herald added a reviewer: indygreg.
Herald added a reviewer: hg-reviewers.
Herald added a subscriber: mercurial-patches.

REPOSITORY
  rHG Mercurial

BRANCH
  default

REVISION DETAIL
  https://phab.mercurial-scm.org/D10361

AFFECTED FILES
  mercurial/changegroup.py
  mercurial/revlog.py
  mercurial/revlogutils/sidedata.py
  mercurial/utils/storageutil.py

CHANGE DETAILS




To: Alphare, indygreg, #hg-reviewers
Cc: mercurial-patches, mercurial-devel

Patch

diff --git a/mercurial/utils/storageutil.py b/mercurial/utils/storageutil.py
--- a/mercurial/utils/storageutil.py
+++ b/mercurial/utils/storageutil.py
@@ -364,24 +364,7 @@ 
     ``assumehaveparentrevisions``
     ``sidedata_helpers`` (optional)
         If not None, means that sidedata should be included.
-        A dictionary of revlog type to tuples of `(repo, computers, removers)`:
-            * `repo` is used as an argument for computers
-            * `computers` is a list of `(category, (keys, computer, flags)` that
-               compute the missing sidedata categories that were asked:
-               * `category` is the sidedata category
-               * `keys` are the sidedata keys to be affected
-               * `flags` is a bitmask (an integer) of flags to remove when
-                  removing the category.
-               * `computer` is the function `(repo, store, rev, sidedata)` that
-                 returns a tuple of
-                 `(new sidedata dict, (flags to add, flags to remove))`.
-                 For example, it will return `({}, (0, 1 << 15))` to return no
-                 sidedata, with no flags to add and one flag to remove.
-            * `removers` will remove the keys corresponding to the categories
-              that are present, but not needed.
-        If both `computers` and `removers` are empty, sidedata are simply not
-        transformed.
-        Revlog types are `changelog`, `manifest` or `filelog`.
+        See `revlogutil.sidedata.get_sidedata_helpers`.
     """
 
     fnode = store.node
diff --git a/mercurial/revlogutils/sidedata.py b/mercurial/revlogutils/sidedata.py
--- a/mercurial/revlogutils/sidedata.py
+++ b/mercurial/revlogutils/sidedata.py
@@ -96,6 +96,26 @@ 
 
 
 def get_sidedata_helpers(repo, remote_sd_categories, pull=False):
+    """
+    Returns a dictionary mapping revlog types to tuples of
+    `(repo, computers, removers)`:
+        * `repo` is used as an argument for computers
+        * `computers` is a list of `(category, (keys, computer, flags)` that
+           compute the missing sidedata categories that were asked:
+           * `category` is the sidedata category
+           * `keys` are the sidedata keys to be affected
+           * `flags` is a bitmask (an integer) of flags to remove when
+              removing the category.
+           * `computer` is the function `(repo, store, rev, sidedata)` that
+             returns a tuple of
+             `(new sidedata dict, (flags to add, flags to remove))`.
+             For example, it will return `({}, (0, 1 << 15))` to return no
+             sidedata, with no flags to add and one flag to remove.
+        * `removers` will remove the keys corresponding to the categories
+          that are present, but not needed.
+        If both `computers` and `removers` are empty, sidedata will simply not
+        be transformed.
+    """
     # Computers for computing sidedata on-the-fly
     sd_computers = collections.defaultdict(list)
     # Computers for categories to remove from sidedata
@@ -121,7 +141,7 @@ 
     the given helpers.
     - `store`: the revlog this applies to (changelog, manifest, or filelog
       instance)
-    - `sidedata_helpers`: see `storageutil.emitrevisions`
+    - `sidedata_helpers`: see `get_sidedata_helpers`
     - `sidedata`: previous sidedata at the given rev, if any
     - `rev`: affected rev of `store`
     """
diff --git a/mercurial/revlog.py b/mercurial/revlog.py
--- a/mercurial/revlog.py
+++ b/mercurial/revlog.py
@@ -2818,7 +2818,8 @@ 
         argument controls whether to force compute deltas against both parents
         for merges. By default, the current default is used.
 
-        See `storageutil.emitrevisions` for the doc on `sidedata_helpers`.
+        See `revlogutil.sidedata.get_sidedata_helpers` for the doc on
+        `sidedata_helpers`.
         """
         if deltareuse not in self.DELTAREUSEALL:
             raise ValueError(
diff --git a/mercurial/changegroup.py b/mercurial/changegroup.py
--- a/mercurial/changegroup.py
+++ b/mercurial/changegroup.py
@@ -842,7 +842,8 @@ 
     If topic is not None, progress detail will be generated using this
     topic name (e.g. changesets, manifests, etc).
 
-    See `storageutil.emitrevisions` for the doc on `sidedata_helpers`.
+    See `revlogutil.sidedata.get_sidedata_helpers` for the doc on
+    `sidedata_helpers`.
     """
     if not nodes:
         return
@@ -1210,7 +1211,8 @@ 
         if generate is False, the state will be fully populated and no chunk
         stream will be yielded
 
-        See `storageutil.emitrevisions` for the doc on `sidedata_helpers`.
+        See `revlogutil.sidedata.get_sidedata_helpers` for the doc on
+        `sidedata_helpers`.
         """
         clrevorder = {}
         manifests = {}
@@ -1315,7 +1317,8 @@ 
         `source` is unused here, but is used by extensions like remotefilelog to
         change what is sent based in pulls vs pushes, etc.
 
-        See `storageutil.emitrevisions` for the doc on `sidedata_helpers`.
+        See `revlogutil.sidedata.get_sidedata_helpers` for the doc on
+        `sidedata_helpers`.
         """
         repo = self._repo
         mfl = repo.manifestlog