Hello,

Na Tue, Aug 21, 2007 at 01:43:01PM +0200, lars <[EMAIL PROTECTED]> pisal(a):
>      def getcleanfile(self, revision=None):
>          """Get a clean version of a file from the git repository"""
> -        command = "git cat-file blob $(git ls-tree HEAD %s|sed 's/.* 
> \([a-f0-9]\{40\}\)\t.*/\1/')" \
> -                     % shellescape(self.location)
> -        output, error = pipe(command)
> -        if error:
> -            raise IOError("git error running '%s': %s" % (command, error))
> -        return output
> +        # get ls-tree HEAD
> +        command = [ "git", "ls-tree", "HEAD", shellescape(self.location) ]
> +        exitcode, output_ls, error = pipe(command)
> +        if exitcode != 0:
> +            raise IOError("[GIT] ls-tree failed for '%s': %s" \
> +                    % self.location, error)
> +        # determine the id
> +        match = re.search(" ([a-f0-9]{40})\t", output_ls)
> +        if not match:
> +            raise IOError("[GIT] failed to get git id for '%s'" % 
> self.location)
> +        # remove whitespace around
> +        git_id = match.groups()[0].strip()
> +        # run cat-file
> +        command = [ "git", "cat-file", "blob", git_id ]
> +        exitcode, output_cat, error = pipe(command)
> +        if exitcode != 0:
> +            raise IOError("[GIT] cat-file failed for ('%s', %s): %s" \
> +                    % (self.location, git_id, error))
> +        return output_ls + output_cat

this is my bad. instead of

git cat-file blob $(git ls-tree HEAD %s|sed 's/.* \([a-f0-9]\{40\}\)\t.*/\1/')

you can simply do a

git show HEAD:%s

i just forgot about git show when i wrote the code

- VMiklos

Attachment: pgp2YY0CbhJhu.pgp
Description: PGP signature

-------------------------------------------------------------------------
This SF.net email is sponsored by: Splunk Inc.
Still grepping through log files to find problems?  Stop.
Now Search log events and configuration files using AJAX and a browser.
Download your FREE copy of Splunk now >>  http://get.splunk.com/
_______________________________________________
Translate-pootle mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/translate-pootle

Reply via email to