2017-05-16 3 views
0

動的なsvnリビジョンを宣言したいので、私が関数を呼び出すと、時間にかかわらず最初のリビジョンと最後のリビジョンを取得できるようになります。これまでのところ私は、私はここでもうPowerShellでダイナミックなsvnリビジョン番号を収集するには?

をしたいいけないリビジョン番号を指定することができます私のコードは次のとおりです。

$ 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 

答えて

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) 
      } 
     } 
    } 
関連する問題