SVN Setup: Difference between revisions

From 1511Wookiee
Jump to navigationJump to search
No edit summary
No edit summary
Line 2: Line 2:


Team 1511 uses Subversion for its source code management. Subversion allows multiple developers to easily work together on a common code base, across many computer systems. On this page, you'll find the access information for our repository, as well as links to Subversion client software.
Team 1511 uses Subversion for its source code management. Subversion allows multiple developers to easily work together on a common code base, across many computer systems. On this page, you'll find the access information for our repository, as well as links to Subversion client software.
== Using SVN to Access the Robot Code==
* ''Initial Setup''
** Pick one of the client options from the bottom of this page and install it.  The easiest client to use on Windows is [https://tortoisesvn.net/ Tortoise SVN]. These instructions assume you are using this.
** Install TortoiseSVN - the default options are typically fine for most people.
** Create a folder on your computer to hold the robot code.  For this example, we will use c:\FIRST
** Open this folder in Windows Explorer, then right-click in the explorer window.  In the context menu, choose "SVN Checkout"
** In the window that opens, you need to enter the URL to the SVN repository.  You can get the right URL to use in the next section of this page (each year's code uses a different URL)
** Click OK
** You will be prompted to login. If you don't have a login for SVN or forgot it, ask a mentor.
** The most recent version of the robot code on the server is transferred to c:\FIRST on your computer.
* ''Updating Your Local Copy of Code''
** Your local version of the robot code can be updated with the work others have checked into the server - ''you should do this once a day or more often when you start working''
** To update, open Windows explorer to your code location on your computer
** Right-click the code folder and choose "SVN Update"
** The code is updated locally - NOTE: If another person updated a file that you had made changes to as well, you may get what is known as a "Merge conflict". See "Resolving Merge Conflicts" below.
* ''Committing Your Changes''
** Once you have made a set of changes that you want to share with the rest of the team, you will need to "commit" them to the SVN server.
** ''Before doing this, have your changes checked by a mentor''
** Open Windows Explorer to your robot code folder.  Right-click the folder and choose "SVN Commit".
** Enter a high-level description of the changes you made (example: "Added code to run the new intake"
** Click OK -- the changes are sent to the server.
** You may get a message that your local version is out of date.  This means you need to Update (see above section) to get the latest changes from the server before you can commit.  Update, then repeat the commit.
* ''Resolving Merge Conflicts''
** Follow these steps if you have a merge conflict after doing an update.  A merge conflict means that someone else made changes to the same part of the code that you did and SVN couldn't figure out how to automatically combine the changes in a sensible way.
** In Windows Explorer, the files with conflicts will be marked with a special icon.  Open these files in VS Code.
** The file will have the sections in conflict marked up as follows:
<pre>
<<<<<<<<
  // My code I wrote or changed is here
  int my_x = 10;
  my_x++;
========
  // The code changes by the other author will be here
  int the_other_persons_x = 20;
  the_other_persons_x++;
>>>>>>>>
</pre>
** As you can see, your version of the code and the other author's changes are shown with special line markings (the <, ==, and > lines)
** You need to edit these to produce one final version, merging things together.  When you are done, you remove the special line markings, leaving only the final code.
** Sometimes you might completely remove their edits and use yours, sometimes you might completely remove your edits because the other person did the same thing but differently, or other times you might keep both sets of changes or some mixture thereof!
** If you need help figuring out what edits to make to fix a conflict, ask a mentor.
** Once you edit all the conflicts, you need to tell SVN you are done.  This is called "Resolving" the conflict.  To do this, open Windows Explorer to the code location, find the conflicted file(s), select them, then right-click and choose Tortoise SVN, then "Resolve"
** When you have marked all conflicts as resolved, you would to a commit as normal to send your changes to the server.


== Team 1511 Subversion Repository Details ==
== Team 1511 Subversion Repository Details ==

Revision as of 15:23, 23 January 2021

Source Code Repository Introduction

Team 1511 uses Subversion for its source code management. Subversion allows multiple developers to easily work together on a common code base, across many computer systems. On this page, you'll find the access information for our repository, as well as links to Subversion client software.

Using SVN to Access the Robot Code

  • Initial Setup
    • Pick one of the client options from the bottom of this page and install it. The easiest client to use on Windows is Tortoise SVN. These instructions assume you are using this.
    • Install TortoiseSVN - the default options are typically fine for most people.
    • Create a folder on your computer to hold the robot code. For this example, we will use c:\FIRST
    • Open this folder in Windows Explorer, then right-click in the explorer window. In the context menu, choose "SVN Checkout"
    • In the window that opens, you need to enter the URL to the SVN repository. You can get the right URL to use in the next section of this page (each year's code uses a different URL)
    • Click OK
    • You will be prompted to login. If you don't have a login for SVN or forgot it, ask a mentor.
    • The most recent version of the robot code on the server is transferred to c:\FIRST on your computer.
  • Updating Your Local Copy of Code
    • Your local version of the robot code can be updated with the work others have checked into the server - you should do this once a day or more often when you start working
    • To update, open Windows explorer to your code location on your computer
    • Right-click the code folder and choose "SVN Update"
    • The code is updated locally - NOTE: If another person updated a file that you had made changes to as well, you may get what is known as a "Merge conflict". See "Resolving Merge Conflicts" below.
  • Committing Your Changes
    • Once you have made a set of changes that you want to share with the rest of the team, you will need to "commit" them to the SVN server.
    • Before doing this, have your changes checked by a mentor
    • Open Windows Explorer to your robot code folder. Right-click the folder and choose "SVN Commit".
    • Enter a high-level description of the changes you made (example: "Added code to run the new intake"
    • Click OK -- the changes are sent to the server.
    • You may get a message that your local version is out of date. This means you need to Update (see above section) to get the latest changes from the server before you can commit. Update, then repeat the commit.
  • Resolving Merge Conflicts
    • Follow these steps if you have a merge conflict after doing an update. A merge conflict means that someone else made changes to the same part of the code that you did and SVN couldn't figure out how to automatically combine the changes in a sensible way.
    • In Windows Explorer, the files with conflicts will be marked with a special icon. Open these files in VS Code.
    • The file will have the sections in conflict marked up as follows:
<<<<<<<<
   // My code I wrote or changed is here
   int my_x = 10;
   my_x++;
========
   // The code changes by the other author will be here
   int the_other_persons_x = 20;
   the_other_persons_x++;
>>>>>>>>
    • As you can see, your version of the code and the other author's changes are shown with special line markings (the <, ==, and > lines)
    • You need to edit these to produce one final version, merging things together. When you are done, you remove the special line markings, leaving only the final code.
    • Sometimes you might completely remove their edits and use yours, sometimes you might completely remove your edits because the other person did the same thing but differently, or other times you might keep both sets of changes or some mixture thereof!
    • If you need help figuring out what edits to make to fix a conflict, ask a mentor.
    • Once you edit all the conflicts, you need to tell SVN you are done. This is called "Resolving" the conflict. To do this, open Windows Explorer to the code location, find the conflicted file(s), select them, then right-click and choose Tortoise SVN, then "Resolve"
    • When you have marked all conflicts as resolved, you would to a commit as normal to send your changes to the server.

Team 1511 Subversion Repository Details

We have one repository for each team-year. All repositories are accessible via http. Simple browsing can be done with a web browser; actually modifying and contributing code requires a Subversion client. When checking out your initial working copy, configure your Subversion client to use the URLs below:

Access requires a username and password. Access is provided to Programming Subteam members only. Please post to the Programming Build Season forum or contact Jeff if you need an account.

Subversion Client Software

Links to Subversion clients:

  • Tortoise SVN - Easy-to-use graphical client implemented as a Windows Explorer shell extension. Basically adds menu items to the Explorer right-click menues. Very convenient and user-friendly. Windows only.
  • SVN - Command-line client provided by creators of Subversion. Works on Linux, Windows, and just about everything.