If we're using git, try pulling the SVN revision out of the commit body.
authorGerald Combs <gerald@wireshark.org>
Sun, 10 Feb 2013 22:20:31 +0000 (22:20 -0000)
committerGerald Combs <gerald@wireshark.org>
Sun, 10 Feb 2013 22:20:31 +0000 (22:20 -0000)
svn path=/trunk/; revision=47619

make-version.pl

index 5de69de5f4101751dc71cedca33e2856820c68be..660583b2b653f69739a0d025b0d0fbac7501e6dd 100755 (executable)
@@ -93,7 +93,7 @@ my %version_pref = (
        #"pkg_format" => "",
        );
 my $srcdir = ".";
-my $svn_info_cmd = "";
+my $info_cmd = "";
 
 # Ensure we run with correct locale
 $ENV{LANG} = "C";
@@ -119,17 +119,17 @@ sub read_svn_info {
 
        if (-d "$srcdir/.svn") {
                $info_source = "Command line (svn info)";
-               $svn_info_cmd = "svn info $srcdir";
+               $info_cmd = "svn info $srcdir";
        } elsif (-d "$srcdir/.git/svn") {
                $info_source = "Command line (git-svn)";
-               $svn_info_cmd = "(cd $srcdir; git svn info)";
+               $info_cmd = "(cd $srcdir; git svn info)";
        }
 
        if ($version_pref{"svn_client"}) {
                eval {
                        use warnings "all";
                        no warnings "all";
-                       $line = qx{$svn_info_cmd};
+                       $line = qx{$info_cmd};
                        if (defined($line)) {
                                if ($line =~ /Last Changed Date: (\d{4})-(\d\d)-(\d\d) (\d\d):(\d\d):(\d\d)/) {
                                        $last_change = timegm($6, $5, $4, $3, $2 - 1, $1);
@@ -158,8 +158,8 @@ sub read_svn_info {
                close(TORTOISE);
 
                $info_source = "Command line (SubWCRev)";
-               $svn_info_cmd = "SubWCRev $srcdir $tortoise_file $version_file";
-               my $tortoise = system($svn_info_cmd);
+               $info_cmd = "SubWCRev $srcdir $tortoise_file $version_file";
+               my $tortoise = system($info_cmd);
                if ($tortoise == 0) {
                        $do_hack = 0;
                }
@@ -188,18 +188,25 @@ sub read_svn_info {
                eval {
                        use warnings "all";
                        no warnings "all";
-                       $svn_info_cmd = "(cd $srcdir; git log --format='commit: %h%ndate: %ad' -n 1 --date=iso)";
-                       $line = qx{$svn_info_cmd};
+                       # If someone had properly tagged 1.9.0 we could also use
+                       # "git describe --abbrev=1 --tags HEAD"
+                       
+                       $info_cmd = "(cd $srcdir; git log --format='%b' -n 1)";
+                       $line = qx{$info_cmd};
                        if (defined($line)) {
-                               if ($line =~ /date: (\d{4})-(\d\d)-(\d\d) (\d\d):(\d\d):(\d\d)/) {
-                                       $last_change = timegm($6, $5, $4, $3, $2 - 1, $1);
-                               }
-                               if ($line =~ /commit: (\S+)/) {
+                               if ($line =~ /svn path=.*; revision=(\d+)/) {
                                        $revision = $1;
                                }
                        }
-                       $svn_info_cmd = "(cd $srcdir; git branch)";
-                       $line = qx{$svn_info_cmd};
+                       $info_cmd = "(cd $srcdir; git log --format='%ad' -n 1 --date=iso)";
+                       $line = qx{$info_cmd};
+                       if (defined($line)) {
+                               if ($line =~ /(\d{4})-(\d\d)-(\d\d) (\d\d):(\d\d):(\d\d)/) {
+                                       $last_change = timegm($6, $5, $4, $3, $2 - 1, $1);
+                               }
+                       }
+                       $info_cmd = "(cd $srcdir; git branch)";
+                       $line = qx{$info_cmd};
                        if (defined($line)) {
                                if ($line =~ /\* (\S+)/) {
                                        $repo_path = $1;
@@ -214,8 +221,8 @@ sub read_svn_info {
                eval {
                        use warnings "all";
                        no warnings "all";
-                       $svn_info_cmd = "(cd $srcdir; bzr log -l 1)";
-                       $line = qx{$svn_info_cmd};
+                       $info_cmd = "(cd $srcdir; bzr log -l 1)";
+                       $line = qx{$info_cmd};
                        if (defined($line)) {
                                if ($line =~ /timestamp: \S+ (\d{4})-(\d\d)-(\d\d) (\d\d):(\d\d):(\d\d)/) {
                                        $last_change = timegm($6, $5, $4, $3, $2 - 1, $1);