Recent uploads from my Flickr photostream...

Archive for May, 2009

Subversion – show commit details when editing commit message

Something I’ve wanted to do for a while is get the list of changed files and a diff into the commit message in my editor when I make a commit with Subversion.

With Git, you can pass the -v (verbose) option when committing, and the commit message you edit will include diffs as well as the list of modified files.

Subversion provides no such option, so I put together a little wrapper shell script to do this for me.

The script provides a function named svncommit (which I alias to just ‘ci’ for supreme shortness :) ).

When used, after the “–This line, and those below, will be ignored–” marker line, the list of files and then diffs will be inserted, as shown in the screenshot below (click for full size):

Subversion commit message being edited

The script itself is relatively simple (it was knocked up quickly; I’ll probably improve on it sometime):

# Do an svn commit, with diffs included in the commit message
svncommit() {
 
    # Start preparing the commit message which we'll then edit
    COMMITMSG=/tmp/$USER-commitmsg
    echo > $COMMITMSG
    echo "--This line, and those below, will be ignored--" >> $COMMITMSG
    svn status "$@" >> $COMMITMSG
    echo >> $COMMITMSG
 
    # Now do a diff; work out stats on lines added/removed by looking at
    # the diff, add that info, then the diff itself
    svn diff "$@"   > /tmp/$USER-svndiff
    LINESADDED=$(  grep '^+[^+]' /tmp/$USER-svndiff | wc -l)
    LINESREMOVED=$(grep '^-[^-]' /tmp/$USER-svndiff | wc -l)
    echo "Added $LINESADDED lines, removed $LINESREMOVED lines" >> $COMMITMSG
    echo >> $COMMITMSG
    cat /tmp/$USER-svndiff >> $COMMITMSG
    echo >> $COMMITMSG
 
    ORIGMD5=$(md5sum $COMMITMSG)
    $VISUAL $COMMITMSG
 
    if [[ "$(md5sum $COMMITMSG)" == "$ORIGMD5" ]]; then
        echo "Commit message unchanged, commit aborted";
    else
        svn commit "$@" -F $COMMITMSG
    fi
 
    rm $COMMITMSG
    rm /tmp/$USER-svndiff
}

If you’re having a bad day…

Found out about FMyLife from a colleague. If you’re having a bad day, have a read, and I’ll bet you won’t feel so bad anymore.

A few class examples:

Today, I was holding a lit cigarette in one hand and a lollipop in the other. Guess which one I licked? FML

Today, my family was preparing a turkey for my grandma’s birthday dinner when my aunt noticed a utensil on the counter and asked what it was for. My mom said it was used to keep the turkey’s legs together. My aunt responded to her by saying, “Maybe you should get one for your daughter.” FML

Today, while driving home I had to pee really bad. I decided to speed to get home quicker. I got pulled over for speeding and peed my pants. The cop, assuming I was drunk, made me take a sobriety test. I had to walk a straight line with piss all over my pants at 2:00 in the afternoon. FML

Today, I met my girlfriend’s parents for the first time. We got on the discussion of animals, and I showed them a picture of my cat on my phone. Being a touchscreen, when her father grabbed it, it changed picture. To a picture of my girlfriend, fully nude. FML

Today, is my mothers birthday. I decided to take her out to lunch. On the way there, we had a car accident. It was my fault. For my mothers birthday I gave her: 3 broken ribs. FML

Today, was my first meeting with business partners as I am new to the team. Instead of saying that I was looking forward to “stretching my legs” or “spreading my wings”, I told them I was anxious to start “spreading my legs”. FML

Today, I was driving home at night when I saw a billboard flash “report drunk drivers”. 15 minuted later, I saw someone drive recklessly as if they were drunk. When I called the cops, I got pulled over by another cop for talking on my cell phone. I got a $150 ticket. FML

Today, I went to meet my girlfriends parents for the first time. I accidently drove past their house the first time, but saw the whole family outside waiting to meet me. I pulled a U-Turn and heard a thud. The whole family watched me run over their dog. FML

Today, I had my first real meeting with my girlfriend’s parents. We had dinner at a pretty upscale restaurant and everything was going great. When the check came, I offered to pay and I stood up to take out my wallet. When I opened it, 3 condoms fell out on the table in front of them. FML

Today, I was on Facebook looking at pictures of my boyfriend, who was in his friend’s wedding this past weekend. He said that none of the girlfriends could come because it would cost too much for the couple. I spent the weekend alone, and all his friend’s girlfriends are in the pictures. FML

Exam bosses demand hosts cover up their leaks

Heh, just read this Exam bosses target faster cheat takedowns article on El Reg.

The Qualifications and Curriculum Authority (QCA), which is responsible for producing national curriculum assessments and the security of papers, said it was worried that normal procedures for removing illegally posted copyright material online were not fast enough.

“Previous instances of unlawful publication of QCA copyright material have demonstrated that the usual public routes for the notification of a copyright breach (which may be sufficient for dealing with post-exam publication of papers) may not react swiftly enough to limit the damage in an emergency pre-test publication,” the QCA wrote.

To help speed up the process, the authority has asked hosting firms to supply it with an emergency hotline phone number, staffed by employees authorised to take down pages. It also asked for the hotline to be manned outside working hours.

So, they can’t manage to prevent information being leaked, but expect UK web hosts to have staff on call 24/7 ready to jump into action to remove any pages they want removed?

What planet are they on?

Twatspotting

Just a quick post to link to a couple of new blogs set up by my friends:

  • London Fashion Victim – highlighting excellent examples of Shoreditch twattery – the fine art of people around Shoreditch to make a complete and utter twat out of themselves in the name of “fashion”
  • Mind the Twat – "inconsiderate bastards on the tube"

He’s got to be hopping mad

(via Weaselking)


Random photos from my Flickr photostream...