如何在两个 SVN 修订版之间导出更改的文件 [英] How to export changed files between two SVN revisions
问题描述
如何在 SVN 中导出在两次修订之间发生更改的更改文件.我需要通过命令行或使用任何脚本(具有适当的文件夹结构)的解决方案.此外,我需要基于 Windows 的解决方案.
How can I export changed files in SVN that have changed between two revisions. I need a solution either via command line or by using any scripts (with proper folder structure). In addition, I need windows based solution.
例如喜欢:
export {svn diff --summarize -r 50:HEAD}
我想要一个目录树,其中包含从 50 开始的任何修订版中更改的文件副本
I want a directory tree with a copy of the files that where changed in any revision from 50 on
推荐答案
据我所知,svn 没有提供这样的功能.但是您可以使用 SharpSVN 编写一个简单的 c# 程序来完成它.这是您可以使用的示例.在此示例中,我获得了从修订版 100 到 200 的整个更改文件.
As far as I know, svn does not provide such a feature. But you may write a simple c# program using SharpSVN to do it. Here is a sample that you can use. In this sample, I am getting the whole changed file from revision 100 to 200.
using SharpSvn;
using System.IO;
using System.Collections.ObjectModel;
using Microsoft.VisualBasic;
namespace SvnDiffExporter
{
class Program
{
static void Main(string[] args)
{
SvnClient client = new SvnClient();
SvnRevisionRange range = new SvnRevisionRange(100, 200);
MemoryStream result = new MemoryStream();
Collection<SvnLogEventArgs> items;
SvnLogArgs logargs = new SvnLogArgs(range);
client.GetLog(@"e:\Artifacts", logargs, out items);
int i = 0;
string [] path = new string[255];
foreach (SvnLogEventArgs ar in items)
{
foreach (SvnChangeItem changeitem in ar.ChangedPaths)
{
if (changeitem.Action != SvnChangeAction.Delete)
{
path[i] = changeitem.Path;
i++;
}
}
}
string localpath = @"c:\data";
foreach (string str in path)
client.Export(str, localpath);
}
}
}
这篇关于如何在两个 SVN 修订版之间导出更改的文件的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!