Browse code

Grab the last modified date from git if svn is unavailable

This allows us to build the website from a git-svn clone, and acts as a
first step towards a git migration

Sebastian Hahn authored on25/01/2012 03:12:01
Showing2 changed files
... ...
@@ -10,7 +10,7 @@
10 10
 # 4. make
11 11
 # 5. ./publish
12 12
 
13
-export TORGIT=set this to your tor.git path
13
+export TORGIT=/Users/killerchicken/coding/git/tor-git/tor/.git
14 14
 export STABLETAG=tor-0.2.2.35
15 15
 export DEVTAG=tor-0.2.3.10-alpha
16 16
 
... ...
@@ -11,16 +11,19 @@
11 11
 	Commons Attribution 3.0 United States License</a>, unless
12 12
 	otherwise noted.</p>
13 13
 <!--
14
-        # This will grab the date from svn info but formatting is tedious
15
-       	# REQUIRES svn for this to work
14
+        # This will grab the date from svn info/git
15
+        # REQUIRES svn or git for this to work
16 16
         <:{
17
-          my $svninfo = `svn info`;
17
+          my $svninfo = `svn info 2>/dev/null`;
18
+          my $modifydate;
18 19
           if ($svninfo =~ m/Last Changed Date: (\d{4}-\d{2}-\d{2})\s(\d{2}:\d{2}:\d{2})\s(.*)\s\((.*)\)/) {
19
-            my $modifydate = "$4 $2 $3";
20
+            $modifydate = "$4 $2 $3";
20 21
             # remove commas from date
21 22
             $modifydate =~ s/,//;
22
-            print 'Last modified: '.$modifydate."\n";
23
+          } else {
24
+            $modifydate = `git log --format=%cd -n 1`
23 25
           }
26
+          print 'Last modified: '.$modifydate."\n";
24 27
         }:>
25 28
         <:{
26 29
           #my $compiledate = `date`;