Pergunta

I read that 'branch' of SVN uses a cheap copy(hard link) of a revision. Here is the link. http://svnbook.red-bean.com/en/1.7/svn.branchmerge.using.html The 'Creating a branch' chapter deals with that.

But the book also says 'As far as Subversion is concerned, these two commits affected different files in different repository locations.' in the 'Working with your branch' chapter.

I think those are conflicted. If a branch is a hard link to a revision in the trunk, a commit to a branch should affect the trunk, not to speak of the branch itself.

How can 'two commits affected different files in different repository locations' be possible?

Foi útil?

Solução

Yeah SVN uses something similar to a hard link to reference files of the same revision. But as soon as you modify a file, it splits away from that hard link to create a revision of that particular file. The thing with branching is that most of the time you only change a few files out of hundreds. So the deal with "cheap copying" is to make branching both time- and storage-efficient.

As the document you pointed to says:

Subversion's repository has a special design. When you copy a directory, you don't need to worry about the repository growing huge—Subversion doesn't actually duplicate any data. Instead, it creates a new directory entry that points to an existing tree. If you're an experienced Unix user, you'll recognize this as the same concept behind a hard link.

As further changes are made to files and directories beneath the copied directory, Subversion continues to employ this hard link concept where it can. It duplicates data only when it is necessary to disambiguate different versions of objects.

Outras dicas

Right after 'svn copy', the branch is actually a hard-link to a revision.

But if something is committed to that branch, a new revision is created by 'bubble-up' method. So that branch is not a simple hard-link any more.

The documents about 'bubble-up' helps a lot.

Licenciado em: CC-BY-SA com atribuição
Não afiliado a StackOverflow
scroll top