Skip to content
9 changes: 9 additions & 0 deletions doctr/__main__.py
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@
import subprocess
import yaml
import json
import shlex

from pathlib import Path

Expand All @@ -40,6 +41,9 @@
get_travis_branch, copy_to_tmp, checkout_deploy_branch)
from . import __version__

def red(text):
return "\033[31m%s\033[0m" % text

def make_parser_with_config_adder(parser, config):
"""factory function for a smarter parser:

Expand Down Expand Up @@ -290,6 +294,11 @@ def deploy(args, parser):
print("Don't have permission to push. Not trying.")
else:
print("The docs have not changed. Not updating")
except BaseException as e:
DOCTR_COMMAND = ' '.join(map(shlex.quote, sys.argv))
print(red("ERROR: The doctr command %r failed: %s" % (DOCTR_COMMAND, e)),
file=sys.stderr)
raise
finally:
run(['git', 'checkout', current_commit])
# Ignore error, won't do anything if there was nothing to stash
Expand Down