After a merge, I might have both content-changes as well as property-changes to a file:
>svn st foo.h
MM foo.h
Is there a way to keep the content-changes, but revert the property-changes?
I could copy the file to a temporary location, revert, then copy back:
>cp foo.h /tmp
>svn revert foo.h
>mv -f /tmp/foo.h foo.h
>svn st foo.h
M foo.h
But that would be cumbersome with many files, without writing a separate script.
I was hoping there may be an svn option that I've missed.
Right click on the selected revision(s), then select Context Menu → Revert changes from this revision. Or if you want to make an earlier revision the new HEAD revision, right click on the selected revision, then select Context Menu → Revert to this revision. This will discard all changes after the selected revision.
svn revert will revert not only the contents of an item in your working copy, but also any property changes. Finally, you can use it to undo any scheduling operations that you may have performed (e.g., files scheduled for addition or deletion can be “unscheduled”).
Note that the svn merge command reverts a commit in the sense of having another commit undoing your changes, but keeping your wrong commit in the history.
Sorry, I don't know of any way to just revert properties… But if I was faced with that situation, I think I would run:
$ svn proplist -v -r $REV foo.h
... # output, which I would copy to the clipboard
$ svn propedit foo.h
... paste in properties ...
And that could probably even be scripted, if you had to revert the properties for a bunch of files.
Ran into this situation myself this morning. Here's a bash script that does the trick ...
for f in $( svn st . | grep '^MM' | cut -c 3- )
do
cp $f $f.$$ && svn revert $f && mv $f.$$ $f
done
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With