From ece804aed9874b4fd1f6b4f4c40268e919a12b17 Mon Sep 17 00:00:00 2001 From: Arthur Milchior Date: Mon, 5 Aug 2019 12:33:54 +0200 Subject: Method stating which commit is being played during an halted rebase This will be useful to me at least. This way, I know that I can tell my script to omit some specific commits. If you accept to merge it, I may also do similar method for merges and cherry pick. --- git/repo/base.py | 11 +++++++++++ 1 file changed, 11 insertions(+) (limited to 'git/repo/base.py') diff --git a/git/repo/base.py b/git/repo/base.py index 1df3c547..efb70b37 100644 --- a/git/repo/base.py +++ b/git/repo/base.py @@ -1062,3 +1062,14 @@ class Repo(object): def __repr__(self): return '' % self.git_dir + + def currentlyRebasingOn(self): + """ + :return: The hash of the commit which is currently being replayed while rebasing. + + None if we are not currently rebasing. + """ + rebase_head_file = osp.join(self.git_dir, "REBASE_HEAD") + if not osp.isfile(rebase_head_file): + return None + return open(rebase_head_file, "rt").readline().strip() -- cgit v1.2.1