如何获取svn --xml list
命令的输出,并使用 PowerShell 将其转换为按提交日期时间排序的表?
我使用此命令输出工作区中每个文件的摘要:
svn --xml list svn://svn.example.com/Database
我收到以下输出:
<?xml version="1.0" encoding="UTF-8"?>
<lists>
<list
path="svn://svn.skyscanner.co.uk/SkyscannerDatabase/INT/Flightstore">
<entry
kind="dir">
<name>Assemblies</name>
<commit
revision="10768">
<author>sam</author>
<date>2011-03-03T17:35:40.705575Z</date>
</commit>
</entry>
<entry
kind="dir">
<name>Data</name>
<commit
revision="15118">
<author>yann</author>
<date>2012-06-07T17:52:46.028463Z</date>
</commit>
</entry>
<entry
kind="dir">
<name>Database Triggers</name>
<commit
revision="10764">
<author>sam</author>
<date>2011-03-03T16:31:50.399811Z</date>
</commit>
</entry>
<entry
kind="dir">
<name>Defaults</name>
<commit
revision="10764">
<author>sam</author>
<date>2011-03-03T16:31:50.399811Z</date>
</commit>
</entry>
<entry
kind="file">
<name>Filter.scpf</name>
<size>4396</size>
<commit
revision="14955">
<author>yann</author>
<date>2012-05-30T10:08:54.064942Z</date>
</commit>
</entry>
<entry
kind="dir">
<name>Functions</name>
<commit
revision="13994">
<author>sam</author>
<date>2012-03-12T10:41:18.173561Z</date>
</commit>
</entry>
<entry
kind="file">
<name>RedGate.ssc</name>
<size>0</size>
<commit
revision="10764">
<author>sam</author>
<date>2011-03-03T16:31:50.399811Z</date>
</commit>
</entry>
<entry
kind="file">
<name>RedGateDatabaseInfo.xml</name>
<size>2491</size>
<commit
revision="14546">
<author>david</author>
<date>2012-05-02T10:23:19.811375Z</date>
</commit>
</entry>
<entry
kind="dir">
<name>Rules</name>
<commit
revision="10768">
<author>sam</author>
<date>2011-03-03T17:35:40.705575Z</date>
</commit>
</entry>
<entry
kind="dir">
<name>Security</name>
<commit
revision="14956">
<author>yann</author>
<date>2012-05-30T10:11:38.387808Z</date>
</commit>
</entry>
<entry
kind="dir">
<name>Service Broker</name>
<commit
revision="10764">
<author>sam</author>
<date>2011-03-03T16:31:50.399811Z</date>
</commit>
</entry>
<entry
kind="dir">
<name>Storage</name>
<commit
revision="10764">
<author>sam</author>
<date>2011-03-03T16:31:50.399811Z</date>
</commit>
</entry>
<entry
kind="dir">
<name>Stored Procedures</name>
<commit
revision="15194">
<author>sam</author>
<date>2012-06-12T16:50:16.105896Z</date>
</commit>
</entry>
<entry
kind="dir">
<name>Synonyms</name>
<commit
revision="10764">
<author>sam</author>
<date>2011-03-03T16:31:50.399811Z</date>
</commit>
</entry>
<entry
kind="dir">
<name>Tables</name>
<commit
revision="15224">
<author>yann</author>
<date>2012-06-13T15:38:11.018172Z</date>
</commit>
</entry>
<entry
kind="dir">
<name>Types</name>
<commit
revision="10768">
<author>sam</author>
<date>2011-03-03T17:35:40.705575Z</date>
</commit>
</entry>
<entry
kind="dir">
<name>Views</name>
<commit
revision="15142">
<author>yann</author>
<date>2012-06-08T17:28:48.067359Z</date>
</commit>
</entry>
</list>
</lists>
svn --verbose list
该表应包含与命令输出相同的列。该命令输出五列:修订、用户、大小、日期时间和文件名。这是输出svn --verbose list svn://svn.example.com/Database
:
15224 yann Jun 13 16:38 ./
10768 sam Mar 03 2011 Assemblies/
15118 yann Jun 07 18:52 Data/
10764 sam Mar 03 2011 Database Triggers/
10764 sam Mar 03 2011 Defaults/
14955 yann 4396 May 30 11:08 Filter.scpf
13994 sam Mar 12 10:41 Functions/
10764 sam 0 Mar 03 2011 RedGate.ssc
14546 david 2491 May 02 11:23 RedGateDatabaseInfo.xml
10768 sam Mar 03 2011 Rules/
14956 yann May 30 11:11 Security/
10764 sam Mar 03 2011 Service Broker/
10764 sam Mar 03 2011 Storage/
15194 sam Jun 12 17:50 Stored Procedures/
10764 sam Mar 03 2011 Synonyms/
15224 yann Jun 13 16:38 Tables/
10768 sam Mar 03 2011 Types/
15142 yann Jun 08 18:28 Views/
我尝试了以下简单代码:
[Xml] $Output = svn --xml list svn://svn.example.com/Database
$Output.Lists.List.Entry
它产生包含三列的输出:种类、名称和提交。这是输出:
kind name commit
---- ---- ------
dir Assemblies commit
dir Data commit
dir Database Triggers commit
dir Defaults commit
file Filter.scpf commit
dir Functions commit
file RedGate.ssc commit
file RedGateDatabaseInfo.xml commit
dir Rules commit
dir Security commit
dir Service Broker commit
dir Storage commit
dir Stored Procedures commit
dir Synonyms commit
dir Tables commit
dir Types commit
dir Views commit
我错过了哪些转变?