From: "David Kågedal" <david@kagedal.org>
To: git@vger.kernel.org
Subject: Re: [PATCH - stgit] Patch to allow import of compressed files
Date: Thu, 19 Jun 2008 16:17:57 +0200 [thread overview]
Message-ID: <878wx14iga.fsf@lysator.liu.se> (raw)
In-Reply-To: 20080610063328.GB26965@diana.vm.bytemark.co.uk
Karl Hasselström <kha@treskal.com> writes:
> 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.
Or use os.path.splitext(filename) which will save you a couple of
endswith calls as well.
> 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. :-)
--
David Kågedal <david@kagedal.org>
prev parent reply other threads:[~2008-06-19 21:37 UTC|newest]
Thread overview: 18+ messages / expand[flat|nested] mbox.gz Atom feed top
2008-06-09 18:38 [PATCH - stgit] Patch to allow import of compressed files Clark Williams
2008-06-10 6:33 ` Karl Hasselström
2008-06-10 6:38 ` Asheesh Laroia
2008-06-10 8:07 ` Sverre Rabbelier
2008-06-10 9:53 ` Karl Hasselström
2008-06-10 9:57 ` Sverre Rabbelier
2008-06-10 10:28 ` Karl Hasselström
2008-06-10 10:33 ` Sverre Rabbelier
2008-06-10 14:06 ` Clark Williams
2008-06-10 14:01 ` Clark Williams
2008-06-10 13:57 ` Clark Williams
2008-06-10 14:04 ` Asheesh Laroia
2008-06-10 13:54 ` Clark Williams
2008-06-10 13:54 ` Clark Williams
2008-06-11 6:27 ` Karl Hasselström
2008-06-11 17:28 ` Clark Williams
2008-06-11 19:14 ` Karl Hasselström
2008-06-19 14:17 ` David Kågedal [this message]
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=878wx14iga.fsf@lysator.liu.se \
--to=david@kagedal.org \
--cc=git@vger.kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.