21
edits
Changes
→branches
== SVN Basics ==
=== Directory Structure ===
|-- Team_Repository_Account
+--branches
| +-- member-id1 <-- this is the studenta team member's home in within branches
| +-- Task1
| +-- Task2
| +-- member-id2 <-- this is a team member's home within branches
| +-- Task1
| +-- Task2
| +-- Task3
| +-- member-id3 <-- this is a team member's home within branches
| +-- Task1
+--tags
</pre></big>
==== Branches branches ====* '''Branchesbranches''' is a the common place directory for all team members' workspaces. * Each team member should create a their own home directory or '''workspace''' (member-id1, member-id2,...) for his their own development tasks in within '''branches'''. * The Each team-member's should divide their workspace is then divided in into several sub-directories (workspaces) during the development of the project. These workspaces(Task1, Task2, ...) are usually copies of the '''trunk''' to be worked on.*: ''These sub-directories(Task1, Task2,...) are called branches of trunk. Also Note that when When the word '''branch''' is used as a verb, it means copying the whole '''trunk ''' into a subdirectorysub-directory, either in '''Branchesbranches''' or '''tags'''.(This method of development is called [http://svnbook.red-bean.com/en/1.5/svn-book.html#svn.branchmerge.commonpatterns.feature Feature Branching] ==== Tags tags ====* '''tags''' is the directory that holds '''copies''' of successful stages of '''trunk''' during throughout development. (''Also called as '''Milestones''''')* '''tags''' are never modified or edited. ''You may branch the a directory of tag into branches under a workspace and then modify it the branch and apply the changes back to trunk, but you should never change the contents of a tag should never change''* The action of '''branchingbranch''' ing the trunk into '''tags''' is often referred to as a '''release'''.* Most importantly, we We use the '''tags''' directory to submit the work to the professor to be markedfor marking. ''Your professor instructor will specify what are the requirements of a release.** A release is usual usually tagged by a version number like: R0.1, Prj0.2, As1_1.0 ** When a release is due, your instructor will always mark the latest version of that realease will be markedrelease. **: ''If R0.3 is due, and in '''tags''' R0.3, R0.31, R0.32 are presentin '''tags''', then your instructor will mark R0.32 will be marked ==== Trunk trunk ====* '''trunk''' IS is the directory that holds the project at in its current stagedstage, '''complied and run-able'''* '''trunk''' should never be at a hold non-complied stagecompiled code. (usually Usually trunk should be the is an exact copy as (or better than) the last latest version in '''tags)'''.* If the repository only contains one project is done within this repository, then trunk has no project level subdirectory sub-directory and is the root of the project, otherwise. Ifthe repository holds more than one project, trunk is divided into several sub-directories - one for each project to be version-controlled.*: ''In this case Tags should also be divided to , we divide '''tags''' into exactly the exact same project sub-directories as present in '''trunk'''''
=== Basic Actions ===
==== checkout ====
To '''checkout''' is to copy the code form from a repository server to a versioned directory on the client, so that you can start working on the code.==== branch ====To '''branch''' is to copy one directory on the repository server into another directory on the repository server.: Note that '''branch'''ing the code copies iton '''the repository''' itself and not on the local (client) machine. To work on the '''branch'''ed (copied) code, you must '''checkout''' the directory to which you copied the '''branch'''.
==== add ====
To '''add''' is to flag a non-versioned file or directory to be added to the repository server at next '''commit'''
==== commit ====
To '''commit''' is to apply (or that is, to copy) your modifications and additions to the repository server.==== branch ===='''branch''' is to copy a directory (like trunk) into another directory on the repository server.: Note that after '''braching''' the code is copied on '''the repository''' and not the local(client) machine. To actually work on the branched (copied) code you must '''checkout''' the directory after branching.
==== merge ====
To '''"merge"''' is to merge a branched directory back to the original directory; that is, to apply to the opposite of original directory those modifications and additions that you have made to your '''branch'''ed directory. : '''"merge"''' merges back a branched directory, back to is the original directory to apply the modifications and additions to the branched direcotryopposite of '''branch'''.
==== export ====To '''export''' is to copy the whole or part of a repository to a non-versioned directory on the client machine: You '''export''' when you want either to package the project, to make it ready for production, or to copy a piece of work from one repository to another repository.==== import ====To '''import''' is to copy a non-versioned work (directory) to the repository server.: Note that although the imported code is on the server, it is still NOT versioned on the client machine. To start working on an imported directory, you need first to '''checkout''' the directory from the repository to the client machine. == Starting the a Project On SVN ==There are two possibilities ways to initiate a projecton SVN:# Start To start the project from zero#: This is We do this when you we create a an empty project and start to write the code yourselffrom scratch# Start To start the project by continuing an existing work#: This is We do this when you have someone else has started the project started by someone else (i.e. Professorthat is, the professor, other team-members, etc.) and you we want to copy the work into your our own repository and continue the that work.
=== Start the Project from zero ===
=== Start the project by continuing an existing work ===
# Copy the basic framework initial code into the '''trunk ''' of your repository#: If the basic framework in provided code is available in another repository (namely RepAsay RepoSrc) , you should copy it by '''export'''ing it from RepoSrc into '''trunk ''' of your repository (namely RepBsay RepoDest)#:# '''update''' RepA RepoSrc to make sure that it is in sync with the server.#:# Right click on direcotry the directory with the basic framework is provided initial code in RepA RepoSrc and select "'''...SVN/export"'''.#:# Select the '''trunk ''' of RepB your own repository (RepoDest) and click OK#:#: This will create a "non-version-controlledversioned" copy of the basic framework initial code in RepBRepoDest/trunk# Do any modification needed to make the framework initial code ready for your own work# Right click on RepBRepoDest/trunk and select '''Add''' and . Then choose the files needed to be that you would like "versioned"# Finally, '''Commit''' The the '''trunk ''' to copy the those files to the SVN server.
== Preparing Your Own Workspace for Development ==
Create a home directory in '''branches''' for your development and name that directory with your seneca-id. Then '''branch''' the trunk into the proper workspace in your home directory under '''branches'''. Finally '''update''' your workspace, so that the code is added to your copy of the repository on your machine. These are the detailed steps:
#:* Select HEAD revision or a specific revision if necessary (mostly head revision applies in our case)
#:* Add a proper descriptive message for to inform others to know about what you have done
#:* Click on OK
#: This copies the trunk into a branch so you can start your own implementation, but note that this . This action is done on '''server''' and your local copy of the repository still remains the sameunchanged.# Right click on '''branches''' and click '''SVN update''', this . This will bring download the new branch to your local machine. == working on Working within your branch/workspace own Workspace ==* You can now start implementing to implement your assigned tasks. *: Unlike trunk, since this is YOUR workspace you can leave it an YOUR workspace in any stage state you like. don't forget to comment Comment each and every and each of your '''commit'''s so that later you know which commit belongs to what and also helps your professor knows what to mark your. * '''If you do not comment a COMMIT, it means that it is was minor and does not need to be marked'''* You can work form home, commit your work( make sure you add comment to your commit) and them , come to school , checkout your committed code work and commit , and continue later.* Make sure if If you are working on a public computer, you make sure to delete the your work from local computer, after you have committed it to the repository.
*: <big>'''It is your responsibility to keep your code safe'''</big>
* If you have any problem with your code, and need help, contact your professor, send the path of your workspace. If needed, he can checkout your code see what is wrong with it and , leave comments on it , and commit it. Afterwards, all you need to do is update your repo and read the comments and corrected code.
== Merging your work back to trunk ==
After you have done completed your work in within your own workspace and your work code compiles and is compiling and ready to go, to you can merge your work back to trunk. These are the detailed steps:# Right click on '''trunk ''' or '''trunk/prj''', depending on what you branched into branches # Select "...SVN/Merge" and , select "reintegrate a branch" , and click on next.
# Make sure "From URL" is the branch you want to merge and click on next.
# click Click on "test merge" to see if the merge is done successfullysuccessful.# click Click on "merge" to merge the branch back to trunk# now Now update the trunk to have apply the possible changes applied.# if If there is are any conflict conflicts, click on "...SVN/edit conflicts" and fix the each conflict, save and click on conflict resolved"# check Check the trunk status in your team page on the wiki#:* If the trunk status is "committed" then change it to "being commited committed by your_name"#:* If the trunk status is "being committed by member_name", wait for the commit them to complete their commit and to go to previous step.# commit Commit the trunk and when done, update the truck status to "commited committed by your_name"# if If this commit was worth recording, branch it in the tags directory under a new release.
If you are having the receive a "branch/project must be ancestrally related to trunk/project" error, try going into your trunk and right click > merge one file at a time. Make sure to click the "show log" button in the merge wizard to get the latest revision for the merge added for you.
== Resources ==
* [[SVN]]