views:

230

answers:

10

Working on three different computers at two different locations, on projects that are in subversion, I once in a while forget to check in stuff at one location, so that I cannot work on the latest code, when I want to continue working on the project at another location.

I am sure other have had similar problems.

What are some things I can do to avoid this issue? Tools that help? Notifications I can set up?

I use Visual Studio 2008 and TortoiseSVN on Windows7 PCs.

+5  A: 

I have no magic wand to offer, just the mantra "commit early, commit often"; besides avoiding such accidents, or at least minimizing their impact when they do occur, that offers other advantages too (finer-grained rollback if a changeset needs reversion, for example). That may require a branch if the trunk is considered to contain always "golden code" so you don't want to commit half-baked changesets (and svn doesn't exactly make branching and merging painless, sigh) -- indeed this (among the other advantages of distributed VCS's) is one reason I've started switching from subversion to mercurial (aka hg) on open-source and/or personal projects where I get to call the shots in the matter!-)

Alex Martelli
Get into a habit. You should be committing multiple times a day, not just once at the end of the day. Once you start doing that it won't be hard to remember to do it at the end of the day.
Sam DeFabbia-Kane
Even hitting commit at every compile doesn't guarantee that you didn't forget to add some resource file or icon deep in a subdir. It's the checkout that tests the repostiory.
Martin Beckett
@mgb: that's where a continuous integration server can help. Triggered on any checkin, a successful build means you (probably) didn't forget anything.
Greg Hewgill
@Sam, yep, that's the gist of what I'm saying. @mgb, not sure how easy it is to integrate the idea into the OP's environment, but personally I wrap svn into a simple script that does extra checks, so if there's some '?' in svn st, it can prompt me about svd adding those files in or adding patterns to svn:ignore -- not as powerful as @Greg's suggestion for continuous integration, but easier to set up (at least in a commandline-based environment -- dunno 'bout tortoises;-).
Alex Martelli
And "svn add" stuff as soon as it was created. I usually create empty files "something.cpp/something.h", add them to svn and only then add them to a project and start writing stuff.
Eugene
+7  A: 

A simple solution is to right-click at the top level of the project and then click "commit". Tortoise shows you the entire project, including "non-versioned" files.

This takes a little discipline when you setup your source tree. For example, if you mix binary output files with source code, it makes it more difficult. Also make sure you don't have any directories ignored that contain source code.

BenB
-1 for a tortoiseSVN answer to a general svn question.
Jeremy Wall
How about reading the question before voting? "I use Visual Studio 2008 and TortoiseSVN on Windows7 PCs." jeez.
BenB
+6  A: 

Daily builds.
A batch file (or equivalent) that checks out into a new directory and does a build (and in an ideal world runs unit tests) - if it doesn't build then you missed somethign.

Martin Beckett
A tool like CruiseControl.net (http://confluence.public.thoughtworks.org/display/CCNET/Welcome+to+CruiseControl.NET) can help with automating this task by automatically attempting a build each time a commit is made.
X-Cubed
We use SVN with CruiseControl very successfully. It still doesn't force developers to check in their work unless they were supposed to check in a dependency to something else that was actually checked in, but does provide constant visibility into the state of the project.
Eric J.
+7  A: 
X-Cubed
I use AnkhSVN http://ankhsvn.open.collab.net/ for the same purpose.
Eric J.
I also use AnkhSVN, but yeah, VS extensions like these do a good job of waving a flag in one's face that stuff needs to be committed.
Chris Charabaruk
+2  A: 

Remote-control other machines (perhaps via VPN) so that you can get at code in remote working directories even if you do forget to check it in.

And/or automated backup of your working directories.

ChrisW
This is what I do. If I discover I've forgotten to check in I just SSH to the machine and commit that way.
Colin Coghill
A: 

I use git-prompt.sh to keep track of the status of files and branches. It appears to also work with SVN.

Aneurysm9
+1  A: 

Cron job to whine at you every evening?

Eevee
Already have that covered - it's called a girlfriend.
Kjensen
Whoa! Where did you find a girlfriend who integrates with your source control?
Eevee
In my trunk! Oh yeah, I went there.
Kjensen
+1  A: 

What I do using Tortoise is to always have one of its "Check for modifications" window open and to regularly hit its Refresh button. It would have been a very bad hurry indeed that would make me shutdown without first checking all open windows/applications for unsaved data.

This is also good against forgetting to add stuff, BTW, as you can setup that window to show all non-ignored non-added stuff, too.

sbi
+2  A: 

Force yourself to get into a routine.

First thing in the office - do an update. 
Last thing in the office  - do a commit (if required).

Of course, you should update/commit during the day (When checking in for example) but at the bare minimum do the above.

Finglas
+2  A: 

For forgetting to check in at all, if possible I would logout via some script that will first nag you if there is work that hasn't been checked in yet. Or via an icon clicked from your projects folder so TortoiseSVN will show you the red exclamation mark.

For forgetting to add new files to a check-in, I use this batch file:

svn st
svn ci -m %1 --username "russell.wallace"

So as soon as I do a commit that's missing new files, I'm notified of the fact and can immediately follow up with another commit that adds them.

rwallace