2011-03-14 82 views
0

靠的是SVN版本我想下载文件靠的是SVN版本我想下载文件在PHP

命令:svn log -r ".$fileId ." -v

输出:

Array 
(
    [0] => ------------------------------------------------------------------------ 
    [1] => r11369 | owner | 2011-03-14 15:42:38 +0530 (Mon, 14 Mar 2011) | 1 line 
    [2] => Changed paths: 
    [3] => A /Process Related Documents/Engineering/SourceCode/fullpath 
    [4] => 
    [5] => Uploaded By Username 
    [6] => ------------------------------------------------------------------------ 
) 

有1档5次修订

r01,r02,r03,r04和r05 现在我想下载r03文件..

+1

你应该考虑编辑这个问题,因为它没有多大意义。你在这里有什么问题? – dianovich 2011-03-14 13:30:41

+1

您可以使用'--xml'选项以XML格式提取日志,可能会更容易解析。 – mdm 2011-03-14 13:32:35

+0

svn“保存修改为”commad line怎么办 – rajaneesh 2011-03-15 05:47:29

回答

0

如果我正确地解析你的问题,你所说的是这样的:

你已经走过了历史/找到了信息,而且你知道有五个不同的版本修改了这个文件。基于此,您已经选择了其中一个版本(第三个版本),并且您想要查看该文件当时的样子。

为此,您想要svn cat

            
 
cat: Output the content of specified files or URLs. usage: cat TARGET[@REV]... If specified, REV determines in which revision the target is first looked up. Valid options: -r [--revision] ARG : ARG (some commands also take ARG1:ARG2 range) A revision argument can be one of: NUMBER revision number '{' DATE '}' revision at start of the date 'HEAD' latest in repository 'BASE' base rev of item's working copy 'COMMITTED' last commit at or before BASE 'PREV' revision just before COMMITTED

已经从资源库中,只需选择svn cat uri://to/repository/to/file -r REVNUM的版本号。

或者,当您使用PHP时,通过svn PECL package获取所需的信息可能会更容易,而不是试图解析命令行输出。

+0

非常感谢您的回放...... – rajaneesh 2011-03-17 05:06:22