diff options
author | Aaron Bentley <aaron.bentley@utoronto.ca> | 2005-03-19 06:04:41 +0000 |
---|---|---|
committer | Aaron Bentley <aaron.bentley@utoronto.ca> | 2005-03-19 06:04:41 +0000 |
commit | 92826d47239312d7ed3cbc6638be44c6e84ca8a3 (patch) | |
tree | 43f27171822472f5445b7bd1b9bf14b131750c1c /libbe/arch.py | |
parent | 148f6d366053422257b1c021cf86fb884c13dff8 (diff) | |
download | bugseverywhere-92826d47239312d7ed3cbc6638be44c6e84ca8a3.tar.gz |
Added RCS configuration.
Diffstat (limited to 'libbe/arch.py')
-rw-r--r-- | libbe/arch.py | 32 |
1 files changed, 32 insertions, 0 deletions
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" |