Search code examples
svnautocommit

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


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.


Solution

  • I would not dirty your control version system with such series of auto commits. But I agree with the idea of using a control version system to provide that information.

    Then, my suggestion is: use a repository for your software and another one for store the auto commits. When the work is done, merge all auto commits in the main repository in only one logical commit.

    With git, I would do this:

    1. Repo 'foo': the main repository
      1. refs/heads/...: the location of your development branches
      2. refs/sessions/...: the location of your work with dirty commits.
    2. Your working copy:
      1. "git init"
      2. "git remote add foo git://foo/...; git fetch foo"
    3. create the branch: "git checkout -b bar foo/master"
    4. tag the begining of the branch: "git tag barbegin"
    5. activate the script: "while true; do git add -A .; git commit -m 'autocommit'; done"
    6. I would not use a cron job, so you can activate/deactivate the autocommits easily.
    7. do your job
    8. after your job done, deactivate the script
    9. commit pending changes
    10. now, you have a lot of auto commits in branch bar, and you have tagged the initial commit of the branch with barbegin
    11. publish your auto commits:
      1. "git tag barend"
      2. "git push foo barbegin:refs/sessions/your user id/the session id/begin"
      3. "git push foo barend:refs/sessions/your user id/the session id/end"
    12. now, you have published your work and your lecturer may access it
    13. for update your foo repository:
      1. "git rebase -i --onto barbegin barbegin" and proceed as described here
      2. I would squash all commits: "in the end, there can be only one".
      3. "git push foo bar:master" # only one commit will be pushed
    14. cleaning:
      1. "git tag -d barbegin"
      2. "git tag -d barend"
      3. "git branch -d bar"

    After all this, I think no useful information may be gathered with such kind of data. So, I would try to avoid this workflow. But if really needed, I would do that way.