update gitrepo.commit() to return the new commit ID

Summary:
This makes gitrepo.commit() return the new commit ID as a hexadecimal string,
just like hgrepo.commit() currently does.

Reviewed By: wez

Differential Revision: D7341605

fbshipit-source-id: 83ebddb8c23d5e4650432bea6f8dcb8d18c0ff38
This commit is contained in:
Adam Simpkins 2018-03-20 15:05:01 -07:00 committed by Facebook Github Bot
parent 8f0e976661
commit f54e89b43c

View File

@ -105,7 +105,7 @@ class GitRepository(repobase.Repository):
committer_email: Optional[str] = None,
committer_date: Optional[datetime.datetime] = None,
amend: bool = False
) -> None:
) -> str:
if author_name is None:
author_name = self.author_name
if author_email is None:
@ -144,3 +144,6 @@ class GitRepository(repobase.Repository):
if amend:
args.append('--amend')
self.git(*args, env=git_commit_env)
# Get the commit ID and return it
return self.git('rev-parse', 'HEAD').strip()