From 2bc7e4736f5c5516dcfae1ea340f0ea6fb82ab5f Mon Sep 17 00:00:00 2001
From: David Anderson <dvander@alliedmods.net>
Date: Sun, 25 May 2014 12:05:24 -0700
Subject: [PATCH] Switch packaging scripts to Git.

---
 tools/buildbot/helpers.pm  | 18 ++++++++++++++++++
 tools/buildbot/package.pl  |  2 +-
 tools/buildbot/symstore.pl |  2 +-
 3 files changed, 20 insertions(+), 2 deletions(-)

diff --git a/tools/buildbot/helpers.pm b/tools/buildbot/helpers.pm
index c30bbd5c..ab2e3cad 100644
--- a/tools/buildbot/helpers.pm
+++ b/tools/buildbot/helpers.pm
@@ -9,6 +9,24 @@ our $SVN = "/usr/bin/svn";
 our $SVN_USER = 'dvander';
 our $SVN_ARGS = '';
 
+sub GitRevNum
+{
+	my ($path) = (@_);
+	my ($cd, $text, $rev);
+
+	$cd = Cwd::cwd();
+        chdir($path);
+        $text = `git rev-list --count HEAD`;
+	chdir($cd);
+
+	chomp $text;
+	if ($text =~ /^(\d+)/) {
+		return $1;
+	}
+
+	return 0;
+}
+
 sub HgRevNum
 {
 	my ($path) = (@_);
diff --git a/tools/buildbot/package.pl b/tools/buildbot/package.pl
index 8f3d08f0..e3e79e81 100755
--- a/tools/buildbot/package.pl
+++ b/tools/buildbot/package.pl
@@ -34,7 +34,7 @@ my ($version);
 
 $version = Build::ProductVersion(Build::PathFormat('../../build/product.version'));
 $version =~ s/-dev//g;
-$version .= '-hg' . Build::HgRevNum('../../build');
+$version .= '-git' . Build::GitRevNum('../../build');
 
 # Append OS to package version
 if ($^O eq "darwin")
diff --git a/tools/buildbot/symstore.pl b/tools/buildbot/symstore.pl
index 264b4d30..128b1453 100755
--- a/tools/buildbot/symstore.pl
+++ b/tools/buildbot/symstore.pl
@@ -16,7 +16,7 @@ open(PDBLOG, '../OUTPUT/pdblog.txt') or die "Could not open pdblog.txt: $!\n";
 my ($version);
 $version = Build::ProductVersion(Build::PathFormat('product.version'));
 $version =~ s/-dev//g;
-$version .= '-hg' . Build::HgRevNum('.');
+$version .= '-git' . Build::GitRevNum('.');
 
 my ($build_type);
 $build_type = Build::GetBuildType(Build::PathFormat('tools/buildbot/build_type'));