comparison mercurial/archival.py @ 24953:5115d03440f4

archive: drop the leading '.' path component from the prefix (issue4634) Unix utilities like tar will happily prefix the files it packs with './', but annoyingly, Windows Explorer will not show these packed files when it opens the archive. Since there doesn't seem to be a point in including './' in the path names, just drop it. The default 'hg archive' prefix is the basename of the archive, so specifying '.' allows for that default to be disabled completely.
author Matt Harbison <matt_harbison@yahoo.com>
date Tue, 05 May 2015 20:52:38 -0400
parents 33ab99a6ad9b
children 3f0744eeaeaf
comparison
equal deleted inserted replaced
24951:eeca859cc045 24953:5115d03440f4
35 break 35 break
36 lpfx = os.path.normpath(util.localpath(prefix)) 36 lpfx = os.path.normpath(util.localpath(prefix))
37 prefix = util.pconvert(lpfx) 37 prefix = util.pconvert(lpfx)
38 if not prefix.endswith('/'): 38 if not prefix.endswith('/'):
39 prefix += '/' 39 prefix += '/'
40 # Drop the leading '.' path component if present, so Windows can read the
41 # zip files (issue4634)
42 if prefix.startswith('./'):
43 prefix = prefix[2:]
40 if prefix.startswith('../') or os.path.isabs(lpfx) or '/../' in prefix: 44 if prefix.startswith('../') or os.path.isabs(lpfx) or '/../' in prefix:
41 raise util.Abort(_('archive prefix contains illegal components')) 45 raise util.Abort(_('archive prefix contains illegal components'))
42 return prefix 46 return prefix
43 47
44 exts = { 48 exts = {