changeset 47086:8bd769b5c941

sidedata: move documentation about sidedata helpers to sidedata module Differential Revision: https://phab.mercurial-scm.org/D10361
author Raphaël Gomès <rgomes@octobus.net>
date Mon, 19 Apr 2021 11:22:24 +0200
parents 3aab2330b7d3
children 4b1bce1aa9bb
files mercurial/changegroup.py mercurial/revlog.py mercurial/revlogutils/sidedata.py mercurial/utils/storageutil.py
diffstat 4 files changed, 30 insertions(+), 23 deletions(-) [+]
line wrap: on
line diff
--- a/mercurial/changegroup.py	Mon Apr 19 11:22:24 2021 +0200
+++ b/mercurial/changegroup.py	Mon Apr 19 11:22:24 2021 +0200
@@ -844,7 +844,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
@@ -1212,7 +1213,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 = {}
@@ -1317,7 +1319,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
--- a/mercurial/revlog.py	Mon Apr 19 11:22:24 2021 +0200
+++ b/mercurial/revlog.py	Mon Apr 19 11:22:24 2021 +0200
@@ -2702,7 +2702,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(
--- a/mercurial/revlogutils/sidedata.py	Mon Apr 19 11:22:24 2021 +0200
+++ b/mercurial/revlogutils/sidedata.py	Mon Apr 19 11:22:24 2021 +0200
@@ -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`
     """
--- a/mercurial/utils/storageutil.py	Mon Apr 19 11:22:24 2021 +0200
+++ b/mercurial/utils/storageutil.py	Mon Apr 19 11:22:24 2021 +0200
@@ -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