From 5323cc1ba94095938c54a2853a3827c14b420e66 Mon Sep 17 00:00:00 2001 From: "W. Trevor King" Date: Tue, 6 Oct 2009 06:37:21 -0400 Subject: Moved VCS detection from _vcs_help() to _vcs_version(). The version string is useful information to have around, while the help string is probably not. For example, we use it in darcs.Darcs._vcs_get_file_contents() to construct an incantation appropriate to the version we're dealing with. --- libbe/darcs.py | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) (limited to 'libbe/darcs.py') diff --git a/libbe/darcs.py b/libbe/darcs.py index 16005f2..a46403c 100644 --- a/libbe/darcs.py +++ b/libbe/darcs.py @@ -40,8 +40,10 @@ class Darcs(vcs.VCS): name="darcs" client="darcs" versioned=True - def _vcs_help(self): - status,output,error = self._u_invoke_client("--help") + def _vcs_version(self): + status,output,error = self._u_invoke_client("--version") + num_part = output.split(" ")[0] + self.parsed_version = [int(i) for i in num_part.split(".")] return output def _vcs_detect(self, path): if self._u_search_parent_directories(path, "_darcs") != None : @@ -97,9 +99,9 @@ class Darcs(vcs.VCS): return vcs.VCS._vcs_get_file_contents(self, path, revision, binary=binary) else: - try: + if self.parsed_version[0] >= 2: return self._u_invoke_client("show", "contents", "--patch", revision, path) - except vcs.CommandError: + else: # Darcs versions < 2.0.0pre2 lack the "show contents" command status,output,error = self._u_invoke_client("diff", "--unified", -- cgit