3

In ClearCase you you can "hijack" a file which means that the change management system will let you make changes to it, but it won't try to commit those changes or try to update that file when you pull the lastest changes. This is useful for configuration files or hacking classes that are only needed for production (like a slow filter that encrypts messages etc).

Is there anyway to do this in Subversion?

Sled
  • 18,541
  • 27
  • 119
  • 168
  • The usecases for this feature looks terrible – Simon Bergot Feb 16 '12 at 18:46
  • @Simon if you go to the second link in my answer they admit there are times for this. Turning off validation or overriding settings to deploy faster while developing are common scenarios. – Sled Feb 16 '12 at 19:00
  • I did no see in the link anything that could justify breaking bits of your versioning system. The timestamp example is a not very convining one. Are there IDE that HAVE to mess up with your files? This look like a pretty bad feature to me. – Simon Bergot Feb 16 '12 at 19:23
  • Well where I was working RAD (IBM's flavour of Eclispse) was autogenerating files and some of us were using version 7 and some were using version 8 and the difference in the files was just in the comments. Sure, we could have rejiggered the ancient fragile build system, but that would have taken days, and you would have been personally responsible for any real or imagined regressions caused by this. So, it was easier to hijack the files than the constant noise of recommitting them. Also, we did this to config files to make our IDEs point different databases. – Sled Feb 17 '12 at 14:35
  • @Simon Actually just came across an even better use case: your `log4j.properties` file. Compared to production, when I deploy locally in dev, I like to increase the number of debug messages for the components I'm working on and decrease the ones that are orthogonal to that which I'm working. – Sled Mar 15 '12 at 20:39

2 Answers2

2

There is no real equivalent in Subversion in that the files are directly writable in your working directory in Subversion.

You can ignore a file in subversion on commit (with TortoiseSVN), which allows you to ignore current modifications done locally while keeping the file under version control.
And that is fairly similar to "hijacked" files in ClearCase.


The OP ArtB asked about a command-line solution, and I suggested using changelist (as in svn changelist), which he summarized in his answer (upvoted)

You will see this approach taken in:

Community
  • 1
  • 1
VonC
  • 1,262,500
  • 529
  • 4,410
  • 5,250
  • Seems familiar from the UI, but how does one do that from the command line? – Sled Feb 15 '12 at 16:53
  • @ArtB the question I referenced (http://stackoverflow.com/questions/895548/subversion-ignore-modifications-to-a-file-locally-on-one-client-only) mentions alternatives (changelists: http://svnbook.red-bean.com/en/1.6/svn.ref.svn.c.changelist.html) – VonC Feb 15 '12 at 19:51
2

This is a new answer to better summarise to what VonC helped lead me. The answer is to take the file and add it changelist called "ignore-on-commit"(see: Excluding Items from the Commit List). So the svn command itself would be svn changelist ignore-on-commit $target_file.

Sled
  • 18,541
  • 27
  • 119
  • 168
  • Good point. +1. I have updated my answer for more visibility and added a couple of references to other similar answers. – VonC Feb 16 '12 at 19:24