Skip to content

Commit 62e49c6

Browse files
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.
1 parent 375c358 commit 62e49c6

File tree

2 files changed

+12
-0
lines changed

2 files changed

+12
-0
lines changed

AUTHORS

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -33,5 +33,6 @@ Contributors are:
3333
-Steven Whitman <ninloot _at_ gmail.com>
3434
-Stefan Stancu <stefan.stancu _at_ gmail.com>
3535
-César Izurieta <cesar _at_ caih.org>
36+
-Arthur Milchior <arthur _at_ milchior.fr>
3637

3738
Portions derived from other open source works and are clearly marked.

git/repo/base.py

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1061,3 +1061,14 @@ def has_separate_working_tree(self):
10611061

10621062
def __repr__(self):
10631063
return '<git.Repo "%s">' % self.git_dir
1064+
1065+
def currentlyRebasingOn(self):
1066+
"""
1067+
:return: The hash of the commit which is currently being replayed while rebasing.
1068+
1069+
None if we are not currently rebasing.
1070+
"""
1071+
rebase_head_file = osp.join(self.git_dir, "REBASE_HEAD")
1072+
if not osp.isfile(rebase_head_file):
1073+
return None
1074+
return open(rebase_head_file, "rt").readline().strip()

0 commit comments

Comments
 (0)