Merge lp:~pwlars/bughelper/bughelper.364896 into lp:bughelper

Proposed by Paul Larson
Status: Merged
Merged at revision: not available
Proposed branch: lp:~pwlars/bughelper/bughelper.364896
Merge into: lp:bughelper
Diff against target: None lines
To merge this branch: bzr merge lp:~pwlars/bughelper/bughelper.364896
Reviewer Review Type Date Requested Status
Bughelper Developers Pending
Review via email: mp+5766@code.launchpad.net
To post a comment you must log in.
Revision history for this message
Paul Larson (pwlars) wrote :

Fix for bug #364896 (rev 229)
minor cleanup for subprocess calls (rev 230)

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'bugHelper/bzrutils.py'
2--- bugHelper/bzrutils.py 2007-09-10 14:42:58 +0000
3+++ bugHelper/bzrutils.py 2009-04-21 23:36:37 +0000
4@@ -3,7 +3,7 @@
5
6 import os
7 import time
8-import subprocess
9+from subprocess import *
10 from bzrlib.bzrdir import BzrDir
11
12 DEFAULT_BRANCH = "http://bazaar.launchpad.net/~bugsquad/bughelper-data/main/"
13@@ -21,9 +21,9 @@
14 """
15 result = (None,None)
16 if not os.path.exists(path):
17- f = os.popen3("bzr branch %s %s" % (DEFAULT_BRANCH, path))
18- sout=f[1].readlines()
19- eout=f[2].readlines()
20+ f = Popen(["bzr", "branch", DEFAULT_BRANCH, path], stderr=PIPE, stdout=PIPE)
21+ sout=f.stdout.readlines()
22+ eout=f.stderr.readlines()
23 if not sout and eout[0].startswith("bzr: ERROR:"):
24 raise BzrError, eout[0]
25 result = (sout,eout)
26@@ -32,9 +32,9 @@
27 if bi.timestamp + time.timezone + float(intervall)*60*60 <= time.time():
28 old_cwd = os.getcwd()
29 os.chdir(path)
30- f = os.popen3("bzr pull %s" % DEFAULT_BRANCH)
31+ f = Popen(["bzr", "pull", DEFAULT_BRANCH], stderr=PIPE, stdout=PIPE)
32 os.chdir(old_cwd)
33- result = (f[1].readlines(),f[2].readlines())
34+ result = (f.stdout.readlines(),f.stderr.readlines())
35 return result
36
37 def update_branch(path, intervall, default_branch, branch_type="checkout"):
38@@ -46,7 +46,7 @@
39 out, error = None, None
40 assert branch_type in ["branch", "checkout"], "branch_type has to be 'branch' or 'checkout'"
41 if not os.path.exists(path):
42- p = subprocess.Popen(["bzr", branch_type, default_branch, path], stderr=subprocess.PIPE, stdout=subprocess.PIPE)
43+ p = Popen(["bzr", branch_type, default_branch, path], stderr=PIPE, stdout=PIPE)
44 out = p.stdout.read()
45 error = p.stderr.read()
46 if not out and not len(error.split("bzr: ERROR:")) == 1:
47@@ -60,7 +60,7 @@
48 if isinstance(intervall, type(None)):
49 intervall = 0
50 if bi.timestamp + time.timezone + float(intervall)*60*60 <= time.time():
51- p = subprocess.Popen(["bzr", operation, default_branch], cwd=path, stderr=subprocess.PIPE, stdout=subprocess.PIPE)
52+ p = Popen(["bzr", operation, default_branch], cwd=path, stderr=PIPE, stdout=PIPE)
53 out = p.stdout.read()
54 error = p.stderr.read()
55 return out, error

Subscribers

People subscribed via source and target branches

to all changes:
to status/vote changes: