|
@@ -62,16 +62,17 @@ def _rebase(repo, name): |
|
|
try: |
|
|
try: |
|
|
res = repo.git.rebase(name) |
|
|
res = repo.git.rebase(name) |
|
|
except exc.GitCommandError as err: |
|
|
except exc.GitCommandError as err: |
|
|
if "unstaged changes" in err.stderr: |
|
|
|
|
|
|
|
|
msg = err.stderr.replace("\n", " ").strip() |
|
|
|
|
|
if "unstaged changes" in msg: |
|
|
print(" error:", "unstaged changes.") |
|
|
print(" error:", "unstaged changes.") |
|
|
elif "uncommitted changes" in err.stderr: |
|
|
|
|
|
|
|
|
elif "uncommitted changes" in msg: |
|
|
print(" error:", "uncommitted changes.") |
|
|
print(" error:", "uncommitted changes.") |
|
|
else: |
|
|
else: |
|
|
try: |
|
|
try: |
|
|
repo.git.rebase("--abort") |
|
|
repo.git.rebase("--abort") |
|
|
except exc.GitCommandError: |
|
|
except exc.GitCommandError: |
|
|
pass |
|
|
pass |
|
|
print(" error:", err.stderr.replace("\n", " ")) |
|
|
|
|
|
|
|
|
print(" error:", msg if msg else "rebase conflict") |
|
|
else: |
|
|
else: |
|
|
print(" done.") |
|
|
print(" done.") |
|
|
|
|
|
|
|
@@ -81,8 +82,15 @@ def _merge(repo, name): |
|
|
try: |
|
|
try: |
|
|
repo.git.merge(name) |
|
|
repo.git.merge(name) |
|
|
except exc.GitCommandError as err: |
|
|
except exc.GitCommandError as err: |
|
|
print(err) |
|
|
|
|
|
### TODO: etc |
|
|
|
|
|
|
|
|
msg = err.stderr.replace("\n", " ").strip() |
|
|
|
|
|
if "local changes" in msg and "would be overwritten" in msg: |
|
|
|
|
|
print(" error:", "uncommitted changes.") |
|
|
|
|
|
else: |
|
|
|
|
|
try: |
|
|
|
|
|
repo.git.merge("--abort") |
|
|
|
|
|
except exc.GitCommandError: |
|
|
|
|
|
pass |
|
|
|
|
|
print(" error:", msg if msg else "merge conflict") |
|
|
else: |
|
|
else: |
|
|
print(" done.") |
|
|
print(" done.") |
|
|
|
|
|
|
|
|