# HG changeset patch # User Atul Varma # Date 1275549360 0 # Node ID 388528fb31c7d535906322be2747d0397ca60c91 # Parent 5e305b2569fef77982c776ca3070618b3a43acba fixes to make things work under older versions of hg diff -r 5e305b2569fe -r 388528fb31c7 bzezpatch/app.py --- a/bzezpatch/app.py Thu Jun 03 07:04:21 2010 +0000 +++ b/bzezpatch/app.py Thu Jun 03 07:16:00 2010 +0000 @@ -64,7 +64,7 @@ except Exception: return error_bad_request() - tmplog = tempfile.TemporaryFile(prefix='hg-trypatch-') + tmplog = tempfile.TemporaryFile(prefix='hg-trypatch-log-') try: patch = self.hg.trypatch(url, out=tmplog) info = {'success': True, 'patch': patch} diff -r 5e305b2569fe -r 388528fb31c7 bzezpatch/hg.py --- a/bzezpatch/hg.py Thu Jun 03 07:04:21 2010 +0000 +++ b/bzezpatch/hg.py Thu Jun 03 07:16:00 2010 +0000 @@ -1,3 +1,4 @@ +import os import sys import subprocess import tempfile @@ -8,7 +9,8 @@ self.__dict__.update(kwargs) def trypatch(self, pull_url, out=sys.stdout): - temp_repo = tempfile.mkdtemp(prefix='hg-trypatch-') + temp_dir = tempfile.mkdtemp(prefix='hg-trypatch-') + temp_repo = os.path.join(temp_dir, 'repo') try: # Step 1: Pull and update local canonical repo. out.write('pulling and updating local canonical repo\n') @@ -34,8 +36,11 @@ # Step 4: Apply the patch by pulling from the foreign repo. out.write('pulling from %s\n' % pull_url) - subprocess.check_call([self.hg, '-R', temp_repo, 'pull', pull_url, - '-u', '--rebase'], + subprocess.check_call([self.hg, '-R', temp_repo, 'pull', + '--rebase', pull_url], + stdout=out, stderr=out) + subprocess.check_call([self.hg, '-R', temp_repo, 'pull', + '--update', pull_url], stdout=out, stderr=out) # Step 5: Generate a patch by diffing the tip of the