Patchwork [4,of,8,STABLE] revsetbenchmark: add a usage message when no arguments are passed

login
register
mail settings
Submitter Pierre-Yves David
Date April 29, 2014, 12:48 a.m.
Message ID <97294fb7453ba6e50c99.1398732511@marginatus.alto.octopoid.net>
Download mbox | patch
Permalink /patch/4448/
State Superseded
Commit f0f8100968429a31948eb74f53b8dd22b7c7e820
Headers show

Comments

Pierre-Yves David - April 29, 2014, 12:48 a.m.
# HG changeset patch
# User Pierre-Yves David <pierre-yves.david@fb.com>
# Date 1398458131 25200
#      Fri Apr 25 13:35:31 2014 -0700
# Branch stable
# Node ID 97294fb7453ba6e50c9979fd5daed1291e76df91
# Parent  94efb32efe7a266c16f0a89b190e10a1931dacf5
revsetbenchmark: add a usage message when no arguments are passed

This increase the odd someone who didn't wrote will it find out how to use this
script.

Patch

diff --git a/contrib/revsetbenchmarks.py b/contrib/revsetbenchmarks.py
--- a/contrib/revsetbenchmarks.py
+++ b/contrib/revsetbenchmarks.py
@@ -64,10 +64,14 @@  def getrevs(spec):
         sys.exit(exc.returncode)
     return [r for r in out.split() if r]
 
 
 
+if len(sys.argv) < 2:
+    print >> sys.stderr, 'usage: %s <revs> [file]' % sys.argv[0]
+    sys.exit(255)
+
 target_rev = sys.argv[1]
 
 revsetsfile = sys.stdin
 if len(sys.argv) > 2:
     revsetsfile = open(sys.argv[2])