make getversion script more generic
This change completely re-vamps the getversion script. The idea is to make it
more generic and adaptable for other applications.
There are now three functions for each supported SCM (Git and Subversion)
which query revision, server, and timestamp information. Some logic toward
the bottom of the script parses command-line arguments (e.g. -r, -s, and -t)
which allow the user to directly control which information is retrieved.
In summary, this patch does the following:
- Add command-line parsing (-r | --revision, -s | --server, -t | --timestamp).
- Add SVN functions for getting timestamp and upstream server info.
- Breaks Git functionality down into constituent parts.
- Adds trivial wrappers which select git/svn functions.
BUG=none
TEST=See notes below
Git repo without uncommitted changes:
$ ./util/getversion.sh -r -s -t
f053479
git.chromium.org/chromiumos/third_party/flashrom.git
Sep 06 2011 23:33:39 UTC
Git repo with uncommitted changes:
$ ./util/getversion.sh -r -s -t
0aedacf
git.chromium.org/chromiumos/third_party/flashrom.git
Sep 06 2011 16:44:20 +
Unmodified Subversion repo:
$ ./getversion.sh -r -s -t
r367
https://mosys.googlecode.com/svn/trunk
Aug 27 2011 00:05:46 UTC
Subversion repo with local modifications:
$ ./getversion.sh -r -s -t
r367
https://mosys.googlecode.com/svn/trunk
Sep 06 2011 16:49:11 +
Change-Id: I06523508a660d03eda945d06f1bd6068564aff7a
Reviewed-on: http://gerrit.chromium.org/gerrit/7306
Tested-by: David Hendricks <dhendrix@chromium.org>
Reviewed-by: David Hendricks <dhendrix@chromium.org>
1 file changed