tests/test-commandserver.py
changeset 16683 525fdb738975
parent 16202 53e2cd303ecf
child 16687 e34106fa0dc3
equal deleted inserted replaced
16676:654b9e1966f7 16683:525fdb738975
    69     server.stdin.write('unknowncommand\n')
    69     server.stdin.write('unknowncommand\n')
    70 
    70 
    71 def hellomessage(server):
    71 def hellomessage(server):
    72     ch, data = readchannel(server)
    72     ch, data = readchannel(server)
    73     # escaping python tests output not supported
    73     # escaping python tests output not supported
    74     print '%c, %r' % (ch, re.sub('encoding: [a-zA-Z0-9-]+', 'encoding: ***', data))
    74     print '%c, %r' % (ch, re.sub('encoding: [a-zA-Z0-9-]+', 'encoding: ***',
       
    75                                  data))
    75 
    76 
    76     # run an arbitrary command to make sure the next thing the server sends
    77     # run an arbitrary command to make sure the next thing the server sends
    77     # isn't part of the hello message
    78     # isn't part of the hello message
    78     runcommand(server, ['id'])
    79     runcommand(server, ['id'])
    79 
    80 
   140 def localhgrc(server):
   141 def localhgrc(server):
   141     """ check that local configs for the cached repo aren't inherited when -R
   142     """ check that local configs for the cached repo aren't inherited when -R
   142     is used """
   143     is used """
   143     readchannel(server)
   144     readchannel(server)
   144 
   145 
   145     # the cached repo local hgrc contains ui.foo=bar, so showconfig should show it
   146     # the cached repo local hgrc contains ui.foo=bar, so showconfig should
       
   147     # show it
   146     runcommand(server, ['showconfig'])
   148     runcommand(server, ['showconfig'])
   147 
   149 
   148     # but not for this repo
   150     # but not for this repo
   149     runcommand(server, ['init', 'foo'])
   151     runcommand(server, ['init', 'foo'])
   150     runcommand(server, ['-R', 'foo', 'showconfig', 'ui', 'defaults'])
   152     runcommand(server, ['-R', 'foo', 'showconfig', 'ui', 'defaults'])
   155     print 'now try to read something: %r' % sys.stdin.read()
   157     print 'now try to read something: %r' % sys.stdin.read()
   156 
   158 
   157 def hookoutput(server):
   159 def hookoutput(server):
   158     readchannel(server)
   160     readchannel(server)
   159     runcommand(server, ['--config',
   161     runcommand(server, ['--config',
   160                         'hooks.pre-identify=python:test-commandserver.hook', 'id'],
   162                         'hooks.pre-identify=python:test-commandserver.hook',
       
   163                         'id'],
   161                input=cStringIO.StringIO('some input'))
   164                input=cStringIO.StringIO('some input'))
   162 
   165 
   163 def outsidechanges(server):
   166 def outsidechanges(server):
   164     readchannel(server)
   167     readchannel(server)
   165     f = open('a', 'ab')
   168     f = open('a', 'ab')