When does svn BASE become equal to the HEAD
Asked Answered
C

4

28

I had a question regarding the BASE version in svn. I know it is the pristine version of an item from the last time update was run and svn diff and status basically run against this version. When does the BASE get updated? Does it get updated to the HEAD when update is run? Is this always true even if there was a conflict during update? What does BASE have incase of a conflict? Does it still have the version from my last update(before the most recent update that caused a conflict) or will it be updated to the HEAD even if there is a conflict?
Also when svn commit is run I am assuming the BASE gets updated with my local changes and at this point BASE, HEAD and my local copy all are the same? Provided the commit was successful.

Cottage answered 13/4, 2009 at 1:17 Comment(0)
B
40

HEAD is the latest revision in the repository. BASE is the last revision you have obtained from the repository. They are the same after a successful commit or update.

When you make changes, your files differ from the BASE copies. When you revert, they go back to matching the BASE revision. When you get a conflict, you do not update the repository. Rather, your files are considered to still be "being edited" as if you were making changes. After you resolve conflicts, you have in essence decided what the final files will look like and you then commit them as you would have normally. So, conflicts are like a case of special editing.

Baran answered 13/4, 2009 at 7:14 Comment(2)
They are the same, however briefly, after an update, though not necessarily after a commit. Consider directories and "mixed revision working copies".Discontinuance
Apparently creating these "mixed revision working copies" -- which means you can create a commit without complete knowledge of what's going on -- is a consequence of one of the "fundamental rules of Subversion".Shaw
D
7

BASE is the revision of your working copy as it exists in the repository. In other words, your revision without the changes you've made. So if you svn update a file or folder to HEAD, then BASE and HEAD are equal.

When there is a conflict, BASE becomes the revision before the commit that conflicted with your working copy.

Run svn info on an item to see it's BASE revision.

Revision Specifiers

Downhearted answered 13/4, 2009 at 6:20 Comment(0)
U
3

It matters when you are viewing logs, because svn log without url shows your BASE log, but with url your HEAD log, that's why i always use "svn log -rHEAD:1" to see all the changes.

Unspoiled answered 14/10, 2009 at 8:44 Comment(0)
H
0

Theory: After a successfull recursive update or switch the base version of all your files becomes head. After a commit or partial update some files might be at the HEAD revision, but only after an update that didn't skip files you can be sure that all files are at the same version. (Reasons for skipping are unversioned obstructions or conflicts).

But, why would you need to know this. Subversion should know this internally, but this knowledge shouldn't really matter to the user in most cases. (Subversion automatically warns you when files are out of date).

As far as I can tell, the only time you really need to make sure that you are at a stable version is, when you are creating a branch from a working copy.

Hold answered 13/4, 2009 at 20:26 Comment(1)
I just wanted to figure out how svn works and its implementation details. Thanks for your response.Cottage

© 2022 - 2024 — McMap. All rights reserved.