[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[GNUnet-SVN] r15289 - gauger
From: |
gnunet |
Subject: |
[GNUnet-SVN] r15289 - gauger |
Date: |
Wed, 25 May 2011 06:38:54 +0200 |
Author: bartpolot
Date: 2011-05-25 06:38:54 +0200 (Wed, 25 May 2011)
New Revision: 15289
Modified:
gauger/gauger
Log:
Added Git, Mercurial, GNU Arch and Monotone support
Modified: gauger/gauger
===================================================================
--- gauger/gauger 2011-05-25 00:31:29 UTC (rev 15288)
+++ gauger/gauger 2011-05-25 04:38:54 UTC (rev 15289)
@@ -1,5 +1,5 @@
#!/usr/bin/env python
-"""gauger-cli.py
+"""gauger
This file is part of gauger.
Copyright 2011 Bartlomiej Polot
@@ -40,9 +40,34 @@
while (stdout[0:x].isdigit()):
x += 1
if(x == 1):
- return ""
- return stdout[0:x-1]
+ return 0
+ return int(stdout[0:x-1])
+def gitversion():
+ p = subprocess.Popen("git log | grep ^commit | wc -l", shell=True,
+ stdout=subprocess.PIPE, stderr=subprocess.PIPE)
+ (stdout, stderr) = p.communicate()
+ return int(stdout)
+
+def hgversion():
+ p = subprocess.Popen("hg id -n", shell=True,
+ stdout=subprocess.PIPE, stderr=subprocess.PIPE)
+ (stdout, stderr) = p.communicate()
+ return int(stdout)
+
+def gnuarchversion():
+ p = subprocess.Popen("tla logs | wc -l", shell=True,
+ stdout=subprocess.PIPE, stderr=subprocess.PIPE)
+ (stdout, stderr) = p.communicate()
+ return int(stdout)
+
+def mtnversion():
+ p = subprocess.Popen("mtn log --brief --no-graph | wc -l", shell=True,
+ stdout=subprocess.PIPE, stderr=subprocess.PIPE)
+ (stdout, stderr) = p.communicate()
+ return int(stdout)
+
+
def process_arguments():
parser = arg_parser.ArgumentParser(description='Gauger client.')
parser.add_argument('-i', '--id',
@@ -62,7 +87,6 @@
args = parser.parse_args()
return args
-
args = process_arguments()
try:
@@ -86,18 +110,22 @@
if(args.id):
revision = args.id
-else:
+elif(os.path.exists('.svn')):
revision = svnversion()
+elif(os.path.exists('.git')):
+ revision = gitversion()
+elif(os.path.exists('.hg')):
+ revision = hgversion()
+elif(os.path.exists('{arch}')):
+ revision = gnuarchversion()
+elif(os.path.exists('_MTN')):
+ revision = mtnversion()
if (not revision):
- print >> sys.stderr, "please make sure to be in a svn respoitory and have
svn installed"
+ print >> sys.stderr, "please make sure to be in a respository supported by
gauger"
print >> sys.stderr, "or specify an identifier at runtime with the --id
option"
exit(1)
-if (int(revision) == 0):
- print >> sys.stderr, "revision number cannot be 0, please try again with a
valid number"
- exit(1)
-
if(args.unit):
args.name = args.name + "___" + args.unit
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [GNUnet-SVN] r15289 - gauger,
gnunet <=