From 92826d47239312d7ed3cbc6638be44c6e84ca8a3 Mon Sep 17 00:00:00 2001 From: Aaron Bentley Date: Sat, 19 Mar 2005 06:04:41 +0000 Subject: Added RCS configuration. --- libbe/arch.py | 32 ++++++++++++++++++++++++++++++++ 1 file changed, 32 insertions(+) (limited to 'libbe/arch.py') diff --git a/libbe/arch.py b/libbe/arch.py index b1b88fd..7e1cd1f 100644 --- a/libbe/arch.py +++ b/libbe/arch.py @@ -24,3 +24,35 @@ def add_id(filename): def delete_id(filename): invoke_client("delete-id", filename) + +def mkdir(path): + os.mkdir(path) + add_id(path) + +def set_file_contents(path, contents): + add = not os.path.exists(path) + file(path, "wb").write(contents) + if add: + add_id(path) + +def unlink(path): + try: + os.unlink(path) + delete_id(path) + except OSError, e: + if e.errno != 2: + raise + + +def detect(path): + """Detect whether a directory is revision-controlled using Arch""" + path = os.path.realpath(path) + while True: + if os.path.exists(os.path.join(path, "{arch}")): + return True + if path == "/": + return False + path = os.path.dirname(path) + + +name = "Arch" -- cgit