tags:

views:

317

answers:

9

School is back in session and I've found myself at a loss. At the end of last semester, we had a group project utilizing subversion (group of 4 people) to make commits and get it complete. I also noticed how easy it was to have access to a central point for my homework. I want to utilize SVN or Git (recently introduced to git) and I have a problem.

What is the best way to organize SVN for multiple homework assignments for multiple computer classes.

I've got 2 programming classes that I definitely want to track. With at minimum of 1 assignment a week that's 32 assignments to manage over 2 classes. Should I keep them all in one repository and just label 1 Java and 1 C++?

Thanks in advance.

Edit: I should mention I have yearly hosting that allows both git and subversion through WebDAV. That's how I accessed the svn repo for my project last year. I have the ability to lock my homework up away from public view through this tool, for those not familiar with that setup.

+7  A: 

Speaking for SVN -
One repository with multiple projects is normal.

You can easily setup a standalone SVN server (without needing a web server) on a PC

You might also look at using svn with a file based repository on a USB key for simplicity between home and school. This is limited to only one user accessing the files but means you need nothing more than the SVN client (or TortoiseSVN)

ps. Learning to use SCC is one of the most important things they don't teach you at school.

Martin Beckett
+1 for the thumbdrive idea + the xkcd avatar
bobby
One repository with multiple projects may be normal for Subversion, but maybe not for git.
Craig McQueen
Similarly, a local repository on a USB key synced regularly between a school and home repository is normal for git, but not for subversion.
Dustin
I didn't mean to sync the repo, but use the USB key as the sole repo.
Martin Beckett
Isn't that really scary? I've lost data to USB drives. I've lost USB drives. I've not lost data to a revision control system since I started using DVCS nearly a decade ago.
Dustin
I assume you would have a backup! There are even tools to efficiently sync SVN repos. It's probably simpler than getting access to a SVN on a lab computer from home or tunneling into a home machine on dynamic DNS from school on a 'weird' port.
Martin Beckett
Is it possible to clone a repo like git can with svn to allow a standalone usb drive that has a "backup" basically, at home?
bobby
You can clone an SVN repo by just copying the files in it. You can also 'svn dump' an online repo to make a local copy of the repo
Martin Beckett
+1  A: 

You could consider using bitbucket.org, which offers Mercurial hosting with one private repository for free. It is a relatively easy source control system to learn, and there are plenty of tutorials and examples. You can also share this repo with your team mates during group projects. There are numerous services like this for git as well.

I don't think there is a good reason to split your repository by technology (e.g., Java/C++), but if you just have a directory layout like /assignments/course/assignment_x, you should be fine. There is probably some code that you can share across coursework, but I suppose that depends on the prof.....

joeslice
+1  A: 

I found it easiest to just have one repository, with sub directories for each class. Then inside the class directories, I would make assignment folders (if assignments consisted of multiple files) or just place the files directly (for single-file assingments like papers).

Andrew Medico
+1  A: 

I use svn hosted on a home computer for all my coursework (and personal) projects. Here's the layout I use for the repository:

<SchoolName>
<SchoolName>\<className>
//assuming homework are generally single files
<SchoolName>\<className>\Homework\
//assuming multiple files needed
<SchoolName>\<className>\Assignment x- The Project of DOOM\ 
Personal\<broad non specific name>

And I find it works well for me. Not just for computer classes either: English, Math, really any class where the majority of the work will end up being typed. I can see that using svn with, say, a drawing class would be problematic.

CoderTao
A: 

To me, if I do not host the repository directly in my HD, I prefer to use DVCS (in this case, Git). For the moment, I use Bazaar as it can do both Centralised and Distributed (and swap between the two using Bind and UnBind operations). I think you can use it through WebDAV too. I use it through Eclipse plugin so it as easy as other VCS.

NawaMan
+6  A: 

If you move between lots of computers you might wanna carry the assignments in a USB stick. Assuming you're using git, there shouldn't be any problems.

I usually have a folder for each class and under it a folder for each assignment,

cpsc511/
   a1/
   a2/
   a3/
cpsc423/
   a1/
   a2/
   a3/

Each assignment would have its own repository. I don't see a reason to use the same repo for all assignments since most of the time they won't be related by anything at all.

hasen j
+1 Git! Woo, religious wars!
Chris Lutz
A: 

I'd like to add to joeslice's comment above, another advantage of going with Mercurial (on Bitbucket, say) will be having easy access to clients on Windows/Unix/Mac.

  • Go with different repositories if they don't have dependencies.
  • Mercurial is pretty much init and run, but that's true for all DVCS I think. This also means that you don't have to worry too much about how to organize things perfectly but can instead just hg init in any directory before you start working there.

PS: I'd have left this as a comment to the post, but apparently I am not allowed to comment yet.

rm
+1  A: 

In the spirit of learning, and sharing I'm posting two really great resources for both subversion and git. I think it'd up to anyone's very own situation to choose which is best for their needs.

Subversion Book - Version Control With Subversion Official Book

Git - Pro Git (Book) Great guide to using git

Git Hub - Learn Github (learn.github.com Just found this today.

So far I've tried subversion and git, and found git with the setup hasen j described works best. I'll try to follow up again with this thread. Thanks again to all of your advice

bobby
+1  A: 

Another thing to keep in mind when you save your semesters work in the cloud is accessibility. I decided to backup every line of code I've written for my undergrad using the following script.

#!/usr/bin/env python

import os
import smtplib
import sys

mail_server = '###'
from_email = '###'
sender = '###'
to_email = '###'
mailbox_name = '###'
mailbox_password = '###'

server = smtplib.SMTP(mail_server)
server.login(mailbox_name, mailbox_password)

repository, revision = sys.argv[1:]

# get info about the commit
cmd = "svnlook info %(repository)s" % locals()
info = os.popen(cmd).read()
info = info.split("\n")
author = info[0]
time = info[1]

# combines all lines of multi line comment into a single line
comment = info[3:len(info)]
temp = ""
for c in comment:
    temp += c + " "
comment = temp

# find out what changes are made
cmd = "svnlook changed %(repository)s" % locals()
changes = os.popen(cmd).read()

# include the diff between new and prior revision
cmd = "svnlook diff %(repository)s -r %(revision)s" % locals() 
diff = os.popen(cmd).read() 

msg = (
"To: %(to_email)s\r\n"
"From: %(sender)s %(from_email)s\r\n"
"Subject: Revision %(revision)s committed\r\n"
"Content-type: text/plain\r\n"
"\r\n"
"Revision: %(revision)s\r\n"
"Comment: %(comment)s\r\n"
"\r\n"
"Author: %(author)s\n"
"Time: %(time)s\r\n"
"\r\n"
"Files affected:\r\n"
"%(changes)s\r\n"
"Changes Made:\r\n"
"%(diff)s\r\n"
)

msg = msg % locals()

server.sendmail(from_email, to_email, msg)
server.quit()
  • Place this in 'svn-repo/hooks/' (save it as post-commit)
  • make it executable - 'chmod +x post-commit'

I it to your personal gmail address for two reasons: 1. I can simply search my inbox years from now using the simple gmail interface 2. You can wake up the next day after a long night of coding and review everything you commmitted as a sanity check - Many software companies follow this practice.

Penang