tests/test-commandserver.t
author Martin von Zweigbergk <martinvonz@google.com>
Sat, 31 Mar 2018 23:37:25 -0700
changeset 37251 7c0f40f4f7bf
parent 37220 7f78de1c93aa
child 37427 6282c1965f8e
permissions -rw-r--r--
scmutil: introduce deprecated alias for revpair() revsingle() returns a context object, revpair() returns nodeids, revrange() returns integer revisions (in a revset). I'm going to reduce this inconsistency by making revpair() return context objects. Changing the return type is not nice to extensions, so this patch introduces a nodeid-returning version of revpair() that they can detect and use. Update callers to the new function so we can change revpair() itself and then migrate them back one by one. Differential Revision: https://phab.mercurial-scm.org/D3005
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
23053
5ba11ab48fcf ui: separate option to show prompt echo, enabled only in tests (issue4417)
Yuya Nishihara <yuya@tcha.org>
parents: 23036
diff changeset
     8
typical client does not want echo-back messages, so test without it:
5ba11ab48fcf ui: separate option to show prompt echo, enabled only in tests (issue4417)
Yuya Nishihara <yuya@tcha.org>
parents: 23036
diff changeset
     9
5ba11ab48fcf ui: separate option to show prompt echo, enabled only in tests (issue4417)
Yuya Nishihara <yuya@tcha.org>
parents: 23036
diff changeset
    10
  $ grep -v '^promptecho ' < $HGRCPATH >> $HGRCPATH.new
5ba11ab48fcf ui: separate option to show prompt echo, enabled only in tests (issue4417)
Yuya Nishihara <yuya@tcha.org>
parents: 23036
diff changeset
    11
  $ mv $HGRCPATH.new $HGRCPATH
5ba11ab48fcf ui: separate option to show prompt echo, enabled only in tests (issue4417)
Yuya Nishihara <yuya@tcha.org>
parents: 23036
diff changeset
    12
22568
78b99149ed8a test-commandserver: port test functions from .py to .t
Yuya Nishihara <yuya@tcha.org>
parents: 22567
diff changeset
    13
  $ hg init repo
78b99149ed8a test-commandserver: port test functions from .py to .t
Yuya Nishihara <yuya@tcha.org>
parents: 22567
diff changeset
    14
  $ cd repo
78b99149ed8a test-commandserver: port test functions from .py to .t
Yuya Nishihara <yuya@tcha.org>
parents: 22567
diff changeset
    15
33922
1a6707b43d05 tests: update test-commandserver to pass our import checker
Augie Fackler <raf@durin42.com>
parents: 33921
diff changeset
    16
  >>> from __future__ import absolute_import, print_function
1a6707b43d05 tests: update test-commandserver to pass our import checker
Augie Fackler <raf@durin42.com>
parents: 33921
diff changeset
    17
  >>> import os
1a6707b43d05 tests: update test-commandserver to pass our import checker
Augie Fackler <raf@durin42.com>
parents: 33921
diff changeset
    18
  >>> import sys
1a6707b43d05 tests: update test-commandserver to pass our import checker
Augie Fackler <raf@durin42.com>
parents: 33921
diff changeset
    19
  >>> from hgclient import check, readchannel, runcommand
22568
78b99149ed8a test-commandserver: port test functions from .py to .t
Yuya Nishihara <yuya@tcha.org>
parents: 22567
diff changeset
    20
  >>> @check
78b99149ed8a test-commandserver: port test functions from .py to .t
Yuya Nishihara <yuya@tcha.org>
parents: 22567
diff changeset
    21
  ... def hellomessage(server):
78b99149ed8a test-commandserver: port test functions from .py to .t
Yuya Nishihara <yuya@tcha.org>
parents: 22567
diff changeset
    22
  ...     ch, data = readchannel(server)
29485
6a98f9408a50 py3: make files use absolute_import and print_function
Pulkit Goyal <7895pulkit@gmail.com>
parents: 28996
diff changeset
    23
  ...     print('%c, %r' % (ch, data))
22568
78b99149ed8a test-commandserver: port test functions from .py to .t
Yuya Nishihara <yuya@tcha.org>
parents: 22567
diff changeset
    24
  ...     # 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
    25
  ...     # 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
    26
  ...     runcommand(server, ['id'])
23036
19f5273c9f3e cmdserver: include pid of server handling requests in hello message
Yuya Nishihara <yuya@tcha.org>
parents: 22994
diff changeset
    27
  o, 'capabilities: getencoding runcommand\nencoding: *\npid: *' (glob)
22572
cc3d9f776632 test-commandserver: make runcommand message bolder
Yuya Nishihara <yuya@tcha.org>
parents: 22571
diff changeset
    28
  *** runcommand 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
    29
  000000000000 tip
22568
78b99149ed8a test-commandserver: port test functions from .py to .t
Yuya Nishihara <yuya@tcha.org>
parents: 22567
diff changeset
    30
78b99149ed8a test-commandserver: port test functions from .py to .t
Yuya Nishihara <yuya@tcha.org>
parents: 22567
diff changeset
    31
  >>> from hgclient import check
78b99149ed8a test-commandserver: port test functions from .py to .t
Yuya Nishihara <yuya@tcha.org>
parents: 22567
diff changeset
    32
  >>> @check
78b99149ed8a test-commandserver: port test functions from .py to .t
Yuya Nishihara <yuya@tcha.org>
parents: 22567
diff changeset
    33
  ... def unknowncommand(server):
78b99149ed8a test-commandserver: port test functions from .py to .t
Yuya Nishihara <yuya@tcha.org>
parents: 22567
diff changeset
    34
  ...     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
    35
  abort: unknown command unknowncommand
22568
78b99149ed8a test-commandserver: port test functions from .py to .t
Yuya Nishihara <yuya@tcha.org>
parents: 22567
diff changeset
    36
33922
1a6707b43d05 tests: update test-commandserver to pass our import checker
Augie Fackler <raf@durin42.com>
parents: 33921
diff changeset
    37
  >>> from hgclient import check, readchannel, runcommand
22568
78b99149ed8a test-commandserver: port test functions from .py to .t
Yuya Nishihara <yuya@tcha.org>
parents: 22567
diff changeset
    38
  >>> @check
78b99149ed8a test-commandserver: port test functions from .py to .t
Yuya Nishihara <yuya@tcha.org>
parents: 22567
diff changeset
    39
  ... def checkruncommand(server):
78b99149ed8a test-commandserver: port test functions from .py to .t
Yuya Nishihara <yuya@tcha.org>
parents: 22567
diff changeset
    40
  ...     # hello block
78b99149ed8a test-commandserver: port test functions from .py to .t
Yuya Nishihara <yuya@tcha.org>
parents: 22567
diff changeset
    41
  ...     readchannel(server)
78b99149ed8a test-commandserver: port test functions from .py to .t
Yuya Nishihara <yuya@tcha.org>
parents: 22567
diff changeset
    42
  ... 
78b99149ed8a test-commandserver: port test functions from .py to .t
Yuya Nishihara <yuya@tcha.org>
parents: 22567
diff changeset
    43
  ...     # no args
78b99149ed8a test-commandserver: port test functions from .py to .t
Yuya Nishihara <yuya@tcha.org>
parents: 22567
diff changeset
    44
  ...     runcommand(server, [])
78b99149ed8a test-commandserver: port test functions from .py to .t
Yuya Nishihara <yuya@tcha.org>
parents: 22567
diff changeset
    45
  ... 
78b99149ed8a test-commandserver: port test functions from .py to .t
Yuya Nishihara <yuya@tcha.org>
parents: 22567
diff changeset
    46
  ...     # global options
78b99149ed8a test-commandserver: port test functions from .py to .t
Yuya Nishihara <yuya@tcha.org>
parents: 22567
diff changeset
    47
  ...     runcommand(server, ['id', '--quiet'])
78b99149ed8a test-commandserver: port test functions from .py to .t
Yuya Nishihara <yuya@tcha.org>
parents: 22567
diff changeset
    48
  ... 
78b99149ed8a test-commandserver: port test functions from .py to .t
Yuya Nishihara <yuya@tcha.org>
parents: 22567
diff changeset
    49
  ...     # 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
    50
  ...     runcommand(server, ['id'])
78b99149ed8a test-commandserver: port test functions from .py to .t
Yuya Nishihara <yuya@tcha.org>
parents: 22567
diff changeset
    51
  ... 
78b99149ed8a test-commandserver: port test functions from .py to .t
Yuya Nishihara <yuya@tcha.org>
parents: 22567
diff changeset
    52
  ...     # --config
78b99149ed8a test-commandserver: port test functions from .py to .t
Yuya Nishihara <yuya@tcha.org>
parents: 22567
diff changeset
    53
  ...     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
    54
  ... 
78b99149ed8a test-commandserver: port test functions from .py to .t
Yuya Nishihara <yuya@tcha.org>
parents: 22567
diff changeset
    55
  ...     # 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
    56
  ...     runcommand(server, ['id'])
78b99149ed8a test-commandserver: port test functions from .py to .t
Yuya Nishihara <yuya@tcha.org>
parents: 22567
diff changeset
    57
  ... 
78b99149ed8a test-commandserver: port test functions from .py to .t
Yuya Nishihara <yuya@tcha.org>
parents: 22567
diff changeset
    58
  ...     # 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
    59
  ...     runcommand(server, ['id', '-runknown'])
22572
cc3d9f776632 test-commandserver: make runcommand message bolder
Yuya Nishihara <yuya@tcha.org>
parents: 22571
diff changeset
    60
  *** runcommand 
22567
f9a4a035003d test-commandserver: add stub for .t test by copying .out with 2-space indent
Yuya Nishihara <yuya@tcha.org>
parents:
diff changeset
    61
  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
    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
  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
    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
   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
    66
   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
    67
   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
    68
   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
    69
   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
    70
   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
    71
   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
    72
   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
    73
   log           show revision history of entire repository or files
23400
3bd577a3283e merge: be precise about what merged into what in short desc
anatoly techtonik <techtonik@gmail.com>
parents: 23095
diff changeset
    74
   merge         merge another revision into working directory
22567
f9a4a035003d test-commandserver: add stub for .t test by copying .out with 2-space indent
Yuya Nishihara <yuya@tcha.org>
parents:
diff changeset
    75
   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
    76
   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
    77
   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
    78
   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
    79
   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
    80
   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
    81
   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
    82
  
29974
7109d5ddeb0c help: use single quotes in use warning
timeless <timeless@mozdev.org>
parents: 29485
diff changeset
    83
  (use 'hg help' for the full list of commands or 'hg -v' for details)
22572
cc3d9f776632 test-commandserver: make runcommand message bolder
Yuya Nishihara <yuya@tcha.org>
parents: 22571
diff changeset
    84
  *** runcommand id --quiet
22567
f9a4a035003d test-commandserver: add stub for .t test by copying .out with 2-space indent
Yuya Nishihara <yuya@tcha.org>
parents:
diff changeset
    85
  000000000000
22572
cc3d9f776632 test-commandserver: make runcommand message bolder
Yuya Nishihara <yuya@tcha.org>
parents: 22571
diff changeset
    86
  *** runcommand 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
    87
  000000000000 tip
22572
cc3d9f776632 test-commandserver: make runcommand message bolder
Yuya Nishihara <yuya@tcha.org>
parents: 22571
diff changeset
    88
  *** runcommand id --config ui.quiet=True
22567
f9a4a035003d test-commandserver: add stub for .t test by copying .out with 2-space indent
Yuya Nishihara <yuya@tcha.org>
parents:
diff changeset
    89
  000000000000
22572
cc3d9f776632 test-commandserver: make runcommand message bolder
Yuya Nishihara <yuya@tcha.org>
parents: 22571
diff changeset
    90
  *** runcommand 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
    91
  000000000000 tip
22572
cc3d9f776632 test-commandserver: make runcommand message bolder
Yuya Nishihara <yuya@tcha.org>
parents: 22571
diff changeset
    92
  *** runcommand 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
    93
  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
    94
   [255]
22568
78b99149ed8a test-commandserver: port test functions from .py to .t
Yuya Nishihara <yuya@tcha.org>
parents: 22567
diff changeset
    95
33922
1a6707b43d05 tests: update test-commandserver to pass our import checker
Augie Fackler <raf@durin42.com>
parents: 33921
diff changeset
    96
  >>> from hgclient import check, readchannel
22568
78b99149ed8a test-commandserver: port test functions from .py to .t
Yuya Nishihara <yuya@tcha.org>
parents: 22567
diff changeset
    97
  >>> @check
78b99149ed8a test-commandserver: port test functions from .py to .t
Yuya Nishihara <yuya@tcha.org>
parents: 22567
diff changeset
    98
  ... def inputeof(server):
78b99149ed8a test-commandserver: port test functions from .py to .t
Yuya Nishihara <yuya@tcha.org>
parents: 22567
diff changeset
    99
  ...     readchannel(server)
78b99149ed8a test-commandserver: port test functions from .py to .t
Yuya Nishihara <yuya@tcha.org>
parents: 22567
diff changeset
   100
  ...     server.stdin.write('runcommand\n')
78b99149ed8a test-commandserver: port test functions from .py to .t
Yuya Nishihara <yuya@tcha.org>
parents: 22567
diff changeset
   101
  ...     # 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
   102
  ...     server.stdin.close()
78b99149ed8a test-commandserver: port test functions from .py to .t
Yuya Nishihara <yuya@tcha.org>
parents: 22567
diff changeset
   103
  ... 
78b99149ed8a test-commandserver: port test functions from .py to .t
Yuya Nishihara <yuya@tcha.org>
parents: 22567
diff changeset
   104
  ...     # server exits with 1 if the pipe closed while reading the command
29485
6a98f9408a50 py3: make files use absolute_import and print_function
Pulkit Goyal <7895pulkit@gmail.com>
parents: 28996
diff changeset
   105
  ...     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
   106
  server exit code = 1
22568
78b99149ed8a test-commandserver: port test functions from .py to .t
Yuya Nishihara <yuya@tcha.org>
parents: 22567
diff changeset
   107
33922
1a6707b43d05 tests: update test-commandserver to pass our import checker
Augie Fackler <raf@durin42.com>
parents: 33921
diff changeset
   108
  >>> from hgclient import check, readchannel, runcommand, stringio
22568
78b99149ed8a test-commandserver: port test functions from .py to .t
Yuya Nishihara <yuya@tcha.org>
parents: 22567
diff changeset
   109
  >>> @check
78b99149ed8a test-commandserver: port test functions from .py to .t
Yuya Nishihara <yuya@tcha.org>
parents: 22567
diff changeset
   110
  ... def serverinput(server):
78b99149ed8a test-commandserver: port test functions from .py to .t
Yuya Nishihara <yuya@tcha.org>
parents: 22567
diff changeset
   111
  ...     readchannel(server)
78b99149ed8a test-commandserver: port test functions from .py to .t
Yuya Nishihara <yuya@tcha.org>
parents: 22567
diff changeset
   112
  ... 
78b99149ed8a test-commandserver: port test functions from .py to .t
Yuya Nishihara <yuya@tcha.org>
parents: 22567
diff changeset
   113
  ...     patch = """
78b99149ed8a test-commandserver: port test functions from .py to .t
Yuya Nishihara <yuya@tcha.org>
parents: 22567
diff changeset
   114
  ... # HG changeset patch
78b99149ed8a test-commandserver: port test functions from .py to .t
Yuya Nishihara <yuya@tcha.org>
parents: 22567
diff changeset
   115
  ... # User test
78b99149ed8a test-commandserver: port test functions from .py to .t
Yuya Nishihara <yuya@tcha.org>
parents: 22567
diff changeset
   116
  ... # Date 0 0
78b99149ed8a test-commandserver: port test functions from .py to .t
Yuya Nishihara <yuya@tcha.org>
parents: 22567
diff changeset
   117
  ... # Node ID c103a3dec114d882c98382d684d8af798d09d857
78b99149ed8a test-commandserver: port test functions from .py to .t
Yuya Nishihara <yuya@tcha.org>
parents: 22567
diff changeset
   118
  ... # Parent  0000000000000000000000000000000000000000
78b99149ed8a test-commandserver: port test functions from .py to .t
Yuya Nishihara <yuya@tcha.org>
parents: 22567
diff changeset
   119
  ... 1
78b99149ed8a test-commandserver: port test functions from .py to .t
Yuya Nishihara <yuya@tcha.org>
parents: 22567
diff changeset
   120
  ... 
78b99149ed8a test-commandserver: port test functions from .py to .t
Yuya Nishihara <yuya@tcha.org>
parents: 22567
diff changeset
   121
  ... 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
   122
  ... --- /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
   123
  ... +++ 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
   124
  ... @@ -0,0 +1,1 @@
78b99149ed8a test-commandserver: port test functions from .py to .t
Yuya Nishihara <yuya@tcha.org>
parents: 22567
diff changeset
   125
  ... +1
78b99149ed8a test-commandserver: port test functions from .py to .t
Yuya Nishihara <yuya@tcha.org>
parents: 22567
diff changeset
   126
  ... """
78b99149ed8a test-commandserver: port test functions from .py to .t
Yuya Nishihara <yuya@tcha.org>
parents: 22567
diff changeset
   127
  ... 
28836
3f45488d70df test-commandserver: handle cStringIO.StringIO/io.StringIO divergence
timeless <timeless@mozdev.org>
parents: 28511
diff changeset
   128
  ...     runcommand(server, ['import', '-'], input=stringio(patch))
22568
78b99149ed8a test-commandserver: port test functions from .py to .t
Yuya Nishihara <yuya@tcha.org>
parents: 22567
diff changeset
   129
  ...     runcommand(server, ['log'])
22572
cc3d9f776632 test-commandserver: make runcommand message bolder
Yuya Nishihara <yuya@tcha.org>
parents: 22571
diff changeset
   130
  *** runcommand import -
22567
f9a4a035003d test-commandserver: add stub for .t test by copying .out with 2-space indent
Yuya Nishihara <yuya@tcha.org>
parents:
diff changeset
   131
  applying patch from stdin
22572
cc3d9f776632 test-commandserver: make runcommand message bolder
Yuya Nishihara <yuya@tcha.org>
parents: 22571
diff changeset
   132
  *** runcommand 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
   133
  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
   134
  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
   135
  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
   136
  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
   137
  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
   138
  
22568
78b99149ed8a test-commandserver: port test functions from .py to .t
Yuya Nishihara <yuya@tcha.org>
parents: 22567
diff changeset
   139
35170
c9740b69b9b7 dispatch: add HGPLAIN=+strictflags to restrict early parsing of global options
Yuya Nishihara <yuya@tcha.org>
parents: 34942
diff changeset
   140
check strict parsing of early options:
c9740b69b9b7 dispatch: add HGPLAIN=+strictflags to restrict early parsing of global options
Yuya Nishihara <yuya@tcha.org>
parents: 34942
diff changeset
   141
c9740b69b9b7 dispatch: add HGPLAIN=+strictflags to restrict early parsing of global options
Yuya Nishihara <yuya@tcha.org>
parents: 34942
diff changeset
   142
  >>> import os
c9740b69b9b7 dispatch: add HGPLAIN=+strictflags to restrict early parsing of global options
Yuya Nishihara <yuya@tcha.org>
parents: 34942
diff changeset
   143
  >>> from hgclient import check, readchannel, runcommand
c9740b69b9b7 dispatch: add HGPLAIN=+strictflags to restrict early parsing of global options
Yuya Nishihara <yuya@tcha.org>
parents: 34942
diff changeset
   144
  >>> os.environ['HGPLAIN'] = '+strictflags'
c9740b69b9b7 dispatch: add HGPLAIN=+strictflags to restrict early parsing of global options
Yuya Nishihara <yuya@tcha.org>
parents: 34942
diff changeset
   145
  >>> @check
c9740b69b9b7 dispatch: add HGPLAIN=+strictflags to restrict early parsing of global options
Yuya Nishihara <yuya@tcha.org>
parents: 34942
diff changeset
   146
  ... def cwd(server):
c9740b69b9b7 dispatch: add HGPLAIN=+strictflags to restrict early parsing of global options
Yuya Nishihara <yuya@tcha.org>
parents: 34942
diff changeset
   147
  ...     readchannel(server)
c9740b69b9b7 dispatch: add HGPLAIN=+strictflags to restrict early parsing of global options
Yuya Nishihara <yuya@tcha.org>
parents: 34942
diff changeset
   148
  ...     runcommand(server, ['log', '-b', '--config=alias.log=!echo pwned',
c9740b69b9b7 dispatch: add HGPLAIN=+strictflags to restrict early parsing of global options
Yuya Nishihara <yuya@tcha.org>
parents: 34942
diff changeset
   149
  ...                         'default'])
c9740b69b9b7 dispatch: add HGPLAIN=+strictflags to restrict early parsing of global options
Yuya Nishihara <yuya@tcha.org>
parents: 34942
diff changeset
   150
  *** runcommand log -b --config=alias.log=!echo pwned default
c9740b69b9b7 dispatch: add HGPLAIN=+strictflags to restrict early parsing of global options
Yuya Nishihara <yuya@tcha.org>
parents: 34942
diff changeset
   151
  abort: unknown revision '--config=alias.log=!echo pwned'!
c9740b69b9b7 dispatch: add HGPLAIN=+strictflags to restrict early parsing of global options
Yuya Nishihara <yuya@tcha.org>
parents: 34942
diff changeset
   152
   [255]
c9740b69b9b7 dispatch: add HGPLAIN=+strictflags to restrict early parsing of global options
Yuya Nishihara <yuya@tcha.org>
parents: 34942
diff changeset
   153
30262
bc5d0e6fd9f3 histedit: use ui.fin to read commands from stdin
Yuya Nishihara <yuya@tcha.org>
parents: 29974
diff changeset
   154
check that "histedit --commands=-" can read rules from the input channel:
bc5d0e6fd9f3 histedit: use ui.fin to read commands from stdin
Yuya Nishihara <yuya@tcha.org>
parents: 29974
diff changeset
   155
bc5d0e6fd9f3 histedit: use ui.fin to read commands from stdin
Yuya Nishihara <yuya@tcha.org>
parents: 29974
diff changeset
   156
  >>> import cStringIO
33922
1a6707b43d05 tests: update test-commandserver to pass our import checker
Augie Fackler <raf@durin42.com>
parents: 33921
diff changeset
   157
  >>> from hgclient import check, readchannel, runcommand
30262
bc5d0e6fd9f3 histedit: use ui.fin to read commands from stdin
Yuya Nishihara <yuya@tcha.org>
parents: 29974
diff changeset
   158
  >>> @check
bc5d0e6fd9f3 histedit: use ui.fin to read commands from stdin
Yuya Nishihara <yuya@tcha.org>
parents: 29974
diff changeset
   159
  ... def serverinput(server):
bc5d0e6fd9f3 histedit: use ui.fin to read commands from stdin
Yuya Nishihara <yuya@tcha.org>
parents: 29974
diff changeset
   160
  ...     readchannel(server)
bc5d0e6fd9f3 histedit: use ui.fin to read commands from stdin
Yuya Nishihara <yuya@tcha.org>
parents: 29974
diff changeset
   161
  ...     rules = 'pick eff892de26ec\n'
bc5d0e6fd9f3 histedit: use ui.fin to read commands from stdin
Yuya Nishihara <yuya@tcha.org>
parents: 29974
diff changeset
   162
  ...     runcommand(server, ['histedit', '0', '--commands=-',
bc5d0e6fd9f3 histedit: use ui.fin to read commands from stdin
Yuya Nishihara <yuya@tcha.org>
parents: 29974
diff changeset
   163
  ...                         '--config', 'extensions.histedit='],
bc5d0e6fd9f3 histedit: use ui.fin to read commands from stdin
Yuya Nishihara <yuya@tcha.org>
parents: 29974
diff changeset
   164
  ...                input=cStringIO.StringIO(rules))
bc5d0e6fd9f3 histedit: use ui.fin to read commands from stdin
Yuya Nishihara <yuya@tcha.org>
parents: 29974
diff changeset
   165
  *** runcommand histedit 0 --commands=- --config extensions.histedit=
bc5d0e6fd9f3 histedit: use ui.fin to read commands from stdin
Yuya Nishihara <yuya@tcha.org>
parents: 29974
diff changeset
   166
22568
78b99149ed8a test-commandserver: port test functions from .py to .t
Yuya Nishihara <yuya@tcha.org>
parents: 22567
diff changeset
   167
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
   168
78b99149ed8a test-commandserver: port test functions from .py to .t
Yuya Nishihara <yuya@tcha.org>
parents: 22567
diff changeset
   169
  $ mkdir foo
78b99149ed8a test-commandserver: port test functions from .py to .t
Yuya Nishihara <yuya@tcha.org>
parents: 22567
diff changeset
   170
  $ touch foo/bar
33922
1a6707b43d05 tests: update test-commandserver to pass our import checker
Augie Fackler <raf@durin42.com>
parents: 33921
diff changeset
   171
  >>> from hgclient import check, readchannel, runcommand
22568
78b99149ed8a test-commandserver: port test functions from .py to .t
Yuya Nishihara <yuya@tcha.org>
parents: 22567
diff changeset
   172
  >>> @check
78b99149ed8a test-commandserver: port test functions from .py to .t
Yuya Nishihara <yuya@tcha.org>
parents: 22567
diff changeset
   173
  ... def cwd(server):
78b99149ed8a test-commandserver: port test functions from .py to .t
Yuya Nishihara <yuya@tcha.org>
parents: 22567
diff changeset
   174
  ...     readchannel(server)
78b99149ed8a test-commandserver: port test functions from .py to .t
Yuya Nishihara <yuya@tcha.org>
parents: 22567
diff changeset
   175
  ...     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
   176
  ...     runcommand(server, ['st', 'foo/bar'])
22572
cc3d9f776632 test-commandserver: make runcommand message bolder
Yuya Nishihara <yuya@tcha.org>
parents: 22571
diff changeset
   177
  *** runcommand --cwd foo st 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
   178
  ? bar
22572
cc3d9f776632 test-commandserver: make runcommand message bolder
Yuya Nishihara <yuya@tcha.org>
parents: 22571
diff changeset
   179
  *** runcommand 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
   180
  ? foo/bar
22568
78b99149ed8a test-commandserver: port test functions from .py to .t
Yuya Nishihara <yuya@tcha.org>
parents: 22567
diff changeset
   181
78b99149ed8a test-commandserver: port test functions from .py to .t
Yuya Nishihara <yuya@tcha.org>
parents: 22567
diff changeset
   182
  $ rm foo/bar
78b99149ed8a test-commandserver: port test functions from .py to .t
Yuya Nishihara <yuya@tcha.org>
parents: 22567
diff changeset
   183
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
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
   186
78b99149ed8a test-commandserver: port test functions from .py to .t
Yuya Nishihara <yuya@tcha.org>
parents: 22567
diff changeset
   187
  $ cat <<EOF >> .hg/hgrc
78b99149ed8a test-commandserver: port test functions from .py to .t
Yuya Nishihara <yuya@tcha.org>
parents: 22567
diff changeset
   188
  > [ui]
78b99149ed8a test-commandserver: port test functions from .py to .t
Yuya Nishihara <yuya@tcha.org>
parents: 22567
diff changeset
   189
  > foo = bar
78b99149ed8a test-commandserver: port test functions from .py to .t
Yuya Nishihara <yuya@tcha.org>
parents: 22567
diff changeset
   190
  > EOF
78b99149ed8a test-commandserver: port test functions from .py to .t
Yuya Nishihara <yuya@tcha.org>
parents: 22567
diff changeset
   191
33922
1a6707b43d05 tests: update test-commandserver to pass our import checker
Augie Fackler <raf@durin42.com>
parents: 33921
diff changeset
   192
  >>> from hgclient import check, readchannel, runcommand, sep
22568
78b99149ed8a test-commandserver: port test functions from .py to .t
Yuya Nishihara <yuya@tcha.org>
parents: 22567
diff changeset
   193
  >>> @check
78b99149ed8a test-commandserver: port test functions from .py to .t
Yuya Nishihara <yuya@tcha.org>
parents: 22567
diff changeset
   194
  ... def localhgrc(server):
78b99149ed8a test-commandserver: port test functions from .py to .t
Yuya Nishihara <yuya@tcha.org>
parents: 22567
diff changeset
   195
  ...     readchannel(server)
78b99149ed8a test-commandserver: port test functions from .py to .t
Yuya Nishihara <yuya@tcha.org>
parents: 22567
diff changeset
   196
  ... 
78b99149ed8a test-commandserver: port test functions from .py to .t
Yuya Nishihara <yuya@tcha.org>
parents: 22567
diff changeset
   197
  ...     # 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
   198
  ...     # show it
78b99149ed8a test-commandserver: port test functions from .py to .t
Yuya Nishihara <yuya@tcha.org>
parents: 22567
diff changeset
   199
  ...     runcommand(server, ['showconfig'], outfilter=sep)
78b99149ed8a test-commandserver: port test functions from .py to .t
Yuya Nishihara <yuya@tcha.org>
parents: 22567
diff changeset
   200
  ... 
78b99149ed8a test-commandserver: port test functions from .py to .t
Yuya Nishihara <yuya@tcha.org>
parents: 22567
diff changeset
   201
  ...     # but not for this repo
78b99149ed8a test-commandserver: port test functions from .py to .t
Yuya Nishihara <yuya@tcha.org>
parents: 22567
diff changeset
   202
  ...     runcommand(server, ['init', 'foo'])
78b99149ed8a test-commandserver: port test functions from .py to .t
Yuya Nishihara <yuya@tcha.org>
parents: 22567
diff changeset
   203
  ...     runcommand(server, ['-R', 'foo', 'showconfig', 'ui', 'defaults'])
22572
cc3d9f776632 test-commandserver: make runcommand message bolder
Yuya Nishihara <yuya@tcha.org>
parents: 22571
diff changeset
   204
  *** runcommand showconfig
22567
f9a4a035003d test-commandserver: add stub for .t test by copying .out with 2-space indent
Yuya Nishihara <yuya@tcha.org>
parents:
diff changeset
   205
  bundle.mainreporoot=$TESTTMP/repo
25290
8f88f768e24c devel: rename 'all' to 'all-warnings' (BC)
Pierre-Yves David <pierre-yves.david@fb.com>
parents: 24751
diff changeset
   206
  devel.all-warnings=true
32410
f94d7e3e46a0 devel: activate default-date in tests
Pierre-Yves David <pierre-yves.david@octobus.net>
parents: 32337
diff changeset
   207
  devel.default-date=0 0
33426
29653495cece tests: add extra output for fsmonitor at showconfig
FUJIWARA Katsunori <foozy@lares.dti.ne.jp>
parents: 33097
diff changeset
   208
  extensions.fsmonitor= (fsmonitor !)
23388
42ed0780ec4b run-tests: set a default largefiles usercache in the default hgrc file
Matt Harbison <matt_harbison@yahoo.com>
parents: 23324
diff changeset
   209
  largefiles.usercache=$TESTTMP/.cache/largefiles
35280
8e72f9152c4d lfs: introduce a user level cache for lfs files
Matt Harbison <matt_harbison@yahoo.com>
parents: 35170
diff changeset
   210
  lfs.usercache=$TESTTMP/.cache/lfs
22567
f9a4a035003d test-commandserver: add stub for .t test by copying .out with 2-space indent
Yuya Nishihara <yuya@tcha.org>
parents:
diff changeset
   211
  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
   212
  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
   213
  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
   214
  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
   215
  ui.nontty=true
31009
161ab32b44a1 runtests: set web.address to localhost
Jun Wu <quark@fb.com>
parents: 30986
diff changeset
   216
  web.address=localhost
31010
09ec648cd2a9 runtests: always set web.ipv6
Jun Wu <quark@fb.com>
parents: 31009
diff changeset
   217
  web\.ipv6=(?:True|False) (re)
37009
5890e5872f36 hgweb: allow defining Server response header for HTTP server
Gregory Szorc <gregory.szorc@gmail.com>
parents: 36426
diff changeset
   218
  web.server-header=testing stub value
22572
cc3d9f776632 test-commandserver: make runcommand message bolder
Yuya Nishihara <yuya@tcha.org>
parents: 22571
diff changeset
   219
  *** runcommand init foo
cc3d9f776632 test-commandserver: make runcommand message bolder
Yuya Nishihara <yuya@tcha.org>
parents: 22571
diff changeset
   220
  *** runcommand -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
   221
  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
   222
  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
   223
  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
   224
  ui.nontty=true
22568
78b99149ed8a test-commandserver: port test functions from .py to .t
Yuya Nishihara <yuya@tcha.org>
parents: 22567
diff changeset
   225
78b99149ed8a test-commandserver: port test functions from .py to .t
Yuya Nishihara <yuya@tcha.org>
parents: 22567
diff changeset
   226
  $ rm -R foo
78b99149ed8a test-commandserver: port test functions from .py to .t
Yuya Nishihara <yuya@tcha.org>
parents: 22567
diff changeset
   227
78b99149ed8a test-commandserver: port test functions from .py to .t
Yuya Nishihara <yuya@tcha.org>
parents: 22567
diff changeset
   228
#if windows
78b99149ed8a test-commandserver: port test functions from .py to .t
Yuya Nishihara <yuya@tcha.org>
parents: 22567
diff changeset
   229
  $ PYTHONPATH="$TESTTMP/repo;$PYTHONPATH"
78b99149ed8a test-commandserver: port test functions from .py to .t
Yuya Nishihara <yuya@tcha.org>
parents: 22567
diff changeset
   230
#else
78b99149ed8a test-commandserver: port test functions from .py to .t
Yuya Nishihara <yuya@tcha.org>
parents: 22567
diff changeset
   231
  $ PYTHONPATH="$TESTTMP/repo:$PYTHONPATH"
78b99149ed8a test-commandserver: port test functions from .py to .t
Yuya Nishihara <yuya@tcha.org>
parents: 22567
diff changeset
   232
#endif
78b99149ed8a test-commandserver: port test functions from .py to .t
Yuya Nishihara <yuya@tcha.org>
parents: 22567
diff changeset
   233
78b99149ed8a test-commandserver: port test functions from .py to .t
Yuya Nishihara <yuya@tcha.org>
parents: 22567
diff changeset
   234
  $ cat <<EOF > hook.py
29485
6a98f9408a50 py3: make files use absolute_import and print_function
Pulkit Goyal <7895pulkit@gmail.com>
parents: 28996
diff changeset
   235
  > from __future__ import print_function
22568
78b99149ed8a test-commandserver: port test functions from .py to .t
Yuya Nishihara <yuya@tcha.org>
parents: 22567
diff changeset
   236
  > import sys
78b99149ed8a test-commandserver: port test functions from .py to .t
Yuya Nishihara <yuya@tcha.org>
parents: 22567
diff changeset
   237
  > def hook(**args):
29485
6a98f9408a50 py3: make files use absolute_import and print_function
Pulkit Goyal <7895pulkit@gmail.com>
parents: 28996
diff changeset
   238
  >     print('hook talking')
6a98f9408a50 py3: make files use absolute_import and print_function
Pulkit Goyal <7895pulkit@gmail.com>
parents: 28996
diff changeset
   239
  >     print('now try to read something: %r' % sys.stdin.read())
22568
78b99149ed8a test-commandserver: port test functions from .py to .t
Yuya Nishihara <yuya@tcha.org>
parents: 22567
diff changeset
   240
  > EOF
78b99149ed8a test-commandserver: port test functions from .py to .t
Yuya Nishihara <yuya@tcha.org>
parents: 22567
diff changeset
   241
33922
1a6707b43d05 tests: update test-commandserver to pass our import checker
Augie Fackler <raf@durin42.com>
parents: 33921
diff changeset
   242
  >>> from hgclient import check, readchannel, runcommand, stringio
22568
78b99149ed8a test-commandserver: port test functions from .py to .t
Yuya Nishihara <yuya@tcha.org>
parents: 22567
diff changeset
   243
  >>> @check
78b99149ed8a test-commandserver: port test functions from .py to .t
Yuya Nishihara <yuya@tcha.org>
parents: 22567
diff changeset
   244
  ... def hookoutput(server):
78b99149ed8a test-commandserver: port test functions from .py to .t
Yuya Nishihara <yuya@tcha.org>
parents: 22567
diff changeset
   245
  ...     readchannel(server)
78b99149ed8a test-commandserver: port test functions from .py to .t
Yuya Nishihara <yuya@tcha.org>
parents: 22567
diff changeset
   246
  ...     runcommand(server, ['--config',
78b99149ed8a test-commandserver: port test functions from .py to .t
Yuya Nishihara <yuya@tcha.org>
parents: 22567
diff changeset
   247
  ...                         '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
   248
  ...                         'id'],
28836
3f45488d70df test-commandserver: handle cStringIO.StringIO/io.StringIO divergence
timeless <timeless@mozdev.org>
parents: 28511
diff changeset
   249
  ...                input=stringio('some input'))
22572
cc3d9f776632 test-commandserver: make runcommand message bolder
Yuya Nishihara <yuya@tcha.org>
parents: 22571
diff changeset
   250
  *** 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
   251
  eff892de26ec tip
37220
7f78de1c93aa procutil: redirect ui.fout to stderr while stdio is protected
Yuya Nishihara <yuya@tcha.org>
parents: 37009
diff changeset
   252
  hook talking
7f78de1c93aa procutil: redirect ui.fout to stderr while stdio is protected
Yuya Nishihara <yuya@tcha.org>
parents: 37009
diff changeset
   253
  now try to read something: ''
22568
78b99149ed8a test-commandserver: port test functions from .py to .t
Yuya Nishihara <yuya@tcha.org>
parents: 22567
diff changeset
   254
33607
6c142f279625 pypy: fix failing test files with Pypy5.6.0
Boris Feld <boris.feld@octobus.net>
parents: 33542
diff changeset
   255
Clean hook cached version
22568
78b99149ed8a test-commandserver: port test functions from .py to .t
Yuya Nishihara <yuya@tcha.org>
parents: 22567
diff changeset
   256
  $ rm hook.py*
33607
6c142f279625 pypy: fix failing test files with Pypy5.6.0
Boris Feld <boris.feld@octobus.net>
parents: 33542
diff changeset
   257
  $ rm -Rf __pycache__
22568
78b99149ed8a test-commandserver: port test functions from .py to .t
Yuya Nishihara <yuya@tcha.org>
parents: 22567
diff changeset
   258
78b99149ed8a test-commandserver: port test functions from .py to .t
Yuya Nishihara <yuya@tcha.org>
parents: 22567
diff changeset
   259
  $ echo a >> a
78b99149ed8a test-commandserver: port test functions from .py to .t
Yuya Nishihara <yuya@tcha.org>
parents: 22567
diff changeset
   260
  >>> import os
33922
1a6707b43d05 tests: update test-commandserver to pass our import checker
Augie Fackler <raf@durin42.com>
parents: 33921
diff changeset
   261
  >>> from hgclient import check, readchannel, runcommand
22568
78b99149ed8a test-commandserver: port test functions from .py to .t
Yuya Nishihara <yuya@tcha.org>
parents: 22567
diff changeset
   262
  >>> @check
78b99149ed8a test-commandserver: port test functions from .py to .t
Yuya Nishihara <yuya@tcha.org>
parents: 22567
diff changeset
   263
  ... def outsidechanges(server):
78b99149ed8a test-commandserver: port test functions from .py to .t
Yuya Nishihara <yuya@tcha.org>
parents: 22567
diff changeset
   264
  ...     readchannel(server)
78b99149ed8a test-commandserver: port test functions from .py to .t
Yuya Nishihara <yuya@tcha.org>
parents: 22567
diff changeset
   265
  ...     runcommand(server, ['status'])
78b99149ed8a test-commandserver: port test functions from .py to .t
Yuya Nishihara <yuya@tcha.org>
parents: 22567
diff changeset
   266
  ...     os.system('hg ci -Am2')
78b99149ed8a test-commandserver: port test functions from .py to .t
Yuya Nishihara <yuya@tcha.org>
parents: 22567
diff changeset
   267
  ...     runcommand(server, ['tip'])
78b99149ed8a test-commandserver: port test functions from .py to .t
Yuya Nishihara <yuya@tcha.org>
parents: 22567
diff changeset
   268
  ...     runcommand(server, ['status'])
22572
cc3d9f776632 test-commandserver: make runcommand message bolder
Yuya Nishihara <yuya@tcha.org>
parents: 22571
diff changeset
   269
  *** runcommand 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
   270
  M a
22572
cc3d9f776632 test-commandserver: make runcommand message bolder
Yuya Nishihara <yuya@tcha.org>
parents: 22571
diff changeset
   271
  *** runcommand tip
22567
f9a4a035003d test-commandserver: add stub for .t test by copying .out with 2-space indent
Yuya Nishihara <yuya@tcha.org>
parents:
diff changeset
   272
  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
   273
  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
   274
  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
   275
  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
   276
  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
   277
  
22572
cc3d9f776632 test-commandserver: make runcommand message bolder
Yuya Nishihara <yuya@tcha.org>
parents: 22571
diff changeset
   278
  *** runcommand status
22568
78b99149ed8a test-commandserver: port test functions from .py to .t
Yuya Nishihara <yuya@tcha.org>
parents: 22567
diff changeset
   279
78b99149ed8a test-commandserver: port test functions from .py to .t
Yuya Nishihara <yuya@tcha.org>
parents: 22567
diff changeset
   280
  >>> import os
33922
1a6707b43d05 tests: update test-commandserver to pass our import checker
Augie Fackler <raf@durin42.com>
parents: 33921
diff changeset
   281
  >>> from hgclient import check, readchannel, runcommand
22568
78b99149ed8a test-commandserver: port test functions from .py to .t
Yuya Nishihara <yuya@tcha.org>
parents: 22567
diff changeset
   282
  >>> @check
78b99149ed8a test-commandserver: port test functions from .py to .t
Yuya Nishihara <yuya@tcha.org>
parents: 22567
diff changeset
   283
  ... def bookmarks(server):
78b99149ed8a test-commandserver: port test functions from .py to .t
Yuya Nishihara <yuya@tcha.org>
parents: 22567
diff changeset
   284
  ...     readchannel(server)
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
78b99149ed8a test-commandserver: port test functions from .py to .t
Yuya Nishihara <yuya@tcha.org>
parents: 22567
diff changeset
   288
  ...     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
   289
  ...     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
   290
  ...     runcommand(server, ['bookmarks'])
78b99149ed8a test-commandserver: port test functions from .py to .t
Yuya Nishihara <yuya@tcha.org>
parents: 22567
diff changeset
   291
  ... 
78b99149ed8a test-commandserver: port test functions from .py to .t
Yuya Nishihara <yuya@tcha.org>
parents: 22567
diff changeset
   292
  ...     # changes .hg/bookmarks.current
78b99149ed8a test-commandserver: port test functions from .py to .t
Yuya Nishihara <yuya@tcha.org>
parents: 22567
diff changeset
   293
  ...     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
   294
  ...     runcommand(server, ['bookmarks'])
78b99149ed8a test-commandserver: port test functions from .py to .t
Yuya Nishihara <yuya@tcha.org>
parents: 22567
diff changeset
   295
  ... 
78b99149ed8a test-commandserver: port test functions from .py to .t
Yuya Nishihara <yuya@tcha.org>
parents: 22567
diff changeset
   296
  ...     runcommand(server, ['bookmarks', 'bm3'])
78b99149ed8a test-commandserver: port test functions from .py to .t
Yuya Nishihara <yuya@tcha.org>
parents: 22567
diff changeset
   297
  ...     f = open('a', 'ab')
78b99149ed8a test-commandserver: port test functions from .py to .t
Yuya Nishihara <yuya@tcha.org>
parents: 22567
diff changeset
   298
  ...     f.write('a\n')
78b99149ed8a test-commandserver: port test functions from .py to .t
Yuya Nishihara <yuya@tcha.org>
parents: 22567
diff changeset
   299
  ...     f.close()
78b99149ed8a test-commandserver: port test functions from .py to .t
Yuya Nishihara <yuya@tcha.org>
parents: 22567
diff changeset
   300
  ...     runcommand(server, ['commit', '-Amm'])
78b99149ed8a test-commandserver: port test functions from .py to .t
Yuya Nishihara <yuya@tcha.org>
parents: 22567
diff changeset
   301
  ...     runcommand(server, ['bookmarks'])
33921
a4c1333b2eda tests: add blank output lines to test-commandserver
Augie Fackler <raf@durin42.com>
parents: 33773
diff changeset
   302
  ...     print('')
22572
cc3d9f776632 test-commandserver: make runcommand message bolder
Yuya Nishihara <yuya@tcha.org>
parents: 22571
diff changeset
   303
  *** runcommand 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
   304
  no bookmarks set
22572
cc3d9f776632 test-commandserver: make runcommand message bolder
Yuya Nishihara <yuya@tcha.org>
parents: 22571
diff changeset
   305
  *** runcommand 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
   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
22572
cc3d9f776632 test-commandserver: make runcommand message bolder
Yuya Nishihara <yuya@tcha.org>
parents: 22571
diff changeset
   308
  *** runcommand 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
   309
   * 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
   310
     bm2                       1:d3a0a68be6de
22572
cc3d9f776632 test-commandserver: make runcommand message bolder
Yuya Nishihara <yuya@tcha.org>
parents: 22571
diff changeset
   311
  *** runcommand bookmarks bm3
cc3d9f776632 test-commandserver: make runcommand message bolder
Yuya Nishihara <yuya@tcha.org>
parents: 22571
diff changeset
   312
  *** runcommand commit -Amm
cc3d9f776632 test-commandserver: make runcommand message bolder
Yuya Nishihara <yuya@tcha.org>
parents: 22571
diff changeset
   313
  *** runcommand 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
   314
     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
   315
     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
   316
   * bm3                       2:aef17e88f5f0
33921
a4c1333b2eda tests: add blank output lines to test-commandserver
Augie Fackler <raf@durin42.com>
parents: 33773
diff changeset
   317
  
22568
78b99149ed8a test-commandserver: port test functions from .py to .t
Yuya Nishihara <yuya@tcha.org>
parents: 22567
diff changeset
   318
78b99149ed8a test-commandserver: port test functions from .py to .t
Yuya Nishihara <yuya@tcha.org>
parents: 22567
diff changeset
   319
  >>> import os
33922
1a6707b43d05 tests: update test-commandserver to pass our import checker
Augie Fackler <raf@durin42.com>
parents: 33921
diff changeset
   320
  >>> from hgclient import check, readchannel, runcommand
22568
78b99149ed8a test-commandserver: port test functions from .py to .t
Yuya Nishihara <yuya@tcha.org>
parents: 22567
diff changeset
   321
  >>> @check
78b99149ed8a test-commandserver: port test functions from .py to .t
Yuya Nishihara <yuya@tcha.org>
parents: 22567
diff changeset
   322
  ... def tagscache(server):
78b99149ed8a test-commandserver: port test functions from .py to .t
Yuya Nishihara <yuya@tcha.org>
parents: 22567
diff changeset
   323
  ...     readchannel(server)
78b99149ed8a test-commandserver: port test functions from .py to .t
Yuya Nishihara <yuya@tcha.org>
parents: 22567
diff changeset
   324
  ...     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
   325
  ...     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
   326
  ...     runcommand(server, ['id', '-t', '-r', '0'])
22572
cc3d9f776632 test-commandserver: make runcommand message bolder
Yuya Nishihara <yuya@tcha.org>
parents: 22571
diff changeset
   327
  *** runcommand 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
   328
  
22572
cc3d9f776632 test-commandserver: make runcommand message bolder
Yuya Nishihara <yuya@tcha.org>
parents: 22571
diff changeset
   329
  *** runcommand 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
   330
  foo
22568
78b99149ed8a test-commandserver: port test functions from .py to .t
Yuya Nishihara <yuya@tcha.org>
parents: 22567
diff changeset
   331
78b99149ed8a test-commandserver: port test functions from .py to .t
Yuya Nishihara <yuya@tcha.org>
parents: 22567
diff changeset
   332
  >>> import os
33922
1a6707b43d05 tests: update test-commandserver to pass our import checker
Augie Fackler <raf@durin42.com>
parents: 33921
diff changeset
   333
  >>> from hgclient import check, readchannel, runcommand
22568
78b99149ed8a test-commandserver: port test functions from .py to .t
Yuya Nishihara <yuya@tcha.org>
parents: 22567
diff changeset
   334
  >>> @check
78b99149ed8a test-commandserver: port test functions from .py to .t
Yuya Nishihara <yuya@tcha.org>
parents: 22567
diff changeset
   335
  ... def setphase(server):
78b99149ed8a test-commandserver: port test functions from .py to .t
Yuya Nishihara <yuya@tcha.org>
parents: 22567
diff changeset
   336
  ...     readchannel(server)
78b99149ed8a test-commandserver: port test functions from .py to .t
Yuya Nishihara <yuya@tcha.org>
parents: 22567
diff changeset
   337
  ...     runcommand(server, ['phase', '-r', '.'])
78b99149ed8a test-commandserver: port test functions from .py to .t
Yuya Nishihara <yuya@tcha.org>
parents: 22567
diff changeset
   338
  ...     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
   339
  ...     runcommand(server, ['phase', '-r', '.'])
22572
cc3d9f776632 test-commandserver: make runcommand message bolder
Yuya Nishihara <yuya@tcha.org>
parents: 22571
diff changeset
   340
  *** runcommand 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
   341
  3: draft
22572
cc3d9f776632 test-commandserver: make runcommand message bolder
Yuya Nishihara <yuya@tcha.org>
parents: 22571
diff changeset
   342
  *** runcommand 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
   343
  3: public
22568
78b99149ed8a test-commandserver: port test functions from .py to .t
Yuya Nishihara <yuya@tcha.org>
parents: 22567
diff changeset
   344
78b99149ed8a test-commandserver: port test functions from .py to .t
Yuya Nishihara <yuya@tcha.org>
parents: 22567
diff changeset
   345
  $ echo a >> a
33922
1a6707b43d05 tests: update test-commandserver to pass our import checker
Augie Fackler <raf@durin42.com>
parents: 33921
diff changeset
   346
  >>> from hgclient import check, readchannel, runcommand
22568
78b99149ed8a test-commandserver: port test functions from .py to .t
Yuya Nishihara <yuya@tcha.org>
parents: 22567
diff changeset
   347
  >>> @check
78b99149ed8a test-commandserver: port test functions from .py to .t
Yuya Nishihara <yuya@tcha.org>
parents: 22567
diff changeset
   348
  ... def rollback(server):
78b99149ed8a test-commandserver: port test functions from .py to .t
Yuya Nishihara <yuya@tcha.org>
parents: 22567
diff changeset
   349
  ...     readchannel(server)
78b99149ed8a test-commandserver: port test functions from .py to .t
Yuya Nishihara <yuya@tcha.org>
parents: 22567
diff changeset
   350
  ...     runcommand(server, ['phase', '-r', '.', '-p'])
78b99149ed8a test-commandserver: port test functions from .py to .t
Yuya Nishihara <yuya@tcha.org>
parents: 22567
diff changeset
   351
  ...     runcommand(server, ['commit', '-Am.'])
78b99149ed8a test-commandserver: port test functions from .py to .t
Yuya Nishihara <yuya@tcha.org>
parents: 22567
diff changeset
   352
  ...     runcommand(server, ['rollback'])
78b99149ed8a test-commandserver: port test functions from .py to .t
Yuya Nishihara <yuya@tcha.org>
parents: 22567
diff changeset
   353
  ...     runcommand(server, ['phase', '-r', '.'])
33921
a4c1333b2eda tests: add blank output lines to test-commandserver
Augie Fackler <raf@durin42.com>
parents: 33773
diff changeset
   354
  ...     print('')
22572
cc3d9f776632 test-commandserver: make runcommand message bolder
Yuya Nishihara <yuya@tcha.org>
parents: 22571
diff changeset
   355
  *** runcommand phase -r . -p
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
  no phases changed
22572
cc3d9f776632 test-commandserver: make runcommand message bolder
Yuya Nishihara <yuya@tcha.org>
parents: 22571
diff changeset
   357
  *** runcommand commit -Am.
cc3d9f776632 test-commandserver: make runcommand message bolder
Yuya Nishihara <yuya@tcha.org>
parents: 22571
diff changeset
   358
  *** runcommand rollback
22567
f9a4a035003d test-commandserver: add stub for .t test by copying .out with 2-space indent
Yuya Nishihara <yuya@tcha.org>
parents:
diff changeset
   359
  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
   360
  working directory now based on revision 3
22572
cc3d9f776632 test-commandserver: make runcommand message bolder
Yuya Nishihara <yuya@tcha.org>
parents: 22571
diff changeset
   361
  *** runcommand 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
   362
  3: public
33921
a4c1333b2eda tests: add blank output lines to test-commandserver
Augie Fackler <raf@durin42.com>
parents: 33773
diff changeset
   363
  
22568
78b99149ed8a test-commandserver: port test functions from .py to .t
Yuya Nishihara <yuya@tcha.org>
parents: 22567
diff changeset
   364
78b99149ed8a test-commandserver: port test functions from .py to .t
Yuya Nishihara <yuya@tcha.org>
parents: 22567
diff changeset
   365
  >>> import os
33922
1a6707b43d05 tests: update test-commandserver to pass our import checker
Augie Fackler <raf@durin42.com>
parents: 33921
diff changeset
   366
  >>> from hgclient import check, readchannel, runcommand
22568
78b99149ed8a test-commandserver: port test functions from .py to .t
Yuya Nishihara <yuya@tcha.org>
parents: 22567
diff changeset
   367
  >>> @check
78b99149ed8a test-commandserver: port test functions from .py to .t
Yuya Nishihara <yuya@tcha.org>
parents: 22567
diff changeset
   368
  ... def branch(server):
78b99149ed8a test-commandserver: port test functions from .py to .t
Yuya Nishihara <yuya@tcha.org>
parents: 22567
diff changeset
   369
  ...     readchannel(server)
78b99149ed8a test-commandserver: port test functions from .py to .t
Yuya Nishihara <yuya@tcha.org>
parents: 22567
diff changeset
   370
  ...     runcommand(server, ['branch'])
78b99149ed8a test-commandserver: port test functions from .py to .t
Yuya Nishihara <yuya@tcha.org>
parents: 22567
diff changeset
   371
  ...     os.system('hg branch foo')
78b99149ed8a test-commandserver: port test functions from .py to .t
Yuya Nishihara <yuya@tcha.org>
parents: 22567
diff changeset
   372
  ...     runcommand(server, ['branch'])
78b99149ed8a test-commandserver: port test functions from .py to .t
Yuya Nishihara <yuya@tcha.org>
parents: 22567
diff changeset
   373
  ...     os.system('hg branch default')
22572
cc3d9f776632 test-commandserver: make runcommand message bolder
Yuya Nishihara <yuya@tcha.org>
parents: 22571
diff changeset
   374
  *** runcommand branch
22567
f9a4a035003d test-commandserver: add stub for .t test by copying .out with 2-space indent
Yuya Nishihara <yuya@tcha.org>
parents:
diff changeset
   375
  default
f9a4a035003d test-commandserver: add stub for .t test by copying .out with 2-space indent
Yuya Nishihara <yuya@tcha.org>
parents:
diff changeset
   376
  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
   377
  (branches are permanent and global, did you want a bookmark?)
22572
cc3d9f776632 test-commandserver: make runcommand message bolder
Yuya Nishihara <yuya@tcha.org>
parents: 22571
diff changeset
   378
  *** runcommand branch
22567
f9a4a035003d test-commandserver: add stub for .t test by copying .out with 2-space indent
Yuya Nishihara <yuya@tcha.org>
parents:
diff changeset
   379
  foo
f9a4a035003d test-commandserver: add stub for .t test by copying .out with 2-space indent
Yuya Nishihara <yuya@tcha.org>
parents:
diff changeset
   380
  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
   381
  (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
   382
78b99149ed8a test-commandserver: port test functions from .py to .t
Yuya Nishihara <yuya@tcha.org>
parents: 22567
diff changeset
   383
  $ touch .hgignore
78b99149ed8a test-commandserver: port test functions from .py to .t
Yuya Nishihara <yuya@tcha.org>
parents: 22567
diff changeset
   384
  >>> import os
33922
1a6707b43d05 tests: update test-commandserver to pass our import checker
Augie Fackler <raf@durin42.com>
parents: 33921
diff changeset
   385
  >>> from hgclient import check, readchannel, runcommand
22568
78b99149ed8a test-commandserver: port test functions from .py to .t
Yuya Nishihara <yuya@tcha.org>
parents: 22567
diff changeset
   386
  >>> @check
78b99149ed8a test-commandserver: port test functions from .py to .t
Yuya Nishihara <yuya@tcha.org>
parents: 22567
diff changeset
   387
  ... def hgignore(server):
78b99149ed8a test-commandserver: port test functions from .py to .t
Yuya Nishihara <yuya@tcha.org>
parents: 22567
diff changeset
   388
  ...     readchannel(server)
78b99149ed8a test-commandserver: port test functions from .py to .t
Yuya Nishihara <yuya@tcha.org>
parents: 22567
diff changeset
   389
  ...     runcommand(server, ['commit', '-Am.'])
78b99149ed8a test-commandserver: port test functions from .py to .t
Yuya Nishihara <yuya@tcha.org>
parents: 22567
diff changeset
   390
  ...     f = open('ignored-file', 'ab')
78b99149ed8a test-commandserver: port test functions from .py to .t
Yuya Nishihara <yuya@tcha.org>
parents: 22567
diff changeset
   391
  ...     f.write('')
78b99149ed8a test-commandserver: port test functions from .py to .t
Yuya Nishihara <yuya@tcha.org>
parents: 22567
diff changeset
   392
  ...     f.close()
78b99149ed8a test-commandserver: port test functions from .py to .t
Yuya Nishihara <yuya@tcha.org>
parents: 22567
diff changeset
   393
  ...     f = open('.hgignore', 'ab')
78b99149ed8a test-commandserver: port test functions from .py to .t
Yuya Nishihara <yuya@tcha.org>
parents: 22567
diff changeset
   394
  ...     f.write('ignored-file')
78b99149ed8a test-commandserver: port test functions from .py to .t
Yuya Nishihara <yuya@tcha.org>
parents: 22567
diff changeset
   395
  ...     f.close()
78b99149ed8a test-commandserver: port test functions from .py to .t
Yuya Nishihara <yuya@tcha.org>
parents: 22567
diff changeset
   396
  ...     runcommand(server, ['status', '-i', '-u'])
33921
a4c1333b2eda tests: add blank output lines to test-commandserver
Augie Fackler <raf@durin42.com>
parents: 33773
diff changeset
   397
  ...     print('')
22572
cc3d9f776632 test-commandserver: make runcommand message bolder
Yuya Nishihara <yuya@tcha.org>
parents: 22571
diff changeset
   398
  *** runcommand commit -Am.
22567
f9a4a035003d test-commandserver: add stub for .t test by copying .out with 2-space indent
Yuya Nishihara <yuya@tcha.org>
parents:
diff changeset
   399
  adding .hgignore
22572
cc3d9f776632 test-commandserver: make runcommand message bolder
Yuya Nishihara <yuya@tcha.org>
parents: 22571
diff changeset
   400
  *** runcommand 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
   401
  I ignored-file
33921
a4c1333b2eda tests: add blank output lines to test-commandserver
Augie Fackler <raf@durin42.com>
parents: 33773
diff changeset
   402
  
22568
78b99149ed8a test-commandserver: port test functions from .py to .t
Yuya Nishihara <yuya@tcha.org>
parents: 22567
diff changeset
   403
26405
c15d8f84343e localrepo: recreate phasecache if changelog was modified (issue4855)
Yuya Nishihara <yuya@tcha.org>
parents: 25290
diff changeset
   404
cache of non-public revisions should be invalidated on repository change
c15d8f84343e localrepo: recreate phasecache if changelog was modified (issue4855)
Yuya Nishihara <yuya@tcha.org>
parents: 25290
diff changeset
   405
(issue4855):
c15d8f84343e localrepo: recreate phasecache if changelog was modified (issue4855)
Yuya Nishihara <yuya@tcha.org>
parents: 25290
diff changeset
   406
c15d8f84343e localrepo: recreate phasecache if changelog was modified (issue4855)
Yuya Nishihara <yuya@tcha.org>
parents: 25290
diff changeset
   407
  >>> import os
33922
1a6707b43d05 tests: update test-commandserver to pass our import checker
Augie Fackler <raf@durin42.com>
parents: 33921
diff changeset
   408
  >>> from hgclient import check, readchannel, runcommand
26405
c15d8f84343e localrepo: recreate phasecache if changelog was modified (issue4855)
Yuya Nishihara <yuya@tcha.org>
parents: 25290
diff changeset
   409
  >>> @check
c15d8f84343e localrepo: recreate phasecache if changelog was modified (issue4855)
Yuya Nishihara <yuya@tcha.org>
parents: 25290
diff changeset
   410
  ... def phasesetscacheaftercommit(server):
c15d8f84343e localrepo: recreate phasecache if changelog was modified (issue4855)
Yuya Nishihara <yuya@tcha.org>
parents: 25290
diff changeset
   411
  ...     readchannel(server)
c15d8f84343e localrepo: recreate phasecache if changelog was modified (issue4855)
Yuya Nishihara <yuya@tcha.org>
parents: 25290
diff changeset
   412
  ...     # load _phasecache._phaserevs and _phasesets
c15d8f84343e localrepo: recreate phasecache if changelog was modified (issue4855)
Yuya Nishihara <yuya@tcha.org>
parents: 25290
diff changeset
   413
  ...     runcommand(server, ['log', '-qr', 'draft()'])
c15d8f84343e localrepo: recreate phasecache if changelog was modified (issue4855)
Yuya Nishihara <yuya@tcha.org>
parents: 25290
diff changeset
   414
  ...     # create draft commits by another process
36289
257071fd3357 py3: use range instead of xrange in tests/test-commandserver.t
Pulkit Goyal <7895pulkit@gmail.com>
parents: 35280
diff changeset
   415
  ...     for i in range(5, 7):
26431
46984a5308a0 test-commandserver: generate files with a fixed EOL for test stability
Matt Harbison <matt_harbison@yahoo.com>
parents: 26409
diff changeset
   416
  ...         f = open('a', 'ab')
46984a5308a0 test-commandserver: generate files with a fixed EOL for test stability
Matt Harbison <matt_harbison@yahoo.com>
parents: 26409
diff changeset
   417
  ...         f.seek(0, os.SEEK_END)
46984a5308a0 test-commandserver: generate files with a fixed EOL for test stability
Matt Harbison <matt_harbison@yahoo.com>
parents: 26409
diff changeset
   418
  ...         f.write('a\n')
46984a5308a0 test-commandserver: generate files with a fixed EOL for test stability
Matt Harbison <matt_harbison@yahoo.com>
parents: 26409
diff changeset
   419
  ...         f.close()
26405
c15d8f84343e localrepo: recreate phasecache if changelog was modified (issue4855)
Yuya Nishihara <yuya@tcha.org>
parents: 25290
diff changeset
   420
  ...         os.system('hg commit -Aqm%d' % i)
c15d8f84343e localrepo: recreate phasecache if changelog was modified (issue4855)
Yuya Nishihara <yuya@tcha.org>
parents: 25290
diff changeset
   421
  ...     # new commits should be listed as draft revisions
c15d8f84343e localrepo: recreate phasecache if changelog was modified (issue4855)
Yuya Nishihara <yuya@tcha.org>
parents: 25290
diff changeset
   422
  ...     runcommand(server, ['log', '-qr', 'draft()'])
33921
a4c1333b2eda tests: add blank output lines to test-commandserver
Augie Fackler <raf@durin42.com>
parents: 33773
diff changeset
   423
  ...     print('')
26405
c15d8f84343e localrepo: recreate phasecache if changelog was modified (issue4855)
Yuya Nishihara <yuya@tcha.org>
parents: 25290
diff changeset
   424
  *** runcommand log -qr draft()
c15d8f84343e localrepo: recreate phasecache if changelog was modified (issue4855)
Yuya Nishihara <yuya@tcha.org>
parents: 25290
diff changeset
   425
  4:7966c8e3734d
c15d8f84343e localrepo: recreate phasecache if changelog was modified (issue4855)
Yuya Nishihara <yuya@tcha.org>
parents: 25290
diff changeset
   426
  *** runcommand log -qr draft()
c15d8f84343e localrepo: recreate phasecache if changelog was modified (issue4855)
Yuya Nishihara <yuya@tcha.org>
parents: 25290
diff changeset
   427
  4:7966c8e3734d
c15d8f84343e localrepo: recreate phasecache if changelog was modified (issue4855)
Yuya Nishihara <yuya@tcha.org>
parents: 25290
diff changeset
   428
  5:41f6602d1c4f
c15d8f84343e localrepo: recreate phasecache if changelog was modified (issue4855)
Yuya Nishihara <yuya@tcha.org>
parents: 25290
diff changeset
   429
  6:10501e202c35
33921
a4c1333b2eda tests: add blank output lines to test-commandserver
Augie Fackler <raf@durin42.com>
parents: 33773
diff changeset
   430
  
26405
c15d8f84343e localrepo: recreate phasecache if changelog was modified (issue4855)
Yuya Nishihara <yuya@tcha.org>
parents: 25290
diff changeset
   431
c15d8f84343e localrepo: recreate phasecache if changelog was modified (issue4855)
Yuya Nishihara <yuya@tcha.org>
parents: 25290
diff changeset
   432
  >>> import os
33922
1a6707b43d05 tests: update test-commandserver to pass our import checker
Augie Fackler <raf@durin42.com>
parents: 33921
diff changeset
   433
  >>> from hgclient import check, readchannel, runcommand
26405
c15d8f84343e localrepo: recreate phasecache if changelog was modified (issue4855)
Yuya Nishihara <yuya@tcha.org>
parents: 25290
diff changeset
   434
  >>> @check
c15d8f84343e localrepo: recreate phasecache if changelog was modified (issue4855)
Yuya Nishihara <yuya@tcha.org>
parents: 25290
diff changeset
   435
  ... def phasesetscacheafterstrip(server):
c15d8f84343e localrepo: recreate phasecache if changelog was modified (issue4855)
Yuya Nishihara <yuya@tcha.org>
parents: 25290
diff changeset
   436
  ...     readchannel(server)
c15d8f84343e localrepo: recreate phasecache if changelog was modified (issue4855)
Yuya Nishihara <yuya@tcha.org>
parents: 25290
diff changeset
   437
  ...     # load _phasecache._phaserevs and _phasesets
c15d8f84343e localrepo: recreate phasecache if changelog was modified (issue4855)
Yuya Nishihara <yuya@tcha.org>
parents: 25290
diff changeset
   438
  ...     runcommand(server, ['log', '-qr', 'draft()'])
c15d8f84343e localrepo: recreate phasecache if changelog was modified (issue4855)
Yuya Nishihara <yuya@tcha.org>
parents: 25290
diff changeset
   439
  ...     # strip cached revisions by another process
c15d8f84343e localrepo: recreate phasecache if changelog was modified (issue4855)
Yuya Nishihara <yuya@tcha.org>
parents: 25290
diff changeset
   440
  ...     os.system('hg --config extensions.strip= strip -q 5')
c15d8f84343e localrepo: recreate phasecache if changelog was modified (issue4855)
Yuya Nishihara <yuya@tcha.org>
parents: 25290
diff changeset
   441
  ...     # shouldn't abort by "unknown revision '6'"
c15d8f84343e localrepo: recreate phasecache if changelog was modified (issue4855)
Yuya Nishihara <yuya@tcha.org>
parents: 25290
diff changeset
   442
  ...     runcommand(server, ['log', '-qr', 'draft()'])
33921
a4c1333b2eda tests: add blank output lines to test-commandserver
Augie Fackler <raf@durin42.com>
parents: 33773
diff changeset
   443
  ...     print('')
26405
c15d8f84343e localrepo: recreate phasecache if changelog was modified (issue4855)
Yuya Nishihara <yuya@tcha.org>
parents: 25290
diff changeset
   444
  *** runcommand log -qr draft()
c15d8f84343e localrepo: recreate phasecache if changelog was modified (issue4855)
Yuya Nishihara <yuya@tcha.org>
parents: 25290
diff changeset
   445
  4:7966c8e3734d
c15d8f84343e localrepo: recreate phasecache if changelog was modified (issue4855)
Yuya Nishihara <yuya@tcha.org>
parents: 25290
diff changeset
   446
  5:41f6602d1c4f
c15d8f84343e localrepo: recreate phasecache if changelog was modified (issue4855)
Yuya Nishihara <yuya@tcha.org>
parents: 25290
diff changeset
   447
  6:10501e202c35
c15d8f84343e localrepo: recreate phasecache if changelog was modified (issue4855)
Yuya Nishihara <yuya@tcha.org>
parents: 25290
diff changeset
   448
  *** runcommand log -qr draft()
c15d8f84343e localrepo: recreate phasecache if changelog was modified (issue4855)
Yuya Nishihara <yuya@tcha.org>
parents: 25290
diff changeset
   449
  4:7966c8e3734d
33921
a4c1333b2eda tests: add blank output lines to test-commandserver
Augie Fackler <raf@durin42.com>
parents: 33773
diff changeset
   450
  
26405
c15d8f84343e localrepo: recreate phasecache if changelog was modified (issue4855)
Yuya Nishihara <yuya@tcha.org>
parents: 25290
diff changeset
   451
c15d8f84343e localrepo: recreate phasecache if changelog was modified (issue4855)
Yuya Nishihara <yuya@tcha.org>
parents: 25290
diff changeset
   452
cache of phase roots should be invalidated on strip (issue3827):
c15d8f84343e localrepo: recreate phasecache if changelog was modified (issue4855)
Yuya Nishihara <yuya@tcha.org>
parents: 25290
diff changeset
   453
22568
78b99149ed8a test-commandserver: port test functions from .py to .t
Yuya Nishihara <yuya@tcha.org>
parents: 22567
diff changeset
   454
  >>> import os
33922
1a6707b43d05 tests: update test-commandserver to pass our import checker
Augie Fackler <raf@durin42.com>
parents: 33921
diff changeset
   455
  >>> from hgclient import check, readchannel, runcommand, sep
22568
78b99149ed8a test-commandserver: port test functions from .py to .t
Yuya Nishihara <yuya@tcha.org>
parents: 22567
diff changeset
   456
  >>> @check
78b99149ed8a test-commandserver: port test functions from .py to .t
Yuya Nishihara <yuya@tcha.org>
parents: 22567
diff changeset
   457
  ... def phasecacheafterstrip(server):
78b99149ed8a test-commandserver: port test functions from .py to .t
Yuya Nishihara <yuya@tcha.org>
parents: 22567
diff changeset
   458
  ...     readchannel(server)
78b99149ed8a test-commandserver: port test functions from .py to .t
Yuya Nishihara <yuya@tcha.org>
parents: 22567
diff changeset
   459
  ... 
78b99149ed8a test-commandserver: port test functions from .py to .t
Yuya Nishihara <yuya@tcha.org>
parents: 22567
diff changeset
   460
  ...     # create new head, 5:731265503d86
78b99149ed8a test-commandserver: port test functions from .py to .t
Yuya Nishihara <yuya@tcha.org>
parents: 22567
diff changeset
   461
  ...     runcommand(server, ['update', '-C', '0'])
78b99149ed8a test-commandserver: port test functions from .py to .t
Yuya Nishihara <yuya@tcha.org>
parents: 22567
diff changeset
   462
  ...     f = open('a', 'ab')
78b99149ed8a test-commandserver: port test functions from .py to .t
Yuya Nishihara <yuya@tcha.org>
parents: 22567
diff changeset
   463
  ...     f.write('a\n')
78b99149ed8a test-commandserver: port test functions from .py to .t
Yuya Nishihara <yuya@tcha.org>
parents: 22567
diff changeset
   464
  ...     f.close()
78b99149ed8a test-commandserver: port test functions from .py to .t
Yuya Nishihara <yuya@tcha.org>
parents: 22567
diff changeset
   465
  ...     runcommand(server, ['commit', '-Am.', 'a'])
78b99149ed8a test-commandserver: port test functions from .py to .t
Yuya Nishihara <yuya@tcha.org>
parents: 22567
diff changeset
   466
  ...     runcommand(server, ['log', '-Gq'])
78b99149ed8a test-commandserver: port test functions from .py to .t
Yuya Nishihara <yuya@tcha.org>
parents: 22567
diff changeset
   467
  ... 
78b99149ed8a test-commandserver: port test functions from .py to .t
Yuya Nishihara <yuya@tcha.org>
parents: 22567
diff changeset
   468
  ...     # 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
   469
  ...     runcommand(server, ['phase', '-p', '.'])
78b99149ed8a test-commandserver: port test functions from .py to .t
Yuya Nishihara <yuya@tcha.org>
parents: 22567
diff changeset
   470
  ...     # load _phasecache.phaseroots
78b99149ed8a test-commandserver: port test functions from .py to .t
Yuya Nishihara <yuya@tcha.org>
parents: 22567
diff changeset
   471
  ...     runcommand(server, ['phase', '.'], outfilter=sep)
78b99149ed8a test-commandserver: port test functions from .py to .t
Yuya Nishihara <yuya@tcha.org>
parents: 22567
diff changeset
   472
  ... 
78b99149ed8a test-commandserver: port test functions from .py to .t
Yuya Nishihara <yuya@tcha.org>
parents: 22567
diff changeset
   473
  ...     # strip 1::4 outside server
78b99149ed8a test-commandserver: port test functions from .py to .t
Yuya Nishihara <yuya@tcha.org>
parents: 22567
diff changeset
   474
  ...     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
   475
  ... 
78b99149ed8a test-commandserver: port test functions from .py to .t
Yuya Nishihara <yuya@tcha.org>
parents: 22567
diff changeset
   476
  ...     # 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
   477
  ...     runcommand(server, ['branches'])
22572
cc3d9f776632 test-commandserver: make runcommand message bolder
Yuya Nishihara <yuya@tcha.org>
parents: 22571
diff changeset
   478
  *** runcommand update -C 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
   479
  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
   480
  (leaving bookmark bm3)
22572
cc3d9f776632 test-commandserver: make runcommand message bolder
Yuya Nishihara <yuya@tcha.org>
parents: 22571
diff changeset
   481
  *** runcommand commit -Am. a
22567
f9a4a035003d test-commandserver: add stub for .t test by copying .out with 2-space indent
Yuya Nishihara <yuya@tcha.org>
parents:
diff changeset
   482
  created new head
22572
cc3d9f776632 test-commandserver: make runcommand message bolder
Yuya Nishihara <yuya@tcha.org>
parents: 22571
diff changeset
   483
  *** runcommand log -Gq
22567
f9a4a035003d test-commandserver: add stub for .t test by copying .out with 2-space indent
Yuya Nishihara <yuya@tcha.org>
parents:
diff changeset
   484
  @  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
   485
  |
f9a4a035003d test-commandserver: add stub for .t test by copying .out with 2-space indent
Yuya Nishihara <yuya@tcha.org>
parents:
diff changeset
   486
  | 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
   487
  | |
f9a4a035003d test-commandserver: add stub for .t test by copying .out with 2-space indent
Yuya Nishihara <yuya@tcha.org>
parents:
diff changeset
   488
  | 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
   489
  | |
f9a4a035003d test-commandserver: add stub for .t test by copying .out with 2-space indent
Yuya Nishihara <yuya@tcha.org>
parents:
diff changeset
   490
  | 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
   491
  | |
f9a4a035003d test-commandserver: add stub for .t test by copying .out with 2-space indent
Yuya Nishihara <yuya@tcha.org>
parents:
diff changeset
   492
  | 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
   493
  |/
f9a4a035003d test-commandserver: add stub for .t test by copying .out with 2-space indent
Yuya Nishihara <yuya@tcha.org>
parents:
diff changeset
   494
  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
   495
  
22572
cc3d9f776632 test-commandserver: make runcommand message bolder
Yuya Nishihara <yuya@tcha.org>
parents: 22571
diff changeset
   496
  *** runcommand phase -p .
cc3d9f776632 test-commandserver: make runcommand message bolder
Yuya Nishihara <yuya@tcha.org>
parents: 22571
diff changeset
   497
  *** runcommand phase .
22567
f9a4a035003d test-commandserver: add stub for .t test by copying .out with 2-space indent
Yuya Nishihara <yuya@tcha.org>
parents:
diff changeset
   498
  5: public
22572
cc3d9f776632 test-commandserver: make runcommand message bolder
Yuya Nishihara <yuya@tcha.org>
parents: 22571
diff changeset
   499
  *** runcommand 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
   500
  default                        1:731265503d86
22568
78b99149ed8a test-commandserver: port test functions from .py to .t
Yuya Nishihara <yuya@tcha.org>
parents: 22567
diff changeset
   501
26251
5c0f5db65c6b localrepo: refresh filecache stats only if transaction finished successfully
Yuya Nishihara <yuya@tcha.org>
parents: 26142
diff changeset
   502
in-memory cache must be reloaded if transaction is aborted. otherwise
5c0f5db65c6b localrepo: refresh filecache stats only if transaction finished successfully
Yuya Nishihara <yuya@tcha.org>
parents: 26142
diff changeset
   503
changelog and manifest would have invalid node:
5c0f5db65c6b localrepo: refresh filecache stats only if transaction finished successfully
Yuya Nishihara <yuya@tcha.org>
parents: 26142
diff changeset
   504
5c0f5db65c6b localrepo: refresh filecache stats only if transaction finished successfully
Yuya Nishihara <yuya@tcha.org>
parents: 26142
diff changeset
   505
  $ echo a >> a
33922
1a6707b43d05 tests: update test-commandserver to pass our import checker
Augie Fackler <raf@durin42.com>
parents: 33921
diff changeset
   506
  >>> from hgclient import check, readchannel, runcommand
26251
5c0f5db65c6b localrepo: refresh filecache stats only if transaction finished successfully
Yuya Nishihara <yuya@tcha.org>
parents: 26142
diff changeset
   507
  >>> @check
5c0f5db65c6b localrepo: refresh filecache stats only if transaction finished successfully
Yuya Nishihara <yuya@tcha.org>
parents: 26142
diff changeset
   508
  ... def txabort(server):
5c0f5db65c6b localrepo: refresh filecache stats only if transaction finished successfully
Yuya Nishihara <yuya@tcha.org>
parents: 26142
diff changeset
   509
  ...     readchannel(server)
5c0f5db65c6b localrepo: refresh filecache stats only if transaction finished successfully
Yuya Nishihara <yuya@tcha.org>
parents: 26142
diff changeset
   510
  ...     runcommand(server, ['commit', '--config', 'hooks.pretxncommit=false',
5c0f5db65c6b localrepo: refresh filecache stats only if transaction finished successfully
Yuya Nishihara <yuya@tcha.org>
parents: 26142
diff changeset
   511
  ...                         '-mfoo'])
5c0f5db65c6b localrepo: refresh filecache stats only if transaction finished successfully
Yuya Nishihara <yuya@tcha.org>
parents: 26142
diff changeset
   512
  ...     runcommand(server, ['verify'])
5c0f5db65c6b localrepo: refresh filecache stats only if transaction finished successfully
Yuya Nishihara <yuya@tcha.org>
parents: 26142
diff changeset
   513
  *** runcommand commit --config hooks.pretxncommit=false -mfoo
5c0f5db65c6b localrepo: refresh filecache stats only if transaction finished successfully
Yuya Nishihara <yuya@tcha.org>
parents: 26142
diff changeset
   514
  transaction abort!
5c0f5db65c6b localrepo: refresh filecache stats only if transaction finished successfully
Yuya Nishihara <yuya@tcha.org>
parents: 26142
diff changeset
   515
  rollback completed
5c0f5db65c6b localrepo: refresh filecache stats only if transaction finished successfully
Yuya Nishihara <yuya@tcha.org>
parents: 26142
diff changeset
   516
  abort: pretxncommit hook exited with status 1
5c0f5db65c6b localrepo: refresh filecache stats only if transaction finished successfully
Yuya Nishihara <yuya@tcha.org>
parents: 26142
diff changeset
   517
   [255]
5c0f5db65c6b localrepo: refresh filecache stats only if transaction finished successfully
Yuya Nishihara <yuya@tcha.org>
parents: 26142
diff changeset
   518
  *** runcommand verify
5c0f5db65c6b localrepo: refresh filecache stats only if transaction finished successfully
Yuya Nishihara <yuya@tcha.org>
parents: 26142
diff changeset
   519
  checking changesets
5c0f5db65c6b localrepo: refresh filecache stats only if transaction finished successfully
Yuya Nishihara <yuya@tcha.org>
parents: 26142
diff changeset
   520
  checking manifests
5c0f5db65c6b localrepo: refresh filecache stats only if transaction finished successfully
Yuya Nishihara <yuya@tcha.org>
parents: 26142
diff changeset
   521
  crosschecking files in changesets and manifests
5c0f5db65c6b localrepo: refresh filecache stats only if transaction finished successfully
Yuya Nishihara <yuya@tcha.org>
parents: 26142
diff changeset
   522
  checking files
5c0f5db65c6b localrepo: refresh filecache stats only if transaction finished successfully
Yuya Nishihara <yuya@tcha.org>
parents: 26142
diff changeset
   523
  1 files, 2 changesets, 2 total revisions
5c0f5db65c6b localrepo: refresh filecache stats only if transaction finished successfully
Yuya Nishihara <yuya@tcha.org>
parents: 26142
diff changeset
   524
  $ hg revert --no-backup -aq
5c0f5db65c6b localrepo: refresh filecache stats only if transaction finished successfully
Yuya Nishihara <yuya@tcha.org>
parents: 26142
diff changeset
   525
22955
fab9dda0f2a3 obsolete: update tests to use obsolete options
Durham Goode <durham@fb.com>
parents: 22783
diff changeset
   526
  $ cat >> .hg/hgrc << EOF
fab9dda0f2a3 obsolete: update tests to use obsolete options
Durham Goode <durham@fb.com>
parents: 22783
diff changeset
   527
  > [experimental]
34866
1644623ab096 config: use 'experimental.evolution.create-markers'
Boris Feld <boris.feld@octobus.net>
parents: 34852
diff changeset
   528
  > evolution.createmarkers=True
22568
78b99149ed8a test-commandserver: port test functions from .py to .t
Yuya Nishihara <yuya@tcha.org>
parents: 22567
diff changeset
   529
  > EOF
78b99149ed8a test-commandserver: port test functions from .py to .t
Yuya Nishihara <yuya@tcha.org>
parents: 22567
diff changeset
   530
78b99149ed8a test-commandserver: port test functions from .py to .t
Yuya Nishihara <yuya@tcha.org>
parents: 22567
diff changeset
   531
  >>> import os
33922
1a6707b43d05 tests: update test-commandserver to pass our import checker
Augie Fackler <raf@durin42.com>
parents: 33921
diff changeset
   532
  >>> from hgclient import check, readchannel, runcommand
22568
78b99149ed8a test-commandserver: port test functions from .py to .t
Yuya Nishihara <yuya@tcha.org>
parents: 22567
diff changeset
   533
  >>> @check
78b99149ed8a test-commandserver: port test functions from .py to .t
Yuya Nishihara <yuya@tcha.org>
parents: 22567
diff changeset
   534
  ... def obsolete(server):
78b99149ed8a test-commandserver: port test functions from .py to .t
Yuya Nishihara <yuya@tcha.org>
parents: 22567
diff changeset
   535
  ...     readchannel(server)
78b99149ed8a test-commandserver: port test functions from .py to .t
Yuya Nishihara <yuya@tcha.org>
parents: 22567
diff changeset
   536
  ... 
78b99149ed8a test-commandserver: port test functions from .py to .t
Yuya Nishihara <yuya@tcha.org>
parents: 22567
diff changeset
   537
  ...     runcommand(server, ['up', 'null'])
78b99149ed8a test-commandserver: port test functions from .py to .t
Yuya Nishihara <yuya@tcha.org>
parents: 22567
diff changeset
   538
  ...     runcommand(server, ['phase', '-df', 'tip'])
78b99149ed8a test-commandserver: port test functions from .py to .t
Yuya Nishihara <yuya@tcha.org>
parents: 22567
diff changeset
   539
  ...     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
   540
  ...     if os.name == 'nt':
78b99149ed8a test-commandserver: port test functions from .py to .t
Yuya Nishihara <yuya@tcha.org>
parents: 22567
diff changeset
   541
  ...         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
   542
  ...     os.system(cmd)
78b99149ed8a test-commandserver: port test functions from .py to .t
Yuya Nishihara <yuya@tcha.org>
parents: 22567
diff changeset
   543
  ...     runcommand(server, ['log', '--hidden'])
78b99149ed8a test-commandserver: port test functions from .py to .t
Yuya Nishihara <yuya@tcha.org>
parents: 22567
diff changeset
   544
  ...     runcommand(server, ['log'])
22572
cc3d9f776632 test-commandserver: make runcommand message bolder
Yuya Nishihara <yuya@tcha.org>
parents: 22571
diff changeset
   545
  *** runcommand up null
22567
f9a4a035003d test-commandserver: add stub for .t test by copying .out with 2-space indent
Yuya Nishihara <yuya@tcha.org>
parents:
diff changeset
   546
  0 files updated, 0 files merged, 1 files removed, 0 files unresolved
22572
cc3d9f776632 test-commandserver: make runcommand message bolder
Yuya Nishihara <yuya@tcha.org>
parents: 22571
diff changeset
   547
  *** runcommand phase -df tip
33542
b11e8c67fb0f debugobsolete: also report the number of obsoleted changesets
Boris Feld <boris.feld@octobus.net>
parents: 33426
diff changeset
   548
  obsoleted 1 changesets
22572
cc3d9f776632 test-commandserver: make runcommand message bolder
Yuya Nishihara <yuya@tcha.org>
parents: 22571
diff changeset
   549
  *** runcommand log --hidden
22567
f9a4a035003d test-commandserver: add stub for .t test by copying .out with 2-space indent
Yuya Nishihara <yuya@tcha.org>
parents:
diff changeset
   550
  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
   551
  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
   552
  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
   553
  date:        Thu Jan 01 00:00:00 1970 +0000
34900
3a3adbcbd3a0 obsfate: rename obsfate into obsolete in changeset_printer
Boris Feld <boris.feld@octobus.net>
parents: 34866
diff changeset
   554
  obsolete:    pruned
22567
f9a4a035003d test-commandserver: add stub for .t test by copying .out with 2-space indent
Yuya Nishihara <yuya@tcha.org>
parents:
diff changeset
   555
  summary:     .
f9a4a035003d test-commandserver: add stub for .t test by copying .out with 2-space indent
Yuya Nishihara <yuya@tcha.org>
parents:
diff changeset
   556
  
f9a4a035003d test-commandserver: add stub for .t test by copying .out with 2-space indent
Yuya Nishihara <yuya@tcha.org>
parents:
diff changeset
   557
  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
   558
  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
   559
  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
   560
  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
   561
  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
   562
  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
   563
  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
   564
  
22572
cc3d9f776632 test-commandserver: make runcommand message bolder
Yuya Nishihara <yuya@tcha.org>
parents: 22571
diff changeset
   565
  *** runcommand 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
   566
  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
   567
  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
   568
  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
   569
  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
   570
  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
   571
  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
   572
  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
   573
  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
   574
  
22568
78b99149ed8a test-commandserver: port test functions from .py to .t
Yuya Nishihara <yuya@tcha.org>
parents: 22567
diff changeset
   575
78b99149ed8a test-commandserver: port test functions from .py to .t
Yuya Nishihara <yuya@tcha.org>
parents: 22567
diff changeset
   576
  $ cat <<EOF >> .hg/hgrc
78b99149ed8a test-commandserver: port test functions from .py to .t
Yuya Nishihara <yuya@tcha.org>
parents: 22567
diff changeset
   577
  > [extensions]
78b99149ed8a test-commandserver: port test functions from .py to .t
Yuya Nishihara <yuya@tcha.org>
parents: 22567
diff changeset
   578
  > mq =
78b99149ed8a test-commandserver: port test functions from .py to .t
Yuya Nishihara <yuya@tcha.org>
parents: 22567
diff changeset
   579
  > EOF
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
  >>> import os
33922
1a6707b43d05 tests: update test-commandserver to pass our import checker
Augie Fackler <raf@durin42.com>
parents: 33921
diff changeset
   582
  >>> from hgclient import check, readchannel, runcommand
22568
78b99149ed8a test-commandserver: port test functions from .py to .t
Yuya Nishihara <yuya@tcha.org>
parents: 22567
diff changeset
   583
  >>> @check
78b99149ed8a test-commandserver: port test functions from .py to .t
Yuya Nishihara <yuya@tcha.org>
parents: 22567
diff changeset
   584
  ... def mqoutsidechanges(server):
78b99149ed8a test-commandserver: port test functions from .py to .t
Yuya Nishihara <yuya@tcha.org>
parents: 22567
diff changeset
   585
  ...     readchannel(server)
78b99149ed8a test-commandserver: port test functions from .py to .t
Yuya Nishihara <yuya@tcha.org>
parents: 22567
diff changeset
   586
  ... 
78b99149ed8a test-commandserver: port test functions from .py to .t
Yuya Nishihara <yuya@tcha.org>
parents: 22567
diff changeset
   587
  ...     # load repo.mq
78b99149ed8a test-commandserver: port test functions from .py to .t
Yuya Nishihara <yuya@tcha.org>
parents: 22567
diff changeset
   588
  ...     runcommand(server, ['qapplied'])
78b99149ed8a test-commandserver: port test functions from .py to .t
Yuya Nishihara <yuya@tcha.org>
parents: 22567
diff changeset
   589
  ...     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
   590
  ...     # repo.mq should be invalidated
78b99149ed8a test-commandserver: port test functions from .py to .t
Yuya Nishihara <yuya@tcha.org>
parents: 22567
diff changeset
   591
  ...     runcommand(server, ['qapplied'])
78b99149ed8a test-commandserver: port test functions from .py to .t
Yuya Nishihara <yuya@tcha.org>
parents: 22567
diff changeset
   592
  ... 
78b99149ed8a test-commandserver: port test functions from .py to .t
Yuya Nishihara <yuya@tcha.org>
parents: 22567
diff changeset
   593
  ...     runcommand(server, ['qpop', '--all'])
78b99149ed8a test-commandserver: port test functions from .py to .t
Yuya Nishihara <yuya@tcha.org>
parents: 22567
diff changeset
   594
  ...     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
   595
  ...     # 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
   596
  ...     runcommand(server, ['qqueue', '--active'])
22572
cc3d9f776632 test-commandserver: make runcommand message bolder
Yuya Nishihara <yuya@tcha.org>
parents: 22571
diff changeset
   597
  *** runcommand qapplied
cc3d9f776632 test-commandserver: make runcommand message bolder
Yuya Nishihara <yuya@tcha.org>
parents: 22571
diff changeset
   598
  *** runcommand qapplied
22567
f9a4a035003d test-commandserver: add stub for .t test by copying .out with 2-space indent
Yuya Nishihara <yuya@tcha.org>
parents:
diff changeset
   599
  0.diff
22572
cc3d9f776632 test-commandserver: make runcommand message bolder
Yuya Nishihara <yuya@tcha.org>
parents: 22571
diff changeset
   600
  *** runcommand qpop --all
22567
f9a4a035003d test-commandserver: add stub for .t test by copying .out with 2-space indent
Yuya Nishihara <yuya@tcha.org>
parents:
diff changeset
   601
  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
   602
  patch queue now empty
22572
cc3d9f776632 test-commandserver: make runcommand message bolder
Yuya Nishihara <yuya@tcha.org>
parents: 22571
diff changeset
   603
  *** runcommand 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
   604
  foo
22568
78b99149ed8a test-commandserver: port test functions from .py to .t
Yuya Nishihara <yuya@tcha.org>
parents: 22567
diff changeset
   605
78b99149ed8a test-commandserver: port test functions from .py to .t
Yuya Nishihara <yuya@tcha.org>
parents: 22567
diff changeset
   606
  $ cat <<EOF > dbgui.py
33922
1a6707b43d05 tests: update test-commandserver to pass our import checker
Augie Fackler <raf@durin42.com>
parents: 33921
diff changeset
   607
  > import os
1a6707b43d05 tests: update test-commandserver to pass our import checker
Augie Fackler <raf@durin42.com>
parents: 33921
diff changeset
   608
  > import sys
32337
46ba2cdda476 registrar: move cmdutil.command to registrar module (API)
Yuya Nishihara <yuya@tcha.org>
parents: 31010
diff changeset
   609
  > from mercurial import commands, registrar
22568
78b99149ed8a test-commandserver: port test functions from .py to .t
Yuya Nishihara <yuya@tcha.org>
parents: 22567
diff changeset
   610
  > cmdtable = {}
32337
46ba2cdda476 registrar: move cmdutil.command to registrar module (API)
Yuya Nishihara <yuya@tcha.org>
parents: 31010
diff changeset
   611
  > command = registrar.command(cmdtable)
33097
fce4ed2912bb py3: make sure commands name are bytes in tests
Pulkit Goyal <7895pulkit@gmail.com>
parents: 32414
diff changeset
   612
  > @command(b"debuggetpass", norepo=True)
22568
78b99149ed8a test-commandserver: port test functions from .py to .t
Yuya Nishihara <yuya@tcha.org>
parents: 22567
diff changeset
   613
  > def debuggetpass(ui):
78b99149ed8a test-commandserver: port test functions from .py to .t
Yuya Nishihara <yuya@tcha.org>
parents: 22567
diff changeset
   614
  >     ui.write("%s\\n" % ui.getpass())
33097
fce4ed2912bb py3: make sure commands name are bytes in tests
Pulkit Goyal <7895pulkit@gmail.com>
parents: 32414
diff changeset
   615
  > @command(b"debugprompt", norepo=True)
22783
524b786bd54f ui: disable echo back of prompt input if ui is set to non-tty purposely
Yuya Nishihara <yuya@tcha.org>
parents: 22572
diff changeset
   616
  > def debugprompt(ui):
524b786bd54f ui: disable echo back of prompt input if ui is set to non-tty purposely
Yuya Nishihara <yuya@tcha.org>
parents: 22572
diff changeset
   617
  >     ui.write("%s\\n" % ui.prompt("prompt:"))
33097
fce4ed2912bb py3: make sure commands name are bytes in tests
Pulkit Goyal <7895pulkit@gmail.com>
parents: 32414
diff changeset
   618
  > @command(b"debugreadstdin", norepo=True)
23324
69f86b937035 cmdserver: protect pipe server streams against corruption caused by direct io
Yuya Nishihara <yuya@tcha.org>
parents: 23322
diff changeset
   619
  > def debugreadstdin(ui):
69f86b937035 cmdserver: protect pipe server streams against corruption caused by direct io
Yuya Nishihara <yuya@tcha.org>
parents: 23322
diff changeset
   620
  >     ui.write("read: %r\n" % sys.stdin.read(1))
33097
fce4ed2912bb py3: make sure commands name are bytes in tests
Pulkit Goyal <7895pulkit@gmail.com>
parents: 32414
diff changeset
   621
  > @command(b"debugwritestdout", norepo=True)
23324
69f86b937035 cmdserver: protect pipe server streams against corruption caused by direct io
Yuya Nishihara <yuya@tcha.org>
parents: 23322
diff changeset
   622
  > def debugwritestdout(ui):
69f86b937035 cmdserver: protect pipe server streams against corruption caused by direct io
Yuya Nishihara <yuya@tcha.org>
parents: 23322
diff changeset
   623
  >     os.write(1, "low-level stdout fd and\n")
37220
7f78de1c93aa procutil: redirect ui.fout to stderr while stdio is protected
Yuya Nishihara <yuya@tcha.org>
parents: 37009
diff changeset
   624
  >     sys.stdout.write("stdout should be redirected to stderr\n")
23324
69f86b937035 cmdserver: protect pipe server streams against corruption caused by direct io
Yuya Nishihara <yuya@tcha.org>
parents: 23322
diff changeset
   625
  >     sys.stdout.flush()
22568
78b99149ed8a test-commandserver: port test functions from .py to .t
Yuya Nishihara <yuya@tcha.org>
parents: 22567
diff changeset
   626
  > EOF
78b99149ed8a test-commandserver: port test functions from .py to .t
Yuya Nishihara <yuya@tcha.org>
parents: 22567
diff changeset
   627
  $ cat <<EOF >> .hg/hgrc
78b99149ed8a test-commandserver: port test functions from .py to .t
Yuya Nishihara <yuya@tcha.org>
parents: 22567
diff changeset
   628
  > [extensions]
78b99149ed8a test-commandserver: port test functions from .py to .t
Yuya Nishihara <yuya@tcha.org>
parents: 22567
diff changeset
   629
  > dbgui = dbgui.py
78b99149ed8a test-commandserver: port test functions from .py to .t
Yuya Nishihara <yuya@tcha.org>
parents: 22567
diff changeset
   630
  > EOF
78b99149ed8a test-commandserver: port test functions from .py to .t
Yuya Nishihara <yuya@tcha.org>
parents: 22567
diff changeset
   631
33922
1a6707b43d05 tests: update test-commandserver to pass our import checker
Augie Fackler <raf@durin42.com>
parents: 33921
diff changeset
   632
  >>> from hgclient import check, readchannel, runcommand, stringio
22568
78b99149ed8a test-commandserver: port test functions from .py to .t
Yuya Nishihara <yuya@tcha.org>
parents: 22567
diff changeset
   633
  >>> @check
78b99149ed8a test-commandserver: port test functions from .py to .t
Yuya Nishihara <yuya@tcha.org>
parents: 22567
diff changeset
   634
  ... def getpass(server):
78b99149ed8a test-commandserver: port test functions from .py to .t
Yuya Nishihara <yuya@tcha.org>
parents: 22567
diff changeset
   635
  ...     readchannel(server)
78b99149ed8a test-commandserver: port test functions from .py to .t
Yuya Nishihara <yuya@tcha.org>
parents: 22567
diff changeset
   636
  ...     runcommand(server, ['debuggetpass', '--config',
78b99149ed8a test-commandserver: port test functions from .py to .t
Yuya Nishihara <yuya@tcha.org>
parents: 22567
diff changeset
   637
  ...                         'ui.interactive=True'],
28836
3f45488d70df test-commandserver: handle cStringIO.StringIO/io.StringIO divergence
timeless <timeless@mozdev.org>
parents: 28511
diff changeset
   638
  ...                input=stringio('1234\n'))
30814
b96c57c1f860 ui: check EOF of getpass() response read from command-server channel
Yuya Nishihara <yuya@tcha.org>
parents: 30363
diff changeset
   639
  ...     runcommand(server, ['debuggetpass', '--config',
b96c57c1f860 ui: check EOF of getpass() response read from command-server channel
Yuya Nishihara <yuya@tcha.org>
parents: 30363
diff changeset
   640
  ...                         'ui.interactive=True'],
b96c57c1f860 ui: check EOF of getpass() response read from command-server channel
Yuya Nishihara <yuya@tcha.org>
parents: 30363
diff changeset
   641
  ...                input=stringio('\n'))
b96c57c1f860 ui: check EOF of getpass() response read from command-server channel
Yuya Nishihara <yuya@tcha.org>
parents: 30363
diff changeset
   642
  ...     runcommand(server, ['debuggetpass', '--config',
b96c57c1f860 ui: check EOF of getpass() response read from command-server channel
Yuya Nishihara <yuya@tcha.org>
parents: 30363
diff changeset
   643
  ...                         'ui.interactive=True'],
b96c57c1f860 ui: check EOF of getpass() response read from command-server channel
Yuya Nishihara <yuya@tcha.org>
parents: 30363
diff changeset
   644
  ...                input=stringio(''))
22783
524b786bd54f ui: disable echo back of prompt input if ui is set to non-tty purposely
Yuya Nishihara <yuya@tcha.org>
parents: 22572
diff changeset
   645
  ...     runcommand(server, ['debugprompt', '--config',
524b786bd54f ui: disable echo back of prompt input if ui is set to non-tty purposely
Yuya Nishihara <yuya@tcha.org>
parents: 22572
diff changeset
   646
  ...                         'ui.interactive=True'],
28836
3f45488d70df test-commandserver: handle cStringIO.StringIO/io.StringIO divergence
timeless <timeless@mozdev.org>
parents: 28511
diff changeset
   647
  ...                input=stringio('5678\n'))
23324
69f86b937035 cmdserver: protect pipe server streams against corruption caused by direct io
Yuya Nishihara <yuya@tcha.org>
parents: 23322
diff changeset
   648
  ...     runcommand(server, ['debugreadstdin'])
69f86b937035 cmdserver: protect pipe server streams against corruption caused by direct io
Yuya Nishihara <yuya@tcha.org>
parents: 23322
diff changeset
   649
  ...     runcommand(server, ['debugwritestdout'])
22572
cc3d9f776632 test-commandserver: make runcommand message bolder
Yuya Nishihara <yuya@tcha.org>
parents: 22571
diff changeset
   650
  *** runcommand debuggetpass --config ui.interactive=True
22567
f9a4a035003d test-commandserver: add stub for .t test by copying .out with 2-space indent
Yuya Nishihara <yuya@tcha.org>
parents:
diff changeset
   651
  password: 1234
30814
b96c57c1f860 ui: check EOF of getpass() response read from command-server channel
Yuya Nishihara <yuya@tcha.org>
parents: 30363
diff changeset
   652
  *** runcommand debuggetpass --config ui.interactive=True
b96c57c1f860 ui: check EOF of getpass() response read from command-server channel
Yuya Nishihara <yuya@tcha.org>
parents: 30363
diff changeset
   653
  password: 
b96c57c1f860 ui: check EOF of getpass() response read from command-server channel
Yuya Nishihara <yuya@tcha.org>
parents: 30363
diff changeset
   654
  *** runcommand debuggetpass --config ui.interactive=True
b96c57c1f860 ui: check EOF of getpass() response read from command-server channel
Yuya Nishihara <yuya@tcha.org>
parents: 30363
diff changeset
   655
  password: abort: response expected
b96c57c1f860 ui: check EOF of getpass() response read from command-server channel
Yuya Nishihara <yuya@tcha.org>
parents: 30363
diff changeset
   656
   [255]
22783
524b786bd54f ui: disable echo back of prompt input if ui is set to non-tty purposely
Yuya Nishihara <yuya@tcha.org>
parents: 22572
diff changeset
   657
  *** runcommand debugprompt --config ui.interactive=True
524b786bd54f ui: disable echo back of prompt input if ui is set to non-tty purposely
Yuya Nishihara <yuya@tcha.org>
parents: 22572
diff changeset
   658
  prompt: 5678
23324
69f86b937035 cmdserver: protect pipe server streams against corruption caused by direct io
Yuya Nishihara <yuya@tcha.org>
parents: 23322
diff changeset
   659
  *** runcommand debugreadstdin
69f86b937035 cmdserver: protect pipe server streams against corruption caused by direct io
Yuya Nishihara <yuya@tcha.org>
parents: 23322
diff changeset
   660
  read: ''
69f86b937035 cmdserver: protect pipe server streams against corruption caused by direct io
Yuya Nishihara <yuya@tcha.org>
parents: 23322
diff changeset
   661
  *** runcommand debugwritestdout
37220
7f78de1c93aa procutil: redirect ui.fout to stderr while stdio is protected
Yuya Nishihara <yuya@tcha.org>
parents: 37009
diff changeset
   662
  low-level stdout fd and
7f78de1c93aa procutil: redirect ui.fout to stderr while stdio is protected
Yuya Nishihara <yuya@tcha.org>
parents: 37009
diff changeset
   663
  stdout should be redirected to stderr
22568
78b99149ed8a test-commandserver: port test functions from .py to .t
Yuya Nishihara <yuya@tcha.org>
parents: 22567
diff changeset
   664
78b99149ed8a test-commandserver: port test functions from .py to .t
Yuya Nishihara <yuya@tcha.org>
parents: 22567
diff changeset
   665
23322
000cfc8b3913 cmdserver: use given streams as pipe channels like other commands
Yuya Nishihara <yuya@tcha.org>
parents: 23095
diff changeset
   666
run commandserver in commandserver, which is silly but should work:
000cfc8b3913 cmdserver: use given streams as pipe channels like other commands
Yuya Nishihara <yuya@tcha.org>
parents: 23095
diff changeset
   667
29485
6a98f9408a50 py3: make files use absolute_import and print_function
Pulkit Goyal <7895pulkit@gmail.com>
parents: 28996
diff changeset
   668
  >>> from __future__ import print_function
33922
1a6707b43d05 tests: update test-commandserver to pass our import checker
Augie Fackler <raf@durin42.com>
parents: 33921
diff changeset
   669
  >>> from hgclient import check, readchannel, runcommand, stringio
23322
000cfc8b3913 cmdserver: use given streams as pipe channels like other commands
Yuya Nishihara <yuya@tcha.org>
parents: 23095
diff changeset
   670
  >>> @check
000cfc8b3913 cmdserver: use given streams as pipe channels like other commands
Yuya Nishihara <yuya@tcha.org>
parents: 23095
diff changeset
   671
  ... def nested(server):
29485
6a98f9408a50 py3: make files use absolute_import and print_function
Pulkit Goyal <7895pulkit@gmail.com>
parents: 28996
diff changeset
   672
  ...     print('%c, %r' % readchannel(server))
23322
000cfc8b3913 cmdserver: use given streams as pipe channels like other commands
Yuya Nishihara <yuya@tcha.org>
parents: 23095
diff changeset
   673
  ...     class nestedserver(object):
28836
3f45488d70df test-commandserver: handle cStringIO.StringIO/io.StringIO divergence
timeless <timeless@mozdev.org>
parents: 28511
diff changeset
   674
  ...         stdin = stringio('getencoding\n')
3f45488d70df test-commandserver: handle cStringIO.StringIO/io.StringIO divergence
timeless <timeless@mozdev.org>
parents: 28511
diff changeset
   675
  ...         stdout = stringio()
23322
000cfc8b3913 cmdserver: use given streams as pipe channels like other commands
Yuya Nishihara <yuya@tcha.org>
parents: 23095
diff changeset
   676
  ...     runcommand(server, ['serve', '--cmdserver', 'pipe'],
000cfc8b3913 cmdserver: use given streams as pipe channels like other commands
Yuya Nishihara <yuya@tcha.org>
parents: 23095
diff changeset
   677
  ...                output=nestedserver.stdout, input=nestedserver.stdin)
000cfc8b3913 cmdserver: use given streams as pipe channels like other commands
Yuya Nishihara <yuya@tcha.org>
parents: 23095
diff changeset
   678
  ...     nestedserver.stdout.seek(0)
29485
6a98f9408a50 py3: make files use absolute_import and print_function
Pulkit Goyal <7895pulkit@gmail.com>
parents: 28996
diff changeset
   679
  ...     print('%c, %r' % readchannel(nestedserver))  # hello
6a98f9408a50 py3: make files use absolute_import and print_function
Pulkit Goyal <7895pulkit@gmail.com>
parents: 28996
diff changeset
   680
  ...     print('%c, %r' % readchannel(nestedserver))  # getencoding
23322
000cfc8b3913 cmdserver: use given streams as pipe channels like other commands
Yuya Nishihara <yuya@tcha.org>
parents: 23095
diff changeset
   681
  o, 'capabilities: getencoding runcommand\nencoding: *\npid: *' (glob)
000cfc8b3913 cmdserver: use given streams as pipe channels like other commands
Yuya Nishihara <yuya@tcha.org>
parents: 23095
diff changeset
   682
  *** runcommand serve --cmdserver pipe
000cfc8b3913 cmdserver: use given streams as pipe channels like other commands
Yuya Nishihara <yuya@tcha.org>
parents: 23095
diff changeset
   683
  o, 'capabilities: getencoding runcommand\nencoding: *\npid: *' (glob)
000cfc8b3913 cmdserver: use given streams as pipe channels like other commands
Yuya Nishihara <yuya@tcha.org>
parents: 23095
diff changeset
   684
  r, '*' (glob)
22568
78b99149ed8a test-commandserver: port test functions from .py to .t
Yuya Nishihara <yuya@tcha.org>
parents: 22567
diff changeset
   685
78b99149ed8a test-commandserver: port test functions from .py to .t
Yuya Nishihara <yuya@tcha.org>
parents: 22567
diff changeset
   686
78b99149ed8a test-commandserver: port test functions from .py to .t
Yuya Nishihara <yuya@tcha.org>
parents: 22567
diff changeset
   687
start without repository:
78b99149ed8a test-commandserver: port test functions from .py to .t
Yuya Nishihara <yuya@tcha.org>
parents: 22567
diff changeset
   688
78b99149ed8a test-commandserver: port test functions from .py to .t
Yuya Nishihara <yuya@tcha.org>
parents: 22567
diff changeset
   689
  $ cd ..
78b99149ed8a test-commandserver: port test functions from .py to .t
Yuya Nishihara <yuya@tcha.org>
parents: 22567
diff changeset
   690
29485
6a98f9408a50 py3: make files use absolute_import and print_function
Pulkit Goyal <7895pulkit@gmail.com>
parents: 28996
diff changeset
   691
  >>> from __future__ import print_function
33922
1a6707b43d05 tests: update test-commandserver to pass our import checker
Augie Fackler <raf@durin42.com>
parents: 33921
diff changeset
   692
  >>> from hgclient import check, readchannel, runcommand
22568
78b99149ed8a test-commandserver: port test functions from .py to .t
Yuya Nishihara <yuya@tcha.org>
parents: 22567
diff changeset
   693
  >>> @check
78b99149ed8a test-commandserver: port test functions from .py to .t
Yuya Nishihara <yuya@tcha.org>
parents: 22567
diff changeset
   694
  ... def hellomessage(server):
78b99149ed8a test-commandserver: port test functions from .py to .t
Yuya Nishihara <yuya@tcha.org>
parents: 22567
diff changeset
   695
  ...     ch, data = readchannel(server)
29485
6a98f9408a50 py3: make files use absolute_import and print_function
Pulkit Goyal <7895pulkit@gmail.com>
parents: 28996
diff changeset
   696
  ...     print('%c, %r' % (ch, data))
22568
78b99149ed8a test-commandserver: port test functions from .py to .t
Yuya Nishihara <yuya@tcha.org>
parents: 22567
diff changeset
   697
  ...     # 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
   698
  ...     # 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
   699
  ...     runcommand(server, ['id'])
23036
19f5273c9f3e cmdserver: include pid of server handling requests in hello message
Yuya Nishihara <yuya@tcha.org>
parents: 22994
diff changeset
   700
  o, 'capabilities: getencoding runcommand\nencoding: *\npid: *' (glob)
22572
cc3d9f776632 test-commandserver: make runcommand message bolder
Yuya Nishihara <yuya@tcha.org>
parents: 22571
diff changeset
   701
  *** runcommand 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
   702
  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
   703
   [255]
22568
78b99149ed8a test-commandserver: port test functions from .py to .t
Yuya Nishihara <yuya@tcha.org>
parents: 22567
diff changeset
   704
33922
1a6707b43d05 tests: update test-commandserver to pass our import checker
Augie Fackler <raf@durin42.com>
parents: 33921
diff changeset
   705
  >>> from hgclient import check, readchannel, runcommand
22568
78b99149ed8a test-commandserver: port test functions from .py to .t
Yuya Nishihara <yuya@tcha.org>
parents: 22567
diff changeset
   706
  >>> @check
78b99149ed8a test-commandserver: port test functions from .py to .t
Yuya Nishihara <yuya@tcha.org>
parents: 22567
diff changeset
   707
  ... def startwithoutrepo(server):
78b99149ed8a test-commandserver: port test functions from .py to .t
Yuya Nishihara <yuya@tcha.org>
parents: 22567
diff changeset
   708
  ...     readchannel(server)
78b99149ed8a test-commandserver: port test functions from .py to .t
Yuya Nishihara <yuya@tcha.org>
parents: 22567
diff changeset
   709
  ...     runcommand(server, ['init', 'repo2'])
78b99149ed8a test-commandserver: port test functions from .py to .t
Yuya Nishihara <yuya@tcha.org>
parents: 22567
diff changeset
   710
  ...     runcommand(server, ['id', '-R', 'repo2'])
22572
cc3d9f776632 test-commandserver: make runcommand message bolder
Yuya Nishihara <yuya@tcha.org>
parents: 22571
diff changeset
   711
  *** runcommand init repo2
cc3d9f776632 test-commandserver: make runcommand message bolder
Yuya Nishihara <yuya@tcha.org>
parents: 22571
diff changeset
   712
  *** runcommand 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
   713
  000000000000 tip
22994
840be5ca03e1 cmdserver: add service that listens on unix domain socket and forks process
Yuya Nishihara <yuya@tcha.org>
parents: 22955
diff changeset
   714
840be5ca03e1 cmdserver: add service that listens on unix domain socket and forks process
Yuya Nishihara <yuya@tcha.org>
parents: 22955
diff changeset
   715
26142
7332bf4ae959 dispatch: error out on invalid -R path even if optionalrepo (issue4805) (BC)
Yuya Nishihara <yuya@tcha.org>
parents: 25290
diff changeset
   716
don't fall back to cwd if invalid -R path is specified (issue4805):
7332bf4ae959 dispatch: error out on invalid -R path even if optionalrepo (issue4805) (BC)
Yuya Nishihara <yuya@tcha.org>
parents: 25290
diff changeset
   717
7332bf4ae959 dispatch: error out on invalid -R path even if optionalrepo (issue4805) (BC)
Yuya Nishihara <yuya@tcha.org>
parents: 25290
diff changeset
   718
  $ cd repo
7332bf4ae959 dispatch: error out on invalid -R path even if optionalrepo (issue4805) (BC)
Yuya Nishihara <yuya@tcha.org>
parents: 25290
diff changeset
   719
  $ hg serve --cmdserver pipe -R ../nonexistent
7332bf4ae959 dispatch: error out on invalid -R path even if optionalrepo (issue4805) (BC)
Yuya Nishihara <yuya@tcha.org>
parents: 25290
diff changeset
   720
  abort: repository ../nonexistent not found!
7332bf4ae959 dispatch: error out on invalid -R path even if optionalrepo (issue4805) (BC)
Yuya Nishihara <yuya@tcha.org>
parents: 25290
diff changeset
   721
  [255]
7332bf4ae959 dispatch: error out on invalid -R path even if optionalrepo (issue4805) (BC)
Yuya Nishihara <yuya@tcha.org>
parents: 25290
diff changeset
   722
  $ cd ..
7332bf4ae959 dispatch: error out on invalid -R path even if optionalrepo (issue4805) (BC)
Yuya Nishihara <yuya@tcha.org>
parents: 25290
diff changeset
   723
7332bf4ae959 dispatch: error out on invalid -R path even if optionalrepo (issue4805) (BC)
Yuya Nishihara <yuya@tcha.org>
parents: 25290
diff changeset
   724
22994
840be5ca03e1 cmdserver: add service that listens on unix domain socket and forks process
Yuya Nishihara <yuya@tcha.org>
parents: 22955
diff changeset
   725
unix domain socket:
840be5ca03e1 cmdserver: add service that listens on unix domain socket and forks process
Yuya Nishihara <yuya@tcha.org>
parents: 22955
diff changeset
   726
840be5ca03e1 cmdserver: add service that listens on unix domain socket and forks process
Yuya Nishihara <yuya@tcha.org>
parents: 22955
diff changeset
   727
  $ cd repo
840be5ca03e1 cmdserver: add service that listens on unix domain socket and forks process
Yuya Nishihara <yuya@tcha.org>
parents: 22955
diff changeset
   728
  $ hg update -q
840be5ca03e1 cmdserver: add service that listens on unix domain socket and forks process
Yuya Nishihara <yuya@tcha.org>
parents: 22955
diff changeset
   729
23095
ac827031fe05 tests: don't try to test unix sockets on vfat
Matt Mackall <mpm@selenic.com>
parents: 23053
diff changeset
   730
#if unix-socket unix-permissions
22994
840be5ca03e1 cmdserver: add service that listens on unix domain socket and forks process
Yuya Nishihara <yuya@tcha.org>
parents: 22955
diff changeset
   731
29485
6a98f9408a50 py3: make files use absolute_import and print_function
Pulkit Goyal <7895pulkit@gmail.com>
parents: 28996
diff changeset
   732
  >>> from __future__ import print_function
33922
1a6707b43d05 tests: update test-commandserver to pass our import checker
Augie Fackler <raf@durin42.com>
parents: 33921
diff changeset
   733
  >>> from hgclient import check, readchannel, runcommand, stringio, unixserver
22994
840be5ca03e1 cmdserver: add service that listens on unix domain socket and forks process
Yuya Nishihara <yuya@tcha.org>
parents: 22955
diff changeset
   734
  >>> server = unixserver('.hg/server.sock', '.hg/server.log')
840be5ca03e1 cmdserver: add service that listens on unix domain socket and forks process
Yuya Nishihara <yuya@tcha.org>
parents: 22955
diff changeset
   735
  >>> def hellomessage(conn):
840be5ca03e1 cmdserver: add service that listens on unix domain socket and forks process
Yuya Nishihara <yuya@tcha.org>
parents: 22955
diff changeset
   736
  ...     ch, data = readchannel(conn)
29485
6a98f9408a50 py3: make files use absolute_import and print_function
Pulkit Goyal <7895pulkit@gmail.com>
parents: 28996
diff changeset
   737
  ...     print('%c, %r' % (ch, data))
22994
840be5ca03e1 cmdserver: add service that listens on unix domain socket and forks process
Yuya Nishihara <yuya@tcha.org>
parents: 22955
diff changeset
   738
  ...     runcommand(conn, ['id'])
840be5ca03e1 cmdserver: add service that listens on unix domain socket and forks process
Yuya Nishihara <yuya@tcha.org>
parents: 22955
diff changeset
   739
  >>> check(hellomessage, server.connect)
23036
19f5273c9f3e cmdserver: include pid of server handling requests in hello message
Yuya Nishihara <yuya@tcha.org>
parents: 22994
diff changeset
   740
  o, 'capabilities: getencoding runcommand\nencoding: *\npid: *' (glob)
22994
840be5ca03e1 cmdserver: add service that listens on unix domain socket and forks process
Yuya Nishihara <yuya@tcha.org>
parents: 22955
diff changeset
   741
  *** runcommand id
840be5ca03e1 cmdserver: add service that listens on unix domain socket and forks process
Yuya Nishihara <yuya@tcha.org>
parents: 22955
diff changeset
   742
  eff892de26ec tip bm1/bm2/bm3
840be5ca03e1 cmdserver: add service that listens on unix domain socket and forks process
Yuya Nishihara <yuya@tcha.org>
parents: 22955
diff changeset
   743
  >>> def unknowncommand(conn):
840be5ca03e1 cmdserver: add service that listens on unix domain socket and forks process
Yuya Nishihara <yuya@tcha.org>
parents: 22955
diff changeset
   744
  ...     readchannel(conn)
840be5ca03e1 cmdserver: add service that listens on unix domain socket and forks process
Yuya Nishihara <yuya@tcha.org>
parents: 22955
diff changeset
   745
  ...     conn.stdin.write('unknowncommand\n')
840be5ca03e1 cmdserver: add service that listens on unix domain socket and forks process
Yuya Nishihara <yuya@tcha.org>
parents: 22955
diff changeset
   746
  >>> check(unknowncommand, server.connect)  # error sent to server.log
840be5ca03e1 cmdserver: add service that listens on unix domain socket and forks process
Yuya Nishihara <yuya@tcha.org>
parents: 22955
diff changeset
   747
  >>> def serverinput(conn):
840be5ca03e1 cmdserver: add service that listens on unix domain socket and forks process
Yuya Nishihara <yuya@tcha.org>
parents: 22955
diff changeset
   748
  ...     readchannel(conn)
840be5ca03e1 cmdserver: add service that listens on unix domain socket and forks process
Yuya Nishihara <yuya@tcha.org>
parents: 22955
diff changeset
   749
  ...     patch = """
840be5ca03e1 cmdserver: add service that listens on unix domain socket and forks process
Yuya Nishihara <yuya@tcha.org>
parents: 22955
diff changeset
   750
  ... # HG changeset patch
840be5ca03e1 cmdserver: add service that listens on unix domain socket and forks process
Yuya Nishihara <yuya@tcha.org>
parents: 22955
diff changeset
   751
  ... # User test
840be5ca03e1 cmdserver: add service that listens on unix domain socket and forks process
Yuya Nishihara <yuya@tcha.org>
parents: 22955
diff changeset
   752
  ... # Date 0 0
840be5ca03e1 cmdserver: add service that listens on unix domain socket and forks process
Yuya Nishihara <yuya@tcha.org>
parents: 22955
diff changeset
   753
  ... 2
840be5ca03e1 cmdserver: add service that listens on unix domain socket and forks process
Yuya Nishihara <yuya@tcha.org>
parents: 22955
diff changeset
   754
  ... 
840be5ca03e1 cmdserver: add service that listens on unix domain socket and forks process
Yuya Nishihara <yuya@tcha.org>
parents: 22955
diff changeset
   755
  ... diff -r eff892de26ec -r 1ed24be7e7a0 a
840be5ca03e1 cmdserver: add service that listens on unix domain socket and forks process
Yuya Nishihara <yuya@tcha.org>
parents: 22955
diff changeset
   756
  ... --- a/a
840be5ca03e1 cmdserver: add service that listens on unix domain socket and forks process
Yuya Nishihara <yuya@tcha.org>
parents: 22955
diff changeset
   757
  ... +++ b/a
840be5ca03e1 cmdserver: add service that listens on unix domain socket and forks process
Yuya Nishihara <yuya@tcha.org>
parents: 22955
diff changeset
   758
  ... @@ -1,1 +1,2 @@
840be5ca03e1 cmdserver: add service that listens on unix domain socket and forks process
Yuya Nishihara <yuya@tcha.org>
parents: 22955
diff changeset
   759
  ...  1
840be5ca03e1 cmdserver: add service that listens on unix domain socket and forks process
Yuya Nishihara <yuya@tcha.org>
parents: 22955
diff changeset
   760
  ... +2
840be5ca03e1 cmdserver: add service that listens on unix domain socket and forks process
Yuya Nishihara <yuya@tcha.org>
parents: 22955
diff changeset
   761
  ... """
28836
3f45488d70df test-commandserver: handle cStringIO.StringIO/io.StringIO divergence
timeless <timeless@mozdev.org>
parents: 28511
diff changeset
   762
  ...     runcommand(conn, ['import', '-'], input=stringio(patch))
22994
840be5ca03e1 cmdserver: add service that listens on unix domain socket and forks process
Yuya Nishihara <yuya@tcha.org>
parents: 22955
diff changeset
   763
  ...     runcommand(conn, ['log', '-rtip', '-q'])
840be5ca03e1 cmdserver: add service that listens on unix domain socket and forks process
Yuya Nishihara <yuya@tcha.org>
parents: 22955
diff changeset
   764
  >>> check(serverinput, server.connect)
840be5ca03e1 cmdserver: add service that listens on unix domain socket and forks process
Yuya Nishihara <yuya@tcha.org>
parents: 22955
diff changeset
   765
  *** runcommand import -
840be5ca03e1 cmdserver: add service that listens on unix domain socket and forks process
Yuya Nishihara <yuya@tcha.org>
parents: 22955
diff changeset
   766
  applying patch from stdin
840be5ca03e1 cmdserver: add service that listens on unix domain socket and forks process
Yuya Nishihara <yuya@tcha.org>
parents: 22955
diff changeset
   767
  *** runcommand log -rtip -q
840be5ca03e1 cmdserver: add service that listens on unix domain socket and forks process
Yuya Nishihara <yuya@tcha.org>
parents: 22955
diff changeset
   768
  2:1ed24be7e7a0
840be5ca03e1 cmdserver: add service that listens on unix domain socket and forks process
Yuya Nishihara <yuya@tcha.org>
parents: 22955
diff changeset
   769
  >>> server.shutdown()
840be5ca03e1 cmdserver: add service that listens on unix domain socket and forks process
Yuya Nishihara <yuya@tcha.org>
parents: 22955
diff changeset
   770
840be5ca03e1 cmdserver: add service that listens on unix domain socket and forks process
Yuya Nishihara <yuya@tcha.org>
parents: 22955
diff changeset
   771
  $ cat .hg/server.log
840be5ca03e1 cmdserver: add service that listens on unix domain socket and forks process
Yuya Nishihara <yuya@tcha.org>
parents: 22955
diff changeset
   772
  listening at .hg/server.sock
840be5ca03e1 cmdserver: add service that listens on unix domain socket and forks process
Yuya Nishihara <yuya@tcha.org>
parents: 22955
diff changeset
   773
  abort: unknown command unknowncommand
840be5ca03e1 cmdserver: add service that listens on unix domain socket and forks process
Yuya Nishihara <yuya@tcha.org>
parents: 22955
diff changeset
   774
  killed!
28511
ff5f923fca3c cmdserver: write early exception to 'e' channel in 'unix' mode
Yuya Nishihara <yuya@tcha.org>
parents: 28265
diff changeset
   775
  $ rm .hg/server.log
ff5f923fca3c cmdserver: write early exception to 'e' channel in 'unix' mode
Yuya Nishihara <yuya@tcha.org>
parents: 28265
diff changeset
   776
ff5f923fca3c cmdserver: write early exception to 'e' channel in 'unix' mode
Yuya Nishihara <yuya@tcha.org>
parents: 28265
diff changeset
   777
 if server crashed before hello, traceback will be sent to 'e' channel as
ff5f923fca3c cmdserver: write early exception to 'e' channel in 'unix' mode
Yuya Nishihara <yuya@tcha.org>
parents: 28265
diff changeset
   778
 last ditch:
ff5f923fca3c cmdserver: write early exception to 'e' channel in 'unix' mode
Yuya Nishihara <yuya@tcha.org>
parents: 28265
diff changeset
   779
ff5f923fca3c cmdserver: write early exception to 'e' channel in 'unix' mode
Yuya Nishihara <yuya@tcha.org>
parents: 28265
diff changeset
   780
  $ cat <<EOF >> .hg/hgrc
ff5f923fca3c cmdserver: write early exception to 'e' channel in 'unix' mode
Yuya Nishihara <yuya@tcha.org>
parents: 28265
diff changeset
   781
  > [cmdserver]
ff5f923fca3c cmdserver: write early exception to 'e' channel in 'unix' mode
Yuya Nishihara <yuya@tcha.org>
parents: 28265
diff changeset
   782
  > log = inexistent/path.log
ff5f923fca3c cmdserver: write early exception to 'e' channel in 'unix' mode
Yuya Nishihara <yuya@tcha.org>
parents: 28265
diff changeset
   783
  > EOF
29485
6a98f9408a50 py3: make files use absolute_import and print_function
Pulkit Goyal <7895pulkit@gmail.com>
parents: 28996
diff changeset
   784
  >>> from __future__ import print_function
33922
1a6707b43d05 tests: update test-commandserver to pass our import checker
Augie Fackler <raf@durin42.com>
parents: 33921
diff changeset
   785
  >>> from hgclient import check, readchannel, unixserver
28511
ff5f923fca3c cmdserver: write early exception to 'e' channel in 'unix' mode
Yuya Nishihara <yuya@tcha.org>
parents: 28265
diff changeset
   786
  >>> server = unixserver('.hg/server.sock', '.hg/server.log')
ff5f923fca3c cmdserver: write early exception to 'e' channel in 'unix' mode
Yuya Nishihara <yuya@tcha.org>
parents: 28265
diff changeset
   787
  >>> def earlycrash(conn):
ff5f923fca3c cmdserver: write early exception to 'e' channel in 'unix' mode
Yuya Nishihara <yuya@tcha.org>
parents: 28265
diff changeset
   788
  ...     while True:
ff5f923fca3c cmdserver: write early exception to 'e' channel in 'unix' mode
Yuya Nishihara <yuya@tcha.org>
parents: 28265
diff changeset
   789
  ...         try:
ff5f923fca3c cmdserver: write early exception to 'e' channel in 'unix' mode
Yuya Nishihara <yuya@tcha.org>
parents: 28265
diff changeset
   790
  ...             ch, data = readchannel(conn)
ff5f923fca3c cmdserver: write early exception to 'e' channel in 'unix' mode
Yuya Nishihara <yuya@tcha.org>
parents: 28265
diff changeset
   791
  ...             if not data.startswith('  '):
29485
6a98f9408a50 py3: make files use absolute_import and print_function
Pulkit Goyal <7895pulkit@gmail.com>
parents: 28996
diff changeset
   792
  ...                 print('%c, %r' % (ch, data))
28511
ff5f923fca3c cmdserver: write early exception to 'e' channel in 'unix' mode
Yuya Nishihara <yuya@tcha.org>
parents: 28265
diff changeset
   793
  ...         except EOFError:
ff5f923fca3c cmdserver: write early exception to 'e' channel in 'unix' mode
Yuya Nishihara <yuya@tcha.org>
parents: 28265
diff changeset
   794
  ...             break
ff5f923fca3c cmdserver: write early exception to 'e' channel in 'unix' mode
Yuya Nishihara <yuya@tcha.org>
parents: 28265
diff changeset
   795
  >>> check(earlycrash, server.connect)
ff5f923fca3c cmdserver: write early exception to 'e' channel in 'unix' mode
Yuya Nishihara <yuya@tcha.org>
parents: 28265
diff changeset
   796
  e, 'Traceback (most recent call last):\n'
ff5f923fca3c cmdserver: write early exception to 'e' channel in 'unix' mode
Yuya Nishihara <yuya@tcha.org>
parents: 28265
diff changeset
   797
  e, "IOError: *" (glob)
ff5f923fca3c cmdserver: write early exception to 'e' channel in 'unix' mode
Yuya Nishihara <yuya@tcha.org>
parents: 28265
diff changeset
   798
  >>> server.shutdown()
ff5f923fca3c cmdserver: write early exception to 'e' channel in 'unix' mode
Yuya Nishihara <yuya@tcha.org>
parents: 28265
diff changeset
   799
ff5f923fca3c cmdserver: write early exception to 'e' channel in 'unix' mode
Yuya Nishihara <yuya@tcha.org>
parents: 28265
diff changeset
   800
  $ cat .hg/server.log | grep -v '^  '
ff5f923fca3c cmdserver: write early exception to 'e' channel in 'unix' mode
Yuya Nishihara <yuya@tcha.org>
parents: 28265
diff changeset
   801
  listening at .hg/server.sock
ff5f923fca3c cmdserver: write early exception to 'e' channel in 'unix' mode
Yuya Nishihara <yuya@tcha.org>
parents: 28265
diff changeset
   802
  Traceback (most recent call last):
ff5f923fca3c cmdserver: write early exception to 'e' channel in 'unix' mode
Yuya Nishihara <yuya@tcha.org>
parents: 28265
diff changeset
   803
  IOError: * (glob)
ff5f923fca3c cmdserver: write early exception to 'e' channel in 'unix' mode
Yuya Nishihara <yuya@tcha.org>
parents: 28265
diff changeset
   804
  killed!
23095
ac827031fe05 tests: don't try to test unix sockets on vfat
Matt Mackall <mpm@selenic.com>
parents: 23053
diff changeset
   805
#endif
ac827031fe05 tests: don't try to test unix sockets on vfat
Matt Mackall <mpm@selenic.com>
parents: 23053
diff changeset
   806
#if no-unix-socket
22994
840be5ca03e1 cmdserver: add service that listens on unix domain socket and forks process
Yuya Nishihara <yuya@tcha.org>
parents: 22955
diff changeset
   807
840be5ca03e1 cmdserver: add service that listens on unix domain socket and forks process
Yuya Nishihara <yuya@tcha.org>
parents: 22955
diff changeset
   808
  $ hg serve --cmdserver unix -a .hg/server.sock
840be5ca03e1 cmdserver: add service that listens on unix domain socket and forks process
Yuya Nishihara <yuya@tcha.org>
parents: 22955
diff changeset
   809
  abort: unsupported platform
840be5ca03e1 cmdserver: add service that listens on unix domain socket and forks process
Yuya Nishihara <yuya@tcha.org>
parents: 22955
diff changeset
   810
  [255]
840be5ca03e1 cmdserver: add service that listens on unix domain socket and forks process
Yuya Nishihara <yuya@tcha.org>
parents: 22955
diff changeset
   811
840be5ca03e1 cmdserver: add service that listens on unix domain socket and forks process
Yuya Nishihara <yuya@tcha.org>
parents: 22955
diff changeset
   812
#endif
28265
332926212ef8 repoview: discard filtered changelog if index isn't shared with unfiltered
FUJIWARA Katsunori <foozy@lares.dti.ne.jp>
parents: 26431
diff changeset
   813
332926212ef8 repoview: discard filtered changelog if index isn't shared with unfiltered
FUJIWARA Katsunori <foozy@lares.dti.ne.jp>
parents: 26431
diff changeset
   814
  $ cd ..
332926212ef8 repoview: discard filtered changelog if index isn't shared with unfiltered
FUJIWARA Katsunori <foozy@lares.dti.ne.jp>
parents: 26431
diff changeset
   815
332926212ef8 repoview: discard filtered changelog if index isn't shared with unfiltered
FUJIWARA Katsunori <foozy@lares.dti.ne.jp>
parents: 26431
diff changeset
   816
Test that accessing to invalid changelog cache is avoided at
332926212ef8 repoview: discard filtered changelog if index isn't shared with unfiltered
FUJIWARA Katsunori <foozy@lares.dti.ne.jp>
parents: 26431
diff changeset
   817
subsequent operations even if repo object is reused even after failure
332926212ef8 repoview: discard filtered changelog if index isn't shared with unfiltered
FUJIWARA Katsunori <foozy@lares.dti.ne.jp>
parents: 26431
diff changeset
   818
of transaction (see 0a7610758c42 also)
332926212ef8 repoview: discard filtered changelog if index isn't shared with unfiltered
FUJIWARA Katsunori <foozy@lares.dti.ne.jp>
parents: 26431
diff changeset
   819
332926212ef8 repoview: discard filtered changelog if index isn't shared with unfiltered
FUJIWARA Katsunori <foozy@lares.dti.ne.jp>
parents: 26431
diff changeset
   820
"hg log" after failure of transaction is needed to detect invalid
332926212ef8 repoview: discard filtered changelog if index isn't shared with unfiltered
FUJIWARA Katsunori <foozy@lares.dti.ne.jp>
parents: 26431
diff changeset
   821
cache in repoview: this can't detect by "hg verify" only.
332926212ef8 repoview: discard filtered changelog if index isn't shared with unfiltered
FUJIWARA Katsunori <foozy@lares.dti.ne.jp>
parents: 26431
diff changeset
   822
332926212ef8 repoview: discard filtered changelog if index isn't shared with unfiltered
FUJIWARA Katsunori <foozy@lares.dti.ne.jp>
parents: 26431
diff changeset
   823
Combination of "finalization" and "empty-ness of changelog" (2 x 2 =
332926212ef8 repoview: discard filtered changelog if index isn't shared with unfiltered
FUJIWARA Katsunori <foozy@lares.dti.ne.jp>
parents: 26431
diff changeset
   824
4) are tested, because '00changelog.i' are differently changed in each
332926212ef8 repoview: discard filtered changelog if index isn't shared with unfiltered
FUJIWARA Katsunori <foozy@lares.dti.ne.jp>
parents: 26431
diff changeset
   825
cases.
332926212ef8 repoview: discard filtered changelog if index isn't shared with unfiltered
FUJIWARA Katsunori <foozy@lares.dti.ne.jp>
parents: 26431
diff changeset
   826
332926212ef8 repoview: discard filtered changelog if index isn't shared with unfiltered
FUJIWARA Katsunori <foozy@lares.dti.ne.jp>
parents: 26431
diff changeset
   827
  $ cat > $TESTTMP/failafterfinalize.py <<EOF
332926212ef8 repoview: discard filtered changelog if index isn't shared with unfiltered
FUJIWARA Katsunori <foozy@lares.dti.ne.jp>
parents: 26431
diff changeset
   828
  > # extension to abort transaction after finalization forcibly
332926212ef8 repoview: discard filtered changelog if index isn't shared with unfiltered
FUJIWARA Katsunori <foozy@lares.dti.ne.jp>
parents: 26431
diff changeset
   829
  > from mercurial import commands, error, extensions, lock as lockmod
34765
f3e4a5ad0d90 configitems: register the test 'failafterfinalize.fail' config
Boris Feld <boris.feld@octobus.net>
parents: 34555
diff changeset
   830
  > from mercurial import registrar
f3e4a5ad0d90 configitems: register the test 'failafterfinalize.fail' config
Boris Feld <boris.feld@octobus.net>
parents: 34555
diff changeset
   831
  > cmdtable = {}
f3e4a5ad0d90 configitems: register the test 'failafterfinalize.fail' config
Boris Feld <boris.feld@octobus.net>
parents: 34555
diff changeset
   832
  > command = registrar.command(cmdtable)
f3e4a5ad0d90 configitems: register the test 'failafterfinalize.fail' config
Boris Feld <boris.feld@octobus.net>
parents: 34555
diff changeset
   833
  > configtable = {}
f3e4a5ad0d90 configitems: register the test 'failafterfinalize.fail' config
Boris Feld <boris.feld@octobus.net>
parents: 34555
diff changeset
   834
  > configitem = registrar.configitem(configtable)
f3e4a5ad0d90 configitems: register the test 'failafterfinalize.fail' config
Boris Feld <boris.feld@octobus.net>
parents: 34555
diff changeset
   835
  > configitem('failafterfinalize', 'fail',
f3e4a5ad0d90 configitems: register the test 'failafterfinalize.fail' config
Boris Feld <boris.feld@octobus.net>
parents: 34555
diff changeset
   836
  >     default=None,
f3e4a5ad0d90 configitems: register the test 'failafterfinalize.fail' config
Boris Feld <boris.feld@octobus.net>
parents: 34555
diff changeset
   837
  > )
28265
332926212ef8 repoview: discard filtered changelog if index isn't shared with unfiltered
FUJIWARA Katsunori <foozy@lares.dti.ne.jp>
parents: 26431
diff changeset
   838
  > def fail(tr):
332926212ef8 repoview: discard filtered changelog if index isn't shared with unfiltered
FUJIWARA Katsunori <foozy@lares.dti.ne.jp>
parents: 26431
diff changeset
   839
  >     raise error.Abort('fail after finalization')
332926212ef8 repoview: discard filtered changelog if index isn't shared with unfiltered
FUJIWARA Katsunori <foozy@lares.dti.ne.jp>
parents: 26431
diff changeset
   840
  > def reposetup(ui, repo):
332926212ef8 repoview: discard filtered changelog if index isn't shared with unfiltered
FUJIWARA Katsunori <foozy@lares.dti.ne.jp>
parents: 26431
diff changeset
   841
  >     class failrepo(repo.__class__):
332926212ef8 repoview: discard filtered changelog if index isn't shared with unfiltered
FUJIWARA Katsunori <foozy@lares.dti.ne.jp>
parents: 26431
diff changeset
   842
  >         def commitctx(self, ctx, error=False):
332926212ef8 repoview: discard filtered changelog if index isn't shared with unfiltered
FUJIWARA Katsunori <foozy@lares.dti.ne.jp>
parents: 26431
diff changeset
   843
  >             if self.ui.configbool('failafterfinalize', 'fail'):
332926212ef8 repoview: discard filtered changelog if index isn't shared with unfiltered
FUJIWARA Katsunori <foozy@lares.dti.ne.jp>
parents: 26431
diff changeset
   844
  >                 # 'sorted()' by ASCII code on category names causes
332926212ef8 repoview: discard filtered changelog if index isn't shared with unfiltered
FUJIWARA Katsunori <foozy@lares.dti.ne.jp>
parents: 26431
diff changeset
   845
  >                 # invoking 'fail' after finalization of changelog
332926212ef8 repoview: discard filtered changelog if index isn't shared with unfiltered
FUJIWARA Katsunori <foozy@lares.dti.ne.jp>
parents: 26431
diff changeset
   846
  >                 # using "'cl-%i' % id(self)" as category name
332926212ef8 repoview: discard filtered changelog if index isn't shared with unfiltered
FUJIWARA Katsunori <foozy@lares.dti.ne.jp>
parents: 26431
diff changeset
   847
  >                 self.currenttransaction().addfinalize('zzzzzzzz', fail)
332926212ef8 repoview: discard filtered changelog if index isn't shared with unfiltered
FUJIWARA Katsunori <foozy@lares.dti.ne.jp>
parents: 26431
diff changeset
   848
  >             return super(failrepo, self).commitctx(ctx, error)
332926212ef8 repoview: discard filtered changelog if index isn't shared with unfiltered
FUJIWARA Katsunori <foozy@lares.dti.ne.jp>
parents: 26431
diff changeset
   849
  >     repo.__class__ = failrepo
332926212ef8 repoview: discard filtered changelog if index isn't shared with unfiltered
FUJIWARA Katsunori <foozy@lares.dti.ne.jp>
parents: 26431
diff changeset
   850
  > EOF
332926212ef8 repoview: discard filtered changelog if index isn't shared with unfiltered
FUJIWARA Katsunori <foozy@lares.dti.ne.jp>
parents: 26431
diff changeset
   851
332926212ef8 repoview: discard filtered changelog if index isn't shared with unfiltered
FUJIWARA Katsunori <foozy@lares.dti.ne.jp>
parents: 26431
diff changeset
   852
  $ hg init repo3
332926212ef8 repoview: discard filtered changelog if index isn't shared with unfiltered
FUJIWARA Katsunori <foozy@lares.dti.ne.jp>
parents: 26431
diff changeset
   853
  $ cd repo3
332926212ef8 repoview: discard filtered changelog if index isn't shared with unfiltered
FUJIWARA Katsunori <foozy@lares.dti.ne.jp>
parents: 26431
diff changeset
   854
332926212ef8 repoview: discard filtered changelog if index isn't shared with unfiltered
FUJIWARA Katsunori <foozy@lares.dti.ne.jp>
parents: 26431
diff changeset
   855
  $ cat <<EOF >> $HGRCPATH
332926212ef8 repoview: discard filtered changelog if index isn't shared with unfiltered
FUJIWARA Katsunori <foozy@lares.dti.ne.jp>
parents: 26431
diff changeset
   856
  > [ui]
332926212ef8 repoview: discard filtered changelog if index isn't shared with unfiltered
FUJIWARA Katsunori <foozy@lares.dti.ne.jp>
parents: 26431
diff changeset
   857
  > logtemplate = {rev} {desc|firstline} ({files})\n
332926212ef8 repoview: discard filtered changelog if index isn't shared with unfiltered
FUJIWARA Katsunori <foozy@lares.dti.ne.jp>
parents: 26431
diff changeset
   858
  > 
332926212ef8 repoview: discard filtered changelog if index isn't shared with unfiltered
FUJIWARA Katsunori <foozy@lares.dti.ne.jp>
parents: 26431
diff changeset
   859
  > [extensions]
332926212ef8 repoview: discard filtered changelog if index isn't shared with unfiltered
FUJIWARA Katsunori <foozy@lares.dti.ne.jp>
parents: 26431
diff changeset
   860
  > failafterfinalize = $TESTTMP/failafterfinalize.py
332926212ef8 repoview: discard filtered changelog if index isn't shared with unfiltered
FUJIWARA Katsunori <foozy@lares.dti.ne.jp>
parents: 26431
diff changeset
   861
  > EOF
332926212ef8 repoview: discard filtered changelog if index isn't shared with unfiltered
FUJIWARA Katsunori <foozy@lares.dti.ne.jp>
parents: 26431
diff changeset
   862
332926212ef8 repoview: discard filtered changelog if index isn't shared with unfiltered
FUJIWARA Katsunori <foozy@lares.dti.ne.jp>
parents: 26431
diff changeset
   863
- test failure with "empty changelog"
332926212ef8 repoview: discard filtered changelog if index isn't shared with unfiltered
FUJIWARA Katsunori <foozy@lares.dti.ne.jp>
parents: 26431
diff changeset
   864
332926212ef8 repoview: discard filtered changelog if index isn't shared with unfiltered
FUJIWARA Katsunori <foozy@lares.dti.ne.jp>
parents: 26431
diff changeset
   865
  $ echo foo > foo
332926212ef8 repoview: discard filtered changelog if index isn't shared with unfiltered
FUJIWARA Katsunori <foozy@lares.dti.ne.jp>
parents: 26431
diff changeset
   866
  $ hg add foo
332926212ef8 repoview: discard filtered changelog if index isn't shared with unfiltered
FUJIWARA Katsunori <foozy@lares.dti.ne.jp>
parents: 26431
diff changeset
   867
30332
318a24b52eeb spelling: fixes of non-dictionary words
Mads Kiilerich <madski@unity3d.com>
parents: 30262
diff changeset
   868
(failure before finalization)
28265
332926212ef8 repoview: discard filtered changelog if index isn't shared with unfiltered
FUJIWARA Katsunori <foozy@lares.dti.ne.jp>
parents: 26431
diff changeset
   869
33922
1a6707b43d05 tests: update test-commandserver to pass our import checker
Augie Fackler <raf@durin42.com>
parents: 33921
diff changeset
   870
  >>> from hgclient import check, readchannel, runcommand
28265
332926212ef8 repoview: discard filtered changelog if index isn't shared with unfiltered
FUJIWARA Katsunori <foozy@lares.dti.ne.jp>
parents: 26431
diff changeset
   871
  >>> @check
332926212ef8 repoview: discard filtered changelog if index isn't shared with unfiltered
FUJIWARA Katsunori <foozy@lares.dti.ne.jp>
parents: 26431
diff changeset
   872
  ... def abort(server):
332926212ef8 repoview: discard filtered changelog if index isn't shared with unfiltered
FUJIWARA Katsunori <foozy@lares.dti.ne.jp>
parents: 26431
diff changeset
   873
  ...     readchannel(server)
332926212ef8 repoview: discard filtered changelog if index isn't shared with unfiltered
FUJIWARA Katsunori <foozy@lares.dti.ne.jp>
parents: 26431
diff changeset
   874
  ...     runcommand(server, ['commit',
332926212ef8 repoview: discard filtered changelog if index isn't shared with unfiltered
FUJIWARA Katsunori <foozy@lares.dti.ne.jp>
parents: 26431
diff changeset
   875
  ...                         '--config', 'hooks.pretxncommit=false',
332926212ef8 repoview: discard filtered changelog if index isn't shared with unfiltered
FUJIWARA Katsunori <foozy@lares.dti.ne.jp>
parents: 26431
diff changeset
   876
  ...                         '-mfoo'])
332926212ef8 repoview: discard filtered changelog if index isn't shared with unfiltered
FUJIWARA Katsunori <foozy@lares.dti.ne.jp>
parents: 26431
diff changeset
   877
  ...     runcommand(server, ['log'])
332926212ef8 repoview: discard filtered changelog if index isn't shared with unfiltered
FUJIWARA Katsunori <foozy@lares.dti.ne.jp>
parents: 26431
diff changeset
   878
  ...     runcommand(server, ['verify', '-q'])
332926212ef8 repoview: discard filtered changelog if index isn't shared with unfiltered
FUJIWARA Katsunori <foozy@lares.dti.ne.jp>
parents: 26431
diff changeset
   879
  *** runcommand commit --config hooks.pretxncommit=false -mfoo
332926212ef8 repoview: discard filtered changelog if index isn't shared with unfiltered
FUJIWARA Katsunori <foozy@lares.dti.ne.jp>
parents: 26431
diff changeset
   880
  transaction abort!
332926212ef8 repoview: discard filtered changelog if index isn't shared with unfiltered
FUJIWARA Katsunori <foozy@lares.dti.ne.jp>
parents: 26431
diff changeset
   881
  rollback completed
332926212ef8 repoview: discard filtered changelog if index isn't shared with unfiltered
FUJIWARA Katsunori <foozy@lares.dti.ne.jp>
parents: 26431
diff changeset
   882
  abort: pretxncommit hook exited with status 1
332926212ef8 repoview: discard filtered changelog if index isn't shared with unfiltered
FUJIWARA Katsunori <foozy@lares.dti.ne.jp>
parents: 26431
diff changeset
   883
   [255]
332926212ef8 repoview: discard filtered changelog if index isn't shared with unfiltered
FUJIWARA Katsunori <foozy@lares.dti.ne.jp>
parents: 26431
diff changeset
   884
  *** runcommand log
332926212ef8 repoview: discard filtered changelog if index isn't shared with unfiltered
FUJIWARA Katsunori <foozy@lares.dti.ne.jp>
parents: 26431
diff changeset
   885
  *** runcommand verify -q
332926212ef8 repoview: discard filtered changelog if index isn't shared with unfiltered
FUJIWARA Katsunori <foozy@lares.dti.ne.jp>
parents: 26431
diff changeset
   886
30332
318a24b52eeb spelling: fixes of non-dictionary words
Mads Kiilerich <madski@unity3d.com>
parents: 30262
diff changeset
   887
(failure after finalization)
28265
332926212ef8 repoview: discard filtered changelog if index isn't shared with unfiltered
FUJIWARA Katsunori <foozy@lares.dti.ne.jp>
parents: 26431
diff changeset
   888
33922
1a6707b43d05 tests: update test-commandserver to pass our import checker
Augie Fackler <raf@durin42.com>
parents: 33921
diff changeset
   889
  >>> from hgclient import check, readchannel, runcommand
28265
332926212ef8 repoview: discard filtered changelog if index isn't shared with unfiltered
FUJIWARA Katsunori <foozy@lares.dti.ne.jp>
parents: 26431
diff changeset
   890
  >>> @check
332926212ef8 repoview: discard filtered changelog if index isn't shared with unfiltered
FUJIWARA Katsunori <foozy@lares.dti.ne.jp>
parents: 26431
diff changeset
   891
  ... def abort(server):
332926212ef8 repoview: discard filtered changelog if index isn't shared with unfiltered
FUJIWARA Katsunori <foozy@lares.dti.ne.jp>
parents: 26431
diff changeset
   892
  ...     readchannel(server)
332926212ef8 repoview: discard filtered changelog if index isn't shared with unfiltered
FUJIWARA Katsunori <foozy@lares.dti.ne.jp>
parents: 26431
diff changeset
   893
  ...     runcommand(server, ['commit',
332926212ef8 repoview: discard filtered changelog if index isn't shared with unfiltered
FUJIWARA Katsunori <foozy@lares.dti.ne.jp>
parents: 26431
diff changeset
   894
  ...                         '--config', 'failafterfinalize.fail=true',
332926212ef8 repoview: discard filtered changelog if index isn't shared with unfiltered
FUJIWARA Katsunori <foozy@lares.dti.ne.jp>
parents: 26431
diff changeset
   895
  ...                         '-mfoo'])
332926212ef8 repoview: discard filtered changelog if index isn't shared with unfiltered
FUJIWARA Katsunori <foozy@lares.dti.ne.jp>
parents: 26431
diff changeset
   896
  ...     runcommand(server, ['log'])
332926212ef8 repoview: discard filtered changelog if index isn't shared with unfiltered
FUJIWARA Katsunori <foozy@lares.dti.ne.jp>
parents: 26431
diff changeset
   897
  ...     runcommand(server, ['verify', '-q'])
332926212ef8 repoview: discard filtered changelog if index isn't shared with unfiltered
FUJIWARA Katsunori <foozy@lares.dti.ne.jp>
parents: 26431
diff changeset
   898
  *** runcommand commit --config failafterfinalize.fail=true -mfoo
332926212ef8 repoview: discard filtered changelog if index isn't shared with unfiltered
FUJIWARA Katsunori <foozy@lares.dti.ne.jp>
parents: 26431
diff changeset
   899
  transaction abort!
332926212ef8 repoview: discard filtered changelog if index isn't shared with unfiltered
FUJIWARA Katsunori <foozy@lares.dti.ne.jp>
parents: 26431
diff changeset
   900
  rollback completed
332926212ef8 repoview: discard filtered changelog if index isn't shared with unfiltered
FUJIWARA Katsunori <foozy@lares.dti.ne.jp>
parents: 26431
diff changeset
   901
  abort: fail after finalization
332926212ef8 repoview: discard filtered changelog if index isn't shared with unfiltered
FUJIWARA Katsunori <foozy@lares.dti.ne.jp>
parents: 26431
diff changeset
   902
   [255]
332926212ef8 repoview: discard filtered changelog if index isn't shared with unfiltered
FUJIWARA Katsunori <foozy@lares.dti.ne.jp>
parents: 26431
diff changeset
   903
  *** runcommand log
332926212ef8 repoview: discard filtered changelog if index isn't shared with unfiltered
FUJIWARA Katsunori <foozy@lares.dti.ne.jp>
parents: 26431
diff changeset
   904
  *** runcommand verify -q
332926212ef8 repoview: discard filtered changelog if index isn't shared with unfiltered
FUJIWARA Katsunori <foozy@lares.dti.ne.jp>
parents: 26431
diff changeset
   905
332926212ef8 repoview: discard filtered changelog if index isn't shared with unfiltered
FUJIWARA Katsunori <foozy@lares.dti.ne.jp>
parents: 26431
diff changeset
   906
- test failure with "not-empty changelog"
332926212ef8 repoview: discard filtered changelog if index isn't shared with unfiltered
FUJIWARA Katsunori <foozy@lares.dti.ne.jp>
parents: 26431
diff changeset
   907
332926212ef8 repoview: discard filtered changelog if index isn't shared with unfiltered
FUJIWARA Katsunori <foozy@lares.dti.ne.jp>
parents: 26431
diff changeset
   908
  $ echo bar > bar
332926212ef8 repoview: discard filtered changelog if index isn't shared with unfiltered
FUJIWARA Katsunori <foozy@lares.dti.ne.jp>
parents: 26431
diff changeset
   909
  $ hg add bar
332926212ef8 repoview: discard filtered changelog if index isn't shared with unfiltered
FUJIWARA Katsunori <foozy@lares.dti.ne.jp>
parents: 26431
diff changeset
   910
  $ hg commit -mbar bar
332926212ef8 repoview: discard filtered changelog if index isn't shared with unfiltered
FUJIWARA Katsunori <foozy@lares.dti.ne.jp>
parents: 26431
diff changeset
   911
332926212ef8 repoview: discard filtered changelog if index isn't shared with unfiltered
FUJIWARA Katsunori <foozy@lares.dti.ne.jp>
parents: 26431
diff changeset
   912
(failure before finalization)
332926212ef8 repoview: discard filtered changelog if index isn't shared with unfiltered
FUJIWARA Katsunori <foozy@lares.dti.ne.jp>
parents: 26431
diff changeset
   913
33922
1a6707b43d05 tests: update test-commandserver to pass our import checker
Augie Fackler <raf@durin42.com>
parents: 33921
diff changeset
   914
  >>> from hgclient import check, readchannel, runcommand
28265
332926212ef8 repoview: discard filtered changelog if index isn't shared with unfiltered
FUJIWARA Katsunori <foozy@lares.dti.ne.jp>
parents: 26431
diff changeset
   915
  >>> @check
332926212ef8 repoview: discard filtered changelog if index isn't shared with unfiltered
FUJIWARA Katsunori <foozy@lares.dti.ne.jp>
parents: 26431
diff changeset
   916
  ... def abort(server):
332926212ef8 repoview: discard filtered changelog if index isn't shared with unfiltered
FUJIWARA Katsunori <foozy@lares.dti.ne.jp>
parents: 26431
diff changeset
   917
  ...     readchannel(server)
332926212ef8 repoview: discard filtered changelog if index isn't shared with unfiltered
FUJIWARA Katsunori <foozy@lares.dti.ne.jp>
parents: 26431
diff changeset
   918
  ...     runcommand(server, ['commit',
332926212ef8 repoview: discard filtered changelog if index isn't shared with unfiltered
FUJIWARA Katsunori <foozy@lares.dti.ne.jp>
parents: 26431
diff changeset
   919
  ...                         '--config', 'hooks.pretxncommit=false',
332926212ef8 repoview: discard filtered changelog if index isn't shared with unfiltered
FUJIWARA Katsunori <foozy@lares.dti.ne.jp>
parents: 26431
diff changeset
   920
  ...                         '-mfoo', 'foo'])
332926212ef8 repoview: discard filtered changelog if index isn't shared with unfiltered
FUJIWARA Katsunori <foozy@lares.dti.ne.jp>
parents: 26431
diff changeset
   921
  ...     runcommand(server, ['log'])
332926212ef8 repoview: discard filtered changelog if index isn't shared with unfiltered
FUJIWARA Katsunori <foozy@lares.dti.ne.jp>
parents: 26431
diff changeset
   922
  ...     runcommand(server, ['verify', '-q'])
332926212ef8 repoview: discard filtered changelog if index isn't shared with unfiltered
FUJIWARA Katsunori <foozy@lares.dti.ne.jp>
parents: 26431
diff changeset
   923
  *** runcommand commit --config hooks.pretxncommit=false -mfoo foo
332926212ef8 repoview: discard filtered changelog if index isn't shared with unfiltered
FUJIWARA Katsunori <foozy@lares.dti.ne.jp>
parents: 26431
diff changeset
   924
  transaction abort!
332926212ef8 repoview: discard filtered changelog if index isn't shared with unfiltered
FUJIWARA Katsunori <foozy@lares.dti.ne.jp>
parents: 26431
diff changeset
   925
  rollback completed
332926212ef8 repoview: discard filtered changelog if index isn't shared with unfiltered
FUJIWARA Katsunori <foozy@lares.dti.ne.jp>
parents: 26431
diff changeset
   926
  abort: pretxncommit hook exited with status 1
332926212ef8 repoview: discard filtered changelog if index isn't shared with unfiltered
FUJIWARA Katsunori <foozy@lares.dti.ne.jp>
parents: 26431
diff changeset
   927
   [255]
332926212ef8 repoview: discard filtered changelog if index isn't shared with unfiltered
FUJIWARA Katsunori <foozy@lares.dti.ne.jp>
parents: 26431
diff changeset
   928
  *** runcommand log
332926212ef8 repoview: discard filtered changelog if index isn't shared with unfiltered
FUJIWARA Katsunori <foozy@lares.dti.ne.jp>
parents: 26431
diff changeset
   929
  0 bar (bar)
332926212ef8 repoview: discard filtered changelog if index isn't shared with unfiltered
FUJIWARA Katsunori <foozy@lares.dti.ne.jp>
parents: 26431
diff changeset
   930
  *** runcommand verify -q
332926212ef8 repoview: discard filtered changelog if index isn't shared with unfiltered
FUJIWARA Katsunori <foozy@lares.dti.ne.jp>
parents: 26431
diff changeset
   931
332926212ef8 repoview: discard filtered changelog if index isn't shared with unfiltered
FUJIWARA Katsunori <foozy@lares.dti.ne.jp>
parents: 26431
diff changeset
   932
(failure after finalization)
332926212ef8 repoview: discard filtered changelog if index isn't shared with unfiltered
FUJIWARA Katsunori <foozy@lares.dti.ne.jp>
parents: 26431
diff changeset
   933
33922
1a6707b43d05 tests: update test-commandserver to pass our import checker
Augie Fackler <raf@durin42.com>
parents: 33921
diff changeset
   934
  >>> from hgclient import check, readchannel, runcommand
28265
332926212ef8 repoview: discard filtered changelog if index isn't shared with unfiltered
FUJIWARA Katsunori <foozy@lares.dti.ne.jp>
parents: 26431
diff changeset
   935
  >>> @check
332926212ef8 repoview: discard filtered changelog if index isn't shared with unfiltered
FUJIWARA Katsunori <foozy@lares.dti.ne.jp>
parents: 26431
diff changeset
   936
  ... def abort(server):
332926212ef8 repoview: discard filtered changelog if index isn't shared with unfiltered
FUJIWARA Katsunori <foozy@lares.dti.ne.jp>
parents: 26431
diff changeset
   937
  ...     readchannel(server)
332926212ef8 repoview: discard filtered changelog if index isn't shared with unfiltered
FUJIWARA Katsunori <foozy@lares.dti.ne.jp>
parents: 26431
diff changeset
   938
  ...     runcommand(server, ['commit',
332926212ef8 repoview: discard filtered changelog if index isn't shared with unfiltered
FUJIWARA Katsunori <foozy@lares.dti.ne.jp>
parents: 26431
diff changeset
   939
  ...                         '--config', 'failafterfinalize.fail=true',
332926212ef8 repoview: discard filtered changelog if index isn't shared with unfiltered
FUJIWARA Katsunori <foozy@lares.dti.ne.jp>
parents: 26431
diff changeset
   940
  ...                         '-mfoo', 'foo'])
332926212ef8 repoview: discard filtered changelog if index isn't shared with unfiltered
FUJIWARA Katsunori <foozy@lares.dti.ne.jp>
parents: 26431
diff changeset
   941
  ...     runcommand(server, ['log'])
332926212ef8 repoview: discard filtered changelog if index isn't shared with unfiltered
FUJIWARA Katsunori <foozy@lares.dti.ne.jp>
parents: 26431
diff changeset
   942
  ...     runcommand(server, ['verify', '-q'])
332926212ef8 repoview: discard filtered changelog if index isn't shared with unfiltered
FUJIWARA Katsunori <foozy@lares.dti.ne.jp>
parents: 26431
diff changeset
   943
  *** runcommand commit --config failafterfinalize.fail=true -mfoo foo
332926212ef8 repoview: discard filtered changelog if index isn't shared with unfiltered
FUJIWARA Katsunori <foozy@lares.dti.ne.jp>
parents: 26431
diff changeset
   944
  transaction abort!
332926212ef8 repoview: discard filtered changelog if index isn't shared with unfiltered
FUJIWARA Katsunori <foozy@lares.dti.ne.jp>
parents: 26431
diff changeset
   945
  rollback completed
332926212ef8 repoview: discard filtered changelog if index isn't shared with unfiltered
FUJIWARA Katsunori <foozy@lares.dti.ne.jp>
parents: 26431
diff changeset
   946
  abort: fail after finalization
332926212ef8 repoview: discard filtered changelog if index isn't shared with unfiltered
FUJIWARA Katsunori <foozy@lares.dti.ne.jp>
parents: 26431
diff changeset
   947
   [255]
332926212ef8 repoview: discard filtered changelog if index isn't shared with unfiltered
FUJIWARA Katsunori <foozy@lares.dti.ne.jp>
parents: 26431
diff changeset
   948
  *** runcommand log
332926212ef8 repoview: discard filtered changelog if index isn't shared with unfiltered
FUJIWARA Katsunori <foozy@lares.dti.ne.jp>
parents: 26431
diff changeset
   949
  0 bar (bar)
332926212ef8 repoview: discard filtered changelog if index isn't shared with unfiltered
FUJIWARA Katsunori <foozy@lares.dti.ne.jp>
parents: 26431
diff changeset
   950
  *** runcommand verify -q
33648
47ea28293d30 tests: show cache of audited paths is never invalidated
Yuya Nishihara <yuya@tcha.org>
parents: 33607
diff changeset
   951
47ea28293d30 tests: show cache of audited paths is never invalidated
Yuya Nishihara <yuya@tcha.org>
parents: 33607
diff changeset
   952
  $ cd ..
47ea28293d30 tests: show cache of audited paths is never invalidated
Yuya Nishihara <yuya@tcha.org>
parents: 33607
diff changeset
   953
47ea28293d30 tests: show cache of audited paths is never invalidated
Yuya Nishihara <yuya@tcha.org>
parents: 33607
diff changeset
   954
Test symlink traversal over cached audited paths:
47ea28293d30 tests: show cache of audited paths is never invalidated
Yuya Nishihara <yuya@tcha.org>
parents: 33607
diff changeset
   955
-------------------------------------------------
47ea28293d30 tests: show cache of audited paths is never invalidated
Yuya Nishihara <yuya@tcha.org>
parents: 33607
diff changeset
   956
47ea28293d30 tests: show cache of audited paths is never invalidated
Yuya Nishihara <yuya@tcha.org>
parents: 33607
diff changeset
   957
#if symlink
47ea28293d30 tests: show cache of audited paths is never invalidated
Yuya Nishihara <yuya@tcha.org>
parents: 33607
diff changeset
   958
47ea28293d30 tests: show cache of audited paths is never invalidated
Yuya Nishihara <yuya@tcha.org>
parents: 33607
diff changeset
   959
set up symlink hell
47ea28293d30 tests: show cache of audited paths is never invalidated
Yuya Nishihara <yuya@tcha.org>
parents: 33607
diff changeset
   960
47ea28293d30 tests: show cache of audited paths is never invalidated
Yuya Nishihara <yuya@tcha.org>
parents: 33607
diff changeset
   961
  $ mkdir merge-symlink-out
47ea28293d30 tests: show cache of audited paths is never invalidated
Yuya Nishihara <yuya@tcha.org>
parents: 33607
diff changeset
   962
  $ hg init merge-symlink
47ea28293d30 tests: show cache of audited paths is never invalidated
Yuya Nishihara <yuya@tcha.org>
parents: 33607
diff changeset
   963
  $ cd merge-symlink
47ea28293d30 tests: show cache of audited paths is never invalidated
Yuya Nishihara <yuya@tcha.org>
parents: 33607
diff changeset
   964
  $ touch base
47ea28293d30 tests: show cache of audited paths is never invalidated
Yuya Nishihara <yuya@tcha.org>
parents: 33607
diff changeset
   965
  $ hg commit -qAm base
47ea28293d30 tests: show cache of audited paths is never invalidated
Yuya Nishihara <yuya@tcha.org>
parents: 33607
diff changeset
   966
  $ ln -s ../merge-symlink-out a
47ea28293d30 tests: show cache of audited paths is never invalidated
Yuya Nishihara <yuya@tcha.org>
parents: 33607
diff changeset
   967
  $ hg commit -qAm 'symlink a -> ../merge-symlink-out'
47ea28293d30 tests: show cache of audited paths is never invalidated
Yuya Nishihara <yuya@tcha.org>
parents: 33607
diff changeset
   968
  $ hg up -q 0
47ea28293d30 tests: show cache of audited paths is never invalidated
Yuya Nishihara <yuya@tcha.org>
parents: 33607
diff changeset
   969
  $ mkdir a
47ea28293d30 tests: show cache of audited paths is never invalidated
Yuya Nishihara <yuya@tcha.org>
parents: 33607
diff changeset
   970
  $ touch a/poisoned
47ea28293d30 tests: show cache of audited paths is never invalidated
Yuya Nishihara <yuya@tcha.org>
parents: 33607
diff changeset
   971
  $ hg commit -qAm 'file a/poisoned'
47ea28293d30 tests: show cache of audited paths is never invalidated
Yuya Nishihara <yuya@tcha.org>
parents: 33607
diff changeset
   972
  $ hg log -G -T '{rev}: {desc}\n'
47ea28293d30 tests: show cache of audited paths is never invalidated
Yuya Nishihara <yuya@tcha.org>
parents: 33607
diff changeset
   973
  @  2: file a/poisoned
47ea28293d30 tests: show cache of audited paths is never invalidated
Yuya Nishihara <yuya@tcha.org>
parents: 33607
diff changeset
   974
  |
47ea28293d30 tests: show cache of audited paths is never invalidated
Yuya Nishihara <yuya@tcha.org>
parents: 33607
diff changeset
   975
  | o  1: symlink a -> ../merge-symlink-out
47ea28293d30 tests: show cache of audited paths is never invalidated
Yuya Nishihara <yuya@tcha.org>
parents: 33607
diff changeset
   976
  |/
47ea28293d30 tests: show cache of audited paths is never invalidated
Yuya Nishihara <yuya@tcha.org>
parents: 33607
diff changeset
   977
  o  0: base
47ea28293d30 tests: show cache of audited paths is never invalidated
Yuya Nishihara <yuya@tcha.org>
parents: 33607
diff changeset
   978
  
47ea28293d30 tests: show cache of audited paths is never invalidated
Yuya Nishihara <yuya@tcha.org>
parents: 33607
diff changeset
   979
47ea28293d30 tests: show cache of audited paths is never invalidated
Yuya Nishihara <yuya@tcha.org>
parents: 33607
diff changeset
   980
try trivial merge after update: cache of audited paths should be discarded,
47ea28293d30 tests: show cache of audited paths is never invalidated
Yuya Nishihara <yuya@tcha.org>
parents: 33607
diff changeset
   981
and the merge should fail (issue5628)
47ea28293d30 tests: show cache of audited paths is never invalidated
Yuya Nishihara <yuya@tcha.org>
parents: 33607
diff changeset
   982
47ea28293d30 tests: show cache of audited paths is never invalidated
Yuya Nishihara <yuya@tcha.org>
parents: 33607
diff changeset
   983
  $ hg up -q null
33922
1a6707b43d05 tests: update test-commandserver to pass our import checker
Augie Fackler <raf@durin42.com>
parents: 33921
diff changeset
   984
  >>> from hgclient import check, readchannel, runcommand
33648
47ea28293d30 tests: show cache of audited paths is never invalidated
Yuya Nishihara <yuya@tcha.org>
parents: 33607
diff changeset
   985
  >>> @check
47ea28293d30 tests: show cache of audited paths is never invalidated
Yuya Nishihara <yuya@tcha.org>
parents: 33607
diff changeset
   986
  ... def merge(server):
47ea28293d30 tests: show cache of audited paths is never invalidated
Yuya Nishihara <yuya@tcha.org>
parents: 33607
diff changeset
   987
  ...     readchannel(server)
47ea28293d30 tests: show cache of audited paths is never invalidated
Yuya Nishihara <yuya@tcha.org>
parents: 33607
diff changeset
   988
  ...     # audit a/poisoned as a good path
47ea28293d30 tests: show cache of audited paths is never invalidated
Yuya Nishihara <yuya@tcha.org>
parents: 33607
diff changeset
   989
  ...     runcommand(server, ['up', '-qC', '2'])
47ea28293d30 tests: show cache of audited paths is never invalidated
Yuya Nishihara <yuya@tcha.org>
parents: 33607
diff changeset
   990
  ...     runcommand(server, ['up', '-qC', '1'])
47ea28293d30 tests: show cache of audited paths is never invalidated
Yuya Nishihara <yuya@tcha.org>
parents: 33607
diff changeset
   991
  ...     # here a is a symlink, so a/poisoned is bad
47ea28293d30 tests: show cache of audited paths is never invalidated
Yuya Nishihara <yuya@tcha.org>
parents: 33607
diff changeset
   992
  ...     runcommand(server, ['merge', '2'])
47ea28293d30 tests: show cache of audited paths is never invalidated
Yuya Nishihara <yuya@tcha.org>
parents: 33607
diff changeset
   993
  *** runcommand up -qC 2
47ea28293d30 tests: show cache of audited paths is never invalidated
Yuya Nishihara <yuya@tcha.org>
parents: 33607
diff changeset
   994
  *** runcommand up -qC 1
47ea28293d30 tests: show cache of audited paths is never invalidated
Yuya Nishihara <yuya@tcha.org>
parents: 33607
diff changeset
   995
  *** runcommand merge 2
34942
2a774cae3a03 merge: disable path conflict checking by default (issue5716)
Siddharth Agarwal <sid0@fb.com>
parents: 34900
diff changeset
   996
  abort: path 'a/poisoned' traverses symbolic link 'a'
2a774cae3a03 merge: disable path conflict checking by default (issue5716)
Siddharth Agarwal <sid0@fb.com>
parents: 34900
diff changeset
   997
   [255]
33648
47ea28293d30 tests: show cache of audited paths is never invalidated
Yuya Nishihara <yuya@tcha.org>
parents: 33607
diff changeset
   998
  $ ls ../merge-symlink-out
47ea28293d30 tests: show cache of audited paths is never invalidated
Yuya Nishihara <yuya@tcha.org>
parents: 33607
diff changeset
   999
47ea28293d30 tests: show cache of audited paths is never invalidated
Yuya Nishihara <yuya@tcha.org>
parents: 33607
diff changeset
  1000
cache of repo.auditor should be discarded, so matcher would never traverse
47ea28293d30 tests: show cache of audited paths is never invalidated
Yuya Nishihara <yuya@tcha.org>
parents: 33607
diff changeset
  1001
symlinks:
47ea28293d30 tests: show cache of audited paths is never invalidated
Yuya Nishihara <yuya@tcha.org>
parents: 33607
diff changeset
  1002
47ea28293d30 tests: show cache of audited paths is never invalidated
Yuya Nishihara <yuya@tcha.org>
parents: 33607
diff changeset
  1003
  $ hg up -qC 0
47ea28293d30 tests: show cache of audited paths is never invalidated
Yuya Nishihara <yuya@tcha.org>
parents: 33607
diff changeset
  1004
  $ touch ../merge-symlink-out/poisoned
33922
1a6707b43d05 tests: update test-commandserver to pass our import checker
Augie Fackler <raf@durin42.com>
parents: 33921
diff changeset
  1005
  >>> from hgclient import check, readchannel, runcommand
33648
47ea28293d30 tests: show cache of audited paths is never invalidated
Yuya Nishihara <yuya@tcha.org>
parents: 33607
diff changeset
  1006
  >>> @check
47ea28293d30 tests: show cache of audited paths is never invalidated
Yuya Nishihara <yuya@tcha.org>
parents: 33607
diff changeset
  1007
  ... def files(server):
47ea28293d30 tests: show cache of audited paths is never invalidated
Yuya Nishihara <yuya@tcha.org>
parents: 33607
diff changeset
  1008
  ...     readchannel(server)
47ea28293d30 tests: show cache of audited paths is never invalidated
Yuya Nishihara <yuya@tcha.org>
parents: 33607
diff changeset
  1009
  ...     runcommand(server, ['up', '-qC', '2'])
47ea28293d30 tests: show cache of audited paths is never invalidated
Yuya Nishihara <yuya@tcha.org>
parents: 33607
diff changeset
  1010
  ...     # audit a/poisoned as a good path
47ea28293d30 tests: show cache of audited paths is never invalidated
Yuya Nishihara <yuya@tcha.org>
parents: 33607
diff changeset
  1011
  ...     runcommand(server, ['files', 'a/poisoned'])
47ea28293d30 tests: show cache of audited paths is never invalidated
Yuya Nishihara <yuya@tcha.org>
parents: 33607
diff changeset
  1012
  ...     runcommand(server, ['up', '-qC', '0'])
47ea28293d30 tests: show cache of audited paths is never invalidated
Yuya Nishihara <yuya@tcha.org>
parents: 33607
diff changeset
  1013
  ...     runcommand(server, ['up', '-qC', '1'])
47ea28293d30 tests: show cache of audited paths is never invalidated
Yuya Nishihara <yuya@tcha.org>
parents: 33607
diff changeset
  1014
  ...     # here 'a' is a symlink, so a/poisoned should be warned
47ea28293d30 tests: show cache of audited paths is never invalidated
Yuya Nishihara <yuya@tcha.org>
parents: 33607
diff changeset
  1015
  ...     runcommand(server, ['files', 'a/poisoned'])
47ea28293d30 tests: show cache of audited paths is never invalidated
Yuya Nishihara <yuya@tcha.org>
parents: 33607
diff changeset
  1016
  *** runcommand up -qC 2
47ea28293d30 tests: show cache of audited paths is never invalidated
Yuya Nishihara <yuya@tcha.org>
parents: 33607
diff changeset
  1017
  *** runcommand files a/poisoned
47ea28293d30 tests: show cache of audited paths is never invalidated
Yuya Nishihara <yuya@tcha.org>
parents: 33607
diff changeset
  1018
  a/poisoned
47ea28293d30 tests: show cache of audited paths is never invalidated
Yuya Nishihara <yuya@tcha.org>
parents: 33607
diff changeset
  1019
  *** runcommand up -qC 0
47ea28293d30 tests: show cache of audited paths is never invalidated
Yuya Nishihara <yuya@tcha.org>
parents: 33607
diff changeset
  1020
  *** runcommand up -qC 1
47ea28293d30 tests: show cache of audited paths is never invalidated
Yuya Nishihara <yuya@tcha.org>
parents: 33607
diff changeset
  1021
  *** runcommand files a/poisoned
33649
377e8ddaebef pathauditor: disable cache of audited paths by default (issue5628)
Yuya Nishihara <yuya@tcha.org>
parents: 33648
diff changeset
  1022
  abort: path 'a/poisoned' traverses symbolic link 'a'
377e8ddaebef pathauditor: disable cache of audited paths by default (issue5628)
Yuya Nishihara <yuya@tcha.org>
parents: 33648
diff changeset
  1023
   [255]
33648
47ea28293d30 tests: show cache of audited paths is never invalidated
Yuya Nishihara <yuya@tcha.org>
parents: 33607
diff changeset
  1024
47ea28293d30 tests: show cache of audited paths is never invalidated
Yuya Nishihara <yuya@tcha.org>
parents: 33607
diff changeset
  1025
  $ cd ..
47ea28293d30 tests: show cache of audited paths is never invalidated
Yuya Nishihara <yuya@tcha.org>
parents: 33607
diff changeset
  1026
47ea28293d30 tests: show cache of audited paths is never invalidated
Yuya Nishihara <yuya@tcha.org>
parents: 33607
diff changeset
  1027
#endif