Mercurial > hg
view contrib/tmplrewrite.py @ 13771:ce6227306c9a
subrepos: use url.url when normalizing repo paths
This works around an issue in older versions of Python that would
strip double slashes from SSH URLs when using urlunparse() on a parsed
URL.
Related issues:
- issue1755: WinXP: cmd line hg 1.3 clone of subrepo fails, due to %5C
'\'? (originally fixed by f783bb979fb3).
author | Brodie Rao <brodie@bitheap.org> |
---|---|
date | Fri, 25 Mar 2011 22:59:04 -0700 |
parents | 94ef2c8ce683 |
children |
line wrap: on
line source
#!/usr/bin/python import sys, os, re IGNORE = ['.css', '.py'] oldre = re.compile('#([\w\|%]+)#') def rewrite(fn): f = open(fn) new = open(fn + '.new', 'wb') for ln in f: new.write(oldre.sub('{\\1}', ln)) new.close() f.close() os.rename(new.name, f.name) if __name__ == '__main__': if len(sys.argv) < 2: print 'usage: python tmplrewrite.py [file [file [file]]]' for fn in sys.argv[1:]: if os.path.splitext(fn) in IGNORE: continue print 'rewriting %s...' % fn rewrite(fn)