diff options
author | Arthur Milchior <Arthur@Milchior.fr> | 2019-08-05 12:33:54 +0200 |
---|---|---|
committer | Sebastian Thiel <byronimo@gmail.com> | 2019-08-14 17:57:00 +0800 |
commit | ece804aed9874b4fd1f6b4f4c40268e919a12b17 (patch) | |
tree | 615e3495420d0845bba7a5e87ddc7dc324438936 | |
parent | d5cc590c875ada0c55d975cbe26141a94e306c94 (diff) | |
download | gitpython-ece804aed9874b4fd1f6b4f4c40268e919a12b17.tar.gz |
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.
-rw-r--r-- | AUTHORS | 1 | ||||
-rw-r--r-- | git/repo/base.py | 11 |
2 files changed, 12 insertions, 0 deletions
@@ -33,5 +33,6 @@ Contributors are: -Steven Whitman <ninloot _at_ gmail.com> -Stefan Stancu <stefan.stancu _at_ gmail.com> -César Izurieta <cesar _at_ caih.org> +-Arthur Milchior <arthur _at_ milchior.fr> Portions derived from other open source works and are clearly marked. 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 '<git.Repo "%s">' % 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() |