Ken Guest’s online diary

March 11, 2015

Disabling hg clean

Filed under: mercurial — kenguest @ 20:46

I use phing a lot in work for kicking off unit tests, phpdocumentor, linting code and other such tasks – this includes using a ‘clean’ target which removes all of the generated files for when I want to ‘trim the fat’.

This is great, and all I have to do is type
$ phing clean
and the files are gone 😉

Occasionally I’ll have other files inside my working clone/repo – documentation that I’m writing up, debug files and such. Phing knows to leave these alone.

Did I mention we use mercurial? Mercurial has a clean subcommand.
$ hg clean
Do this, and all non-version controlled files are gone. Including documentation, debug files and such that I might have decided aren’t ready or shouldn’t be in the repo. I rarely use this.

I’m sure you can see the oncoming train that’s going to collide – if I tap “hg” when I mean to type “phing” all my carefully edited files may as well be exposed to supermagnetic radiation. Vamoosed! Gone. The can no longer be read! (We’ve a nespresso machine in work too – maybe I’m overdoing the caffeine.)

Q: So what to do?
A: Cheat – outrageously.

The start of the [alias] section in my ~/.hgrc file now redefines ‘clean’:
clean = version

Job done!


1 Comment »

  1. I really like your writing style, superb info, thanks for putting up :

    Comment by Golden Goose Deluxe Brand — May 7, 2018 @ 03:49

RSS feed for comments on this post. TrackBack URI

Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )


Connecting to %s

Create a free website or blog at