![]() I actually did another script that prints the size of the repository folder by getting a sum of the “size” nodes, but I will leave that as an exercise for the reader (hint: Measure-Object Cmdlet and the -Sum Parameter would be useful).Īnalytics architecture Books Career Debugging Dev Dev Community DevOps Hello React and TypeScript My Projects Pipeline Planning Quality Test Automation Tips TestPipe This and That Uncategorized Tags. Powershell strikes again and provides a simple and easy way to work with XML output. | Export-Csv c:\svnlist.csv – formats the results as csv and saves it to a file. | sort -property date – this does what it says and sorts by date. As you can see, its pretty powerful and I could reformat my output as I see fit. You will notice that to get the revision I am asking Powershell to GetAttribute on the commit node. Example: I want the author included in my output so I will tell Powershell to include author, N=’author’ and set the value to the value of the author node from the commit node object, E=. – this takes each of our entry nodes and parses it to select the output we want. If you view this file you would see that there is a root lists node that has a child node list, that has child node entry, which in turn has child nodes: name, size, and commit (with revision attribute and child node for author and date). ![]() If you want to see the XML, you could output to a file like this: PS C:\program files\tortoisesvn\bin> ((svn list -xml -recursive This simply takes the XML document created by and saves it to a file. The next part of the script we are sending each entry node object to our processing pipeline to produce the output. – this is some XML parsing magic where we get a reference to the root “lists” node, then each “list” and each “entry” in the list. Svn list –xml –recursive – this returns an xml list of files and folders from the svn path and recurse into subdirectories ( ). This can be used on any source that returns plain text XML, not just SVN list. It converts plain text XML into an XML document object that Powershell can work with. – this is the Powershell XML type accelerator. OK, that is a mouthful, so here is a break down of what’s going on here. ![]() PS C:\program files\tortoisesvn\bin> ((svn list -xml -recursive | select -property | sort -property date | Export-Csv c:\svnlist.csv I will use the svn command line to get the list of files and directories and Powershell to parse, transform and output the CSV file. ![]() The main reason was to get the size of the contents of the folder, but I also wanted to work with the results (sort, group, filter) and Excel was the tool I wanted to do it in. I needed to get a list of files in a specific folder of an SVN repository and export it as an csv file. ![]()
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |