Stories
Slash Boxes
Comments
NOTE: use Perl; is on undef hiatus. You can read content, but you can't post it. More info will be forthcoming forthcomingly.

All the Perl that's Practical to Extract and Report

use Perl Log In

Log In

[ Create a new account ]

Ovid (2709)

Ovid
  (email not shown publicly)
http://publius-ovidius.livejournal.com/
AOL IM: ovidperl (Add Buddy, Send Message)

Stuff with the Perl Foundation. A couple of patches in the Perl core. A few CPAN modules. That about sums it up.

Journal of Ovid (2709)

Thursday January 18, 2007
10:02 AM

Subversion or CVS?

[ #32190 ]

Because I constantly work with package with either a Build.PL or a Makefile.PL and I'm always typing the wrong command, I have the following shell script named 'rebuild':

#!/usr/local/bin/bash
if [ -f Build.PL ]; then
    makeprog=Build
    makecommand=./Build
elif [ -f Makefile.PL ]; then
    makeprog=Makefile
    makecommand=make
else
    echo Nothing to rebuild!
    exit 1
fi

if [ -f $makeprog ]; then
    $makecommand realclean
fi
perl $makeprog.PL && $makecommand && $makecommand test

if [ "$1" = dist ]; then
    $makecommand dist
fi

Note: this is one of the hacks I contributed to Perl Hacks. If you like it, you'll find other items of interest in the book.

In a similar vein, I find that work uses CVS and I use Subversion at home, so I'm always mistyping the command. Hence my writing the following shell script, following a similar theme:

#!/usr/local/bin/bash

if [ -d CVS ]; then
    prog=cvs
elif [ -d .svn ]; then
    prog=svn
else
    echo Cannot determine source control!
    exit 1
fi

case "$1" in
    "") $prog up    ;; # no arguments
    * ) $prog up $* ;; # Pass 'em straight through
esac

Perhaps I should go ahead and start on a proper compatibility layer. Nah, I have too much work to do with TAPx::Parser. I assume someone has already written something like this?

The Fine Print: The following comments are owned by whoever posted them. We are not responsible for them in any way.
 Full
 Abbreviated
 Hidden
More | Login | Reply
Loading... please wait.
  • Extend SVK so it can push as well as pull from CVS repos :)
    • I keep thinking I should check out SVK since so many people I respect say it's so wonderful, but given that I no nothing about it other than how to spell it, it's been pretty low on my list of Things To Do :)

      • The thing I like about it is that I can do:

        svk mirror $WORK_REPO/project/foo/trunk //foo/trunk
        svk cp //foo/trunk //foo/local -m 'a local branch for local folk'
        svk sync -a
        svk co //foo/local foo

        # unplug network & leave work

        # work away offline and unnetworked, committing things in my
        # local foo repo to my hearts content

        # go back to work and plugin network

        # to merge in changes other folk might have done while
        # I was away
        svk pull

        # to push my changes back to the main repository
        svk push

        It just makes offline wo
  • Someone beat you to it :-)
  • In your case statement, do you really intend to pass the 'up' in the second case?

    Also, you probably want to do this:

    $prog "$@"

    Rather than this:

    $prog $*

    The difference being that "$@" does the right thing with quoted arguments containing spaces (eg: -m "commit message here").