tests/test-hgwebdir-paths.py
changeset 37879 81455f482478
parent 30559 d83ca854fa21
child 43076 2372284d9457
equal deleted inserted replaced
37878:fa2423acb02f 37879:81455f482478
     8 from mercurial.hgweb import (
     8 from mercurial.hgweb import (
     9     hgwebdir_mod,
     9     hgwebdir_mod,
    10 )
    10 )
    11 hgwebdir = hgwebdir_mod.hgwebdir
    11 hgwebdir = hgwebdir_mod.hgwebdir
    12 
    12 
    13 os.mkdir('webdir')
    13 os.mkdir(b'webdir')
    14 os.chdir('webdir')
    14 os.chdir(b'webdir')
    15 
    15 
    16 webdir = os.path.realpath('.')
    16 webdir = os.path.realpath(b'.')
    17 
    17 
    18 u = uimod.ui.load()
    18 u = uimod.ui.load()
    19 hg.repository(u, 'a', create=1)
    19 hg.repository(u, b'a', create=1)
    20 hg.repository(u, 'b', create=1)
    20 hg.repository(u, b'b', create=1)
    21 os.chdir('b')
    21 os.chdir(b'b')
    22 hg.repository(u, 'd', create=1)
    22 hg.repository(u, b'd', create=1)
    23 os.chdir('..')
    23 os.chdir(b'..')
    24 hg.repository(u, 'c', create=1)
    24 hg.repository(u, b'c', create=1)
    25 os.chdir('..')
    25 os.chdir(b'..')
    26 
    26 
    27 paths = {'t/a/': '%s/a' % webdir,
    27 paths = {b't/a/': b'%s/a' % webdir,
    28          'b': '%s/b' % webdir,
    28          b'b': b'%s/b' % webdir,
    29          'coll': '%s/*' % webdir,
    29          b'coll': b'%s/*' % webdir,
    30          'rcoll': '%s/**' % webdir}
    30          b'rcoll': b'%s/**' % webdir}
    31 
    31 
    32 config = os.path.join(webdir, 'hgwebdir.conf')
    32 config = os.path.join(webdir, b'hgwebdir.conf')
    33 configfile = open(config, 'w')
    33 configfile = open(config, 'wb')
    34 configfile.write('[paths]\n')
    34 configfile.write(b'[paths]\n')
    35 for k, v in paths.items():
    35 for k, v in paths.items():
    36     configfile.write('%s = %s\n' % (k, v))
    36     configfile.write(b'%s = %s\n' % (k, v))
    37 configfile.close()
    37 configfile.close()
    38 
    38 
    39 confwd = hgwebdir(config)
    39 confwd = hgwebdir(config)
    40 dictwd = hgwebdir(paths)
    40 dictwd = hgwebdir(paths)
    41 
    41