aboutsummaryrefslogtreecommitdiffstats
path: root/libbe/rcs.py
diff options
context:
space:
mode:
authorAaron Bentley <abentley@panoramicfeedback.com>2006-02-03 15:17:59 -0500
committerAaron Bentley <abentley@panoramicfeedback.com>2006-02-03 15:17:59 -0500
commitd4b7a0a07db702a80c279b5c92a999cd91dfc1bc (patch)
tree61a6db543de3db754b99c310685203b3cc5326bb /libbe/rcs.py
parent979fe49abcd905ac9db403e665ea442376a061c3 (diff)
downloadbugseverywhere-d4b7a0a07db702a80c279b5c92a999cd91dfc1bc.tar.gz
Got commit basics working for bzr
Diffstat (limited to 'libbe/rcs.py')
-rw-r--r--libbe/rcs.py16
1 files changed, 16 insertions, 0 deletions
diff --git a/libbe/rcs.py b/libbe/rcs.py
index c0966f8..ac96734 100644
--- a/libbe/rcs.py
+++ b/libbe/rcs.py
@@ -14,6 +14,7 @@
# 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 subprocess import Popen, PIPE
def rcs_by_name(rcs_name):
"""Return the module for the RCS with the given name"""
if rcs_name == "Arch":
@@ -36,3 +37,18 @@ def detect(dir):
return bzr
import no_rcs
return no_rcs
+
+class CommandError(Exception):
+ def __init__(self, err_str, status):
+ Exception.__init__(self, "Command failed (%d): %s" % (status, err_str))
+ self.err_str = err_str
+ self.status = status
+
+def invoke(args, expect=(0,)):
+ q = Popen(args, stdin=PIPE, stdout=PIPE, stderr=PIPE)
+ output = q.stdout.read()
+ error = q.stderr.read()
+ status = q.wait()
+ if status not in expect:
+ raise CommandError(error, status)
+ return status, output, error