git/list[1] front-page[2] threads[3] people[4] search[5] about
 

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

From
CWClark Williams <clark.williams@gmail.com>
Date
Jun 10, 2008, 13:54 UTC
Message-ID
<484E877E.801@gmail.com>
In-Reply-To
<20080610063328.GB26965@diana.vm.bytemark.co.uk>
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1
Karl Hasselström wrote:
Show 13 quoted lines
>> +        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.
Done.
> 
>   * We try to use single quotes wherever possible (except when triple
>     quoting). You're using a mix ...

I normally use single quotes too, but I've been doing a bunch of C programming lately, so that's my excuse and I'm sticking with it. Replaced.

> 
>   * .replace() will happily replace anywhere in the string. Please
>     consider using stgit.util.strip_suffix() instead.
Ah, didn't know about strip_suffix(). Done.
> 
> 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. :-)
> 

I'll work on that. Can't do it right now, but I'll look at the test harness and see what it'll take.

Clark
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.9 (GNU/Linux)
Comment: Using GnuPG with Fedora - http://enigmail.mozdev.org

iEYEARECAAYFAkhOh34ACgkQqA4JVb61b9ea9gCgoV1MZbT2F62WEkduOfmkgdP3 BwIAnApT1o+VttF4VRHJj4DkPmi/HXfm =Uwho -----END PGP SIGNATURE-----

Previous: Asheesh LaroiaNext: Clark Williams
Message 13 of 18 in “Patch to allow import of compressed files”
  1. Patch to allow import of compressed filesClark Williams, Jun 9, 2008
  2. Karl HasselströmJun 10, 2008
  3. Asheesh LaroiaJun 10, 2008
  4. Sverre RabbelierJun 10, 2008
  5. Karl HasselströmJun 10, 2008
  6. Sverre RabbelierJun 10, 2008
  7. Karl HasselströmJun 10, 2008
  8. Sverre RabbelierJun 10, 2008
  9. Clark WilliamsJun 10, 2008
  10. Clark WilliamsJun 10, 2008
  11. Clark WilliamsJun 10, 2008
  12. Asheesh LaroiaJun 10, 2008
  13. Clark WilliamsJun 10, 2008
  14. Clark WilliamsJun 10, 2008
  15. Karl HasselströmJun 11, 2008
  16. Clark WilliamsJun 11, 2008
  17. Karl HasselströmJun 11, 2008
  18. David KågedalJun 19, 2008

Read the whole thread, see it on lore, or plain text.

$ cat FOOTERMessages come from the public archive at lore.kernel.org/git, fetched every hour. The front page is chosen and written each morning by an AI editor and can be wrong; the threads themselves are the record. About and API. For agents: an MCP server at https://gitlist.dev/mcp, and any thread, story or person page as Markdown by adding .md to its URL (or sending Accept: text/markdown). Details in /llms.txt.