# HG changeset patch # User Jeff Hammel # Date 1279755443 25200 # Node ID 0c0ade65b9f9b3ea506faba99cd9d789c437bb60 # Parent 67ec22ce347c366b5bc7e8ccdcfcddfeca1b6828 fix errors diff -r 67ec22ce347c -r 0c0ade65b9f9 gut/main.py --- 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 = '' 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 '' output = call(['git', 'rev-parse', '--show-cdup'], output=False, pipe=True) location = output['stdout'].strip() if not location: