简体   繁体   English

SVN 重定位 - 将所有外部变量更改为“相对于存储库根目录的 url”

[英]SVN Relocate - Change all externals to “relative url to repository root”

We recently changed the server name of our svn projects (http to https) Unfortunately all my externals which were using absolute urls are now not working.我们最近更改了 svn 项目的服务器名称(http 到 https) 不幸的是,我所有使用绝对 url 的外部设备现在都无法正常工作。 I want to change all of them with relative url to repository root "^/...".我想使用相对 url 将所有这些更改为存储库根目录“^/...”。

  • Folder 1文件夹 1
    • Folder 1.1文件夹 1.1
      • External 1外部 1
      • Folder 1.1.1文件夹 1.1.1
        • External 2外部 2
        • External 3外部 3
  • Folder 2文件夹 2
    • Folder 2.1文件夹 2.1
      • External 4外部 4
      • Folder 2.1.1文件夹 2.1.1
        • External 5外部 5
        • External 6外部 6

Is there a simple way to change them all at the same time ?有没有一种简单的方法可以同时更改它们?

I am using SVN 1.8.11我正在使用 SVN 1.8.11

Thank you in advance for your help预先感谢您的帮助

I would've made this a comment, but unfortunately I don't have access to comments yet.我本来可以评论的,但不幸的是我还没有评论的权限。 But are you using a Subversion Client?但是您使用的是 Subversion 客户端吗?

TortoiseSVN is a good svn client to use with an easy-to-use shell menu where all you would have to do would be to go to your checked out directory: - Right Click > TortoiseSVN > Properties > New... > Externals TortoiseSVN 是一个很好的 svn 客户端,它有一个易于使用的 shell 菜单,你所要做的就是转到你的检出目录: - 右键单击​​ > TortoiseSVN > 属性 > 新建... > 外部

Otherwise, yeah you would have to use the propset with the file.否则,是的,您必须将 propset 与文件一起使用。 Something like this:像这样的东西:

$ svn propset svn:externals BaseDirectory
Folder 1                       https://url/to/folder1
Folder 1/external 1            https://url/to/external1

Or you might have to use propedit, if they're already there.或者您可能必须使用 propedit,如果它们已经存在的话。 See more information:查看更多信息:

Manipulating Properties 操作属性

Externals Definitions 外部定义

Having externals shouldn't be an issue though, just make sure the directories aren't already there if you're doing an update.不过,拥有外部对象应该不是问题,只要确保在进行更新时目录不存在即可。 Sometimes subversion messes up if you're trying to add externals and point them to directories that already exist.如果您尝试添加外部对象并将它们指向已经存在的目录,有时颠覆会搞砸。 You might see an error like您可能会看到类似的错误

Cannot obtain lock on non directory

Or something like that.或类似的东西。 Hope this helps somewhat!希望这会有所帮助!

Since i had the same issue now and didn't find a solution I leave this here for future reference.由于我现在遇到了同样的问题并且没有找到解决方案,因此我将其留在这里以供将来参考。

I ended up checking out the whole repository.我最终检查了整个存储库。 Then exporting all externals with svn propget svn:externals -R > externals.txt .然后使用svn propget svn:externals -R > externals.txt导出所有svn propget svn:externals -R > externals.txt On this file you can replace ^([^\\s]+) - (.*?)(?=\\r\\n\\r\\n) with svn propset svn:externals "$2" $1 to get a list of commands to change all externals in the repository.在这个文件中,你可以用svn propset svn:externals "$2" $1替换^([^\\s]+) - (.*?)(?=\\r\\n\\r\\n)来获取命令列表更改存储库中的所有外部。 Then search/replace your url and execute the commands.然后搜索/替换您的网址并执行命令。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM