comparison mercurial/revlog.py @ 31749:17d0dab7b2b6

revlog: clarify flagprocessor documentation The words "text", "newtext", "bool" could be confusing. Use explicit "text" or "rawtext" and document more about the "bool".
author Jun Wu <quark@fb.com>
date Thu, 30 Mar 2017 07:59:48 -0700
parents 4eb75c86368b
children f319981c24c9
comparison
equal deleted inserted replaced
31748:985de02b5b9d 31749:17d0dab7b2b6
86 Invariant: 86 Invariant:
87 - Flags need to be defined in REVIDX_KNOWN_FLAGS and REVIDX_FLAGS_ORDER. 87 - Flags need to be defined in REVIDX_KNOWN_FLAGS and REVIDX_FLAGS_ORDER.
88 - Only one flag processor can be registered on a specific flag. 88 - Only one flag processor can be registered on a specific flag.
89 - flagprocessors must be 3-tuples of functions (read, write, raw) with the 89 - flagprocessors must be 3-tuples of functions (read, write, raw) with the
90 following signatures: 90 following signatures:
91 - (read) f(self, text) -> newtext, bool 91 - (read) f(self, rawtext) -> text, bool
92 - (write) f(self, text) -> newtext, bool 92 - (write) f(self, text) -> rawtext, bool
93 - (raw) f(self, text) -> bool 93 - (raw) f(self, rawtext) -> bool
94 "text" is presented to the user. "rawtext" is stored in revlog data, not
95 directly visible to the user.
94 The boolean returned by these transforms is used to determine whether 96 The boolean returned by these transforms is used to determine whether
95 'newtext' can be used for hash integrity checking. 97 the returned text can be used for hash integrity checking. For example,
98 if "write" returns False, then "text" is used to generate hash. If
99 "write" returns True, that basically means "rawtext" returned by "write"
100 should be used to generate hash. Usually, "write" and "read" return
101 different booleans. And "raw" returns a same boolean as "write".
96 102
97 Note: The 'raw' transform is used for changegroup generation and in some 103 Note: The 'raw' transform is used for changegroup generation and in some
98 debug commands. In this case the transform only indicates whether the 104 debug commands. In this case the transform only indicates whether the
99 contents can be used for hash integrity checks. 105 contents can be used for hash integrity checks.
100 """ 106 """