in antlir/btrfs_diff/inode.py [0:0]
def _repr_fields(self):
yield S_IFMT_TO_FILE_TYPE_NAME.get(self.file_type, str(self.file_type))
if self.mode is not None:
yield f"m{self.mode:o}"
if self.owner is not None:
yield f"o{self.owner}"
if self.utimes is not None:
yield f"t{self.utimes}"
if self.xattrs:
yield "x" + ",".join(
f"{repr(_repr_decode(k))}={repr(_repr_decode(v))}"
for k, v in self.xattrs.items()
)
# The next 3 fields are unmarked because they belong to different
# file-types, and would normally come last. A pathological `Inode`
# could emit ambiguous output because of this, but I'm not worried.
if self.chunks: # This won't distinguish between `None` and `()`
yield "".join(
f"{EXTENT_KIND_TO_ABBREV[c.kind]}{c.length}"
+ (
(
"("
+ "/".join(sorted(repr(cc) for cc in c.chunk_clones))
+ ")"
)
if c.chunk_clones
else ""
)
for c in self.chunks
)
if self.dev is not None:
yield f"{hex(self.dev)[2:]}"
if self.dest is not None:
yield f"{_repr_decode(self.dest)}"