Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

SVN tags: How not to update/checkout them?

Tags:

svn

tags

In many projects, I check out the complete repository and have then the standard directory structure:

project/
    branches/
    tags/
    trunk/

If I do an svn up project, it's all fine with the branches and trunk folders, but, of course, the tags folder is updated, too, and filled with (mostly) lots of tagged versions that are of no value for my work and only occupy disk space.

How can I except the tags folder from an svn update? Especially, how can I do this locally only, that is, without committing that back to the repository, as a solution with the svn:ignore keyword would do?

like image 942
Boldewyn Avatar asked May 18 '10 08:05

Boldewyn


People also ask

How do tags work in svn?

A tag is just a “snapshot” of a project in time. In Subversion, this idea already seems to be everywhere. Each repository revision is exactly that—a snapshot of the filesystem after each commit. However, people often want to give more human-friendly names to tags, such as release-1.0 .

Can you commit to a tag in svn?

In SVN, tag is just a copy in /tags directory, so commiting is possible, but that's just an implementation detail. Nothing prevents you from commiting, but it's unusual, and people using the tag may be confused what exactly this tag represent ... original revision when tag was created or new changes.

What is different between branch and tag in svn?

There is no difference between branches and tags in Subversion. The only difference is in what the user then does with the directory. Branches are typically created, edited, and then merged back into the trunk. Alternatively, tags are created as a snapshot of the project at a point in time and then never changed.


2 Answers

Subversion has a feature called Sparse Checkout for this case.

svn up --set-depth empty project/tags

This will remove all checked out tags, leaving only the "tags" directory behind.

Another option is:

svn up --set-depth immediates project/tags

which will check out the tag directories itself, but not their content.
This way you can easily see new tags and get the contents of single tags with:

svn up --set-depth infinity project/tags/mytag

Edit:

This is working with elcucos solution, too and you can even use it for your branches directory.

like image 103
Hardcoded Avatar answered Sep 19 '22 02:09

Hardcoded


First you check out the top of the project in non recursive way (-N or --non-recursive)

svn co https://server/project -N my_project_checkout

Now at this stage you can update only the trunk:

svn up my_project_checkout/trunk
like image 29
elcuco Avatar answered Sep 21 '22 02:09

elcuco