~bzr-pqm/bzr/bzr.dev

« back to all changes in this revision

Viewing changes to bzrlib/export/tar_exporter.py

  • Committer: Jelmer Vernooij
  • Date: 2011-03-14 11:21:15 UTC
  • mto: This revision was merged to the branch mainline in revision 5724.
  • Revision ID: jelmer@samba.org-20110314112115-bglulg2ue3qer68z
Use revision tree timestamp if possible.

Show diffs side-by-side

added added

removed removed

Lines of Context:
21
21
import StringIO
22
22
import sys
23
23
import tarfile
 
24
import time
24
25
 
25
26
from bzrlib import (
26
27
    errors,
93
94
    already exists, it will be clobbered, like with "tar -c".
94
95
    """
95
96
    import gzip
96
 
    if force_mtime is None and tree.get_root_id():
97
 
        # FIXME: Use tree.get_revision_id()'s timestamp ?
 
97
    if force_mtime is not None:
 
98
        root_mtime = force_mtime
 
99
    elif (getattr(tree, "repository", None) and
 
100
          getattr(tree, "get_revision_id", None)):
 
101
        # If this is a revision tree, use the revisions' timestamp
 
102
        rev = tree.repository.get_revision(tree.get_revision_id())
 
103
        root_mtime = rev.timestamp
 
104
    elif tree.get_root_id() is not None:
98
105
        root_mtime = tree.get_file_mtime(tree.get_root_id())
99
106
    else:
100
 
        root_mtime = force_mtime
 
107
        root_mtime = time.time()
101
108
    if dest == '-':
102
109
        # XXX: If no root is given, the output tarball will contain files
103
110
        # named '-/foo'; perhaps this is the most reasonable thing.