[PATCH] D33458: [git-llvm] Check if svn and git-svn have been installed.
Rui Ueyama via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Tue May 23 12:59:43 PDT 2017
ruiu created this revision.
The error messages that git-llvm script prints out when svn or
git-svn are 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 more user-friendly error messages.
https://reviews.llvm.org/D33458
Files:
llvm/utils/git-svn/git-llvm
Index: llvm/utils/git-svn/git-llvm
===================================================================
--- llvm/utils/git-svn/git-llvm
+++ llvm/utils/git-svn/git-llvm
@@ -133,6 +133,11 @@
return shell(['svn'] + list(cmd), cwd=cwd, stdin=kwargs.get('stdin', None),
ignore_errors=kwargs.get('ignore_errors', None))
+def 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,11 @@
if __name__ == '__main__':
+ if not exists('svn'):
+ die('error: git-llvm needs svn command, but svn is not installed.')
+ if subprocess.call('git svn --help > /dev/null 2>&1', shell=True) != 0:
+ die('error: "git svn" returns an error. Make sure you have installed git-svn.')
+
argv = sys.argv[1:]
p = argparse.ArgumentParser(
prog='git llvm', formatter_class=argparse.RawDescriptionHelpFormatter,
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D33458.99978.patch
Type: text/x-patch
Size: 1070 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20170523/906cb80e/attachment.bin>
More information about the llvm-commits
mailing list