equal
deleted
inserted
replaced
33 prefix += '/' |
33 prefix += '/' |
34 if prefix.startswith('../') or os.path.isabs(lpfx) or '/../' in prefix: |
34 if prefix.startswith('../') or os.path.isabs(lpfx) or '/../' in prefix: |
35 raise util.Abort(_('archive prefix contains illegal components')) |
35 raise util.Abort(_('archive prefix contains illegal components')) |
36 return prefix |
36 return prefix |
37 |
37 |
|
38 exts = { |
|
39 'tar': ['.tar'], |
|
40 'tbz2': ['.tbz2', '.tar.bz2'], |
|
41 'tgz': ['.tgz', '.tar.gz'], |
|
42 'zip': ['.zip'], |
|
43 } |
|
44 |
|
45 def guesskind(dest): |
|
46 for kind, extensions in exts.iteritems(): |
|
47 if util.any(dest.endswith(ext) for ext in extensions): |
|
48 return kind |
|
49 return None |
|
50 |
|
51 |
38 class tarit(object): |
52 class tarit(object): |
39 '''write archive to tar file or stream. can write uncompressed, |
53 '''write archive to tar file or stream. can write uncompressed, |
40 or compress with gzip or bzip2.''' |
54 or compress with gzip or bzip2.''' |
41 |
55 |
42 class GzipFileWithTime(gzip.GzipFile): |
56 class GzipFileWithTime(gzip.GzipFile): |