Redid versioning for Mercurial.
authorDavid Anderson <dvander@alliedmods.net>
Tue Nov 18 02:28:38 2008 -0600 (2008-11-18)
changeset 5580ed2a4a6e31d
parent 556 b37a142ba881
child 559 cb183b37e0ff
Redid versioning for Mercurial.
core-legacy/concommands.cpp
core-legacy/sourcemm.h
core-legacy/svn_version.h
core-legacy/svn_version.tpl
core-legacy/version.h
core-legacy/version.tpl
core-legacy/vsp_bridge.cpp
core-legacy/vsp_listener.cpp
core/metamod.cpp
core/metamod.h
core/metamod_console.cpp
core/provider/vsp_listener.cpp
core/svn_version.h
core/svn_version.tpl
core/version.h
core/version.tpl
core/vsp_bridge.cpp
modules.versions
support/buildbot/bootstrap.pl
support/buildbot/helpers.pm
support/versionchanger.pl
     1.1 --- a/core-legacy/concommands.cpp	Sun Nov 16 22:33:16 2008 -0600
     1.2 +++ b/core-legacy/concommands.cpp	Tue Nov 18 02:28:38 2008 -0600
     1.3 @@ -105,7 +105,7 @@
     1.4  	}
     1.5  }
     1.6  
     1.7 -ConVar metamod_version("metamod_version", SOURCEMM_VERSION, FCVAR_SPONLY | FCVAR_NOTIFY, "Metamod:Source Version");
     1.8 +ConVar metamod_version("metamod_version", SVN_FULL_VERSION, FCVAR_SPONLY | FCVAR_NOTIFY, "Metamod:Source Version");
     1.9  #ifdef OS_WIN32
    1.10  ConVar mm_pluginsfile("mm_pluginsfile", "addons\\metamod\\metaplugins.ini", FCVAR_SPONLY, "Metamod:Source Plugins File");
    1.11  ConVar mm_basedir("mm_basedir", "addons\\metamod", FCVAR_SPONLY, "Metamod:Source base folder");
    1.12 @@ -140,7 +140,8 @@
    1.13  			
    1.14  			return;
    1.15  		} else if (strcmp(command, "version") == 0) {
    1.16 -			CONMSG("Metamod:Source version %s\n", SOURCEMM_VERSION);
    1.17 +			CONMSG("Metamod:Source version %s\n", SVN_FULL_VERSION);
    1.18 +			CONMSG("Build ID: %s\n", MMS_BUILD_UNIQUEID);
    1.19  			if (g_bIsBridgedAsVsp)
    1.20  			{
    1.21  				CONMSG("Loaded As: Valve Server Plugin\n");
    1.22 @@ -658,7 +659,7 @@
    1.23  
    1.24  				RETURN_META(MRES_SUPERCEDE);
    1.25  			} else if(strcmp(subcmd, "version") == 0) {
    1.26 -				CLIENT_CONMSG(client, "Metamod:Source version %s\n", SOURCEMM_VERSION);
    1.27 +				CLIENT_CONMSG(client, "Metamod:Source version %s\n", SVN_FULL_VERSION);
    1.28  				CLIENT_CONMSG(client, "Compiled on: %s\n", SOURCEMM_DATE);
    1.29  				CLIENT_CONMSG(client, "Plugin interface version: %d:%d\n", PLAPI_VERSION, PLAPI_MIN_VERSION);
    1.30  				CLIENT_CONMSG(client, "SourceHook version: %d:%d\n", g_SourceHook.GetIfaceVersion(), g_SourceHook.GetImplVersion());
     2.1 --- a/core-legacy/sourcemm.h	Sun Nov 16 22:33:16 2008 -0600
     2.2 +++ b/core-legacy/sourcemm.h	Tue Nov 18 02:28:38 2008 -0600
     2.3 @@ -25,7 +25,7 @@
     2.4  #include "CPlugin.h"
     2.5  #include "oslink.h"
     2.6  #include "util.h"
     2.7 -#include "svn_version.h"
     2.8 +#include "version.h"
     2.9  
    2.10  /**
    2.11   * Versioning
     3.1 --- a/core-legacy/svn_version.h	Sun Nov 16 22:33:16 2008 -0600
     3.2 +++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
     3.3 @@ -1,13 +0,0 @@
     3.4 -/** This file is autogenerated by build scripts */
     3.5 -
     3.6 -#ifndef _INCLUDE_SVN_VERSION_H_
     3.7 -#define _INCLUDE_SVN_VERSION_H_
     3.8 -
     3.9 -#define SVN_PRODUCT_VERSION		"1.7.0"
    3.10 -
    3.11 -#define SVN_REVISION			705
    3.12 -#define SVN_REVISION_STRING		"705"
    3.13 -#define SVN_FILE_VERSION		1,7,0,705
    3.14 -#define SVN_FILE_VERSION_STRING	"1.7.0.705"
    3.15 -
    3.16 -#endif //_INCLUDE_SVN_VERSION_H_
     4.1 --- a/core-legacy/svn_version.tpl	Sun Nov 16 22:33:16 2008 -0600
     4.2 +++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
     4.3 @@ -1,13 +0,0 @@
     4.4 -/** This file is autogenerated by build scripts */
     4.5 -
     4.6 -#ifndef _INCLUDE_SVN_VERSION_H_
     4.7 -#define _INCLUDE_SVN_VERSION_H_
     4.8 -
     4.9 -#define SVN_PRODUCT_VERSION		"$PMAJOR$.$PMINOR$.$PREVISION$"
    4.10 -
    4.11 -#define SVN_REVISION			$GLOBAL_BUILD$
    4.12 -#define SVN_REVISION_STRING		"$GLOBAL_BUILD$"
    4.13 -#define SVN_FILE_VERSION		$PMAJOR$,$PMINOR$,$PREVISION$,$GLOBAL_BUILD$
    4.14 -#define SVN_FILE_VERSION_STRING	"$PMAJOR$.$PMINOR$.$PREVISION$.$GLOBAL_BUILD$"
    4.15 -
    4.16 -#endif //_INCLUDE_SVN_VERSION_H_
     5.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     5.2 +++ b/core-legacy/version.h	Tue Nov 18 02:28:38 2008 -0600
     5.3 @@ -0,0 +1,12 @@
     5.4 +/** This file is autogenerated by build scripts */
     5.5 +
     5.6 +#ifndef _INCLUDE_SVN_VERSION_H_
     5.7 +#define _INCLUDE_SVN_VERSION_H_
     5.8 +
     5.9 +#define MMS_BUILD_STRING     "-dev"
    5.10 +#define MMS_BUILD_UNIQUEID   "556:b37a142ba881" MMS_BUILD_STRING
    5.11 +#define SVN_FULL_VERSION    "1.7.0" MMS_BUILD_STRING
    5.12 +#define SVN_FILE_VERSION    1,7,0,0
    5.13 +
    5.14 +#endif //_INCLUDE_SVN_VERSION_H_
    5.15 +
     6.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     6.2 +++ b/core-legacy/version.tpl	Tue Nov 18 02:28:38 2008 -0600
     6.3 @@ -0,0 +1,12 @@
     6.4 +/** This file is autogenerated by build scripts */
     6.5 +
     6.6 +#ifndef _INCLUDE_SVN_VERSION_H_
     6.7 +#define _INCLUDE_SVN_VERSION_H_
     6.8 +
     6.9 +#define MMS_BUILD_STRING     "$BUILD_STRING$"
    6.10 +#define MMS_BUILD_UNIQUEID   "$BUILD_ID$" MMS_BUILD_STRING
    6.11 +#define SVN_FULL_VERSION    "$PMAJOR$.$PMINOR$.$PREVISION$" MMS_BUILD_STRING
    6.12 +#define SVN_FILE_VERSION    $PMAJOR$,$PMINOR$,$PREVISION$,0
    6.13 +
    6.14 +#endif //_INCLUDE_SVN_VERSION_H_
    6.15 +
     7.1 --- a/core-legacy/vsp_bridge.cpp	Sun Nov 16 22:33:16 2008 -0600
     7.2 +++ b/core-legacy/vsp_bridge.cpp	Tue Nov 18 02:28:38 2008 -0600
     7.3 @@ -67,7 +67,7 @@
     7.4  
     7.5  	virtual const char *GetDescription()
     7.6  	{
     7.7 -		return "Metamod:Source " SOURCEMM_VERSION;
     7.8 +		return "Metamod:Source " SVN_FULL_VERSION;
     7.9  	}
    7.10  };
    7.11  
     8.1 --- a/core-legacy/vsp_listener.cpp	Sun Nov 16 22:33:16 2008 -0600
     8.2 +++ b/core-legacy/vsp_listener.cpp	Tue Nov 18 02:28:38 2008 -0600
     8.3 @@ -58,7 +58,7 @@
     8.4  
     8.5  const char *VSPListener::GetPluginDescription()
     8.6  {
     8.7 -	return "Metamod:Source Interface v" SOURCEMM_VERSION;
     8.8 +	return "Metamod:Source Interface " SVN_FULL_VERSION;
     8.9  }
    8.10  
    8.11  bool VSPListener::IsLoaded()
     9.1 --- a/core/metamod.cpp	Sun Nov 16 22:33:16 2008 -0600
     9.2 +++ b/core/metamod.cpp	Tue Nov 18 02:28:38 2008 -0600
     9.3 @@ -763,11 +763,11 @@
     9.4  	UTIL_Format(buffer,
     9.5  		sizeof(buffer),
     9.6  		"%s%s",
     9.7 -		SOURCEMM_VERSION,
     9.8 +		SVN_FULL_VERSION,
     9.9  		is_vsp_load ? "V" : "");
    9.10  
    9.11  	metamod_version = provider->CreateConVar("metamod_version", 
    9.12 -		SOURCEMM_VERSION, 
    9.13 +		SVN_FULL_VERSION, 
    9.14  		"Metamod:Source Version",
    9.15  		ConVarFlag_Notify|ConVarFlag_SpOnly);
    9.16  
    10.1 --- a/core/metamod.h	Sun Nov 16 22:33:16 2008 -0600
    10.2 +++ b/core/metamod.h	Tue Nov 18 02:28:38 2008 -0600
    10.3 @@ -41,7 +41,7 @@
    10.4  #include <sourcehook/sourcehook.h>
    10.5  #include <ISmmPlugin.h>
    10.6  #include "metamod_provider.h"
    10.7 -#include "svn_version.h"
    10.8 +#include "version.h"
    10.9  
   10.10  using namespace SourceMM;
   10.11  
    11.1 --- a/core/metamod_console.cpp	Sun Nov 16 22:33:16 2008 -0600
    11.2 +++ b/core/metamod_console.cpp	Tue Nov 18 02:28:38 2008 -0600
    11.3 @@ -70,7 +70,8 @@
    11.4  		}
    11.5  		else if (strcmp(command, "version") == 0)
    11.6  		{
    11.7 -			CONMSG("Metamod:Source version %s\n", SOURCEMM_VERSION);
    11.8 +			CONMSG("Metamod:Source version %s\n", SVN_FULL_VERSION);
    11.9 +			CONMSG("Build ID: %s\n", MMS_BUILD_UNIQUEID);
   11.10  
   11.11  			if (g_Metamod.IsLoadedAsGameDLL())
   11.12  			{
   11.13 @@ -687,7 +688,7 @@
   11.14  			}
   11.15  			else if(strcmp(subcmd, "version") == 0)
   11.16  			{
   11.17 -				CLIENT_CONMSG(client, "Metamod:Source version %s\n", SOURCEMM_VERSION);
   11.18 +				CLIENT_CONMSG(client, "Metamod:Source version %s\n", SVN_FULL_VERSION);
   11.19  				CLIENT_CONMSG(client, "Compiled on: %s\n", SOURCEMM_DATE);
   11.20  				CLIENT_CONMSG(client, "Plugin interface version: %d:%d\n", METAMOD_PLAPI_VERSION, PLAPI_MIN_VERSION);
   11.21  				CLIENT_CONMSG(client, "SourceHook version: %d:%d\n", g_SHPtr->GetIfaceVersion(), g_SHPtr->GetImplVersion());
    12.1 --- a/core/provider/vsp_listener.cpp	Sun Nov 16 22:33:16 2008 -0600
    12.2 +++ b/core/provider/vsp_listener.cpp	Tue Nov 18 02:28:38 2008 -0600
    12.3 @@ -33,7 +33,7 @@
    12.4  #include <eiface.h>
    12.5  #include "iplayerinfo.h"
    12.6  #include "vsp_listener.h"
    12.7 -#include "svn_version.h"
    12.8 +#include "version.h"
    12.9  #include "provider_ep2.h"
   12.10  
   12.11  using namespace SourceMM;
   12.12 @@ -80,7 +80,7 @@
   12.13  
   12.14  const char *VSPListener::GetPluginDescription()
   12.15  {
   12.16 -	return "Metamod:Source Interface v" SVN_FILE_VERSION_STRING;
   12.17 +	return "Metamod:Source Interface " SVN_FULL_VERSION;
   12.18  }
   12.19  
   12.20  bool VSPListener::IsLoaded()
    13.1 --- a/core/svn_version.h	Sun Nov 16 22:33:16 2008 -0600
    13.2 +++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
    13.3 @@ -1,13 +0,0 @@
    13.4 -/** This file is autogenerated by build scripts */
    13.5 -
    13.6 -#ifndef _INCLUDE_SVN_VERSION_H_
    13.7 -#define _INCLUDE_SVN_VERSION_H_
    13.8 -
    13.9 -#define SVN_PRODUCT_VERSION		"1.7.0"
   13.10 -
   13.11 -#define SVN_REVISION			703
   13.12 -#define SVN_REVISION_STRING		"703"
   13.13 -#define SVN_FILE_VERSION		1,7,0,703
   13.14 -#define SVN_FILE_VERSION_STRING	"1.7.0.703"
   13.15 -
   13.16 -#endif //_INCLUDE_SVN_VERSION_H_
    14.1 --- a/core/svn_version.tpl	Sun Nov 16 22:33:16 2008 -0600
    14.2 +++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
    14.3 @@ -1,13 +0,0 @@
    14.4 -/** This file is autogenerated by build scripts */
    14.5 -
    14.6 -#ifndef _INCLUDE_SVN_VERSION_H_
    14.7 -#define _INCLUDE_SVN_VERSION_H_
    14.8 -
    14.9 -#define SVN_PRODUCT_VERSION		"$PMAJOR$.$PMINOR$.$PREVISION$"
   14.10 -
   14.11 -#define SVN_REVISION			$GLOBAL_BUILD$
   14.12 -#define SVN_REVISION_STRING		"$GLOBAL_BUILD$"
   14.13 -#define SVN_FILE_VERSION		$PMAJOR$,$PMINOR$,$PREVISION$,$GLOBAL_BUILD$
   14.14 -#define SVN_FILE_VERSION_STRING	"$PMAJOR$.$PMINOR$.$PREVISION$.$GLOBAL_BUILD$"
   14.15 -
   14.16 -#endif //_INCLUDE_SVN_VERSION_H_
    15.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
    15.2 +++ b/core/version.h	Tue Nov 18 02:28:38 2008 -0600
    15.3 @@ -0,0 +1,12 @@
    15.4 +/** This file is autogenerated by build scripts */
    15.5 +
    15.6 +#ifndef _INCLUDE_SVN_VERSION_H_
    15.7 +#define _INCLUDE_SVN_VERSION_H_
    15.8 +
    15.9 +#define MMS_BUILD_STRING     "-dev"
   15.10 +#define MMS_BUILD_UNIQUEID   "556:b37a142ba881" MMS_BUILD_STRING
   15.11 +#define SVN_FULL_VERSION    "1.7.0" MMS_BUILD_STRING
   15.12 +#define SVN_FILE_VERSION    1,7,0,0
   15.13 +
   15.14 +#endif //_INCLUDE_SVN_VERSION_H_
   15.15 +
    16.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
    16.2 +++ b/core/version.tpl	Tue Nov 18 02:28:38 2008 -0600
    16.3 @@ -0,0 +1,12 @@
    16.4 +/** This file is autogenerated by build scripts */
    16.5 +
    16.6 +#ifndef _INCLUDE_SVN_VERSION_H_
    16.7 +#define _INCLUDE_SVN_VERSION_H_
    16.8 +
    16.9 +#define MMS_BUILD_STRING     "$BUILD_STRING$"
   16.10 +#define MMS_BUILD_UNIQUEID   "$BUILD_ID$" MMS_BUILD_STRING
   16.11 +#define SVN_FULL_VERSION    "$PMAJOR$.$PMINOR$.$PREVISION$" MMS_BUILD_STRING
   16.12 +#define SVN_FILE_VERSION    $PMAJOR$,$PMINOR$,$PREVISION$,0
   16.13 +
   16.14 +#endif //_INCLUDE_SVN_VERSION_H_
   16.15 +
    17.1 --- a/core/vsp_bridge.cpp	Sun Nov 16 22:33:16 2008 -0600
    17.2 +++ b/core/vsp_bridge.cpp	Tue Nov 18 02:28:38 2008 -0600
    17.3 @@ -96,7 +96,7 @@
    17.4  
    17.5  	virtual const char *GetDescription()
    17.6  	{
    17.7 -		return "Metamod:Source " SOURCEMM_VERSION;
    17.8 +		return "Metamod:Source " SVN_FULL_VERSION;
    17.9  	}
   17.10  };
   17.11  
    18.1 --- a/modules.versions	Sun Nov 16 22:33:16 2008 -0600
    18.2 +++ b/modules.versions	Tue Nov 18 02:28:38 2008 -0600
    18.3 @@ -1,9 +1,15 @@
    18.4 -[PRODUCT]
    18.5 -major = 1
    18.6 -minor = 7
    18.7 -revision = 0
    18.8 -
    18.9 -[sourcemm]
   18.10 -folder = sourcemm
   18.11 -in = svn_version.tpl
   18.12 -out = svn_version.h
   18.13 +[PRODUCT]
   18.14 +major = 1
   18.15 +minor = 7
   18.16 +revision = 0
   18.17 +
   18.18 +[core]
   18.19 +folder = core
   18.20 +in = version.tpl
   18.21 +out = version.h
   18.22 +
   18.23 +[core-legacy]
   18.24 +folder = core-legacy
   18.25 +in = version.tpl
   18.26 +out = version.h
   18.27 +
    19.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
    19.2 +++ b/support/buildbot/bootstrap.pl	Tue Nov 18 02:28:38 2008 -0600
    19.3 @@ -0,0 +1,24 @@
    19.4 +#!/usr/bin/perl
    19.5 +
    19.6 +use strict;
    19.7 +use Cwd;
    19.8 +use File::Basename;
    19.9 +
   19.10 +my ($myself, $path) = fileparse($0);
   19.11 +chdir($path);
   19.12 +
   19.13 +require 'helpers.pm';
   19.14 +
   19.15 +#Go to main source dir
   19.16 +chdir(Build::PathFormat('../..'));
   19.17 +
   19.18 +#Do the annoying revision bumping.
   19.19 +#Linux needs some help here.
   19.20 +if ($^O eq "linux")
   19.21 +{
   19.22 +	Build::Command("flip -u modules.versions");
   19.23 +	Build::Command("flip -u support/versionchanger.pl");
   19.24 +	Build::Command("chmod +x support/versionchanger.pl");
   19.25 +}
   19.26 +Build::Command(Build::PathFormat('support/versionchanger.pl') . '--buildstring="-dev"');
   19.27 +
    20.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
    20.2 +++ b/support/buildbot/helpers.pm	Tue Nov 18 02:28:38 2008 -0600
    20.3 @@ -0,0 +1,145 @@
    20.4 +#!/usr/bin/perl
    20.5 +
    20.6 +use strict;
    20.7 +use Cwd;
    20.8 +
    20.9 +package Build;
   20.10 +
   20.11 +our $SVN = "/usr/bin/svn";
   20.12 +our $SVN_USER = 'dvander';
   20.13 +our $SVN_ARGS = '';
   20.14 +
   20.15 +sub HgRevNum
   20.16 +{
   20.17 +	my ($path) = (@_);
   20.18 +	my ($cd, $text, $rev);
   20.19 +
   20.20 +	$cd = Cwd::cwd();
   20.21 +	chdir($path);
   20.22 +	$text = `hg identify -n`;
   20.23 +	chdir($cd);
   20.24 +
   20.25 +	chomp $text;
   20.26 +	if ($text =~ /^(\d+)/)
   20.27 +	{
   20.28 +		return $1;
   20.29 +	}
   20.30 +
   20.31 +	return 0;
   20.32 +}
   20.33 +
   20.34 +sub SvnRevNum
   20.35 +{
   20.36 +	my ($str)=(@_);
   20.37 +			
   20.38 +	my $data = Command('svnversion -c ' . $str);
   20.39 +	if ($data =~ /(\d+):(\d+)/)
   20.40 +	{
   20.41 +		return $2;
   20.42 +	} elsif ($data =~ /(\d+)/) {
   20.43 +		return $1;
   20.44 +	} else {
   20.45 +		return 0;
   20.46 +	}
   20.47 +}
   20.48 +
   20.49 +sub ProductVersion
   20.50 +{
   20.51 +	my ($file) = (@_);
   20.52 +	my ($version);
   20.53 +	open(FILE, $file) or die "Could not open $file: $!\n";
   20.54 +	$version = <FILE>;
   20.55 +	close(FILE);
   20.56 +	chomp $version;
   20.57 +	return $version;
   20.58 +}
   20.59 +
   20.60 +sub Delete
   20.61 +{
   20.62 +	my ($str)=(@_);
   20.63 +	if ($^O =~ /MSWin/)
   20.64 +	{
   20.65 +		Command("del /S /F /Q \"$str\"");
   20.66 +		Command("rmdir /S /Q \"$str\"");
   20.67 +	} else {
   20.68 +		Command("rm -rf $str");
   20.69 +	}
   20.70 +	return !(-e $str);
   20.71 +}
   20.72 +
   20.73 +sub Copy
   20.74 +{
   20.75 +	my ($src,$dest)=(@_);
   20.76 +	if ($^O =~ /MSWin/)
   20.77 +	{
   20.78 +		Command("copy \"$src\" \"$dest\" /y");
   20.79 +	} else {
   20.80 +		Command("cp \"$src\" \"$dest\"");
   20.81 +	}
   20.82 +	return (-e $dest);
   20.83 +}
   20.84 +
   20.85 +sub Move
   20.86 +{
   20.87 +	my ($src,$dest)=(@_);
   20.88 +	if ($^O =~ /MSWin/)
   20.89 +	{
   20.90 +		Command("move \"$src\" \"$dest\"");
   20.91 +	} else {
   20.92 +		Command("mv \"$src\" \"$dest\"");
   20.93 +	}
   20.94 +	return (-e $dest);
   20.95 +}
   20.96 +
   20.97 +sub Command
   20.98 +{
   20.99 +	my($cmd)=(@_);
  20.100 +	print "$cmd\n";
  20.101 +	return `$cmd`;
  20.102 +}
  20.103 +
  20.104 +sub PathFormat
  20.105 +{
  20.106 +	my ($str)=(@_);
  20.107 +	if ($^O =~ /MSWin/)
  20.108 +	{
  20.109 +		$str =~ s#/#\\#g;
  20.110 +	} else {
  20.111 +		$str =~ s#\\#/#g;
  20.112 +	}
  20.113 +	return $str;
  20.114 +}
  20.115 +
  20.116 +sub SVN_Remove
  20.117 +{
  20.118 +	my ($file)=(@_);
  20.119 +	my ($path, $name);
  20.120 +	if ($^O =~ /MSWin/)
  20.121 +	{
  20.122 +		($path, $name) = ($file =~ /(.+)\/([^\/]+)$/);
  20.123 +	} else {
  20.124 +		($path, $name) = ($file =~ /(.+)\\([^\\]+)$/);
  20.125 +	}
  20.126 +	my $dir = Cwd::cwd();
  20.127 +	chdir($path);
  20.128 +	Command($SVN . ' ' . $SVN_ARGS . ' delete ' . $name);
  20.129 +	chdir($dir);
  20.130 +}
  20.131 +
  20.132 +sub SVN_Add
  20.133 +{
  20.134 +	my ($file)=(@_);
  20.135 +	my ($path, $name);
  20.136 +	if ($^O =~ /MSWin/)
  20.137 +	{
  20.138 +		($path, $name) = ($file =~ /(.+)\/([^\/]+)$/);
  20.139 +	} else {
  20.140 +		($path, $name) = ($file =~ /(.+)\\([^\\]+)$/);
  20.141 +	}
  20.142 +	my $dir = Cwd::cwd();
  20.143 +	chdir($path);
  20.144 +	Command($SVN . ' ' . $SVN_ARGS . ' add ' . $name);
  20.145 +	chdir($dir);
  20.146 +}
  20.147 +
  20.148 +return 1;
    21.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
    21.2 +++ b/support/versionchanger.pl	Tue Nov 18 02:28:38 2008 -0600
    21.3 @@ -0,0 +1,140 @@
    21.4 +#!/usr/bin/perl
    21.5 +
    21.6 +our %arguments =
    21.7 +(
    21.8 +	'config' => 'modules.versions',
    21.9 +	'major' => '1',
   21.10 +	'minor' => '0',
   21.11 +	'revision' => '0',
   21.12 +	'build' => undef,
   21.13 +	'path' => '',
   21.14 +	'buildstring' => '',
   21.15 +);
   21.16 +
   21.17 +my $arg;
   21.18 +foreach $arg (@ARGV)
   21.19 +{
   21.20 +	$arg =~ s/--//;
   21.21 +	@arg = split(/=/, $arg);
   21.22 +	$arguments{$arg[0]} = $arg[1];
   21.23 +}
   21.24 +
   21.25 +#Set up path info
   21.26 +if ($arguments{'path'} ne "")
   21.27 +{
   21.28 +	if (!(-d $arguments{'path'}))
   21.29 +	{
   21.30 +		die "Unable to find path: " . $arguments{'path'} ."\n";
   21.31 +	}
   21.32 +	chdir($arguments{'path'});
   21.33 +}
   21.34 +
   21.35 +if (!open(CONFIG, $arguments{'config'}))
   21.36 +{
   21.37 +	die "Unable to open config file for reading: " . $arguments{'config'} . "\n";
   21.38 +}
   21.39 +
   21.40 +our %modules;
   21.41 +my $cur_module = undef;
   21.42 +my $line;
   21.43 +while (<CONFIG>)
   21.44 +{
   21.45 +	chomp;
   21.46 +	$line = $_;
   21.47 +	if ($line =~ /^\[([^\]]+)\]$/)
   21.48 +	{
   21.49 +		$cur_module = $1;
   21.50 +		next;
   21.51 +	}
   21.52 +	if (!$cur_module)
   21.53 +	{
   21.54 +		next;
   21.55 +	}
   21.56 +	if ($line =~ /^([^=]+) = (.+)$/)
   21.57 +	{
   21.58 +		$modules{$cur_module}{$1} = $2;
   21.59 +	}
   21.60 +}
   21.61 +
   21.62 +close(CONFIG);
   21.63 +
   21.64 +#Copy global configuration options...
   21.65 +if (exists($modules{'PRODUCT'}))
   21.66 +{
   21.67 +	if (exists($modules{'PRODUCT'}{'major'}))
   21.68 +	{
   21.69 +		$arguments{'major'} = $modules{'PRODUCT'}{'major'};
   21.70 +	}
   21.71 +	if (exists($modules{'PRODUCT'}{'minor'}))
   21.72 +	{
   21.73 +		$arguments{'minor'} = $modules{'PRODUCT'}{'minor'};
   21.74 +	}
   21.75 +	if (exists($modules{'PRODUCT'}{'revision'}))
   21.76 +	{
   21.77 +		$arguments{'revision'} = $modules{'PRODUCT'}{'revision'};
   21.78 +	}
   21.79 +}
   21.80 +
   21.81 +#Get the global SVN revision if we have none
   21.82 +my $rev;
   21.83 +if ($arguments{'build'} == undef)
   21.84 +{
   21.85 +	my ($text);
   21.86 +	$text = `hg identif -n -i`;
   21.87 +	chomp $text;
   21.88 +	$text =~ s/\+//g;
   21.89 +	my ($id,$num) = split(/ /, $text);
   21.90 +	$rev = "$num:$id";
   21.91 +} 
   21.92 +else 
   21.93 +{
   21.94 +	$rev = int($arguments{'build'});
   21.95 +}
   21.96 +
   21.97 +my $major = $arguments{'major'};
   21.98 +my $minor = $arguments{'minor'};
   21.99 +my $revision = $arguments{'revision'};
  21.100 +my $buildstr = $arguments{'buildstring'};
  21.101 +
  21.102 +#Go through everything now
  21.103 +my $mod_i;
  21.104 +while ( ($cur_module, $mod_i) = each(%modules) )
  21.105 +{
  21.106 +	#Skip the magic one
  21.107 +	if ($cur_module eq "PRODUCT")
  21.108 +	{
  21.109 +		next;
  21.110 +	}
  21.111 +	#Prepare path
  21.112 +	my %mod = %{$mod_i};
  21.113 +	my $infile = $mod{'in'};
  21.114 +	my $outfile = $mod{'out'};
  21.115 +	if ($mod{'folder'})
  21.116 +	{
  21.117 +		if (!(-d $mod{'folder'}))
  21.118 +		{
  21.119 +			die "Folder " . $mod{'folder'} . " not found.\n";
  21.120 +		}
  21.121 +		$infile = $mod{'folder'} . '/' . $infile;
  21.122 +		$outfile = $mod{'folder'} . '/' . $outfile;
  21.123 +	}
  21.124 +	if (!(-f $infile))
  21.125 +	{
  21.126 +		die "File $infile is not a file.\n";
  21.127 +	}
  21.128 +	#Start rewriting
  21.129 +	open(INFILE, $infile) or die "Could not open file for reading: $infile\n";
  21.130 +	open(OUTFILE, '>'.$outfile) or die "Could not open file for writing: $outfile\n";
  21.131 +	while (<INFILE>)
  21.132 +	{
  21.133 +		s/\$PMAJOR\$/$major/g;
  21.134 +		s/\$PMINOR\$/$minor/g;
  21.135 +		s/\$PREVISION\$/$revision/g;
  21.136 +		s/\$BUILD_ID\$/$rev/g;
  21.137 +		s/\$BUILD_STRING\$/$buildstr/g;
  21.138 +		print OUTFILE $_;
  21.139 +	}
  21.140 +	close(OUTFILE);
  21.141 +	close(INFILE);
  21.142 +}
  21.143 +