How can I make subversion commit an immutable file?

I want subversion to commit the file, even if it hasn't changed. Is there any way to do this?

+49
version-control svn commit
Oct 15 '08 at 20:04
source share
11 answers

If you want the contents of the file to remain unchanged (which means you cannot just change the spaces, as johnstok suggested), you can always change one of the properties in the file.

eg.

 svn propset dummyproperty 1 yourfile
 svn commit yourfile

This will commit without changing the file.

Just make sure that you are not using one of the special svn: properties. Everything else should be in order.




Edit: A number of other posters asked why someone would want to do this - apparently the people who noted this answer also faced the same problems.

I can’t speak for the original poster, but one scenario where I saw this is to try to automatically synchronize actions in the Visual Sourcesafe repository with the subversion repository.

+58
Oct 15 '08 at 23:04
source share

How to answer the question of why forced commits should be made. I saw cases where someone used a commit message that was incorrect or unclear. It’s nice if you can force the commit, where you can fix this error. Thus, the updated commit message goes to the repository, so it will not be lost.

+4
Jan 18 '10 at 13:36
source share

I tricked this by deleting then re-adding the intruder file. Not the nicest way to do this, and it probably broke the history of the changes, but it was in line with my goals.

The reason for this: The file was one of two executable files built from the same source (with different #defines set). A slight change in the source meant that it changed, and the other did not. I wanted to write in the revision history that I really updated it to the latest version (although there were no changes).

Morten Holdflod Møller may indicate that “the file will still be part of the new edition” will cover this indication, but I think the unchanged file log did not show comments for this version.

+3
Dec 21 '08 at 13:02
source share

If it is a text file, just add a space, such as a line.

+2
Oct 15 '08 at 20:10
source share

The answer to some questions that should be asked should be possible: for some reason svn does not recognize the differences between the doc files, so I would also like to force a commit!

Now I am moving documentation from static dirs, svn. files are similar to UG_v1.2, UG_v1.3, etc. Therefore, to save the story, I take 1.2, delete the version from the file name and add and commit it to svn. Then I take ver from the second, copy it over the first and want to commit it and a newer version. The file size and creation date change (not to mention what's inside the document), but svn claims to be exactly the same file and forbids me to commit. When I manually change a document, svn sees different ones. Damn ?:>

+2
Mar 04 '10 at 13:27
source share

I don’t think it’s possible, but first of all, why do you need it? If the file has not changed, it should not be executed.

If you really want this file to be grouped with other files in a commit, you could change something minor inside (add a space, for example).

0
Oct. 15 '08 at 20:06
source share

The reason someone wants to commit an immutable file is because of a misunderstanding of how to revert to a previous version of the file.

For example, you can go back to index.html in revision 680 by simply updating it to a version in the past, for example. 650 :

svn update index.html -r 650

but this does not solve the problem because:

 svn status -u index.html
         * 650 index.html
 Status against revision: 680

svn clearly says that index.html is being modified remotely, and you cannot commit it, i.e. he "thinks" that index.html is outdated and needs to be updated to a new version. So, the next svn update will bring index.html to version 680 .

To really restore the file, you must combine it in the reverse order:

svn merge -r 680:650 index.html

and then commit it svn ci -m "Reverted to r650" index.html

0
Dec 02 '10 at 12:03
source share

In fact, I came across a reason to make a force fix. This is probably not the best practice, but we put Truecrypt ( http://www.truecrypt.org/ ) volumes in SVN because we need to maintain tight protection on some shell script, because it contains sensitive information. When a Truecrypt volume is created, its binary data remains unchanged no matter what you do with it. That way, I can change the contents of the volume, but the volume never appears.

-one
May 01 '09 at 10:33
source share

Changing a property will not be forced.

TortoiseSVN 1.4.5, build 10425 - 32 bit, 2007/08/26 11:14:13

-one
May 01 '09 at 10:38 PM
source share

I have the same problem with trueCrypt volume.

I added a new property (as suggested above) "forceCommit1", and I was able to commit the volume file. but only the property was not captured in the contents of the file.

I deleted the file and added it to svn again

-one
Jun 25 '09 at 16:07
source share

I thought you can do this from the command line?

 svn ci -force <filename> 

I do not have a repository to verify this, so I could be wrong.

-2
Oct 31 '08 at 10:31
source share



All Articles