Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Method stating which commit is being played during an halted rebase#903

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to ourterms of service andprivacy statement. We’ll occasionally send you account related emails.

Already on GitHub?Sign in to your account

Merged
Byron merged 4 commits intogitpython-developers:masterfromArthur-Milchior:rebase
Aug 14, 2019
Merged
Show file tree
Hide file tree
Changes fromall commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletionsAUTHORS
View file
Open in desktop
Original file line numberDiff line numberDiff line change
Expand Up@@ -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.
11 changes: 11 additions & 0 deletionsgit/repo/base.py
View file
Open in desktop
Original file line numberDiff line numberDiff line change
Expand Up@@ -1061,3 +1061,14 @@ def has_separate_working_tree(self):

def __repr__(self):
return '<git.Repo "%s">' % self.git_dir

def currently_rebasing_on(self):
"""
:return: 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 self.commit(open(rebase_head_file, "rt").readline().strip())
22 changes: 22 additions & 0 deletionsgit/test/test_repo.py
View file
Open in desktop
Original file line numberDiff line numberDiff line change
Expand Up@@ -1023,3 +1023,25 @@ def test_git_work_tree_env(self, rw_dir):
self.assertEqual(r.working_dir, repo_dir)
finally:
os.environ = oldenv

@with_rw_directory
def test_rebasing(self, rw_dir):
r = Repo.init(rw_dir)
fp = osp.join(rw_dir, 'hello.txt')
r.git.commit("--allow-empty", message="init",)
with open(fp, 'w') as fs:
fs.write("hello world")
r.git.add(Git.polish_url(fp))
r.git.commit(message="English")
self.assertEqual(r.currently_rebasing_on(), None)
r.git.checkout("HEAD^1")
with open(fp, 'w') as fs:
fs.write("Hola Mundo")
r.git.add(Git.polish_url(fp))
r.git.commit(message="Spanish")
commitSpanish = r.commit()
try:
r.git.rebase("master")
except GitCommandError:
pass
self.assertEqual(r.currently_rebasing_on(), commitSpanish)

[8]ページ先頭

©2009-2025 Movatter.jp