Re: [PATCH 3/9] lib/bpgit.py: add git status support

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Wed, 2013-05-22 at 04:34 -0700, Luis R. Rodriguez wrote:
> From: "Luis R. Rodriguez" <mcgrof@xxxxxxxxxxxxxxxx>
> 
> We use --porcelain given that this spits out the results
> in an easy-to-parse format for scripts and will remain stable
> across git versions and regardless of user configuration.
> 
> We will use this later.
> 
> Signed-off-by: Luis R. Rodriguez <mcgrof@xxxxxxxxxxxxxxxx>
> ---
>  lib/bpgit.py |   12 ++++++++++++
>  1 file changed, 12 insertions(+)
> 
> diff --git a/lib/bpgit.py b/lib/bpgit.py
> index 40523f2..335cc9c 100644
> --- a/lib/bpgit.py
> +++ b/lib/bpgit.py
> @@ -27,6 +27,18 @@ def rev_parse(rev='HEAD', tree=None):
>          raise SHAError()
>      return sha
>  
> +def status(tree=None):
> +    cmd = ['git', 'status', '--porcelain']
> +
> +    process = subprocess.Popen(cmd,
> +                               stdout=subprocess.PIPE, stderr=subprocess.STDOUT,
> +                               close_fds=True, universal_newlines=True, cwd=tree)
> +    stdout = process.communicate()[0]
> +    process.wait()
> +    _check(process)
> +
> +    return stdout.strip()

I think it would make some sense to parse this here into something more
"pythonic", like a list of tuples or so.

johannes

--
To unsubscribe from this list: send the line "unsubscribe backports" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html




[Index of Archives]     [Linux ARM Kernel]     [Linux ARM]     [Linux Omap]     [Fedora ARM]     [IETF Annouce]     [Security]     [Bugtraq]     [Linux]     [Linux OMAP]     [Linux MIPS]     [ECOS]     [Asterisk Internet PBX]     [Linux API]

  Powered by Linux