##// END OF EJS Templates
commitctx: extract sidedata encoding inside its own function...
marmoute -
r45885:c6eea580 default
parent child Browse files
Show More
@@ -558,27 +558,7 b' class changelog(revlog.revlog):'
558 558 sortedfiles = sorted(files.touched)
559 559 sidedata = None
560 560 if self._copiesstorage == b'changeset-sidedata':
561 sidedata = {}
562 p1copies = files.copied_from_p1
563 if p1copies:
564 p1copies = metadata.encodecopies(sortedfiles, p1copies)
565 sidedata[sidedatamod.SD_P1COPIES] = p1copies
566 p2copies = files.copied_from_p2
567 if p2copies:
568 p2copies = metadata.encodecopies(sortedfiles, p2copies)
569 sidedata[sidedatamod.SD_P2COPIES] = p2copies
570 filesadded = files.added
571 if filesadded:
572 filesadded = metadata.encodefileindices(sortedfiles, filesadded)
573 sidedata[sidedatamod.SD_FILESADDED] = filesadded
574 filesremoved = files.removed
575 if filesremoved:
576 filesremoved = metadata.encodefileindices(
577 sortedfiles, filesremoved
578 )
579 sidedata[sidedatamod.SD_FILESREMOVED] = filesremoved
580 if not sidedata:
581 sidedata = None
561 sidedata = metadata.encode_copies_sidedata(files)
582 562
583 563 if extra:
584 564 extra = encodeextra(extra)
@@ -254,6 +254,30 b' def decodefileindices(files, data):'
254 254 return None
255 255
256 256
257 def encode_copies_sidedata(files):
258 sortedfiles = sorted(files.touched)
259 sidedata = {}
260 p1copies = files.copied_from_p1
261 if p1copies:
262 p1copies = encodecopies(sortedfiles, p1copies)
263 sidedata[sidedatamod.SD_P1COPIES] = p1copies
264 p2copies = files.copied_from_p2
265 if p2copies:
266 p2copies = encodecopies(sortedfiles, p2copies)
267 sidedata[sidedatamod.SD_P2COPIES] = p2copies
268 filesadded = files.added
269 if filesadded:
270 filesadded = encodefileindices(sortedfiles, filesadded)
271 sidedata[sidedatamod.SD_FILESADDED] = filesadded
272 filesremoved = files.removed
273 if filesremoved:
274 filesremoved = encodefileindices(sortedfiles, filesremoved)
275 sidedata[sidedatamod.SD_FILESREMOVED] = filesremoved
276 if not sidedata:
277 sidedata = None
278 return sidedata
279
280
257 281 def _getsidedata(srcrepo, rev):
258 282 ctx = srcrepo[rev]
259 283 filescopies = computechangesetcopies(ctx)
General Comments 0
You need to be logged in to leave comments. Login now