Mercurial > hg > gut
changeset 7:67ec22ce347c
add a delete command
author | Jeff Hammel <jhammel@mozilla.com> |
---|---|
date | Wed, 21 Jul 2010 16:23:43 -0700 |
parents | ef895ddba2d3 |
children | 0c0ade65b9f9 |
files | gut/main.py |
diffstat | 1 files changed, 13 insertions(+), 1 deletions(-) [+] |
line wrap: on
line diff
--- 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)