Patchwork [2,of,9,V2] revlog: clarify flagprocessor documentation

mail settings
Submitter Jun Wu
Date March 31, 2017, 4:45 a.m.
Message ID <31aa38709dbd983b8730.1490935511@x1c>
Download mbox | patch
Permalink /patch/19854/
State Accepted
Headers show


Jun Wu - March 31, 2017, 4:45 a.m.
# HG changeset patch
# User Jun Wu <>
# Date 1490885988 25200
#      Thu Mar 30 07:59:48 2017 -0700
# Node ID 31aa38709dbd983b87302a0f24f4cf78a138ae83
# Parent  4a3f09c00a850667225b56d4aa0069e8e8233281
# Available At
#              hg pull -r 31aa38709dbd
revlog: clarify flagprocessor documentation

The words "text", "newtext", "bool" could be confusing. Use explicit "text"
or "rawtext" and document more about the "bool".


diff --git a/mercurial/ b/mercurial/
--- a/mercurial/
+++ b/mercurial/
@@ -89,9 +89,15 @@  def addflagprocessor(flag, processor):
     - flagprocessors must be 3-tuples of functions (read, write, raw) with the
       following signatures:
-          - (read)  f(self, text) -> newtext, bool
-          - (write) f(self, text) -> newtext, bool
-          - (raw)   f(self, text) -> bool
+          - (read)  f(self, rawtext) -> text, bool
+          - (write) f(self, text) -> rawtext, bool
+          - (raw)   f(self, rawtext) -> bool
+      "text" is presented to the user. "rawtext" is stored in revlog data, not
+      directly visible to the user.
       The boolean returned by these transforms is used to determine whether
-      'newtext' can be used for hash integrity checking.
+      the returned text can be used for hash integrity checking. For example,
+      if "write" returns False, then "text" is used to generate hash. If
+      "write" returns True, that basically means "rawtext" returned by "write"
+      should be used to generate hash. Usually, "write" and "read" return
+      different booleans. And "raw" returns a same boolean as "write".
       Note: The 'raw' transform is used for changegroup generation and in some