简体   繁体   中英

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. I want to change all of them with relative url to repository root "^/...".

  • Folder 1
    • Folder 1.1
      • External 1
      • Folder 1.1.1
        • External 2
        • External 3
  • Folder 2
    • Folder 2.1
      • External 4
      • Folder 2.1.1
        • External 5
        • External 6

Is there a simple way to change them all at the same time ?

I am using 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?

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

Otherwise, yeah you would have to use the propset with the file. 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. 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 . 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. Then search/replace your url and execute the commands.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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