Mercurial > hg > gut
changeset 8:0c0ade65b9f9
fix errors
author | Jeff Hammel <jhammel@mozilla.com> |
---|---|
date | Wed, 21 Jul 2010 16:37:23 -0700 |
parents | 67ec22ce347c |
children | b344537797de |
files | gut/main.py |
diffstat | 1 files changed, 12 insertions(+), 5 deletions(-) [+] |
line wrap: on
line diff
--- a/gut/main.py Wed Jul 21 16:23:43 2010 -0700 +++ b/gut/main.py Wed Jul 21 16:37:23 2010 -0700 @@ -49,6 +49,8 @@ - branches: branches to apply to """ + self.simulate = simulate + # sanity check try: self.root() @@ -57,7 +59,6 @@ sys.exit(1) self.remote = remote - self.simulate = simulate self.branches = branches if simulate: globals()['call'] = fake_call @@ -142,6 +143,8 @@ # sanity check branch = self.branch() + if self.simulate: + branch = '<branch>' assert branch != 'master', "Can't apply master to itself!" assert self.branches, "No branches defined!" @@ -151,8 +154,9 @@ log = os.path.abspath(branch + '.log') # apply the patch - cwd = os.getcwd() - os.chdir(self.root()) + if not self.simulate: + cwd = os.getcwd() + os.chdir(self.root()) for b in self.branches: call(['git', 'checkout', b]) call(['patch -p1 < %s' % diff]) @@ -163,7 +167,8 @@ # cleanup call(['git', 'checkout', branch]) - os.chdir(cwd) + if not self.simulate: + os.chdir(cwd) def delete(self): """delete the current feature branch""" @@ -184,7 +189,9 @@ def root(self): """return (relative) root location of repository""" - + + if self.simulate: + return '<root>' output = call(['git', 'rev-parse', '--show-cdup'], output=False, pipe=True) location = output['stdout'].strip() if not location: