# HG changeset patch # User Jeff Hammel # Date 1279754623 25200 # Node ID 67ec22ce347c366b5bc7e8ccdcfcddfeca1b6828 # Parent ef895ddba2d3f6f6d27a0596061e2aea67c9939d add a delete command diff -r ef895ddba2d3 -r 67ec22ce347c gut/main.py --- a/gut/main.py Wed Jul 21 16:18:59 2010 -0700 +++ b/gut/main.py Wed Jul 21 16:23:43 2010 -0700 @@ -50,7 +50,11 @@ """ # sanity check - self.root() + try: + self.root() + except SystemExit: + print "Not in a git repository" + sys.exit(1) self.remote = remote self.simulate = simulate @@ -161,6 +165,14 @@ call(['git', 'checkout', branch]) os.chdir(cwd) + def delete(self): + """delete the current feature branch""" + # sanity check + branch = self.branch() + assert branch != 'master', "You can't delete the master!" + call(['git', 'checkout', 'master']) + call(['git', '-D', branch]) + def branch(self): """print what branch you're on""" output = call(['git', 'branch'], output=False, pipe=True)