Version Control Using Subversion

117 views
Skip to first unread message

Alan Isaac

unread,
Jun 6, 2014, 2:15:49 PM6/6/14
to au-ec...@googlegroups.com
During the first week of class, graduate students were asked to install Subversion.  (Undergrads are welcome to also.)

Now that you are working on your projects, you should put your code under version control.  Before attempting this, be sure to read

Here is how you will put your code under version control.  (I will pretend you are on Windows.  Other OS's are essentially the same, but instead of the command prompt your will work at the bash prompt.)

1. Decide where you want to store your code on your computer (i.e., in which folder).  Let us suppose you want it to be
    C:\Users\yourusername\econ650\code
    Don't create the code folder!
    Just change to your class directory: C:\Users\yourusername\econ650

2. Once you have changed to your class directory, give the following command at the command prompt:

3. You should see a checkout of the class repository, creating your working copy as a "code" folder.
    Change directory into your new "code" folder.

4.  Use Subversion to make a new personal folder using the name you like to be called by the class.
     E.g., Kevin would (at the command prompt, while in the "code" folder) give the command
    svn mkdir kevin
    svn commit -m "creating personal folder"

5. Move your project code into your new personal folder.
    This is where you will work on it from now on.
    But it is not yet under version to control.
    To put it under version control, change to your personal folder,
    and then use Subversion to add your .nlogo file, and commit it.
    E.g., suppose Kevin's file kevin.nlogo is in his "kevin" folder.
    Then he would change to the "kevin" folder and do enter the following at the command prompt:
    svn add kevin.nlogo
    svn commit kevin.nlogo -m "adding project file"

6. Once you have put your project file under version control,  you should follow the UMUTC workflow
    described in the reading above.  THIS IS VERY IMPORTANT!!!!

7. Note: if you are working in a group, you should make one (1) personal folder for the entire group.
    So only one of you will follow the process above.  Once you have done so, tell the rest of your
    group to update their working copy of the repository.  Once they do that, they will see the group's
     personal folder appear in their "code" folder.

If you run into any problems getting Subversion up and running, you can discuss it in this thread,
and you can contact the Helpdesk at 202-885-2550.

Alan Isaac


Amanda Saville

unread,
Jun 13, 2014, 8:24:37 PM6/13/14
to au-ec...@googlegroups.com
I'm attempting to access the repository, but I'm unable to log on with my American userid... Did I miss any instructions that would say our username was different from our American userid's?

Alan Isaac

unread,
Jun 14, 2014, 8:55:39 AM6/14/14
to au-ec...@googlegroups.com
Your login name for the Subversion server is the same as MyAU portal login names;
your password is in the format logi...@american.edu.

Does that get you there?

Amanda Saville

unread,
Jun 14, 2014, 10:59:13 AM6/14/14
to au-ec...@googlegroups.com
I just tried to use a whole host of combinations of things as my username and password based on your response, but I still can't get on, and it is still not clear to me what my username and password should be.

If my email address is as6...@student.american.edu, then:

username: as6493b

Is this correct?  I also tried to leave student out.  Whenever I enter the repository code in terminal, though, it defaults to my username on my computer, so I have been changing this manually.  Could this be posing the issue?

If I can't get on this morning, I think I will be calling the helpdesk Monday.

Thanks for your help!

Matthew Reardon

unread,
Jun 14, 2014, 5:43:39 PM6/14/14
to au-ec...@googlegroups.com
I think the password is supposed to be as6...@american.edu not our actual full email @student.american.edu.  At least that works for me when I try to log on through the browser and through my terminal commands. I know you said you tried leaving student out, so maybe your problems are not "your" problems (something on the subversion server side).

 to clarify, my email address is mr8...@student.american.edu 

When accessing subversion through terminal (on my mac) I use the following

username: mr8980a

From start to finish when using terminal, this is what I experienced....
1) type this in terminal    svn checkout https://subversion.american.edu/svn/econ450650e2014/trunk code
2) choose to accept the server certificate (permanently, but it gives you the option to accept temporarily or reject)
3) that prompted me for my COMPUTER password, which is to allow terminal changes to the folder on my computer
4) then it prompted me for the subversion username (mr8980a)
5) finally, it prompted me for the subversion pw (mr8...@american.edu)
6) then it just listed a bunch of code/ extensions, but when I look at the folder on my computer there have been modifications

If you're having trouble logging in, try going directly to (in your browser)   https://subversion.american.edu/svn/econ450650e2014/trunk 
This should prompt you to log in, which you can then try out various combinations to see which one works


Hope this helps!

Alan Isaac

unread,
Jun 15, 2014, 8:18:47 AM6/15/14
to au-ec...@googlegroups.com
First Checkout

It looks like Matthew had a successful first checkout.  The "modifications" he sees in the folder should be the new code folder, where you all will work.  Each student (or group) should make a personal folder and make changes only there.

REMEMBER: use the UMUTC workflow!
https://subversion.american.edu/aisaac/notes/svn-intro.xhtml#workflow

Amanda Saville

unread,
Jun 16, 2014, 12:39:01 PM6/16/14
to au-ec...@googlegroups.com
Thank you, Matthew, for sharing your experience.  Just wanted to follow-up to let you know that with some correspondence between myself, Dr. Isaac, and an administrator I was able to get on.  I think you were correct when you said it may have been something on the subversion side, but I am happy it was much less painless this morning trying to get on the repository.

Alan Isaac

unread,
Jun 16, 2014, 3:11:36 PM6/16/14
to au-ec...@googlegroups.com
working together

Remember to always use the UMUTC workflow!

Amanda, I made some changes to the formatting of the code you committed.  If you update, you will see that the code has changed. This shows how you and Natalie can work together on a single file.

But it can lead to problems if two people change the same line of the same file.  (That is what the UMUTC flow avoids.)  If that happens, let me know, and we will discuss how to resolve it.

One other thing: it looks like you could use repeat rather than while in your go procedure.

Amanda Saville

unread,
Jun 16, 2014, 4:53:41 PM6/16/14
to au-ec...@googlegroups.com
Okay, neat!  I'm glad to finally be active on the repository.  

I notice that in your formatting changes that you moved the open bracket in many of the procedures, is this how we should be writing all of our code?  I have gotten into the habit of writing my opening bracket on the next line and then closing immediately after so I could fill in the rest of a procedure later.

And I will investigate using "repeat" in the "go" procedure. Thank you.


Alan G Isaac

unread,
Jun 16, 2014, 5:32:13 PM6/16/14
to au-ec...@googlegroups.com
This is mostly a matter of style, but the style I recommend is a little
more compressed, so you can read more at once. Note that in principle an
entire NetLogo program could be written on a single line. Formatting is
for convenience in reading.

I do not impose any formatting requirements in this course.
But I do encourage readability.

Alan Isaac

Adin Dobkin

unread,
Jun 19, 2014, 2:23:28 PM6/19/14
to au-ec...@googlegroups.com
I've been getting up to the part where one has to create a new personal folder.  Whenever I get to that point (step 4), the command prompt is telling me that x directory is not a working copy.  

I think my problem is somewhere in step 3.  Perhaps someone could explain to me how to change the directory to a place in the econ 450 repository?   Pretty lost at this point.

Alan G Isaac

unread,
Jun 19, 2014, 2:47:13 PM6/19/14
to AU-ECON-ABS on behalf of Adin Dobkin
American University has a computer (the "server") that has the repository.
You cannot work on that computer.
Instead, you need to do a checkout from the repository onto your own computer.
This gives you a "working copy" of the repository, where you can work.
This is discussed in the version control readings, e.g.
https://subversion.american.edu/aisaac/notes/svn-intro.xhtml

So the first question is, did you make a working copy?
If you followed the instructions, you should find on your hard drive
a folder named `code` that has within it the personal folders of several students.
You need to `cd` into that `code` folder, and *then* you can
svn mkdir adin
svn commit -m "committing my personal folder"

hth,
Alan Isaac

Kevin Carrig

unread,
Jun 20, 2014, 9:39:54 AM6/20/14
to au-ec...@googlegroups.com
Not completely sure if this is what you're after, but the command "cd" lets you navigate through directories in the command prompt. For example, if you open up the command prompt and the default directory is somewhere in your C drive, say "C:/Users/", then you can type "cd Desktop" to navigate to your Desktop. From there, if you want to move to another folder on your desktop, you repeat the process "cd Folder Name". If you can successfully navigate to the directory you want, then you can start using the SVN commands while in the directory. Hope this helps. 

Alan Isaac

unread,
Jun 20, 2014, 9:47:11 AM6/20/14
to au-ec...@googlegroups.com
Reminder:

All graduate students should now be actively using Subversion for their project code.  This is not optional!  If you are having troubles, post *detailed* descriptions of your problems here.  (The TA is also available by Skype.)

Actively means I should be seeing new commits to your code every day!

Undergrads are encouraged to do use Subversion as well.

Remember: UMUTC!
https://subversion.american.edu/aisaac/notes/svn-intro.xhtml#workflow

Alan Isaac

unread,
Jun 20, 2014, 12:53:18 PM6/20/14
to au-ec...@googlegroups.com
Backing Up Your Paper

By the way, be sure to back up your work frequently.  Each time you commit your code, it means that you have created a back-up copy of your work.  Even better, it is on another computer (AU's server)!

If (!!) you are using a text-based format to write your paper (like LyX or LaTeX), then you can also add your .tex or .lyx files to the repository.  (But please do not do this with word processor files, like Word, WordPerfect, or Writer.  Subverstion is not suitable for such binary formats.  You'll have to make a regular back up on your own computer or, better yet, an external drive.)

Matthew Reardon

unread,
Jun 21, 2014, 3:54:43 PM6/21/14
to au-ec...@googlegroups.com

It's worth noting that the common directory command (cd) is useful across many platforms, especially when sharing code or working together on a project.  Similar to the homework exercise of using the _include command for the ruin project, if your code involves loading/closing files then setting a common directory makes things alot easier.  This way, when referring to programs/datasets throughout a program's code, you do not have to include the full extension.  For example, if I use cd to set the desktop as my directory, then any file path in the code doesn't have to include /users/mreardon/desktop.   Then when sharing code, the new user only has to change the cd path to their respective desktop, and all file path references will continue working.  This is incredibly convenient for group projects in various software platforms (especially stata)


Alan Isaac

unread,
Jun 22, 2014, 9:06:49 AM6/22/14
to au-ec...@googlegroups.com
Reminder

All graduate students must be committing their code to the repository every day now.
Recall the instructions that started this thread:

Those who have not done so should fix that **today**.
If you are having difficulties, post them to this thread.

Undergrads are encouraged to do this too.
You will find it easier to get useful feedback from me if you use Subversion.

Alan Isaac

unread,
Jun 23, 2014, 10:52:23 AM6/23/14
to au-ec...@googlegroups.com
NetLogo and Subversion

If you are working in NetLogo and want to pull my comments from the repository with ``svn update``,
be sure to first save and close your NetLogo file!

Do not (!!!) have your .nlogo file open while you are updating it.

Alan Isaac

unread,
Jun 23, 2014, 5:43:14 PM6/23/14
to au-ec...@googlegroups.com
Reminder reminder.  :-)
Alan Isaac


On Sunday, June 22, 2014 9:06:49 AM UTC-4, Alan Isaac wrote:
Reminder

All graduate students must be committing their code to the repository every day now.

Reply all
Reply to author
Forward
0 new messages