tests/test-inherit-mode
changeset 6113 8ca25589e960
parent 6073 89c70d496175
child 6160 3ee3bc5d06c5
equal deleted inserted replaced
6112:5ffa962783c4 6113:8ca25589e960
    26 for name in allnames:
    26 for name in allnames:
    27     suffix = name in isdir and '/' or ''
    27     suffix = name in isdir and '/' or ''
    28     print '%05o %s%s' % (os.lstat(name).st_mode & 07777, name, suffix)
    28     print '%05o %s%s' % (os.lstat(name).st_mode & 07777, name, suffix)
    29 EOF
    29 EOF
    30 
    30 
       
    31 cat >mode.py <<EOF
       
    32 import sys
       
    33 import os
       
    34 print '%05o' % os.lstat(sys.argv[1]).st_mode
       
    35 EOF
       
    36 
    31 umask 077
    37 umask 077
    32 
    38 
    33 hg init repo
    39 hg init repo
    34 cd repo
    40 cd repo
    35 
    41 
    36 chmod 0770 .hg/store
    42 chmod 0770 .hg/store
    37 chmod g+s .hg/store
       
    38 
    43 
    39 echo '% before commit'
    44 echo '% before commit'
    40 echo '% store can be written by the group, other files cannot'
    45 echo '% store can be written by the group, other files cannot'
    41 echo '% store is setgid'
    46 echo '% store is setgid'
    42 python ../printmodes.py .
    47 python ../printmodes.py .
    64 hg -q push ../push
    69 hg -q push ../push
    65 echo
    70 echo
    66 echo '% after push'
    71 echo '% after push'
    67 echo '% group can still write everything'
    72 echo '% group can still write everything'
    68 python ../printmodes.py ../push
    73 python ../printmodes.py ../push
       
    74 
       
    75 # Test that we don't lose the setgid bit when we call chmod.
       
    76 # Not all systems support setgid directories (e.g. HFS+), so
       
    77 # just check that directories have the same mode.
       
    78 cd ..
       
    79 hg init setgid
       
    80 cd setgid
       
    81 chmod g+s .hg/store 2> /dev/null
       
    82 mkdir dir
       
    83 touch dir/file
       
    84 hg ci -qAm 'add dir/file'
       
    85 storemode=`python ../mode.py .hg/store`
       
    86 dirmode=`python ../mode.py .hg/store/data/dir`
       
    87 if [ "$storemode" != "$dirmode" ]; then
       
    88     echo "$storemode != $dirmode"
       
    89 fi
       
    90