5
def update(file, pattern, replacement, verbose=False):
7
print "Updating:", file
9
# make sure we can write the file
10
old_perm = os.stat(file)[0]
11
if not os.access(file, os.W_OK):
12
os.chmod(file, old_perm | stat.S_IWRITE)
15
s = open(file, 'rb').read()
16
out = open(file, 'wb')
17
out.write(s.replace(pattern, replacement))
21
os.chmod(file, old_perm)
24
old_uuid = "4d949360-5a40-0410-921c-d637654a4d6e" # IVLE at SourceForge
25
new_uuid = "2b9c9e99-6f39-0410-b283-7f802c844ae2" # IVLE at GoogleCode
27
for root, dirs, files in os.walk('.'):
28
if root.endswith('.svn'):
29
update(os.path.join(root, 'entries'), old_uuid, new_uuid, True)