MCPcopy Create free account
hub / github.com/libgit2/pygit2 / MergeFileResult

Class MergeFileResult

pygit2/index.py:391–427  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

389
390@dataclass
391class MergeFileResult:
392 automergeable: bool
393 'True if the output was automerged, false if the output contains conflict markers'
394
395 path: str | None | PathLike[str]
396 'The path that the resultant merge file should use, or None if a filename conflict would occur'
397
398 mode: FileMode
399 'The mode that the resultant merge file should use'
400
401 contents: str
402 'Contents of the file, which might include conflict markers'
403
404 def __repr__(self):
405 t = type(self)
406 contents = (
407 self.contents if len(self.contents) <= 20 else f'{self.contents[:20]}...'
408 )
409 return (
410 f'<{t.__module__}.{t.__qualname__} "'
411 f'automergeable={self.automergeable} "'
412 f'path={self.path} '
413 f'mode={self.mode} '
414 f'contents={contents}>'
415 )
416
417 @classmethod
418 def _from_c(cls, centry):
419 if centry == ffi.NULL:
420 return None
421
422 automergeable = centry.automergeable != 0
423 path = to_str(ffi.string(centry.path)) if centry.path else None
424 mode = FileMode(centry.mode)
425 contents = ffi.string(centry.ptr, centry.len).decode('utf-8')
426
427 return MergeFileResult(automergeable, path, mode, contents)
428
429
430class IndexEntry:

Callers 2

_from_cMethod · 0.85

Calls

no outgoing calls

Used in the wild real call sites across dependent graphs

searching dependent graphs…