从工作副本中读取SVN:外部 [英] reading SVN:externals from working copy

查看:36
本文介绍了从工作副本中读取SVN:外部的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

直到最近,仅通过读取存储在.svn子目录中的一些文本文件,即可轻松读取子版本工作副本中引用的所有SVN:Externals.通过使用mysql表更改为新的磁盘结构,这不再那么简单.

我想更新一个内部使用的工具,该工具用于读取外部列表以使用新结构.该工具是用Delphi 2007编写的,因此我更喜欢一些用Delphi编写的代码.

sourceforge上有 Version Insight for RAD Studio ,其中可能包含一些实现此目的的代码,但我想知道是否还有其他机构已经完成了从该项目中提取所需部分的工作,或者是否还有其他选择.

解决方案

您还可以使用Subversion客户端DLL以编程方式进行此操作.这是用Delphi XE编写的最小示例:

 程序svnext;{$ APPTYPE控制台}用途SysUtils,SvnClient;程序Main;变种SvnClient:TSvnClient;SvnItem:TSvnItem;开始//Subversion客户端DLL目录;在这里,我只是使用.exe的目录//(我在此处手动复制了DLL.)BaseDllDir:= ExtractFilePath(ParamStr(0));SvnClient:=零;SvnItem:= nil;尝试SvnClient:= TSvnClient.Create;SvnClient.Initialize;SvnItem:= TSvnItem.Create(SvnClient,nil,ParamStr(1));Writeln(SvnItem.PropValues ['svn:externals']);最后SvnItem.Free;SvnClient.Free;结尾;结尾;开始尝试主要的;除了在E上:例外开始ExitCode:= 1;Writeln(Format('[[%s]%s',[E.ClassName,E.Message])));结尾;结尾;结尾. 

您可能需要调整Delphi 2007的代码.在此期间,Version Insight似乎有所发展,并且失去了(向后)兼容性.

Until recently it was simple to read all the SVN:Externals referenced in a subversion working copy by just reading some text files stored in the .svn subdirectory. With the change to a new on disk structure using mysql tables this is no longer that simple.

I want to update an internally used tool that used to read that list of externals to using the new structure. The Tool is written in Delphi 2007 so I would prefer some code written in Delphi.

There is Version Insight for RAD Studio on sourceforge which might contain some code to do the trick but I wonder if any body else has maybe already gone through the work of extracting the required parts from that project or has an alternative.

解决方案

You can also do it programmatically, using the Subversion client DLLs. Here is a minimal example written in Delphi XE:

program svnext;

{$APPTYPE CONSOLE}

uses
  SysUtils,
  SvnClient;

procedure Main;
var
  SvnClient: TSvnClient;
  SvnItem: TSvnItem;
begin
  // Subversion client DLL directory; here I simply use the .exe's directory
  // (I copied the DLLs there manually.)
  BaseDllDir := ExtractFilePath(ParamStr(0));

  SvnClient := nil;
  SvnItem := nil;
  try
    SvnClient := TSvnClient.Create;
    SvnClient.Initialize;
    SvnItem := TSvnItem.Create(SvnClient, nil, ParamStr(1));
    Writeln(SvnItem.PropValues['svn:externals']);
  finally
    SvnItem.Free;
    SvnClient.Free;
  end;
end;

begin
  try
    Main;
  except
    on E: Exception do
    begin
      ExitCode := 1;
      Writeln(Format('[%s] %s', [E.ClassName, E.Message]));
    end;
  end;
end.

You might have to tweak the code for Delphi 2007. It seems Version Insight has evolved in the meantime and lost (some of) the backward compatibility.

这篇关于从工作副本中读取SVN:外部的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆