1042
1042
If no revision is specified this exports the last committed revision.
1044
1044
Format may be an "exporter" name, such as tar, tgz, tbz2. If none is
1045
given, exports to a directory (equivalent to --format=dir).
1045
given, try to find the format with the extension. If no extension
1046
is found exports to a directory (equivalent to --format=dir).
1047
Root may be the top directory for tar, tgz and tbz2 formats."""
1048
Root may be the top directory for tar, tgz and tbz2 formats. If none
1049
is given, the top directory will be the root name of the file."""
1048
1050
# TODO: list known exporters
1049
1051
takes_args = ['dest']
1050
1052
takes_options = ['revision', 'format', 'root']
1051
def run(self, dest, revision=None, format='dir', root=None):
1053
def run(self, dest, revision=None, format=None, root=None):
1052
1055
b = find_branch('.')
1053
1056
if revision == None:
1054
1057
rh = b.revision_history()[-1]
1056
1059
rh = b.lookup_revision(int(revision))
1057
1060
t = b.revision_tree(rh)
1061
root, ext = os.path.splitext(dest)
1063
if ext in (".tar",):
1065
elif ext in (".gz", ".tgz"):
1067
elif ext in (".bz2", ".tbz2"):
1058
1071
t.export(dest, format, root)