[cvsnt] Scripts variables

Adrian Crossley adrian.crossley at hesa.ac.uk
Mon Dec 20 09:00:46 GMT 2004


Variables: http://www.cvsnt.org/manual/Variables.html

stdin is mostly just the log message.

My loginfo command is: DEFAULT php /cvsnt/cvsroot-it/CVSROOT/loginfo-log.php %{sVv} $CVSROOT $USER $COMMITID >> /cvsnt/cvsroot-it/CVSROOT/commitlog 

My php loginfo script is below.  I run on Windows2003.

hth
Ade

<?php 
/* 
**  print cvs commit info obtained from args and stdin 
*/ 

if (strftime("%Z") == 'GMT Daylight Time') { 
  $timestamp = strftime("%Y-%m-%d %H:%M:%S BST"); 
} else { 
  $timestamp = strftime("%Y-%m-%d %H:%M:%S GMT"); 
} 
$changes  = explode(' ', $argv[1]); 
$module   = array_shift($changes); 
$cvsroot  = $argv[2]; 
$user     = $argv[3]; 
$commitid = $argv[4]; 

$logmsg = ''; 
$previousLine = ''; 
while ($currentLine = fgets(STDIN)) { 
  if ( ereg('^Log Message:', $previousLine)) { 
    $logmsg .= $currentLine; 
  } elseif ($logmsg != '') { 
    $logmsg .= $currentLine; 
  } 
  $previousLine = $currentLine; 
} 


echo "------------------------------------------------------\n"; 
echo "Timestamp : $timestamp\n"; 
echo "Repository: $cvsroot\n"; 
echo "Module    : $module\n"; 
echo "User      : $user\n"; 
echo "CommitID  : $commitid\n"; 
echo "Changes   : \n"; 
foreach($changes as $change) { 
  $part = explode(',', $change); 
  if ($part[1] == 'NONE') { 
    echo "  $part[0] Added\n"; 
  } elseif ($part[2] == 'NONE') { 
    echo "  $part[0] Removed\n"; 
  } else { 
    echo "  $part[0] Modified\n"; 
  } 
} 
echo "Reason    : \n$logmsg"; 
?> 




More information about the cvsnt mailing list