Mercurial > hg
comparison mercurial/copies.py @ 45639:7a757e893532
copies: no longer change the sidedata flag
With the new sidedata storage that include data about all file changes, every
revision has one, so the sidedata flag is not longer a good way to spot
changeset with copy information. So we drop this check to simplify the code
We optimisation itself provided an interesting speedup, so we will likely
reintroduce something similar, with a dedicated flag, in the future.
Differential Revision: https://phab.mercurial-scm.org/D9116
author | Pierre-Yves David <pierre-yves.david@octobus.net> |
---|---|
date | Fri, 25 Sep 2020 14:54:43 +0200 |
parents | 4f876e6b30fa |
children | 2693659c2b34 |
comparison
equal
deleted
inserted
replaced
45638:4f876e6b30fa | 45639:7a757e893532 |
---|---|
10 import collections | 10 import collections |
11 import os | 11 import os |
12 | 12 |
13 from .i18n import _ | 13 from .i18n import _ |
14 | 14 |
15 | |
16 from .revlogutils.flagutil import REVIDX_SIDEDATA | |
17 | 15 |
18 from . import ( | 16 from . import ( |
19 match as matchmod, | 17 match as matchmod, |
20 node, | 18 node, |
21 pathutil, | 19 pathutil, |
200 return nb_parents >= 2 | 198 return nb_parents >= 2 |
201 | 199 |
202 return ismerged | 200 return ismerged |
203 | 201 |
204 changelogrevision = cl.changelogrevision | 202 changelogrevision = cl.changelogrevision |
205 flags = cl.flags | |
206 | 203 |
207 # A small cache to avoid doing the work twice for merges | 204 # A small cache to avoid doing the work twice for merges |
208 # | 205 # |
209 # In the vast majority of cases, if we ask information for a revision | 206 # In the vast majority of cases, if we ask information for a revision |
210 # about 1 parent, we'll later ask it for the other. So it make sense to | 207 # about 1 parent, we'll later ask it for the other. So it make sense to |
230 merge_caches = {} | 227 merge_caches = {} |
231 | 228 |
232 def revinfo(rev): | 229 def revinfo(rev): |
233 p1, p2 = parents(rev) | 230 p1, p2 = parents(rev) |
234 value = None | 231 value = None |
235 if flags(rev) & REVIDX_SIDEDATA: | 232 e = merge_caches.pop(rev, None) |
236 e = merge_caches.pop(rev, None) | 233 if e is not None: |
237 if e is not None: | 234 return e |
238 return e | 235 c = changelogrevision(rev) |
239 c = changelogrevision(rev) | 236 p1copies = c.p1copies |
240 p1copies = c.p1copies | 237 p2copies = c.p2copies |
241 p2copies = c.p2copies | 238 removed = c.filesremoved |
242 removed = c.filesremoved | 239 if p1 != node.nullrev and p2 != node.nullrev: |
243 if p1 != node.nullrev and p2 != node.nullrev: | 240 # XXX some case we over cache, IGNORE |
244 # XXX some case we over cache, IGNORE | 241 value = merge_caches[rev] = ( |
245 value = merge_caches[rev] = ( | 242 p1, |
246 p1, | 243 p2, |
247 p2, | 244 p1copies, |
248 p1copies, | 245 p2copies, |
249 p2copies, | 246 removed, |
250 removed, | 247 get_ismerged(rev), |
251 get_ismerged(rev), | 248 ) |
252 ) | |
253 else: | |
254 p1copies = {} | |
255 p2copies = {} | |
256 removed = [] | |
257 | 249 |
258 if value is None: | 250 if value is None: |
259 value = (p1, p2, p1copies, p2copies, removed, get_ismerged(rev)) | 251 value = (p1, p2, p1copies, p2copies, removed, get_ismerged(rev)) |
260 return value | 252 return value |
261 | 253 |