开发者

Is there a way to revert svn property changes for a file without reverting changes to the file's contents?

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.


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
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜