Reputation: 19342
I come from a git
background so apologies for any gross svn-misconceptions causing this question.
In git, when switching between branches
, the working copy is always say "adjusted" to reflect the staged files.
So e.g. when working in branchA
, which incorporates a folder named branchA-folder
, and the master
branch does not have this folder yet, running git checkout master
(ok, after having stashed or committed your changes) will make the folder branchA-folder
"dissapear" from your filesystem (working directory), right?
Unless I am wrong, this allows git
to maintain one local copy of your working dir which always reflects the (staged) status of your branch.
What is the case when it comes to svn
?
svn switch <branchA-url>
) make the branchA-folder
"dissapear"?Thx.
Upvotes: 1
Views: 911
Reputation: 1847
To understand how svn deals with things you need to realize, that SVN does not really support tags and braches. Branch/tag is just a copy of trunk directory placed in some other subdirectory. To make it manageable somehow, svn implements "cheap" copies (but only on server side).
Will the above switch (svn switch branchA-url) make the branchA-folder "dissapear"?
Yes. It will be removed from working copy (if it is versioned by SVN). You can even do svn switch ^/branchA-url/branchA-folder
- there is no difference between directory and branch from SVN point of view.
Does svn maintain one actual copy of the working dir per branch/tag?
I am not sure if I understand your question correctly - SVN does not duplicate directory content in central server if svn copy
was properly used to create a directory (or branch, or tag). No, if you did cp
and svn add
by hand. This is worse than git (every object in git "database" is stored exactly once).
Upvotes: 0
Reputation: 146450
I believe the relevant difference to take into account is that Subversion allows to check out as many working copies as you want and have them exist simultaneously because a working copy is just a directory with an attached repository URL. So when you switch to a branch Subversion assumes you want to keep your local changes and will just merge incoming changes into them (if any). It's also forced to assume that because there's currently no shelving feature: there's nowhere to save your changes for later.
Disclaimer: I don't have any git background
Upvotes: 2