~azzar1/unity/add-show-desktop-key

« back to all changes in this revision

Viewing changes to bin/svn_relocate.py

  • Committer: matt.giuca
  • Date: 2009-01-12 01:03:59 UTC
  • Revision ID: svn-v3-trunk0:2b9c9e99-6f39-0410-b283-7f802c844ae2:trunk:1077
Reverted revisions 1059 and 1069 - renaming the DB user from 'postgres' to
    'ivleuser'.
    Heart was in the right place, but currently doesn't work because postgres
    owns the relations and we've no way to correct that yet (since we manually
    run the .sql script as postgres).

    This will be reverted back again once that's solved.

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
#!/usr/bin/env python
 
2
 
 
3
import os, stat, sys
 
4
 
 
5
def update(file, pattern, replacement, verbose=False):
 
6
    if verbose:
 
7
        print "Updating:", file
 
8
 
 
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)
 
13
 
 
14
    # write the file
 
15
    s = open(file, 'rb').read()
 
16
    out = open(file, 'wb')
 
17
    out.write(s.replace(pattern, replacement))
 
18
    out.close()
 
19
   
 
20
    # restore permissions
 
21
    os.chmod(file, old_perm)
 
22
 
 
23
            
 
24
old_uuid = "4d949360-5a40-0410-921c-d637654a4d6e" # IVLE at SourceForge
 
25
new_uuid = "2b9c9e99-6f39-0410-b283-7f802c844ae2" # IVLE at GoogleCode
 
26
 
 
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)
 
30
 
 
31