Super User is a question and answer site for computer enthusiasts and power users. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

How can I revert one of several properties on a directory from svn command line?

My svn trunk has a property svn:externals to import an external repo.

  svn:external = /external/trunk

When I set up a new branch foo, the external is changed to point to a branch as well:

  svn:external = /external/branches/foo

Sometimes when I merge a branch back into the trunk, that property gets copied over and I end up with:

  svn:external = /external/branches/foo

Normally I could run svn revert . --depth=empty to undo the property merge, but there are other properties on the dir that would be reverted as well, specifically svn:mergeinfo. From my GUI client I can revert individual properties pretty easily, but I don't always remember to do so. Is there a way to do the same thing directly from svn cmd line, or do I need to write some crazy wrapper for svn propget to get and undo the diff?

share|improve this question

svn propset svn:externals "$(svn propget svn:externals . -r HEAD)" .

this sets the property to the HEAD value. This is a valid workaround since revert can only be applied to all properties, and doesn't exist for individual properties.

share|improve this answer

For my future reference more than for you, seeing as you probably have the answer...

svn propget PROPNAMETOREVERT `svn info | perl -ne 'print if s/URL: (.*)/\1/'` | perl -ne 'chomp; print' | svn propset PROPNAMETOREVERT  -F - .

Worked for me (on a one line property, might need modification for one with multiple lines).

Which could clearly do with being a script :-)

share|improve this answer

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .