changeset 33:f90bd2d1a12b

Converted revision reporting from SVN to hg.
author Oleg Oshmyan <chortos@inbox.lv>
date Mon, 29 Nov 2010 22:15:01 +0000
parents 3000bb94addb
children 8fec38b0dd6e
files 2.00/test-svn.py publish.py publish.sh test-svn.py
diffstat 4 files changed, 13 insertions(+), 16 deletions(-) [+]
line wrap: on
line diff
--- a/2.00/test-svn.py	Mon Nov 29 01:24:22 2010 +0000
+++ b/2.00/test-svn.py	Mon Nov 29 22:15:01 2010 +0000
@@ -10,8 +10,7 @@
 
 from compat import *
 
-# $Rev$
-version = '2.00.0 (SVN r$$REV$$)'
+version = '2.00.0 ($$REV$$)'
 parser = optparse.OptionParser(version='test.py '+version, epilog='Python 2.5 or newer is required.')
 parser.add_option('-1', dest='legacy', action='store_true', default=False, help='handle configuration files in a way more compatible with test.py 1.x')
 parser.add_option('-u', '--update', dest='update', action='store_true', default=False, help='update the installed test.py to the latest publicly available version')
--- a/publish.py	Mon Nov 29 01:24:22 2010 +0000
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,12 +0,0 @@
-#! /usr/bin/python
-# Copyright (c) 2009-2010 Chortos-2 <chortos@inbox.lv>
-
-with open('test-svn.py') as t:
-	f = t.read()
-i = f.find('# $Rev: ')
-j = f.find('\n', i)
-rev = f[i+8:j-2]
-f = f[0:i] + f[j+1:]
-f = f.replace('$$REV$$', rev)
-with open('test.py', 'wb') as t:
-	t.write(f)
\ No newline at end of file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/publish.sh	Mon Nov 29 22:15:01 2010 +0000
@@ -0,0 +1,11 @@
+#! /bin/sh
+
+VERSION=`hg summary | grep '^parent' | sed -En 's/^parent: [0-9]*:([0-9a-f]+) .*$/\1/p'`
+if [ -z "$VERSION" ]
+then
+	echo The current Mercurial changeset could not be determined. >&2
+	exit 1
+fi
+
+sed 's/$$REV$\$/hg '"$VERSION/" test-svn.py >test.py
+chmod +x test.py
\ No newline at end of file
--- a/test-svn.py	Mon Nov 29 01:24:22 2010 +0000
+++ b/test-svn.py	Mon Nov 29 22:15:01 2010 +0000
@@ -3,8 +3,7 @@
 
 import os, sys, shutil, time, subprocess, filecmp, optparse, signal, tempfile, tarfile, zipfile
 
-# $Rev$
-version = '1.21.0 (SVN r$$REV$$)'
+version = '1.21.0 ($$REV$$)'
 parser = optparse.OptionParser(version='test.py '+version, usage='usage: %prog [options] [problem names] [[path' + os.path.sep + 'to' + os.path.sep + ']solution-app] [test case numbers]\n\nTest case numbers can be specified in plain text or as a Python expression\nif there is only one positional argument.\n\nOnly problem names listed in testconf.py are recognized.')
 parser.add_option('-u', '--update', dest='update', action='store_true', default=False, help='check for an updated version of test.py')
 parser.add_option('-e', '--exclude', dest='exclude', action='append', help='test case number(s) to exclude, as a Python expression; multiple -e options can be supplied')