/loggerhead/trunk

To get this branch, use:
bzr branch http://gegoxaren.bato24.eu/bzr/loggerhead/trunk

« back to all changes in this revision

Viewing changes to loggerhead/exporter.py

  • Committer: Vincent Ladeuil
  • Date: 2011-06-28 15:55:36 UTC
  • mto: (431.2.18 loggerhead)
  • mto: This revision was merged to the branch mainline in revision 461.
  • Revision ID: v.ladeuil+lp@free.fr-20110628155536-4rkhrtfw15ovb2x2
Various fixes to make the test run, only to block on a bug in bzrlib.

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
# Copyright (C) 2011 Canonical Ltd
 
2
#
 
3
# This program is free software; you can redistribute it and/or modify
 
4
# it under the terms of the GNU General Public License as published by
 
5
# the Free Software Foundation; either version 2 of the License, or
 
6
# (at your option) any later version.
 
7
#
 
8
# This program is distributed in the hope that it will be useful,
 
9
# but WITHOUT ANY WARRANTY; without even the implied warranty of
 
10
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 
11
# GNU General Public License for more details.
 
12
#
1
13
"""Exports an archive from a bazaar branch"""
2
14
 
3
15
from bzrlib.export import get_export_generator
18
30
            self._buffer = []
19
31
 
20
32
 
21
 
def export_archive(history, revid, format=".tar.gz"):
 
33
def export_archive(history, root, revid, format=".tar.gz"):
22
34
    """Export tree contents to an archive
23
35
 
24
36
    :param history: Instance of history to export
 
37
    :param root: Root location inside the archive.
25
38
    :param revid: Revision to export
26
39
    :param format: Format of the archive
27
40
    """
28
41
    fileobj = ExporterFileObject()
29
42
    tree = history._branch.repository.revision_tree(revid)
30
 
    for _ in get_export_generator(tree=tree, fileobj=fileobj, format=format):
 
43
    for _ in get_export_generator(tree=tree, root=root, fileobj=fileobj, format=format):
31
44
        yield fileobj.get_buffer()
32
45
    # Might have additonal contents written
33
46
    yield fileobj.get_buffer()