Lines Matching refs:xf
374 for xf in self.transfers:
376 for _, sr in xf.stash_before:
398 size = xf.src_ranges.size()
401 unstashed_src_ranges = xf.src_ranges
403 for _, sr in xf.use_stash:
406 sr = xf.src_ranges.map_within(sr)
418 if xf.use_stash:
419 mapped_unstashed = xf.src_ranges.map_within(unstashed_src_ranges)
437 tgt_size = xf.tgt_ranges.size()
439 if xf.style == "new":
440 assert xf.tgt_ranges
441 assert tgt_size == WriteSplitTransfers(out, xf.style, xf.tgt_ranges)
443 elif xf.style == "move":
444 assert xf.tgt_ranges
445 assert xf.src_ranges.size() == tgt_size
446 if xf.src_ranges != xf.tgt_ranges:
448 if xf.src_ranges.overlaps(xf.tgt_ranges):
449 temp_stash_usage = stashed_blocks + xf.src_ranges.size()
454 xf.src_ranges)
457 xf.style,
458 xf.tgt_sha1,
459 xf.tgt_ranges.to_string_raw(), src_str))
461 elif xf.style in ("bsdiff", "imgdiff"):
462 assert xf.tgt_ranges
463 assert xf.src_ranges
465 if xf.src_ranges.overlaps(xf.tgt_ranges):
466 temp_stash_usage = stashed_blocks + xf.src_ranges.size()
470 self.touched_src_ranges = self.touched_src_ranges.union(xf.src_ranges)
473 xf.style,
474 xf.patch_start, xf.patch_len,
475 xf.src_sha1,
476 xf.tgt_sha1,
477 xf.tgt_ranges.to_string_raw(), src_str))
479 elif xf.style == "zero":
480 assert xf.tgt_ranges
481 to_zero = xf.tgt_ranges.subtract(xf.src_ranges)
482 assert WriteSplitTransfers(out, xf.style, to_zero) == to_zero.size()
485 raise ValueError("unknown transfer style '%s'\n" % xf.style)
560 for xf in self.transfers:
561 # Command xf defines (stores) all the stashes in stash_before.
562 for stash_raw_id, sr in xf.stash_before:
563 stash_map[stash_raw_id] = (sr, xf)
565 # Record all the stashes command xf uses.
566 for stash_raw_id, _ in xf.use_stash:
567 stash_map[stash_raw_id] += (xf,)
584 for xf in self.transfers:
587 # xf.stash_before generates explicit stash commands.
588 for stash_raw_id, sr in xf.stash_before:
611 if xf.style == "diff":
612 assert xf.tgt_ranges and xf.src_ranges
613 if xf.src_ranges.overlaps(xf.tgt_ranges):
614 if stashed_blocks + xf.src_ranges.size() > max_allowed:
615 replaced_cmds.append(xf)
616 print("%10d %9s %s" % (xf.src_ranges.size(), "implicit", xf))
632 # xf.use_stash may generate free commands.
633 for _, sr in xf.use_stash:
651 for index, xf in enumerate(self.transfers):
652 if xf.style == "zero":
653 tgt_size = xf.tgt_ranges.size() * self.tgt.blocksize
655 tgt_size, tgt_size, 100.0, xf.style, xf.tgt_name,
656 str(xf.tgt_ranges)))
658 elif xf.style == "new":
659 self.tgt.WriteRangeDataToFd(xf.tgt_ranges, new_f)
660 tgt_size = xf.tgt_ranges.size() * self.tgt.blocksize
662 tgt_size, tgt_size, 100.0, xf.style,
663 xf.tgt_name, str(xf.tgt_ranges)))
665 elif xf.style == "diff":
674 if xf.src_sha1 == xf.tgt_sha1:
677 xf.style = "move"
678 tgt_size = xf.tgt_ranges.size() * self.tgt.blocksize
679 if xf.src_ranges != xf.tgt_ranges:
681 tgt_size, tgt_size, 100.0, xf.style,
682 xf.tgt_name if xf.tgt_name == xf.src_name else (
683 xf.tgt_name + " (from " + xf.src_name + ")"),
684 str(xf.tgt_ranges), str(xf.src_ranges)))
701 imgdiff = (not self.disable_imgdiff and xf.intact and
702 xf.tgt_name.split(".")[-1].lower()
704 xf.style = "imgdiff" if imgdiff else "bsdiff"
709 assert False, "unknown style " + xf.style
739 xf = self.transfers[xf_index]
740 src_ranges = xf.src_ranges
741 tgt_ranges = xf.tgt_ranges
760 xf.tgt_name if xf.tgt_name == xf.src_name else
761 xf.tgt_name + " (from " + xf.src_name + ")",
762 xf.tgt_ranges, xf.src_ranges, e.message))
771 print(' [%d%%] %s\033[K' % (progress, xf.tgt_name), end='\r')
793 xf = self.transfers[index]
794 xf.patch_len = len(patch)
795 xf.patch_start = offset
796 offset += xf.patch_len
800 tgt_size = xf.tgt_ranges.size() * self.tgt.blocksize
802 xf.patch_len, tgt_size, xf.patch_len * 100.0 / tgt_size,
803 xf.style,
804 xf.tgt_name if xf.tgt_name == xf.src_name else (
805 xf.tgt_name + " (from " + xf.src_name + ")"),
806 xf.tgt_ranges, xf.src_ranges))
817 for xf in self.transfers:
820 x = xf.src_ranges
821 for _, sr in xf.use_stash:
834 for s, e in xf.tgt_ranges:
857 for xf in self.transfers:
858 xf.incoming = xf.goes_after.copy()
859 xf.outgoing = xf.goes_before.copy()
871 _, _, xf = heapq.heappop(S)
872 L.append(xf)
873 for u in xf.outgoing:
874 del u.incoming[xf]
882 for i, xf in enumerate(L):
883 xf.order = i
891 for xf in self.transfers:
893 size = xf.src_ranges.size()
894 for u in xf.goes_before:
895 # xf should go before u
896 if xf.order < u.order:
900 # it doesn't, boo. trim the blocks that u writes from xf's
901 # source, so that xf can go after u.
903 assert xf.src_ranges.overlaps(u.tgt_ranges)
904 xf.src_ranges = xf.src_ranges.subtract(u.tgt_ranges)
905 xf.intact = False
907 if xf.style == "diff" and not xf.src_ranges:
909 xf.style = "new"
911 lost = size - xf.src_ranges.size()
939 for xf in self.transfers:
940 for u in xf.goes_before.copy():
941 # xf should go before u
942 if xf.order < u.order:
947 # writes that xf wants to read, and then require u to go
948 # before xf.
951 overlap = xf.src_ranges.intersect(u.tgt_ranges)
955 xf.use_stash.append((stash_raw_id, overlap))
959 # reverse the edge direction; now xf must go after u
960 del xf.goes_before[u]
961 del u.goes_after[xf]
962 xf.goes_after[u] = None # value doesn't matter
963 u.goes_before[xf] = None
987 for xf in self.transfers:
988 xf.incoming = xf.goes_after.copy()
989 xf.outgoing = xf.goes_before.copy()
990 xf.score = sum(xf.outgoing.values()) - sum(xf.incoming.values())
996 for xf in self.transfers:
997 G[xf] = None
1002 for xf in self.transfers:
1003 xf.heap_item = HeapItem(xf)
1004 heap.append(xf.heap_item)