Mercurial > hg-stable
view contrib/tmplrewrite.py @ 16851:c739227b5eea
test-revset: enable for Windows
In MSYS, the test fails like this if the hghave exit at the beginning is
removed:
--- C:\Users\adi\hgrepos\hg-main\tests\test-revset.t
+++ C:\Users\adi\hgrepos\hg-main\tests\test-revset.t.err
@@ -58,7 +58,7 @@
$ hg co 3
2 files updated, 0 files merged, 0 files removed, 0 files unresolved
$ hg branch /a/b/c/
- marked working directory as branch /a/b/c/
+ marked working directory as branch a:/b/c/
(branches are permanent and global, did you want a bookmark?)
$ hg ci -Aqm"5 bug"
@@ -252,7 +252,7 @@
2 a-b-c-
3 +a+b+c+
4 -a-b-c-
- 5 /a/b/c/
+ 5 a:/b/c/
6 _a_b_c_
7 .a.b.c.
$ log 'children(ancestor(4,5))'
due to the posix path conversion done by MSYS globally, as explained here
http://www.mingw.org/wiki/Posix_path_conversion
The solution is a bit lame, but it is simple and works: don't use strings that
look like '/a/b', in order not to trigger the path magic done by MSYS.
So, if we can agree not to insist on testing branch names starting with '/',
then this relatively simple patch makes the test pass both on Windows with MSYS
and Linux.
author | Adrian Buehlmann <adrian@cadifra.com> |
---|---|
date | Sun, 03 Jun 2012 09:06:15 +0200 |
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)