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

login
register
mail settings
Submitter Pierre-Yves David
Date May 2, 2014, 1:45 a.m.
Message ID <3bb87edcae46d4362641.1398995126@marginatus.alto.octopoid.net>
Download mbox | patch
Permalink /patch/4478/
State Accepted
Commit f0f8100968429a31948eb74f53b8dd22b7c7e820
Headers show

Comments

Pierre-Yves David - May 2, 2014, 1:45 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
# Node ID 3bb87edcae46d4362641d7a57c48a73e3ee076d4
# Parent  1be2c08892d5b7bdfe741556b2586a8d33d8b16d
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])