Show More
@@ -112,26 +112,49 b' 0.5 Malformed Cases' | |||||
112 | 1. Interleaved insertions, or interleaved deletions. |
|
112 | 1. Interleaved insertions, or interleaved deletions. | |
113 | It can be rewritten to a non-interleaved tree structure. |
|
113 | It can be rewritten to a non-interleaved tree structure. | |
114 |
|
114 | |||
115 | ^AI/D x ^AI/D x |
|
115 | Take insertions as example, deletions are similar: | |
116 | ^AI/D y -> ^AI/D y |
|
116 | ||
117 |
^A |
|
117 | ^AI x ^AI x | |
118 |
|
|
118 | a a | |
|
119 | ^AI x + 1 -> ^AI x + 1 | |||
|
120 | b b | |||
|
121 | ^AE x ^AE x + 1 | |||
|
122 | c ^AE x | |||
|
123 | ^AE x + 1 ^AI x + 1 | |||
|
124 | c | |||
|
125 | ^AE x + 1 | |||
119 |
|
126 | |||
120 | 2. Nested insertions, where the inner one has a smaller revision number. |
|
127 | 2. Nested insertions, where the inner one has a smaller revision number. | |
|
128 | Or nested deletions, where the inner one has a larger revision number. | |||
121 | It can be rewritten to a non-nested form. |
|
129 | It can be rewritten to a non-nested form. | |
122 |
|
130 | |||
|
131 | Take insertions as example, deletions are similar: | |||
|
132 | ||||
123 | ^AI x + 1 ^AI x + 1 |
|
133 | ^AI x + 1 ^AI x + 1 | |
|
134 | a a | |||
124 | ^AI x -> ^AE x + 1 |
|
135 | ^AI x -> ^AE x + 1 | |
125 |
|
|
136 | b ^AI x | |
126 |
^AE x |
|
137 | ^AE x b | |
|
138 | c ^AE x | |||
|
139 | ^AE x + 1 ^AI x + 1 | |||
|
140 | c | |||
|
141 | ^AE x + 1 | |||
127 |
|
142 | |||
128 | 3. Insertion or deletion inside another deletion, where the outer deletion |
|
143 | 3. Insertion inside deletion with a smaller revision number. | |
129 | block has a smaller revision number. |
|
144 | ||
|
145 | Rewrite by duplicating the content inserted: | |||
130 |
|
146 | |||
131 | ^AD x ^AD x |
|
147 | ^AD x ^AD x | |
132 | ^AI/D x + 1 -> ^AE x |
|
148 | a a | |
133 |
^A |
|
149 | ^AI x + 1 -> b | |
134 |
|
|
150 | b c | |
|
151 | ^AE x + 1 ^AE x | |||
|
152 | c ^AI x + 1 | |||
|
153 | ^AE x b | |||
|
154 | ^AE x + 1 | |||
|
155 | ||||
|
156 | Note: If "annotate" purely depends on "^AI" information, then the | |||
|
157 | duplication content will lose track of where "b" is originally from. | |||
135 |
|
158 | |||
136 | Some of them may be valid in other implementations for special purposes. For |
|
159 | Some of them may be valid in other implementations for special purposes. For | |
137 | example, to "revive" a previously deleted block in a newer revision. |
|
160 | example, to "revive" a previously deleted block in a newer revision. | |
@@ -249,3 +272,31 b" 1.3 Comparing with Mercurial's revlog fo" | |||||
249 |
|
272 | |||
250 | "c" makes "hg absorb" easier to implement and makes it possible to do |
|
273 | "c" makes "hg absorb" easier to implement and makes it possible to do | |
251 | "annotate --deleted". |
|
274 | "annotate --deleted". | |
|
275 | ||||
|
276 | 1.4 Malformed Cases Handling | |||
|
277 | ||||
|
278 | The following "case 1", "case 2", and "case 3" refer to cases mentioned | |||
|
279 | in section 0.5. | |||
|
280 | ||||
|
281 | Using the exposed API (replacelines), case 1 is impossible to generate, | |||
|
282 | although it's possible to generate it by constructing rawdata and load that | |||
|
283 | via linelog.fromdata. | |||
|
284 | ||||
|
285 | Doing annotate(maxrev) before replacelines (aka. a1, a2 passed to | |||
|
286 | replacelines are related to the latest revision) eliminates the possibility | |||
|
287 | of case 3. That makes sense since usually you'd like to make edits on top of | |||
|
288 | the latest revision. Practically, both absorb and fastannotate do this. | |||
|
289 | ||||
|
290 | Doing annotate(maxrev), plus replacelines(rev, ...) where rev >= maxrev | |||
|
291 | eliminates the possibility of case 2. That makes sense since usually the | |||
|
292 | edits belong to "new revisions", not "old revisions". Practically, | |||
|
293 | fastannotate does this. Absorb calls replacelines with rev < maxrev to edit | |||
|
294 | past revisions. So it needs some extra care to not generate case 2. | |||
|
295 | ||||
|
296 | If case 1 occurs, that probably means linelog file corruption (assuming | |||
|
297 | linelog is edited via public APIs) the checkout or annotate result could | |||
|
298 | be less meaningful or even error out, but linelog wouldn't enter an infinite | |||
|
299 | loop. | |||
|
300 | ||||
|
301 | If either case 2 or 3 occurs, linelog works as if the inner "^AI/D" and "^AE" | |||
|
302 | operations on the left side are silently ignored. |
General Comments 0
You need to be logged in to leave comments.
Login now