Difference between revisions of "Hints for Using SVN to collaborate on school projects"

From CDOT Wiki
Jump to: navigation, search
(Preparing Branches/workspace for development)
(branches)
 
(41 intermediate revisions by 3 users not shown)
Line 1: Line 1:
Under construction<br />
+
This is a "how to" document for using a graphical user interface with SVN. Graphical user interfaces include
This text is a "how to" document to be used with a graphical user interface with SVN, like [[RabbitVCS]] for linux or [http://www.rapidsvn.org/download/release/0.12/RapidSVN-0.12.0-8051.dmg RapidSVN] for Mac or [http://tortoisesvn.net/downloads TortoiseSVN] for Windows.
+
* [[RabbitVCS]] for linux
Help making this better by adding SVN command line commands for examples.
+
* [http://www.rapidsvn.org/download/release/0.12/RapidSVN-0.12.0-8051.dmg RapidSVN] for Mac
 +
* [http://tortoisesvn.net/downloads TortoiseSVN] for Windows
 +
<br />
 +
Help improve this document by adding SVN command line commands for examples.
 
== SVN Basics ==
 
== SVN Basics ==
 
=== Directory Structure ===
 
=== Directory Structure ===
Line 7: Line 10:
 
|-- Team_Repository_Account
 
|-- Team_Repository_Account
 
   +--branches
 
   +--branches
   | +-- member-id1  <-- this is the student's home in branches
+
   | +-- member-id1  <-- this is a team member's home within branches
 
   |  +-- Task1
 
   |  +-- Task1
 
   |  +-- Task2
 
   |  +-- Task2
   | +-- member-id2
+
   | +-- member-id2 <-- this is a team member's home within branches
 
   |  +-- Task1
 
   |  +-- Task1
 
   |  +-- Task2
 
   |  +-- Task2
 
   |  +-- Task3
 
   |  +-- Task3
   | +-- member-id3
+
   | +-- member-id3 <-- this is a team member's home within branches
 
   |  +-- Task1
 
   |  +-- Task1
 
   +--tags
 
   +--tags
Line 31: Line 34:
 
</pre></big>
 
</pre></big>
  
==== Branches ====
+
==== branches ====
* '''Branches''' is a common place for all team members' workspaces.  
+
* '''branches''' is the common directory for all team members' workspaces.  
* Each team member should create a home directory or '''workspace''' (member-id1, member-id2,...) for his own development tasks in branches.  
+
* Each team member should create their own home directory or '''workspace''' (member-id1, member-id2,...) for their own development tasks within '''branches'''.  
* The team-member's workspace is then divided in several directories (workspaces) during the development of the project. These workspaces(Task1, Task2, ...) are usually copies of the '''trunk''' to be worked on.
+
* Each team member should divide their workspace 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 directories(Task1, Task2,...) are called branches of trunk. Also Note that when the word '''branch''' is used as a verb, it means copying the whole trunk into a subdirectory, either in '''Branches''' or '''tags'''.
+
*: ''These sub-directories(Task1, Task2,...) are called branches of trunk. When the word '''branch''' is used as a verb, it means copying the whole '''trunk''' into a sub-directory, either in '''branches''' 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''' directory holds '''copies''' of successful stages of '''trunk''' during development. (''Also called as '''Milestones''''')
+
==== tags ====
* '''tags''' are never modified or edited. ''You may branch the a directory of tag into branches under a workspace and then modify it and apply the changes back to trunk, but the contents of a tag should never change''
+
* '''tags''' is the directory that holds '''copies''' of successful stages of '''trunk''' throughout development. (''Also called as '''Milestones''''')
* The action of '''branching''' the trunk into '''tags''' is often referred to as a '''release'''.
+
* '''tags''' are never modified or edited. ''You may branch a directory of tag into branches under a workspace and then modify the branch and apply the changes back to trunk, but you should never change the contents of a tag''
* Most importantly, we use the '''tags''' directory to submit the work to the professor to be marked. ''Your professor will specify what are the requirements of a release.
+
* The action of '''branch'''ing the trunk into '''tags''' is often referred to as a '''release'''.
** A release is usual tagged by a version like: R0.1, Prj0.2, As1_1.0  
+
* We use the '''tags''' directory to submit the work for marking. ''Your instructor will specify the requirements of a release.
** When a release is due, always the latest version of that realease will be marked.  
+
** A release is usually tagged by a version number like: R0.1, Prj0.2, As1_1.0  
**: ''If R0.3 is due, and in '''tags''' R0.3, R0.31, R0.32 are present, then R0.32 will be marked
+
** When a release is due, your instructor will always mark the latest version of that release.  
==== Trunk ====
+
**: ''If R0.3 is due, and R0.3, R0.31, R0.32 are present in '''tags''', then your instructor will mark R0.32
* '''trunk''' IS the project at current staged, '''complied and run-able'''
+
 
* '''trunk''' should never be at a non-complied stage. (usually trunk should be the exact copy as (or better than) the last version in tags).
+
==== trunk ====
* If only one project is done within this repository, then trunk has no project level subdirectory and is the root of the project, otherwise, trunk is divided into several directories for each project to be version-controlled.
+
* '''trunk''' is the directory that holds the project in its current stage, '''complied and run-able'''
*: ''In this case Tags should also be divided to the exact same project directories as trunk''
+
* '''trunk''' should never hold non-compiled code. Usually trunk is an exact copy (or better than) the latest version in '''tags'''.
 +
* If the repository only contains one project, then trunk has no project level sub-directory and is the root of the project.  Ifthe repository holds  more than one project, trunk is divided into several sub-directories - one for each project.
 +
*: ''In this case, we divide '''tags''' into exactly the same project sub-directories as present in '''trunk'''''
 +
 
 
=== Basic Actions ===
 
=== Basic Actions ===
To explain basic actions we have to clear few facts and terminology:
+
A few important facts and terminology to help clarify the basic actions:
*Responsibility of a code repository is to keep track of all the modifications done to a project by different members.  
+
* One responsibility of a code repository is to keep track of all of the modifications done to a project by its team members.  
*:In other words, when a project handled by a code repository (version-controlled or in short versioned) you can track any changes done through the development life of the project; like who modified/added/deleted what and when. You can undo any work or rollback the work to any stage of the development and much more.
+
*:In a project that is tracked by a code repository (version-controlled or in short versioned), you can focus on any changes during the project's development life; such as, who modified/added/deleted what and when. You can undo work or rollback the work to any stage of the development and much more.
* SVN a client/server based repository;
+
* SVN is a client/server repository;
*: Which means the code is kept on a server and those with access can copy the whole, or pieces of the project to their local machines and work on them and then apply the changes back to the server. Note that because if this fact, one member could be unaware of the changes make by another member, unless the first one applies the changes to the server.
+
*: Code is kept on a server and those members who have access can copy the whole or parts of the project to their local machines, work on the whole or parts and then apply their changes back to the server. Because of the code is kept on a server, one member may be unaware of the changes made by another member, unless the other has applied the changes to the server and the member has update their local copy.
* Merging all the modifications by different members into the repository is another responsibility of SVN.
+
* Merging the modifications of different members into the repository is another responsibility.
* a '''Version-controlled or versioned''' file, is a file that is handled and tracked by a repository  
+
* A '''Version-controlled or versioned''' file is a file that is handled and tracked by a repository  
==== import ====
 
'''import''' is to copy non-versioned work (directory) to a repository server.
 
: note that in this case the imported code is on the server and is still NOT versioned on the client machine; to start working on an imported directory, you should fist '''checkout'''  the directory from the repository to the client machine.
 
==== export ====
 
'''export''' is to copy the whole or part of a repository into a non-versioned directory on the client machine
 
: This is usually done when you want to either package the project and make it ready for production or when you and to copy a piece of work form one repository to another repository.
 
 
==== checkout ====
 
==== checkout ====
'''checkout''' is to copy the code form repository server to a versioned directory on the client, so you can start working on it.
+
To '''checkout''' is to copy the code 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 it on '''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 ====
 
==== add ====
'''add''' is to flag a non-versioned file or directory to be added to the repository server at next '''commit'''
+
To '''add''' is to flag a non-versioned file or directory to be added to the repository server at next '''commit'''
 
==== commit ====
 
==== commit ====
'''commit''' is to apply (or copy) your modifications and additions to the repository server.
+
To '''commit''' is to apply (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 ====
 
==== merge ====
'''merge''' is the opposite of '''branch'''.  
+
To '''"merge"''' is to merge a branched directory back to the original directory; that is, to apply to the original directory those modifications and additions that you have made to your '''branch'''ed directory.
: '''"merge"''' merges back a branched directory, back to the original directory to apply the modifications and additions to the branched direcotry.
+
: '''merge''' is the opposite of '''branch'''.
  
== Starting the Project On SVN ==
+
==== export ====
There are two possibilities to initiate a project:
+
To '''export''' is to copy the whole or part of a repository to a non-versioned directory on the client machine
# Start the project from zero
+
: 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.
#: This is when you create a project and start the code yourself
+
==== import ====
# Start the project by continuing an existing work
+
To '''import''' is to copy a non-versioned work (directory) to the repository server.
#: This is when you have the project started by someone else (i.e. Professor,  other team-members, etc.) and you want to copy the work into your own repository and continue the work.
+
: 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 a Project On SVN ==
 +
There are two ways to initiate a project on SVN:
 +
# To start the project from zero
 +
#: We do this when we create an empty project and start to write the code from scratch
 +
# To start the project by continuing existing work
 +
#: We do this when someone else has started the project (that is, the professor,  other team-members, etc.) and we want to copy the work into our own repository and continue that work.
 
=== Start the Project from zero ===
 
=== Start the Project from zero ===
For this you should create the basic framework of your project in trunk, and '''Add''' and '''Commit''' it. This is how you do this:
+
To start from zero, create the initial code of your project in '''trunk''', '''add''' the code, and then '''commit''' it. These are the detailed steps:
 +
 
 +
# '''checkout''' the project repository in a new directory on your local computer;
 +
#:# ''Create a new directory on your local computer, right click on that directory, and then click on '''SVN Checkout'''
 +
#:# In '''URL of the repository''' type your repository path (svn://zenit.senecac.on.ca/....)
 +
#:# Click on ok
 +
# If the basic directories (trunk, tags, branches) don't exist, create them and add them by right clicking on them and selecting '''...SVN/add'''.
 +
# In '''trunk''', create your project, compile it, and run it. (This could be as simple as a few empty files or a Hello world application).
 +
# Right click on the '''trunk''', select '''...SVN/add''', and then select all of the files you would like to add to the repository.
 +
#: Add only those files that you want to track for modification. Only source and project files need to be version-controlled. We don't usually add binary or executable files to the repository. Add them only if you have a reason for doing so.
 +
# Right click on '''trunk''' and select '''SVN Commit''' to commit your work to the repository server.
  
# '''checkout''' the project repository in a new directory on your computer;
 
#:# ''Create a new directory on your computer, right click on it and then click on '''SVN Checkout'''
 
#:# In '''URL of repository''' type your repository path (svn://zenit.senecac.on.ca/....)
 
#:# click on ok
 
# If the basic directories (trunk, tags, branches) don't exist create them and then add them by right clicking on them and selecting '''...SVN/Add'''.
 
# In trunk, create your basic project framework, compile and run it. (this could be as simple as few empty files or a Hello world application).
 
# Right click on the trunk and select '''....SVN/Add''' again and select all the needed file to be added to the repository.
 
#: Add only those files that should be tracked for modification; "Those need to be version-controlled". Binary and Executable files are usually not added to the repository; Only add them if you know what you are doing.
 
# Right click on trunk and select '''SVN Commit''' to commit your work to repository server.
 
 
=== Start the project by continuing an existing work ===
 
=== Start the project by continuing an existing work ===
For this you should have a '''non-versioned''' copy of the basic framework for the project to initiate it. Then you should copy the framework into the trunk, '''add''' and '''commit'''it. This is how it is done:
+
To continue an existing work, you should have a '''non-versioned''' copy of the initial code for your project. Copy this code into the '''trunk''', '''add''' and '''commit''' it. These are the detailed steps:
 
 
# Copy the basic framework into trunk of your repository
 
#: If the basic framework in provided in another repository (namely RepA) , you should copy it by '''export'''ing it into trunk of your repository (namely RepB)
 
#:# '''update''' RepA to make sure it is in sync with the server.
 
#:# Right click on direcotry with the basic framework is provided in RepA and select "...SVN/export".
 
#:# Select the trunk of RepB and click OK
 
#:#: This will create a "non-version-controlled" copy of the basic framework in RepB/trunk
 
# Do any modification needed to make the framework ready for work
 
# Right click on RepB/trunk and select '''Add''' and choose the files needed to be "versioned"
 
# '''Commit''' The trunk to copy the files to the server.
 
  
 +
# Copy the initial code into the '''trunk''' of your repository
 +
#: If the code is available in another repository (say RepoSrc), '''export''' from RepoSrc into '''trunk''' of your repository (say RepoDest)
 +
#:# '''update''' RepoSrc to make sure that it is in sync with the server.
 +
#:# Right click on the directory with the initial code in RepoSrc and select '''...SVN/export'''.
 +
#:# Select the '''trunk''' of your own repository (RepoDest) and click OK
 +
#:#: This will create a "non-versioned" copy of the initial code in RepoDest/trunk
 +
# Do any modification needed to make the initial code ready for your own work
 +
# Right click on RepoDest/trunk and select '''Add'''. Then choose the files that you would like "versioned"
 +
# Finally, '''Commit''' the '''trunk''' to copy those files to the SVN server.
  
== Preparing Branches/workspace for development ==
+
== Preparing Your Own Workspace for Development ==
For this you should create a home direcotry for your development in branches using your seneca-id. Then your should branch the trunk into the proper workspace in your home directory in '''branches'''. Finally you should '''update''', so the new workspace is added to your copy of the repository on your machine. Here is how:
+
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:
  
# Create a directory with your seneca-id in branches and '''add''' it to the repository and then '''commit''' branches to update the repository server.
+
# Create a directory in '''branches''' and name it with your seneca-id
# Right click on the trunk and select '''...SVN/"Branch/Tag"''' to create a branch for your next task  
+
# '''add''' the directory to the repository and '''commit''' branches to update the repository server.
#:* By doing this you will create your first workspace to start implementation in the project. Fore next step, choose a relevant name for the task assigned to you, for example if your project is writing a text editor an your next task is to implement "Copy And Past" feature, then the proper name would something like: "CopyPaste"  
+
# Right click on '''trunk''' and select '''...SVN/"Branch/Tag"''' to create a branch for your next task  
#:* In "To URL" type or select your home dir in the branches dir, then add "/CopyPaste" to it: (svn://RepoUrlAndPath/branches/yourSenecaid/CopyPaste")
+
#:* This will create your first workspace. Choose a relevant name for your assigned task. For example if your project is writing a text editor and your next task is to implement "Copy And Paste" feature, then a suitable name would be: "CopyPaste"  
 +
#:* In "To URL" type or select your home sub-directory in the '''branches''' directory and add "/CopyPaste" to it: (svn://RepoUrlAndPath/branches/yourSenecaid/CopyPaste")
 
#:* Select HEAD revision or a specific revision if necessary (mostly head revision applies in our case)
 
#:* Select HEAD revision or a specific revision if necessary (mostly head revision applies in our case)
#:* Add a proper message for others to know what you have done
+
#:* Add a descriptive message to inform others about what you have done
 
#:* Click on OK
 
#:* Click on OK
#: This copies the trunk into a branch so you can start your implementation, but note that this action is done on '''server''' and your local copy of repository still remains the same.
+
#: This copies the trunk into a branch so you can start your own implementation. This action is done on '''server''' and your local copy of the repository remains unchanged.
# Right click on '''branches''' and click '''SVN update''', this will bring the new branch to your machine.
+
# Right click on '''branches''' and click '''SVN update'''. This will download the new branch to your local machine.
== working on your branch/workspace ==
+
 
You can now start implementing your assigned tasks. Unlike trunk, since this is YOUR workspace you can leave it an any stage you like. don't forget to comment every and each of your '''commit'''s so later you know which commit belongs to what and also helps your professor to mark your.  
+
== Working within your own Workspace ==
 +
You can now start to implement your assigned tasks.  
 +
* Unlike trunk, you can leave YOUR workspace in any state you like. Comment each and every '''commit'''s so that later you know which commit belongs to what and your professor knows what to mark.
 +
* '''If you do not comment a COMMIT, it means that it was minor and does not need to be marked'''
 +
* You can work form home, commit your work, come to school, checkout your committed code, and continue later.
 +
* If you are working on a public computer, make sure to delete your work, 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, 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 completed your work within your own workspace and your code compiles and is ready to go, 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", select "reintegrate a branch", and click on next.
 +
# Make sure "From URL" is the branch you want to merge and click on next.
 +
# Click on "test merge" to see if the merge is successful.
 +
# Click on "merge" to merge the branch back to trunk
 +
# Now update the trunk to apply the changes.
 +
# If there are any conflicts, click on "...SVN/edit conflicts" and fix each conflict, save and click on conflict resolved"
 +
# Check the trunk status in your team page on the wiki
 +
#:* If the trunk status is "committed" then change it to "being committed by your_name"
 +
#:* If the trunk status is "being committed by member_name", wait for them to complete their commit and go to previous step.
 +
# Commit the trunk and when done, update the truck status to "committed by your_name"
 +
# If this commit was worth recording, branch it in the tags directory under a new release.
 +
 
 +
 
 +
If you 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.
  
'''If you do not comment a COMMIT, it means it is minor and does not need to be marked'''
+
== Resources ==
 +
* [[SVN]]

Latest revision as of 01:29, 13 February 2012

This is a "how to" document for using a graphical user interface with SVN. Graphical user interfaces include


Help improve this document by adding SVN command line commands for examples.

SVN Basics

Directory Structure

|-- Team_Repository_Account
  +--branches
  | +-- member-id1  <-- this is a team member's home 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
  | +-- R0.1
  | +-- R0.11
  | +-- R0.2
  | +-- R0.21
  | +-- ...
  | +-- R0.5
  | +-- ...
  | +-- R1.0
  | +-- R1.1
  | +-- R1.2
  | +-- R1.21
  +--trunk

branches

  • branches is the common directory for all team members' workspaces.
  • Each team member should create their own home directory or workspace (member-id1, member-id2,...) for their own development tasks within branches.
  • Each team member should divide their workspace 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. When the word branch is used as a verb, it means copying the whole trunk into a sub-directory, either in branches or tags. (This method of development is called Feature Branching

tags

  • tags is the directory that holds copies of successful stages of trunk throughout development. (Also called as Milestones)
  • tags are never modified or edited. You may branch a directory of tag into branches under a workspace and then modify the branch and apply the changes back to trunk, but you should never change the contents of a tag
  • The action of branching the trunk into tags is often referred to as a release.
  • We use the tags directory to submit the work for marking. Your instructor will specify the requirements of a release.
    • A release is 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 release.
      If R0.3 is due, and R0.3, R0.31, R0.32 are present in tags, then your instructor will mark R0.32

trunk

  • trunk is the directory that holds the project in its current stage, complied and run-able
  • trunk should never hold non-compiled code. Usually trunk is an exact copy (or better than) the latest version in tags.
  • If the repository only contains one project, then trunk has no project level sub-directory and is the root of the project. Ifthe repository holds more than one project, trunk is divided into several sub-directories - one for each project.
    In this case, we divide tags into exactly the same project sub-directories as present in trunk

Basic Actions

A few important facts and terminology to help clarify the basic actions:

  • One responsibility of a code repository is to keep track of all of the modifications done to a project by its team members.
    In a project that is tracked by a code repository (version-controlled or in short versioned), you can focus on any changes during the project's development life; such as, who modified/added/deleted what and when. You can undo work or rollback the work to any stage of the development and much more.
  • SVN is a client/server repository;
    Code is kept on a server and those members who have access can copy the whole or parts of the project to their local machines, work on the whole or parts and then apply their changes back to the server. Because of the code is kept on a server, one member may be unaware of the changes made by another member, unless the other has applied the changes to the server and the member has update their local copy.
  • Merging the modifications of different members into the repository is another responsibility.
  • A Version-controlled or versioned file is a file that is handled and tracked by a repository

checkout

To checkout is to copy the code 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 branching the code copies it on the repository itself and not on the local (client) machine. To work on the branched (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 (that is, to copy) your modifications and additions to the repository server.

merge

To "merge" is to merge a branched directory back to the original directory; that is, to apply to the original directory those modifications and additions that you have made to your branched directory.

merge is the opposite 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 a Project On SVN

There are two ways to initiate a project on SVN:

  1. To start the project from zero
    We do this when we create an empty project and start to write the code from scratch
  2. To start the project by continuing existing work
    We do this when someone else has started the project (that is, the professor, other team-members, etc.) and we want to copy the work into our own repository and continue that work.

Start the Project from zero

To start from zero, create the initial code of your project in trunk, add the code, and then commit it. These are the detailed steps:

  1. checkout the project repository in a new directory on your local computer;
    1. Create a new directory on your local computer, right click on that directory, and then click on SVN Checkout
    2. In URL of the repository type your repository path (svn://zenit.senecac.on.ca/....)
    3. Click on ok
  2. If the basic directories (trunk, tags, branches) don't exist, create them and add them by right clicking on them and selecting ...SVN/add.
  3. In trunk, create your project, compile it, and run it. (This could be as simple as a few empty files or a Hello world application).
  4. Right click on the trunk, select ...SVN/add, and then select all of the files you would like to add to the repository.
    Add only those files that you want to track for modification. Only source and project files need to be version-controlled. We don't usually add binary or executable files to the repository. Add them only if you have a reason for doing so.
  5. Right click on trunk and select SVN Commit to commit your work to the repository server.

Start the project by continuing an existing work

To continue an existing work, you should have a non-versioned copy of the initial code for your project. Copy this code into the trunk, add and commit it. These are the detailed steps:

  1. Copy the initial code into the trunk of your repository
    If the code is available in another repository (say RepoSrc), export from RepoSrc into trunk of your repository (say RepoDest)
    1. update RepoSrc to make sure that it is in sync with the server.
    2. Right click on the directory with the initial code in RepoSrc and select ...SVN/export.
    3. Select the trunk of your own repository (RepoDest) and click OK
      This will create a "non-versioned" copy of the initial code in RepoDest/trunk
  2. Do any modification needed to make the initial code ready for your own work
  3. Right click on RepoDest/trunk and select Add. Then choose the files that you would like "versioned"
  4. Finally, Commit the trunk to copy 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:

  1. Create a directory in branches and name it with your seneca-id
  2. add the directory to the repository and commit branches to update the repository server.
  3. Right click on trunk and select ...SVN/"Branch/Tag" to create a branch for your next task
    • This will create your first workspace. Choose a relevant name for your assigned task. For example if your project is writing a text editor and your next task is to implement "Copy And Paste" feature, then a suitable name would be: "CopyPaste"
    • In "To URL" type or select your home sub-directory in the branches directory and add "/CopyPaste" to it: (svn://RepoUrlAndPath/branches/yourSenecaid/CopyPaste")
    • Select HEAD revision or a specific revision if necessary (mostly head revision applies in our case)
    • Add a descriptive message to inform others about what you have done
    • Click on OK
    This copies the trunk into a branch so you can start your own implementation. This action is done on server and your local copy of the repository remains unchanged.
  4. Right click on branches and click SVN update. This will download the new branch to your local machine.

Working within your own Workspace

You can now start to implement your assigned tasks.

  • Unlike trunk, you can leave YOUR workspace in any state you like. Comment each and every commits so that later you know which commit belongs to what and your professor knows what to mark.
  • If you do not comment a COMMIT, it means that it was minor and does not need to be marked
  • You can work form home, commit your work, come to school, checkout your committed code, and continue later.
  • If you are working on a public computer, make sure to delete your work, after you have committed it to the repository.
    It is your responsibility to keep your code safe
  • 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, 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 completed your work within your own workspace and your code compiles and is ready to go, you can merge your work back to trunk. These are the detailed steps:

  1. Right click on trunk or trunk/prj, depending on what you branched into branches
  2. Select "...SVN/Merge", select "reintegrate a branch", and click on next.
  3. Make sure "From URL" is the branch you want to merge and click on next.
  4. Click on "test merge" to see if the merge is successful.
  5. Click on "merge" to merge the branch back to trunk
  6. Now update the trunk to apply the changes.
  7. If there are any conflicts, click on "...SVN/edit conflicts" and fix each conflict, save and click on conflict resolved"
  8. Check the trunk status in your team page on the wiki
    • If the trunk status is "committed" then change it to "being committed by your_name"
    • If the trunk status is "being committed by member_name", wait for them to complete their commit and go to previous step.
  9. Commit the trunk and when done, update the truck status to "committed by your_name"
  10. If this commit was worth recording, branch it in the tags directory under a new release.


If you 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