Monday, February 21, 2011

How do I get SVN to realize a binary file's changed if the filesize is fixed.

I'm working with a program that writes data to fixed-size binary files that I store in a subversion archive.

The problem, however, is SVN (both the command-line client and TortiseSVN) thinks that since the size of the file didn't change, the file itself didn't change and it shouldn't commit it.

Is there a way to change what diffing method is used, or do I have to resort to hacks such as adding a dummy property to the files?


EDIT: Turns out the solution wasn't becuase of the file-size thing. I just automatically assumed that would be the case, since most nieve diffing altorithims do this all the time. [weasel words]

From stackoverflow
  • Are you absolutely sure that the files did change? Subversion can and does handle binary files and they have an actual diffing algorithm for them; it's not just a look at the file size. Subversion detects file changes to binary files just fine here, even though the size did not change.

    Si : Hahaha, you beat me by 3 seconds :)
    Joey : I would have been faster, but I read the part in the Subversion book again :)
  • Are you sure the file has changed? i.e. different bytes. I'm pretty sure subversion uses a binary diff algorithm, and doesn't rely on file size.

    Kevin Reid : Subversion *does* compare timestamps, and assumes the file is unchanged if the timestamp has not changed. If the timestamp has changed, it will compare the entire content of the file.
    Si : Thanks Kevin, edited.
  • Resoved on my own.

    Turns out that the program that changed the files was also messing with the file's metadata in a way that confused SVN.

  • See here for a description on how SVN determines whether a file is modified or not.

0 comments:

Post a Comment