tests/test-commandserver.t
changeset 23036 19f5273c9f3e
parent 22994 840be5ca03e1
child 23053 5ba11ab48fcf
equal deleted inserted replaced
23035:5f8f8225fc7e 23036:19f5273c9f3e
    14   ...     ch, data = readchannel(server)
    14   ...     ch, data = readchannel(server)
    15   ...     print '%c, %r' % (ch, data)
    15   ...     print '%c, %r' % (ch, data)
    16   ...     # run an arbitrary command to make sure the next thing the server
    16   ...     # run an arbitrary command to make sure the next thing the server
    17   ...     # sends isn't part of the hello message
    17   ...     # sends isn't part of the hello message
    18   ...     runcommand(server, ['id'])
    18   ...     runcommand(server, ['id'])
    19   o, 'capabilities: getencoding runcommand\nencoding: *' (glob)
    19   o, 'capabilities: getencoding runcommand\nencoding: *\npid: *' (glob)
    20   *** runcommand id
    20   *** runcommand id
    21   000000000000 tip
    21   000000000000 tip
    22 
    22 
    23   >>> from hgclient import check
    23   >>> from hgclient import check
    24   >>> @check
    24   >>> @check
   529   ...     ch, data = readchannel(server)
   529   ...     ch, data = readchannel(server)
   530   ...     print '%c, %r' % (ch, data)
   530   ...     print '%c, %r' % (ch, data)
   531   ...     # run an arbitrary command to make sure the next thing the server
   531   ...     # run an arbitrary command to make sure the next thing the server
   532   ...     # sends isn't part of the hello message
   532   ...     # sends isn't part of the hello message
   533   ...     runcommand(server, ['id'])
   533   ...     runcommand(server, ['id'])
   534   o, 'capabilities: getencoding runcommand\nencoding: *' (glob)
   534   o, 'capabilities: getencoding runcommand\nencoding: *\npid: *' (glob)
   535   *** runcommand id
   535   *** runcommand id
   536   abort: there is no Mercurial repository here (.hg not found)
   536   abort: there is no Mercurial repository here (.hg not found)
   537    [255]
   537    [255]
   538 
   538 
   539   >>> from hgclient import readchannel, runcommand, check
   539   >>> from hgclient import readchannel, runcommand, check
   560   >>> def hellomessage(conn):
   560   >>> def hellomessage(conn):
   561   ...     ch, data = readchannel(conn)
   561   ...     ch, data = readchannel(conn)
   562   ...     print '%c, %r' % (ch, data)
   562   ...     print '%c, %r' % (ch, data)
   563   ...     runcommand(conn, ['id'])
   563   ...     runcommand(conn, ['id'])
   564   >>> check(hellomessage, server.connect)
   564   >>> check(hellomessage, server.connect)
   565   o, 'capabilities: getencoding runcommand\nencoding: *' (glob)
   565   o, 'capabilities: getencoding runcommand\nencoding: *\npid: *' (glob)
   566   *** runcommand id
   566   *** runcommand id
   567   eff892de26ec tip bm1/bm2/bm3
   567   eff892de26ec tip bm1/bm2/bm3
   568   >>> def unknowncommand(conn):
   568   >>> def unknowncommand(conn):
   569   ...     readchannel(conn)
   569   ...     readchannel(conn)
   570   ...     conn.stdin.write('unknowncommand\n')
   570   ...     conn.stdin.write('unknowncommand\n')