Svn revert all properties changes

限于喜欢 提交于 2019-12-20 09:51:45

问题


I have a svn working copy which I attempted to reverse merge a couple of recent revisions into. I cancelled the merge before it completed as I changed my mind. Now my working copy has a couple of thousand "changes" from updates to the ancestry related properties on most of the files. I have about 10 files with real code changes mixed in which I don't want to have to seperate out by hand.

Is there a way for me to revert all of the property changes without affecting the content changes?


回答1:


svn revert `svn status | grep '^ M' | sed 's/^ M \+//g'`



回答2:


If you use the '--depth empty' option you'll revert changes only to paths explicitly specified on the command line so if you specify all of the directories that have property changes but NONE of the files whose content changes you want to keep.

e.g. if you have the directory 'foo' with unwanted property changes but the file 'bar' inside 'foo', the following should preserve the mods to 'bar' but revert the property changes on 'foo'.

$svn revert --depth empty foo



回答3:


Turns out that Tortoise SVN can do this really nicely. In the commit dialog you can sort the "modified" files by "text status" or "properties status". I simply sorted by text status and then reverted all the "modified" files which had "normal" "text status".




回答4:


You can submit your changes and then revert the property changes from that revision:

svn merge -c -REV -depth empty

where REV is the revision where you want to revert the property changes




回答5:


Revert all property changes with PowerShell.

> @(svn status) -match '^ M' | `
>>> % { ($_ -split 'M\s+')[1] } | `
>>> % { svn revert --depth empty $_ }

Credit to Jerome Jaglale and TheJuice for the general approach.

Note the backtick ` symbol indicates a new line.




回答6:


I would just copy/backup the 10 files with the real code change somewhere else, and just svn revert -R the whole project, then copy back the 10 files.



来源:https://stackoverflow.com/questions/3086418/svn-revert-all-properties-changes

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!