Subversion comes with a command to do just that: SVNVERSION.EXE .
Usage: svnversion [OPTIONS] [WC_PATH [TRAIL_URL]]
Generate a compact version number for the WC_PATH copy work path. TRAIL_URL is the end of the URL used to determine if WC_PATH itself is enabled (detecting switches inside WC_PATH is not supposed to be TRAIL_URL). The version number is written to standard output. For example:
$ svnversion . /repos/svn/trunk 4168
The version number will be one number if the working copy is a single revision, has not been changed, and has not been switched from a URL that matches the TRAIL_URL argument. If the copy is unusual, the version number will be more complex:
4123: 4168 mixed audit working copy
4168M modified working copy
4123S changed working copy
4123: 4168MS mixed revision, modified, removable working copy
If it is called in a directory that is not a working copy, the exported directory says that the program will output 'exported'.
If called without arguments, WC_PATH will be the current directory.
Valid parameters: -n [--no-newline]: do not output the final new line -c [--committed]: last change, not current versions -h [--help]: display this help --version: show information about version
William leara
source share