Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

SVN - When you tag a working copy is it still a cheap copy?

Using Subversion, in my working copy I make a minor modification (update a version number). I would then like to tag my working copy. Would this tag still be a cheap copy with the modification, or would SVN duplicate the files? I would hate to see my repository grow enormously in size because I'm trying to save a version number change.

The reason I ask about creating a tag that contains a modification rather than committing then tagging involves my build server. The build server creates a CCNetLabel which I use to update the version numbers of my projects (AssemblyInfo.cs). When the build is successful it creates a tag. When I use ForceBuild the tag is based on the working copy which would contain the modified version number. I want the tag to contain the appropriate version number.

note: It's debatable if I'm creating a branch or a tag, however SVN does not make a distinction between the two.

like image 562
mcdon Avatar asked Mar 07 '10 08:03

mcdon


People also ask

How do svn tags work?

Version Control System supports the tag operation by using that concept that one can give meaningful name to a specific version of the code. Tag allows to give descriptive and memorable names to specific version of code. For example BASIC_ARRAY_OPERATIONS is more memorable than revision 4.

What is a working copy in svn?

Working copies A Subversion working copy is your own private working area, which looks like any other ordinary directory on your system. It contains a COPY of those files which you will have been editing on the website. You can edit these files however you wish, in the usual way.

What is the difference between tag and branch 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.

What is the working copy?

A working copy is the copy you have checked out to your working area. It doesn't matter if it is a branch or from the trunk. It's what you are working on.


4 Answers

It depends. If your working copy is up to date (all nodes have the same revision) it is just as cheap as tagging from the repository.

For every file/directory (or actually subtree) with a different revision than its parent additional data will be added. And if you have local modifications even more data will be added.

But it is still reasonable cheap: It doesn't duplicate any files that are already in the repository.

like image 196
Bert Huijben Avatar answered Sep 23 '22 07:09

Bert Huijben


From the subversion description

  • Branching and tagging are cheap (constant time) operations. There is no reason for these operations to be expensive, so they aren't. Branches and tags are both implemented in terms of an underlying "copy" operation. A copy takes up a small, constant amount of space. Any copy is a tag; and if you start committing on a copy, then it's a branch as well. (This does away with CVS's "branch-point tagging", by removing the distinction that made branch-point tags necessary in the first place.)

Note! I just noticed that Subversion has been moved into the Apache project organization

like image 35
epatel Avatar answered Sep 27 '22 07:09

epatel


Quite an out of date post but worth mentioning for anyone visiting that the answer stating you can only 'You can only tag data that has already been committed into the repository...' committed work is not completely accurate (at least not now).

You can tag a working copy, which could contain mixed revisions and even switched directories as well as local modifications.

As for cheapness, yes it should still be cheap as Subversion will branch for you, then overlay your working copy changes into the repo, saving as much space as possible

like image 27
Rob Avatar answered Sep 24 '22 07:09

Rob


Creating a tag or a branch in subversion is very cheap. The files will not be copied. All that happens is that a new revision will be created, the content of which basically just contain a pointer to where the tag was copied from. This will be the same size for a tag of a project with one small file or for one with a million big ones.

When you say "tag my working copy", do you mean "tag my working branch"? You can only tag data that has already been committed into the repository somewhere, not your local uncommitted changes.

like image 45
Thilo Avatar answered Sep 25 '22 07:09

Thilo