Take the 2-minute tour ×
Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

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.

/trunk
  svn:external = /external/trunk

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

/branches/foo
  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:

/trunk
  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

2 Answers 2

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

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

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