Mercurial > hg
comparison mercurial/util.py @ 6877:1d38f3605b20
util: set_flags shouldn't know about repo flag formats
author | Matt Mackall <mpm@selenic.com> |
---|---|
date | Sun, 10 Aug 2008 21:55:06 -0500 |
parents | 08d9e0f974d9 |
children | 202d178ec706 |
comparison
equal
deleted
inserted
replaced
6875:0d714a48ab53 | 6877:1d38f3605b20 |
---|---|
994 | 994 |
995 def testpid(pid): | 995 def testpid(pid): |
996 '''return False if pid dead, True if running or not known''' | 996 '''return False if pid dead, True if running or not known''' |
997 return True | 997 return True |
998 | 998 |
999 def set_flags(f, flags): | 999 def set_flags(f, l, x): |
1000 pass | 1000 pass |
1001 | 1001 |
1002 def set_binary(fd): | 1002 def set_binary(fd): |
1003 # When run without console, pipes may expose invalid | 1003 # When run without console, pipes may expose invalid |
1004 # fileno(), usually set to -1. | 1004 # fileno(), usually set to -1. |
1141 | 1141 |
1142 def is_exec(f): | 1142 def is_exec(f): |
1143 """check whether a file is executable""" | 1143 """check whether a file is executable""" |
1144 return (os.lstat(f).st_mode & 0100 != 0) | 1144 return (os.lstat(f).st_mode & 0100 != 0) |
1145 | 1145 |
1146 def set_flags(f, flags): | 1146 def set_flags(f, l, x): |
1147 s = os.lstat(f).st_mode | 1147 s = os.lstat(f).st_mode |
1148 x = "x" in flags | |
1149 l = "l" in flags | |
1150 if l: | 1148 if l: |
1151 if not stat.S_ISLNK(s): | 1149 if not stat.S_ISLNK(s): |
1152 # switch file to link | 1150 # switch file to link |
1153 data = file(f).read() | 1151 data = file(f).read() |
1154 os.unlink(f) | 1152 os.unlink(f) |