5
votes

There are a couple of points about SVN revision numbering on a branch which are not clear to me:

  1. When I create a branch, does the branch get its own revision number?
  2. How does SVN does handle the revision numbering on the branch? Does branch have its own sequence of revision numbers separate from the Trunk and other branches? Or there is only one single sequence numbering for the whole SVN server? To clarify, please explain what happens when a commit is done on a branch.
2

2 Answers

11
votes

When I create a branch, does the branch get its own revision number?

No. There is only one global revision number for the whole repository.

The commit that creates the branch will get a revision number.

To clarify, please explain what happens when a commit is done on a branch.

Subversion itself does not really have special support or understanding for branches. This is all conventions built on how to lay out files in a directory structure.

So there is no difference between committing a file on "trunk" and committing a file on a "branch". In fact, the same commit can change files across many branches.

There is no difference to subversion internally between creating a branch and copying a directory. We (as users) just assign a different meaning to it.

Same thing with "tags". Those are just copies of your code at a certain time moved to another directory (just like a branch), that you intend to keep around without ever changing them again (but Subversion itself does not enforce that).

3
votes
  1. Yes. Revision numbers belong to the repository; every commit gets its own revision number.

  2. The branch is just a subfolder in the repository. It gets revision numbers which are unique across the whole repo, just like every other subfolder. When you commit to a branch, it works exactly the same as when you commit to any other folder of the repo.