Skip to content

Commit a28c70f

Browse files
authored
Merge pull request #153 from gisce/fix_diff_apply_info
Fix diff apply to work correctly and show failuers + verbose
2 parents f28d0d5 + b2aff99 commit a28c70f

File tree

2 files changed

+12
-4
lines changed

2 files changed

+12
-4
lines changed

apply_pr/exceptions.py

+6
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
class SastreBaseException(Exception):
2+
pass
3+
4+
5+
class ApplyError(SastreBaseException):
6+
pass

apply_pr/fabfile.py

+6-4
Original file line numberDiff line numberDiff line change
@@ -234,9 +234,11 @@ def apply(diff, stash=True, reject=False, message=None, sudo_user='erp'):
234234
" and unstaged changes. Press Enter to continue.")
235235
)
236236
else:
237-
sudo(
238-
"git apply {}{}".format(diff, reject),
239-
)
237+
from apply_pr.exceptions import ApplyError
238+
with settings(abort_exception=ApplyError):
239+
sudo(
240+
"git apply {}{}".format(diff, reject),
241+
)
240242
empty_files = sudo(
241243
'git ls-files --modified;git ls-files -o --exclude-standard; echo empty'
242244
)
@@ -779,7 +781,7 @@ def apply_pr(
779781
if as_diff:
780782
tqdm.write(colors.yellow("Applying diff \U0001F648"))
781783
check_am_session(src=src, repository=repository_name)
782-
apply_remote_diff(
784+
result = apply_remote_diff(
783785
pr_number, src=src, repository=repository, sudo_user=sudo_user,
784786
reject=reject
785787
)

0 commit comments

Comments
 (0)