Mercurial > ~astiob > upreckon > hgweb
comparison publish.py @ 13:a2c9f7cfa174
$Rev$ substitution still
| author | Oleg Oshmyan <chortos@inbox.lv> |
|---|---|
| date | Sat, 13 Mar 2010 00:00:48 +0000 |
| parents | 231e3317477d |
| children |
comparison
equal
deleted
inserted
replaced
| 12:7c6f02865bf6 | 13:a2c9f7cfa174 |
|---|---|
| 3 | 3 |
| 4 with open('test-svn.py') as t: | 4 with open('test-svn.py') as t: |
| 5 f = t.read() | 5 f = t.read() |
| 6 i = f.find('# $Rev: ') | 6 i = f.find('# $Rev: ') |
| 7 j = f.find('\n', i) | 7 j = f.find('\n', i) |
| 8 rev = f[i+8:j-1] | 8 rev = f[i+8:j-2] |
| 9 f = f[0:i] + f[j+1:] | 9 f = f[0:i] + f[j+1:] |
| 10 f = f.replace('$$REV$$', rev) | 10 f = f.replace('$$REV$$', rev) |
| 11 with open('test.py', 'wb') as t: | 11 with open('test.py', 'wb') as t: |
| 12 t.write(f) | 12 t.write(f) |
