From c65661ce0bcacf67169faf3f62d495a1e8269aa8 Mon Sep 17 00:00:00 2001 From: Gianluca Montecchi Date: Wed, 7 Oct 2009 20:41:49 +0200 Subject: Updated to trunk --- libbe/darcs.py | 26 ++++++++++++++------------ 1 file changed, 14 insertions(+), 12 deletions(-) (limited to 'libbe/darcs.py') diff --git a/libbe/darcs.py b/libbe/darcs.py index 16005f2..9115886 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 : @@ -95,20 +97,20 @@ class Darcs(vcs.VCS): def _vcs_get_file_contents(self, path, revision=None, binary=False): if revision == None: return vcs.VCS._vcs_get_file_contents(self, path, revision, - binary=binary) + binary=binary) else: - try: - return self._u_invoke_client("show", "contents", "--patch", revision, path) - except vcs.CommandError: + if self.parsed_version[0] >= 2: + status,output,error = self._u_invoke_client( \ + "show", "contents", "--patch", revision, path) + return output + else: # Darcs versions < 2.0.0pre2 lack the "show contents" command - status,output,error = self._u_invoke_client("diff", "--unified", - "--from-patch", - revision, path) + status,output,error = self._u_invoke_client( \ + "diff", "--unified", "--from-patch", revision, path) major_patch = output - status,output,error = self._u_invoke_client("diff", "--unified", - "--patch", - revision, path) + status,output,error = self._u_invoke_client( \ + "diff", "--unified", "--patch", revision, path) target_patch = output # "--output -" to be supported in GNU patch > 2.5.9 -- cgit