简体   繁体   中英

Is it possible to change “svn:externals” property of subversion repository remotely?

I am trying to change "svn:externals" property of a remote repository via this command:

svn ps svn:externals "vendor1 http://vendor_repo_here.com" http://main-repo-here.com

I am expecting above command to change the "svn:externals" property from whatever it is to "vendor1 http://vendor_repo_here.com ".. But it throws an error:

Setting property on non-local target 'http://main-repo-here.com' needs a base revision.

So I try this:

svn ps -r HEAD svn:externals "vendor1 http://vendor_repo_here.com" http://main-repo-here.com

Now it says:

Cannot specify revision for versioned property 'svn:externals'

Am I doing something wrong? Is there anyway to change this remotely via command line?

I had a similar problem. Turtoise seems to checkout and then commit again, so I wrote a script that does the same.

svn checkout <URL> repocopy --depth 'empty'
svn propget svn:externals repocopy > tmp2
//whatever you want to do > tmp_new
svn propset svn:externals repocopy -F tmp_new
svn commit -m "commit comment" tmp
rm -f -r repocopy
rm tmp2
rm tmp_new

from the help of svn propset:

propset (pset, ps): Set the value of a property on files, dirs, or revisions. usage: 1. propset PROPNAME PROPVAL PATH... 2. propset PROPNAME --revprop -r REV PROPVAL [TARGET]

  1. Changes a versioned file or directory property in a working copy.
  2. Changes an unversioned property on a repository revision. (TARGET only determines which repository to access.)

svn:externals is a versioned property, which cannot be changed in such way.

It's possible to change svn:externals remotely using TortoiseSVN:

TortoiseSVN > Repo-Browser > (select svn:externals dir) > Show Properties > Edit

That works for me.

It would be interesting to know why TortoiseSVN is able to yet svn cannot.

When you install subversion, next to the 'svn' command there is another command installed called 'svnmucc'. 'svnmucc' is capable of setting properties url based from the command line. This includes versioned properties.

d:>svnmucc
enter code Subversion multiple URL command client
usage: svnmucc ACTION...

   Perform one or more Subversion repository URL-based ACTIONs, committing
   the result as a (single) new revision.

Actions:
   cp REV SRC-URL DST-URL : copy SRC-URL@REV to DST-URL
   mkdir URL              : create new directory URL
   mv SRC-URL DST-URL     : move SRC-URL to DST-URL
   rm URL                 : delete URL
   put SRC-FILE URL       : add or modify file URL with contents copied from
                       SRC-FILE (use "-" to read from standard input)
   propset NAME VALUE URL : set property NAME on URL to VALUE
   propsetf NAME FILE URL : set property NAME on URL to value read from FILE
   propdel NAME URL       : delete property NAME from URLhere

Propedit will work on revision properties, not sure about propset but that should work to.

However : the repo will have to be modified to allow revision property edits (in the pre-revprop-change hook) or they will be rejected. Once done, you can set other revision properties like author, date, log comment etc (of course, your hook can get clever, rejecting all but externals changes, but you need to be aware you'll have to code in that capability)

You will have to set an editor - I don't think you can directly override the existing value, (unless propset does this) as it expects to show you the existing value for you to edit.

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