diff options
author | W. Trevor King <wking@drexel.edu> | 2009-11-21 14:54:11 -0500 |
---|---|---|
committer | W. Trevor King <wking@drexel.edu> | 2009-11-21 14:54:11 -0500 |
commit | bb8dd5066f730f9bb0ac0398bf9a167e9736a808 (patch) | |
tree | 23a68fb2476d40033af7f3b8d6429a315e2b0a82 /libbe | |
parent | 85fd7e2681005e8b47ffc1e73fcc0cca93025921 (diff) | |
download | bugseverywhere-bb8dd5066f730f9bb0ac0398bf9a167e9736a808.tar.gz |
Fix libbe.vcs.VCS.get_file_contents(allow_no_vcs=True,binary=True).
In it's previous form it had ignored the binary option if
self._use_vcs() returned False.
Also added a few more details to the docstring, explaining the
arguments.
Diffstat (limited to 'libbe')
-rw-r--r-- | libbe/vcs.py | 9 |
1 files changed, 8 insertions, 1 deletions
diff --git a/libbe/vcs.py b/libbe/vcs.py index b1fd114..57a0245 100644 --- a/libbe/vcs.py +++ b/libbe/vcs.py @@ -334,6 +334,10 @@ class VCS(object): """ Get the file as it was in a given revision. Revision==None specifies the current revision. + + allow_no_vcs==True allows direct access to files through + codecs.open() or open() if the vcs decides it can't handle the + given path. """ if not os.path.exists(path): raise NoSuchFile(path) @@ -341,7 +345,10 @@ class VCS(object): relpath = self._u_rel_path(path) contents = self._vcs_get_file_contents(relpath,revision,binary=binary) else: - f = codecs.open(path, "r", self.encoding) + if binary == True: + f = codecs.open(path, "r", self.encoding) + else: + f = open(path, "rb") contents = f.read() f.close() return contents |