3

I'm new to being a pure programmer/engineer (though I have worked with many through the years and performed 'as needed' coding). Now I find myself needing to setup a version control environment. I'm familiar with SVN, but would like to know if it has a 'feature' before going to the trouble of setting it up and determine what file structure to implement.

Within a project, I've several files that change frequently, but I do not want to keep prior versions as they would quickly gobble up disk space. Does SVN have a feature where you can set the property for a file (or folder) within the repository to only retain the latest version of a file? (Or maybe just the n last versions?)

If SVN does not have this feature, are there other version control systems that do?

Thanks in advance for your consideration of this question...

  • 2
    You really don't need it. SVN keeps diffs only for a particular revision - not the entire files. Personally I've never heard of someone running out of disk space because of one SVN repository, – ElmoVanKielmo Mar 27 '14 at 14:55
  • @ElmoVanKielmo while I agree with your sentiment, you're now lucky enought to meet someone who ran out of space with SVN, due to poor use in the past. I have since repented, but, A long time ago in a galaxy far away... I was using SVN to store frequently changing non-textual assets like images, other media, and compiled code. It seemed like good idea in theory to centralize and make simple release process and delpoyment (which it did), but the hammer of reality eventually caught up... – Ray Mar 27 '14 at 15:15

2 Answers2

2

SVN keeps track of change sets, not whole files and no, you cannot delete them.

Extra Advice: I'd not worry about disk space for repos if I were you or maybe take some time reconsider why the files change so frequently that entire disk space is getting filled. Does this need version control? If so, you probably don't really want to blow away history.

Also, I'd recommend using a more modern version control tool like git or mercurial.

Here's a similar posts regarding clearing disk space with git:

As noted in a comment below, if you're this new to version control any of the above kung fu may likely result in broken feet ;)

Community
  • 1
  • 1
Ray
  • 40,256
  • 21
  • 101
  • 138
  • I'd recommend that too in general, but they don't provide a solution/answer to this problem either. – Erwin Bolwidt Mar 27 '14 at 14:56
  • @ErwinBolwidt see my updated answer where git might help – Ray Mar 27 '14 at 14:57
  • yes and no- certainly not something a beginner should do with `git`, and since it rewrites the history, it requires coordination with everyone who has cloned the repository that you're modifying in this way. – Erwin Bolwidt Mar 27 '14 at 14:58
  • @ErwinBolwidt The real answer is my first sentence--simply, no SVN cannot accomplish what is needed. However unwise, at least in git you've got plenty of options to shoot feet off. – Ray Mar 27 '14 at 15:01
  • Thanks to all for the feedback so far. I suppose I am trying to solve 2 problems (backup and version control) with 1 tool. – user3469050 Mar 27 '14 at 18:23
  • Thanks to all for the feedback so far. I suppose I am trying to solve 2 problems (backup and version control) with 1 tool. I'm only a beginner with regards to the implementation of version control, but not the use of it. And I haven't yet decided on which way to go -- I'm only anticipating that I could potentially have a problem with some of the file types in the project. Seems I still need a better understanding of how it works, though. So, to further that end -- SVN stores the 1st ver of the file when committed, then the file is changed the next day and on commit, only saves the diff? – user3469050 Mar 27 '14 at 18:30
  • (Obviously I'm a beginner with posting to SO. Sorry for multiple alerts on my attempts to edit my comment. [Enter] seems to commit the comment and you only have a short time to edit it...) – user3469050 Mar 27 '14 at 18:32
  • @user3469050 Yes, basically that's how SVN works. But once again, I'd recommend not using SVN unless you've inherited it from another project. Use git. You won't run into a disk storage problem unless you're storing huge files I'll bet – Ray Mar 27 '14 at 18:32
  • Excellent - thx for the confirmation Ray! Using a different combo of search terms, I found this entry which was helpful in explaining further: http://stackoverflow.com/questions/2332833/how-exactly-does-subversion-store-files-in-the-repository. Looking into git is also on my list. – user3469050 Mar 27 '14 at 22:00
  • I don't really understand how using Git is going to help you to complete the task. – bahrep Mar 28 '14 at 12:09
2
  1. I guess that the file you are concerned about should not be stored in version-control sytsem at all. The common way to use Apache Subversion, or any other source control system is not to store files that are built from your own source files (e.g. autogenerated files, large binaries or disk images). In other words, if you build an executable, you should store it's sourcecode, not the compiled executable.

  2. It's not clear what kind of file you are concerned about still. What is is the filetype and the size of the file?

    • If the file is textual then you don't have to worry about the repository size, see @ElmoVanKielmo's comment to your question. Subversion stores deltas between revisions of textual files very effectively.

    • If the file is large and binary then you still can store it in Subversion repository, however I wouldn't store files larger than 1GB in the repository.

  3. Apache Subversion does not have such feature to automatically remove a file completely from the repository history. Subversion is designed to never lose information that exists in the repository. However, you can store the large file in dedicated branch and easily clean it up from time to time using repository history filtering.

  4. Beware that disconnected/distributed version-control has it's shortcomings in regards of storing large binaries:

    with Git, everyone who does git clone will have to download the whole repository with all versions of the large binary file, so it can be time- and bandwidth- consuming. I'd say that Git is way less adapted for storing binaries than Subversion is.


...before going to the trouble of setting it up and determine what file structure to implement.

Installing and configuring Subversion server is not a trouble at all. You can look through the list of Apache Subversion Binary Packages to get one for your platform. Configure the server to expose your repositories over HTTP(S) (Apache HTTP Server) or svn:// (svnserve) protocols.

If you are on Windows, you may want to try VisualSVN Server that installs and configures the complete server package in a couple of clicks saving you a lot of time.

bahrep
  • 29,961
  • 12
  • 103
  • 150