SVN report in Powershell

Viewed 83

I would like to export SVN logs which would contain following data:

  1. From each branch I have to export commits list. For each commit I need to pull its ID and Date.
  2. Output should also contain appropriate output, in case of multiple commits for one change in selected branch.

Here is what I did so far:

Function Get-SvnLog()
{
    ([xml](svn log -v --xml svn://ch00sa513/PLM/trunk/Test/)).log.logentry | % {
        $nEntry= $_
        $_.paths.path | % {
            $path = $_
            $nEntry| Select-Object -Property `
                Author, `
                @{n='Revision'; e={([int]$_.Revision)}}, `
                @{n='Date';     e={Get-Date $_.Date  }}, `
                @{n='Action';   e={$path.action      }}, `
                @{n='msg';      e={([string]$_.msg)  }}, `
                @{n='Path';     e={$path.InnerText   }}`
        }
    }
}

The output is as follows:

author     Revision Date                Action msg                                                                                                               Path                                                                                
------     -------- ----                ------ ---                                                                                                                                                                                         
user-1     2147 06.05.2020 14:23:32 M      Added machine ch00sa602 (MDA DEV) to file deploy-prepare.bat                                                      /trunk/jenkins/deploy-prepare.bat                                                   
user-2     2087 24.04.2020 14:41:53 M      DEVOPS-187: Add build number and SVN revision to Jenkins log                                                      /trunk/jenkins/build.bat                                                            
user-2     1925 09.04.2020 12:52:35 M      DEVOPS-185: add ch00sa601 to the list of servers                                                                  /trunk/jenkins/deploy-prepare.bat                                                   
user-2     1853 06.04.2020 20:37:19 M      DEVOPS-175: add pre-prod dispatchers to the list of known servers                                                 /trunk/jenkins/deploy-prepare.bat                                                   
user-2     1853 06.04.2020 20:37:19 M      DEVOPS-175: add pre-prod dispatchers to the list of known servers                                                 /trunk/jenkins/parts/tesis.bat               

And the desired output should be like this. How I can split those objects and out put it in such shape?

0 Answers
Related