Merge lp://staging/~xaav/bzr/tarball-generator into lp://staging/bzr

Proposed by xaav
Status: Merged
Approved by: Vincent Ladeuil
Approved revision: 5977
Merge reported by: Vincent Ladeuil
Merged at revision: not available
Proposed branch: lp://staging/~xaav/bzr/tarball-generator
Merge into: lp://staging/bzr
Diff against target: 638 lines (+315/-123)
6 files modified
bzrlib/export/__init__.py (+86/-35)
bzrlib/export/dir_exporter.py (+18/-3)
bzrlib/export/tar_exporter.py (+188/-83)
bzrlib/export/zip_exporter.py (+14/-2)
doc/en/release-notes/bzr-2.4.txt (+3/-0)
doc/en/whats-new/whats-new-in-2.4.txt (+6/-0)
To merge this branch: bzr merge lp://staging/~xaav/bzr/tarball-generator
Reviewer Review Type Date Requested Status
Vincent Ladeuil Approve
Robert Collins Pending
Martin Pool Pending
Review via email: mp+63510@code.staging.launchpad.net

This proposal supersedes a proposal from 2011-06-03.

Description of the change

This change fixes the related bug:
- yeild after ball.addfile is called.
- export_tarball function wrapper.

To post a comment you must log in.
Revision history for this message
Jelmer Vernooij (jelmer) wrote : Posted in a previous version of this proposal

Hi Geoff,

On Wed, 2011-06-01 at 22:36 +0000, Geoff wrote:
> Geoff has proposed merging lp:~xaav/bzr/tarball-generator into lp:bzr.
>
> Requested reviews:
> bzr-core (bzr-core)
> Related bugs:
> Bug #791005 in Bazaar: "Impossible to get data from export during progress."
> https://bugs.launchpad.net/bzr/+bug/791005
>
> For more details, see:
> https://code.launchpad.net/~xaav/bzr/tarball-generator/+merge/63180
>
> This change fixes the related bug:
> - yeild after ball.addfile is called.
> - export_tarball function wrapper.
Thanks for working on this... it'd be really nice to have export support
in Loggerhead.

I think rather than making export_tarball a generator, it would make
more sense to factor out the body of the loop in export_tarball, which
could then be used by your function and the existing export_tarball
function. I.e. a export_tarball_item function that just returns a (item,
fileobj) tuple.

Can you add a trivial test function for the new method you expose,
whatever it is? That way we won't accidentally change it, and break
loggerhead.

Cheers,

Jelmer

Revision history for this message
Robert Collins (lifeless) wrote : Posted in a previous version of this proposal

On Thu, Jun 2, 2011 at 11:01 AM, Jelmer Vernooij <email address hidden> wrote:
> Hi Geoff,
>
> On Wed, 2011-06-01 at 22:36 +0000, Geoff wrote:
>> Geoff has proposed merging lp:~xaav/bzr/tarball-generator into lp:bzr.
>>
>> Requested reviews:
>>   bzr-core (bzr-core)
>> Related bugs:
>>   Bug #791005 in Bazaar: "Impossible to get data from export during progress."
>>   https://bugs.launchpad.net/bzr/+bug/791005
>>
>> For more details, see:
>> https://code.launchpad.net/~xaav/bzr/tarball-generator/+merge/63180
>>
>> This change fixes the related bug:
>> - yeild after ball.addfile is called.
>> - export_tarball function wrapper.
> Thanks for working on this... it'd be really nice to have export support
> in Loggerhead.
>
> I think rather than making export_tarball a generator, it would make
> more sense to factor out the body of the loop in export_tarball, which
> could then be used by your function and the existing export_tarball
> function. I.e. a export_tarball_item function that just returns a (item,
> fileobj) tuple.
>
> Can you add a trivial test function for the new method you expose,
> whatever it is? That way we won't accidentally change it, and break
> loggerhead.

That would still mean duplicating code in loggerhead vs bzrlib, which
frankly sucks.

Whats the concern over this being a generator in bzrlib?

-Rob

Revision history for this message
Jelmer Vernooij (jelmer) wrote : Posted in a previous version of this proposal

On Wed, 2011-06-01 at 23:07 +0000, Robert Collins wrote:
> On Thu, Jun 2, 2011 at 11:01 AM, Jelmer Vernooij <email address hidden> wrote:
> > Hi Geoff,
> >
> > On Wed, 2011-06-01 at 22:36 +0000, Geoff wrote:
> >> Geoff has proposed merging lp:~xaav/bzr/tarball-generator into lp:bzr.
> >>
> >> Requested reviews:
> >> bzr-core (bzr-core)
> >> Related bugs:
> >> Bug #791005 in Bazaar: "Impossible to get data from export during progress."
> >> https://bugs.launchpad.net/bzr/+bug/791005
> >>
> >> For more details, see:
> >> https://code.launchpad.net/~xaav/bzr/tarball-generator/+merge/63180
> >>
> >> This change fixes the related bug:
> >> - yeild after ball.addfile is called.
> >> - export_tarball function wrapper.
> > Thanks for working on this... it'd be really nice to have export support
> > in Loggerhead.
> >
> > I think rather than making export_tarball a generator, it would make
> > more sense to factor out the body of the loop in export_tarball, which
> > could then be used by your function and the existing export_tarball
> > function. I.e. a export_tarball_item function that just returns a (item,
> > fileobj) tuple.
> >
> > Can you add a trivial test function for the new method you expose,
> > whatever it is? That way we won't accidentally change it, and break
> > loggerhead.
> That would still mean duplicating code in loggerhead vs bzrlib, which
> frankly sucks.
>
> Whats the concern over this being a generator in bzrlib?
It's a generator, but it still takes a tarball object that it will add
entries to even though it also yields them.

export_tarball would roughly be:

def export_tarball(ball, tree, ...):
   for ie, path in tree.iter_entries_by_dir():
      (item, fileobj) = export_tarball_item(tree, file_id, ...)
      ball.add(item, fileobj)

and loggerhead could do roughly the same thing, except it wouldn't have
to add the items returned to the tarfile object but it could stream them
directly.

Having a separate export_tarball_item function also gives us freedom to
select a different set of files to export - for example, there is a bug
open to support a --exclude option to "bzr export", and there is a bug
about exporting .bzrignore.

Cheers,

Jelmer

Revision history for this message
Robert Collins (lifeless) wrote : Posted in a previous version of this proposal

On Thu, Jun 2, 2011 at 11:40 AM, Jelmer Vernooij <email address hidden> wrote:
>> Whats the concern over this being a generator in bzrlib?
> It's a generator, but it still takes a tarball object that it will add
> entries to even though it also yields them.
>
> export_tarball would roughly be:
>
> def export_tarball(ball, tree, ...):
>   for ie, path in tree.iter_entries_by_dir():
>      (item, fileobj) = export_tarball_item(tree, file_id, ...)
>      ball.add(item, fileobj)
>
> and loggerhead could do roughly the same thing, except it wouldn't have
> to add the items returned to the tarfile object but it could stream them
> directly.

That means loggerhead is duplicating code. I think the yield of the
ball was incidental and not the point of the patch.

> Having a separate export_tarball_item function also gives us freedom to
> select a different set of files to export - for example, there is a bug
> open to support a --exclude option to "bzr export", and there is a bug
> about exporting .bzrignore.

Likewise here - a separate inner function may be a useful thing to do
but it doesn't help loggerhead.

Revision history for this message
xaav (xaav) wrote : Posted in a previous version of this proposal

The yield of the ball is not really helpful to anything - I figured it would make more sense to yield the tarball than yield nothing.

Alternatively, we could move the for in loop to the tgz,tbz, plain tar, etc... exporters.

All I really care about here is fixing the bug in loggerhead. Please make up your mind about what I'm supposed to do - duplicate code in loggerhead or factor it out here - and inform me of that decision.

Revision history for this message
xaav (xaav) wrote : Posted in a previous version of this proposal

Okay, I've updated the code to use a different method. Please tell me which method you prefer.

Revision history for this message
Robert Collins (lifeless) wrote : Posted in a previous version of this proposal

Hi Geoff, sorry you are getting torn in different directions. I've chatted with Jelmer on IRC to avoid this for you.

I think this is pretty close. We may want a test that it works in bzrlib's test suite, to show the contract loggerhead needs.

I think what we want is the following:

* in loggerhead a *single* code path that can handle:
 - tar.gz
 - zip
 - tar.lzma
 - etc

exports. It would be something like you wrote.

output_stream = LoggerheadFilelikeBuffer()
exporter = bzrlib.export.get_export_generator(output_stream, '.tar.gz', tree, revision_id)
for _ in exporter:
    yield output_stream.get_buffer()

* in bzrlib get_export_generator takes care of wrapping the output stream with the right GZipFile etc and raises an exception if it can't stream.

That way we can fixup bzrlib to support zip etc in the future and only have to make cosmetic changes to loggerhead.

What do you think?

Revision history for this message
xaav (xaav) wrote : Posted in a previous version of this proposal

> Hi Geoff, sorry you are getting torn in different directions. I've chatted
> with Jelmer on IRC to avoid this for you.
>
> I think this is pretty close. We may want a test that it works in bzrlib's
> test suite, to show the contract loggerhead needs.
>
> I think what we want is the following:
>
> * in loggerhead a *single* code path that can handle:
> - tar.gz
> - zip
> - tar.lzma
> - etc
>
> exports. It would be something like you wrote.
>
> output_stream = LoggerheadFilelikeBuffer()
> exporter = bzrlib.export.get_export_generator(output_stream, '.tar.gz', tree,
> revision_id)
> for _ in exporter:
> yield output_stream.get_buffer()
>
> * in bzrlib get_export_generator takes care of wrapping the output stream with
> the right GZipFile etc and raises an exception if it can't stream.
>
> That way we can fixup bzrlib to support zip etc in the future and only have to
> make cosmetic changes to loggerhead.
>
> What do you think?

Sounds good. I should have it coded up by tomorrow.

Revision history for this message
xaav (xaav) wrote : Posted in a previous version of this proposal

Okay, I've reworked this to meet the specifications, but it may need some cleaning-up.

You are welcome to commend in the meantime.

Revision history for this message
Martin Pool (mbp) wrote : Posted in a previous version of this proposal

I commend this patch ;-)

[question] It seems to me that you can get streaming by just observing the chunks being written into the file object, and having a generator as well is redundant. I see this is basically needed because PEP333 strongly deprecates having streaming data sent to a write function returned by a generator.

Perhaps it would at least be good to explain that it is done this way for the sake of PEP333.

[question] Given that wsgi does actually support having write() called repeatedly for streaming data, why not use it? I realize it's not the recommended interface, but it is the interface that does fit most naturally with the lower level tarball code we're using. It seems a bit like we're reimplementing something that could be better done in the wsgi framework -- specifically, turning push commands into pull. That would have the concrete benefit of allowing streaming just exactly as data is produced by the compressor, on finer granularity than exporting a single file.

+
+def get_export_generator(tree, dest=None, format=None, root=None, subdir=None, filtered=False,
+ per_file_timestamps=False, fileobj=None):
+
+ """Returns a generator that exports the given Tree to the specific destination.
...
+ :param fileobj: Optional file object to use

Factoring out this function makes sense.

[fix] Please make the docstring explain what the generator actually produces. I am confused whether the content is written to the file object or returned in the generator; also how fileobj interacts with dest.

[idea] Actually, perhaps it would be better to do away with 'dest' entirely at this layer? I think it is only there for the sake of heuristics about choosing the format, and then for opening the file, and

[fix] I see all the actual 'exporters', and also 'export' itself now return generators which must be consumed for them to work. Generally if we change an api in such a way that existing callers will be wrong (rather than getting an error), we ought to rename the api too, and of course add a news entry. Another option would be to keep the existing function names doing the whole job, and add new ones that are generators.

+def export_tarball_item(tree, ball, root, dp, ie, subdir=None, filtered=False,
+ force_mtime=None):

Lifting this out is good.

[tweak] Per pep8, we indent continuation lines either by 4 spaces, or to be just after the preceding parenthesis.

review: Needs Fixing
Revision history for this message
Martin Pool (mbp) wrote : Posted in a previous version of this proposal

Just for the sake of being clear: as the comment tags are meant to indicate, I'd _like_ to see if there's a simpler way, but I'd be ok with just fixing the docs and the API stability.

Revision history for this message
Jelmer Vernooij (jelmer) wrote : Posted in a previous version of this proposal

per_file_timestamps determines whether or not force_mtime is set; passing down per_file_timestamps to the actual exporters is not necessary since it won't be used.

Revision history for this message
xaav (xaav) wrote : Posted in a previous version of this proposal

[question] Given that wsgi does actually support having write() called repeatedly for streaming data, why not use it? I realize it's not the recommended interface, but it is the interface that does fit most naturally with the lower level tarball code we're using. It seems a bit like we're reimplementing something that could be better done in the wsgi framework -- specifically, turning push commands into pull. That would have the concrete benefit of allowing streaming just exactly as data is produced by the compressor, on finer granularity than exporting a single file.

It seemed like calling that method wouldn't support chunked encoding - it would instead store it in a buffer and calculate the content length. Also the documentation regarding chunked encoding isn't good, and this seemed the most appropriate way to do this.

Revision history for this message
xaav (xaav) wrote : Posted in a previous version of this proposal

[fix] Please make the docstring explain what the generator actually produces. I am confused whether the content is written to the file object or returned in the generator; also how fileobj interacts with dest.

The generator does the same thing that had been previously been done, just in chunks.

Revision history for this message
xaav (xaav) wrote : Posted in a previous version of this proposal

[fix] I see all the actual 'exporters', and also 'export' itself now return generators which must be consumed for them to work. Generally if we change an api in such a way that existing callers will be wrong (rather than getting an error), we ought to rename the api too, and of course add a news entry. Another option would be to keep the existing function names doing the whole job, and add new ones that are generators.

I changed how this was done, because I didn't think the code in the finally statement would be executed properly. Please re-review this.

[tweak] Per pep8, we indent continuation lines either by 4 spaces, or to be just after the preceding parenthesis.

Where is this a problem?

Revision history for this message
xaav (xaav) : Posted in a previous version of this proposal
review: Needs Resubmitting
Revision history for this message
Martin Pool (mbp) wrote : Posted in a previous version of this proposal

On 3 June 2011 10:38, Geoff <email address hidden> wrote:
> [fix] Please make the docstring explain what the generator actually produces.  I am confused whether the content is written to the file object or returned in the generator; also how fileobj interacts with dest.
>
> The generator does the same thing that had been previously been done, just in chunks.

Normally Python generators return something on each iteration;
typically the main result of a generator function will be produced
through the generator. This one returns None repeatedly, and the
caller is required to consume the whole thing. This is unusual enough
that it should be clearly documented.

Revision history for this message
Martin Pool (mbp) wrote : Posted in a previous version of this proposal

On 3 June 2011 10:41, Geoff <email address hidden> wrote:
> [fix] I see all the actual 'exporters', and also 'export' itself now return generators which must be consumed for them to work.  Generally if we change an api in such a way that existing callers will be wrong (rather than getting an error), we ought to rename the api too, and of course add a news entry.  Another option would be to keep the existing function names doing the whole job, and add new ones that are generators.
>
> I changed how this was done, because I didn't think the code in the finally statement would be executed properly. Please re-review this.

It looks like you did change export() back into being a non-generator
function, but the others still are. I am concerned there will be
functions that count on the current behaviour so we ought to fix this.

I see::

- try:
- return _exporters[format](tree, dest, root, subdir, filtered=filtered,
- force_mtime=force_mtime)
- finally:
- tree.unlock()
-
+
+ for _ in _exporters[format](tree, dest, root, subdir, filtered,
force_mtime, per_file_timestamps, fileobj):
+
+ yield
+
+ tree.unlock()
+
+

[fix] It's almost always a bug, and it is in this case, to have the
unlock code not in either a finally block, or addCleanup, or some
other equivalent. If the export is interrupted or errors, the tree
won't be unlocked.

+def export_tarball_item(tree, root, final_path, entry,
filtered=False, force_mtime=None):

[tweak] So this doesn't actually export it, it just packs it up ready
to be exported. Please consider renaming it, and document what is
returned.

[aside] We could probably make this faster by avoiding using a
StringIO in the common case, but that's a separate existing issue.

> [tweak] Per pep8, we indent continuation lines either by 4 spaces, or to be just after the preceding parenthesis.
>
> Where is this a problem?

[tweak] Actually, that specific problem isn't there, it just looked
like it to me because some lines are very long. Our coding
convention, following <http://www.python.org/dev/peps/pep-0008/> is
that they should be wrapped before 80 columns.

hth, thanks

Revision history for this message
xaav (xaav) wrote : Posted in a previous version of this proposal

On 3 June 2011 10:41, Geoff <email address hidden> wrote:
> [fix] I see all the actual 'exporters', and also 'export' itself now return generators which must be consumed for them to work. Generally if we change an api in such a way that existing callers will be wrong (rather than getting an error), we ought to rename the api too, and of course add a news entry. Another option would be to keep the existing function names doing the whole job, and add new ones that are generators.
>
> I changed how this was done, because I didn't think the code in the finally statement would be executed properly. Please re-review this.
>
> It looks like you did change export() back into being a non-generator
> function, but the others still are. I am concerned there will be
> functions that count on the current behaviour so we ought to fix this.

The way the code base is currently set up, there is no need to use the other functions. They should just be passing in the information to the export() function.

I see::

- try:
- return _exporters[format](tree, dest, root, subdir, filtered=filtered,
- force_mtime=force_mtime)
- finally:
- tree.unlock()
-
+
+ for _ in _exporters[format](tree, dest, root, subdir, filtered,
force_mtime, per_file_timestamps, fileobj):
+
+ yield
+
+ tree.unlock()
+
+

> [fix] It's almost always a bug, and it is in this case, to have the
> unlock code not in either a finally block, or addCleanup, or some
> other equivalent. If the export is interrupted or errors, the tree
> won't be unlocked.

Fixed and will show up on the next push.

Revision history for this message
xaav (xaav) wrote : Posted in a previous version of this proposal

+def export_tarball_item(tree, root, final_path, entry,
filtered=False, force_mtime=None):

[tweak] So this doesn't actually export it, it just packs it up ready
to be exported. Please consider renaming it, and document what is
returned.

Fixed and will show up on the next push.

Revision history for this message
xaav (xaav) wrote : Posted in a previous version of this proposal

[aside] We could probably make this faster by avoiding using a
StringIO in the common case, but that's a separate existing issue.

> [tweak] Per pep8, we indent continuation lines either by 4 spaces, or to be just after the preceding parenthesis.
>
> Where is this a problem?

[tweak] Actually, that specific problem isn't there, it just looked
like it to me because some lines are very long. Our coding
convention, following <http://www.python.org/dev/peps/pep-0008/> is
that they should be wrapped before 80 columns.

Okay, I'll be sure and fix this.

Revision history for this message
xaav (xaav) wrote : Posted in a previous version of this proposal

Fixed. Are there any more issues?

review: Abstain
Revision history for this message
Martin Pool (mbp) wrote : Posted in a previous version of this proposal

On 3 June 2011 13:40, Geoff <email address hidden> wrote:
> On 3 June 2011 10:41, Geoff <email address hidden> wrote:
>> [fix] I see all the actual 'exporters', and also 'export' itself now return generators which must be consumed for them to work.  Generally if we change an api in such a way that existing callers will be wrong (rather than getting an error), we ought to rename the api too, and of course add a news entry.  Another option would be to keep the existing function names doing the whole job, and add new ones that are generators.
>>
>> I changed how this was done, because I didn't think the code in the finally statement would be executed properly. Please re-review this.
>>
>> It looks like you did change export() back into being a non-generator
>> function, but the others still are.  I am concerned there will be
>> functions that count on the current behaviour so we ought to fix this.
>
> The way the code base is currently set up, there is no need to use the other functions. They should just be passing in the information to the export() function.

If you're reasoning that therefore nobody actually will be using them,
you're probably right, but I wouldn't bet on it. Renaming them is
cheap.

Thanks

Revision history for this message
Martin Pool (mbp) wrote : Posted in a previous version of this proposal

... so the only remaining thing I would like is to rename the per-format exporters to say tar_lzma_export_generator etc.

Revision history for this message
Jelmer Vernooij (jelmer) wrote : Posted in a previous version of this proposal

On Fri, 2011-06-03 at 03:56 +0000, Geoff wrote:
> Review: Abstain
> Fixed. Are there any more issues?
per_file_timestamps and force_mtime do the same thing, no function
should take both.

Cheers,

Jelmer

Revision history for this message
xaav (xaav) wrote : Posted in a previous version of this proposal

Okay, I'll rename them and then create wrapper functions that return the original contents.

Revision history for this message
xaav (xaav) wrote : Posted in a previous version of this proposal

> per_file_timestamps and force_mtime do the same thing, no function
> should take both.

Oops! I'll look into this.

Revision history for this message
xaav (xaav) wrote : Posted in a previous version of this proposal

Okay, this should fix all the issues pointed out so far.

Revision history for this message
xaav (xaav) wrote : Posted in a previous version of this proposal

If there are no further issues then I would appreciate if someone would merge this.

Revision history for this message
xaav (xaav) wrote :

Will someone please either comment on this or merge the branch? I would really like to get this fixed so that I can move on and fix the bug in loggerhead.

Revision history for this message
Martin Pool (mbp) wrote :

Hi Geoff,

> + """Returns a generator that exports the given Tree to the specific destination.

I would just add a sentence there saying that the generator returns None repeatedly while the actual export is written to fileobj.

Aside from that it looks ok, thanks.

I'll let Robert rereview if he wants to.

5975. By xaav

Updated docstring.

Revision history for this message
xaav (xaav) wrote :

Done.

Revision history for this message
Vincent Ladeuil (vila) wrote :

So, the last hurdles seem to be:
- executing the contributor agreement: http://www.canonical.com/contributors
- adding news entries in doc/en/release-notes and doc/en/whats-new

I've fixed some more PEP8 issues at lp:~vila/bzr/tarball-generator, feel free to merge them in your branch.

I've also added 'while the actual export is written to fileobj.' to the get_export_generator doc string as I had to read the code to understand why the generators were yielding None.

This addition may not be true for all generators but you seem to have mentioned the exceptions already.

Revision history for this message
xaav (xaav) wrote :
Revision history for this message
Vincent Ladeuil (vila) wrote :

>>>>> Geoff writes:

    > @vila I'll be merging your branch shortly: https://code.launchpad.net/~vila/bzr/tarball-generator/+merge/63557

You didn't need a merge proposal for it, merging it locally is
enough. You then push *your* resulting branch and launchpad will update
the diff.

Revision history for this message
xaav (xaav) wrote :

Yes, well I wanted to see the diff first.

On Mon, Jun 6, 2011 at 10:11 AM, Vincent Ladeuil <email address hidden>wrote:

> >>>>> Geoff writes:
>
> > @vila I'll be merging your branch shortly:
> https://code.launchpad.net/~vila/bzr/tarball-generator/+merge/63557
>
> You didn't need a merge proposal for it, merging it locally is
> enough. You then push *your* resulting branch and launchpad will update
> the diff.
>
> --
> https://code.launchpad.net/~xaav/bzr/tarball-generator/+merge/63510
> You are the owner of lp:~xaav/bzr/tarball-generator.
>

Revision history for this message
Gordon Tyler (doxxx) wrote :

You can also use `bzr diff --old=. --new=lp:~vila/bzr/tarball-generator` to see the diff between your local branch and vila's. qdiff will accept the same options as well.

Another alternative is to use `bzr merge lp:~vila/bzr/tarball-generator` in your local branch and then use diff/qdiff to see the changes, before you commit the merge.

5976. By xaav <email address hidden>

Merged branch

Revision history for this message
xaav (xaav) wrote :

@vila I've merged your branch.

Revision history for this message
xaav (xaav) wrote :

I've also agreed to the contrib agreement.

Revision history for this message
xaav (xaav) wrote :

Release notes updated.

Revision history for this message
xaav (xaav) wrote :

What's new updated.

5977. By xaav

Updated release notes & What's new.

Revision history for this message
Vincent Ladeuil (vila) wrote :

You forgot to take credits in the news entry :) I'll fix that when landing.

Thanks for your patience !

review: Approve
Revision history for this message
Vincent Ladeuil (vila) wrote :
Download full text (16.1 KiB)

Almost there...

Fails on pqm:

blackbox.test_export.TestExport.test_tar_export_ignores_bzr FAIL 0ms
    Text attachment: log
------------
149.696 creating repository in file:///tmp/testbzr-cRPmgM.tmp/bzrlib.tests.blackbox.test_export.TestExport.test_tar_export_ignores_bzr/work/tree/.bzr/.
149.699 creating branch <bzrlib.branch.BzrBranchFormat7 object at 0x88e6510> in file:///tmp/testbzr-cRPmgM.tmp/bzrlib.tests.blackbox.test_export.TestExport.test_tar_export_ignores_bzr/work/tree/
149.710 trying to create missing lock '/tmp/testbzr-cRPmgM.tmp/bzrlib.tests.blackbox.test_export.TestExport.test_tar_export_ignores_bzr/work/tree/.bzr/checkout/dirstate'
149.710 opening working tree '/tmp/testbzr-cRPmgM.tmp/bzrlib.tests.blackbox.test_export.TestExport.test_tar_export_ignores_bzr/work/tree'
149.725 preparing to commit
    INFO Committing to: /tmp/testbzr-cRPmgM.tmp/bzrlib.tests.blackbox.test_export.TestExport.test_tar_export_ignores_bzr/work/tree/
149.728 Selecting files for commit with filter None
    INFO added a
    INFO Committed revision 1.
149.741 Committed revid <email address hidden> as revno 1.
149.747 run bzr: ['ignore', 'something', '-d', 'tree']
149.748 bazaar version: 2.4.0dev4
149.748 bzr arguments: [u'ignore', u'something', u'-d', u'tree']
149.751 encoding stdout as sys.stdout encoding 'UTF-8'
149.754 opening working tree '/tmp/testbzr-cRPmgM.tmp/bzrlib.tests.blackbox.test_export.TestExport.test_tar_export_ignores_bzr/work/tree'
149.769 preparing to commit
    INFO Committing to: /tmp/testbzr-cRPmgM.tmp/bzrlib.tests.blackbox.test_export.TestExport.test_tar_export_ignores_bzr/work/tree/
149.773 Selecting files for commit with filter None
    INFO added .bzr-adir
    INFO added .bzrignore
    INFO added .bzrrules
    INFO added .bzr-adir/afile
    INFO Committed revision 2.
149.795 Committed revid <email address hidden> as revno 2.
149.797 run bzr: ['export', 'test.tar.gz', '-d', 'tree']
149.797 bazaar version: 2.4.0dev4
149.797 bzr arguments: [u'export', u'test.tar.gz', u'-d', u'tree']
149.799 encoding stdout as sys.stdout encoding 'UTF-8'
149.803 opening working tree '/tmp/testbzr-cRPmgM.tmp/bzrlib.tests.blackbox.test_export.TestExport.test_tar_export_ignores_bzr/work/tree'
149.808 export version <DirStateRevisionTree of <email address hidden> in DirState(u'/tmp/testbzr-cRPmgM.tmp/bzrlib.tests.blackbox.test_export.TestExport.test_tar_export_ignores_bzr/work/tree/.bzr/checkout/dirstate')>
149.811 errors:
"Exception ValueError: ValueError('write() on closed GzipFile object',) in <bound method _Stream.__del__ of <tarfile._Stream instance at 0x7ca1c68>> ignored\n"
149.818 opening working tree '/tmp/testbzr-cRPmgM.tmp'
------------
Text attachment: traceback
------------
Traceback (most recent call last):
  File "/usr/lib/python2.6/dist-packages/testtools/runtest.py", line 144, in _run_user
    return fn(*args)
  File "/usr/lib/python2.6/dist-packages/testtools/testcase.py", line 465, in _run_test_method
    testMethod()
  File "/home/pqm/bzr-pqm-workdir/home/+trunk/bzrlib/tests/blackbox/test_export.py", line 98, in ...

Revision history for this message
Vincent Ladeuil (vila) wrote :

=== modified file 'bzrlib/export/tar_exporter.py'
--- bzrlib/export/tar_exporter.py 2011-06-06 09:31:59 +0000
+++ bzrlib/export/tar_exporter.py 2011-06-07 13:32:57 +0000
@@ -164,9 +163,12 @@
                                       force_mtime):

         yield
-
+ # Closing ball may trigger writes to zipstream
+ ball.close()
+ # Closing zipstream may trigger writes to stream
     zipstream.close()
     if not is_stdout:
+ # Now we can safely close the stream
         stream.close()

Fix both tests for python2.6 and python2.7. I'll land it.

Revision history for this message
Vincent Ladeuil (vila) wrote :

Saga followup (last episode ?):

=== modified file 'bzrlib/export/__init__.py'
--- bzrlib/export/__init__.py 2011-06-06 09:31:59 +0000
+++ bzrlib/export/__init__.py 2011-06-07 15:18:16 +0000
@@ -226,7 +226,7 @@
 register_lazy_exporter('tlzma', ['.tar.lzma'], 'bzrlib.export.tar_exporter',
                        'tar_lzma_exporter_generator')
 register_lazy_exporter('txz', ['.tar.xz'], 'bzrlib.export.tar_exporter',
- 'tar_xz_exporte_generatorr')
+ 'tar_xz_exporter_generator')
 register_lazy_exporter('zip', ['.zip'], 'bzrlib.export.zip_exporter',
                        'zip_exporter_generator')

/me blinks

There is quite a hole in our test coverage here, it's amazing we went that far without anybody noticing...

I'll fix that.

Revision history for this message
Jelmer Vernooij (jelmer) wrote :

On Tue, 2011-06-07 at 15:29 +0000, Vincent Ladeuil wrote:
> Saga followup (last episode ?):
>
> === modified file 'bzrlib/export/__init__.py'
> --- bzrlib/export/__init__.py 2011-06-06 09:31:59 +0000
> +++ bzrlib/export/__init__.py 2011-06-07 15:18:16 +0000
> @@ -226,7 +226,7 @@
> register_lazy_exporter('tlzma', ['.tar.lzma'], 'bzrlib.export.tar_exporter',
> 'tar_lzma_exporter_generator')
> register_lazy_exporter('txz', ['.tar.xz'], 'bzrlib.export.tar_exporter',
> - 'tar_xz_exporte_generatorr')
> + 'tar_xz_exporter_generator')
> register_lazy_exporter('zip', ['.zip'], 'bzrlib.export.zip_exporter',
> 'zip_exporter_generator')
>
> /me blinks
>
> There is quite a hole in our test coverage here, it's amazing we went that far without anybody noticing...
>
> I'll fix that.
We do have tests, but you need to have python-lzma installed to be able
to run them.

Cheers,

Jelmer

Revision history for this message
xaav (xaav) wrote :

Wow. Sorry for my clumsy typing.

Revision history for this message
xaav (xaav) wrote :

Okay, test_export and blackbox.test_export tests passed on my machine.

5978. By xaav

Fixed clumsy typing.

5979. By xaav

Fixed export.

Revision history for this message
Vincent Ladeuil (vila) wrote :

>>>>> Jelmer Vernooij <email address hidden> writes:

<snip/>
    > We do have tests, but you need to have python-lzma installed to be able
    > to run them.

Yup, sorry, spoke too soon. bt.test_export not appearing in the proposal
led me on the wrong track.

Revision history for this message
Vincent Ladeuil (vila) wrote :

>>>>> Xaav writes:

    > Wow. Sorry for my clumsy typing.

No worries, that what tests are for :)

And *I* tyop a lot ;)

     > Okay, test_export and blackbox.test_export tests passed on my
     > machine.

Yeah, on mine too, even with the typo since I didn't have lzma installed
(as I discovered while Jelmer was trying to tell me ;)

So no hole at all since indeed pqm caught your typo ;)

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
The diff is not available at this time. You can reload the page or download it.