diff options
Diffstat (limited to 'libbe/bzr.py')
-rw-r--r-- | libbe/bzr.py | 17 |
1 files changed, 10 insertions, 7 deletions
diff --git a/libbe/bzr.py b/libbe/bzr.py index fd6d4a6..bc4d98d 100644 --- a/libbe/bzr.py +++ b/libbe/bzr.py @@ -14,19 +14,20 @@ # You should have received a copy of the GNU General Public License # along with this program; if not, write to the Free Software # Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA -from popen2 import Popen3 +from subprocess import Popen import os import config def invoke(args): - q=Popen3(args, True) - output = q.fromchild.read() - error = q.childerr.read() + q=Popen(args) + output = q.stdout.read() + error = q.stderr.read() status = q.wait() - if os.WIFEXITED(status): - return os.WEXITSTATUS(status), output, error + if status >= 0: + return status, output, error raise Exception("Command failed: %s" % error) + def invoke_client(*args, **kwargs): cl_args = ["bzr"] cl_args.extend(args) @@ -91,11 +92,13 @@ def unlink(path): def detect(path): """Detect whether a directory is revision-controlled using bzr""" path = os.path.realpath(path) + old_path = None while True: if os.path.exists(os.path.join(path, ".bzr")): return True - if path == "/": + if path == old_path: return False + old_path = path path = os.path.dirname(path) |