开发者

Subversion freaking out on me!

开发者 https://www.devze.com 2022-12-30 03:06 出处:网络
I have two copies of a site, one is the production copy, and the other is the development copy. I recently ad开发者_开发知识库ded everything in the production to a subversion repository hosted on our

I have two copies of a site, one is the production copy, and the other is the development copy. I recently ad开发者_开发知识库ded everything in the production to a subversion repository hosted on our linux backup server. I created a tag of the current version and I was done.

I then copied the development copy overtop of the production copy (on my local machine where I have everything checked out). There are only 10-20 files changed, however, when I use tortoise SVN to do a commit, it says every file has changed. The diff file generated shows subversion removing everything, and replacing it with the new version (which is the exact same).

What is going on? How do I fix it?

An example diff:

Index: C:/Users/jhollon/Documents/Visual Studio 2008/Projects/saloon/trunk/components/index.html
===================================================================
--- C:/Users/jhollon/Documents/Visual Studio 2008/Projects/saloon/trunk/components/index.html   (revision 5)
+++ C:/Users/jhollon/Documents/Visual Studio 2008/Projects/saloon/trunk/components/index.html   (working copy)
@@ -1,4 +1,4 @@
-<html>
-<body bgcolor="#FFFFFF">
-</body>
+<html>
+<body bgcolor="#FFFFFF">
+</body>
 </html>
\ No newline at end of file


It's probably a line-ending mismatch. Set property svn:eol-style=native on all your files.

http://svnbook.red-bean.com/en/1.5/svn.advanced.props.file-portability.html#svn.advanced.props.special.eol-style

You can have Subversion set this property on all new files by default:

http://svnbook.red-bean.com/en/1.5/svn.advanced.props.html#svn.advanced.props.auto

Here's what's in my ~/.subversion/config:

enable-auto-props = yes

### Section for configuring automatic properties.
[auto-props]
### The format of the entries is:
###   file-name-pattern = propname[=value][;propname[=value]...]
### The file-name-pattern can contain wildcards (such as '*' and
### '?').  All entries which match will be applied to the file.
### Note that auto-props functionality must be enabled, which
### is typically done by setting the 'enable-auto-props' option.
*.c = svn:eol-style=native
*.cpp = svn:eol-style=native
*.h = svn:eol-style=native
# *.dsp = svn:eol-style=CRLF
# *.dsw = svn:eol-style=CRLF
*.sh = svn:eol-style=native;svn:executable=*
*.txt = svn:eol-style=native
*.png = svn:mime-type=image/png
*.jpg = svn:mime-type=image/jpeg
*.jpeg = svn:mime-type=image/jpeg
Makefile = svn:eol-style=native
*.tmpl = svn:eol-style=native
*.gif = svn:mime-type=image/gif
*.t = svn:eol-style=native;svn:executable=*
*.pm = svn:eol-style=native
*.pl = svn:eol-style=native;svn:executable=*
*.cgi = svn:eol-style=native;svn:executable=*
*.js = svn:eol-style=native;svn:mime-type=application/x-javascript
*.dtd = svn:eol-style=native;svn:mime-type=application/xml-dtd
*.txt = svn:eol-style=native;svn:mime-type=text/plain
*.html = svn:eol-style=native;svn:mime-type=text/html
*.yicf = svn:eol-style=native
*.xml = svn:eol-style=native;svn:mime-type=text/xml
*.sgml = svn:eol-style=native;svn:mime-type=text/sgml
*.xul = svn:mime-type=application/vnd.mozilla.xul+xml
*.tt = svn:eol-style=native


I see you're using Visual Studio, so maybe it has to do with the file encoding? I have had weird problems with VS encoding source files differently on two different machines, even though the machines have the same language and culture settings. In VS, the sources look exactly the same, but SVN sees the raw files...

Open the two revisions in an editor that knows nothing about Unicode or encoding (I think I used Notepad?), and see if they are different. The first line of the file contains a code that indicates what type of encoding is being used. I have no idea how to interpret that code, but at least you'll be able to tell if they are different.

There are options in Tools -> Options -> Environment -> Documents that control encoding.


Sounds like this question is already well answered (EOL style). I just wanted to add one other thing that can trigger a problem like this: Tabs vs Spaces. If your text editor or IDE uses spaces for indenting, and someone else on your team uses Tabs, SVN will see lots of file changes, but you won't "see" the change.


short-term solution (to check the diff between the two versions) : check out the two versions to compare in two seperate directories, and compare the directories with an external diff tool (meld in linux, winmerge in windows). Those tools can be configured to ignore end of line differences.

Edit : for the rest, use David M's solution (didn't know SVN could manage that...)

0

精彩评论

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