Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
return self._search_group(RE_RAW_AUTHOR, "name")
def author_email(self) -> str:
return self._search_group(RE_RAW_AUTHOR, "email")
def commit_msg(self) -> str:
return '\n'.join(
m.group("line")
for m in RE_RAW_COMMIT_MSG_LINE.finditer(self.raw_header))
def split_header(s: str) -> List[CommitHeader]:
return list(map(CommitHeader, s.split("\0")[:-1]))
class GitPatch(ghstack.diff.Patch):
h: CommitHeader
def __init__(self, h: CommitHeader):
self.h = h
def apply(self, sh: ghstack.shell.Shell, base_tree: GitTreeHash) -> GitTreeHash:
expected_tree = sh.git("rev-parse", self.h.commit_id() + "~^{tree}")
assert expected_tree == base_tree, \
"expected_tree = {}, base_tree = {}".format(expected_tree, base_tree)
return self.h.tree()
def parse_header(s: str) -> List[ghstack.diff.Diff]:
def convert(h: CommitHeader) -> ghstack.diff.Diff:
parents = h.parents()
if len(parents) != 1: