Difference between revisions of "SVN"

From Stanford SSI Wiki
Jump to navigation Jump to search
Line 1: Line 1:
Did you mean: [[How to Install and Configure Altium]]
+
===Background===
Or: [[List of SVN Repositories]]
+
An SVN repository is a series of "snapshots" of a folder over time. Each snapshot is called a '''commit''', and represents the state of the folder and some or all of its contents at a moment in time. Commits are created by users (aka you) when they want to preserve a version of the files they are working on - this typically happens after making a group of changes to files stored in the SVN repository (ie. after adding a part to a library or making progress on a circuit schematic or circuit board).
 +
 
 +
Any file can be stored in an SVN repository, and the repository can detect any change to any file. With TortoiseSVN installed, tracked files in an SVN repository which have been edited since the last commit will have a small red exclamation point displayed on their icon when viewed in a folder. New files created in your Altium SVN folder will not automatically be tracked - this is intentional, and a good thing.
 +
 
 +
Unlike other version control systems, "branches" do not work in SVN. All commits in an SVN repository contain changes that directly follow the commit before them, and can have only a single commit that follows after them. Because of this, SVN users can '''lock''' files and folders, becoming the only person allowed to commit changes to that file or folder. Other users can still edit the files, but their changes cannot be committed, making those edits futile. TortoiseSVN shows when a file has been locked by someone else, to help keep you from trying to edit something that somebody else is working on. Locking exists so that two users cannot try to commit different versions of the same file - someone who opens a file and knows they will commit changes to it soon can lock the file, marking the fact that they started editing the file first and so should be allowed to complete and commit their changes before anyone else. Locks can be taken away from someone who locks a file for an extended period of time, preventing abuse of this feature.
 +
 
 +
Changes other people make to files stored in the SVN must be downloaded manually, through the SVN '''update''' command. Updating replaces any files in your SVN folder that have been changed since the last time you ran SVN update with their most recently committed versions. You can see if there are new SVN commits to download in the {{slack-channel|altium}} channel, where notices of new commits are automatically posted.
 +
 
 +
===Your First Commit===
 +
[[File:MakingACommit.png|thumb|200px|right|You will likely only have iwuzhere.txt in your list of files to commit, but if you have others, leave them unchecked.]]
 +
In your SSI Altium SVN folder, right click while ''not'' on any file or folder, and mouse down to "SVN Update" and click it. This will quickly bring all of your files up to date. Next, in your Altium SVN folder, find "iwuzhere.txt." This file is tracked by the SVN repository, and should have a small green check mark on it. Right click on the file, mouse down to "TortoiseSVN," and then click "Get lock..." Click OK on any windows that appear. A small lock icon should appear on the file - you now have the lock on this file.
 +
 
 +
If the file was already locked by someone else, you will not be able to lock it, and should message the {{slack-channel|altium}} to ask to lock it. If you do not receive a response within 10 minutes, lock the file as described above, and check "Steal the locks" to take the lock from whomever had it previously. Slack is how locking conflicts like this (which are rare) are resolved, and 10 minutes is a short period of time to wait for a response, but this file is simple and very little work is lost from stealing the lock on it. If someone else commits a new version of the file, run another SVN update, and then you should be able to lock it.
 +
 
 +
Open the file, and add your name and the current date, matching the format of the names already there. ''You're now a part of SSI's corps of electrical engineers!''
 +
 
 +
To finish, go back to your Altium SVN folder, right click while ''not'' on any file or folder, and mouse down to "SVN Commit..." and click it. A dialog box will come up (see right), at the bottom of which should be a list of files. This shows files you have changed since the last time you ran SVN update, and ''should'' just have iwuzhere.txt listed. Make sure you have it checked. In the text box at the top of the window, you will need to write a '''commit message''', a brief description of what changes you're committing. This message will appear in Slack and must be at least 20 characters (but shouldn't be longer than a single sentence). Once you've written it, click okay, and wait for a message to appear in Slack.

Revision as of 00:16, 16 May 2021

Background

An SVN repository is a series of "snapshots" of a folder over time. Each snapshot is called a commit, and represents the state of the folder and some or all of its contents at a moment in time. Commits are created by users (aka you) when they want to preserve a version of the files they are working on - this typically happens after making a group of changes to files stored in the SVN repository (ie. after adding a part to a library or making progress on a circuit schematic or circuit board).

Any file can be stored in an SVN repository, and the repository can detect any change to any file. With TortoiseSVN installed, tracked files in an SVN repository which have been edited since the last commit will have a small red exclamation point displayed on their icon when viewed in a folder. New files created in your Altium SVN folder will not automatically be tracked - this is intentional, and a good thing.

Unlike other version control systems, "branches" do not work in SVN. All commits in an SVN repository contain changes that directly follow the commit before them, and can have only a single commit that follows after them. Because of this, SVN users can lock files and folders, becoming the only person allowed to commit changes to that file or folder. Other users can still edit the files, but their changes cannot be committed, making those edits futile. TortoiseSVN shows when a file has been locked by someone else, to help keep you from trying to edit something that somebody else is working on. Locking exists so that two users cannot try to commit different versions of the same file - someone who opens a file and knows they will commit changes to it soon can lock the file, marking the fact that they started editing the file first and so should be allowed to complete and commit their changes before anyone else. Locks can be taken away from someone who locks a file for an extended period of time, preventing abuse of this feature.

Changes other people make to files stored in the SVN must be downloaded manually, through the SVN update command. Updating replaces any files in your SVN folder that have been changed since the last time you ran SVN update with their most recently committed versions. You can see if there are new SVN commits to download in the SlackLogo.png#altium  channel, where notices of new commits are automatically posted.

Your First Commit

You will likely only have iwuzhere.txt in your list of files to commit, but if you have others, leave them unchecked.

In your SSI Altium SVN folder, right click while not on any file or folder, and mouse down to "SVN Update" and click it. This will quickly bring all of your files up to date. Next, in your Altium SVN folder, find "iwuzhere.txt." This file is tracked by the SVN repository, and should have a small green check mark on it. Right click on the file, mouse down to "TortoiseSVN," and then click "Get lock..." Click OK on any windows that appear. A small lock icon should appear on the file - you now have the lock on this file.

If the file was already locked by someone else, you will not be able to lock it, and should message the SlackLogo.png#altium  to ask to lock it. If you do not receive a response within 10 minutes, lock the file as described above, and check "Steal the locks" to take the lock from whomever had it previously. Slack is how locking conflicts like this (which are rare) are resolved, and 10 minutes is a short period of time to wait for a response, but this file is simple and very little work is lost from stealing the lock on it. If someone else commits a new version of the file, run another SVN update, and then you should be able to lock it.

Open the file, and add your name and the current date, matching the format of the names already there. You're now a part of SSI's corps of electrical engineers!

To finish, go back to your Altium SVN folder, right click while not on any file or folder, and mouse down to "SVN Commit..." and click it. A dialog box will come up (see right), at the bottom of which should be a list of files. This shows files you have changed since the last time you ran SVN update, and should just have iwuzhere.txt listed. Make sure you have it checked. In the text box at the top of the window, you will need to write a commit message, a brief description of what changes you're committing. This message will appear in Slack and must be at least 20 characters (but shouldn't be longer than a single sentence). Once you've written it, click okay, and wait for a message to appear in Slack.