Re: [PATCH - stgit] Patch to allow import of compressed files

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

 



On 2008-06-09 13:38:55 -0500, Clark Williams wrote:

> This patch allows StGit to directly import compressed (.gz and .bz2)
> files with reasonable patch names.
>
> I do a lot of work on modified kernel trees and usually the first
> two things imported are a stable update patch followed immediately
> by an -rt patch, both of which are compressed. With this patch I can
> just copy the files down directly from kernel.org and import them,
> rather than having to keep uncompressed copies around.
>
> Hey, I'm lazy... :)

Lazy is good. Thanks for the patch!

> +        if filename.endswith(".gz"):
> +            import gzip
> +            f = gzip.open(filename)
> +            pname = filename.replace(".gz", "")
> +        elif filename.endswith(".bz2"):
> +            import bz2
> +            f = bz2.BZ2File(filename, 'r')
> +            pname = filename.replace(".bz2", "")

Some comments here:

  * By my reading of the docs, the second argument to BZ2File defaults
    to 'r' anyway, so you could omit it.

  * We try to use single quotes wherever possible (except when triple
    quoting). You're using a mix ...

  * .replace() will happily replace anywhere in the string. Please
    consider using stgit.util.strip_suffix() instead.

And last but not least, it'd be terrific if you'd let me bully you
into adding .gz and .bz2 test cases for t1800-import. :-)

-- 
Karl Hasselström, kha@xxxxxxxxxxx
      www.treskal.com/kalle
--
To unsubscribe from this list: send the line "unsubscribe git" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html

[Index of Archives]     [Linux Kernel Development]     [Gcc Help]     [IETF Annouce]     [DCCP]     [Netdev]     [Networking]     [Security]     [V4L]     [Bugtraq]     [Yosemite]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux SCSI]     [Fedora Users]

  Powered by Linux