19

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?

5 Answers 5

33

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
5
  • 2
    Ok, so adding 'depth' will make sure the checkout is immediate regardless of your repo size...right? Sounds perfect. Haven't tried it yet - but I think your answer is most acceptable. Nov 30, 2010 at 4:34
  • 2
    Yes, "--depth empty" does that. "--depth immediate" also exists and would checkout files and folders inside that top level directory, too.
    – panschk
    Dec 3, 2010 at 12:56
  • 3
    Thanks, but in line 5, I'd rather do svn commit -m "commit comment" repocopy; other than that, great.
    – J S
    Jan 6, 2015 at 0:19
  • A sample of what "tmp_new" might contain is "-r611 htp://svn.company.com/svn/Build" - more detail on what @lazy-badger posted here: stackoverflow.com/questions/23277009/… Oct 21, 2015 at 17:36
  • You could save the need of creating the tmp2 and pass the "whatever you want to do" as an argument for --editor-command, using propedit. One of my examples: svn propedit svn:externals . --editor-cmd='sed -i -r s#@\(HEAD\|[0-9]+\)#@'$REV'#' You could replace the 'sed ...' in the above example with any custom script. The script will be invoked (by svn) with the prop file name as $1.
    – eyalzba
    Nov 6, 2019 at 15:15
4

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.

1
  • I'm not sure how TortoiseSVN does it directly from "Repo browser" then, as Si suggested. Jul 20, 2010 at 4:17
1

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.

2
  • That's good info.. I'm aware about this. But can't it be done from command line? Jul 20, 2010 at 4:15
  • The documentation Adrian supplied indicates it's not possible, so your best bet might be to email either subversion or TortoiseSVN mailing lists for a rationale as to why one client (presumably using the same API/library) can do this whereas another cannot. You might get lucky on SO and find someone with deeper knowledge, I know Stefan (TortoiseSVN lead dev) was on SO a while ago, but pot luck really!
    – si618
    Jul 20, 2010 at 4:35
0

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.

1
  • svn:externals is not, however, a revision property, it's a normal (albeit special) one.
    – eichin
    Oct 1, 2011 at 16:37
0

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
3
  • the "___" with subversion.. ?
    – Xlander
    Oct 29, 2014 at 10:04
  • Ok, I admit, being Dutch I am good in Dutch-isms. I adapted my text to make it more readable (I hope).
    – Ton Bosma
    Oct 30, 2014 at 10:00
  • Lol ok. That's not a problem. A better way to say it would be When you install subversion, next to the 'svn' command there is another command installed called 'svnmucc'.
    – Xlander
    Oct 30, 2014 at 10:15

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.