Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to make Subversion (or any program) perform periodic commits?

Tags:

svn

autocommit

I want to configure my computer so that say every half an hour it automatically commits the program I am working on. I am using a svn repository so even if it was just a script that ran 'svn ci' every 30 min that would be okay. The problem is that I don't know how to do that.

Could somebody please tell me, or direct me to something, that would let me get this periodic commit stuff working?

Thanks in advance.

EDIT: Sorry it appears that I have confused people as to why I would want to do this. The sole reason that I want to do this is because a lecturer of mine wants us to know how our code develops over time and I thought that it would be a great idea to use svn for this purpose. It does not matter if the latest commit works or not. It just has to show the changes I have made to the code over time.

like image 330
Robert Massaioli Avatar asked Apr 17 '09 03:04

Robert Massaioli


2 Answers

You could try a cron job that runs a shell script. What OS are you on?

But I'm curious as to why you'd want to do this. Your commits should consist of pieces of functionality or bug fixes, and not based on a time interval. You're likely to commit in the middle of a change (on a group of files) which will render your revisions useless.

like image 44
Brian Kelly Avatar answered Sep 21 '22 23:09

Brian Kelly


Contrary to apparent popular opinion, I think this is a great use of svn, in the context of the assignment.

Tools like kdesvn (or even better, tortoisesvn, but that's only on windows) might give you great insight into what's happening with their log views, diffs and blame visuals.

If you're using ubuntu, run this bash script from a console that's separate to the one you're working on.

#!/bin/bash
while [ 1 ]
do
        # Do the commit
        svn ci --message "Automated commit" ~/yourworkingcopy

        # Wait until next commit time
        sleep 1800
done
like image 99
Jim T Avatar answered Sep 22 '22 23:09

Jim T