##// END OF EJS Templates
copies: return None instead of ChangingFiles when relevant...
marmoute -
r46246:1720d843 default draft
parent child Browse files
Show More
@@ -599,7 +599,7 b' class changelog(revlog.revlog):'
599 l = [hex(manifest), user, parseddate] + sortedfiles + [b"", desc]
599 l = [hex(manifest), user, parseddate] + sortedfiles + [b"", desc]
600 text = b"\n".join(l)
600 text = b"\n".join(l)
601 return self.addrevision(
601 return self.addrevision(
602 text, transaction, len(self), p1, p2, sidedata=sidedata
602 text, transaction, len(self), p1, p2, sidedata=sidedata, flags=flags
603 )
603 )
604
604
605 def branchinfo(self, rev):
605 def branchinfo(self, rev):
@@ -24,6 +24,8 b' from . import ('
24
24
25 from .utils import stringutil
25 from .utils import stringutil
26
26
27 from .revlogutils import flagutil
28
27
29
28 def _filter(src, dst, t):
30 def _filter(src, dst, t):
29 """filters out invalid copies after chaining"""
31 """filters out invalid copies after chaining"""
@@ -179,6 +181,9 b' def _revinfo_getter(repo):'
179 """
181 """
180 cl = repo.changelog
182 cl = repo.changelog
181 parents = cl.parentrevs
183 parents = cl.parentrevs
184 flags = cl.flags
185
186 HASCOPIESINFO = flagutil.REVIDX_HASCOPIESINFO
182
187
183 changelogrevision = cl.changelogrevision
188 changelogrevision = cl.changelogrevision
184
189
@@ -213,7 +218,10 b' def _revinfo_getter(repo):'
213 e = merge_caches.pop(rev, None)
218 e = merge_caches.pop(rev, None)
214 if e is not None:
219 if e is not None:
215 return e
220 return e
216 value = (p1, p2, changelogrevision(rev).changes)
221 changes = None
222 if flags(rev) & HASCOPIESINFO:
223 changes = changelogrevision(rev).changes
224 value = (p1, p2, changes)
217 if p1 != node.nullrev and p2 != node.nullrev:
225 if p1 != node.nullrev and p2 != node.nullrev:
218 # XXX some case we over cache, IGNORE
226 # XXX some case we over cache, IGNORE
219 merge_caches[rev] = value
227 merge_caches[rev] = value
@@ -293,13 +301,16 b' def _combine_changeset_copies('
293 copies = {}
301 copies = {}
294 for i, c in enumerate(children[r]):
302 for i, c in enumerate(children[r]):
295 p1, p2, changes = revinfo(c)
303 p1, p2, changes = revinfo(c)
304 childcopies = {}
296 if r == p1:
305 if r == p1:
297 parent = 1
306 parent = 1
298 childcopies = changes.copied_from_p1
307 if changes is not None:
308 childcopies = changes.copied_from_p1
299 else:
309 else:
300 assert r == p2
310 assert r == p2
301 parent = 2
311 parent = 2
302 childcopies = changes.copied_from_p2
312 if changes is not None:
313 childcopies = changes.copied_from_p2
303 if not alwaysmatch:
314 if not alwaysmatch:
304 childcopies = {
315 childcopies = {
305 dst: src for dst, src in childcopies.items() if match(dst)
316 dst: src for dst, src in childcopies.items() if match(dst)
@@ -313,14 +324,15 b' def _combine_changeset_copies('
313 source = prev[1]
324 source = prev[1]
314 newcopies[dest] = (c, source)
325 newcopies[dest] = (c, source)
315 assert newcopies is not copies
326 assert newcopies is not copies
316 for f in changes.removed:
327 if changes is not None:
317 if f in newcopies:
328 for f in changes.removed:
318 if newcopies is copies:
329 if f in newcopies:
319 # copy on write to avoid affecting potential other
330 if newcopies is copies:
320 # branches. when there are no other branches, this
331 # copy on write to avoid affecting potential other
321 # could be avoided.
332 # branches. when there are no other branches, this
322 newcopies = copies.copy()
333 # could be avoided.
323 newcopies[f] = (c, None)
334 newcopies = copies.copy()
335 newcopies[f] = (c, None)
324 othercopies = all_copies.get(c)
336 othercopies = all_copies.get(c)
325 if othercopies is None:
337 if othercopies is None:
326 all_copies[c] = newcopies
338 all_copies[c] = newcopies
@@ -373,13 +385,21 b' def _merge_copies_dict(minor, major, isa'
373 # than the branch point or there is a merge
385 # than the branch point or there is a merge
374 if new_tt == other_tt:
386 if new_tt == other_tt:
375 minor[dest] = value
387 minor[dest] = value
376 elif value[1] is None and dest in changes.salvaged:
388 elif (
389 changes is not None
390 and value[1] is None
391 and dest in changes.salvaged
392 ):
377 pass
393 pass
378 elif other[1] is None and dest in changes.salvaged:
394 elif (
395 changes is not None
396 and other[1] is None
397 and dest in changes.salvaged
398 ):
379 minor[dest] = value
399 minor[dest] = value
380 elif not isancestor(new_tt, other_tt):
400 elif not isancestor(new_tt, other_tt):
381 minor[dest] = value
401 minor[dest] = value
382 elif dest in changes.merged:
402 elif changes is not None and dest in changes.merged:
383 minor[dest] = value
403 minor[dest] = value
384
404
385
405
General Comments 0
You need to be logged in to leave comments. Login now