Amir Saniyan
Amir Saniyan

Reputation: 13759

Does tags directory duplicates my source code in SVN?

When I checkout a project from existing repository, three folders created: branches, tags and trunk.

I put my source code in trunk directory:

trunk
  |--include
  |--src
  |--lib
  |--bin
  |--build
  |--doc

But it seems I when I finish a version of the project, I should put a copy of it in tags directory (eg tags>my_project-1.0.0).

Does tags directory duplicates my source code in SVN? or I do something wrong?

I mean I should save all previous source codes in tag directory or I should save LATEST version in trunk directory without any duplication in other folders?

Upvotes: 4

Views: 592

Answers (2)

abatishchev
abatishchev

Reputation: 100308

a tag in SVN is just a named revision, i.e. r1000 internally named '1.0.0'.

so if you will checkout tags locally, will get following:

branches
tags
  |--1.0.0
    |--include
    |--src
    |--lib
    |--bin
    |--build
    |--doc
trunk
  |--include
  |--src
  |--lib
  |--bin
  |--build
  |--doc

but that will occupy disk space only once (on server), and twice - on your local disk.

Upvotes: 1

Rup
Rup

Reputation: 34418

It won't duplicate the storage, no. SVN effectively stores its data as a versioned file system tree plus a bucket of file data, and trunk/include/abc.h will point to the same file data as tags/myTag/include/abc.h.

There will now be two paths to access the same copy of the code, yes, but the tags version will be fixed at the revision where you made the copy. As you continue to commit to trunk/include/abc.h, tags/myTag/include/abc.h will remain the same.

That said, you can always reference a version of code on trunk by rembering the revision number: you could just write down somewhere that release-1.0.0 = trunk@12345. That said, tags are an easier way of remembering this and will contain metadata linking them back to the particular trunk revision you copied them from.

Your latest edit: I'm not 100% sure what you mean by "all previous or latest", but you should save the version you actually release. You might also want to create a stable branch from your release so that you can make fix-releases from the same version of code rather than trunk. There's no (or very little) storage overhead for tagging absolutely everything on trunk. If you mean can you access the commit log for files starting at the tag then yes, you can - the tag effectively contains all history to that point.


D'oh sorry, only just spotted this:

When I checkout a project from existing repository, three folders created: branches, tags and trunk.

No - you only need to check out trunk, or the branch that you're working on. You shouldn't check out the whole thing, no, or you will get everything duplicated on your disk. Checking out the root of a repository is a bad idea, and there's even an apache plugin in the subversion distribution you can install to explicitly forbid it.

Upvotes: 4

Related Questions