2017-05-16 2 views
0

Je veux déclarer une révision svn dynamique afin que lorsque j'appelle ma fonction, je puisse obtenir la première révision et la dernière révision indépendamment du temps. Jusqu'à présent, je ne peux préciser le numéro de révision que je ne veux pas faire plusComment collecter des numéros de révision svn dynamiques dans PowerShell?

Voici mon code:

$ FromRev = "100" $ Torev = "200"

$Range = $FromRev + ':' + $ToRev 

$NewTable = "SVNStaticTable" 
#Create Table object 
$table = New-Object system.Data.DataTable “$NewTable” 

#Define Columns 
$col1 = New-Object system.Data.DataColumn Author,([string]) 
$col2 = New-Object system.Data.DataColumn Revision,([string]) 
$col3 = New-Object system.Data.DataColumn Msg,([string]) 
$col4 = New-Object system.Data.DataColumn Path,([string]) 
#$col5 = New-Object system.Data.DataColumn Comment,([string]) 

#Add the Columns 
$table.columns.add($col1) 
$table.columns.add($col2) 
$table.columns.add($col3) 
$table.columns.add($col4) 
#$table.columns.add($col5) 

$LogOutput = ([xml](svn log http://server/folder1/folder2 -v -r $Range --xml)).log.logentry 

Répondre

0
foreach ($entry in $LogOutput) { 
     $Paths = $entry.paths.path 
     Foreach ($path in $paths) { 
      if ($path.InnerText -like "*/static/*"){ 
       #Create a row 
       $row = $table.NewRow() 
       $row.Author = $entry.author 
       $row.Revision = $entry.revision 
       # $row.Msg = $entry.msg.Replace('\D+(\d+)\D+','$1') #you call a function here 
       #$row.Msg = $entry.msg.Replace("\w", '') #you call a function here 
       #$row.Msg = $entry.msg.Substring(0,7) #using the substring works 
       $row.Msg = $entry.msg 
       #$row.Msg = $test -replace "^.*_(\d*)$test.*$", '$1' 
       $row.Path = $path.InnerText.Replace("/branches/R3.21/db/static/","") 
       #$row.Path = $path.Replace('\..*') 
       #$row.Comment = $entry.Comment 
       $table.Rows.Add($row) 
      } 
     } 
    }