阅读SVN:工作副本的外部

dum*_*uch 3 svn delphi

直到最近,简单阅读所有的SVN:通过只读取存储在子目录.svn一些文本文件在Subversion工作拷贝引用的外部对象.随着使用mysql表更改为新的磁盘结构,这已经不再那么简单了.

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

在sourceforge上有针对RAD Studio的版本洞察,它可能包含一些代码来完成这个技巧,但我想知道是否有任何其他人可能已经完成了从该项目中提取所需部分的工作或有替代方法.

Ond*_*lle 11

您也可以使用Subversion客户端DLL以编程方式执行此操作.这是用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.
Run Code Online (Sandbox Code Playgroud)

您可能不得不调整Delphi 2007的代码.似乎Version Insight在此期间已经发展并且失去了(某些)向后兼容性.


Céd*_*ien 5

如果你可以调用svn可执行文件,很容易找到你的存储库中存储的所有外部代码:

svn propget -R svn:externals .
Run Code Online (Sandbox Code Playgroud)

将返回 :

first/path/to/external - name_of_first_external http://first_repos/that/is/in/external
second/path/to/external - name_of_second_external http://second_repos/that/is/in/external
Run Code Online (Sandbox Code Playgroud)