tests/test-commandserver.t
author Yuya Nishihara <yuya@tcha.org>
Sun, 28 Sep 2014 16:05:37 +0900
changeset 22568 78b99149ed8a
parent 22567 f9a4a035003d
child 22570 db497a1ef1c1
permissions -rw-r--r--
test-commandserver: port test functions from .py to .t Though we have to duplicate import statements, .t test is still more handy than .py test which has cryptic .out file. This change allows to skip a part of test by #if conditional, which my next patch series depends on.
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
22568
78b99149ed8a test-commandserver: port test functions from .py to .t
Yuya Nishihara <yuya@tcha.org>
parents: 22567
diff changeset
     1
#if windows
78b99149ed8a test-commandserver: port test functions from .py to .t
Yuya Nishihara <yuya@tcha.org>
parents: 22567
diff changeset
     2
  $ PYTHONPATH="$TESTDIR/../contrib;$PYTHONPATH"
78b99149ed8a test-commandserver: port test functions from .py to .t
Yuya Nishihara <yuya@tcha.org>
parents: 22567
diff changeset
     3
#else
78b99149ed8a test-commandserver: port test functions from .py to .t
Yuya Nishihara <yuya@tcha.org>
parents: 22567
diff changeset
     4
  $ PYTHONPATH="$TESTDIR/../contrib:$PYTHONPATH"
78b99149ed8a test-commandserver: port test functions from .py to .t
Yuya Nishihara <yuya@tcha.org>
parents: 22567
diff changeset
     5
#endif
78b99149ed8a test-commandserver: port test functions from .py to .t
Yuya Nishihara <yuya@tcha.org>
parents: 22567
diff changeset
     6
  $ export PYTHONPATH
78b99149ed8a test-commandserver: port test functions from .py to .t
Yuya Nishihara <yuya@tcha.org>
parents: 22567
diff changeset
     7
78b99149ed8a test-commandserver: port test functions from .py to .t
Yuya Nishihara <yuya@tcha.org>
parents: 22567
diff changeset
     8
  $ hg init repo
78b99149ed8a test-commandserver: port test functions from .py to .t
Yuya Nishihara <yuya@tcha.org>
parents: 22567
diff changeset
     9
  $ cd repo
78b99149ed8a test-commandserver: port test functions from .py to .t
Yuya Nishihara <yuya@tcha.org>
parents: 22567
diff changeset
    10
78b99149ed8a test-commandserver: port test functions from .py to .t
Yuya Nishihara <yuya@tcha.org>
parents: 22567
diff changeset
    11
  >>> import re
78b99149ed8a test-commandserver: port test functions from .py to .t
Yuya Nishihara <yuya@tcha.org>
parents: 22567
diff changeset
    12
  >>> from hgclient import readchannel, runcommand, check
78b99149ed8a test-commandserver: port test functions from .py to .t
Yuya Nishihara <yuya@tcha.org>
parents: 22567
diff changeset
    13
  >>> @check
78b99149ed8a test-commandserver: port test functions from .py to .t
Yuya Nishihara <yuya@tcha.org>
parents: 22567
diff changeset
    14
  ... def hellomessage(server):
78b99149ed8a test-commandserver: port test functions from .py to .t
Yuya Nishihara <yuya@tcha.org>
parents: 22567
diff changeset
    15
  ...     ch, data = readchannel(server)
78b99149ed8a test-commandserver: port test functions from .py to .t
Yuya Nishihara <yuya@tcha.org>
parents: 22567
diff changeset
    16
  ...     # escaping python tests output not supported
78b99149ed8a test-commandserver: port test functions from .py to .t
Yuya Nishihara <yuya@tcha.org>
parents: 22567
diff changeset
    17
  ...     print '%c, %r' % (ch, re.sub('encoding: [a-zA-Z0-9-]+',
78b99149ed8a test-commandserver: port test functions from .py to .t
Yuya Nishihara <yuya@tcha.org>
parents: 22567
diff changeset
    18
  ...                                  'encoding: ***', data))
78b99149ed8a test-commandserver: port test functions from .py to .t
Yuya Nishihara <yuya@tcha.org>
parents: 22567
diff changeset
    19
  ... 
78b99149ed8a test-commandserver: port test functions from .py to .t
Yuya Nishihara <yuya@tcha.org>
parents: 22567
diff changeset
    20
  ...     # run an arbitrary command to make sure the next thing the server
78b99149ed8a test-commandserver: port test functions from .py to .t
Yuya Nishihara <yuya@tcha.org>
parents: 22567
diff changeset
    21
  ...     # sends isn't part of the hello message
78b99149ed8a test-commandserver: port test functions from .py to .t
Yuya Nishihara <yuya@tcha.org>
parents: 22567
diff changeset
    22
  ...     runcommand(server, ['id'])
22567
f9a4a035003d test-commandserver: add stub for .t test by copying .out with 2-space indent
Yuya Nishihara <yuya@tcha.org>
parents:
diff changeset
    23
  
f9a4a035003d test-commandserver: add stub for .t test by copying .out with 2-space indent
Yuya Nishihara <yuya@tcha.org>
parents:
diff changeset
    24
  testing hellomessage:
f9a4a035003d test-commandserver: add stub for .t test by copying .out with 2-space indent
Yuya Nishihara <yuya@tcha.org>
parents:
diff changeset
    25
  
f9a4a035003d test-commandserver: add stub for .t test by copying .out with 2-space indent
Yuya Nishihara <yuya@tcha.org>
parents:
diff changeset
    26
  o, 'capabilities: getencoding runcommand\nencoding: ***'
f9a4a035003d test-commandserver: add stub for .t test by copying .out with 2-space indent
Yuya Nishihara <yuya@tcha.org>
parents:
diff changeset
    27
   runcommand id
f9a4a035003d test-commandserver: add stub for .t test by copying .out with 2-space indent
Yuya Nishihara <yuya@tcha.org>
parents:
diff changeset
    28
  000000000000 tip
22568
78b99149ed8a test-commandserver: port test functions from .py to .t
Yuya Nishihara <yuya@tcha.org>
parents: 22567
diff changeset
    29
78b99149ed8a test-commandserver: port test functions from .py to .t
Yuya Nishihara <yuya@tcha.org>
parents: 22567
diff changeset
    30
  >>> from hgclient import check
78b99149ed8a test-commandserver: port test functions from .py to .t
Yuya Nishihara <yuya@tcha.org>
parents: 22567
diff changeset
    31
  >>> @check
78b99149ed8a test-commandserver: port test functions from .py to .t
Yuya Nishihara <yuya@tcha.org>
parents: 22567
diff changeset
    32
  ... def unknowncommand(server):
78b99149ed8a test-commandserver: port test functions from .py to .t
Yuya Nishihara <yuya@tcha.org>
parents: 22567
diff changeset
    33
  ...     server.stdin.write('unknowncommand\n')
22567
f9a4a035003d test-commandserver: add stub for .t test by copying .out with 2-space indent
Yuya Nishihara <yuya@tcha.org>
parents:
diff changeset
    34
  
f9a4a035003d test-commandserver: add stub for .t test by copying .out with 2-space indent
Yuya Nishihara <yuya@tcha.org>
parents:
diff changeset
    35
  testing unknowncommand:
f9a4a035003d test-commandserver: add stub for .t test by copying .out with 2-space indent
Yuya Nishihara <yuya@tcha.org>
parents:
diff changeset
    36
  
f9a4a035003d test-commandserver: add stub for .t test by copying .out with 2-space indent
Yuya Nishihara <yuya@tcha.org>
parents:
diff changeset
    37
  abort: unknown command unknowncommand
22568
78b99149ed8a test-commandserver: port test functions from .py to .t
Yuya Nishihara <yuya@tcha.org>
parents: 22567
diff changeset
    38
78b99149ed8a test-commandserver: port test functions from .py to .t
Yuya Nishihara <yuya@tcha.org>
parents: 22567
diff changeset
    39
  >>> from hgclient import readchannel, runcommand, check
78b99149ed8a test-commandserver: port test functions from .py to .t
Yuya Nishihara <yuya@tcha.org>
parents: 22567
diff changeset
    40
  >>> @check
78b99149ed8a test-commandserver: port test functions from .py to .t
Yuya Nishihara <yuya@tcha.org>
parents: 22567
diff changeset
    41
  ... def checkruncommand(server):
78b99149ed8a test-commandserver: port test functions from .py to .t
Yuya Nishihara <yuya@tcha.org>
parents: 22567
diff changeset
    42
  ...     # hello block
78b99149ed8a test-commandserver: port test functions from .py to .t
Yuya Nishihara <yuya@tcha.org>
parents: 22567
diff changeset
    43
  ...     readchannel(server)
78b99149ed8a test-commandserver: port test functions from .py to .t
Yuya Nishihara <yuya@tcha.org>
parents: 22567
diff changeset
    44
  ... 
78b99149ed8a test-commandserver: port test functions from .py to .t
Yuya Nishihara <yuya@tcha.org>
parents: 22567
diff changeset
    45
  ...     # no args
78b99149ed8a test-commandserver: port test functions from .py to .t
Yuya Nishihara <yuya@tcha.org>
parents: 22567
diff changeset
    46
  ...     runcommand(server, [])
78b99149ed8a test-commandserver: port test functions from .py to .t
Yuya Nishihara <yuya@tcha.org>
parents: 22567
diff changeset
    47
  ... 
78b99149ed8a test-commandserver: port test functions from .py to .t
Yuya Nishihara <yuya@tcha.org>
parents: 22567
diff changeset
    48
  ...     # global options
78b99149ed8a test-commandserver: port test functions from .py to .t
Yuya Nishihara <yuya@tcha.org>
parents: 22567
diff changeset
    49
  ...     runcommand(server, ['id', '--quiet'])
78b99149ed8a test-commandserver: port test functions from .py to .t
Yuya Nishihara <yuya@tcha.org>
parents: 22567
diff changeset
    50
  ... 
78b99149ed8a test-commandserver: port test functions from .py to .t
Yuya Nishihara <yuya@tcha.org>
parents: 22567
diff changeset
    51
  ...     # make sure global options don't stick through requests
78b99149ed8a test-commandserver: port test functions from .py to .t
Yuya Nishihara <yuya@tcha.org>
parents: 22567
diff changeset
    52
  ...     runcommand(server, ['id'])
78b99149ed8a test-commandserver: port test functions from .py to .t
Yuya Nishihara <yuya@tcha.org>
parents: 22567
diff changeset
    53
  ... 
78b99149ed8a test-commandserver: port test functions from .py to .t
Yuya Nishihara <yuya@tcha.org>
parents: 22567
diff changeset
    54
  ...     # --config
78b99149ed8a test-commandserver: port test functions from .py to .t
Yuya Nishihara <yuya@tcha.org>
parents: 22567
diff changeset
    55
  ...     runcommand(server, ['id', '--config', 'ui.quiet=True'])
78b99149ed8a test-commandserver: port test functions from .py to .t
Yuya Nishihara <yuya@tcha.org>
parents: 22567
diff changeset
    56
  ... 
78b99149ed8a test-commandserver: port test functions from .py to .t
Yuya Nishihara <yuya@tcha.org>
parents: 22567
diff changeset
    57
  ...     # make sure --config doesn't stick
78b99149ed8a test-commandserver: port test functions from .py to .t
Yuya Nishihara <yuya@tcha.org>
parents: 22567
diff changeset
    58
  ...     runcommand(server, ['id'])
78b99149ed8a test-commandserver: port test functions from .py to .t
Yuya Nishihara <yuya@tcha.org>
parents: 22567
diff changeset
    59
  ... 
78b99149ed8a test-commandserver: port test functions from .py to .t
Yuya Nishihara <yuya@tcha.org>
parents: 22567
diff changeset
    60
  ...     # negative return code should be masked
78b99149ed8a test-commandserver: port test functions from .py to .t
Yuya Nishihara <yuya@tcha.org>
parents: 22567
diff changeset
    61
  ...     runcommand(server, ['id', '-runknown'])
22567
f9a4a035003d test-commandserver: add stub for .t test by copying .out with 2-space indent
Yuya Nishihara <yuya@tcha.org>
parents:
diff changeset
    62
  
f9a4a035003d test-commandserver: add stub for .t test by copying .out with 2-space indent
Yuya Nishihara <yuya@tcha.org>
parents:
diff changeset
    63
  testing checkruncommand:
f9a4a035003d test-commandserver: add stub for .t test by copying .out with 2-space indent
Yuya Nishihara <yuya@tcha.org>
parents:
diff changeset
    64
  
f9a4a035003d test-commandserver: add stub for .t test by copying .out with 2-space indent
Yuya Nishihara <yuya@tcha.org>
parents:
diff changeset
    65
   runcommand 
f9a4a035003d test-commandserver: add stub for .t test by copying .out with 2-space indent
Yuya Nishihara <yuya@tcha.org>
parents:
diff changeset
    66
  Mercurial Distributed SCM
f9a4a035003d test-commandserver: add stub for .t test by copying .out with 2-space indent
Yuya Nishihara <yuya@tcha.org>
parents:
diff changeset
    67
  
f9a4a035003d test-commandserver: add stub for .t test by copying .out with 2-space indent
Yuya Nishihara <yuya@tcha.org>
parents:
diff changeset
    68
  basic commands:
f9a4a035003d test-commandserver: add stub for .t test by copying .out with 2-space indent
Yuya Nishihara <yuya@tcha.org>
parents:
diff changeset
    69
  
f9a4a035003d test-commandserver: add stub for .t test by copying .out with 2-space indent
Yuya Nishihara <yuya@tcha.org>
parents:
diff changeset
    70
   add           add the specified files on the next commit
f9a4a035003d test-commandserver: add stub for .t test by copying .out with 2-space indent
Yuya Nishihara <yuya@tcha.org>
parents:
diff changeset
    71
   annotate      show changeset information by line for each file
f9a4a035003d test-commandserver: add stub for .t test by copying .out with 2-space indent
Yuya Nishihara <yuya@tcha.org>
parents:
diff changeset
    72
   clone         make a copy of an existing repository
f9a4a035003d test-commandserver: add stub for .t test by copying .out with 2-space indent
Yuya Nishihara <yuya@tcha.org>
parents:
diff changeset
    73
   commit        commit the specified files or all outstanding changes
f9a4a035003d test-commandserver: add stub for .t test by copying .out with 2-space indent
Yuya Nishihara <yuya@tcha.org>
parents:
diff changeset
    74
   diff          diff repository (or selected files)
f9a4a035003d test-commandserver: add stub for .t test by copying .out with 2-space indent
Yuya Nishihara <yuya@tcha.org>
parents:
diff changeset
    75
   export        dump the header and diffs for one or more changesets
f9a4a035003d test-commandserver: add stub for .t test by copying .out with 2-space indent
Yuya Nishihara <yuya@tcha.org>
parents:
diff changeset
    76
   forget        forget the specified files on the next commit
f9a4a035003d test-commandserver: add stub for .t test by copying .out with 2-space indent
Yuya Nishihara <yuya@tcha.org>
parents:
diff changeset
    77
   init          create a new repository in the given directory
f9a4a035003d test-commandserver: add stub for .t test by copying .out with 2-space indent
Yuya Nishihara <yuya@tcha.org>
parents:
diff changeset
    78
   log           show revision history of entire repository or files
f9a4a035003d test-commandserver: add stub for .t test by copying .out with 2-space indent
Yuya Nishihara <yuya@tcha.org>
parents:
diff changeset
    79
   merge         merge working directory with another revision
f9a4a035003d test-commandserver: add stub for .t test by copying .out with 2-space indent
Yuya Nishihara <yuya@tcha.org>
parents:
diff changeset
    80
   pull          pull changes from the specified source
f9a4a035003d test-commandserver: add stub for .t test by copying .out with 2-space indent
Yuya Nishihara <yuya@tcha.org>
parents:
diff changeset
    81
   push          push changes to the specified destination
f9a4a035003d test-commandserver: add stub for .t test by copying .out with 2-space indent
Yuya Nishihara <yuya@tcha.org>
parents:
diff changeset
    82
   remove        remove the specified files on the next commit
f9a4a035003d test-commandserver: add stub for .t test by copying .out with 2-space indent
Yuya Nishihara <yuya@tcha.org>
parents:
diff changeset
    83
   serve         start stand-alone webserver
f9a4a035003d test-commandserver: add stub for .t test by copying .out with 2-space indent
Yuya Nishihara <yuya@tcha.org>
parents:
diff changeset
    84
   status        show changed files in the working directory
f9a4a035003d test-commandserver: add stub for .t test by copying .out with 2-space indent
Yuya Nishihara <yuya@tcha.org>
parents:
diff changeset
    85
   summary       summarize working directory state
f9a4a035003d test-commandserver: add stub for .t test by copying .out with 2-space indent
Yuya Nishihara <yuya@tcha.org>
parents:
diff changeset
    86
   update        update working directory (or switch revisions)
f9a4a035003d test-commandserver: add stub for .t test by copying .out with 2-space indent
Yuya Nishihara <yuya@tcha.org>
parents:
diff changeset
    87
  
f9a4a035003d test-commandserver: add stub for .t test by copying .out with 2-space indent
Yuya Nishihara <yuya@tcha.org>
parents:
diff changeset
    88
  (use "hg help" for the full list of commands or "hg -v" for details)
f9a4a035003d test-commandserver: add stub for .t test by copying .out with 2-space indent
Yuya Nishihara <yuya@tcha.org>
parents:
diff changeset
    89
   runcommand id --quiet
f9a4a035003d test-commandserver: add stub for .t test by copying .out with 2-space indent
Yuya Nishihara <yuya@tcha.org>
parents:
diff changeset
    90
  000000000000
f9a4a035003d test-commandserver: add stub for .t test by copying .out with 2-space indent
Yuya Nishihara <yuya@tcha.org>
parents:
diff changeset
    91
   runcommand id
f9a4a035003d test-commandserver: add stub for .t test by copying .out with 2-space indent
Yuya Nishihara <yuya@tcha.org>
parents:
diff changeset
    92
  000000000000 tip
f9a4a035003d test-commandserver: add stub for .t test by copying .out with 2-space indent
Yuya Nishihara <yuya@tcha.org>
parents:
diff changeset
    93
   runcommand id --config ui.quiet=True
f9a4a035003d test-commandserver: add stub for .t test by copying .out with 2-space indent
Yuya Nishihara <yuya@tcha.org>
parents:
diff changeset
    94
  000000000000
f9a4a035003d test-commandserver: add stub for .t test by copying .out with 2-space indent
Yuya Nishihara <yuya@tcha.org>
parents:
diff changeset
    95
   runcommand id
f9a4a035003d test-commandserver: add stub for .t test by copying .out with 2-space indent
Yuya Nishihara <yuya@tcha.org>
parents:
diff changeset
    96
  000000000000 tip
f9a4a035003d test-commandserver: add stub for .t test by copying .out with 2-space indent
Yuya Nishihara <yuya@tcha.org>
parents:
diff changeset
    97
   runcommand id -runknown
f9a4a035003d test-commandserver: add stub for .t test by copying .out with 2-space indent
Yuya Nishihara <yuya@tcha.org>
parents:
diff changeset
    98
  abort: unknown revision 'unknown'!
f9a4a035003d test-commandserver: add stub for .t test by copying .out with 2-space indent
Yuya Nishihara <yuya@tcha.org>
parents:
diff changeset
    99
   [255]
22568
78b99149ed8a test-commandserver: port test functions from .py to .t
Yuya Nishihara <yuya@tcha.org>
parents: 22567
diff changeset
   100
78b99149ed8a test-commandserver: port test functions from .py to .t
Yuya Nishihara <yuya@tcha.org>
parents: 22567
diff changeset
   101
  >>> from hgclient import readchannel, check
78b99149ed8a test-commandserver: port test functions from .py to .t
Yuya Nishihara <yuya@tcha.org>
parents: 22567
diff changeset
   102
  >>> @check
78b99149ed8a test-commandserver: port test functions from .py to .t
Yuya Nishihara <yuya@tcha.org>
parents: 22567
diff changeset
   103
  ... def inputeof(server):
78b99149ed8a test-commandserver: port test functions from .py to .t
Yuya Nishihara <yuya@tcha.org>
parents: 22567
diff changeset
   104
  ...     readchannel(server)
78b99149ed8a test-commandserver: port test functions from .py to .t
Yuya Nishihara <yuya@tcha.org>
parents: 22567
diff changeset
   105
  ...     server.stdin.write('runcommand\n')
78b99149ed8a test-commandserver: port test functions from .py to .t
Yuya Nishihara <yuya@tcha.org>
parents: 22567
diff changeset
   106
  ...     # close stdin while server is waiting for input
78b99149ed8a test-commandserver: port test functions from .py to .t
Yuya Nishihara <yuya@tcha.org>
parents: 22567
diff changeset
   107
  ...     server.stdin.close()
78b99149ed8a test-commandserver: port test functions from .py to .t
Yuya Nishihara <yuya@tcha.org>
parents: 22567
diff changeset
   108
  ... 
78b99149ed8a test-commandserver: port test functions from .py to .t
Yuya Nishihara <yuya@tcha.org>
parents: 22567
diff changeset
   109
  ...     # server exits with 1 if the pipe closed while reading the command
78b99149ed8a test-commandserver: port test functions from .py to .t
Yuya Nishihara <yuya@tcha.org>
parents: 22567
diff changeset
   110
  ...     print 'server exit code =', server.wait()
22567
f9a4a035003d test-commandserver: add stub for .t test by copying .out with 2-space indent
Yuya Nishihara <yuya@tcha.org>
parents:
diff changeset
   111
  
f9a4a035003d test-commandserver: add stub for .t test by copying .out with 2-space indent
Yuya Nishihara <yuya@tcha.org>
parents:
diff changeset
   112
  testing inputeof:
f9a4a035003d test-commandserver: add stub for .t test by copying .out with 2-space indent
Yuya Nishihara <yuya@tcha.org>
parents:
diff changeset
   113
  
f9a4a035003d test-commandserver: add stub for .t test by copying .out with 2-space indent
Yuya Nishihara <yuya@tcha.org>
parents:
diff changeset
   114
  server exit code = 1
22568
78b99149ed8a test-commandserver: port test functions from .py to .t
Yuya Nishihara <yuya@tcha.org>
parents: 22567
diff changeset
   115
78b99149ed8a test-commandserver: port test functions from .py to .t
Yuya Nishihara <yuya@tcha.org>
parents: 22567
diff changeset
   116
  >>> import cStringIO
78b99149ed8a test-commandserver: port test functions from .py to .t
Yuya Nishihara <yuya@tcha.org>
parents: 22567
diff changeset
   117
  >>> from hgclient import readchannel, runcommand, check
78b99149ed8a test-commandserver: port test functions from .py to .t
Yuya Nishihara <yuya@tcha.org>
parents: 22567
diff changeset
   118
  >>> @check
78b99149ed8a test-commandserver: port test functions from .py to .t
Yuya Nishihara <yuya@tcha.org>
parents: 22567
diff changeset
   119
  ... def serverinput(server):
78b99149ed8a test-commandserver: port test functions from .py to .t
Yuya Nishihara <yuya@tcha.org>
parents: 22567
diff changeset
   120
  ...     readchannel(server)
78b99149ed8a test-commandserver: port test functions from .py to .t
Yuya Nishihara <yuya@tcha.org>
parents: 22567
diff changeset
   121
  ... 
78b99149ed8a test-commandserver: port test functions from .py to .t
Yuya Nishihara <yuya@tcha.org>
parents: 22567
diff changeset
   122
  ...     patch = """
78b99149ed8a test-commandserver: port test functions from .py to .t
Yuya Nishihara <yuya@tcha.org>
parents: 22567
diff changeset
   123
  ... # HG changeset patch
78b99149ed8a test-commandserver: port test functions from .py to .t
Yuya Nishihara <yuya@tcha.org>
parents: 22567
diff changeset
   124
  ... # User test
78b99149ed8a test-commandserver: port test functions from .py to .t
Yuya Nishihara <yuya@tcha.org>
parents: 22567
diff changeset
   125
  ... # Date 0 0
78b99149ed8a test-commandserver: port test functions from .py to .t
Yuya Nishihara <yuya@tcha.org>
parents: 22567
diff changeset
   126
  ... # Node ID c103a3dec114d882c98382d684d8af798d09d857
78b99149ed8a test-commandserver: port test functions from .py to .t
Yuya Nishihara <yuya@tcha.org>
parents: 22567
diff changeset
   127
  ... # Parent  0000000000000000000000000000000000000000
78b99149ed8a test-commandserver: port test functions from .py to .t
Yuya Nishihara <yuya@tcha.org>
parents: 22567
diff changeset
   128
  ... 1
78b99149ed8a test-commandserver: port test functions from .py to .t
Yuya Nishihara <yuya@tcha.org>
parents: 22567
diff changeset
   129
  ... 
78b99149ed8a test-commandserver: port test functions from .py to .t
Yuya Nishihara <yuya@tcha.org>
parents: 22567
diff changeset
   130
  ... diff -r 000000000000 -r c103a3dec114 a
78b99149ed8a test-commandserver: port test functions from .py to .t
Yuya Nishihara <yuya@tcha.org>
parents: 22567
diff changeset
   131
  ... --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
78b99149ed8a test-commandserver: port test functions from .py to .t
Yuya Nishihara <yuya@tcha.org>
parents: 22567
diff changeset
   132
  ... +++ b/a	Thu Jan 01 00:00:00 1970 +0000
78b99149ed8a test-commandserver: port test functions from .py to .t
Yuya Nishihara <yuya@tcha.org>
parents: 22567
diff changeset
   133
  ... @@ -0,0 +1,1 @@
78b99149ed8a test-commandserver: port test functions from .py to .t
Yuya Nishihara <yuya@tcha.org>
parents: 22567
diff changeset
   134
  ... +1
78b99149ed8a test-commandserver: port test functions from .py to .t
Yuya Nishihara <yuya@tcha.org>
parents: 22567
diff changeset
   135
  ... """
78b99149ed8a test-commandserver: port test functions from .py to .t
Yuya Nishihara <yuya@tcha.org>
parents: 22567
diff changeset
   136
  ... 
78b99149ed8a test-commandserver: port test functions from .py to .t
Yuya Nishihara <yuya@tcha.org>
parents: 22567
diff changeset
   137
  ...     runcommand(server, ['import', '-'], input=cStringIO.StringIO(patch))
78b99149ed8a test-commandserver: port test functions from .py to .t
Yuya Nishihara <yuya@tcha.org>
parents: 22567
diff changeset
   138
  ...     runcommand(server, ['log'])
22567
f9a4a035003d test-commandserver: add stub for .t test by copying .out with 2-space indent
Yuya Nishihara <yuya@tcha.org>
parents:
diff changeset
   139
  
f9a4a035003d test-commandserver: add stub for .t test by copying .out with 2-space indent
Yuya Nishihara <yuya@tcha.org>
parents:
diff changeset
   140
  testing serverinput:
f9a4a035003d test-commandserver: add stub for .t test by copying .out with 2-space indent
Yuya Nishihara <yuya@tcha.org>
parents:
diff changeset
   141
  
f9a4a035003d test-commandserver: add stub for .t test by copying .out with 2-space indent
Yuya Nishihara <yuya@tcha.org>
parents:
diff changeset
   142
   runcommand import -
f9a4a035003d test-commandserver: add stub for .t test by copying .out with 2-space indent
Yuya Nishihara <yuya@tcha.org>
parents:
diff changeset
   143
  applying patch from stdin
f9a4a035003d test-commandserver: add stub for .t test by copying .out with 2-space indent
Yuya Nishihara <yuya@tcha.org>
parents:
diff changeset
   144
   runcommand log
f9a4a035003d test-commandserver: add stub for .t test by copying .out with 2-space indent
Yuya Nishihara <yuya@tcha.org>
parents:
diff changeset
   145
  changeset:   0:eff892de26ec
f9a4a035003d test-commandserver: add stub for .t test by copying .out with 2-space indent
Yuya Nishihara <yuya@tcha.org>
parents:
diff changeset
   146
  tag:         tip
f9a4a035003d test-commandserver: add stub for .t test by copying .out with 2-space indent
Yuya Nishihara <yuya@tcha.org>
parents:
diff changeset
   147
  user:        test
f9a4a035003d test-commandserver: add stub for .t test by copying .out with 2-space indent
Yuya Nishihara <yuya@tcha.org>
parents:
diff changeset
   148
  date:        Thu Jan 01 00:00:00 1970 +0000
f9a4a035003d test-commandserver: add stub for .t test by copying .out with 2-space indent
Yuya Nishihara <yuya@tcha.org>
parents:
diff changeset
   149
  summary:     1
f9a4a035003d test-commandserver: add stub for .t test by copying .out with 2-space indent
Yuya Nishihara <yuya@tcha.org>
parents:
diff changeset
   150
  
22568
78b99149ed8a test-commandserver: port test functions from .py to .t
Yuya Nishihara <yuya@tcha.org>
parents: 22567
diff changeset
   151
78b99149ed8a test-commandserver: port test functions from .py to .t
Yuya Nishihara <yuya@tcha.org>
parents: 22567
diff changeset
   152
check that --cwd doesn't persist between requests:
78b99149ed8a test-commandserver: port test functions from .py to .t
Yuya Nishihara <yuya@tcha.org>
parents: 22567
diff changeset
   153
78b99149ed8a test-commandserver: port test functions from .py to .t
Yuya Nishihara <yuya@tcha.org>
parents: 22567
diff changeset
   154
  $ mkdir foo
78b99149ed8a test-commandserver: port test functions from .py to .t
Yuya Nishihara <yuya@tcha.org>
parents: 22567
diff changeset
   155
  $ touch foo/bar
78b99149ed8a test-commandserver: port test functions from .py to .t
Yuya Nishihara <yuya@tcha.org>
parents: 22567
diff changeset
   156
  >>> from hgclient import readchannel, runcommand, check
78b99149ed8a test-commandserver: port test functions from .py to .t
Yuya Nishihara <yuya@tcha.org>
parents: 22567
diff changeset
   157
  >>> @check
78b99149ed8a test-commandserver: port test functions from .py to .t
Yuya Nishihara <yuya@tcha.org>
parents: 22567
diff changeset
   158
  ... def cwd(server):
78b99149ed8a test-commandserver: port test functions from .py to .t
Yuya Nishihara <yuya@tcha.org>
parents: 22567
diff changeset
   159
  ...     readchannel(server)
78b99149ed8a test-commandserver: port test functions from .py to .t
Yuya Nishihara <yuya@tcha.org>
parents: 22567
diff changeset
   160
  ...     runcommand(server, ['--cwd', 'foo', 'st', 'bar'])
78b99149ed8a test-commandserver: port test functions from .py to .t
Yuya Nishihara <yuya@tcha.org>
parents: 22567
diff changeset
   161
  ...     runcommand(server, ['st', 'foo/bar'])
22567
f9a4a035003d test-commandserver: add stub for .t test by copying .out with 2-space indent
Yuya Nishihara <yuya@tcha.org>
parents:
diff changeset
   162
  
f9a4a035003d test-commandserver: add stub for .t test by copying .out with 2-space indent
Yuya Nishihara <yuya@tcha.org>
parents:
diff changeset
   163
  testing cwd:
f9a4a035003d test-commandserver: add stub for .t test by copying .out with 2-space indent
Yuya Nishihara <yuya@tcha.org>
parents:
diff changeset
   164
  
f9a4a035003d test-commandserver: add stub for .t test by copying .out with 2-space indent
Yuya Nishihara <yuya@tcha.org>
parents:
diff changeset
   165
   runcommand --cwd foo st bar
f9a4a035003d test-commandserver: add stub for .t test by copying .out with 2-space indent
Yuya Nishihara <yuya@tcha.org>
parents:
diff changeset
   166
  ? bar
f9a4a035003d test-commandserver: add stub for .t test by copying .out with 2-space indent
Yuya Nishihara <yuya@tcha.org>
parents:
diff changeset
   167
   runcommand st foo/bar
f9a4a035003d test-commandserver: add stub for .t test by copying .out with 2-space indent
Yuya Nishihara <yuya@tcha.org>
parents:
diff changeset
   168
  ? foo/bar
22568
78b99149ed8a test-commandserver: port test functions from .py to .t
Yuya Nishihara <yuya@tcha.org>
parents: 22567
diff changeset
   169
78b99149ed8a test-commandserver: port test functions from .py to .t
Yuya Nishihara <yuya@tcha.org>
parents: 22567
diff changeset
   170
  $ rm foo/bar
78b99149ed8a test-commandserver: port test functions from .py to .t
Yuya Nishihara <yuya@tcha.org>
parents: 22567
diff changeset
   171
78b99149ed8a test-commandserver: port test functions from .py to .t
Yuya Nishihara <yuya@tcha.org>
parents: 22567
diff changeset
   172
78b99149ed8a test-commandserver: port test functions from .py to .t
Yuya Nishihara <yuya@tcha.org>
parents: 22567
diff changeset
   173
check that local configs for the cached repo aren't inherited when -R is used:
78b99149ed8a test-commandserver: port test functions from .py to .t
Yuya Nishihara <yuya@tcha.org>
parents: 22567
diff changeset
   174
78b99149ed8a test-commandserver: port test functions from .py to .t
Yuya Nishihara <yuya@tcha.org>
parents: 22567
diff changeset
   175
  $ cat <<EOF >> .hg/hgrc
78b99149ed8a test-commandserver: port test functions from .py to .t
Yuya Nishihara <yuya@tcha.org>
parents: 22567
diff changeset
   176
  > [ui]
78b99149ed8a test-commandserver: port test functions from .py to .t
Yuya Nishihara <yuya@tcha.org>
parents: 22567
diff changeset
   177
  > foo = bar
78b99149ed8a test-commandserver: port test functions from .py to .t
Yuya Nishihara <yuya@tcha.org>
parents: 22567
diff changeset
   178
  > EOF
78b99149ed8a test-commandserver: port test functions from .py to .t
Yuya Nishihara <yuya@tcha.org>
parents: 22567
diff changeset
   179
78b99149ed8a test-commandserver: port test functions from .py to .t
Yuya Nishihara <yuya@tcha.org>
parents: 22567
diff changeset
   180
  >>> from hgclient import readchannel, sep, runcommand, check
78b99149ed8a test-commandserver: port test functions from .py to .t
Yuya Nishihara <yuya@tcha.org>
parents: 22567
diff changeset
   181
  >>> @check
78b99149ed8a test-commandserver: port test functions from .py to .t
Yuya Nishihara <yuya@tcha.org>
parents: 22567
diff changeset
   182
  ... def localhgrc(server):
78b99149ed8a test-commandserver: port test functions from .py to .t
Yuya Nishihara <yuya@tcha.org>
parents: 22567
diff changeset
   183
  ...     readchannel(server)
78b99149ed8a test-commandserver: port test functions from .py to .t
Yuya Nishihara <yuya@tcha.org>
parents: 22567
diff changeset
   184
  ... 
78b99149ed8a test-commandserver: port test functions from .py to .t
Yuya Nishihara <yuya@tcha.org>
parents: 22567
diff changeset
   185
  ...     # the cached repo local hgrc contains ui.foo=bar, so showconfig should
78b99149ed8a test-commandserver: port test functions from .py to .t
Yuya Nishihara <yuya@tcha.org>
parents: 22567
diff changeset
   186
  ...     # show it
78b99149ed8a test-commandserver: port test functions from .py to .t
Yuya Nishihara <yuya@tcha.org>
parents: 22567
diff changeset
   187
  ...     runcommand(server, ['showconfig'], outfilter=sep)
78b99149ed8a test-commandserver: port test functions from .py to .t
Yuya Nishihara <yuya@tcha.org>
parents: 22567
diff changeset
   188
  ... 
78b99149ed8a test-commandserver: port test functions from .py to .t
Yuya Nishihara <yuya@tcha.org>
parents: 22567
diff changeset
   189
  ...     # but not for this repo
78b99149ed8a test-commandserver: port test functions from .py to .t
Yuya Nishihara <yuya@tcha.org>
parents: 22567
diff changeset
   190
  ...     runcommand(server, ['init', 'foo'])
78b99149ed8a test-commandserver: port test functions from .py to .t
Yuya Nishihara <yuya@tcha.org>
parents: 22567
diff changeset
   191
  ...     runcommand(server, ['-R', 'foo', 'showconfig', 'ui', 'defaults'])
22567
f9a4a035003d test-commandserver: add stub for .t test by copying .out with 2-space indent
Yuya Nishihara <yuya@tcha.org>
parents:
diff changeset
   192
  
f9a4a035003d test-commandserver: add stub for .t test by copying .out with 2-space indent
Yuya Nishihara <yuya@tcha.org>
parents:
diff changeset
   193
  testing localhgrc:
f9a4a035003d test-commandserver: add stub for .t test by copying .out with 2-space indent
Yuya Nishihara <yuya@tcha.org>
parents:
diff changeset
   194
  
f9a4a035003d test-commandserver: add stub for .t test by copying .out with 2-space indent
Yuya Nishihara <yuya@tcha.org>
parents:
diff changeset
   195
   runcommand showconfig
f9a4a035003d test-commandserver: add stub for .t test by copying .out with 2-space indent
Yuya Nishihara <yuya@tcha.org>
parents:
diff changeset
   196
  bundle.mainreporoot=$TESTTMP/repo
f9a4a035003d test-commandserver: add stub for .t test by copying .out with 2-space indent
Yuya Nishihara <yuya@tcha.org>
parents:
diff changeset
   197
  defaults.backout=-d "0 0"
f9a4a035003d test-commandserver: add stub for .t test by copying .out with 2-space indent
Yuya Nishihara <yuya@tcha.org>
parents:
diff changeset
   198
  defaults.commit=-d "0 0"
f9a4a035003d test-commandserver: add stub for .t test by copying .out with 2-space indent
Yuya Nishihara <yuya@tcha.org>
parents:
diff changeset
   199
  defaults.shelve=--date "0 0"
f9a4a035003d test-commandserver: add stub for .t test by copying .out with 2-space indent
Yuya Nishihara <yuya@tcha.org>
parents:
diff changeset
   200
  defaults.tag=-d "0 0"
f9a4a035003d test-commandserver: add stub for .t test by copying .out with 2-space indent
Yuya Nishihara <yuya@tcha.org>
parents:
diff changeset
   201
  ui.slash=True
f9a4a035003d test-commandserver: add stub for .t test by copying .out with 2-space indent
Yuya Nishihara <yuya@tcha.org>
parents:
diff changeset
   202
  ui.interactive=False
f9a4a035003d test-commandserver: add stub for .t test by copying .out with 2-space indent
Yuya Nishihara <yuya@tcha.org>
parents:
diff changeset
   203
  ui.mergemarkers=detailed
f9a4a035003d test-commandserver: add stub for .t test by copying .out with 2-space indent
Yuya Nishihara <yuya@tcha.org>
parents:
diff changeset
   204
  ui.foo=bar
f9a4a035003d test-commandserver: add stub for .t test by copying .out with 2-space indent
Yuya Nishihara <yuya@tcha.org>
parents:
diff changeset
   205
  ui.nontty=true
f9a4a035003d test-commandserver: add stub for .t test by copying .out with 2-space indent
Yuya Nishihara <yuya@tcha.org>
parents:
diff changeset
   206
   runcommand init foo
f9a4a035003d test-commandserver: add stub for .t test by copying .out with 2-space indent
Yuya Nishihara <yuya@tcha.org>
parents:
diff changeset
   207
   runcommand -R foo showconfig ui defaults
f9a4a035003d test-commandserver: add stub for .t test by copying .out with 2-space indent
Yuya Nishihara <yuya@tcha.org>
parents:
diff changeset
   208
  defaults.backout=-d "0 0"
f9a4a035003d test-commandserver: add stub for .t test by copying .out with 2-space indent
Yuya Nishihara <yuya@tcha.org>
parents:
diff changeset
   209
  defaults.commit=-d "0 0"
f9a4a035003d test-commandserver: add stub for .t test by copying .out with 2-space indent
Yuya Nishihara <yuya@tcha.org>
parents:
diff changeset
   210
  defaults.shelve=--date "0 0"
f9a4a035003d test-commandserver: add stub for .t test by copying .out with 2-space indent
Yuya Nishihara <yuya@tcha.org>
parents:
diff changeset
   211
  defaults.tag=-d "0 0"
f9a4a035003d test-commandserver: add stub for .t test by copying .out with 2-space indent
Yuya Nishihara <yuya@tcha.org>
parents:
diff changeset
   212
  ui.slash=True
f9a4a035003d test-commandserver: add stub for .t test by copying .out with 2-space indent
Yuya Nishihara <yuya@tcha.org>
parents:
diff changeset
   213
  ui.interactive=False
f9a4a035003d test-commandserver: add stub for .t test by copying .out with 2-space indent
Yuya Nishihara <yuya@tcha.org>
parents:
diff changeset
   214
  ui.mergemarkers=detailed
f9a4a035003d test-commandserver: add stub for .t test by copying .out with 2-space indent
Yuya Nishihara <yuya@tcha.org>
parents:
diff changeset
   215
  ui.nontty=true
22568
78b99149ed8a test-commandserver: port test functions from .py to .t
Yuya Nishihara <yuya@tcha.org>
parents: 22567
diff changeset
   216
78b99149ed8a test-commandserver: port test functions from .py to .t
Yuya Nishihara <yuya@tcha.org>
parents: 22567
diff changeset
   217
  $ rm -R foo
78b99149ed8a test-commandserver: port test functions from .py to .t
Yuya Nishihara <yuya@tcha.org>
parents: 22567
diff changeset
   218
78b99149ed8a test-commandserver: port test functions from .py to .t
Yuya Nishihara <yuya@tcha.org>
parents: 22567
diff changeset
   219
#if windows
78b99149ed8a test-commandserver: port test functions from .py to .t
Yuya Nishihara <yuya@tcha.org>
parents: 22567
diff changeset
   220
  $ PYTHONPATH="$TESTTMP/repo;$PYTHONPATH"
78b99149ed8a test-commandserver: port test functions from .py to .t
Yuya Nishihara <yuya@tcha.org>
parents: 22567
diff changeset
   221
#else
78b99149ed8a test-commandserver: port test functions from .py to .t
Yuya Nishihara <yuya@tcha.org>
parents: 22567
diff changeset
   222
  $ PYTHONPATH="$TESTTMP/repo:$PYTHONPATH"
78b99149ed8a test-commandserver: port test functions from .py to .t
Yuya Nishihara <yuya@tcha.org>
parents: 22567
diff changeset
   223
#endif
78b99149ed8a test-commandserver: port test functions from .py to .t
Yuya Nishihara <yuya@tcha.org>
parents: 22567
diff changeset
   224
78b99149ed8a test-commandserver: port test functions from .py to .t
Yuya Nishihara <yuya@tcha.org>
parents: 22567
diff changeset
   225
  $ cat <<EOF > hook.py
78b99149ed8a test-commandserver: port test functions from .py to .t
Yuya Nishihara <yuya@tcha.org>
parents: 22567
diff changeset
   226
  > import sys
78b99149ed8a test-commandserver: port test functions from .py to .t
Yuya Nishihara <yuya@tcha.org>
parents: 22567
diff changeset
   227
  > def hook(**args):
78b99149ed8a test-commandserver: port test functions from .py to .t
Yuya Nishihara <yuya@tcha.org>
parents: 22567
diff changeset
   228
  >     print 'hook talking'
78b99149ed8a test-commandserver: port test functions from .py to .t
Yuya Nishihara <yuya@tcha.org>
parents: 22567
diff changeset
   229
  >     print 'now try to read something: %r' % sys.stdin.read()
78b99149ed8a test-commandserver: port test functions from .py to .t
Yuya Nishihara <yuya@tcha.org>
parents: 22567
diff changeset
   230
  > EOF
78b99149ed8a test-commandserver: port test functions from .py to .t
Yuya Nishihara <yuya@tcha.org>
parents: 22567
diff changeset
   231
78b99149ed8a test-commandserver: port test functions from .py to .t
Yuya Nishihara <yuya@tcha.org>
parents: 22567
diff changeset
   232
  >>> import cStringIO
78b99149ed8a test-commandserver: port test functions from .py to .t
Yuya Nishihara <yuya@tcha.org>
parents: 22567
diff changeset
   233
  >>> from hgclient import readchannel, runcommand, check
78b99149ed8a test-commandserver: port test functions from .py to .t
Yuya Nishihara <yuya@tcha.org>
parents: 22567
diff changeset
   234
  >>> @check
78b99149ed8a test-commandserver: port test functions from .py to .t
Yuya Nishihara <yuya@tcha.org>
parents: 22567
diff changeset
   235
  ... def hookoutput(server):
78b99149ed8a test-commandserver: port test functions from .py to .t
Yuya Nishihara <yuya@tcha.org>
parents: 22567
diff changeset
   236
  ...     readchannel(server)
78b99149ed8a test-commandserver: port test functions from .py to .t
Yuya Nishihara <yuya@tcha.org>
parents: 22567
diff changeset
   237
  ...     runcommand(server, ['--config',
78b99149ed8a test-commandserver: port test functions from .py to .t
Yuya Nishihara <yuya@tcha.org>
parents: 22567
diff changeset
   238
  ...                         'hooks.pre-identify=python:hook.hook',
78b99149ed8a test-commandserver: port test functions from .py to .t
Yuya Nishihara <yuya@tcha.org>
parents: 22567
diff changeset
   239
  ...                         'id'],
78b99149ed8a test-commandserver: port test functions from .py to .t
Yuya Nishihara <yuya@tcha.org>
parents: 22567
diff changeset
   240
  ...                input=cStringIO.StringIO('some input'))
22567
f9a4a035003d test-commandserver: add stub for .t test by copying .out with 2-space indent
Yuya Nishihara <yuya@tcha.org>
parents:
diff changeset
   241
  
f9a4a035003d test-commandserver: add stub for .t test by copying .out with 2-space indent
Yuya Nishihara <yuya@tcha.org>
parents:
diff changeset
   242
  testing hookoutput:
f9a4a035003d test-commandserver: add stub for .t test by copying .out with 2-space indent
Yuya Nishihara <yuya@tcha.org>
parents:
diff changeset
   243
  
22568
78b99149ed8a test-commandserver: port test functions from .py to .t
Yuya Nishihara <yuya@tcha.org>
parents: 22567
diff changeset
   244
   runcommand --config hooks.pre-identify=python:hook.hook id
22567
f9a4a035003d test-commandserver: add stub for .t test by copying .out with 2-space indent
Yuya Nishihara <yuya@tcha.org>
parents:
diff changeset
   245
  hook talking
f9a4a035003d test-commandserver: add stub for .t test by copying .out with 2-space indent
Yuya Nishihara <yuya@tcha.org>
parents:
diff changeset
   246
  now try to read something: 'some input'
f9a4a035003d test-commandserver: add stub for .t test by copying .out with 2-space indent
Yuya Nishihara <yuya@tcha.org>
parents:
diff changeset
   247
  eff892de26ec tip
22568
78b99149ed8a test-commandserver: port test functions from .py to .t
Yuya Nishihara <yuya@tcha.org>
parents: 22567
diff changeset
   248
78b99149ed8a test-commandserver: port test functions from .py to .t
Yuya Nishihara <yuya@tcha.org>
parents: 22567
diff changeset
   249
  $ rm hook.py*
78b99149ed8a test-commandserver: port test functions from .py to .t
Yuya Nishihara <yuya@tcha.org>
parents: 22567
diff changeset
   250
78b99149ed8a test-commandserver: port test functions from .py to .t
Yuya Nishihara <yuya@tcha.org>
parents: 22567
diff changeset
   251
  $ echo a >> a
78b99149ed8a test-commandserver: port test functions from .py to .t
Yuya Nishihara <yuya@tcha.org>
parents: 22567
diff changeset
   252
  >>> import os
78b99149ed8a test-commandserver: port test functions from .py to .t
Yuya Nishihara <yuya@tcha.org>
parents: 22567
diff changeset
   253
  >>> from hgclient import readchannel, runcommand, check
78b99149ed8a test-commandserver: port test functions from .py to .t
Yuya Nishihara <yuya@tcha.org>
parents: 22567
diff changeset
   254
  >>> @check
78b99149ed8a test-commandserver: port test functions from .py to .t
Yuya Nishihara <yuya@tcha.org>
parents: 22567
diff changeset
   255
  ... def outsidechanges(server):
78b99149ed8a test-commandserver: port test functions from .py to .t
Yuya Nishihara <yuya@tcha.org>
parents: 22567
diff changeset
   256
  ...     readchannel(server)
78b99149ed8a test-commandserver: port test functions from .py to .t
Yuya Nishihara <yuya@tcha.org>
parents: 22567
diff changeset
   257
  ...     runcommand(server, ['status'])
78b99149ed8a test-commandserver: port test functions from .py to .t
Yuya Nishihara <yuya@tcha.org>
parents: 22567
diff changeset
   258
  ...     os.system('hg ci -Am2')
78b99149ed8a test-commandserver: port test functions from .py to .t
Yuya Nishihara <yuya@tcha.org>
parents: 22567
diff changeset
   259
  ...     runcommand(server, ['tip'])
78b99149ed8a test-commandserver: port test functions from .py to .t
Yuya Nishihara <yuya@tcha.org>
parents: 22567
diff changeset
   260
  ...     runcommand(server, ['status'])
22567
f9a4a035003d test-commandserver: add stub for .t test by copying .out with 2-space indent
Yuya Nishihara <yuya@tcha.org>
parents:
diff changeset
   261
  
f9a4a035003d test-commandserver: add stub for .t test by copying .out with 2-space indent
Yuya Nishihara <yuya@tcha.org>
parents:
diff changeset
   262
  testing outsidechanges:
f9a4a035003d test-commandserver: add stub for .t test by copying .out with 2-space indent
Yuya Nishihara <yuya@tcha.org>
parents:
diff changeset
   263
  
f9a4a035003d test-commandserver: add stub for .t test by copying .out with 2-space indent
Yuya Nishihara <yuya@tcha.org>
parents:
diff changeset
   264
   runcommand status
f9a4a035003d test-commandserver: add stub for .t test by copying .out with 2-space indent
Yuya Nishihara <yuya@tcha.org>
parents:
diff changeset
   265
  M a
f9a4a035003d test-commandserver: add stub for .t test by copying .out with 2-space indent
Yuya Nishihara <yuya@tcha.org>
parents:
diff changeset
   266
   runcommand tip
f9a4a035003d test-commandserver: add stub for .t test by copying .out with 2-space indent
Yuya Nishihara <yuya@tcha.org>
parents:
diff changeset
   267
  changeset:   1:d3a0a68be6de
f9a4a035003d test-commandserver: add stub for .t test by copying .out with 2-space indent
Yuya Nishihara <yuya@tcha.org>
parents:
diff changeset
   268
  tag:         tip
f9a4a035003d test-commandserver: add stub for .t test by copying .out with 2-space indent
Yuya Nishihara <yuya@tcha.org>
parents:
diff changeset
   269
  user:        test
f9a4a035003d test-commandserver: add stub for .t test by copying .out with 2-space indent
Yuya Nishihara <yuya@tcha.org>
parents:
diff changeset
   270
  date:        Thu Jan 01 00:00:00 1970 +0000
f9a4a035003d test-commandserver: add stub for .t test by copying .out with 2-space indent
Yuya Nishihara <yuya@tcha.org>
parents:
diff changeset
   271
  summary:     2
f9a4a035003d test-commandserver: add stub for .t test by copying .out with 2-space indent
Yuya Nishihara <yuya@tcha.org>
parents:
diff changeset
   272
  
f9a4a035003d test-commandserver: add stub for .t test by copying .out with 2-space indent
Yuya Nishihara <yuya@tcha.org>
parents:
diff changeset
   273
   runcommand status
22568
78b99149ed8a test-commandserver: port test functions from .py to .t
Yuya Nishihara <yuya@tcha.org>
parents: 22567
diff changeset
   274
78b99149ed8a test-commandserver: port test functions from .py to .t
Yuya Nishihara <yuya@tcha.org>
parents: 22567
diff changeset
   275
  >>> import os
78b99149ed8a test-commandserver: port test functions from .py to .t
Yuya Nishihara <yuya@tcha.org>
parents: 22567
diff changeset
   276
  >>> from hgclient import readchannel, runcommand, check
78b99149ed8a test-commandserver: port test functions from .py to .t
Yuya Nishihara <yuya@tcha.org>
parents: 22567
diff changeset
   277
  >>> @check
78b99149ed8a test-commandserver: port test functions from .py to .t
Yuya Nishihara <yuya@tcha.org>
parents: 22567
diff changeset
   278
  ... def bookmarks(server):
78b99149ed8a test-commandserver: port test functions from .py to .t
Yuya Nishihara <yuya@tcha.org>
parents: 22567
diff changeset
   279
  ...     readchannel(server)
78b99149ed8a test-commandserver: port test functions from .py to .t
Yuya Nishihara <yuya@tcha.org>
parents: 22567
diff changeset
   280
  ...     runcommand(server, ['bookmarks'])
78b99149ed8a test-commandserver: port test functions from .py to .t
Yuya Nishihara <yuya@tcha.org>
parents: 22567
diff changeset
   281
  ... 
78b99149ed8a test-commandserver: port test functions from .py to .t
Yuya Nishihara <yuya@tcha.org>
parents: 22567
diff changeset
   282
  ...     # changes .hg/bookmarks
78b99149ed8a test-commandserver: port test functions from .py to .t
Yuya Nishihara <yuya@tcha.org>
parents: 22567
diff changeset
   283
  ...     os.system('hg bookmark -i bm1')
78b99149ed8a test-commandserver: port test functions from .py to .t
Yuya Nishihara <yuya@tcha.org>
parents: 22567
diff changeset
   284
  ...     os.system('hg bookmark -i bm2')
78b99149ed8a test-commandserver: port test functions from .py to .t
Yuya Nishihara <yuya@tcha.org>
parents: 22567
diff changeset
   285
  ...     runcommand(server, ['bookmarks'])
78b99149ed8a test-commandserver: port test functions from .py to .t
Yuya Nishihara <yuya@tcha.org>
parents: 22567
diff changeset
   286
  ... 
78b99149ed8a test-commandserver: port test functions from .py to .t
Yuya Nishihara <yuya@tcha.org>
parents: 22567
diff changeset
   287
  ...     # changes .hg/bookmarks.current
78b99149ed8a test-commandserver: port test functions from .py to .t
Yuya Nishihara <yuya@tcha.org>
parents: 22567
diff changeset
   288
  ...     os.system('hg upd bm1 -q')
78b99149ed8a test-commandserver: port test functions from .py to .t
Yuya Nishihara <yuya@tcha.org>
parents: 22567
diff changeset
   289
  ...     runcommand(server, ['bookmarks'])
78b99149ed8a test-commandserver: port test functions from .py to .t
Yuya Nishihara <yuya@tcha.org>
parents: 22567
diff changeset
   290
  ... 
78b99149ed8a test-commandserver: port test functions from .py to .t
Yuya Nishihara <yuya@tcha.org>
parents: 22567
diff changeset
   291
  ...     runcommand(server, ['bookmarks', 'bm3'])
78b99149ed8a test-commandserver: port test functions from .py to .t
Yuya Nishihara <yuya@tcha.org>
parents: 22567
diff changeset
   292
  ...     f = open('a', 'ab')
78b99149ed8a test-commandserver: port test functions from .py to .t
Yuya Nishihara <yuya@tcha.org>
parents: 22567
diff changeset
   293
  ...     f.write('a\n')
78b99149ed8a test-commandserver: port test functions from .py to .t
Yuya Nishihara <yuya@tcha.org>
parents: 22567
diff changeset
   294
  ...     f.close()
78b99149ed8a test-commandserver: port test functions from .py to .t
Yuya Nishihara <yuya@tcha.org>
parents: 22567
diff changeset
   295
  ...     runcommand(server, ['commit', '-Amm'])
78b99149ed8a test-commandserver: port test functions from .py to .t
Yuya Nishihara <yuya@tcha.org>
parents: 22567
diff changeset
   296
  ...     runcommand(server, ['bookmarks'])
22567
f9a4a035003d test-commandserver: add stub for .t test by copying .out with 2-space indent
Yuya Nishihara <yuya@tcha.org>
parents:
diff changeset
   297
  
f9a4a035003d test-commandserver: add stub for .t test by copying .out with 2-space indent
Yuya Nishihara <yuya@tcha.org>
parents:
diff changeset
   298
  testing bookmarks:
f9a4a035003d test-commandserver: add stub for .t test by copying .out with 2-space indent
Yuya Nishihara <yuya@tcha.org>
parents:
diff changeset
   299
  
f9a4a035003d test-commandserver: add stub for .t test by copying .out with 2-space indent
Yuya Nishihara <yuya@tcha.org>
parents:
diff changeset
   300
   runcommand bookmarks
f9a4a035003d test-commandserver: add stub for .t test by copying .out with 2-space indent
Yuya Nishihara <yuya@tcha.org>
parents:
diff changeset
   301
  no bookmarks set
f9a4a035003d test-commandserver: add stub for .t test by copying .out with 2-space indent
Yuya Nishihara <yuya@tcha.org>
parents:
diff changeset
   302
   runcommand bookmarks
f9a4a035003d test-commandserver: add stub for .t test by copying .out with 2-space indent
Yuya Nishihara <yuya@tcha.org>
parents:
diff changeset
   303
     bm1                       1:d3a0a68be6de
f9a4a035003d test-commandserver: add stub for .t test by copying .out with 2-space indent
Yuya Nishihara <yuya@tcha.org>
parents:
diff changeset
   304
     bm2                       1:d3a0a68be6de
f9a4a035003d test-commandserver: add stub for .t test by copying .out with 2-space indent
Yuya Nishihara <yuya@tcha.org>
parents:
diff changeset
   305
   runcommand bookmarks
f9a4a035003d test-commandserver: add stub for .t test by copying .out with 2-space indent
Yuya Nishihara <yuya@tcha.org>
parents:
diff changeset
   306
   * bm1                       1:d3a0a68be6de
f9a4a035003d test-commandserver: add stub for .t test by copying .out with 2-space indent
Yuya Nishihara <yuya@tcha.org>
parents:
diff changeset
   307
     bm2                       1:d3a0a68be6de
f9a4a035003d test-commandserver: add stub for .t test by copying .out with 2-space indent
Yuya Nishihara <yuya@tcha.org>
parents:
diff changeset
   308
   runcommand bookmarks bm3
f9a4a035003d test-commandserver: add stub for .t test by copying .out with 2-space indent
Yuya Nishihara <yuya@tcha.org>
parents:
diff changeset
   309
   runcommand commit -Amm
f9a4a035003d test-commandserver: add stub for .t test by copying .out with 2-space indent
Yuya Nishihara <yuya@tcha.org>
parents:
diff changeset
   310
   runcommand bookmarks
f9a4a035003d test-commandserver: add stub for .t test by copying .out with 2-space indent
Yuya Nishihara <yuya@tcha.org>
parents:
diff changeset
   311
     bm1                       1:d3a0a68be6de
f9a4a035003d test-commandserver: add stub for .t test by copying .out with 2-space indent
Yuya Nishihara <yuya@tcha.org>
parents:
diff changeset
   312
     bm2                       1:d3a0a68be6de
f9a4a035003d test-commandserver: add stub for .t test by copying .out with 2-space indent
Yuya Nishihara <yuya@tcha.org>
parents:
diff changeset
   313
   * bm3                       2:aef17e88f5f0
22568
78b99149ed8a test-commandserver: port test functions from .py to .t
Yuya Nishihara <yuya@tcha.org>
parents: 22567
diff changeset
   314
78b99149ed8a test-commandserver: port test functions from .py to .t
Yuya Nishihara <yuya@tcha.org>
parents: 22567
diff changeset
   315
  >>> import os
78b99149ed8a test-commandserver: port test functions from .py to .t
Yuya Nishihara <yuya@tcha.org>
parents: 22567
diff changeset
   316
  >>> from hgclient import readchannel, runcommand, check
78b99149ed8a test-commandserver: port test functions from .py to .t
Yuya Nishihara <yuya@tcha.org>
parents: 22567
diff changeset
   317
  >>> @check
78b99149ed8a test-commandserver: port test functions from .py to .t
Yuya Nishihara <yuya@tcha.org>
parents: 22567
diff changeset
   318
  ... def tagscache(server):
78b99149ed8a test-commandserver: port test functions from .py to .t
Yuya Nishihara <yuya@tcha.org>
parents: 22567
diff changeset
   319
  ...     readchannel(server)
78b99149ed8a test-commandserver: port test functions from .py to .t
Yuya Nishihara <yuya@tcha.org>
parents: 22567
diff changeset
   320
  ...     runcommand(server, ['id', '-t', '-r', '0'])
78b99149ed8a test-commandserver: port test functions from .py to .t
Yuya Nishihara <yuya@tcha.org>
parents: 22567
diff changeset
   321
  ...     os.system('hg tag -r 0 foo')
78b99149ed8a test-commandserver: port test functions from .py to .t
Yuya Nishihara <yuya@tcha.org>
parents: 22567
diff changeset
   322
  ...     runcommand(server, ['id', '-t', '-r', '0'])
22567
f9a4a035003d test-commandserver: add stub for .t test by copying .out with 2-space indent
Yuya Nishihara <yuya@tcha.org>
parents:
diff changeset
   323
  
f9a4a035003d test-commandserver: add stub for .t test by copying .out with 2-space indent
Yuya Nishihara <yuya@tcha.org>
parents:
diff changeset
   324
  testing tagscache:
f9a4a035003d test-commandserver: add stub for .t test by copying .out with 2-space indent
Yuya Nishihara <yuya@tcha.org>
parents:
diff changeset
   325
  
f9a4a035003d test-commandserver: add stub for .t test by copying .out with 2-space indent
Yuya Nishihara <yuya@tcha.org>
parents:
diff changeset
   326
   runcommand id -t -r 0
f9a4a035003d test-commandserver: add stub for .t test by copying .out with 2-space indent
Yuya Nishihara <yuya@tcha.org>
parents:
diff changeset
   327
  
f9a4a035003d test-commandserver: add stub for .t test by copying .out with 2-space indent
Yuya Nishihara <yuya@tcha.org>
parents:
diff changeset
   328
   runcommand id -t -r 0
f9a4a035003d test-commandserver: add stub for .t test by copying .out with 2-space indent
Yuya Nishihara <yuya@tcha.org>
parents:
diff changeset
   329
  foo
22568
78b99149ed8a test-commandserver: port test functions from .py to .t
Yuya Nishihara <yuya@tcha.org>
parents: 22567
diff changeset
   330
78b99149ed8a test-commandserver: port test functions from .py to .t
Yuya Nishihara <yuya@tcha.org>
parents: 22567
diff changeset
   331
  >>> import os
78b99149ed8a test-commandserver: port test functions from .py to .t
Yuya Nishihara <yuya@tcha.org>
parents: 22567
diff changeset
   332
  >>> from hgclient import readchannel, runcommand, check
78b99149ed8a test-commandserver: port test functions from .py to .t
Yuya Nishihara <yuya@tcha.org>
parents: 22567
diff changeset
   333
  >>> @check
78b99149ed8a test-commandserver: port test functions from .py to .t
Yuya Nishihara <yuya@tcha.org>
parents: 22567
diff changeset
   334
  ... def setphase(server):
78b99149ed8a test-commandserver: port test functions from .py to .t
Yuya Nishihara <yuya@tcha.org>
parents: 22567
diff changeset
   335
  ...     readchannel(server)
78b99149ed8a test-commandserver: port test functions from .py to .t
Yuya Nishihara <yuya@tcha.org>
parents: 22567
diff changeset
   336
  ...     runcommand(server, ['phase', '-r', '.'])
78b99149ed8a test-commandserver: port test functions from .py to .t
Yuya Nishihara <yuya@tcha.org>
parents: 22567
diff changeset
   337
  ...     os.system('hg phase -r . -p')
78b99149ed8a test-commandserver: port test functions from .py to .t
Yuya Nishihara <yuya@tcha.org>
parents: 22567
diff changeset
   338
  ...     runcommand(server, ['phase', '-r', '.'])
22567
f9a4a035003d test-commandserver: add stub for .t test by copying .out with 2-space indent
Yuya Nishihara <yuya@tcha.org>
parents:
diff changeset
   339
  
f9a4a035003d test-commandserver: add stub for .t test by copying .out with 2-space indent
Yuya Nishihara <yuya@tcha.org>
parents:
diff changeset
   340
  testing setphase:
f9a4a035003d test-commandserver: add stub for .t test by copying .out with 2-space indent
Yuya Nishihara <yuya@tcha.org>
parents:
diff changeset
   341
  
f9a4a035003d test-commandserver: add stub for .t test by copying .out with 2-space indent
Yuya Nishihara <yuya@tcha.org>
parents:
diff changeset
   342
   runcommand phase -r .
f9a4a035003d test-commandserver: add stub for .t test by copying .out with 2-space indent
Yuya Nishihara <yuya@tcha.org>
parents:
diff changeset
   343
  3: draft
f9a4a035003d test-commandserver: add stub for .t test by copying .out with 2-space indent
Yuya Nishihara <yuya@tcha.org>
parents:
diff changeset
   344
   runcommand phase -r .
f9a4a035003d test-commandserver: add stub for .t test by copying .out with 2-space indent
Yuya Nishihara <yuya@tcha.org>
parents:
diff changeset
   345
  3: public
22568
78b99149ed8a test-commandserver: port test functions from .py to .t
Yuya Nishihara <yuya@tcha.org>
parents: 22567
diff changeset
   346
78b99149ed8a test-commandserver: port test functions from .py to .t
Yuya Nishihara <yuya@tcha.org>
parents: 22567
diff changeset
   347
  $ echo a >> a
78b99149ed8a test-commandserver: port test functions from .py to .t
Yuya Nishihara <yuya@tcha.org>
parents: 22567
diff changeset
   348
  >>> from hgclient import readchannel, runcommand, check
78b99149ed8a test-commandserver: port test functions from .py to .t
Yuya Nishihara <yuya@tcha.org>
parents: 22567
diff changeset
   349
  >>> @check
78b99149ed8a test-commandserver: port test functions from .py to .t
Yuya Nishihara <yuya@tcha.org>
parents: 22567
diff changeset
   350
  ... def rollback(server):
78b99149ed8a test-commandserver: port test functions from .py to .t
Yuya Nishihara <yuya@tcha.org>
parents: 22567
diff changeset
   351
  ...     readchannel(server)
78b99149ed8a test-commandserver: port test functions from .py to .t
Yuya Nishihara <yuya@tcha.org>
parents: 22567
diff changeset
   352
  ...     runcommand(server, ['phase', '-r', '.', '-p'])
78b99149ed8a test-commandserver: port test functions from .py to .t
Yuya Nishihara <yuya@tcha.org>
parents: 22567
diff changeset
   353
  ...     runcommand(server, ['commit', '-Am.'])
78b99149ed8a test-commandserver: port test functions from .py to .t
Yuya Nishihara <yuya@tcha.org>
parents: 22567
diff changeset
   354
  ...     runcommand(server, ['rollback'])
78b99149ed8a test-commandserver: port test functions from .py to .t
Yuya Nishihara <yuya@tcha.org>
parents: 22567
diff changeset
   355
  ...     runcommand(server, ['phase', '-r', '.'])
22567
f9a4a035003d test-commandserver: add stub for .t test by copying .out with 2-space indent
Yuya Nishihara <yuya@tcha.org>
parents:
diff changeset
   356
  
f9a4a035003d test-commandserver: add stub for .t test by copying .out with 2-space indent
Yuya Nishihara <yuya@tcha.org>
parents:
diff changeset
   357
  testing rollback:
f9a4a035003d test-commandserver: add stub for .t test by copying .out with 2-space indent
Yuya Nishihara <yuya@tcha.org>
parents:
diff changeset
   358
  
f9a4a035003d test-commandserver: add stub for .t test by copying .out with 2-space indent
Yuya Nishihara <yuya@tcha.org>
parents:
diff changeset
   359
   runcommand phase -r . -p
f9a4a035003d test-commandserver: add stub for .t test by copying .out with 2-space indent
Yuya Nishihara <yuya@tcha.org>
parents:
diff changeset
   360
  no phases changed
f9a4a035003d test-commandserver: add stub for .t test by copying .out with 2-space indent
Yuya Nishihara <yuya@tcha.org>
parents:
diff changeset
   361
   [1]
f9a4a035003d test-commandserver: add stub for .t test by copying .out with 2-space indent
Yuya Nishihara <yuya@tcha.org>
parents:
diff changeset
   362
   runcommand commit -Am.
f9a4a035003d test-commandserver: add stub for .t test by copying .out with 2-space indent
Yuya Nishihara <yuya@tcha.org>
parents:
diff changeset
   363
   runcommand rollback
f9a4a035003d test-commandserver: add stub for .t test by copying .out with 2-space indent
Yuya Nishihara <yuya@tcha.org>
parents:
diff changeset
   364
  repository tip rolled back to revision 3 (undo commit)
f9a4a035003d test-commandserver: add stub for .t test by copying .out with 2-space indent
Yuya Nishihara <yuya@tcha.org>
parents:
diff changeset
   365
  working directory now based on revision 3
f9a4a035003d test-commandserver: add stub for .t test by copying .out with 2-space indent
Yuya Nishihara <yuya@tcha.org>
parents:
diff changeset
   366
   runcommand phase -r .
f9a4a035003d test-commandserver: add stub for .t test by copying .out with 2-space indent
Yuya Nishihara <yuya@tcha.org>
parents:
diff changeset
   367
  3: public
22568
78b99149ed8a test-commandserver: port test functions from .py to .t
Yuya Nishihara <yuya@tcha.org>
parents: 22567
diff changeset
   368
78b99149ed8a test-commandserver: port test functions from .py to .t
Yuya Nishihara <yuya@tcha.org>
parents: 22567
diff changeset
   369
  >>> import os
78b99149ed8a test-commandserver: port test functions from .py to .t
Yuya Nishihara <yuya@tcha.org>
parents: 22567
diff changeset
   370
  >>> from hgclient import readchannel, runcommand, check
78b99149ed8a test-commandserver: port test functions from .py to .t
Yuya Nishihara <yuya@tcha.org>
parents: 22567
diff changeset
   371
  >>> @check
78b99149ed8a test-commandserver: port test functions from .py to .t
Yuya Nishihara <yuya@tcha.org>
parents: 22567
diff changeset
   372
  ... def branch(server):
78b99149ed8a test-commandserver: port test functions from .py to .t
Yuya Nishihara <yuya@tcha.org>
parents: 22567
diff changeset
   373
  ...     readchannel(server)
78b99149ed8a test-commandserver: port test functions from .py to .t
Yuya Nishihara <yuya@tcha.org>
parents: 22567
diff changeset
   374
  ...     runcommand(server, ['branch'])
78b99149ed8a test-commandserver: port test functions from .py to .t
Yuya Nishihara <yuya@tcha.org>
parents: 22567
diff changeset
   375
  ...     os.system('hg branch foo')
78b99149ed8a test-commandserver: port test functions from .py to .t
Yuya Nishihara <yuya@tcha.org>
parents: 22567
diff changeset
   376
  ...     runcommand(server, ['branch'])
78b99149ed8a test-commandserver: port test functions from .py to .t
Yuya Nishihara <yuya@tcha.org>
parents: 22567
diff changeset
   377
  ...     os.system('hg branch default')
22567
f9a4a035003d test-commandserver: add stub for .t test by copying .out with 2-space indent
Yuya Nishihara <yuya@tcha.org>
parents:
diff changeset
   378
  
f9a4a035003d test-commandserver: add stub for .t test by copying .out with 2-space indent
Yuya Nishihara <yuya@tcha.org>
parents:
diff changeset
   379
  testing branch:
f9a4a035003d test-commandserver: add stub for .t test by copying .out with 2-space indent
Yuya Nishihara <yuya@tcha.org>
parents:
diff changeset
   380
  
f9a4a035003d test-commandserver: add stub for .t test by copying .out with 2-space indent
Yuya Nishihara <yuya@tcha.org>
parents:
diff changeset
   381
   runcommand branch
f9a4a035003d test-commandserver: add stub for .t test by copying .out with 2-space indent
Yuya Nishihara <yuya@tcha.org>
parents:
diff changeset
   382
  default
f9a4a035003d test-commandserver: add stub for .t test by copying .out with 2-space indent
Yuya Nishihara <yuya@tcha.org>
parents:
diff changeset
   383
  marked working directory as branch foo
f9a4a035003d test-commandserver: add stub for .t test by copying .out with 2-space indent
Yuya Nishihara <yuya@tcha.org>
parents:
diff changeset
   384
  (branches are permanent and global, did you want a bookmark?)
f9a4a035003d test-commandserver: add stub for .t test by copying .out with 2-space indent
Yuya Nishihara <yuya@tcha.org>
parents:
diff changeset
   385
   runcommand branch
f9a4a035003d test-commandserver: add stub for .t test by copying .out with 2-space indent
Yuya Nishihara <yuya@tcha.org>
parents:
diff changeset
   386
  foo
f9a4a035003d test-commandserver: add stub for .t test by copying .out with 2-space indent
Yuya Nishihara <yuya@tcha.org>
parents:
diff changeset
   387
  marked working directory as branch default
f9a4a035003d test-commandserver: add stub for .t test by copying .out with 2-space indent
Yuya Nishihara <yuya@tcha.org>
parents:
diff changeset
   388
  (branches are permanent and global, did you want a bookmark?)
22568
78b99149ed8a test-commandserver: port test functions from .py to .t
Yuya Nishihara <yuya@tcha.org>
parents: 22567
diff changeset
   389
78b99149ed8a test-commandserver: port test functions from .py to .t
Yuya Nishihara <yuya@tcha.org>
parents: 22567
diff changeset
   390
  $ touch .hgignore
78b99149ed8a test-commandserver: port test functions from .py to .t
Yuya Nishihara <yuya@tcha.org>
parents: 22567
diff changeset
   391
  >>> import os
78b99149ed8a test-commandserver: port test functions from .py to .t
Yuya Nishihara <yuya@tcha.org>
parents: 22567
diff changeset
   392
  >>> from hgclient import readchannel, runcommand, check
78b99149ed8a test-commandserver: port test functions from .py to .t
Yuya Nishihara <yuya@tcha.org>
parents: 22567
diff changeset
   393
  >>> @check
78b99149ed8a test-commandserver: port test functions from .py to .t
Yuya Nishihara <yuya@tcha.org>
parents: 22567
diff changeset
   394
  ... def hgignore(server):
78b99149ed8a test-commandserver: port test functions from .py to .t
Yuya Nishihara <yuya@tcha.org>
parents: 22567
diff changeset
   395
  ...     readchannel(server)
78b99149ed8a test-commandserver: port test functions from .py to .t
Yuya Nishihara <yuya@tcha.org>
parents: 22567
diff changeset
   396
  ...     runcommand(server, ['commit', '-Am.'])
78b99149ed8a test-commandserver: port test functions from .py to .t
Yuya Nishihara <yuya@tcha.org>
parents: 22567
diff changeset
   397
  ...     f = open('ignored-file', 'ab')
78b99149ed8a test-commandserver: port test functions from .py to .t
Yuya Nishihara <yuya@tcha.org>
parents: 22567
diff changeset
   398
  ...     f.write('')
78b99149ed8a test-commandserver: port test functions from .py to .t
Yuya Nishihara <yuya@tcha.org>
parents: 22567
diff changeset
   399
  ...     f.close()
78b99149ed8a test-commandserver: port test functions from .py to .t
Yuya Nishihara <yuya@tcha.org>
parents: 22567
diff changeset
   400
  ...     f = open('.hgignore', 'ab')
78b99149ed8a test-commandserver: port test functions from .py to .t
Yuya Nishihara <yuya@tcha.org>
parents: 22567
diff changeset
   401
  ...     f.write('ignored-file')
78b99149ed8a test-commandserver: port test functions from .py to .t
Yuya Nishihara <yuya@tcha.org>
parents: 22567
diff changeset
   402
  ...     f.close()
78b99149ed8a test-commandserver: port test functions from .py to .t
Yuya Nishihara <yuya@tcha.org>
parents: 22567
diff changeset
   403
  ...     runcommand(server, ['status', '-i', '-u'])
22567
f9a4a035003d test-commandserver: add stub for .t test by copying .out with 2-space indent
Yuya Nishihara <yuya@tcha.org>
parents:
diff changeset
   404
  
f9a4a035003d test-commandserver: add stub for .t test by copying .out with 2-space indent
Yuya Nishihara <yuya@tcha.org>
parents:
diff changeset
   405
  testing hgignore:
f9a4a035003d test-commandserver: add stub for .t test by copying .out with 2-space indent
Yuya Nishihara <yuya@tcha.org>
parents:
diff changeset
   406
  
f9a4a035003d test-commandserver: add stub for .t test by copying .out with 2-space indent
Yuya Nishihara <yuya@tcha.org>
parents:
diff changeset
   407
   runcommand commit -Am.
f9a4a035003d test-commandserver: add stub for .t test by copying .out with 2-space indent
Yuya Nishihara <yuya@tcha.org>
parents:
diff changeset
   408
  adding .hgignore
f9a4a035003d test-commandserver: add stub for .t test by copying .out with 2-space indent
Yuya Nishihara <yuya@tcha.org>
parents:
diff changeset
   409
   runcommand status -i -u
f9a4a035003d test-commandserver: add stub for .t test by copying .out with 2-space indent
Yuya Nishihara <yuya@tcha.org>
parents:
diff changeset
   410
  I ignored-file
22568
78b99149ed8a test-commandserver: port test functions from .py to .t
Yuya Nishihara <yuya@tcha.org>
parents: 22567
diff changeset
   411
78b99149ed8a test-commandserver: port test functions from .py to .t
Yuya Nishihara <yuya@tcha.org>
parents: 22567
diff changeset
   412
  >>> import os
78b99149ed8a test-commandserver: port test functions from .py to .t
Yuya Nishihara <yuya@tcha.org>
parents: 22567
diff changeset
   413
  >>> from hgclient import readchannel, sep, runcommand, check
78b99149ed8a test-commandserver: port test functions from .py to .t
Yuya Nishihara <yuya@tcha.org>
parents: 22567
diff changeset
   414
  >>> @check
78b99149ed8a test-commandserver: port test functions from .py to .t
Yuya Nishihara <yuya@tcha.org>
parents: 22567
diff changeset
   415
  ... def phasecacheafterstrip(server):
78b99149ed8a test-commandserver: port test functions from .py to .t
Yuya Nishihara <yuya@tcha.org>
parents: 22567
diff changeset
   416
  ...     readchannel(server)
78b99149ed8a test-commandserver: port test functions from .py to .t
Yuya Nishihara <yuya@tcha.org>
parents: 22567
diff changeset
   417
  ... 
78b99149ed8a test-commandserver: port test functions from .py to .t
Yuya Nishihara <yuya@tcha.org>
parents: 22567
diff changeset
   418
  ...     # create new head, 5:731265503d86
78b99149ed8a test-commandserver: port test functions from .py to .t
Yuya Nishihara <yuya@tcha.org>
parents: 22567
diff changeset
   419
  ...     runcommand(server, ['update', '-C', '0'])
78b99149ed8a test-commandserver: port test functions from .py to .t
Yuya Nishihara <yuya@tcha.org>
parents: 22567
diff changeset
   420
  ...     f = open('a', 'ab')
78b99149ed8a test-commandserver: port test functions from .py to .t
Yuya Nishihara <yuya@tcha.org>
parents: 22567
diff changeset
   421
  ...     f.write('a\n')
78b99149ed8a test-commandserver: port test functions from .py to .t
Yuya Nishihara <yuya@tcha.org>
parents: 22567
diff changeset
   422
  ...     f.close()
78b99149ed8a test-commandserver: port test functions from .py to .t
Yuya Nishihara <yuya@tcha.org>
parents: 22567
diff changeset
   423
  ...     runcommand(server, ['commit', '-Am.', 'a'])
78b99149ed8a test-commandserver: port test functions from .py to .t
Yuya Nishihara <yuya@tcha.org>
parents: 22567
diff changeset
   424
  ...     runcommand(server, ['log', '-Gq'])
78b99149ed8a test-commandserver: port test functions from .py to .t
Yuya Nishihara <yuya@tcha.org>
parents: 22567
diff changeset
   425
  ... 
78b99149ed8a test-commandserver: port test functions from .py to .t
Yuya Nishihara <yuya@tcha.org>
parents: 22567
diff changeset
   426
  ...     # make it public; draft marker moves to 4:7966c8e3734d
78b99149ed8a test-commandserver: port test functions from .py to .t
Yuya Nishihara <yuya@tcha.org>
parents: 22567
diff changeset
   427
  ...     runcommand(server, ['phase', '-p', '.'])
78b99149ed8a test-commandserver: port test functions from .py to .t
Yuya Nishihara <yuya@tcha.org>
parents: 22567
diff changeset
   428
  ...     # load _phasecache.phaseroots
78b99149ed8a test-commandserver: port test functions from .py to .t
Yuya Nishihara <yuya@tcha.org>
parents: 22567
diff changeset
   429
  ...     runcommand(server, ['phase', '.'], outfilter=sep)
78b99149ed8a test-commandserver: port test functions from .py to .t
Yuya Nishihara <yuya@tcha.org>
parents: 22567
diff changeset
   430
  ... 
78b99149ed8a test-commandserver: port test functions from .py to .t
Yuya Nishihara <yuya@tcha.org>
parents: 22567
diff changeset
   431
  ...     # strip 1::4 outside server
78b99149ed8a test-commandserver: port test functions from .py to .t
Yuya Nishihara <yuya@tcha.org>
parents: 22567
diff changeset
   432
  ...     os.system('hg -q --config extensions.mq= strip 1')
78b99149ed8a test-commandserver: port test functions from .py to .t
Yuya Nishihara <yuya@tcha.org>
parents: 22567
diff changeset
   433
  ... 
78b99149ed8a test-commandserver: port test functions from .py to .t
Yuya Nishihara <yuya@tcha.org>
parents: 22567
diff changeset
   434
  ...     # shouldn't raise "7966c8e3734d: no node!"
78b99149ed8a test-commandserver: port test functions from .py to .t
Yuya Nishihara <yuya@tcha.org>
parents: 22567
diff changeset
   435
  ...     runcommand(server, ['branches'])
22567
f9a4a035003d test-commandserver: add stub for .t test by copying .out with 2-space indent
Yuya Nishihara <yuya@tcha.org>
parents:
diff changeset
   436
  
f9a4a035003d test-commandserver: add stub for .t test by copying .out with 2-space indent
Yuya Nishihara <yuya@tcha.org>
parents:
diff changeset
   437
  testing phasecacheafterstrip:
f9a4a035003d test-commandserver: add stub for .t test by copying .out with 2-space indent
Yuya Nishihara <yuya@tcha.org>
parents:
diff changeset
   438
  
f9a4a035003d test-commandserver: add stub for .t test by copying .out with 2-space indent
Yuya Nishihara <yuya@tcha.org>
parents:
diff changeset
   439
   runcommand update -C 0
f9a4a035003d test-commandserver: add stub for .t test by copying .out with 2-space indent
Yuya Nishihara <yuya@tcha.org>
parents:
diff changeset
   440
  1 files updated, 0 files merged, 2 files removed, 0 files unresolved
f9a4a035003d test-commandserver: add stub for .t test by copying .out with 2-space indent
Yuya Nishihara <yuya@tcha.org>
parents:
diff changeset
   441
  (leaving bookmark bm3)
f9a4a035003d test-commandserver: add stub for .t test by copying .out with 2-space indent
Yuya Nishihara <yuya@tcha.org>
parents:
diff changeset
   442
   runcommand commit -Am. a
f9a4a035003d test-commandserver: add stub for .t test by copying .out with 2-space indent
Yuya Nishihara <yuya@tcha.org>
parents:
diff changeset
   443
  created new head
f9a4a035003d test-commandserver: add stub for .t test by copying .out with 2-space indent
Yuya Nishihara <yuya@tcha.org>
parents:
diff changeset
   444
   runcommand log -Gq
f9a4a035003d test-commandserver: add stub for .t test by copying .out with 2-space indent
Yuya Nishihara <yuya@tcha.org>
parents:
diff changeset
   445
  @  5:731265503d86
f9a4a035003d test-commandserver: add stub for .t test by copying .out with 2-space indent
Yuya Nishihara <yuya@tcha.org>
parents:
diff changeset
   446
  |
f9a4a035003d test-commandserver: add stub for .t test by copying .out with 2-space indent
Yuya Nishihara <yuya@tcha.org>
parents:
diff changeset
   447
  | o  4:7966c8e3734d
f9a4a035003d test-commandserver: add stub for .t test by copying .out with 2-space indent
Yuya Nishihara <yuya@tcha.org>
parents:
diff changeset
   448
  | |
f9a4a035003d test-commandserver: add stub for .t test by copying .out with 2-space indent
Yuya Nishihara <yuya@tcha.org>
parents:
diff changeset
   449
  | o  3:b9b85890c400
f9a4a035003d test-commandserver: add stub for .t test by copying .out with 2-space indent
Yuya Nishihara <yuya@tcha.org>
parents:
diff changeset
   450
  | |
f9a4a035003d test-commandserver: add stub for .t test by copying .out with 2-space indent
Yuya Nishihara <yuya@tcha.org>
parents:
diff changeset
   451
  | o  2:aef17e88f5f0
f9a4a035003d test-commandserver: add stub for .t test by copying .out with 2-space indent
Yuya Nishihara <yuya@tcha.org>
parents:
diff changeset
   452
  | |
f9a4a035003d test-commandserver: add stub for .t test by copying .out with 2-space indent
Yuya Nishihara <yuya@tcha.org>
parents:
diff changeset
   453
  | o  1:d3a0a68be6de
f9a4a035003d test-commandserver: add stub for .t test by copying .out with 2-space indent
Yuya Nishihara <yuya@tcha.org>
parents:
diff changeset
   454
  |/
f9a4a035003d test-commandserver: add stub for .t test by copying .out with 2-space indent
Yuya Nishihara <yuya@tcha.org>
parents:
diff changeset
   455
  o  0:eff892de26ec
f9a4a035003d test-commandserver: add stub for .t test by copying .out with 2-space indent
Yuya Nishihara <yuya@tcha.org>
parents:
diff changeset
   456
  
f9a4a035003d test-commandserver: add stub for .t test by copying .out with 2-space indent
Yuya Nishihara <yuya@tcha.org>
parents:
diff changeset
   457
   runcommand phase -p .
f9a4a035003d test-commandserver: add stub for .t test by copying .out with 2-space indent
Yuya Nishihara <yuya@tcha.org>
parents:
diff changeset
   458
   runcommand phase .
f9a4a035003d test-commandserver: add stub for .t test by copying .out with 2-space indent
Yuya Nishihara <yuya@tcha.org>
parents:
diff changeset
   459
  5: public
f9a4a035003d test-commandserver: add stub for .t test by copying .out with 2-space indent
Yuya Nishihara <yuya@tcha.org>
parents:
diff changeset
   460
   runcommand branches
f9a4a035003d test-commandserver: add stub for .t test by copying .out with 2-space indent
Yuya Nishihara <yuya@tcha.org>
parents:
diff changeset
   461
  default                        1:731265503d86
22568
78b99149ed8a test-commandserver: port test functions from .py to .t
Yuya Nishihara <yuya@tcha.org>
parents: 22567
diff changeset
   462
78b99149ed8a test-commandserver: port test functions from .py to .t
Yuya Nishihara <yuya@tcha.org>
parents: 22567
diff changeset
   463
  $ cat <<EOF > obs.py
78b99149ed8a test-commandserver: port test functions from .py to .t
Yuya Nishihara <yuya@tcha.org>
parents: 22567
diff changeset
   464
  > import mercurial.obsolete
78b99149ed8a test-commandserver: port test functions from .py to .t
Yuya Nishihara <yuya@tcha.org>
parents: 22567
diff changeset
   465
  > mercurial.obsolete._enabled = True
78b99149ed8a test-commandserver: port test functions from .py to .t
Yuya Nishihara <yuya@tcha.org>
parents: 22567
diff changeset
   466
  > EOF
78b99149ed8a test-commandserver: port test functions from .py to .t
Yuya Nishihara <yuya@tcha.org>
parents: 22567
diff changeset
   467
  $ cat <<EOF >> .hg/hgrc
78b99149ed8a test-commandserver: port test functions from .py to .t
Yuya Nishihara <yuya@tcha.org>
parents: 22567
diff changeset
   468
  > [extensions]
78b99149ed8a test-commandserver: port test functions from .py to .t
Yuya Nishihara <yuya@tcha.org>
parents: 22567
diff changeset
   469
  > obs = obs.py
78b99149ed8a test-commandserver: port test functions from .py to .t
Yuya Nishihara <yuya@tcha.org>
parents: 22567
diff changeset
   470
  > EOF
78b99149ed8a test-commandserver: port test functions from .py to .t
Yuya Nishihara <yuya@tcha.org>
parents: 22567
diff changeset
   471
78b99149ed8a test-commandserver: port test functions from .py to .t
Yuya Nishihara <yuya@tcha.org>
parents: 22567
diff changeset
   472
  >>> import os
78b99149ed8a test-commandserver: port test functions from .py to .t
Yuya Nishihara <yuya@tcha.org>
parents: 22567
diff changeset
   473
  >>> from hgclient import readchannel, runcommand, check
78b99149ed8a test-commandserver: port test functions from .py to .t
Yuya Nishihara <yuya@tcha.org>
parents: 22567
diff changeset
   474
  >>> @check
78b99149ed8a test-commandserver: port test functions from .py to .t
Yuya Nishihara <yuya@tcha.org>
parents: 22567
diff changeset
   475
  ... def obsolete(server):
78b99149ed8a test-commandserver: port test functions from .py to .t
Yuya Nishihara <yuya@tcha.org>
parents: 22567
diff changeset
   476
  ...     readchannel(server)
78b99149ed8a test-commandserver: port test functions from .py to .t
Yuya Nishihara <yuya@tcha.org>
parents: 22567
diff changeset
   477
  ... 
78b99149ed8a test-commandserver: port test functions from .py to .t
Yuya Nishihara <yuya@tcha.org>
parents: 22567
diff changeset
   478
  ...     runcommand(server, ['up', 'null'])
78b99149ed8a test-commandserver: port test functions from .py to .t
Yuya Nishihara <yuya@tcha.org>
parents: 22567
diff changeset
   479
  ...     runcommand(server, ['phase', '-df', 'tip'])
78b99149ed8a test-commandserver: port test functions from .py to .t
Yuya Nishihara <yuya@tcha.org>
parents: 22567
diff changeset
   480
  ...     cmd = 'hg debugobsolete `hg log -r tip --template {node}`'
78b99149ed8a test-commandserver: port test functions from .py to .t
Yuya Nishihara <yuya@tcha.org>
parents: 22567
diff changeset
   481
  ...     if os.name == 'nt':
78b99149ed8a test-commandserver: port test functions from .py to .t
Yuya Nishihara <yuya@tcha.org>
parents: 22567
diff changeset
   482
  ...         cmd = 'sh -c "%s"' % cmd # run in sh, not cmd.exe
78b99149ed8a test-commandserver: port test functions from .py to .t
Yuya Nishihara <yuya@tcha.org>
parents: 22567
diff changeset
   483
  ...     os.system(cmd)
78b99149ed8a test-commandserver: port test functions from .py to .t
Yuya Nishihara <yuya@tcha.org>
parents: 22567
diff changeset
   484
  ...     runcommand(server, ['log', '--hidden'])
78b99149ed8a test-commandserver: port test functions from .py to .t
Yuya Nishihara <yuya@tcha.org>
parents: 22567
diff changeset
   485
  ...     runcommand(server, ['log'])
22567
f9a4a035003d test-commandserver: add stub for .t test by copying .out with 2-space indent
Yuya Nishihara <yuya@tcha.org>
parents:
diff changeset
   486
  
f9a4a035003d test-commandserver: add stub for .t test by copying .out with 2-space indent
Yuya Nishihara <yuya@tcha.org>
parents:
diff changeset
   487
  testing obsolete:
f9a4a035003d test-commandserver: add stub for .t test by copying .out with 2-space indent
Yuya Nishihara <yuya@tcha.org>
parents:
diff changeset
   488
  
f9a4a035003d test-commandserver: add stub for .t test by copying .out with 2-space indent
Yuya Nishihara <yuya@tcha.org>
parents:
diff changeset
   489
   runcommand up null
f9a4a035003d test-commandserver: add stub for .t test by copying .out with 2-space indent
Yuya Nishihara <yuya@tcha.org>
parents:
diff changeset
   490
  0 files updated, 0 files merged, 1 files removed, 0 files unresolved
f9a4a035003d test-commandserver: add stub for .t test by copying .out with 2-space indent
Yuya Nishihara <yuya@tcha.org>
parents:
diff changeset
   491
   runcommand phase -df tip
f9a4a035003d test-commandserver: add stub for .t test by copying .out with 2-space indent
Yuya Nishihara <yuya@tcha.org>
parents:
diff changeset
   492
   runcommand log --hidden
f9a4a035003d test-commandserver: add stub for .t test by copying .out with 2-space indent
Yuya Nishihara <yuya@tcha.org>
parents:
diff changeset
   493
  changeset:   1:731265503d86
f9a4a035003d test-commandserver: add stub for .t test by copying .out with 2-space indent
Yuya Nishihara <yuya@tcha.org>
parents:
diff changeset
   494
  tag:         tip
f9a4a035003d test-commandserver: add stub for .t test by copying .out with 2-space indent
Yuya Nishihara <yuya@tcha.org>
parents:
diff changeset
   495
  user:        test
f9a4a035003d test-commandserver: add stub for .t test by copying .out with 2-space indent
Yuya Nishihara <yuya@tcha.org>
parents:
diff changeset
   496
  date:        Thu Jan 01 00:00:00 1970 +0000
f9a4a035003d test-commandserver: add stub for .t test by copying .out with 2-space indent
Yuya Nishihara <yuya@tcha.org>
parents:
diff changeset
   497
  summary:     .
f9a4a035003d test-commandserver: add stub for .t test by copying .out with 2-space indent
Yuya Nishihara <yuya@tcha.org>
parents:
diff changeset
   498
  
f9a4a035003d test-commandserver: add stub for .t test by copying .out with 2-space indent
Yuya Nishihara <yuya@tcha.org>
parents:
diff changeset
   499
  changeset:   0:eff892de26ec
f9a4a035003d test-commandserver: add stub for .t test by copying .out with 2-space indent
Yuya Nishihara <yuya@tcha.org>
parents:
diff changeset
   500
  bookmark:    bm1
f9a4a035003d test-commandserver: add stub for .t test by copying .out with 2-space indent
Yuya Nishihara <yuya@tcha.org>
parents:
diff changeset
   501
  bookmark:    bm2
f9a4a035003d test-commandserver: add stub for .t test by copying .out with 2-space indent
Yuya Nishihara <yuya@tcha.org>
parents:
diff changeset
   502
  bookmark:    bm3
f9a4a035003d test-commandserver: add stub for .t test by copying .out with 2-space indent
Yuya Nishihara <yuya@tcha.org>
parents:
diff changeset
   503
  user:        test
f9a4a035003d test-commandserver: add stub for .t test by copying .out with 2-space indent
Yuya Nishihara <yuya@tcha.org>
parents:
diff changeset
   504
  date:        Thu Jan 01 00:00:00 1970 +0000
f9a4a035003d test-commandserver: add stub for .t test by copying .out with 2-space indent
Yuya Nishihara <yuya@tcha.org>
parents:
diff changeset
   505
  summary:     1
f9a4a035003d test-commandserver: add stub for .t test by copying .out with 2-space indent
Yuya Nishihara <yuya@tcha.org>
parents:
diff changeset
   506
  
f9a4a035003d test-commandserver: add stub for .t test by copying .out with 2-space indent
Yuya Nishihara <yuya@tcha.org>
parents:
diff changeset
   507
   runcommand log
f9a4a035003d test-commandserver: add stub for .t test by copying .out with 2-space indent
Yuya Nishihara <yuya@tcha.org>
parents:
diff changeset
   508
  changeset:   0:eff892de26ec
f9a4a035003d test-commandserver: add stub for .t test by copying .out with 2-space indent
Yuya Nishihara <yuya@tcha.org>
parents:
diff changeset
   509
  bookmark:    bm1
f9a4a035003d test-commandserver: add stub for .t test by copying .out with 2-space indent
Yuya Nishihara <yuya@tcha.org>
parents:
diff changeset
   510
  bookmark:    bm2
f9a4a035003d test-commandserver: add stub for .t test by copying .out with 2-space indent
Yuya Nishihara <yuya@tcha.org>
parents:
diff changeset
   511
  bookmark:    bm3
f9a4a035003d test-commandserver: add stub for .t test by copying .out with 2-space indent
Yuya Nishihara <yuya@tcha.org>
parents:
diff changeset
   512
  tag:         tip
f9a4a035003d test-commandserver: add stub for .t test by copying .out with 2-space indent
Yuya Nishihara <yuya@tcha.org>
parents:
diff changeset
   513
  user:        test
f9a4a035003d test-commandserver: add stub for .t test by copying .out with 2-space indent
Yuya Nishihara <yuya@tcha.org>
parents:
diff changeset
   514
  date:        Thu Jan 01 00:00:00 1970 +0000
f9a4a035003d test-commandserver: add stub for .t test by copying .out with 2-space indent
Yuya Nishihara <yuya@tcha.org>
parents:
diff changeset
   515
  summary:     1
f9a4a035003d test-commandserver: add stub for .t test by copying .out with 2-space indent
Yuya Nishihara <yuya@tcha.org>
parents:
diff changeset
   516
  
22568
78b99149ed8a test-commandserver: port test functions from .py to .t
Yuya Nishihara <yuya@tcha.org>
parents: 22567
diff changeset
   517
78b99149ed8a test-commandserver: port test functions from .py to .t
Yuya Nishihara <yuya@tcha.org>
parents: 22567
diff changeset
   518
  $ cat <<EOF >> .hg/hgrc
78b99149ed8a test-commandserver: port test functions from .py to .t
Yuya Nishihara <yuya@tcha.org>
parents: 22567
diff changeset
   519
  > [extensions]
78b99149ed8a test-commandserver: port test functions from .py to .t
Yuya Nishihara <yuya@tcha.org>
parents: 22567
diff changeset
   520
  > mq =
78b99149ed8a test-commandserver: port test functions from .py to .t
Yuya Nishihara <yuya@tcha.org>
parents: 22567
diff changeset
   521
  > EOF
78b99149ed8a test-commandserver: port test functions from .py to .t
Yuya Nishihara <yuya@tcha.org>
parents: 22567
diff changeset
   522
78b99149ed8a test-commandserver: port test functions from .py to .t
Yuya Nishihara <yuya@tcha.org>
parents: 22567
diff changeset
   523
  >>> import os
78b99149ed8a test-commandserver: port test functions from .py to .t
Yuya Nishihara <yuya@tcha.org>
parents: 22567
diff changeset
   524
  >>> from hgclient import readchannel, runcommand, check
78b99149ed8a test-commandserver: port test functions from .py to .t
Yuya Nishihara <yuya@tcha.org>
parents: 22567
diff changeset
   525
  >>> @check
78b99149ed8a test-commandserver: port test functions from .py to .t
Yuya Nishihara <yuya@tcha.org>
parents: 22567
diff changeset
   526
  ... def mqoutsidechanges(server):
78b99149ed8a test-commandserver: port test functions from .py to .t
Yuya Nishihara <yuya@tcha.org>
parents: 22567
diff changeset
   527
  ...     readchannel(server)
78b99149ed8a test-commandserver: port test functions from .py to .t
Yuya Nishihara <yuya@tcha.org>
parents: 22567
diff changeset
   528
  ... 
78b99149ed8a test-commandserver: port test functions from .py to .t
Yuya Nishihara <yuya@tcha.org>
parents: 22567
diff changeset
   529
  ...     # load repo.mq
78b99149ed8a test-commandserver: port test functions from .py to .t
Yuya Nishihara <yuya@tcha.org>
parents: 22567
diff changeset
   530
  ...     runcommand(server, ['qapplied'])
78b99149ed8a test-commandserver: port test functions from .py to .t
Yuya Nishihara <yuya@tcha.org>
parents: 22567
diff changeset
   531
  ...     os.system('hg qnew 0.diff')
78b99149ed8a test-commandserver: port test functions from .py to .t
Yuya Nishihara <yuya@tcha.org>
parents: 22567
diff changeset
   532
  ...     # repo.mq should be invalidated
78b99149ed8a test-commandserver: port test functions from .py to .t
Yuya Nishihara <yuya@tcha.org>
parents: 22567
diff changeset
   533
  ...     runcommand(server, ['qapplied'])
78b99149ed8a test-commandserver: port test functions from .py to .t
Yuya Nishihara <yuya@tcha.org>
parents: 22567
diff changeset
   534
  ... 
78b99149ed8a test-commandserver: port test functions from .py to .t
Yuya Nishihara <yuya@tcha.org>
parents: 22567
diff changeset
   535
  ...     runcommand(server, ['qpop', '--all'])
78b99149ed8a test-commandserver: port test functions from .py to .t
Yuya Nishihara <yuya@tcha.org>
parents: 22567
diff changeset
   536
  ...     os.system('hg qqueue --create foo')
78b99149ed8a test-commandserver: port test functions from .py to .t
Yuya Nishihara <yuya@tcha.org>
parents: 22567
diff changeset
   537
  ...     # repo.mq should be recreated to point to new queue
78b99149ed8a test-commandserver: port test functions from .py to .t
Yuya Nishihara <yuya@tcha.org>
parents: 22567
diff changeset
   538
  ...     runcommand(server, ['qqueue', '--active'])
22567
f9a4a035003d test-commandserver: add stub for .t test by copying .out with 2-space indent
Yuya Nishihara <yuya@tcha.org>
parents:
diff changeset
   539
  
f9a4a035003d test-commandserver: add stub for .t test by copying .out with 2-space indent
Yuya Nishihara <yuya@tcha.org>
parents:
diff changeset
   540
  testing mqoutsidechanges:
f9a4a035003d test-commandserver: add stub for .t test by copying .out with 2-space indent
Yuya Nishihara <yuya@tcha.org>
parents:
diff changeset
   541
  
f9a4a035003d test-commandserver: add stub for .t test by copying .out with 2-space indent
Yuya Nishihara <yuya@tcha.org>
parents:
diff changeset
   542
   runcommand qapplied
f9a4a035003d test-commandserver: add stub for .t test by copying .out with 2-space indent
Yuya Nishihara <yuya@tcha.org>
parents:
diff changeset
   543
   runcommand qapplied
f9a4a035003d test-commandserver: add stub for .t test by copying .out with 2-space indent
Yuya Nishihara <yuya@tcha.org>
parents:
diff changeset
   544
  0.diff
f9a4a035003d test-commandserver: add stub for .t test by copying .out with 2-space indent
Yuya Nishihara <yuya@tcha.org>
parents:
diff changeset
   545
   runcommand qpop --all
f9a4a035003d test-commandserver: add stub for .t test by copying .out with 2-space indent
Yuya Nishihara <yuya@tcha.org>
parents:
diff changeset
   546
  popping 0.diff
f9a4a035003d test-commandserver: add stub for .t test by copying .out with 2-space indent
Yuya Nishihara <yuya@tcha.org>
parents:
diff changeset
   547
  patch queue now empty
f9a4a035003d test-commandserver: add stub for .t test by copying .out with 2-space indent
Yuya Nishihara <yuya@tcha.org>
parents:
diff changeset
   548
   runcommand qqueue --active
f9a4a035003d test-commandserver: add stub for .t test by copying .out with 2-space indent
Yuya Nishihara <yuya@tcha.org>
parents:
diff changeset
   549
  foo
22568
78b99149ed8a test-commandserver: port test functions from .py to .t
Yuya Nishihara <yuya@tcha.org>
parents: 22567
diff changeset
   550
78b99149ed8a test-commandserver: port test functions from .py to .t
Yuya Nishihara <yuya@tcha.org>
parents: 22567
diff changeset
   551
  $ cat <<EOF > dbgui.py
78b99149ed8a test-commandserver: port test functions from .py to .t
Yuya Nishihara <yuya@tcha.org>
parents: 22567
diff changeset
   552
  > from mercurial import cmdutil, commands
78b99149ed8a test-commandserver: port test functions from .py to .t
Yuya Nishihara <yuya@tcha.org>
parents: 22567
diff changeset
   553
  > cmdtable = {}
78b99149ed8a test-commandserver: port test functions from .py to .t
Yuya Nishihara <yuya@tcha.org>
parents: 22567
diff changeset
   554
  > command = cmdutil.command(cmdtable)
78b99149ed8a test-commandserver: port test functions from .py to .t
Yuya Nishihara <yuya@tcha.org>
parents: 22567
diff changeset
   555
  > @command("debuggetpass", norepo=True)
78b99149ed8a test-commandserver: port test functions from .py to .t
Yuya Nishihara <yuya@tcha.org>
parents: 22567
diff changeset
   556
  > def debuggetpass(ui):
78b99149ed8a test-commandserver: port test functions from .py to .t
Yuya Nishihara <yuya@tcha.org>
parents: 22567
diff changeset
   557
  >     ui.write("%s\\n" % ui.getpass())
78b99149ed8a test-commandserver: port test functions from .py to .t
Yuya Nishihara <yuya@tcha.org>
parents: 22567
diff changeset
   558
  > EOF
78b99149ed8a test-commandserver: port test functions from .py to .t
Yuya Nishihara <yuya@tcha.org>
parents: 22567
diff changeset
   559
  $ cat <<EOF >> .hg/hgrc
78b99149ed8a test-commandserver: port test functions from .py to .t
Yuya Nishihara <yuya@tcha.org>
parents: 22567
diff changeset
   560
  > [extensions]
78b99149ed8a test-commandserver: port test functions from .py to .t
Yuya Nishihara <yuya@tcha.org>
parents: 22567
diff changeset
   561
  > dbgui = dbgui.py
78b99149ed8a test-commandserver: port test functions from .py to .t
Yuya Nishihara <yuya@tcha.org>
parents: 22567
diff changeset
   562
  > EOF
78b99149ed8a test-commandserver: port test functions from .py to .t
Yuya Nishihara <yuya@tcha.org>
parents: 22567
diff changeset
   563
78b99149ed8a test-commandserver: port test functions from .py to .t
Yuya Nishihara <yuya@tcha.org>
parents: 22567
diff changeset
   564
  >>> import cStringIO
78b99149ed8a test-commandserver: port test functions from .py to .t
Yuya Nishihara <yuya@tcha.org>
parents: 22567
diff changeset
   565
  >>> from hgclient import readchannel, runcommand, check
78b99149ed8a test-commandserver: port test functions from .py to .t
Yuya Nishihara <yuya@tcha.org>
parents: 22567
diff changeset
   566
  >>> @check
78b99149ed8a test-commandserver: port test functions from .py to .t
Yuya Nishihara <yuya@tcha.org>
parents: 22567
diff changeset
   567
  ... def getpass(server):
78b99149ed8a test-commandserver: port test functions from .py to .t
Yuya Nishihara <yuya@tcha.org>
parents: 22567
diff changeset
   568
  ...     readchannel(server)
78b99149ed8a test-commandserver: port test functions from .py to .t
Yuya Nishihara <yuya@tcha.org>
parents: 22567
diff changeset
   569
  ...     runcommand(server, ['debuggetpass', '--config',
78b99149ed8a test-commandserver: port test functions from .py to .t
Yuya Nishihara <yuya@tcha.org>
parents: 22567
diff changeset
   570
  ...                         'ui.interactive=True'],
78b99149ed8a test-commandserver: port test functions from .py to .t
Yuya Nishihara <yuya@tcha.org>
parents: 22567
diff changeset
   571
  ...                input=cStringIO.StringIO('1234\n'))
22567
f9a4a035003d test-commandserver: add stub for .t test by copying .out with 2-space indent
Yuya Nishihara <yuya@tcha.org>
parents:
diff changeset
   572
  
f9a4a035003d test-commandserver: add stub for .t test by copying .out with 2-space indent
Yuya Nishihara <yuya@tcha.org>
parents:
diff changeset
   573
  testing getpass:
f9a4a035003d test-commandserver: add stub for .t test by copying .out with 2-space indent
Yuya Nishihara <yuya@tcha.org>
parents:
diff changeset
   574
  
f9a4a035003d test-commandserver: add stub for .t test by copying .out with 2-space indent
Yuya Nishihara <yuya@tcha.org>
parents:
diff changeset
   575
   runcommand debuggetpass --config ui.interactive=True
f9a4a035003d test-commandserver: add stub for .t test by copying .out with 2-space indent
Yuya Nishihara <yuya@tcha.org>
parents:
diff changeset
   576
  password: 1234
22568
78b99149ed8a test-commandserver: port test functions from .py to .t
Yuya Nishihara <yuya@tcha.org>
parents: 22567
diff changeset
   577
78b99149ed8a test-commandserver: port test functions from .py to .t
Yuya Nishihara <yuya@tcha.org>
parents: 22567
diff changeset
   578
78b99149ed8a test-commandserver: port test functions from .py to .t
Yuya Nishihara <yuya@tcha.org>
parents: 22567
diff changeset
   579
start without repository:
78b99149ed8a test-commandserver: port test functions from .py to .t
Yuya Nishihara <yuya@tcha.org>
parents: 22567
diff changeset
   580
78b99149ed8a test-commandserver: port test functions from .py to .t
Yuya Nishihara <yuya@tcha.org>
parents: 22567
diff changeset
   581
  $ cd ..
78b99149ed8a test-commandserver: port test functions from .py to .t
Yuya Nishihara <yuya@tcha.org>
parents: 22567
diff changeset
   582
78b99149ed8a test-commandserver: port test functions from .py to .t
Yuya Nishihara <yuya@tcha.org>
parents: 22567
diff changeset
   583
  >>> import re
78b99149ed8a test-commandserver: port test functions from .py to .t
Yuya Nishihara <yuya@tcha.org>
parents: 22567
diff changeset
   584
  >>> from hgclient import readchannel, runcommand, check
78b99149ed8a test-commandserver: port test functions from .py to .t
Yuya Nishihara <yuya@tcha.org>
parents: 22567
diff changeset
   585
  >>> @check
78b99149ed8a test-commandserver: port test functions from .py to .t
Yuya Nishihara <yuya@tcha.org>
parents: 22567
diff changeset
   586
  ... def hellomessage(server):
78b99149ed8a test-commandserver: port test functions from .py to .t
Yuya Nishihara <yuya@tcha.org>
parents: 22567
diff changeset
   587
  ...     ch, data = readchannel(server)
78b99149ed8a test-commandserver: port test functions from .py to .t
Yuya Nishihara <yuya@tcha.org>
parents: 22567
diff changeset
   588
  ...     # escaping python tests output not supported
78b99149ed8a test-commandserver: port test functions from .py to .t
Yuya Nishihara <yuya@tcha.org>
parents: 22567
diff changeset
   589
  ...     print '%c, %r' % (ch, re.sub('encoding: [a-zA-Z0-9-]+',
78b99149ed8a test-commandserver: port test functions from .py to .t
Yuya Nishihara <yuya@tcha.org>
parents: 22567
diff changeset
   590
  ...                                  'encoding: ***', data))
78b99149ed8a test-commandserver: port test functions from .py to .t
Yuya Nishihara <yuya@tcha.org>
parents: 22567
diff changeset
   591
  ... 
78b99149ed8a test-commandserver: port test functions from .py to .t
Yuya Nishihara <yuya@tcha.org>
parents: 22567
diff changeset
   592
  ...     # run an arbitrary command to make sure the next thing the server
78b99149ed8a test-commandserver: port test functions from .py to .t
Yuya Nishihara <yuya@tcha.org>
parents: 22567
diff changeset
   593
  ...     # sends isn't part of the hello message
78b99149ed8a test-commandserver: port test functions from .py to .t
Yuya Nishihara <yuya@tcha.org>
parents: 22567
diff changeset
   594
  ...     runcommand(server, ['id'])
22567
f9a4a035003d test-commandserver: add stub for .t test by copying .out with 2-space indent
Yuya Nishihara <yuya@tcha.org>
parents:
diff changeset
   595
  
f9a4a035003d test-commandserver: add stub for .t test by copying .out with 2-space indent
Yuya Nishihara <yuya@tcha.org>
parents:
diff changeset
   596
  testing hellomessage:
f9a4a035003d test-commandserver: add stub for .t test by copying .out with 2-space indent
Yuya Nishihara <yuya@tcha.org>
parents:
diff changeset
   597
  
f9a4a035003d test-commandserver: add stub for .t test by copying .out with 2-space indent
Yuya Nishihara <yuya@tcha.org>
parents:
diff changeset
   598
  o, 'capabilities: getencoding runcommand\nencoding: ***'
f9a4a035003d test-commandserver: add stub for .t test by copying .out with 2-space indent
Yuya Nishihara <yuya@tcha.org>
parents:
diff changeset
   599
   runcommand id
f9a4a035003d test-commandserver: add stub for .t test by copying .out with 2-space indent
Yuya Nishihara <yuya@tcha.org>
parents:
diff changeset
   600
  abort: there is no Mercurial repository here (.hg not found)
f9a4a035003d test-commandserver: add stub for .t test by copying .out with 2-space indent
Yuya Nishihara <yuya@tcha.org>
parents:
diff changeset
   601
   [255]
22568
78b99149ed8a test-commandserver: port test functions from .py to .t
Yuya Nishihara <yuya@tcha.org>
parents: 22567
diff changeset
   602
78b99149ed8a test-commandserver: port test functions from .py to .t
Yuya Nishihara <yuya@tcha.org>
parents: 22567
diff changeset
   603
  >>> from hgclient import readchannel, runcommand, check
78b99149ed8a test-commandserver: port test functions from .py to .t
Yuya Nishihara <yuya@tcha.org>
parents: 22567
diff changeset
   604
  >>> @check
78b99149ed8a test-commandserver: port test functions from .py to .t
Yuya Nishihara <yuya@tcha.org>
parents: 22567
diff changeset
   605
  ... def startwithoutrepo(server):
78b99149ed8a test-commandserver: port test functions from .py to .t
Yuya Nishihara <yuya@tcha.org>
parents: 22567
diff changeset
   606
  ...     readchannel(server)
78b99149ed8a test-commandserver: port test functions from .py to .t
Yuya Nishihara <yuya@tcha.org>
parents: 22567
diff changeset
   607
  ...     runcommand(server, ['init', 'repo2'])
78b99149ed8a test-commandserver: port test functions from .py to .t
Yuya Nishihara <yuya@tcha.org>
parents: 22567
diff changeset
   608
  ...     runcommand(server, ['id', '-R', 'repo2'])
22567
f9a4a035003d test-commandserver: add stub for .t test by copying .out with 2-space indent
Yuya Nishihara <yuya@tcha.org>
parents:
diff changeset
   609
  
f9a4a035003d test-commandserver: add stub for .t test by copying .out with 2-space indent
Yuya Nishihara <yuya@tcha.org>
parents:
diff changeset
   610
  testing startwithoutrepo:
f9a4a035003d test-commandserver: add stub for .t test by copying .out with 2-space indent
Yuya Nishihara <yuya@tcha.org>
parents:
diff changeset
   611
  
f9a4a035003d test-commandserver: add stub for .t test by copying .out with 2-space indent
Yuya Nishihara <yuya@tcha.org>
parents:
diff changeset
   612
   runcommand init repo2
f9a4a035003d test-commandserver: add stub for .t test by copying .out with 2-space indent
Yuya Nishihara <yuya@tcha.org>
parents:
diff changeset
   613
   runcommand id -R repo2
f9a4a035003d test-commandserver: add stub for .t test by copying .out with 2-space indent
Yuya Nishihara <yuya@tcha.org>
parents:
diff changeset
   614
  000000000000 tip