Why does svn diff sometimes copy working files to a temp file?

半腔热情 提交于 2019-12-08 16:49:39

问题


I use an external diff tool with Subversion (Beyond Compare rules!), and one of the great features is being able to use the diff program to make some minor edits to the file as I'm reviewing the changes I've made.

But svn diff works differently on different projects of mine. In all, the left-hand file is a temp file containing the latest revision stored in Subversion (the head). But in some, the right-hand file is the actual working file, while in others it's a temp file copy of the working file. In the first case, I can make changes in the diff program and they affect the working copy. In the second case, I'm editing a temp file, so changes are lost.

Why does Subversion sometimes diff against the working file but sometimes against a temp copy of the working file? How can I make it always use the working file?


回答1:


Do you have any svn:keywords set on those files? If yes, then Subversion will create a temp file first which has all those expanded keywords 'unexpanded'. This is to avoid having all the keyword lines shown as different even if they haven't been changed.

For example, if you diff a file in your working copy against BASE, the BASE file has no keywords expanded (and is also stored with LF lineendings), while the file in your working copy has all keywords expanded (and may be stored with CRLF lineendings). If you haven't modified that file locally, 'svn diff' would show all lines as different (if the line endings don't match) or at least all lines with the keywords would be shown as different - which is not what you would expect.




回答2:


Perhaps there are some access problems. Try to set a file to read-only, if svn opens a temp file now, this is one possible answer to your question. In this case, perhaps some editor/IDE you use write-protects the file.



来源:https://stackoverflow.com/questions/396176/why-does-svn-diff-sometimes-copy-working-files-to-a-temp-file

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