aboutsummaryrefslogtreecommitdiff
path: root/llvm/utils/git-svn/git-llvm
diff options
context:
space:
mode:
authorRui Ueyama <ruiu@google.com>2017-05-23 21:50:40 +0000
committerRui Ueyama <ruiu@google.com>2017-05-23 21:50:40 +0000
commit2f8db1d6543e70e9b0e178b2a9c270d428b5c77e (patch)
tree373309fcc9762a25c2f4e5fdb00966ef96df54e9 /llvm/utils/git-svn/git-llvm
parent49dd6e68c21c966d4fb81fb8248ee5a576896843 (diff)
downloadllvm-2f8db1d6543e70e9b0e178b2a9c270d428b5c77e.zip
llvm-2f8db1d6543e70e9b0e178b2a9c270d428b5c77e.tar.gz
llvm-2f8db1d6543e70e9b0e178b2a9c270d428b5c77e.tar.bz2
[git-llvm] Check if svn is installed.
The error message that git-llvm script prints out when svn is missing is very cryptic. I spent a fair amount of time to find what was wrong with my environment. It looks like many newcomers also exprienced a hard time to submit their first patches due to this error. This patch adds a more user-friendly error message. Differential Revision: https://reviews.llvm.org/D33458 llvm-svn: 303696
Diffstat (limited to 'llvm/utils/git-svn/git-llvm')
-rwxr-xr-xllvm/utils/git-svn/git-llvm8
1 files changed, 8 insertions, 0 deletions
diff --git a/llvm/utils/git-svn/git-llvm b/llvm/utils/git-svn/git-llvm
index 9309889..26f8f4d 100755
--- a/llvm/utils/git-svn/git-llvm
+++ b/llvm/utils/git-svn/git-llvm
@@ -133,6 +133,11 @@ def svn(cwd, *cmd, **kwargs):
return shell(['svn'] + list(cmd), cwd=cwd, stdin=kwargs.get('stdin', None),
ignore_errors=kwargs.get('ignore_errors', None))
+def program_exists(cmd):
+ for path in os.environ["PATH"].split(os.pathsep):
+ if os.access(os.path.join(path, cmd), os.X_OK):
+ return True
+ return False
def get_default_rev_range():
# Get the branch tracked by the current branch, as set by
@@ -309,6 +314,9 @@ def cmd_push(args):
if __name__ == '__main__':
+ if not program_exists('svn'):
+ die('error: git-llvm needs svn command, but svn is not installed.')
+
argv = sys.argv[1:]
p = argparse.ArgumentParser(
prog='git llvm', formatter_class=argparse.RawDescriptionHelpFormatter,