Index: contrib/tools/post-review
===================================================================
--- contrib/tools/post-review	(revision 1243)
+++ contrib/tools/post-review	(working copy)
@@ -358,6 +358,9 @@
     information and generates compatible diffs.
     """
     def get_repository_info(self):
+        if not check_install('svn help'):
+            return None
+        
         data = execute('svn info', ignore_errors=True)
 
         m = re.search(r'^Repository Root: (.+)$', data, re.M)
@@ -417,6 +420,9 @@
     and generates compatible diffs.
     """
     def get_repository_info(self):
+        if not check_install('p4 help'):
+            return None
+        
         data = execute('p4 info', ignore_errors=True)
 
         m = re.search(r'^Server address: (.+)$', data, re.M)
@@ -654,6 +660,9 @@
     information and generates compatible diffs.
     """
     def get_repository_info(self):
+        if not check_install('hg --help'):
+            return None
+        
         data = execute('hg root', ignore_errors=True)
         if data.startswith('abort:'):
             # hg aborted => no mercurial repository here.
@@ -703,6 +712,9 @@
     remote repository, whether git, SVN or Perforce.
     """
     def get_repository_info(self):
+        if not check_install('git --help'):
+            return None
+        
         git_dir = execute('git rev-parse --git-dir', ignore_errors=True).strip()
 
         if git_dir.startswith("fatal:") or not os.path.isdir(git_dir):
@@ -841,6 +853,21 @@
     tempfiles.append(tmpfile)
     return tmpfile
 
+def check_install(command):
+    """
+    Try executing an external command and return a boolean indicating whether
+    that command is installed or not.  The 'command' argument should be something
+    that executes quickly, without hitting the network (for instance, 'svn help'
+    or 'git --version').
+    """
+    try:
+        p = subprocess.Popen(command.split(' '),
+                             stdin=subprocess.PIPE,
+                             stdout=subprocess.PIPE,
+                             stderr=subprocess.PIPE)
+        return True
+    except OSError:
+        return False
 
 def execute(command, split_lines=False, ignore_errors=False, extra_ignore_errors=()):
     """
