tests/test-commandserver.t
author Manuel Jacob <me@manueljacob.de>
Thu, 15 Sep 2022 01:48:38 +0200
changeset 49494 c96ed4029fda
parent 48879 9987d14ad63f
child 49826 c84844cd523a
permissions -rw-r--r--
templates: add filter to reverse list The filter supports only lists because for lists, it’s straightforward to implement. Reversing text doesn’t seem very useful and is hard to implement. Reversing the bytes would break multi-bytes encodings. Reversing the code points would break characters consisting of multiple code points. Reversing graphemes is non-trivial without using a library not included in the standard library.
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
47587
be496e3489b9 tests: blacklist a handful of test with `rhg` or `chg`
Pierre-Yves David <pierre-yves.david@octobus.net>
parents: 47279
diff changeset
     1
#require no-rhg no-chg
be496e3489b9 tests: blacklist a handful of test with `rhg` or `chg`
Pierre-Yves David <pierre-yves.david@octobus.net>
parents: 47279
diff changeset
     2
be496e3489b9 tests: blacklist a handful of test with `rhg` or `chg`
Pierre-Yves David <pierre-yves.david@octobus.net>
parents: 47279
diff changeset
     3
XXX-RHG this test hangs if `hg` is really `rhg`. This was hidden by the use of
be496e3489b9 tests: blacklist a handful of test with `rhg` or `chg`
Pierre-Yves David <pierre-yves.david@octobus.net>
parents: 47279
diff changeset
     4
`alias hg=rhg` by run-tests.py. With such alias removed, this test is revealed
be496e3489b9 tests: blacklist a handful of test with `rhg` or `chg`
Pierre-Yves David <pierre-yves.david@octobus.net>
parents: 47279
diff changeset
     5
buggy. This need to be resolved sooner than later.
be496e3489b9 tests: blacklist a handful of test with `rhg` or `chg`
Pierre-Yves David <pierre-yves.david@octobus.net>
parents: 47279
diff changeset
     6
be496e3489b9 tests: blacklist a handful of test with `rhg` or `chg`
Pierre-Yves David <pierre-yves.david@octobus.net>
parents: 47279
diff changeset
     7
XXX-CHG this test hangs if `hg` is really `chg`. This was hidden by the use of
be496e3489b9 tests: blacklist a handful of test with `rhg` or `chg`
Pierre-Yves David <pierre-yves.david@octobus.net>
parents: 47279
diff changeset
     8
`alias hg=chg` by run-tests.py. With such alias removed, this test is revealed
be496e3489b9 tests: blacklist a handful of test with `rhg` or `chg`
Pierre-Yves David <pierre-yves.david@octobus.net>
parents: 47279
diff changeset
     9
buggy. This need to be resolved sooner than later.
be496e3489b9 tests: blacklist a handful of test with `rhg` or `chg`
Pierre-Yves David <pierre-yves.david@octobus.net>
parents: 47279
diff changeset
    10
22568
78b99149ed8a test-commandserver: port test functions from .py to .t
Yuya Nishihara <yuya@tcha.org>
parents: 22567
diff changeset
    11
#if windows
78b99149ed8a test-commandserver: port test functions from .py to .t
Yuya Nishihara <yuya@tcha.org>
parents: 22567
diff changeset
    12
  $ PYTHONPATH="$TESTDIR/../contrib;$PYTHONPATH"
78b99149ed8a test-commandserver: port test functions from .py to .t
Yuya Nishihara <yuya@tcha.org>
parents: 22567
diff changeset
    13
#else
78b99149ed8a test-commandserver: port test functions from .py to .t
Yuya Nishihara <yuya@tcha.org>
parents: 22567
diff changeset
    14
  $ PYTHONPATH="$TESTDIR/../contrib:$PYTHONPATH"
78b99149ed8a test-commandserver: port test functions from .py to .t
Yuya Nishihara <yuya@tcha.org>
parents: 22567
diff changeset
    15
#endif
78b99149ed8a test-commandserver: port test functions from .py to .t
Yuya Nishihara <yuya@tcha.org>
parents: 22567
diff changeset
    16
  $ export PYTHONPATH
78b99149ed8a test-commandserver: port test functions from .py to .t
Yuya Nishihara <yuya@tcha.org>
parents: 22567
diff changeset
    17
23053
5ba11ab48fcf ui: separate option to show prompt echo, enabled only in tests (issue4417)
Yuya Nishihara <yuya@tcha.org>
parents: 23036
diff changeset
    18
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
    19
5ba11ab48fcf ui: separate option to show prompt echo, enabled only in tests (issue4417)
Yuya Nishihara <yuya@tcha.org>
parents: 23036
diff changeset
    20
  $ 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
    21
  $ 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
    22
22568
78b99149ed8a test-commandserver: port test functions from .py to .t
Yuya Nishihara <yuya@tcha.org>
parents: 22567
diff changeset
    23
  $ hg init repo
78b99149ed8a test-commandserver: port test functions from .py to .t
Yuya Nishihara <yuya@tcha.org>
parents: 22567
diff changeset
    24
  $ cd repo
78b99149ed8a test-commandserver: port test functions from .py to .t
Yuya Nishihara <yuya@tcha.org>
parents: 22567
diff changeset
    25
33922
1a6707b43d05 tests: update test-commandserver to pass our import checker
Augie Fackler <raf@durin42.com>
parents: 33921
diff changeset
    26
  >>> import os
1a6707b43d05 tests: update test-commandserver to pass our import checker
Augie Fackler <raf@durin42.com>
parents: 33921
diff changeset
    27
  >>> import sys
40355
77ab5fbdbbf0 py3: use bprint() helper in test-commandserver.t
Yuya Nishihara <yuya@tcha.org>
parents: 40354
diff changeset
    28
  >>> from hgclient import bprint, check, readchannel, runcommand
22568
78b99149ed8a test-commandserver: port test functions from .py to .t
Yuya Nishihara <yuya@tcha.org>
parents: 22567
diff changeset
    29
  >>> @check
78b99149ed8a test-commandserver: port test functions from .py to .t
Yuya Nishihara <yuya@tcha.org>
parents: 22567
diff changeset
    30
  ... def hellomessage(server):
78b99149ed8a test-commandserver: port test functions from .py to .t
Yuya Nishihara <yuya@tcha.org>
parents: 22567
diff changeset
    31
  ...     ch, data = readchannel(server)
40355
77ab5fbdbbf0 py3: use bprint() helper in test-commandserver.t
Yuya Nishihara <yuya@tcha.org>
parents: 40354
diff changeset
    32
  ...     bprint(b'%c, %r' % (ch, data))
22568
78b99149ed8a test-commandserver: port test functions from .py to .t
Yuya Nishihara <yuya@tcha.org>
parents: 22567
diff changeset
    33
  ...     # 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
    34
  ...     # sends isn't part of the hello message
40354
f9f2faf25fc4 py3: byte-stringify most literals in test-commandserver.t
Yuya Nishihara <yuya@tcha.org>
parents: 39951
diff changeset
    35
  ...     runcommand(server, [b'id'])
23036
19f5273c9f3e cmdserver: include pid of server handling requests in hello message
Yuya Nishihara <yuya@tcha.org>
parents: 22994
diff changeset
    36
  o, 'capabilities: getencoding runcommand\nencoding: *\npid: *' (glob)
22572
cc3d9f776632 test-commandserver: make runcommand message bolder
Yuya Nishihara <yuya@tcha.org>
parents: 22571
diff changeset
    37
  *** 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
    38
  000000000000 tip
22568
78b99149ed8a test-commandserver: port test functions from .py to .t
Yuya Nishihara <yuya@tcha.org>
parents: 22567
diff changeset
    39
78b99149ed8a test-commandserver: port test functions from .py to .t
Yuya Nishihara <yuya@tcha.org>
parents: 22567
diff changeset
    40
  >>> from hgclient import check
78b99149ed8a test-commandserver: port test functions from .py to .t
Yuya Nishihara <yuya@tcha.org>
parents: 22567
diff changeset
    41
  >>> @check
78b99149ed8a test-commandserver: port test functions from .py to .t
Yuya Nishihara <yuya@tcha.org>
parents: 22567
diff changeset
    42
  ... def unknowncommand(server):
40354
f9f2faf25fc4 py3: byte-stringify most literals in test-commandserver.t
Yuya Nishihara <yuya@tcha.org>
parents: 39951
diff changeset
    43
  ...     server.stdin.write(b'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
    44
  abort: unknown command unknowncommand
22568
78b99149ed8a test-commandserver: port test functions from .py to .t
Yuya Nishihara <yuya@tcha.org>
parents: 22567
diff changeset
    45
33922
1a6707b43d05 tests: update test-commandserver to pass our import checker
Augie Fackler <raf@durin42.com>
parents: 33921
diff changeset
    46
  >>> 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
    47
  >>> @check
78b99149ed8a test-commandserver: port test functions from .py to .t
Yuya Nishihara <yuya@tcha.org>
parents: 22567
diff changeset
    48
  ... def checkruncommand(server):
78b99149ed8a test-commandserver: port test functions from .py to .t
Yuya Nishihara <yuya@tcha.org>
parents: 22567
diff changeset
    49
  ...     # hello block
78b99149ed8a test-commandserver: port test functions from .py to .t
Yuya Nishihara <yuya@tcha.org>
parents: 22567
diff changeset
    50
  ...     readchannel(server)
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
  ...     # no args
78b99149ed8a test-commandserver: port test functions from .py to .t
Yuya Nishihara <yuya@tcha.org>
parents: 22567
diff changeset
    53
  ...     runcommand(server, [])
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
  ...     # global options
40354
f9f2faf25fc4 py3: byte-stringify most literals in test-commandserver.t
Yuya Nishihara <yuya@tcha.org>
parents: 39951
diff changeset
    56
  ...     runcommand(server, [b'id', b'--quiet'])
22568
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
  ...     # make sure global options don't stick through requests
40354
f9f2faf25fc4 py3: byte-stringify most literals in test-commandserver.t
Yuya Nishihara <yuya@tcha.org>
parents: 39951
diff changeset
    59
  ...     runcommand(server, [b'id'])
22568
78b99149ed8a test-commandserver: port test functions from .py to .t
Yuya Nishihara <yuya@tcha.org>
parents: 22567
diff changeset
    60
  ... 
78b99149ed8a test-commandserver: port test functions from .py to .t
Yuya Nishihara <yuya@tcha.org>
parents: 22567
diff changeset
    61
  ...     # --config
40354
f9f2faf25fc4 py3: byte-stringify most literals in test-commandserver.t
Yuya Nishihara <yuya@tcha.org>
parents: 39951
diff changeset
    62
  ...     runcommand(server, [b'id', b'--config', b'ui.quiet=True'])
22568
78b99149ed8a test-commandserver: port test functions from .py to .t
Yuya Nishihara <yuya@tcha.org>
parents: 22567
diff changeset
    63
  ... 
78b99149ed8a test-commandserver: port test functions from .py to .t
Yuya Nishihara <yuya@tcha.org>
parents: 22567
diff changeset
    64
  ...     # make sure --config doesn't stick
40354
f9f2faf25fc4 py3: byte-stringify most literals in test-commandserver.t
Yuya Nishihara <yuya@tcha.org>
parents: 39951
diff changeset
    65
  ...     runcommand(server, [b'id'])
22568
78b99149ed8a test-commandserver: port test functions from .py to .t
Yuya Nishihara <yuya@tcha.org>
parents: 22567
diff changeset
    66
  ... 
78b99149ed8a test-commandserver: port test functions from .py to .t
Yuya Nishihara <yuya@tcha.org>
parents: 22567
diff changeset
    67
  ...     # negative return code should be masked
40354
f9f2faf25fc4 py3: byte-stringify most literals in test-commandserver.t
Yuya Nishihara <yuya@tcha.org>
parents: 39951
diff changeset
    68
  ...     runcommand(server, [b'id', b'-runknown'])
22572
cc3d9f776632 test-commandserver: make runcommand message bolder
Yuya Nishihara <yuya@tcha.org>
parents: 22571
diff changeset
    69
  *** 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
    70
  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
    71
  
f9a4a035003d test-commandserver: add stub for .t test by copying .out with 2-space indent
Yuya Nishihara <yuya@tcha.org>
parents:
diff changeset
    72
  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
    73
  
f9a4a035003d test-commandserver: add stub for .t test by copying .out with 2-space indent
Yuya Nishihara <yuya@tcha.org>
parents:
diff changeset
    74
   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
    75
   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
    76
   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
    77
   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
    78
   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
    79
   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
    80
   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
    81
   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
    82
   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
    83
   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
    84
   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
    85
   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
    86
   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
    87
   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
    88
   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
    89
   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
    90
   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
    91
  
29974
7109d5ddeb0c help: use single quotes in use warning
timeless <timeless@mozdev.org>
parents: 29485
diff changeset
    92
  (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
    93
  *** 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
    94
  000000000000
22572
cc3d9f776632 test-commandserver: make runcommand message bolder
Yuya Nishihara <yuya@tcha.org>
parents: 22571
diff changeset
    95
  *** 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
    96
  000000000000 tip
22572
cc3d9f776632 test-commandserver: make runcommand message bolder
Yuya Nishihara <yuya@tcha.org>
parents: 22571
diff changeset
    97
  *** 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
    98
  000000000000
22572
cc3d9f776632 test-commandserver: make runcommand message bolder
Yuya Nishihara <yuya@tcha.org>
parents: 22571
diff changeset
    99
  *** 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
   100
  000000000000 tip
22572
cc3d9f776632 test-commandserver: make runcommand message bolder
Yuya Nishihara <yuya@tcha.org>
parents: 22571
diff changeset
   101
  *** runcommand id -runknown
45906
95c4cca641f6 errors: remove trailing "!" from some error messages for consistency
Martin von Zweigbergk <martinvonz@google.com>
parents: 45827
diff changeset
   102
  abort: unknown revision 'unknown'
48118
5105a9975407 errors: raise InputError from revsingle() iff revset provided by the user
Martin von Zweigbergk <martinvonz@google.com>
parents: 47919
diff changeset
   103
   [10]
22568
78b99149ed8a test-commandserver: port test functions from .py to .t
Yuya Nishihara <yuya@tcha.org>
parents: 22567
diff changeset
   104
40355
77ab5fbdbbf0 py3: use bprint() helper in test-commandserver.t
Yuya Nishihara <yuya@tcha.org>
parents: 40354
diff changeset
   105
  >>> from hgclient import bprint, check, readchannel
22568
78b99149ed8a test-commandserver: port test functions from .py to .t
Yuya Nishihara <yuya@tcha.org>
parents: 22567
diff changeset
   106
  >>> @check
78b99149ed8a test-commandserver: port test functions from .py to .t
Yuya Nishihara <yuya@tcha.org>
parents: 22567
diff changeset
   107
  ... def inputeof(server):
78b99149ed8a test-commandserver: port test functions from .py to .t
Yuya Nishihara <yuya@tcha.org>
parents: 22567
diff changeset
   108
  ...     readchannel(server)
40354
f9f2faf25fc4 py3: byte-stringify most literals in test-commandserver.t
Yuya Nishihara <yuya@tcha.org>
parents: 39951
diff changeset
   109
  ...     server.stdin.write(b'runcommand\n')
22568
78b99149ed8a test-commandserver: port test functions from .py to .t
Yuya Nishihara <yuya@tcha.org>
parents: 22567
diff changeset
   110
  ...     # 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
   111
  ...     server.stdin.close()
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
  ...     # server exits with 1 if the pipe closed while reading the command
40355
77ab5fbdbbf0 py3: use bprint() helper in test-commandserver.t
Yuya Nishihara <yuya@tcha.org>
parents: 40354
diff changeset
   114
  ...     bprint(b'server exit code =', b'%d' % 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
   115
  server exit code = 1
22568
78b99149ed8a test-commandserver: port test functions from .py to .t
Yuya Nishihara <yuya@tcha.org>
parents: 22567
diff changeset
   116
33922
1a6707b43d05 tests: update test-commandserver to pass our import checker
Augie Fackler <raf@durin42.com>
parents: 33921
diff changeset
   117
  >>> 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
   118
  >>> @check
78b99149ed8a test-commandserver: port test functions from .py to .t
Yuya Nishihara <yuya@tcha.org>
parents: 22567
diff changeset
   119
  ... def serverinput(server):
78b99149ed8a test-commandserver: port test functions from .py to .t
Yuya Nishihara <yuya@tcha.org>
parents: 22567
diff changeset
   120
  ...     readchannel(server)
78b99149ed8a test-commandserver: port test functions from .py to .t
Yuya Nishihara <yuya@tcha.org>
parents: 22567
diff changeset
   121
  ... 
40354
f9f2faf25fc4 py3: byte-stringify most literals in test-commandserver.t
Yuya Nishihara <yuya@tcha.org>
parents: 39951
diff changeset
   122
  ...     patch = b"""
22568
78b99149ed8a test-commandserver: port test functions from .py to .t
Yuya Nishihara <yuya@tcha.org>
parents: 22567
diff changeset
   123
  ... # HG changeset patch
78b99149ed8a test-commandserver: port test functions from .py to .t
Yuya Nishihara <yuya@tcha.org>
parents: 22567
diff changeset
   124
  ... # User test
78b99149ed8a test-commandserver: port test functions from .py to .t
Yuya Nishihara <yuya@tcha.org>
parents: 22567
diff changeset
   125
  ... # Date 0 0
78b99149ed8a test-commandserver: port test functions from .py to .t
Yuya Nishihara <yuya@tcha.org>
parents: 22567
diff changeset
   126
  ... # Node ID c103a3dec114d882c98382d684d8af798d09d857
78b99149ed8a test-commandserver: port test functions from .py to .t
Yuya Nishihara <yuya@tcha.org>
parents: 22567
diff changeset
   127
  ... # Parent  0000000000000000000000000000000000000000
78b99149ed8a test-commandserver: port test functions from .py to .t
Yuya Nishihara <yuya@tcha.org>
parents: 22567
diff changeset
   128
  ... 1
78b99149ed8a test-commandserver: port test functions from .py to .t
Yuya Nishihara <yuya@tcha.org>
parents: 22567
diff changeset
   129
  ... 
78b99149ed8a test-commandserver: port test functions from .py to .t
Yuya Nishihara <yuya@tcha.org>
parents: 22567
diff changeset
   130
  ... diff -r 000000000000 -r c103a3dec114 a
78b99149ed8a test-commandserver: port test functions from .py to .t
Yuya Nishihara <yuya@tcha.org>
parents: 22567
diff changeset
   131
  ... --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
78b99149ed8a test-commandserver: port test functions from .py to .t
Yuya Nishihara <yuya@tcha.org>
parents: 22567
diff changeset
   132
  ... +++ b/a	Thu Jan 01 00:00:00 1970 +0000
78b99149ed8a test-commandserver: port test functions from .py to .t
Yuya Nishihara <yuya@tcha.org>
parents: 22567
diff changeset
   133
  ... @@ -0,0 +1,1 @@
78b99149ed8a test-commandserver: port test functions from .py to .t
Yuya Nishihara <yuya@tcha.org>
parents: 22567
diff changeset
   134
  ... +1
78b99149ed8a test-commandserver: port test functions from .py to .t
Yuya Nishihara <yuya@tcha.org>
parents: 22567
diff changeset
   135
  ... """
78b99149ed8a test-commandserver: port test functions from .py to .t
Yuya Nishihara <yuya@tcha.org>
parents: 22567
diff changeset
   136
  ... 
40354
f9f2faf25fc4 py3: byte-stringify most literals in test-commandserver.t
Yuya Nishihara <yuya@tcha.org>
parents: 39951
diff changeset
   137
  ...     runcommand(server, [b'import', b'-'], input=stringio(patch))
f9f2faf25fc4 py3: byte-stringify most literals in test-commandserver.t
Yuya Nishihara <yuya@tcha.org>
parents: 39951
diff changeset
   138
  ...     runcommand(server, [b'log'])
22572
cc3d9f776632 test-commandserver: make runcommand message bolder
Yuya Nishihara <yuya@tcha.org>
parents: 22571
diff changeset
   139
  *** 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
   140
  applying patch from stdin
22572
cc3d9f776632 test-commandserver: make runcommand message bolder
Yuya Nishihara <yuya@tcha.org>
parents: 22571
diff changeset
   141
  *** 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
   142
  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
   143
  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
   144
  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
   145
  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
   146
  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
   147
  
22568
78b99149ed8a test-commandserver: port test functions from .py to .t
Yuya Nishihara <yuya@tcha.org>
parents: 22567
diff changeset
   148
35170
c9740b69b9b7 dispatch: add HGPLAIN=+strictflags to restrict early parsing of global options
Yuya Nishihara <yuya@tcha.org>
parents: 34942
diff changeset
   149
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
   150
c9740b69b9b7 dispatch: add HGPLAIN=+strictflags to restrict early parsing of global options
Yuya Nishihara <yuya@tcha.org>
parents: 34942
diff changeset
   151
  >>> import os
c9740b69b9b7 dispatch: add HGPLAIN=+strictflags to restrict early parsing of global options
Yuya Nishihara <yuya@tcha.org>
parents: 34942
diff changeset
   152
  >>> 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
   153
  >>> 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
   154
  >>> @check
c9740b69b9b7 dispatch: add HGPLAIN=+strictflags to restrict early parsing of global options
Yuya Nishihara <yuya@tcha.org>
parents: 34942
diff changeset
   155
  ... def cwd(server):
c9740b69b9b7 dispatch: add HGPLAIN=+strictflags to restrict early parsing of global options
Yuya Nishihara <yuya@tcha.org>
parents: 34942
diff changeset
   156
  ...     readchannel(server)
40354
f9f2faf25fc4 py3: byte-stringify most literals in test-commandserver.t
Yuya Nishihara <yuya@tcha.org>
parents: 39951
diff changeset
   157
  ...     runcommand(server, [b'log', b'-b', b'--config=alias.log=!echo pwned',
f9f2faf25fc4 py3: byte-stringify most literals in test-commandserver.t
Yuya Nishihara <yuya@tcha.org>
parents: 39951
diff changeset
   158
  ...                         b'default'])
35170
c9740b69b9b7 dispatch: add HGPLAIN=+strictflags to restrict early parsing of global options
Yuya Nishihara <yuya@tcha.org>
parents: 34942
diff changeset
   159
  *** runcommand log -b --config=alias.log=!echo pwned default
45906
95c4cca641f6 errors: remove trailing "!" from some error messages for consistency
Martin von Zweigbergk <martinvonz@google.com>
parents: 45827
diff changeset
   160
  abort: unknown revision '--config=alias.log=!echo pwned'
48368
8c4881c07f57 errors: use detailed exit code for RepoLookupError
Martin von Zweigbergk <martinvonz@google.com>
parents: 48295
diff changeset
   161
   [10]
35170
c9740b69b9b7 dispatch: add HGPLAIN=+strictflags to restrict early parsing of global options
Yuya Nishihara <yuya@tcha.org>
parents: 34942
diff changeset
   162
30262
bc5d0e6fd9f3 histedit: use ui.fin to read commands from stdin
Yuya Nishihara <yuya@tcha.org>
parents: 29974
diff changeset
   163
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
   164
40356
756e9b1084fd py3: import StringIO from test utility to test-commandserver.t
Yuya Nishihara <yuya@tcha.org>
parents: 40355
diff changeset
   165
  >>> from hgclient import check, readchannel, runcommand, stringio
30262
bc5d0e6fd9f3 histedit: use ui.fin to read commands from stdin
Yuya Nishihara <yuya@tcha.org>
parents: 29974
diff changeset
   166
  >>> @check
bc5d0e6fd9f3 histedit: use ui.fin to read commands from stdin
Yuya Nishihara <yuya@tcha.org>
parents: 29974
diff changeset
   167
  ... def serverinput(server):
bc5d0e6fd9f3 histedit: use ui.fin to read commands from stdin
Yuya Nishihara <yuya@tcha.org>
parents: 29974
diff changeset
   168
  ...     readchannel(server)
40354
f9f2faf25fc4 py3: byte-stringify most literals in test-commandserver.t
Yuya Nishihara <yuya@tcha.org>
parents: 39951
diff changeset
   169
  ...     rules = b'pick eff892de26ec\n'
f9f2faf25fc4 py3: byte-stringify most literals in test-commandserver.t
Yuya Nishihara <yuya@tcha.org>
parents: 39951
diff changeset
   170
  ...     runcommand(server, [b'histedit', b'0', b'--commands=-',
f9f2faf25fc4 py3: byte-stringify most literals in test-commandserver.t
Yuya Nishihara <yuya@tcha.org>
parents: 39951
diff changeset
   171
  ...                         b'--config', b'extensions.histedit='],
40356
756e9b1084fd py3: import StringIO from test utility to test-commandserver.t
Yuya Nishihara <yuya@tcha.org>
parents: 40355
diff changeset
   172
  ...                input=stringio(rules))
30262
bc5d0e6fd9f3 histedit: use ui.fin to read commands from stdin
Yuya Nishihara <yuya@tcha.org>
parents: 29974
diff changeset
   173
  *** 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
   174
22568
78b99149ed8a test-commandserver: port test functions from .py to .t
Yuya Nishihara <yuya@tcha.org>
parents: 22567
diff changeset
   175
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
   176
78b99149ed8a test-commandserver: port test functions from .py to .t
Yuya Nishihara <yuya@tcha.org>
parents: 22567
diff changeset
   177
  $ mkdir foo
78b99149ed8a test-commandserver: port test functions from .py to .t
Yuya Nishihara <yuya@tcha.org>
parents: 22567
diff changeset
   178
  $ touch foo/bar
33922
1a6707b43d05 tests: update test-commandserver to pass our import checker
Augie Fackler <raf@durin42.com>
parents: 33921
diff changeset
   179
  >>> 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
   180
  >>> @check
78b99149ed8a test-commandserver: port test functions from .py to .t
Yuya Nishihara <yuya@tcha.org>
parents: 22567
diff changeset
   181
  ... def cwd(server):
78b99149ed8a test-commandserver: port test functions from .py to .t
Yuya Nishihara <yuya@tcha.org>
parents: 22567
diff changeset
   182
  ...     readchannel(server)
40354
f9f2faf25fc4 py3: byte-stringify most literals in test-commandserver.t
Yuya Nishihara <yuya@tcha.org>
parents: 39951
diff changeset
   183
  ...     runcommand(server, [b'--cwd', b'foo', b'st', b'bar'])
f9f2faf25fc4 py3: byte-stringify most literals in test-commandserver.t
Yuya Nishihara <yuya@tcha.org>
parents: 39951
diff changeset
   184
  ...     runcommand(server, [b'st', b'foo/bar'])
22572
cc3d9f776632 test-commandserver: make runcommand message bolder
Yuya Nishihara <yuya@tcha.org>
parents: 22571
diff changeset
   185
  *** 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
   186
  ? bar
22572
cc3d9f776632 test-commandserver: make runcommand message bolder
Yuya Nishihara <yuya@tcha.org>
parents: 22571
diff changeset
   187
  *** 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
   188
  ? foo/bar
22568
78b99149ed8a test-commandserver: port test functions from .py to .t
Yuya Nishihara <yuya@tcha.org>
parents: 22567
diff changeset
   189
78b99149ed8a test-commandserver: port test functions from .py to .t
Yuya Nishihara <yuya@tcha.org>
parents: 22567
diff changeset
   190
  $ rm foo/bar
78b99149ed8a test-commandserver: port test functions from .py to .t
Yuya Nishihara <yuya@tcha.org>
parents: 22567
diff changeset
   191
78b99149ed8a test-commandserver: port test functions from .py to .t
Yuya Nishihara <yuya@tcha.org>
parents: 22567
diff changeset
   192
78b99149ed8a test-commandserver: port test functions from .py to .t
Yuya Nishihara <yuya@tcha.org>
parents: 22567
diff changeset
   193
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
   194
78b99149ed8a test-commandserver: port test functions from .py to .t
Yuya Nishihara <yuya@tcha.org>
parents: 22567
diff changeset
   195
  $ cat <<EOF >> .hg/hgrc
78b99149ed8a test-commandserver: port test functions from .py to .t
Yuya Nishihara <yuya@tcha.org>
parents: 22567
diff changeset
   196
  > [ui]
78b99149ed8a test-commandserver: port test functions from .py to .t
Yuya Nishihara <yuya@tcha.org>
parents: 22567
diff changeset
   197
  > foo = bar
78b99149ed8a test-commandserver: port test functions from .py to .t
Yuya Nishihara <yuya@tcha.org>
parents: 22567
diff changeset
   198
  > EOF
78b99149ed8a test-commandserver: port test functions from .py to .t
Yuya Nishihara <yuya@tcha.org>
parents: 22567
diff changeset
   199
37427
6282c1965f8e tests: conditionalize test-commandserver.t based on extra extensions
Gregory Szorc <gregory.szorc@gmail.com>
parents: 37220
diff changeset
   200
#if no-extraextensions
6282c1965f8e tests: conditionalize test-commandserver.t based on extra extensions
Gregory Szorc <gregory.szorc@gmail.com>
parents: 37220
diff changeset
   201
33922
1a6707b43d05 tests: update test-commandserver to pass our import checker
Augie Fackler <raf@durin42.com>
parents: 33921
diff changeset
   202
  >>> 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
   203
  >>> @check
78b99149ed8a test-commandserver: port test functions from .py to .t
Yuya Nishihara <yuya@tcha.org>
parents: 22567
diff changeset
   204
  ... def localhgrc(server):
78b99149ed8a test-commandserver: port test functions from .py to .t
Yuya Nishihara <yuya@tcha.org>
parents: 22567
diff changeset
   205
  ...     readchannel(server)
78b99149ed8a test-commandserver: port test functions from .py to .t
Yuya Nishihara <yuya@tcha.org>
parents: 22567
diff changeset
   206
  ... 
78b99149ed8a test-commandserver: port test functions from .py to .t
Yuya Nishihara <yuya@tcha.org>
parents: 22567
diff changeset
   207
  ...     # 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
   208
  ...     # show it
40354
f9f2faf25fc4 py3: byte-stringify most literals in test-commandserver.t
Yuya Nishihara <yuya@tcha.org>
parents: 39951
diff changeset
   209
  ...     runcommand(server, [b'showconfig'], outfilter=sep)
22568
78b99149ed8a test-commandserver: port test functions from .py to .t
Yuya Nishihara <yuya@tcha.org>
parents: 22567
diff changeset
   210
  ... 
78b99149ed8a test-commandserver: port test functions from .py to .t
Yuya Nishihara <yuya@tcha.org>
parents: 22567
diff changeset
   211
  ...     # but not for this repo
40354
f9f2faf25fc4 py3: byte-stringify most literals in test-commandserver.t
Yuya Nishihara <yuya@tcha.org>
parents: 39951
diff changeset
   212
  ...     runcommand(server, [b'init', b'foo'])
f9f2faf25fc4 py3: byte-stringify most literals in test-commandserver.t
Yuya Nishihara <yuya@tcha.org>
parents: 39951
diff changeset
   213
  ...     runcommand(server, [b'-R', b'foo', b'showconfig', b'ui', b'defaults'])
22572
cc3d9f776632 test-commandserver: make runcommand message bolder
Yuya Nishihara <yuya@tcha.org>
parents: 22571
diff changeset
   214
  *** 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
   215
  bundle.mainreporoot=$TESTTMP/repo
47776
036b9b3cc79a run-tests: use a small timeout for chg instance
Pierre-Yves David <pierre-yves.david@octobus.net>
parents: 47587
diff changeset
   216
  chgserver.idletimeout=60
25290
8f88f768e24c devel: rename 'all' to 'all-warnings' (BC)
Pierre-Yves David <pierre-yves.david@fb.com>
parents: 24751
diff changeset
   217
  devel.all-warnings=true
32410
f94d7e3e46a0 devel: activate default-date in tests
Pierre-Yves David <pierre-yves.david@octobus.net>
parents: 32337
diff changeset
   218
  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
   219
  extensions.fsmonitor= (fsmonitor !)
48674
f7086f6173f8 dirstate-v2: rename the configuration to enable the format
Pierre-Yves David <pierre-yves.david@octobus.net>
parents: 48295
diff changeset
   220
  format.use-dirstate-v2=1 (dirstate-v2 !)
23388
42ed0780ec4b run-tests: set a default largefiles usercache in the default hgrc file
Matt Harbison <matt_harbison@yahoo.com>
parents: 23324
diff changeset
   221
  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
   222
  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
   223
  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
   224
  ui.interactive=False
45826
21733e8c924f errors: add config that lets user get more detailed exit codes
Martin von Zweigbergk <martinvonz@google.com>
parents: 45765
diff changeset
   225
  ui.detailed-exit-code=True
40470
d6b6f1b441cf run-tests: define the default merge tool through configuration
Boris Feld <boris.feld@octobus.net>
parents: 40362
diff changeset
   226
  ui.merge=internal:merge
22567
f9a4a035003d test-commandserver: add stub for .t test by copying .out with 2-space indent
Yuya Nishihara <yuya@tcha.org>
parents:
diff changeset
   227
  ui.mergemarkers=detailed
47919
a28a7dcb9158 tests: setup dummyssh as the default ssh
Valentin Gatien-Baron <valentin.gatienbaron@gmail.com>
parents: 47776
diff changeset
   228
  ui.ssh=* (glob)
46015
f44b9c72f061 run-tests: allow some slack about 'waiting on lock' message
Pierre-Yves David <pierre-yves.david@octobus.net>
parents: 45906
diff changeset
   229
  ui.timeout.warn=15
22567
f9a4a035003d test-commandserver: add stub for .t test by copying .out with 2-space indent
Yuya Nishihara <yuya@tcha.org>
parents:
diff changeset
   230
  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
   231
  ui.nontty=true
31009
161ab32b44a1 runtests: set web.address to localhost
Jun Wu <quark@fb.com>
parents: 30986
diff changeset
   232
  web.address=localhost
31010
09ec648cd2a9 runtests: always set web.ipv6
Jun Wu <quark@fb.com>
parents: 31009
diff changeset
   233
  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
   234
  web.server-header=testing stub value
22572
cc3d9f776632 test-commandserver: make runcommand message bolder
Yuya Nishihara <yuya@tcha.org>
parents: 22571
diff changeset
   235
  *** runcommand init foo
cc3d9f776632 test-commandserver: make runcommand message bolder
Yuya Nishihara <yuya@tcha.org>
parents: 22571
diff changeset
   236
  *** 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
   237
  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
   238
  ui.interactive=False
45826
21733e8c924f errors: add config that lets user get more detailed exit codes
Martin von Zweigbergk <martinvonz@google.com>
parents: 45765
diff changeset
   239
  ui.detailed-exit-code=True
40470
d6b6f1b441cf run-tests: define the default merge tool through configuration
Boris Feld <boris.feld@octobus.net>
parents: 40362
diff changeset
   240
  ui.merge=internal:merge
22567
f9a4a035003d test-commandserver: add stub for .t test by copying .out with 2-space indent
Yuya Nishihara <yuya@tcha.org>
parents:
diff changeset
   241
  ui.mergemarkers=detailed
47919
a28a7dcb9158 tests: setup dummyssh as the default ssh
Valentin Gatien-Baron <valentin.gatienbaron@gmail.com>
parents: 47776
diff changeset
   242
  ui.ssh=* (glob)
46015
f44b9c72f061 run-tests: allow some slack about 'waiting on lock' message
Pierre-Yves David <pierre-yves.david@octobus.net>
parents: 45906
diff changeset
   243
  ui.timeout.warn=15
22567
f9a4a035003d test-commandserver: add stub for .t test by copying .out with 2-space indent
Yuya Nishihara <yuya@tcha.org>
parents:
diff changeset
   244
  ui.nontty=true
37427
6282c1965f8e tests: conditionalize test-commandserver.t based on extra extensions
Gregory Szorc <gregory.szorc@gmail.com>
parents: 37220
diff changeset
   245
#endif
22568
78b99149ed8a test-commandserver: port test functions from .py to .t
Yuya Nishihara <yuya@tcha.org>
parents: 22567
diff changeset
   246
78b99149ed8a test-commandserver: port test functions from .py to .t
Yuya Nishihara <yuya@tcha.org>
parents: 22567
diff changeset
   247
  $ rm -R foo
78b99149ed8a test-commandserver: port test functions from .py to .t
Yuya Nishihara <yuya@tcha.org>
parents: 22567
diff changeset
   248
78b99149ed8a test-commandserver: port test functions from .py to .t
Yuya Nishihara <yuya@tcha.org>
parents: 22567
diff changeset
   249
#if windows
78b99149ed8a test-commandserver: port test functions from .py to .t
Yuya Nishihara <yuya@tcha.org>
parents: 22567
diff changeset
   250
  $ PYTHONPATH="$TESTTMP/repo;$PYTHONPATH"
78b99149ed8a test-commandserver: port test functions from .py to .t
Yuya Nishihara <yuya@tcha.org>
parents: 22567
diff changeset
   251
#else
78b99149ed8a test-commandserver: port test functions from .py to .t
Yuya Nishihara <yuya@tcha.org>
parents: 22567
diff changeset
   252
  $ PYTHONPATH="$TESTTMP/repo:$PYTHONPATH"
78b99149ed8a test-commandserver: port test functions from .py to .t
Yuya Nishihara <yuya@tcha.org>
parents: 22567
diff changeset
   253
#endif
78b99149ed8a test-commandserver: port test functions from .py to .t
Yuya Nishihara <yuya@tcha.org>
parents: 22567
diff changeset
   254
78b99149ed8a test-commandserver: port test functions from .py to .t
Yuya Nishihara <yuya@tcha.org>
parents: 22567
diff changeset
   255
  $ cat <<EOF > hook.py
78b99149ed8a test-commandserver: port test functions from .py to .t
Yuya Nishihara <yuya@tcha.org>
parents: 22567
diff changeset
   256
  > import sys
40355
77ab5fbdbbf0 py3: use bprint() helper in test-commandserver.t
Yuya Nishihara <yuya@tcha.org>
parents: 40354
diff changeset
   257
  > from hgclient import bprint
22568
78b99149ed8a test-commandserver: port test functions from .py to .t
Yuya Nishihara <yuya@tcha.org>
parents: 22567
diff changeset
   258
  > def hook(**args):
40355
77ab5fbdbbf0 py3: use bprint() helper in test-commandserver.t
Yuya Nishihara <yuya@tcha.org>
parents: 40354
diff changeset
   259
  >     bprint(b'hook talking')
77ab5fbdbbf0 py3: use bprint() helper in test-commandserver.t
Yuya Nishihara <yuya@tcha.org>
parents: 40354
diff changeset
   260
  >     bprint(b'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
   261
  > EOF
78b99149ed8a test-commandserver: port test functions from .py to .t
Yuya Nishihara <yuya@tcha.org>
parents: 22567
diff changeset
   262
33922
1a6707b43d05 tests: update test-commandserver to pass our import checker
Augie Fackler <raf@durin42.com>
parents: 33921
diff changeset
   263
  >>> 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
   264
  >>> @check
78b99149ed8a test-commandserver: port test functions from .py to .t
Yuya Nishihara <yuya@tcha.org>
parents: 22567
diff changeset
   265
  ... def hookoutput(server):
78b99149ed8a test-commandserver: port test functions from .py to .t
Yuya Nishihara <yuya@tcha.org>
parents: 22567
diff changeset
   266
  ...     readchannel(server)
40354
f9f2faf25fc4 py3: byte-stringify most literals in test-commandserver.t
Yuya Nishihara <yuya@tcha.org>
parents: 39951
diff changeset
   267
  ...     runcommand(server, [b'--config',
f9f2faf25fc4 py3: byte-stringify most literals in test-commandserver.t
Yuya Nishihara <yuya@tcha.org>
parents: 39951
diff changeset
   268
  ...                         b'hooks.pre-identify=python:hook.hook',
f9f2faf25fc4 py3: byte-stringify most literals in test-commandserver.t
Yuya Nishihara <yuya@tcha.org>
parents: 39951
diff changeset
   269
  ...                         b'id'],
f9f2faf25fc4 py3: byte-stringify most literals in test-commandserver.t
Yuya Nishihara <yuya@tcha.org>
parents: 39951
diff changeset
   270
  ...                input=stringio(b'some input'))
22572
cc3d9f776632 test-commandserver: make runcommand message bolder
Yuya Nishihara <yuya@tcha.org>
parents: 22571
diff changeset
   271
  *** 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
   272
  eff892de26ec tip
37220
7f78de1c93aa procutil: redirect ui.fout to stderr while stdio is protected
Yuya Nishihara <yuya@tcha.org>
parents: 37009
diff changeset
   273
  hook talking
7f78de1c93aa procutil: redirect ui.fout to stderr while stdio is protected
Yuya Nishihara <yuya@tcha.org>
parents: 37009
diff changeset
   274
  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
   275
33607
6c142f279625 pypy: fix failing test files with Pypy5.6.0
Boris Feld <boris.feld@octobus.net>
parents: 33542
diff changeset
   276
Clean hook cached version
22568
78b99149ed8a test-commandserver: port test functions from .py to .t
Yuya Nishihara <yuya@tcha.org>
parents: 22567
diff changeset
   277
  $ rm hook.py*
33607
6c142f279625 pypy: fix failing test files with Pypy5.6.0
Boris Feld <boris.feld@octobus.net>
parents: 33542
diff changeset
   278
  $ rm -Rf __pycache__
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
  $ echo a >> a
78b99149ed8a test-commandserver: port test functions from .py to .t
Yuya Nishihara <yuya@tcha.org>
parents: 22567
diff changeset
   281
  >>> import os
33922
1a6707b43d05 tests: update test-commandserver to pass our import checker
Augie Fackler <raf@durin42.com>
parents: 33921
diff changeset
   282
  >>> 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
   283
  >>> @check
78b99149ed8a test-commandserver: port test functions from .py to .t
Yuya Nishihara <yuya@tcha.org>
parents: 22567
diff changeset
   284
  ... def outsidechanges(server):
78b99149ed8a test-commandserver: port test functions from .py to .t
Yuya Nishihara <yuya@tcha.org>
parents: 22567
diff changeset
   285
  ...     readchannel(server)
40354
f9f2faf25fc4 py3: byte-stringify most literals in test-commandserver.t
Yuya Nishihara <yuya@tcha.org>
parents: 39951
diff changeset
   286
  ...     runcommand(server, [b'status'])
22568
78b99149ed8a test-commandserver: port test functions from .py to .t
Yuya Nishihara <yuya@tcha.org>
parents: 22567
diff changeset
   287
  ...     os.system('hg ci -Am2')
40354
f9f2faf25fc4 py3: byte-stringify most literals in test-commandserver.t
Yuya Nishihara <yuya@tcha.org>
parents: 39951
diff changeset
   288
  ...     runcommand(server, [b'tip'])
f9f2faf25fc4 py3: byte-stringify most literals in test-commandserver.t
Yuya Nishihara <yuya@tcha.org>
parents: 39951
diff changeset
   289
  ...     runcommand(server, [b'status'])
22572
cc3d9f776632 test-commandserver: make runcommand message bolder
Yuya Nishihara <yuya@tcha.org>
parents: 22571
diff changeset
   290
  *** 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
   291
  M a
22572
cc3d9f776632 test-commandserver: make runcommand message bolder
Yuya Nishihara <yuya@tcha.org>
parents: 22571
diff changeset
   292
  *** 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
   293
  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
   294
  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
   295
  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
   296
  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
   297
  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
   298
  
22572
cc3d9f776632 test-commandserver: make runcommand message bolder
Yuya Nishihara <yuya@tcha.org>
parents: 22571
diff changeset
   299
  *** runcommand status
22568
78b99149ed8a test-commandserver: port test functions from .py to .t
Yuya Nishihara <yuya@tcha.org>
parents: 22567
diff changeset
   300
78b99149ed8a test-commandserver: port test functions from .py to .t
Yuya Nishihara <yuya@tcha.org>
parents: 22567
diff changeset
   301
  >>> import os
40355
77ab5fbdbbf0 py3: use bprint() helper in test-commandserver.t
Yuya Nishihara <yuya@tcha.org>
parents: 40354
diff changeset
   302
  >>> from hgclient import bprint, check, readchannel, runcommand
22568
78b99149ed8a test-commandserver: port test functions from .py to .t
Yuya Nishihara <yuya@tcha.org>
parents: 22567
diff changeset
   303
  >>> @check
78b99149ed8a test-commandserver: port test functions from .py to .t
Yuya Nishihara <yuya@tcha.org>
parents: 22567
diff changeset
   304
  ... def bookmarks(server):
78b99149ed8a test-commandserver: port test functions from .py to .t
Yuya Nishihara <yuya@tcha.org>
parents: 22567
diff changeset
   305
  ...     readchannel(server)
40354
f9f2faf25fc4 py3: byte-stringify most literals in test-commandserver.t
Yuya Nishihara <yuya@tcha.org>
parents: 39951
diff changeset
   306
  ...     runcommand(server, [b'bookmarks'])
22568
78b99149ed8a test-commandserver: port test functions from .py to .t
Yuya Nishihara <yuya@tcha.org>
parents: 22567
diff changeset
   307
  ... 
78b99149ed8a test-commandserver: port test functions from .py to .t
Yuya Nishihara <yuya@tcha.org>
parents: 22567
diff changeset
   308
  ...     # changes .hg/bookmarks
78b99149ed8a test-commandserver: port test functions from .py to .t
Yuya Nishihara <yuya@tcha.org>
parents: 22567
diff changeset
   309
  ...     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
   310
  ...     os.system('hg bookmark -i bm2')
40354
f9f2faf25fc4 py3: byte-stringify most literals in test-commandserver.t
Yuya Nishihara <yuya@tcha.org>
parents: 39951
diff changeset
   311
  ...     runcommand(server, [b'bookmarks'])
22568
78b99149ed8a test-commandserver: port test functions from .py to .t
Yuya Nishihara <yuya@tcha.org>
parents: 22567
diff changeset
   312
  ... 
78b99149ed8a test-commandserver: port test functions from .py to .t
Yuya Nishihara <yuya@tcha.org>
parents: 22567
diff changeset
   313
  ...     # changes .hg/bookmarks.current
78b99149ed8a test-commandserver: port test functions from .py to .t
Yuya Nishihara <yuya@tcha.org>
parents: 22567
diff changeset
   314
  ...     os.system('hg upd bm1 -q')
40354
f9f2faf25fc4 py3: byte-stringify most literals in test-commandserver.t
Yuya Nishihara <yuya@tcha.org>
parents: 39951
diff changeset
   315
  ...     runcommand(server, [b'bookmarks'])
22568
78b99149ed8a test-commandserver: port test functions from .py to .t
Yuya Nishihara <yuya@tcha.org>
parents: 22567
diff changeset
   316
  ... 
40354
f9f2faf25fc4 py3: byte-stringify most literals in test-commandserver.t
Yuya Nishihara <yuya@tcha.org>
parents: 39951
diff changeset
   317
  ...     runcommand(server, [b'bookmarks', b'bm3'])
22568
78b99149ed8a test-commandserver: port test functions from .py to .t
Yuya Nishihara <yuya@tcha.org>
parents: 22567
diff changeset
   318
  ...     f = open('a', 'ab')
40354
f9f2faf25fc4 py3: byte-stringify most literals in test-commandserver.t
Yuya Nishihara <yuya@tcha.org>
parents: 39951
diff changeset
   319
  ...     f.write(b'a\n') and None
22568
78b99149ed8a test-commandserver: port test functions from .py to .t
Yuya Nishihara <yuya@tcha.org>
parents: 22567
diff changeset
   320
  ...     f.close()
40354
f9f2faf25fc4 py3: byte-stringify most literals in test-commandserver.t
Yuya Nishihara <yuya@tcha.org>
parents: 39951
diff changeset
   321
  ...     runcommand(server, [b'commit', b'-Amm'])
f9f2faf25fc4 py3: byte-stringify most literals in test-commandserver.t
Yuya Nishihara <yuya@tcha.org>
parents: 39951
diff changeset
   322
  ...     runcommand(server, [b'bookmarks'])
40355
77ab5fbdbbf0 py3: use bprint() helper in test-commandserver.t
Yuya Nishihara <yuya@tcha.org>
parents: 40354
diff changeset
   323
  ...     bprint(b'')
22572
cc3d9f776632 test-commandserver: make runcommand message bolder
Yuya Nishihara <yuya@tcha.org>
parents: 22571
diff changeset
   324
  *** 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
   325
  no bookmarks set
22572
cc3d9f776632 test-commandserver: make runcommand message bolder
Yuya Nishihara <yuya@tcha.org>
parents: 22571
diff changeset
   326
  *** 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
   327
     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
   328
     bm2                       1:d3a0a68be6de
22572
cc3d9f776632 test-commandserver: make runcommand message bolder
Yuya Nishihara <yuya@tcha.org>
parents: 22571
diff changeset
   329
  *** 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
   330
   * 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
   331
     bm2                       1:d3a0a68be6de
22572
cc3d9f776632 test-commandserver: make runcommand message bolder
Yuya Nishihara <yuya@tcha.org>
parents: 22571
diff changeset
   332
  *** runcommand bookmarks bm3
cc3d9f776632 test-commandserver: make runcommand message bolder
Yuya Nishihara <yuya@tcha.org>
parents: 22571
diff changeset
   333
  *** runcommand commit -Amm
cc3d9f776632 test-commandserver: make runcommand message bolder
Yuya Nishihara <yuya@tcha.org>
parents: 22571
diff changeset
   334
  *** 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
   335
     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
   336
     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
   337
   * bm3                       2:aef17e88f5f0
33921
a4c1333b2eda tests: add blank output lines to test-commandserver
Augie Fackler <raf@durin42.com>
parents: 33773
diff changeset
   338
  
22568
78b99149ed8a test-commandserver: port test functions from .py to .t
Yuya Nishihara <yuya@tcha.org>
parents: 22567
diff changeset
   339
78b99149ed8a test-commandserver: port test functions from .py to .t
Yuya Nishihara <yuya@tcha.org>
parents: 22567
diff changeset
   340
  >>> import os
33922
1a6707b43d05 tests: update test-commandserver to pass our import checker
Augie Fackler <raf@durin42.com>
parents: 33921
diff changeset
   341
  >>> 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
   342
  >>> @check
78b99149ed8a test-commandserver: port test functions from .py to .t
Yuya Nishihara <yuya@tcha.org>
parents: 22567
diff changeset
   343
  ... def tagscache(server):
78b99149ed8a test-commandserver: port test functions from .py to .t
Yuya Nishihara <yuya@tcha.org>
parents: 22567
diff changeset
   344
  ...     readchannel(server)
40354
f9f2faf25fc4 py3: byte-stringify most literals in test-commandserver.t
Yuya Nishihara <yuya@tcha.org>
parents: 39951
diff changeset
   345
  ...     runcommand(server, [b'id', b'-t', b'-r', b'0'])
22568
78b99149ed8a test-commandserver: port test functions from .py to .t
Yuya Nishihara <yuya@tcha.org>
parents: 22567
diff changeset
   346
  ...     os.system('hg tag -r 0 foo')
40354
f9f2faf25fc4 py3: byte-stringify most literals in test-commandserver.t
Yuya Nishihara <yuya@tcha.org>
parents: 39951
diff changeset
   347
  ...     runcommand(server, [b'id', b'-t', b'-r', b'0'])
22572
cc3d9f776632 test-commandserver: make runcommand message bolder
Yuya Nishihara <yuya@tcha.org>
parents: 22571
diff changeset
   348
  *** 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
   349
  
22572
cc3d9f776632 test-commandserver: make runcommand message bolder
Yuya Nishihara <yuya@tcha.org>
parents: 22571
diff changeset
   350
  *** 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
   351
  foo
22568
78b99149ed8a test-commandserver: port test functions from .py to .t
Yuya Nishihara <yuya@tcha.org>
parents: 22567
diff changeset
   352
78b99149ed8a test-commandserver: port test functions from .py to .t
Yuya Nishihara <yuya@tcha.org>
parents: 22567
diff changeset
   353
  >>> import os
33922
1a6707b43d05 tests: update test-commandserver to pass our import checker
Augie Fackler <raf@durin42.com>
parents: 33921
diff changeset
   354
  >>> 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
   355
  >>> @check
78b99149ed8a test-commandserver: port test functions from .py to .t
Yuya Nishihara <yuya@tcha.org>
parents: 22567
diff changeset
   356
  ... def setphase(server):
78b99149ed8a test-commandserver: port test functions from .py to .t
Yuya Nishihara <yuya@tcha.org>
parents: 22567
diff changeset
   357
  ...     readchannel(server)
40354
f9f2faf25fc4 py3: byte-stringify most literals in test-commandserver.t
Yuya Nishihara <yuya@tcha.org>
parents: 39951
diff changeset
   358
  ...     runcommand(server, [b'phase', b'-r', b'.'])
22568
78b99149ed8a test-commandserver: port test functions from .py to .t
Yuya Nishihara <yuya@tcha.org>
parents: 22567
diff changeset
   359
  ...     os.system('hg phase -r . -p')
40354
f9f2faf25fc4 py3: byte-stringify most literals in test-commandserver.t
Yuya Nishihara <yuya@tcha.org>
parents: 39951
diff changeset
   360
  ...     runcommand(server, [b'phase', b'-r', b'.'])
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: draft
22572
cc3d9f776632 test-commandserver: make runcommand message bolder
Yuya Nishihara <yuya@tcha.org>
parents: 22571
diff changeset
   363
  *** 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
   364
  3: public
22568
78b99149ed8a test-commandserver: port test functions from .py to .t
Yuya Nishihara <yuya@tcha.org>
parents: 22567
diff changeset
   365
78b99149ed8a test-commandserver: port test functions from .py to .t
Yuya Nishihara <yuya@tcha.org>
parents: 22567
diff changeset
   366
  $ echo a >> a
40355
77ab5fbdbbf0 py3: use bprint() helper in test-commandserver.t
Yuya Nishihara <yuya@tcha.org>
parents: 40354
diff changeset
   367
  >>> from hgclient import bprint, check, readchannel, runcommand
22568
78b99149ed8a test-commandserver: port test functions from .py to .t
Yuya Nishihara <yuya@tcha.org>
parents: 22567
diff changeset
   368
  >>> @check
78b99149ed8a test-commandserver: port test functions from .py to .t
Yuya Nishihara <yuya@tcha.org>
parents: 22567
diff changeset
   369
  ... def rollback(server):
78b99149ed8a test-commandserver: port test functions from .py to .t
Yuya Nishihara <yuya@tcha.org>
parents: 22567
diff changeset
   370
  ...     readchannel(server)
40354
f9f2faf25fc4 py3: byte-stringify most literals in test-commandserver.t
Yuya Nishihara <yuya@tcha.org>
parents: 39951
diff changeset
   371
  ...     runcommand(server, [b'phase', b'-r', b'.', b'-p'])
f9f2faf25fc4 py3: byte-stringify most literals in test-commandserver.t
Yuya Nishihara <yuya@tcha.org>
parents: 39951
diff changeset
   372
  ...     runcommand(server, [b'commit', b'-Am.'])
f9f2faf25fc4 py3: byte-stringify most literals in test-commandserver.t
Yuya Nishihara <yuya@tcha.org>
parents: 39951
diff changeset
   373
  ...     runcommand(server, [b'rollback'])
f9f2faf25fc4 py3: byte-stringify most literals in test-commandserver.t
Yuya Nishihara <yuya@tcha.org>
parents: 39951
diff changeset
   374
  ...     runcommand(server, [b'phase', b'-r', b'.'])
40355
77ab5fbdbbf0 py3: use bprint() helper in test-commandserver.t
Yuya Nishihara <yuya@tcha.org>
parents: 40354
diff changeset
   375
  ...     bprint(b'')
22572
cc3d9f776632 test-commandserver: make runcommand message bolder
Yuya Nishihara <yuya@tcha.org>
parents: 22571
diff changeset
   376
  *** 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
   377
  no phases changed
22572
cc3d9f776632 test-commandserver: make runcommand message bolder
Yuya Nishihara <yuya@tcha.org>
parents: 22571
diff changeset
   378
  *** runcommand commit -Am.
cc3d9f776632 test-commandserver: make runcommand message bolder
Yuya Nishihara <yuya@tcha.org>
parents: 22571
diff changeset
   379
  *** 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
   380
  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
   381
  working directory now based on revision 3
22572
cc3d9f776632 test-commandserver: make runcommand message bolder
Yuya Nishihara <yuya@tcha.org>
parents: 22571
diff changeset
   382
  *** 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
   383
  3: public
33921
a4c1333b2eda tests: add blank output lines to test-commandserver
Augie Fackler <raf@durin42.com>
parents: 33773
diff changeset
   384
  
22568
78b99149ed8a test-commandserver: port test functions from .py to .t
Yuya Nishihara <yuya@tcha.org>
parents: 22567
diff changeset
   385
78b99149ed8a test-commandserver: port test functions from .py to .t
Yuya Nishihara <yuya@tcha.org>
parents: 22567
diff changeset
   386
  >>> import os
33922
1a6707b43d05 tests: update test-commandserver to pass our import checker
Augie Fackler <raf@durin42.com>
parents: 33921
diff changeset
   387
  >>> 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
   388
  >>> @check
78b99149ed8a test-commandserver: port test functions from .py to .t
Yuya Nishihara <yuya@tcha.org>
parents: 22567
diff changeset
   389
  ... def branch(server):
78b99149ed8a test-commandserver: port test functions from .py to .t
Yuya Nishihara <yuya@tcha.org>
parents: 22567
diff changeset
   390
  ...     readchannel(server)
40354
f9f2faf25fc4 py3: byte-stringify most literals in test-commandserver.t
Yuya Nishihara <yuya@tcha.org>
parents: 39951
diff changeset
   391
  ...     runcommand(server, [b'branch'])
22568
78b99149ed8a test-commandserver: port test functions from .py to .t
Yuya Nishihara <yuya@tcha.org>
parents: 22567
diff changeset
   392
  ...     os.system('hg branch foo')
40354
f9f2faf25fc4 py3: byte-stringify most literals in test-commandserver.t
Yuya Nishihara <yuya@tcha.org>
parents: 39951
diff changeset
   393
  ...     runcommand(server, [b'branch'])
22568
78b99149ed8a test-commandserver: port test functions from .py to .t
Yuya Nishihara <yuya@tcha.org>
parents: 22567
diff changeset
   394
  ...     os.system('hg branch default')
22572
cc3d9f776632 test-commandserver: make runcommand message bolder
Yuya Nishihara <yuya@tcha.org>
parents: 22571
diff changeset
   395
  *** 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
   396
  default
f9a4a035003d test-commandserver: add stub for .t test by copying .out with 2-space indent
Yuya Nishihara <yuya@tcha.org>
parents:
diff changeset
   397
  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
   398
  (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
   399
  *** 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
   400
  foo
f9a4a035003d test-commandserver: add stub for .t test by copying .out with 2-space indent
Yuya Nishihara <yuya@tcha.org>
parents:
diff changeset
   401
  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
   402
  (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
   403
78b99149ed8a test-commandserver: port test functions from .py to .t
Yuya Nishihara <yuya@tcha.org>
parents: 22567
diff changeset
   404
  $ touch .hgignore
78b99149ed8a test-commandserver: port test functions from .py to .t
Yuya Nishihara <yuya@tcha.org>
parents: 22567
diff changeset
   405
  >>> import os
40355
77ab5fbdbbf0 py3: use bprint() helper in test-commandserver.t
Yuya Nishihara <yuya@tcha.org>
parents: 40354
diff changeset
   406
  >>> from hgclient import bprint, check, readchannel, runcommand
22568
78b99149ed8a test-commandserver: port test functions from .py to .t
Yuya Nishihara <yuya@tcha.org>
parents: 22567
diff changeset
   407
  >>> @check
78b99149ed8a test-commandserver: port test functions from .py to .t
Yuya Nishihara <yuya@tcha.org>
parents: 22567
diff changeset
   408
  ... def hgignore(server):
78b99149ed8a test-commandserver: port test functions from .py to .t
Yuya Nishihara <yuya@tcha.org>
parents: 22567
diff changeset
   409
  ...     readchannel(server)
40354
f9f2faf25fc4 py3: byte-stringify most literals in test-commandserver.t
Yuya Nishihara <yuya@tcha.org>
parents: 39951
diff changeset
   410
  ...     runcommand(server, [b'commit', b'-Am.'])
22568
78b99149ed8a test-commandserver: port test functions from .py to .t
Yuya Nishihara <yuya@tcha.org>
parents: 22567
diff changeset
   411
  ...     f = open('ignored-file', 'ab')
40354
f9f2faf25fc4 py3: byte-stringify most literals in test-commandserver.t
Yuya Nishihara <yuya@tcha.org>
parents: 39951
diff changeset
   412
  ...     f.write(b'') and None
22568
78b99149ed8a test-commandserver: port test functions from .py to .t
Yuya Nishihara <yuya@tcha.org>
parents: 22567
diff changeset
   413
  ...     f.close()
78b99149ed8a test-commandserver: port test functions from .py to .t
Yuya Nishihara <yuya@tcha.org>
parents: 22567
diff changeset
   414
  ...     f = open('.hgignore', 'ab')
40354
f9f2faf25fc4 py3: byte-stringify most literals in test-commandserver.t
Yuya Nishihara <yuya@tcha.org>
parents: 39951
diff changeset
   415
  ...     f.write(b'ignored-file')
22568
78b99149ed8a test-commandserver: port test functions from .py to .t
Yuya Nishihara <yuya@tcha.org>
parents: 22567
diff changeset
   416
  ...     f.close()
40354
f9f2faf25fc4 py3: byte-stringify most literals in test-commandserver.t
Yuya Nishihara <yuya@tcha.org>
parents: 39951
diff changeset
   417
  ...     runcommand(server, [b'status', b'-i', b'-u'])
40355
77ab5fbdbbf0 py3: use bprint() helper in test-commandserver.t
Yuya Nishihara <yuya@tcha.org>
parents: 40354
diff changeset
   418
  ...     bprint(b'')
22572
cc3d9f776632 test-commandserver: make runcommand message bolder
Yuya Nishihara <yuya@tcha.org>
parents: 22571
diff changeset
   419
  *** 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
   420
  adding .hgignore
22572
cc3d9f776632 test-commandserver: make runcommand message bolder
Yuya Nishihara <yuya@tcha.org>
parents: 22571
diff changeset
   421
  *** 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
   422
  I ignored-file
33921
a4c1333b2eda tests: add blank output lines to test-commandserver
Augie Fackler <raf@durin42.com>
parents: 33773
diff changeset
   423
  
22568
78b99149ed8a test-commandserver: port test functions from .py to .t
Yuya Nishihara <yuya@tcha.org>
parents: 22567
diff changeset
   424
26405
c15d8f84343e localrepo: recreate phasecache if changelog was modified (issue4855)
Yuya Nishihara <yuya@tcha.org>
parents: 25290
diff changeset
   425
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
   426
(issue4855):
c15d8f84343e localrepo: recreate phasecache if changelog was modified (issue4855)
Yuya Nishihara <yuya@tcha.org>
parents: 25290
diff changeset
   427
c15d8f84343e localrepo: recreate phasecache if changelog was modified (issue4855)
Yuya Nishihara <yuya@tcha.org>
parents: 25290
diff changeset
   428
  >>> import os
40355
77ab5fbdbbf0 py3: use bprint() helper in test-commandserver.t
Yuya Nishihara <yuya@tcha.org>
parents: 40354
diff changeset
   429
  >>> from hgclient import bprint, check, readchannel, runcommand
26405
c15d8f84343e localrepo: recreate phasecache if changelog was modified (issue4855)
Yuya Nishihara <yuya@tcha.org>
parents: 25290
diff changeset
   430
  >>> @check
c15d8f84343e localrepo: recreate phasecache if changelog was modified (issue4855)
Yuya Nishihara <yuya@tcha.org>
parents: 25290
diff changeset
   431
  ... def phasesetscacheaftercommit(server):
c15d8f84343e localrepo: recreate phasecache if changelog was modified (issue4855)
Yuya Nishihara <yuya@tcha.org>
parents: 25290
diff changeset
   432
  ...     readchannel(server)
c15d8f84343e localrepo: recreate phasecache if changelog was modified (issue4855)
Yuya Nishihara <yuya@tcha.org>
parents: 25290
diff changeset
   433
  ...     # load _phasecache._phaserevs and _phasesets
40354
f9f2faf25fc4 py3: byte-stringify most literals in test-commandserver.t
Yuya Nishihara <yuya@tcha.org>
parents: 39951
diff changeset
   434
  ...     runcommand(server, [b'log', b'-qr', b'draft()'])
26405
c15d8f84343e localrepo: recreate phasecache if changelog was modified (issue4855)
Yuya Nishihara <yuya@tcha.org>
parents: 25290
diff changeset
   435
  ...     # 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
   436
  ...     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
   437
  ...         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
   438
  ...         f.seek(0, os.SEEK_END)
40354
f9f2faf25fc4 py3: byte-stringify most literals in test-commandserver.t
Yuya Nishihara <yuya@tcha.org>
parents: 39951
diff changeset
   439
  ...         f.write(b'a\n') and None
26431
46984a5308a0 test-commandserver: generate files with a fixed EOL for test stability
Matt Harbison <matt_harbison@yahoo.com>
parents: 26409
diff changeset
   440
  ...         f.close()
26405
c15d8f84343e localrepo: recreate phasecache if changelog was modified (issue4855)
Yuya Nishihara <yuya@tcha.org>
parents: 25290
diff changeset
   441
  ...         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
   442
  ...     # new commits should be listed as draft revisions
40354
f9f2faf25fc4 py3: byte-stringify most literals in test-commandserver.t
Yuya Nishihara <yuya@tcha.org>
parents: 39951
diff changeset
   443
  ...     runcommand(server, [b'log', b'-qr', b'draft()'])
40355
77ab5fbdbbf0 py3: use bprint() helper in test-commandserver.t
Yuya Nishihara <yuya@tcha.org>
parents: 40354
diff changeset
   444
  ...     bprint(b'')
26405
c15d8f84343e localrepo: recreate phasecache if changelog was modified (issue4855)
Yuya Nishihara <yuya@tcha.org>
parents: 25290
diff changeset
   445
  *** runcommand log -qr draft()
c15d8f84343e localrepo: recreate phasecache if changelog was modified (issue4855)
Yuya Nishihara <yuya@tcha.org>
parents: 25290
diff changeset
   446
  4:7966c8e3734d
c15d8f84343e localrepo: recreate phasecache if changelog was modified (issue4855)
Yuya Nishihara <yuya@tcha.org>
parents: 25290
diff changeset
   447
  *** runcommand log -qr draft()
c15d8f84343e localrepo: recreate phasecache if changelog was modified (issue4855)
Yuya Nishihara <yuya@tcha.org>
parents: 25290
diff changeset
   448
  4:7966c8e3734d
c15d8f84343e localrepo: recreate phasecache if changelog was modified (issue4855)
Yuya Nishihara <yuya@tcha.org>
parents: 25290
diff changeset
   449
  5:41f6602d1c4f
c15d8f84343e localrepo: recreate phasecache if changelog was modified (issue4855)
Yuya Nishihara <yuya@tcha.org>
parents: 25290
diff changeset
   450
  6:10501e202c35
33921
a4c1333b2eda tests: add blank output lines to test-commandserver
Augie Fackler <raf@durin42.com>
parents: 33773
diff changeset
   451
  
26405
c15d8f84343e localrepo: recreate phasecache if changelog was modified (issue4855)
Yuya Nishihara <yuya@tcha.org>
parents: 25290
diff changeset
   452
c15d8f84343e localrepo: recreate phasecache if changelog was modified (issue4855)
Yuya Nishihara <yuya@tcha.org>
parents: 25290
diff changeset
   453
  >>> import os
40355
77ab5fbdbbf0 py3: use bprint() helper in test-commandserver.t
Yuya Nishihara <yuya@tcha.org>
parents: 40354
diff changeset
   454
  >>> from hgclient import bprint, check, readchannel, runcommand
26405
c15d8f84343e localrepo: recreate phasecache if changelog was modified (issue4855)
Yuya Nishihara <yuya@tcha.org>
parents: 25290
diff changeset
   455
  >>> @check
c15d8f84343e localrepo: recreate phasecache if changelog was modified (issue4855)
Yuya Nishihara <yuya@tcha.org>
parents: 25290
diff changeset
   456
  ... def phasesetscacheafterstrip(server):
c15d8f84343e localrepo: recreate phasecache if changelog was modified (issue4855)
Yuya Nishihara <yuya@tcha.org>
parents: 25290
diff changeset
   457
  ...     readchannel(server)
c15d8f84343e localrepo: recreate phasecache if changelog was modified (issue4855)
Yuya Nishihara <yuya@tcha.org>
parents: 25290
diff changeset
   458
  ...     # load _phasecache._phaserevs and _phasesets
40354
f9f2faf25fc4 py3: byte-stringify most literals in test-commandserver.t
Yuya Nishihara <yuya@tcha.org>
parents: 39951
diff changeset
   459
  ...     runcommand(server, [b'log', b'-qr', b'draft()'])
26405
c15d8f84343e localrepo: recreate phasecache if changelog was modified (issue4855)
Yuya Nishihara <yuya@tcha.org>
parents: 25290
diff changeset
   460
  ...     # strip cached revisions by another process
c15d8f84343e localrepo: recreate phasecache if changelog was modified (issue4855)
Yuya Nishihara <yuya@tcha.org>
parents: 25290
diff changeset
   461
  ...     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
   462
  ...     # shouldn't abort by "unknown revision '6'"
40354
f9f2faf25fc4 py3: byte-stringify most literals in test-commandserver.t
Yuya Nishihara <yuya@tcha.org>
parents: 39951
diff changeset
   463
  ...     runcommand(server, [b'log', b'-qr', b'draft()'])
40355
77ab5fbdbbf0 py3: use bprint() helper in test-commandserver.t
Yuya Nishihara <yuya@tcha.org>
parents: 40354
diff changeset
   464
  ...     bprint(b'')
26405
c15d8f84343e localrepo: recreate phasecache if changelog was modified (issue4855)
Yuya Nishihara <yuya@tcha.org>
parents: 25290
diff changeset
   465
  *** runcommand log -qr draft()
c15d8f84343e localrepo: recreate phasecache if changelog was modified (issue4855)
Yuya Nishihara <yuya@tcha.org>
parents: 25290
diff changeset
   466
  4:7966c8e3734d
c15d8f84343e localrepo: recreate phasecache if changelog was modified (issue4855)
Yuya Nishihara <yuya@tcha.org>
parents: 25290
diff changeset
   467
  5:41f6602d1c4f
c15d8f84343e localrepo: recreate phasecache if changelog was modified (issue4855)
Yuya Nishihara <yuya@tcha.org>
parents: 25290
diff changeset
   468
  6:10501e202c35
c15d8f84343e localrepo: recreate phasecache if changelog was modified (issue4855)
Yuya Nishihara <yuya@tcha.org>
parents: 25290
diff changeset
   469
  *** runcommand log -qr draft()
c15d8f84343e localrepo: recreate phasecache if changelog was modified (issue4855)
Yuya Nishihara <yuya@tcha.org>
parents: 25290
diff changeset
   470
  4:7966c8e3734d
33921
a4c1333b2eda tests: add blank output lines to test-commandserver
Augie Fackler <raf@durin42.com>
parents: 33773
diff changeset
   471
  
26405
c15d8f84343e localrepo: recreate phasecache if changelog was modified (issue4855)
Yuya Nishihara <yuya@tcha.org>
parents: 25290
diff changeset
   472
c15d8f84343e localrepo: recreate phasecache if changelog was modified (issue4855)
Yuya Nishihara <yuya@tcha.org>
parents: 25290
diff changeset
   473
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
   474
22568
78b99149ed8a test-commandserver: port test functions from .py to .t
Yuya Nishihara <yuya@tcha.org>
parents: 22567
diff changeset
   475
  >>> import os
33922
1a6707b43d05 tests: update test-commandserver to pass our import checker
Augie Fackler <raf@durin42.com>
parents: 33921
diff changeset
   476
  >>> 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
   477
  >>> @check
78b99149ed8a test-commandserver: port test functions from .py to .t
Yuya Nishihara <yuya@tcha.org>
parents: 22567
diff changeset
   478
  ... def phasecacheafterstrip(server):
78b99149ed8a test-commandserver: port test functions from .py to .t
Yuya Nishihara <yuya@tcha.org>
parents: 22567
diff changeset
   479
  ...     readchannel(server)
78b99149ed8a test-commandserver: port test functions from .py to .t
Yuya Nishihara <yuya@tcha.org>
parents: 22567
diff changeset
   480
  ... 
78b99149ed8a test-commandserver: port test functions from .py to .t
Yuya Nishihara <yuya@tcha.org>
parents: 22567
diff changeset
   481
  ...     # create new head, 5:731265503d86
40354
f9f2faf25fc4 py3: byte-stringify most literals in test-commandserver.t
Yuya Nishihara <yuya@tcha.org>
parents: 39951
diff changeset
   482
  ...     runcommand(server, [b'update', b'-C', b'0'])
22568
78b99149ed8a test-commandserver: port test functions from .py to .t
Yuya Nishihara <yuya@tcha.org>
parents: 22567
diff changeset
   483
  ...     f = open('a', 'ab')
40354
f9f2faf25fc4 py3: byte-stringify most literals in test-commandserver.t
Yuya Nishihara <yuya@tcha.org>
parents: 39951
diff changeset
   484
  ...     f.write(b'a\n') and None
22568
78b99149ed8a test-commandserver: port test functions from .py to .t
Yuya Nishihara <yuya@tcha.org>
parents: 22567
diff changeset
   485
  ...     f.close()
40354
f9f2faf25fc4 py3: byte-stringify most literals in test-commandserver.t
Yuya Nishihara <yuya@tcha.org>
parents: 39951
diff changeset
   486
  ...     runcommand(server, [b'commit', b'-Am.', b'a'])
f9f2faf25fc4 py3: byte-stringify most literals in test-commandserver.t
Yuya Nishihara <yuya@tcha.org>
parents: 39951
diff changeset
   487
  ...     runcommand(server, [b'log', b'-Gq'])
22568
78b99149ed8a test-commandserver: port test functions from .py to .t
Yuya Nishihara <yuya@tcha.org>
parents: 22567
diff changeset
   488
  ... 
78b99149ed8a test-commandserver: port test functions from .py to .t
Yuya Nishihara <yuya@tcha.org>
parents: 22567
diff changeset
   489
  ...     # make it public; draft marker moves to 4:7966c8e3734d
40354
f9f2faf25fc4 py3: byte-stringify most literals in test-commandserver.t
Yuya Nishihara <yuya@tcha.org>
parents: 39951
diff changeset
   490
  ...     runcommand(server, [b'phase', b'-p', b'.'])
22568
78b99149ed8a test-commandserver: port test functions from .py to .t
Yuya Nishihara <yuya@tcha.org>
parents: 22567
diff changeset
   491
  ...     # load _phasecache.phaseroots
40354
f9f2faf25fc4 py3: byte-stringify most literals in test-commandserver.t
Yuya Nishihara <yuya@tcha.org>
parents: 39951
diff changeset
   492
  ...     runcommand(server, [b'phase', b'.'], outfilter=sep)
22568
78b99149ed8a test-commandserver: port test functions from .py to .t
Yuya Nishihara <yuya@tcha.org>
parents: 22567
diff changeset
   493
  ... 
78b99149ed8a test-commandserver: port test functions from .py to .t
Yuya Nishihara <yuya@tcha.org>
parents: 22567
diff changeset
   494
  ...     # strip 1::4 outside server
78b99149ed8a test-commandserver: port test functions from .py to .t
Yuya Nishihara <yuya@tcha.org>
parents: 22567
diff changeset
   495
  ...     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
   496
  ... 
78b99149ed8a test-commandserver: port test functions from .py to .t
Yuya Nishihara <yuya@tcha.org>
parents: 22567
diff changeset
   497
  ...     # shouldn't raise "7966c8e3734d: no node!"
40354
f9f2faf25fc4 py3: byte-stringify most literals in test-commandserver.t
Yuya Nishihara <yuya@tcha.org>
parents: 39951
diff changeset
   498
  ...     runcommand(server, [b'branches'])
22572
cc3d9f776632 test-commandserver: make runcommand message bolder
Yuya Nishihara <yuya@tcha.org>
parents: 22571
diff changeset
   499
  *** 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
   500
  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
   501
  (leaving bookmark bm3)
22572
cc3d9f776632 test-commandserver: make runcommand message bolder
Yuya Nishihara <yuya@tcha.org>
parents: 22571
diff changeset
   502
  *** 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
   503
  created new head
22572
cc3d9f776632 test-commandserver: make runcommand message bolder
Yuya Nishihara <yuya@tcha.org>
parents: 22571
diff changeset
   504
  *** 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
   505
  @  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
   506
  |
f9a4a035003d test-commandserver: add stub for .t test by copying .out with 2-space indent
Yuya Nishihara <yuya@tcha.org>
parents:
diff changeset
   507
  | 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
   508
  | |
f9a4a035003d test-commandserver: add stub for .t test by copying .out with 2-space indent
Yuya Nishihara <yuya@tcha.org>
parents:
diff changeset
   509
  | 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
   510
  | |
f9a4a035003d test-commandserver: add stub for .t test by copying .out with 2-space indent
Yuya Nishihara <yuya@tcha.org>
parents:
diff changeset
   511
  | 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
   512
  | |
f9a4a035003d test-commandserver: add stub for .t test by copying .out with 2-space indent
Yuya Nishihara <yuya@tcha.org>
parents:
diff changeset
   513
  | 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
   514
  |/
f9a4a035003d test-commandserver: add stub for .t test by copying .out with 2-space indent
Yuya Nishihara <yuya@tcha.org>
parents:
diff changeset
   515
  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
   516
  
22572
cc3d9f776632 test-commandserver: make runcommand message bolder
Yuya Nishihara <yuya@tcha.org>
parents: 22571
diff changeset
   517
  *** runcommand phase -p .
cc3d9f776632 test-commandserver: make runcommand message bolder
Yuya Nishihara <yuya@tcha.org>
parents: 22571
diff changeset
   518
  *** 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
   519
  5: public
22572
cc3d9f776632 test-commandserver: make runcommand message bolder
Yuya Nishihara <yuya@tcha.org>
parents: 22571
diff changeset
   520
  *** 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
   521
  default                        1:731265503d86
22568
78b99149ed8a test-commandserver: port test functions from .py to .t
Yuya Nishihara <yuya@tcha.org>
parents: 22567
diff changeset
   522
26251
5c0f5db65c6b localrepo: refresh filecache stats only if transaction finished successfully
Yuya Nishihara <yuya@tcha.org>
parents: 26142
diff changeset
   523
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
   524
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
   525
5c0f5db65c6b localrepo: refresh filecache stats only if transaction finished successfully
Yuya Nishihara <yuya@tcha.org>
parents: 26142
diff changeset
   526
  $ echo a >> a
33922
1a6707b43d05 tests: update test-commandserver to pass our import checker
Augie Fackler <raf@durin42.com>
parents: 33921
diff changeset
   527
  >>> 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
   528
  >>> @check
5c0f5db65c6b localrepo: refresh filecache stats only if transaction finished successfully
Yuya Nishihara <yuya@tcha.org>
parents: 26142
diff changeset
   529
  ... def txabort(server):
5c0f5db65c6b localrepo: refresh filecache stats only if transaction finished successfully
Yuya Nishihara <yuya@tcha.org>
parents: 26142
diff changeset
   530
  ...     readchannel(server)
40354
f9f2faf25fc4 py3: byte-stringify most literals in test-commandserver.t
Yuya Nishihara <yuya@tcha.org>
parents: 39951
diff changeset
   531
  ...     runcommand(server, [b'commit', b'--config', b'hooks.pretxncommit=false',
f9f2faf25fc4 py3: byte-stringify most literals in test-commandserver.t
Yuya Nishihara <yuya@tcha.org>
parents: 39951
diff changeset
   532
  ...                         b'-mfoo'])
f9f2faf25fc4 py3: byte-stringify most literals in test-commandserver.t
Yuya Nishihara <yuya@tcha.org>
parents: 39951
diff changeset
   533
  ...     runcommand(server, [b'verify'])
26251
5c0f5db65c6b localrepo: refresh filecache stats only if transaction finished successfully
Yuya Nishihara <yuya@tcha.org>
parents: 26142
diff changeset
   534
  *** 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
   535
  transaction abort!
5c0f5db65c6b localrepo: refresh filecache stats only if transaction finished successfully
Yuya Nishihara <yuya@tcha.org>
parents: 26142
diff changeset
   536
  rollback completed
5c0f5db65c6b localrepo: refresh filecache stats only if transaction finished successfully
Yuya Nishihara <yuya@tcha.org>
parents: 26142
diff changeset
   537
  abort: pretxncommit hook exited with status 1
46417
768056549737 errors: use exit code 40 for when a hook fails
Martin von Zweigbergk <martinvonz@google.com>
parents: 46015
diff changeset
   538
   [40]
26251
5c0f5db65c6b localrepo: refresh filecache stats only if transaction finished successfully
Yuya Nishihara <yuya@tcha.org>
parents: 26142
diff changeset
   539
  *** runcommand verify
5c0f5db65c6b localrepo: refresh filecache stats only if transaction finished successfully
Yuya Nishihara <yuya@tcha.org>
parents: 26142
diff changeset
   540
  checking changesets
5c0f5db65c6b localrepo: refresh filecache stats only if transaction finished successfully
Yuya Nishihara <yuya@tcha.org>
parents: 26142
diff changeset
   541
  checking manifests
5c0f5db65c6b localrepo: refresh filecache stats only if transaction finished successfully
Yuya Nishihara <yuya@tcha.org>
parents: 26142
diff changeset
   542
  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
   543
  checking files
39489
f1186c292d03 verify: make output less confusing (issue5924)
Meirambek Omyrzak <meirambek77@gmail.com>
parents: 37427
diff changeset
   544
  checked 2 changesets with 2 changes to 1 files
26251
5c0f5db65c6b localrepo: refresh filecache stats only if transaction finished successfully
Yuya Nishihara <yuya@tcha.org>
parents: 26142
diff changeset
   545
  $ hg revert --no-backup -aq
5c0f5db65c6b localrepo: refresh filecache stats only if transaction finished successfully
Yuya Nishihara <yuya@tcha.org>
parents: 26142
diff changeset
   546
22955
fab9dda0f2a3 obsolete: update tests to use obsolete options
Durham Goode <durham@fb.com>
parents: 22783
diff changeset
   547
  $ cat >> .hg/hgrc << EOF
fab9dda0f2a3 obsolete: update tests to use obsolete options
Durham Goode <durham@fb.com>
parents: 22783
diff changeset
   548
  > [experimental]
34866
1644623ab096 config: use 'experimental.evolution.create-markers'
Boris Feld <boris.feld@octobus.net>
parents: 34852
diff changeset
   549
  > evolution.createmarkers=True
22568
78b99149ed8a test-commandserver: port test functions from .py to .t
Yuya Nishihara <yuya@tcha.org>
parents: 22567
diff changeset
   550
  > EOF
78b99149ed8a test-commandserver: port test functions from .py to .t
Yuya Nishihara <yuya@tcha.org>
parents: 22567
diff changeset
   551
78b99149ed8a test-commandserver: port test functions from .py to .t
Yuya Nishihara <yuya@tcha.org>
parents: 22567
diff changeset
   552
  >>> import os
33922
1a6707b43d05 tests: update test-commandserver to pass our import checker
Augie Fackler <raf@durin42.com>
parents: 33921
diff changeset
   553
  >>> 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
   554
  >>> @check
78b99149ed8a test-commandserver: port test functions from .py to .t
Yuya Nishihara <yuya@tcha.org>
parents: 22567
diff changeset
   555
  ... def obsolete(server):
78b99149ed8a test-commandserver: port test functions from .py to .t
Yuya Nishihara <yuya@tcha.org>
parents: 22567
diff changeset
   556
  ...     readchannel(server)
78b99149ed8a test-commandserver: port test functions from .py to .t
Yuya Nishihara <yuya@tcha.org>
parents: 22567
diff changeset
   557
  ... 
40354
f9f2faf25fc4 py3: byte-stringify most literals in test-commandserver.t
Yuya Nishihara <yuya@tcha.org>
parents: 39951
diff changeset
   558
  ...     runcommand(server, [b'up', b'null'])
f9f2faf25fc4 py3: byte-stringify most literals in test-commandserver.t
Yuya Nishihara <yuya@tcha.org>
parents: 39951
diff changeset
   559
  ...     runcommand(server, [b'phase', b'-df', b'tip'])
22568
78b99149ed8a test-commandserver: port test functions from .py to .t
Yuya Nishihara <yuya@tcha.org>
parents: 22567
diff changeset
   560
  ...     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
   561
  ...     if os.name == 'nt':
78b99149ed8a test-commandserver: port test functions from .py to .t
Yuya Nishihara <yuya@tcha.org>
parents: 22567
diff changeset
   562
  ...         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
   563
  ...     os.system(cmd)
40354
f9f2faf25fc4 py3: byte-stringify most literals in test-commandserver.t
Yuya Nishihara <yuya@tcha.org>
parents: 39951
diff changeset
   564
  ...     runcommand(server, [b'log', b'--hidden'])
f9f2faf25fc4 py3: byte-stringify most literals in test-commandserver.t
Yuya Nishihara <yuya@tcha.org>
parents: 39951
diff changeset
   565
  ...     runcommand(server, [b'log'])
22572
cc3d9f776632 test-commandserver: make runcommand message bolder
Yuya Nishihara <yuya@tcha.org>
parents: 22571
diff changeset
   566
  *** 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
   567
  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
   568
  *** runcommand phase -df tip
42893
34a46d48d24e debugobsolete: also issue the "new obsmarkers" messsage
Pierre-Yves David <pierre-yves.david@octobus.net>
parents: 42620
diff changeset
   569
  1 new obsolescence markers
33542
b11e8c67fb0f debugobsolete: also report the number of obsoleted changesets
Boris Feld <boris.feld@octobus.net>
parents: 33426
diff changeset
   570
  obsoleted 1 changesets
22572
cc3d9f776632 test-commandserver: make runcommand message bolder
Yuya Nishihara <yuya@tcha.org>
parents: 22571
diff changeset
   571
  *** 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
   572
  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
   573
  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
   574
  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
   575
  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
   576
  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
   577
  summary:     .
f9a4a035003d test-commandserver: add stub for .t test by copying .out with 2-space indent
Yuya Nishihara <yuya@tcha.org>
parents:
diff changeset
   578
  
f9a4a035003d test-commandserver: add stub for .t test by copying .out with 2-space indent
Yuya Nishihara <yuya@tcha.org>
parents:
diff changeset
   579
  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
   580
  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
   581
  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
   582
  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
   583
  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
   584
  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
   585
  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
   586
  
22572
cc3d9f776632 test-commandserver: make runcommand message bolder
Yuya Nishihara <yuya@tcha.org>
parents: 22571
diff changeset
   587
  *** 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
   588
  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
   589
  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
   590
  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
   591
  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
   592
  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
   593
  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
   594
  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
   595
  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
   596
  
22568
78b99149ed8a test-commandserver: port test functions from .py to .t
Yuya Nishihara <yuya@tcha.org>
parents: 22567
diff changeset
   597
78b99149ed8a test-commandserver: port test functions from .py to .t
Yuya Nishihara <yuya@tcha.org>
parents: 22567
diff changeset
   598
  $ cat <<EOF >> .hg/hgrc
78b99149ed8a test-commandserver: port test functions from .py to .t
Yuya Nishihara <yuya@tcha.org>
parents: 22567
diff changeset
   599
  > [extensions]
78b99149ed8a test-commandserver: port test functions from .py to .t
Yuya Nishihara <yuya@tcha.org>
parents: 22567
diff changeset
   600
  > mq =
78b99149ed8a test-commandserver: port test functions from .py to .t
Yuya Nishihara <yuya@tcha.org>
parents: 22567
diff changeset
   601
  > EOF
78b99149ed8a test-commandserver: port test functions from .py to .t
Yuya Nishihara <yuya@tcha.org>
parents: 22567
diff changeset
   602
78b99149ed8a test-commandserver: port test functions from .py to .t
Yuya Nishihara <yuya@tcha.org>
parents: 22567
diff changeset
   603
  >>> import os
33922
1a6707b43d05 tests: update test-commandserver to pass our import checker
Augie Fackler <raf@durin42.com>
parents: 33921
diff changeset
   604
  >>> 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
   605
  >>> @check
78b99149ed8a test-commandserver: port test functions from .py to .t
Yuya Nishihara <yuya@tcha.org>
parents: 22567
diff changeset
   606
  ... def mqoutsidechanges(server):
78b99149ed8a test-commandserver: port test functions from .py to .t
Yuya Nishihara <yuya@tcha.org>
parents: 22567
diff changeset
   607
  ...     readchannel(server)
78b99149ed8a test-commandserver: port test functions from .py to .t
Yuya Nishihara <yuya@tcha.org>
parents: 22567
diff changeset
   608
  ... 
78b99149ed8a test-commandserver: port test functions from .py to .t
Yuya Nishihara <yuya@tcha.org>
parents: 22567
diff changeset
   609
  ...     # load repo.mq
40354
f9f2faf25fc4 py3: byte-stringify most literals in test-commandserver.t
Yuya Nishihara <yuya@tcha.org>
parents: 39951
diff changeset
   610
  ...     runcommand(server, [b'qapplied'])
22568
78b99149ed8a test-commandserver: port test functions from .py to .t
Yuya Nishihara <yuya@tcha.org>
parents: 22567
diff changeset
   611
  ...     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
   612
  ...     # repo.mq should be invalidated
40354
f9f2faf25fc4 py3: byte-stringify most literals in test-commandserver.t
Yuya Nishihara <yuya@tcha.org>
parents: 39951
diff changeset
   613
  ...     runcommand(server, [b'qapplied'])
22568
78b99149ed8a test-commandserver: port test functions from .py to .t
Yuya Nishihara <yuya@tcha.org>
parents: 22567
diff changeset
   614
  ... 
40354
f9f2faf25fc4 py3: byte-stringify most literals in test-commandserver.t
Yuya Nishihara <yuya@tcha.org>
parents: 39951
diff changeset
   615
  ...     runcommand(server, [b'qpop', b'--all'])
22568
78b99149ed8a test-commandserver: port test functions from .py to .t
Yuya Nishihara <yuya@tcha.org>
parents: 22567
diff changeset
   616
  ...     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
   617
  ...     # repo.mq should be recreated to point to new queue
40354
f9f2faf25fc4 py3: byte-stringify most literals in test-commandserver.t
Yuya Nishihara <yuya@tcha.org>
parents: 39951
diff changeset
   618
  ...     runcommand(server, [b'qqueue', b'--active'])
22572
cc3d9f776632 test-commandserver: make runcommand message bolder
Yuya Nishihara <yuya@tcha.org>
parents: 22571
diff changeset
   619
  *** runcommand qapplied
cc3d9f776632 test-commandserver: make runcommand message bolder
Yuya Nishihara <yuya@tcha.org>
parents: 22571
diff changeset
   620
  *** 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
   621
  0.diff
22572
cc3d9f776632 test-commandserver: make runcommand message bolder
Yuya Nishihara <yuya@tcha.org>
parents: 22571
diff changeset
   622
  *** 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
   623
  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
   624
  patch queue now empty
22572
cc3d9f776632 test-commandserver: make runcommand message bolder
Yuya Nishihara <yuya@tcha.org>
parents: 22571
diff changeset
   625
  *** 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
   626
  foo
22568
78b99149ed8a test-commandserver: port test functions from .py to .t
Yuya Nishihara <yuya@tcha.org>
parents: 22567
diff changeset
   627
40591
c49283e740da test-commandserver: clean up quoting and location of dbgui extension
Yuya Nishihara <yuya@tcha.org>
parents: 40590
diff changeset
   628
  $ cat <<'EOF' > ../dbgui.py
33922
1a6707b43d05 tests: update test-commandserver to pass our import checker
Augie Fackler <raf@durin42.com>
parents: 33921
diff changeset
   629
  > import os
1a6707b43d05 tests: update test-commandserver to pass our import checker
Augie Fackler <raf@durin42.com>
parents: 33921
diff changeset
   630
  > import sys
32337
46ba2cdda476 registrar: move cmdutil.command to registrar module (API)
Yuya Nishihara <yuya@tcha.org>
parents: 31010
diff changeset
   631
  > 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
   632
  > cmdtable = {}
32337
46ba2cdda476 registrar: move cmdutil.command to registrar module (API)
Yuya Nishihara <yuya@tcha.org>
parents: 31010
diff changeset
   633
  > command = registrar.command(cmdtable)
33097
fce4ed2912bb py3: make sure commands name are bytes in tests
Pulkit Goyal <7895pulkit@gmail.com>
parents: 32414
diff changeset
   634
  > @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
   635
  > def debuggetpass(ui):
40591
c49283e740da test-commandserver: clean up quoting and location of dbgui extension
Yuya Nishihara <yuya@tcha.org>
parents: 40590
diff changeset
   636
  >     ui.write(b"%s\n" % ui.getpass())
33097
fce4ed2912bb py3: make sure commands name are bytes in tests
Pulkit Goyal <7895pulkit@gmail.com>
parents: 32414
diff changeset
   637
  > @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
   638
  > def debugprompt(ui):
40591
c49283e740da test-commandserver: clean up quoting and location of dbgui extension
Yuya Nishihara <yuya@tcha.org>
parents: 40590
diff changeset
   639
  >     ui.write(b"%s\n" % ui.prompt(b"prompt:"))
40592
83e571ea06a9 commandserver: attach prompt default and choices to message
Yuya Nishihara <yuya@tcha.org>
parents: 40591
diff changeset
   640
  > @command(b"debugpromptchoice", norepo=True)
83e571ea06a9 commandserver: attach prompt default and choices to message
Yuya Nishihara <yuya@tcha.org>
parents: 40591
diff changeset
   641
  > def debugpromptchoice(ui):
83e571ea06a9 commandserver: attach prompt default and choices to message
Yuya Nishihara <yuya@tcha.org>
parents: 40591
diff changeset
   642
  >     msg = b"promptchoice (y/n)? $$ &Yes $$ &No"
83e571ea06a9 commandserver: attach prompt default and choices to message
Yuya Nishihara <yuya@tcha.org>
parents: 40591
diff changeset
   643
  >     ui.write(b"%d\n" % ui.promptchoice(msg))
33097
fce4ed2912bb py3: make sure commands name are bytes in tests
Pulkit Goyal <7895pulkit@gmail.com>
parents: 32414
diff changeset
   644
  > @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
   645
  > def debugreadstdin(ui):
40354
f9f2faf25fc4 py3: byte-stringify most literals in test-commandserver.t
Yuya Nishihara <yuya@tcha.org>
parents: 39951
diff changeset
   646
  >     ui.write(b"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
   647
  > @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
   648
  > def debugwritestdout(ui):
40354
f9f2faf25fc4 py3: byte-stringify most literals in test-commandserver.t
Yuya Nishihara <yuya@tcha.org>
parents: 39951
diff changeset
   649
  >     os.write(1, b"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
   650
  >     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
   651
  >     sys.stdout.flush()
22568
78b99149ed8a test-commandserver: port test functions from .py to .t
Yuya Nishihara <yuya@tcha.org>
parents: 22567
diff changeset
   652
  > EOF
78b99149ed8a test-commandserver: port test functions from .py to .t
Yuya Nishihara <yuya@tcha.org>
parents: 22567
diff changeset
   653
  $ cat <<EOF >> .hg/hgrc
78b99149ed8a test-commandserver: port test functions from .py to .t
Yuya Nishihara <yuya@tcha.org>
parents: 22567
diff changeset
   654
  > [extensions]
40591
c49283e740da test-commandserver: clean up quoting and location of dbgui extension
Yuya Nishihara <yuya@tcha.org>
parents: 40590
diff changeset
   655
  > dbgui = ../dbgui.py
22568
78b99149ed8a test-commandserver: port test functions from .py to .t
Yuya Nishihara <yuya@tcha.org>
parents: 22567
diff changeset
   656
  > EOF
78b99149ed8a test-commandserver: port test functions from .py to .t
Yuya Nishihara <yuya@tcha.org>
parents: 22567
diff changeset
   657
33922
1a6707b43d05 tests: update test-commandserver to pass our import checker
Augie Fackler <raf@durin42.com>
parents: 33921
diff changeset
   658
  >>> 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
   659
  >>> @check
78b99149ed8a test-commandserver: port test functions from .py to .t
Yuya Nishihara <yuya@tcha.org>
parents: 22567
diff changeset
   660
  ... def getpass(server):
78b99149ed8a test-commandserver: port test functions from .py to .t
Yuya Nishihara <yuya@tcha.org>
parents: 22567
diff changeset
   661
  ...     readchannel(server)
40354
f9f2faf25fc4 py3: byte-stringify most literals in test-commandserver.t
Yuya Nishihara <yuya@tcha.org>
parents: 39951
diff changeset
   662
  ...     runcommand(server, [b'debuggetpass', b'--config',
f9f2faf25fc4 py3: byte-stringify most literals in test-commandserver.t
Yuya Nishihara <yuya@tcha.org>
parents: 39951
diff changeset
   663
  ...                         b'ui.interactive=True'],
f9f2faf25fc4 py3: byte-stringify most literals in test-commandserver.t
Yuya Nishihara <yuya@tcha.org>
parents: 39951
diff changeset
   664
  ...                input=stringio(b'1234\n'))
f9f2faf25fc4 py3: byte-stringify most literals in test-commandserver.t
Yuya Nishihara <yuya@tcha.org>
parents: 39951
diff changeset
   665
  ...     runcommand(server, [b'debuggetpass', b'--config',
f9f2faf25fc4 py3: byte-stringify most literals in test-commandserver.t
Yuya Nishihara <yuya@tcha.org>
parents: 39951
diff changeset
   666
  ...                         b'ui.interactive=True'],
f9f2faf25fc4 py3: byte-stringify most literals in test-commandserver.t
Yuya Nishihara <yuya@tcha.org>
parents: 39951
diff changeset
   667
  ...                input=stringio(b'\n'))
f9f2faf25fc4 py3: byte-stringify most literals in test-commandserver.t
Yuya Nishihara <yuya@tcha.org>
parents: 39951
diff changeset
   668
  ...     runcommand(server, [b'debuggetpass', b'--config',
f9f2faf25fc4 py3: byte-stringify most literals in test-commandserver.t
Yuya Nishihara <yuya@tcha.org>
parents: 39951
diff changeset
   669
  ...                         b'ui.interactive=True'],
f9f2faf25fc4 py3: byte-stringify most literals in test-commandserver.t
Yuya Nishihara <yuya@tcha.org>
parents: 39951
diff changeset
   670
  ...                input=stringio(b''))
f9f2faf25fc4 py3: byte-stringify most literals in test-commandserver.t
Yuya Nishihara <yuya@tcha.org>
parents: 39951
diff changeset
   671
  ...     runcommand(server, [b'debugprompt', b'--config',
f9f2faf25fc4 py3: byte-stringify most literals in test-commandserver.t
Yuya Nishihara <yuya@tcha.org>
parents: 39951
diff changeset
   672
  ...                         b'ui.interactive=True'],
f9f2faf25fc4 py3: byte-stringify most literals in test-commandserver.t
Yuya Nishihara <yuya@tcha.org>
parents: 39951
diff changeset
   673
  ...                input=stringio(b'5678\n'))
44373
98c14f0108b8 py3: fix EOL detection in commandserver.channeledinput
Yuya Nishihara <yuya@tcha.org>
parents: 42893
diff changeset
   674
  ...     runcommand(server, [b'debugprompt', b'--config',
98c14f0108b8 py3: fix EOL detection in commandserver.channeledinput
Yuya Nishihara <yuya@tcha.org>
parents: 42893
diff changeset
   675
  ...                         b'ui.interactive=True'],
98c14f0108b8 py3: fix EOL detection in commandserver.channeledinput
Yuya Nishihara <yuya@tcha.org>
parents: 42893
diff changeset
   676
  ...                input=stringio(b'\nremainder\nshould\nnot\nbe\nread\n'))
40354
f9f2faf25fc4 py3: byte-stringify most literals in test-commandserver.t
Yuya Nishihara <yuya@tcha.org>
parents: 39951
diff changeset
   677
  ...     runcommand(server, [b'debugreadstdin'])
f9f2faf25fc4 py3: byte-stringify most literals in test-commandserver.t
Yuya Nishihara <yuya@tcha.org>
parents: 39951
diff changeset
   678
  ...     runcommand(server, [b'debugwritestdout'])
22572
cc3d9f776632 test-commandserver: make runcommand message bolder
Yuya Nishihara <yuya@tcha.org>
parents: 22571
diff changeset
   679
  *** 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
   680
  password: 1234
30814
b96c57c1f860 ui: check EOF of getpass() response read from command-server channel
Yuya Nishihara <yuya@tcha.org>
parents: 30363
diff changeset
   681
  *** 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
   682
  password: 
b96c57c1f860 ui: check EOF of getpass() response read from command-server channel
Yuya Nishihara <yuya@tcha.org>
parents: 30363
diff changeset
   683
  *** 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
   684
  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
   685
   [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
   686
  *** 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
   687
  prompt: 5678
44373
98c14f0108b8 py3: fix EOL detection in commandserver.channeledinput
Yuya Nishihara <yuya@tcha.org>
parents: 42893
diff changeset
   688
  *** runcommand debugprompt --config ui.interactive=True
98c14f0108b8 py3: fix EOL detection in commandserver.channeledinput
Yuya Nishihara <yuya@tcha.org>
parents: 42893
diff changeset
   689
  prompt: y
23324
69f86b937035 cmdserver: protect pipe server streams against corruption caused by direct io
Yuya Nishihara <yuya@tcha.org>
parents: 23322
diff changeset
   690
  *** runcommand debugreadstdin
69f86b937035 cmdserver: protect pipe server streams against corruption caused by direct io
Yuya Nishihara <yuya@tcha.org>
parents: 23322
diff changeset
   691
  read: ''
69f86b937035 cmdserver: protect pipe server streams against corruption caused by direct io
Yuya Nishihara <yuya@tcha.org>
parents: 23322
diff changeset
   692
  *** runcommand debugwritestdout
37220
7f78de1c93aa procutil: redirect ui.fout to stderr while stdio is protected
Yuya Nishihara <yuya@tcha.org>
parents: 37009
diff changeset
   693
  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
   694
  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
   695
78b99149ed8a test-commandserver: port test functions from .py to .t
Yuya Nishihara <yuya@tcha.org>
parents: 22567
diff changeset
   696
23322
000cfc8b3913 cmdserver: use given streams as pipe channels like other commands
Yuya Nishihara <yuya@tcha.org>
parents: 23095
diff changeset
   697
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
   698
40355
77ab5fbdbbf0 py3: use bprint() helper in test-commandserver.t
Yuya Nishihara <yuya@tcha.org>
parents: 40354
diff changeset
   699
  >>> from hgclient import bprint, 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
   700
  >>> @check
000cfc8b3913 cmdserver: use given streams as pipe channels like other commands
Yuya Nishihara <yuya@tcha.org>
parents: 23095
diff changeset
   701
  ... def nested(server):
40355
77ab5fbdbbf0 py3: use bprint() helper in test-commandserver.t
Yuya Nishihara <yuya@tcha.org>
parents: 40354
diff changeset
   702
  ...     bprint(b'%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
   703
  ...     class nestedserver(object):
40354
f9f2faf25fc4 py3: byte-stringify most literals in test-commandserver.t
Yuya Nishihara <yuya@tcha.org>
parents: 39951
diff changeset
   704
  ...         stdin = stringio(b'getencoding\n')
28836
3f45488d70df test-commandserver: handle cStringIO.StringIO/io.StringIO divergence
timeless <timeless@mozdev.org>
parents: 28511
diff changeset
   705
  ...         stdout = stringio()
40354
f9f2faf25fc4 py3: byte-stringify most literals in test-commandserver.t
Yuya Nishihara <yuya@tcha.org>
parents: 39951
diff changeset
   706
  ...     runcommand(server, [b'serve', b'--cmdserver', b'pipe'],
23322
000cfc8b3913 cmdserver: use given streams as pipe channels like other commands
Yuya Nishihara <yuya@tcha.org>
parents: 23095
diff changeset
   707
  ...                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
   708
  ...     nestedserver.stdout.seek(0)
40355
77ab5fbdbbf0 py3: use bprint() helper in test-commandserver.t
Yuya Nishihara <yuya@tcha.org>
parents: 40354
diff changeset
   709
  ...     bprint(b'%c, %r' % readchannel(nestedserver))  # hello
77ab5fbdbbf0 py3: use bprint() helper in test-commandserver.t
Yuya Nishihara <yuya@tcha.org>
parents: 40354
diff changeset
   710
  ...     bprint(b'%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
   711
  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
   712
  *** runcommand serve --cmdserver pipe
000cfc8b3913 cmdserver: use given streams as pipe channels like other commands
Yuya Nishihara <yuya@tcha.org>
parents: 23095
diff changeset
   713
  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
   714
  r, '*' (glob)
22568
78b99149ed8a test-commandserver: port test functions from .py to .t
Yuya Nishihara <yuya@tcha.org>
parents: 22567
diff changeset
   715
78b99149ed8a test-commandserver: port test functions from .py to .t
Yuya Nishihara <yuya@tcha.org>
parents: 22567
diff changeset
   716
78b99149ed8a test-commandserver: port test functions from .py to .t
Yuya Nishihara <yuya@tcha.org>
parents: 22567
diff changeset
   717
start without repository:
78b99149ed8a test-commandserver: port test functions from .py to .t
Yuya Nishihara <yuya@tcha.org>
parents: 22567
diff changeset
   718
78b99149ed8a test-commandserver: port test functions from .py to .t
Yuya Nishihara <yuya@tcha.org>
parents: 22567
diff changeset
   719
  $ cd ..
78b99149ed8a test-commandserver: port test functions from .py to .t
Yuya Nishihara <yuya@tcha.org>
parents: 22567
diff changeset
   720
40355
77ab5fbdbbf0 py3: use bprint() helper in test-commandserver.t
Yuya Nishihara <yuya@tcha.org>
parents: 40354
diff changeset
   721
  >>> from hgclient import bprint, check, readchannel, runcommand
22568
78b99149ed8a test-commandserver: port test functions from .py to .t
Yuya Nishihara <yuya@tcha.org>
parents: 22567
diff changeset
   722
  >>> @check
78b99149ed8a test-commandserver: port test functions from .py to .t
Yuya Nishihara <yuya@tcha.org>
parents: 22567
diff changeset
   723
  ... def hellomessage(server):
78b99149ed8a test-commandserver: port test functions from .py to .t
Yuya Nishihara <yuya@tcha.org>
parents: 22567
diff changeset
   724
  ...     ch, data = readchannel(server)
40355
77ab5fbdbbf0 py3: use bprint() helper in test-commandserver.t
Yuya Nishihara <yuya@tcha.org>
parents: 40354
diff changeset
   725
  ...     bprint(b'%c, %r' % (ch, data))
22568
78b99149ed8a test-commandserver: port test functions from .py to .t
Yuya Nishihara <yuya@tcha.org>
parents: 22567
diff changeset
   726
  ...     # 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
   727
  ...     # sends isn't part of the hello message
40354
f9f2faf25fc4 py3: byte-stringify most literals in test-commandserver.t
Yuya Nishihara <yuya@tcha.org>
parents: 39951
diff changeset
   728
  ...     runcommand(server, [b'id'])
23036
19f5273c9f3e cmdserver: include pid of server handling requests in hello message
Yuya Nishihara <yuya@tcha.org>
parents: 22994
diff changeset
   729
  o, 'capabilities: getencoding runcommand\nencoding: *\npid: *' (glob)
22572
cc3d9f776632 test-commandserver: make runcommand message bolder
Yuya Nishihara <yuya@tcha.org>
parents: 22571
diff changeset
   730
  *** 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
   731
  abort: there is no Mercurial repository here (.hg not found)
45827
8d72e29ad1e0 errors: introduce InputError and use it from commands and cmdutil
Martin von Zweigbergk <martinvonz@google.com>
parents: 45826
diff changeset
   732
   [10]
22568
78b99149ed8a test-commandserver: port test functions from .py to .t
Yuya Nishihara <yuya@tcha.org>
parents: 22567
diff changeset
   733
33922
1a6707b43d05 tests: update test-commandserver to pass our import checker
Augie Fackler <raf@durin42.com>
parents: 33921
diff changeset
   734
  >>> 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
   735
  >>> @check
78b99149ed8a test-commandserver: port test functions from .py to .t
Yuya Nishihara <yuya@tcha.org>
parents: 22567
diff changeset
   736
  ... def startwithoutrepo(server):
78b99149ed8a test-commandserver: port test functions from .py to .t
Yuya Nishihara <yuya@tcha.org>
parents: 22567
diff changeset
   737
  ...     readchannel(server)
40354
f9f2faf25fc4 py3: byte-stringify most literals in test-commandserver.t
Yuya Nishihara <yuya@tcha.org>
parents: 39951
diff changeset
   738
  ...     runcommand(server, [b'init', b'repo2'])
f9f2faf25fc4 py3: byte-stringify most literals in test-commandserver.t
Yuya Nishihara <yuya@tcha.org>
parents: 39951
diff changeset
   739
  ...     runcommand(server, [b'id', b'-R', b'repo2'])
22572
cc3d9f776632 test-commandserver: make runcommand message bolder
Yuya Nishihara <yuya@tcha.org>
parents: 22571
diff changeset
   740
  *** runcommand init repo2
cc3d9f776632 test-commandserver: make runcommand message bolder
Yuya Nishihara <yuya@tcha.org>
parents: 22571
diff changeset
   741
  *** 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
   742
  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
   743
840be5ca03e1 cmdserver: add service that listens on unix domain socket and forks process
Yuya Nishihara <yuya@tcha.org>
parents: 22955
diff changeset
   744
26142
7332bf4ae959 dispatch: error out on invalid -R path even if optionalrepo (issue4805) (BC)
Yuya Nishihara <yuya@tcha.org>
parents: 25290
diff changeset
   745
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
   746
7332bf4ae959 dispatch: error out on invalid -R path even if optionalrepo (issue4805) (BC)
Yuya Nishihara <yuya@tcha.org>
parents: 25290
diff changeset
   747
  $ cd repo
7332bf4ae959 dispatch: error out on invalid -R path even if optionalrepo (issue4805) (BC)
Yuya Nishihara <yuya@tcha.org>
parents: 25290
diff changeset
   748
  $ hg serve --cmdserver pipe -R ../nonexistent
45906
95c4cca641f6 errors: remove trailing "!" from some error messages for consistency
Martin von Zweigbergk <martinvonz@google.com>
parents: 45827
diff changeset
   749
  abort: repository ../nonexistent not found
26142
7332bf4ae959 dispatch: error out on invalid -R path even if optionalrepo (issue4805) (BC)
Yuya Nishihara <yuya@tcha.org>
parents: 25290
diff changeset
   750
  [255]
7332bf4ae959 dispatch: error out on invalid -R path even if optionalrepo (issue4805) (BC)
Yuya Nishihara <yuya@tcha.org>
parents: 25290
diff changeset
   751
  $ cd ..
7332bf4ae959 dispatch: error out on invalid -R path even if optionalrepo (issue4805) (BC)
Yuya Nishihara <yuya@tcha.org>
parents: 25290
diff changeset
   752
7332bf4ae959 dispatch: error out on invalid -R path even if optionalrepo (issue4805) (BC)
Yuya Nishihara <yuya@tcha.org>
parents: 25290
diff changeset
   753
45057
d6e99a446eea cmdserver: add option to not exit from message loop on SIGINT
Yuya Nishihara <yuya@tcha.org>
parents: 44373
diff changeset
   754
#if no-windows
d6e99a446eea cmdserver: add option to not exit from message loop on SIGINT
Yuya Nishihara <yuya@tcha.org>
parents: 44373
diff changeset
   755
d6e99a446eea cmdserver: add option to not exit from message loop on SIGINT
Yuya Nishihara <yuya@tcha.org>
parents: 44373
diff changeset
   756
option to not shutdown on SIGINT:
d6e99a446eea cmdserver: add option to not exit from message loop on SIGINT
Yuya Nishihara <yuya@tcha.org>
parents: 44373
diff changeset
   757
d6e99a446eea cmdserver: add option to not exit from message loop on SIGINT
Yuya Nishihara <yuya@tcha.org>
parents: 44373
diff changeset
   758
  $ cat <<'EOF' > dbgint.py
d6e99a446eea cmdserver: add option to not exit from message loop on SIGINT
Yuya Nishihara <yuya@tcha.org>
parents: 44373
diff changeset
   759
  > import os
d6e99a446eea cmdserver: add option to not exit from message loop on SIGINT
Yuya Nishihara <yuya@tcha.org>
parents: 44373
diff changeset
   760
  > import signal
d6e99a446eea cmdserver: add option to not exit from message loop on SIGINT
Yuya Nishihara <yuya@tcha.org>
parents: 44373
diff changeset
   761
  > import time
d6e99a446eea cmdserver: add option to not exit from message loop on SIGINT
Yuya Nishihara <yuya@tcha.org>
parents: 44373
diff changeset
   762
  > from mercurial import commands, registrar
d6e99a446eea cmdserver: add option to not exit from message loop on SIGINT
Yuya Nishihara <yuya@tcha.org>
parents: 44373
diff changeset
   763
  > cmdtable = {}
d6e99a446eea cmdserver: add option to not exit from message loop on SIGINT
Yuya Nishihara <yuya@tcha.org>
parents: 44373
diff changeset
   764
  > command = registrar.command(cmdtable)
d6e99a446eea cmdserver: add option to not exit from message loop on SIGINT
Yuya Nishihara <yuya@tcha.org>
parents: 44373
diff changeset
   765
  > @command(b"debugsleep", norepo=True)
d6e99a446eea cmdserver: add option to not exit from message loop on SIGINT
Yuya Nishihara <yuya@tcha.org>
parents: 44373
diff changeset
   766
  > def debugsleep(ui):
d6e99a446eea cmdserver: add option to not exit from message loop on SIGINT
Yuya Nishihara <yuya@tcha.org>
parents: 44373
diff changeset
   767
  >     time.sleep(1)
d6e99a446eea cmdserver: add option to not exit from message loop on SIGINT
Yuya Nishihara <yuya@tcha.org>
parents: 44373
diff changeset
   768
  > @command(b"debugsuicide", norepo=True)
d6e99a446eea cmdserver: add option to not exit from message loop on SIGINT
Yuya Nishihara <yuya@tcha.org>
parents: 44373
diff changeset
   769
  > def debugsuicide(ui):
d6e99a446eea cmdserver: add option to not exit from message loop on SIGINT
Yuya Nishihara <yuya@tcha.org>
parents: 44373
diff changeset
   770
  >     os.kill(os.getpid(), signal.SIGINT)
d6e99a446eea cmdserver: add option to not exit from message loop on SIGINT
Yuya Nishihara <yuya@tcha.org>
parents: 44373
diff changeset
   771
  >     time.sleep(1)
d6e99a446eea cmdserver: add option to not exit from message loop on SIGINT
Yuya Nishihara <yuya@tcha.org>
parents: 44373
diff changeset
   772
  > EOF
d6e99a446eea cmdserver: add option to not exit from message loop on SIGINT
Yuya Nishihara <yuya@tcha.org>
parents: 44373
diff changeset
   773
d6e99a446eea cmdserver: add option to not exit from message loop on SIGINT
Yuya Nishihara <yuya@tcha.org>
parents: 44373
diff changeset
   774
  >>> import signal
d6e99a446eea cmdserver: add option to not exit from message loop on SIGINT
Yuya Nishihara <yuya@tcha.org>
parents: 44373
diff changeset
   775
  >>> import time
d6e99a446eea cmdserver: add option to not exit from message loop on SIGINT
Yuya Nishihara <yuya@tcha.org>
parents: 44373
diff changeset
   776
  >>> from hgclient import checkwith, readchannel, runcommand
d6e99a446eea cmdserver: add option to not exit from message loop on SIGINT
Yuya Nishihara <yuya@tcha.org>
parents: 44373
diff changeset
   777
  >>> @checkwith(extraargs=[b'--config', b'cmdserver.shutdown-on-interrupt=False',
d6e99a446eea cmdserver: add option to not exit from message loop on SIGINT
Yuya Nishihara <yuya@tcha.org>
parents: 44373
diff changeset
   778
  ...                       b'--config', b'extensions.dbgint=dbgint.py'])
d6e99a446eea cmdserver: add option to not exit from message loop on SIGINT
Yuya Nishihara <yuya@tcha.org>
parents: 44373
diff changeset
   779
  ... def nointr(server):
d6e99a446eea cmdserver: add option to not exit from message loop on SIGINT
Yuya Nishihara <yuya@tcha.org>
parents: 44373
diff changeset
   780
  ...     readchannel(server)
d6e99a446eea cmdserver: add option to not exit from message loop on SIGINT
Yuya Nishihara <yuya@tcha.org>
parents: 44373
diff changeset
   781
  ...     server.send_signal(signal.SIGINT)  # server won't be terminated
d6e99a446eea cmdserver: add option to not exit from message loop on SIGINT
Yuya Nishihara <yuya@tcha.org>
parents: 44373
diff changeset
   782
  ...     time.sleep(1)
d6e99a446eea cmdserver: add option to not exit from message loop on SIGINT
Yuya Nishihara <yuya@tcha.org>
parents: 44373
diff changeset
   783
  ...     runcommand(server, [b'debugsleep'])
d6e99a446eea cmdserver: add option to not exit from message loop on SIGINT
Yuya Nishihara <yuya@tcha.org>
parents: 44373
diff changeset
   784
  ...     server.send_signal(signal.SIGINT)  # server won't be terminated
d6e99a446eea cmdserver: add option to not exit from message loop on SIGINT
Yuya Nishihara <yuya@tcha.org>
parents: 44373
diff changeset
   785
  ...     runcommand(server, [b'debugsleep'])
d6e99a446eea cmdserver: add option to not exit from message loop on SIGINT
Yuya Nishihara <yuya@tcha.org>
parents: 44373
diff changeset
   786
  ...     runcommand(server, [b'debugsuicide'])  # command can be interrupted
d6e99a446eea cmdserver: add option to not exit from message loop on SIGINT
Yuya Nishihara <yuya@tcha.org>
parents: 44373
diff changeset
   787
  ...     server.send_signal(signal.SIGTERM)  # server will be terminated
d6e99a446eea cmdserver: add option to not exit from message loop on SIGINT
Yuya Nishihara <yuya@tcha.org>
parents: 44373
diff changeset
   788
  ...     time.sleep(1)
d6e99a446eea cmdserver: add option to not exit from message loop on SIGINT
Yuya Nishihara <yuya@tcha.org>
parents: 44373
diff changeset
   789
  *** runcommand debugsleep
d6e99a446eea cmdserver: add option to not exit from message loop on SIGINT
Yuya Nishihara <yuya@tcha.org>
parents: 44373
diff changeset
   790
  *** runcommand debugsleep
d6e99a446eea cmdserver: add option to not exit from message loop on SIGINT
Yuya Nishihara <yuya@tcha.org>
parents: 44373
diff changeset
   791
  *** runcommand debugsuicide
d6e99a446eea cmdserver: add option to not exit from message loop on SIGINT
Yuya Nishihara <yuya@tcha.org>
parents: 44373
diff changeset
   792
  interrupted!
d6e99a446eea cmdserver: add option to not exit from message loop on SIGINT
Yuya Nishihara <yuya@tcha.org>
parents: 44373
diff changeset
   793
  killed!
48255
8c34edb1ad10 backout: backed out changeset 6edc8800dbc3
Raphaël Gomès <rgomes@octobus.net>
parents: 48186
diff changeset
   794
   [255]
45057
d6e99a446eea cmdserver: add option to not exit from message loop on SIGINT
Yuya Nishihara <yuya@tcha.org>
parents: 44373
diff changeset
   795
d6e99a446eea cmdserver: add option to not exit from message loop on SIGINT
Yuya Nishihara <yuya@tcha.org>
parents: 44373
diff changeset
   796
#endif
d6e99a446eea cmdserver: add option to not exit from message loop on SIGINT
Yuya Nishihara <yuya@tcha.org>
parents: 44373
diff changeset
   797
d6e99a446eea cmdserver: add option to not exit from message loop on SIGINT
Yuya Nishihara <yuya@tcha.org>
parents: 44373
diff changeset
   798
40589
054d0fcba2c4 commandserver: add experimental option to use separate message channel
Yuya Nishihara <yuya@tcha.org>
parents: 40470
diff changeset
   799
structured message channel:
054d0fcba2c4 commandserver: add experimental option to use separate message channel
Yuya Nishihara <yuya@tcha.org>
parents: 40470
diff changeset
   800
054d0fcba2c4 commandserver: add experimental option to use separate message channel
Yuya Nishihara <yuya@tcha.org>
parents: 40470
diff changeset
   801
  $ cat <<'EOF' >> repo2/.hg/hgrc
054d0fcba2c4 commandserver: add experimental option to use separate message channel
Yuya Nishihara <yuya@tcha.org>
parents: 40470
diff changeset
   802
  > [ui]
054d0fcba2c4 commandserver: add experimental option to use separate message channel
Yuya Nishihara <yuya@tcha.org>
parents: 40470
diff changeset
   803
  > # server --config should precede repository option
054d0fcba2c4 commandserver: add experimental option to use separate message channel
Yuya Nishihara <yuya@tcha.org>
parents: 40470
diff changeset
   804
  > message-output = stdio
054d0fcba2c4 commandserver: add experimental option to use separate message channel
Yuya Nishihara <yuya@tcha.org>
parents: 40470
diff changeset
   805
  > EOF
054d0fcba2c4 commandserver: add experimental option to use separate message channel
Yuya Nishihara <yuya@tcha.org>
parents: 40470
diff changeset
   806
054d0fcba2c4 commandserver: add experimental option to use separate message channel
Yuya Nishihara <yuya@tcha.org>
parents: 40470
diff changeset
   807
  >>> from hgclient import bprint, checkwith, readchannel, runcommand
054d0fcba2c4 commandserver: add experimental option to use separate message channel
Yuya Nishihara <yuya@tcha.org>
parents: 40470
diff changeset
   808
  >>> @checkwith(extraargs=[b'--config', b'ui.message-output=channel',
054d0fcba2c4 commandserver: add experimental option to use separate message channel
Yuya Nishihara <yuya@tcha.org>
parents: 40470
diff changeset
   809
  ...                       b'--config', b'cmdserver.message-encodings=foo cbor'])
054d0fcba2c4 commandserver: add experimental option to use separate message channel
Yuya Nishihara <yuya@tcha.org>
parents: 40470
diff changeset
   810
  ... def verify(server):
054d0fcba2c4 commandserver: add experimental option to use separate message channel
Yuya Nishihara <yuya@tcha.org>
parents: 40470
diff changeset
   811
  ...     _ch, data = readchannel(server)
054d0fcba2c4 commandserver: add experimental option to use separate message channel
Yuya Nishihara <yuya@tcha.org>
parents: 40470
diff changeset
   812
  ...     bprint(data)
054d0fcba2c4 commandserver: add experimental option to use separate message channel
Yuya Nishihara <yuya@tcha.org>
parents: 40470
diff changeset
   813
  ...     runcommand(server, [b'-R', b'repo2', b'verify'])
054d0fcba2c4 commandserver: add experimental option to use separate message channel
Yuya Nishihara <yuya@tcha.org>
parents: 40470
diff changeset
   814
  capabilities: getencoding runcommand
054d0fcba2c4 commandserver: add experimental option to use separate message channel
Yuya Nishihara <yuya@tcha.org>
parents: 40470
diff changeset
   815
  encoding: ascii
054d0fcba2c4 commandserver: add experimental option to use separate message channel
Yuya Nishihara <yuya@tcha.org>
parents: 40470
diff changeset
   816
  message-encoding: cbor
054d0fcba2c4 commandserver: add experimental option to use separate message channel
Yuya Nishihara <yuya@tcha.org>
parents: 40470
diff changeset
   817
  pid: * (glob)
40653
6d0fdeda43f7 tests: stabilize test-commandserver.t on Windows
Matt Harbison <matt_harbison@yahoo.com>
parents: 40594
diff changeset
   818
  pgid: * (glob) (no-windows !)
40589
054d0fcba2c4 commandserver: add experimental option to use separate message channel
Yuya Nishihara <yuya@tcha.org>
parents: 40470
diff changeset
   819
  *** runcommand -R repo2 verify
40590
83dd8c63a0c6 ui: extract helpers to write message with type or label
Yuya Nishihara <yuya@tcha.org>
parents: 40589
diff changeset
   820
  message: '\xa2DdataTchecking changesets\nDtypeFstatus'
40594
234c2d8c9e48 commandserver: send raw progress information to message channel
Yuya Nishihara <yuya@tcha.org>
parents: 40593
diff changeset
   821
  message: '\xa6Ditem@Cpos\xf6EtopicHcheckingEtotal\xf6DtypeHprogressDunit@'
40590
83dd8c63a0c6 ui: extract helpers to write message with type or label
Yuya Nishihara <yuya@tcha.org>
parents: 40589
diff changeset
   822
  message: '\xa2DdataSchecking manifests\nDtypeFstatus'
40594
234c2d8c9e48 commandserver: send raw progress information to message channel
Yuya Nishihara <yuya@tcha.org>
parents: 40593
diff changeset
   823
  message: '\xa6Ditem@Cpos\xf6EtopicHcheckingEtotal\xf6DtypeHprogressDunit@'
40590
83dd8c63a0c6 ui: extract helpers to write message with type or label
Yuya Nishihara <yuya@tcha.org>
parents: 40589
diff changeset
   824
  message: '\xa2DdataX0crosschecking files in changesets and manifests\nDtypeFstatus'
40594
234c2d8c9e48 commandserver: send raw progress information to message channel
Yuya Nishihara <yuya@tcha.org>
parents: 40593
diff changeset
   825
  message: '\xa6Ditem@Cpos\xf6EtopicMcrosscheckingEtotal\xf6DtypeHprogressDunit@'
40590
83dd8c63a0c6 ui: extract helpers to write message with type or label
Yuya Nishihara <yuya@tcha.org>
parents: 40589
diff changeset
   826
  message: '\xa2DdataOchecking files\nDtypeFstatus'
40594
234c2d8c9e48 commandserver: send raw progress information to message channel
Yuya Nishihara <yuya@tcha.org>
parents: 40593
diff changeset
   827
  message: '\xa6Ditem@Cpos\xf6EtopicHcheckingEtotal\xf6DtypeHprogressDunit@'
40590
83dd8c63a0c6 ui: extract helpers to write message with type or label
Yuya Nishihara <yuya@tcha.org>
parents: 40589
diff changeset
   828
  message: '\xa2DdataX/checked 0 changesets with 0 changes to 0 files\nDtypeFstatus'
40589
054d0fcba2c4 commandserver: add experimental option to use separate message channel
Yuya Nishihara <yuya@tcha.org>
parents: 40470
diff changeset
   829
40592
83e571ea06a9 commandserver: attach prompt default and choices to message
Yuya Nishihara <yuya@tcha.org>
parents: 40591
diff changeset
   830
  >>> from hgclient import checkwith, readchannel, runcommand, stringio
83e571ea06a9 commandserver: attach prompt default and choices to message
Yuya Nishihara <yuya@tcha.org>
parents: 40591
diff changeset
   831
  >>> @checkwith(extraargs=[b'--config', b'ui.message-output=channel',
83e571ea06a9 commandserver: attach prompt default and choices to message
Yuya Nishihara <yuya@tcha.org>
parents: 40591
diff changeset
   832
  ...                       b'--config', b'cmdserver.message-encodings=cbor',
83e571ea06a9 commandserver: attach prompt default and choices to message
Yuya Nishihara <yuya@tcha.org>
parents: 40591
diff changeset
   833
  ...                       b'--config', b'extensions.dbgui=dbgui.py'])
83e571ea06a9 commandserver: attach prompt default and choices to message
Yuya Nishihara <yuya@tcha.org>
parents: 40591
diff changeset
   834
  ... def prompt(server):
83e571ea06a9 commandserver: attach prompt default and choices to message
Yuya Nishihara <yuya@tcha.org>
parents: 40591
diff changeset
   835
  ...     readchannel(server)
83e571ea06a9 commandserver: attach prompt default and choices to message
Yuya Nishihara <yuya@tcha.org>
parents: 40591
diff changeset
   836
  ...     interactive = [b'--config', b'ui.interactive=True']
40593
6f0941f4a184 commandserver: make getpass() request distinct from normal prompt
Yuya Nishihara <yuya@tcha.org>
parents: 40592
diff changeset
   837
  ...     runcommand(server, [b'debuggetpass'] + interactive,
6f0941f4a184 commandserver: make getpass() request distinct from normal prompt
Yuya Nishihara <yuya@tcha.org>
parents: 40592
diff changeset
   838
  ...                input=stringio(b'1234\n'))
40592
83e571ea06a9 commandserver: attach prompt default and choices to message
Yuya Nishihara <yuya@tcha.org>
parents: 40591
diff changeset
   839
  ...     runcommand(server, [b'debugprompt'] + interactive,
83e571ea06a9 commandserver: attach prompt default and choices to message
Yuya Nishihara <yuya@tcha.org>
parents: 40591
diff changeset
   840
  ...                input=stringio(b'5678\n'))
83e571ea06a9 commandserver: attach prompt default and choices to message
Yuya Nishihara <yuya@tcha.org>
parents: 40591
diff changeset
   841
  ...     runcommand(server, [b'debugpromptchoice'] + interactive,
83e571ea06a9 commandserver: attach prompt default and choices to message
Yuya Nishihara <yuya@tcha.org>
parents: 40591
diff changeset
   842
  ...                input=stringio(b'n\n'))
40593
6f0941f4a184 commandserver: make getpass() request distinct from normal prompt
Yuya Nishihara <yuya@tcha.org>
parents: 40592
diff changeset
   843
  *** runcommand debuggetpass --config ui.interactive=True
6f0941f4a184 commandserver: make getpass() request distinct from normal prompt
Yuya Nishihara <yuya@tcha.org>
parents: 40592
diff changeset
   844
  message: '\xa3DdataJpassword: Hpassword\xf5DtypeFprompt'
6f0941f4a184 commandserver: make getpass() request distinct from normal prompt
Yuya Nishihara <yuya@tcha.org>
parents: 40592
diff changeset
   845
  1234
40592
83e571ea06a9 commandserver: attach prompt default and choices to message
Yuya Nishihara <yuya@tcha.org>
parents: 40591
diff changeset
   846
  *** runcommand debugprompt --config ui.interactive=True
83e571ea06a9 commandserver: attach prompt default and choices to message
Yuya Nishihara <yuya@tcha.org>
parents: 40591
diff changeset
   847
  message: '\xa3DdataGprompt:GdefaultAyDtypeFprompt'
83e571ea06a9 commandserver: attach prompt default and choices to message
Yuya Nishihara <yuya@tcha.org>
parents: 40591
diff changeset
   848
   5678
83e571ea06a9 commandserver: attach prompt default and choices to message
Yuya Nishihara <yuya@tcha.org>
parents: 40591
diff changeset
   849
  *** runcommand debugpromptchoice --config ui.interactive=True
83e571ea06a9 commandserver: attach prompt default and choices to message
Yuya Nishihara <yuya@tcha.org>
parents: 40591
diff changeset
   850
  message: '\xa4Gchoices\x82\x82AyCYes\x82AnBNoDdataTpromptchoice (y/n)? GdefaultAyDtypeFprompt'
83e571ea06a9 commandserver: attach prompt default and choices to message
Yuya Nishihara <yuya@tcha.org>
parents: 40591
diff changeset
   851
   1
83e571ea06a9 commandserver: attach prompt default and choices to message
Yuya Nishihara <yuya@tcha.org>
parents: 40591
diff changeset
   852
40589
054d0fcba2c4 commandserver: add experimental option to use separate message channel
Yuya Nishihara <yuya@tcha.org>
parents: 40470
diff changeset
   853
bad message encoding:
054d0fcba2c4 commandserver: add experimental option to use separate message channel
Yuya Nishihara <yuya@tcha.org>
parents: 40470
diff changeset
   854
054d0fcba2c4 commandserver: add experimental option to use separate message channel
Yuya Nishihara <yuya@tcha.org>
parents: 40470
diff changeset
   855
  $ hg serve --cmdserver pipe --config ui.message-output=channel
054d0fcba2c4 commandserver: add experimental option to use separate message channel
Yuya Nishihara <yuya@tcha.org>
parents: 40470
diff changeset
   856
  abort: no supported message encodings: 
054d0fcba2c4 commandserver: add experimental option to use separate message channel
Yuya Nishihara <yuya@tcha.org>
parents: 40470
diff changeset
   857
  [255]
054d0fcba2c4 commandserver: add experimental option to use separate message channel
Yuya Nishihara <yuya@tcha.org>
parents: 40470
diff changeset
   858
  $ hg serve --cmdserver pipe --config ui.message-output=channel \
054d0fcba2c4 commandserver: add experimental option to use separate message channel
Yuya Nishihara <yuya@tcha.org>
parents: 40470
diff changeset
   859
  > --config cmdserver.message-encodings='foo bar'
054d0fcba2c4 commandserver: add experimental option to use separate message channel
Yuya Nishihara <yuya@tcha.org>
parents: 40470
diff changeset
   860
  abort: no supported message encodings: foo bar
054d0fcba2c4 commandserver: add experimental option to use separate message channel
Yuya Nishihara <yuya@tcha.org>
parents: 40470
diff changeset
   861
  [255]
054d0fcba2c4 commandserver: add experimental option to use separate message channel
Yuya Nishihara <yuya@tcha.org>
parents: 40470
diff changeset
   862
22994
840be5ca03e1 cmdserver: add service that listens on unix domain socket and forks process
Yuya Nishihara <yuya@tcha.org>
parents: 22955
diff changeset
   863
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
   864
840be5ca03e1 cmdserver: add service that listens on unix domain socket and forks process
Yuya Nishihara <yuya@tcha.org>
parents: 22955
diff changeset
   865
  $ cd repo
840be5ca03e1 cmdserver: add service that listens on unix domain socket and forks process
Yuya Nishihara <yuya@tcha.org>
parents: 22955
diff changeset
   866
  $ 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
   867
23095
ac827031fe05 tests: don't try to test unix sockets on vfat
Matt Mackall <mpm@selenic.com>
parents: 23053
diff changeset
   868
#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
   869
40355
77ab5fbdbbf0 py3: use bprint() helper in test-commandserver.t
Yuya Nishihara <yuya@tcha.org>
parents: 40354
diff changeset
   870
  >>> from hgclient import bprint, check, readchannel, runcommand, stringio, unixserver
40354
f9f2faf25fc4 py3: byte-stringify most literals in test-commandserver.t
Yuya Nishihara <yuya@tcha.org>
parents: 39951
diff changeset
   871
  >>> server = unixserver(b'.hg/server.sock', b'.hg/server.log')
22994
840be5ca03e1 cmdserver: add service that listens on unix domain socket and forks process
Yuya Nishihara <yuya@tcha.org>
parents: 22955
diff changeset
   872
  >>> 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
   873
  ...     ch, data = readchannel(conn)
40355
77ab5fbdbbf0 py3: use bprint() helper in test-commandserver.t
Yuya Nishihara <yuya@tcha.org>
parents: 40354
diff changeset
   874
  ...     bprint(b'%c, %r' % (ch, data))
40354
f9f2faf25fc4 py3: byte-stringify most literals in test-commandserver.t
Yuya Nishihara <yuya@tcha.org>
parents: 39951
diff changeset
   875
  ...     runcommand(conn, [b'id'])
22994
840be5ca03e1 cmdserver: add service that listens on unix domain socket and forks process
Yuya Nishihara <yuya@tcha.org>
parents: 22955
diff changeset
   876
  >>> 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
   877
  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
   878
  *** runcommand id
840be5ca03e1 cmdserver: add service that listens on unix domain socket and forks process
Yuya Nishihara <yuya@tcha.org>
parents: 22955
diff changeset
   879
  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
   880
  >>> 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
   881
  ...     readchannel(conn)
40354
f9f2faf25fc4 py3: byte-stringify most literals in test-commandserver.t
Yuya Nishihara <yuya@tcha.org>
parents: 39951
diff changeset
   882
  ...     conn.stdin.write(b'unknowncommand\n')
22994
840be5ca03e1 cmdserver: add service that listens on unix domain socket and forks process
Yuya Nishihara <yuya@tcha.org>
parents: 22955
diff changeset
   883
  >>> 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
   884
  >>> 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
   885
  ...     readchannel(conn)
40354
f9f2faf25fc4 py3: byte-stringify most literals in test-commandserver.t
Yuya Nishihara <yuya@tcha.org>
parents: 39951
diff changeset
   886
  ...     patch = b"""
22994
840be5ca03e1 cmdserver: add service that listens on unix domain socket and forks process
Yuya Nishihara <yuya@tcha.org>
parents: 22955
diff changeset
   887
  ... # 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
   888
  ... # User test
840be5ca03e1 cmdserver: add service that listens on unix domain socket and forks process
Yuya Nishihara <yuya@tcha.org>
parents: 22955
diff changeset
   889
  ... # 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
   890
  ... 2
840be5ca03e1 cmdserver: add service that listens on unix domain socket and forks process
Yuya Nishihara <yuya@tcha.org>
parents: 22955
diff changeset
   891
  ... 
840be5ca03e1 cmdserver: add service that listens on unix domain socket and forks process
Yuya Nishihara <yuya@tcha.org>
parents: 22955
diff changeset
   892
  ... 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
   893
  ... --- a/a
840be5ca03e1 cmdserver: add service that listens on unix domain socket and forks process
Yuya Nishihara <yuya@tcha.org>
parents: 22955
diff changeset
   894
  ... +++ b/a
840be5ca03e1 cmdserver: add service that listens on unix domain socket and forks process
Yuya Nishihara <yuya@tcha.org>
parents: 22955
diff changeset
   895
  ... @@ -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
   896
  ...  1
840be5ca03e1 cmdserver: add service that listens on unix domain socket and forks process
Yuya Nishihara <yuya@tcha.org>
parents: 22955
diff changeset
   897
  ... +2
840be5ca03e1 cmdserver: add service that listens on unix domain socket and forks process
Yuya Nishihara <yuya@tcha.org>
parents: 22955
diff changeset
   898
  ... """
40354
f9f2faf25fc4 py3: byte-stringify most literals in test-commandserver.t
Yuya Nishihara <yuya@tcha.org>
parents: 39951
diff changeset
   899
  ...     runcommand(conn, [b'import', b'-'], input=stringio(patch))
f9f2faf25fc4 py3: byte-stringify most literals in test-commandserver.t
Yuya Nishihara <yuya@tcha.org>
parents: 39951
diff changeset
   900
  ...     runcommand(conn, [b'log', b'-rtip', b'-q'])
22994
840be5ca03e1 cmdserver: add service that listens on unix domain socket and forks process
Yuya Nishihara <yuya@tcha.org>
parents: 22955
diff changeset
   901
  >>> 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
   902
  *** runcommand import -
840be5ca03e1 cmdserver: add service that listens on unix domain socket and forks process
Yuya Nishihara <yuya@tcha.org>
parents: 22955
diff changeset
   903
  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
   904
  *** 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
   905
  2:1ed24be7e7a0
840be5ca03e1 cmdserver: add service that listens on unix domain socket and forks process
Yuya Nishihara <yuya@tcha.org>
parents: 22955
diff changeset
   906
  >>> server.shutdown()
840be5ca03e1 cmdserver: add service that listens on unix domain socket and forks process
Yuya Nishihara <yuya@tcha.org>
parents: 22955
diff changeset
   907
840be5ca03e1 cmdserver: add service that listens on unix domain socket and forks process
Yuya Nishihara <yuya@tcha.org>
parents: 22955
diff changeset
   908
  $ 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
   909
  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
   910
  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
   911
  killed!
28511
ff5f923fca3c cmdserver: write early exception to 'e' channel in 'unix' mode
Yuya Nishihara <yuya@tcha.org>
parents: 28265
diff changeset
   912
  $ rm .hg/server.log
ff5f923fca3c cmdserver: write early exception to 'e' channel in 'unix' mode
Yuya Nishihara <yuya@tcha.org>
parents: 28265
diff changeset
   913
ff5f923fca3c cmdserver: write early exception to 'e' channel in 'unix' mode
Yuya Nishihara <yuya@tcha.org>
parents: 28265
diff changeset
   914
 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
   915
 last ditch:
ff5f923fca3c cmdserver: write early exception to 'e' channel in 'unix' mode
Yuya Nishihara <yuya@tcha.org>
parents: 28265
diff changeset
   916
40822
6a75363f834a test-commandserver: change way of triggering early crash
Yuya Nishihara <yuya@tcha.org>
parents: 40653
diff changeset
   917
  $ cat <<'EOF' > ../earlycrasher.py
6a75363f834a test-commandserver: change way of triggering early crash
Yuya Nishihara <yuya@tcha.org>
parents: 40653
diff changeset
   918
  > from mercurial import commandserver, extensions
40875
e7110f44ee2d commandserver: pass around option to hook repo instance creation
Yuya Nishihara <yuya@tcha.org>
parents: 40822
diff changeset
   919
  > def _serverequest(orig, ui, repo, conn, createcmdserver, prereposetups):
40822
6a75363f834a test-commandserver: change way of triggering early crash
Yuya Nishihara <yuya@tcha.org>
parents: 40653
diff changeset
   920
  >     def createcmdserver(*args, **kwargs):
6a75363f834a test-commandserver: change way of triggering early crash
Yuya Nishihara <yuya@tcha.org>
parents: 40653
diff changeset
   921
  >         raise Exception('crash')
40875
e7110f44ee2d commandserver: pass around option to hook repo instance creation
Yuya Nishihara <yuya@tcha.org>
parents: 40822
diff changeset
   922
  >     return orig(ui, repo, conn, createcmdserver, prereposetups)
40822
6a75363f834a test-commandserver: change way of triggering early crash
Yuya Nishihara <yuya@tcha.org>
parents: 40653
diff changeset
   923
  > def extsetup(ui):
6a75363f834a test-commandserver: change way of triggering early crash
Yuya Nishihara <yuya@tcha.org>
parents: 40653
diff changeset
   924
  >     extensions.wrapfunction(commandserver, b'_serverequest', _serverequest)
6a75363f834a test-commandserver: change way of triggering early crash
Yuya Nishihara <yuya@tcha.org>
parents: 40653
diff changeset
   925
  > EOF
28511
ff5f923fca3c cmdserver: write early exception to 'e' channel in 'unix' mode
Yuya Nishihara <yuya@tcha.org>
parents: 28265
diff changeset
   926
  $ cat <<EOF >> .hg/hgrc
40822
6a75363f834a test-commandserver: change way of triggering early crash
Yuya Nishihara <yuya@tcha.org>
parents: 40653
diff changeset
   927
  > [extensions]
6a75363f834a test-commandserver: change way of triggering early crash
Yuya Nishihara <yuya@tcha.org>
parents: 40653
diff changeset
   928
  > earlycrasher = ../earlycrasher.py
28511
ff5f923fca3c cmdserver: write early exception to 'e' channel in 'unix' mode
Yuya Nishihara <yuya@tcha.org>
parents: 28265
diff changeset
   929
  > EOF
40355
77ab5fbdbbf0 py3: use bprint() helper in test-commandserver.t
Yuya Nishihara <yuya@tcha.org>
parents: 40354
diff changeset
   930
  >>> from hgclient import bprint, check, readchannel, unixserver
40354
f9f2faf25fc4 py3: byte-stringify most literals in test-commandserver.t
Yuya Nishihara <yuya@tcha.org>
parents: 39951
diff changeset
   931
  >>> server = unixserver(b'.hg/server.sock', b'.hg/server.log')
28511
ff5f923fca3c cmdserver: write early exception to 'e' channel in 'unix' mode
Yuya Nishihara <yuya@tcha.org>
parents: 28265
diff changeset
   932
  >>> def earlycrash(conn):
ff5f923fca3c cmdserver: write early exception to 'e' channel in 'unix' mode
Yuya Nishihara <yuya@tcha.org>
parents: 28265
diff changeset
   933
  ...     while True:
ff5f923fca3c cmdserver: write early exception to 'e' channel in 'unix' mode
Yuya Nishihara <yuya@tcha.org>
parents: 28265
diff changeset
   934
  ...         try:
ff5f923fca3c cmdserver: write early exception to 'e' channel in 'unix' mode
Yuya Nishihara <yuya@tcha.org>
parents: 28265
diff changeset
   935
  ...             ch, data = readchannel(conn)
40361
b7de186efd82 py3: don't use traceback.print_exc() in commandserver.py
Yuya Nishihara <yuya@tcha.org>
parents: 40356
diff changeset
   936
  ...             for l in data.splitlines(True):
b7de186efd82 py3: don't use traceback.print_exc() in commandserver.py
Yuya Nishihara <yuya@tcha.org>
parents: 40356
diff changeset
   937
  ...                 if not l.startswith(b'  '):
b7de186efd82 py3: don't use traceback.print_exc() in commandserver.py
Yuya Nishihara <yuya@tcha.org>
parents: 40356
diff changeset
   938
  ...                     bprint(b'%c, %r' % (ch, l))
28511
ff5f923fca3c cmdserver: write early exception to 'e' channel in 'unix' mode
Yuya Nishihara <yuya@tcha.org>
parents: 28265
diff changeset
   939
  ...         except EOFError:
ff5f923fca3c cmdserver: write early exception to 'e' channel in 'unix' mode
Yuya Nishihara <yuya@tcha.org>
parents: 28265
diff changeset
   940
  ...             break
ff5f923fca3c cmdserver: write early exception to 'e' channel in 'unix' mode
Yuya Nishihara <yuya@tcha.org>
parents: 28265
diff changeset
   941
  >>> check(earlycrash, server.connect)
ff5f923fca3c cmdserver: write early exception to 'e' channel in 'unix' mode
Yuya Nishihara <yuya@tcha.org>
parents: 28265
diff changeset
   942
  e, 'Traceback (most recent call last):\n'
40822
6a75363f834a test-commandserver: change way of triggering early crash
Yuya Nishihara <yuya@tcha.org>
parents: 40653
diff changeset
   943
  e, 'Exception: crash\n'
28511
ff5f923fca3c cmdserver: write early exception to 'e' channel in 'unix' mode
Yuya Nishihara <yuya@tcha.org>
parents: 28265
diff changeset
   944
  >>> server.shutdown()
ff5f923fca3c cmdserver: write early exception to 'e' channel in 'unix' mode
Yuya Nishihara <yuya@tcha.org>
parents: 28265
diff changeset
   945
ff5f923fca3c cmdserver: write early exception to 'e' channel in 'unix' mode
Yuya Nishihara <yuya@tcha.org>
parents: 28265
diff changeset
   946
  $ 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
   947
  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
   948
  Traceback (most recent call last):
40822
6a75363f834a test-commandserver: change way of triggering early crash
Yuya Nishihara <yuya@tcha.org>
parents: 40653
diff changeset
   949
  Exception: crash
28511
ff5f923fca3c cmdserver: write early exception to 'e' channel in 'unix' mode
Yuya Nishihara <yuya@tcha.org>
parents: 28265
diff changeset
   950
  killed!
23095
ac827031fe05 tests: don't try to test unix sockets on vfat
Matt Mackall <mpm@selenic.com>
parents: 23053
diff changeset
   951
#endif
ac827031fe05 tests: don't try to test unix sockets on vfat
Matt Mackall <mpm@selenic.com>
parents: 23053
diff changeset
   952
#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
   953
840be5ca03e1 cmdserver: add service that listens on unix domain socket and forks process
Yuya Nishihara <yuya@tcha.org>
parents: 22955
diff changeset
   954
  $ 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
   955
  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
   956
  [255]
840be5ca03e1 cmdserver: add service that listens on unix domain socket and forks process
Yuya Nishihara <yuya@tcha.org>
parents: 22955
diff changeset
   957
840be5ca03e1 cmdserver: add service that listens on unix domain socket and forks process
Yuya Nishihara <yuya@tcha.org>
parents: 22955
diff changeset
   958
#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
   959
332926212ef8 repoview: discard filtered changelog if index isn't shared with unfiltered
FUJIWARA Katsunori <foozy@lares.dti.ne.jp>
parents: 26431
diff changeset
   960
  $ cd ..
332926212ef8 repoview: discard filtered changelog if index isn't shared with unfiltered
FUJIWARA Katsunori <foozy@lares.dti.ne.jp>
parents: 26431
diff changeset
   961
332926212ef8 repoview: discard filtered changelog if index isn't shared with unfiltered
FUJIWARA Katsunori <foozy@lares.dti.ne.jp>
parents: 26431
diff changeset
   962
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
   963
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
   964
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
   965
332926212ef8 repoview: discard filtered changelog if index isn't shared with unfiltered
FUJIWARA Katsunori <foozy@lares.dti.ne.jp>
parents: 26431
diff changeset
   966
"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
   967
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
   968
332926212ef8 repoview: discard filtered changelog if index isn't shared with unfiltered
FUJIWARA Katsunori <foozy@lares.dti.ne.jp>
parents: 26431
diff changeset
   969
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
   970
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
   971
cases.
332926212ef8 repoview: discard filtered changelog if index isn't shared with unfiltered
FUJIWARA Katsunori <foozy@lares.dti.ne.jp>
parents: 26431
diff changeset
   972
332926212ef8 repoview: discard filtered changelog if index isn't shared with unfiltered
FUJIWARA Katsunori <foozy@lares.dti.ne.jp>
parents: 26431
diff changeset
   973
  $ 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
   974
  > # 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
   975
  > 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
   976
  > from mercurial import registrar
f3e4a5ad0d90 configitems: register the test 'failafterfinalize.fail' config
Boris Feld <boris.feld@octobus.net>
parents: 34555
diff changeset
   977
  > cmdtable = {}
f3e4a5ad0d90 configitems: register the test 'failafterfinalize.fail' config
Boris Feld <boris.feld@octobus.net>
parents: 34555
diff changeset
   978
  > command = registrar.command(cmdtable)
f3e4a5ad0d90 configitems: register the test 'failafterfinalize.fail' config
Boris Feld <boris.feld@octobus.net>
parents: 34555
diff changeset
   979
  > configtable = {}
f3e4a5ad0d90 configitems: register the test 'failafterfinalize.fail' config
Boris Feld <boris.feld@octobus.net>
parents: 34555
diff changeset
   980
  > configitem = registrar.configitem(configtable)
40354
f9f2faf25fc4 py3: byte-stringify most literals in test-commandserver.t
Yuya Nishihara <yuya@tcha.org>
parents: 39951
diff changeset
   981
  > configitem(b'failafterfinalize', b'fail',
34765
f3e4a5ad0d90 configitems: register the test 'failafterfinalize.fail' config
Boris Feld <boris.feld@octobus.net>
parents: 34555
diff changeset
   982
  >     default=None,
f3e4a5ad0d90 configitems: register the test 'failafterfinalize.fail' config
Boris Feld <boris.feld@octobus.net>
parents: 34555
diff changeset
   983
  > )
28265
332926212ef8 repoview: discard filtered changelog if index isn't shared with unfiltered
FUJIWARA Katsunori <foozy@lares.dti.ne.jp>
parents: 26431
diff changeset
   984
  > def fail(tr):
40354
f9f2faf25fc4 py3: byte-stringify most literals in test-commandserver.t
Yuya Nishihara <yuya@tcha.org>
parents: 39951
diff changeset
   985
  >     raise error.Abort(b'fail 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
   986
  > 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
   987
  >     class failrepo(repo.__class__):
42620
d98ec36be808 convert: add a config option to help doing identity hg->hg conversion
Valentin Gatien-Baron <valentin.gatienbaron@gmail.com>
parents: 40875
diff changeset
   988
  >         def commitctx(self, ctx, error=False, origctx=None):
40354
f9f2faf25fc4 py3: byte-stringify most literals in test-commandserver.t
Yuya Nishihara <yuya@tcha.org>
parents: 39951
diff changeset
   989
  >             if self.ui.configbool(b'failafterfinalize', b'fail'):
28265
332926212ef8 repoview: discard filtered changelog if index isn't shared with unfiltered
FUJIWARA Katsunori <foozy@lares.dti.ne.jp>
parents: 26431
diff changeset
   990
  >                 # '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
   991
  >                 # 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
   992
  >                 # using "'cl-%i' % id(self)" as category name
40354
f9f2faf25fc4 py3: byte-stringify most literals in test-commandserver.t
Yuya Nishihara <yuya@tcha.org>
parents: 39951
diff changeset
   993
  >                 self.currenttransaction().addfinalize(b'zzzzzzzz', fail)
42620
d98ec36be808 convert: add a config option to help doing identity hg->hg conversion
Valentin Gatien-Baron <valentin.gatienbaron@gmail.com>
parents: 40875
diff changeset
   994
  >             return super(failrepo, self).commitctx(ctx, error, origctx)
28265
332926212ef8 repoview: discard filtered changelog if index isn't shared with unfiltered
FUJIWARA Katsunori <foozy@lares.dti.ne.jp>
parents: 26431
diff changeset
   995
  >     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
   996
  > EOF
332926212ef8 repoview: discard filtered changelog if index isn't shared with unfiltered
FUJIWARA Katsunori <foozy@lares.dti.ne.jp>
parents: 26431
diff changeset
   997
332926212ef8 repoview: discard filtered changelog if index isn't shared with unfiltered
FUJIWARA Katsunori <foozy@lares.dti.ne.jp>
parents: 26431
diff changeset
   998
  $ 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
   999
  $ 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
  1000
332926212ef8 repoview: discard filtered changelog if index isn't shared with unfiltered
FUJIWARA Katsunori <foozy@lares.dti.ne.jp>
parents: 26431
diff changeset
  1001
  $ cat <<EOF >> $HGRCPATH
45765
ed84a4d48910 config: add a new [command-templates] section for templates defined by hg
Martin von Zweigbergk <martinvonz@google.com>
parents: 45057
diff changeset
  1002
  > [command-templates]
ed84a4d48910 config: add a new [command-templates] section for templates defined by hg
Martin von Zweigbergk <martinvonz@google.com>
parents: 45057
diff changeset
  1003
  > log = {rev} {desc|firstline} ({files})\n
28265
332926212ef8 repoview: discard filtered changelog if index isn't shared with unfiltered
FUJIWARA Katsunori <foozy@lares.dti.ne.jp>
parents: 26431
diff changeset
  1004
  > 
332926212ef8 repoview: discard filtered changelog if index isn't shared with unfiltered
FUJIWARA Katsunori <foozy@lares.dti.ne.jp>
parents: 26431
diff changeset
  1005
  > [extensions]
332926212ef8 repoview: discard filtered changelog if index isn't shared with unfiltered
FUJIWARA Katsunori <foozy@lares.dti.ne.jp>
parents: 26431
diff changeset
  1006
  > 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
  1007
  > EOF
332926212ef8 repoview: discard filtered changelog if index isn't shared with unfiltered
FUJIWARA Katsunori <foozy@lares.dti.ne.jp>
parents: 26431
diff changeset
  1008
332926212ef8 repoview: discard filtered changelog if index isn't shared with unfiltered
FUJIWARA Katsunori <foozy@lares.dti.ne.jp>
parents: 26431
diff changeset
  1009
- 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
  1010
332926212ef8 repoview: discard filtered changelog if index isn't shared with unfiltered
FUJIWARA Katsunori <foozy@lares.dti.ne.jp>
parents: 26431
diff changeset
  1011
  $ 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
  1012
  $ 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
  1013
30332
318a24b52eeb spelling: fixes of non-dictionary words
Mads Kiilerich <madski@unity3d.com>
parents: 30262
diff changeset
  1014
(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
  1015
33922
1a6707b43d05 tests: update test-commandserver to pass our import checker
Augie Fackler <raf@durin42.com>
parents: 33921
diff changeset
  1016
  >>> 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
  1017
  >>> @check
332926212ef8 repoview: discard filtered changelog if index isn't shared with unfiltered
FUJIWARA Katsunori <foozy@lares.dti.ne.jp>
parents: 26431
diff changeset
  1018
  ... 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
  1019
  ...     readchannel(server)
40354
f9f2faf25fc4 py3: byte-stringify most literals in test-commandserver.t
Yuya Nishihara <yuya@tcha.org>
parents: 39951
diff changeset
  1020
  ...     runcommand(server, [b'commit',
f9f2faf25fc4 py3: byte-stringify most literals in test-commandserver.t
Yuya Nishihara <yuya@tcha.org>
parents: 39951
diff changeset
  1021
  ...                         b'--config', b'hooks.pretxncommit=false',
f9f2faf25fc4 py3: byte-stringify most literals in test-commandserver.t
Yuya Nishihara <yuya@tcha.org>
parents: 39951
diff changeset
  1022
  ...                         b'-mfoo'])
f9f2faf25fc4 py3: byte-stringify most literals in test-commandserver.t
Yuya Nishihara <yuya@tcha.org>
parents: 39951
diff changeset
  1023
  ...     runcommand(server, [b'log'])
f9f2faf25fc4 py3: byte-stringify most literals in test-commandserver.t
Yuya Nishihara <yuya@tcha.org>
parents: 39951
diff changeset
  1024
  ...     runcommand(server, [b'verify', b'-q'])
28265
332926212ef8 repoview: discard filtered changelog if index isn't shared with unfiltered
FUJIWARA Katsunori <foozy@lares.dti.ne.jp>
parents: 26431
diff changeset
  1025
  *** 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
  1026
  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
  1027
  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
  1028
  abort: pretxncommit hook exited with status 1
46417
768056549737 errors: use exit code 40 for when a hook fails
Martin von Zweigbergk <martinvonz@google.com>
parents: 46015
diff changeset
  1029
   [40]
28265
332926212ef8 repoview: discard filtered changelog if index isn't shared with unfiltered
FUJIWARA Katsunori <foozy@lares.dti.ne.jp>
parents: 26431
diff changeset
  1030
  *** 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
  1031
  *** 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
  1032
30332
318a24b52eeb spelling: fixes of non-dictionary words
Mads Kiilerich <madski@unity3d.com>
parents: 30262
diff changeset
  1033
(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
  1034
33922
1a6707b43d05 tests: update test-commandserver to pass our import checker
Augie Fackler <raf@durin42.com>
parents: 33921
diff changeset
  1035
  >>> 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
  1036
  >>> @check
332926212ef8 repoview: discard filtered changelog if index isn't shared with unfiltered
FUJIWARA Katsunori <foozy@lares.dti.ne.jp>
parents: 26431
diff changeset
  1037
  ... 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
  1038
  ...     readchannel(server)
40354
f9f2faf25fc4 py3: byte-stringify most literals in test-commandserver.t
Yuya Nishihara <yuya@tcha.org>
parents: 39951
diff changeset
  1039
  ...     runcommand(server, [b'commit',
f9f2faf25fc4 py3: byte-stringify most literals in test-commandserver.t
Yuya Nishihara <yuya@tcha.org>
parents: 39951
diff changeset
  1040
  ...                         b'--config', b'failafterfinalize.fail=true',
f9f2faf25fc4 py3: byte-stringify most literals in test-commandserver.t
Yuya Nishihara <yuya@tcha.org>
parents: 39951
diff changeset
  1041
  ...                         b'-mfoo'])
f9f2faf25fc4 py3: byte-stringify most literals in test-commandserver.t
Yuya Nishihara <yuya@tcha.org>
parents: 39951
diff changeset
  1042
  ...     runcommand(server, [b'log'])
f9f2faf25fc4 py3: byte-stringify most literals in test-commandserver.t
Yuya Nishihara <yuya@tcha.org>
parents: 39951
diff changeset
  1043
  ...     runcommand(server, [b'verify', b'-q'])
28265
332926212ef8 repoview: discard filtered changelog if index isn't shared with unfiltered
FUJIWARA Katsunori <foozy@lares.dti.ne.jp>
parents: 26431
diff changeset
  1044
  *** 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
  1045
  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
  1046
  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
  1047
  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
  1048
   [255]
332926212ef8 repoview: discard filtered changelog if index isn't shared with unfiltered
FUJIWARA Katsunori <foozy@lares.dti.ne.jp>
parents: 26431
diff changeset
  1049
  *** 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
  1050
  *** 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
  1051
332926212ef8 repoview: discard filtered changelog if index isn't shared with unfiltered
FUJIWARA Katsunori <foozy@lares.dti.ne.jp>
parents: 26431
diff changeset
  1052
- 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
  1053
332926212ef8 repoview: discard filtered changelog if index isn't shared with unfiltered
FUJIWARA Katsunori <foozy@lares.dti.ne.jp>
parents: 26431
diff changeset
  1054
  $ 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
  1055
  $ 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
  1056
  $ 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
  1057
332926212ef8 repoview: discard filtered changelog if index isn't shared with unfiltered
FUJIWARA Katsunori <foozy@lares.dti.ne.jp>
parents: 26431
diff changeset
  1058
(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
  1059
33922
1a6707b43d05 tests: update test-commandserver to pass our import checker
Augie Fackler <raf@durin42.com>
parents: 33921
diff changeset
  1060
  >>> 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
  1061
  >>> @check
332926212ef8 repoview: discard filtered changelog if index isn't shared with unfiltered
FUJIWARA Katsunori <foozy@lares.dti.ne.jp>
parents: 26431
diff changeset
  1062
  ... 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
  1063
  ...     readchannel(server)
40354
f9f2faf25fc4 py3: byte-stringify most literals in test-commandserver.t
Yuya Nishihara <yuya@tcha.org>
parents: 39951
diff changeset
  1064
  ...     runcommand(server, [b'commit',
f9f2faf25fc4 py3: byte-stringify most literals in test-commandserver.t
Yuya Nishihara <yuya@tcha.org>
parents: 39951
diff changeset
  1065
  ...                         b'--config', b'hooks.pretxncommit=false',
f9f2faf25fc4 py3: byte-stringify most literals in test-commandserver.t
Yuya Nishihara <yuya@tcha.org>
parents: 39951
diff changeset
  1066
  ...                         b'-mfoo', b'foo'])
f9f2faf25fc4 py3: byte-stringify most literals in test-commandserver.t
Yuya Nishihara <yuya@tcha.org>
parents: 39951
diff changeset
  1067
  ...     runcommand(server, [b'log'])
f9f2faf25fc4 py3: byte-stringify most literals in test-commandserver.t
Yuya Nishihara <yuya@tcha.org>
parents: 39951
diff changeset
  1068
  ...     runcommand(server, [b'verify', b'-q'])
28265
332926212ef8 repoview: discard filtered changelog if index isn't shared with unfiltered
FUJIWARA Katsunori <foozy@lares.dti.ne.jp>
parents: 26431
diff changeset
  1069
  *** 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
  1070
  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
  1071
  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
  1072
  abort: pretxncommit hook exited with status 1
46417
768056549737 errors: use exit code 40 for when a hook fails
Martin von Zweigbergk <martinvonz@google.com>
parents: 46015
diff changeset
  1073
   [40]
28265
332926212ef8 repoview: discard filtered changelog if index isn't shared with unfiltered
FUJIWARA Katsunori <foozy@lares.dti.ne.jp>
parents: 26431
diff changeset
  1074
  *** 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
  1075
  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
  1076
  *** 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
  1077
332926212ef8 repoview: discard filtered changelog if index isn't shared with unfiltered
FUJIWARA Katsunori <foozy@lares.dti.ne.jp>
parents: 26431
diff changeset
  1078
(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
  1079
33922
1a6707b43d05 tests: update test-commandserver to pass our import checker
Augie Fackler <raf@durin42.com>
parents: 33921
diff changeset
  1080
  >>> 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
  1081
  >>> @check
332926212ef8 repoview: discard filtered changelog if index isn't shared with unfiltered
FUJIWARA Katsunori <foozy@lares.dti.ne.jp>
parents: 26431
diff changeset
  1082
  ... 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
  1083
  ...     readchannel(server)
40354
f9f2faf25fc4 py3: byte-stringify most literals in test-commandserver.t
Yuya Nishihara <yuya@tcha.org>
parents: 39951
diff changeset
  1084
  ...     runcommand(server, [b'commit',
f9f2faf25fc4 py3: byte-stringify most literals in test-commandserver.t
Yuya Nishihara <yuya@tcha.org>
parents: 39951
diff changeset
  1085
  ...                         b'--config', b'failafterfinalize.fail=true',
f9f2faf25fc4 py3: byte-stringify most literals in test-commandserver.t
Yuya Nishihara <yuya@tcha.org>
parents: 39951
diff changeset
  1086
  ...                         b'-mfoo', b'foo'])
f9f2faf25fc4 py3: byte-stringify most literals in test-commandserver.t
Yuya Nishihara <yuya@tcha.org>
parents: 39951
diff changeset
  1087
  ...     runcommand(server, [b'log'])
f9f2faf25fc4 py3: byte-stringify most literals in test-commandserver.t
Yuya Nishihara <yuya@tcha.org>
parents: 39951
diff changeset
  1088
  ...     runcommand(server, [b'verify', b'-q'])
28265
332926212ef8 repoview: discard filtered changelog if index isn't shared with unfiltered
FUJIWARA Katsunori <foozy@lares.dti.ne.jp>
parents: 26431
diff changeset
  1089
  *** 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
  1090
  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
  1091
  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
  1092
  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
  1093
   [255]
332926212ef8 repoview: discard filtered changelog if index isn't shared with unfiltered
FUJIWARA Katsunori <foozy@lares.dti.ne.jp>
parents: 26431
diff changeset
  1094
  *** 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
  1095
  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
  1096
  *** runcommand verify -q
33648
47ea28293d30 tests: show cache of audited paths is never invalidated
Yuya Nishihara <yuya@tcha.org>
parents: 33607
diff changeset
  1097
47ea28293d30 tests: show cache of audited paths is never invalidated
Yuya Nishihara <yuya@tcha.org>
parents: 33607
diff changeset
  1098
  $ cd ..
47ea28293d30 tests: show cache of audited paths is never invalidated
Yuya Nishihara <yuya@tcha.org>
parents: 33607
diff changeset
  1099
47ea28293d30 tests: show cache of audited paths is never invalidated
Yuya Nishihara <yuya@tcha.org>
parents: 33607
diff changeset
  1100
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
  1101
-------------------------------------------------
47ea28293d30 tests: show cache of audited paths is never invalidated
Yuya Nishihara <yuya@tcha.org>
parents: 33607
diff changeset
  1102
47ea28293d30 tests: show cache of audited paths is never invalidated
Yuya Nishihara <yuya@tcha.org>
parents: 33607
diff changeset
  1103
#if symlink
47ea28293d30 tests: show cache of audited paths is never invalidated
Yuya Nishihara <yuya@tcha.org>
parents: 33607
diff changeset
  1104
47ea28293d30 tests: show cache of audited paths is never invalidated
Yuya Nishihara <yuya@tcha.org>
parents: 33607
diff changeset
  1105
set up symlink hell
47ea28293d30 tests: show cache of audited paths is never invalidated
Yuya Nishihara <yuya@tcha.org>
parents: 33607
diff changeset
  1106
47ea28293d30 tests: show cache of audited paths is never invalidated
Yuya Nishihara <yuya@tcha.org>
parents: 33607
diff changeset
  1107
  $ mkdir merge-symlink-out
47ea28293d30 tests: show cache of audited paths is never invalidated
Yuya Nishihara <yuya@tcha.org>
parents: 33607
diff changeset
  1108
  $ hg init merge-symlink
47ea28293d30 tests: show cache of audited paths is never invalidated
Yuya Nishihara <yuya@tcha.org>
parents: 33607
diff changeset
  1109
  $ cd merge-symlink
47ea28293d30 tests: show cache of audited paths is never invalidated
Yuya Nishihara <yuya@tcha.org>
parents: 33607
diff changeset
  1110
  $ touch base
47ea28293d30 tests: show cache of audited paths is never invalidated
Yuya Nishihara <yuya@tcha.org>
parents: 33607
diff changeset
  1111
  $ hg commit -qAm base
47ea28293d30 tests: show cache of audited paths is never invalidated
Yuya Nishihara <yuya@tcha.org>
parents: 33607
diff changeset
  1112
  $ 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
  1113
  $ 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
  1114
  $ hg up -q 0
47ea28293d30 tests: show cache of audited paths is never invalidated
Yuya Nishihara <yuya@tcha.org>
parents: 33607
diff changeset
  1115
  $ mkdir a
47ea28293d30 tests: show cache of audited paths is never invalidated
Yuya Nishihara <yuya@tcha.org>
parents: 33607
diff changeset
  1116
  $ touch a/poisoned
47ea28293d30 tests: show cache of audited paths is never invalidated
Yuya Nishihara <yuya@tcha.org>
parents: 33607
diff changeset
  1117
  $ 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
  1118
  $ 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
  1119
  @  2: file a/poisoned
47ea28293d30 tests: show cache of audited paths is never invalidated
Yuya Nishihara <yuya@tcha.org>
parents: 33607
diff changeset
  1120
  |
47ea28293d30 tests: show cache of audited paths is never invalidated
Yuya Nishihara <yuya@tcha.org>
parents: 33607
diff changeset
  1121
  | 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
  1122
  |/
47ea28293d30 tests: show cache of audited paths is never invalidated
Yuya Nishihara <yuya@tcha.org>
parents: 33607
diff changeset
  1123
  o  0: base
47ea28293d30 tests: show cache of audited paths is never invalidated
Yuya Nishihara <yuya@tcha.org>
parents: 33607
diff changeset
  1124
  
47ea28293d30 tests: show cache of audited paths is never invalidated
Yuya Nishihara <yuya@tcha.org>
parents: 33607
diff changeset
  1125
47ea28293d30 tests: show cache of audited paths is never invalidated
Yuya Nishihara <yuya@tcha.org>
parents: 33607
diff changeset
  1126
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
  1127
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
  1128
47ea28293d30 tests: show cache of audited paths is never invalidated
Yuya Nishihara <yuya@tcha.org>
parents: 33607
diff changeset
  1129
  $ hg up -q null
33922
1a6707b43d05 tests: update test-commandserver to pass our import checker
Augie Fackler <raf@durin42.com>
parents: 33921
diff changeset
  1130
  >>> 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
  1131
  >>> @check
47ea28293d30 tests: show cache of audited paths is never invalidated
Yuya Nishihara <yuya@tcha.org>
parents: 33607
diff changeset
  1132
  ... def merge(server):
47ea28293d30 tests: show cache of audited paths is never invalidated
Yuya Nishihara <yuya@tcha.org>
parents: 33607
diff changeset
  1133
  ...     readchannel(server)
47ea28293d30 tests: show cache of audited paths is never invalidated
Yuya Nishihara <yuya@tcha.org>
parents: 33607
diff changeset
  1134
  ...     # audit a/poisoned as a good path
40354
f9f2faf25fc4 py3: byte-stringify most literals in test-commandserver.t
Yuya Nishihara <yuya@tcha.org>
parents: 39951
diff changeset
  1135
  ...     runcommand(server, [b'up', b'-qC', b'2'])
f9f2faf25fc4 py3: byte-stringify most literals in test-commandserver.t
Yuya Nishihara <yuya@tcha.org>
parents: 39951
diff changeset
  1136
  ...     runcommand(server, [b'up', b'-qC', b'1'])
33648
47ea28293d30 tests: show cache of audited paths is never invalidated
Yuya Nishihara <yuya@tcha.org>
parents: 33607
diff changeset
  1137
  ...     # here a is a symlink, so a/poisoned is bad
40354
f9f2faf25fc4 py3: byte-stringify most literals in test-commandserver.t
Yuya Nishihara <yuya@tcha.org>
parents: 39951
diff changeset
  1138
  ...     runcommand(server, [b'merge', b'2'])
33648
47ea28293d30 tests: show cache of audited paths is never invalidated
Yuya Nishihara <yuya@tcha.org>
parents: 33607
diff changeset
  1139
  *** runcommand up -qC 2
47ea28293d30 tests: show cache of audited paths is never invalidated
Yuya Nishihara <yuya@tcha.org>
parents: 33607
diff changeset
  1140
  *** runcommand up -qC 1
47ea28293d30 tests: show cache of audited paths is never invalidated
Yuya Nishihara <yuya@tcha.org>
parents: 33607
diff changeset
  1141
  *** runcommand merge 2
34942
2a774cae3a03 merge: disable path conflict checking by default (issue5716)
Siddharth Agarwal <sid0@fb.com>
parents: 34900
diff changeset
  1142
  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
  1143
   [255]
33648
47ea28293d30 tests: show cache of audited paths is never invalidated
Yuya Nishihara <yuya@tcha.org>
parents: 33607
diff changeset
  1144
  $ ls ../merge-symlink-out
47ea28293d30 tests: show cache of audited paths is never invalidated
Yuya Nishihara <yuya@tcha.org>
parents: 33607
diff changeset
  1145
47ea28293d30 tests: show cache of audited paths is never invalidated
Yuya Nishihara <yuya@tcha.org>
parents: 33607
diff changeset
  1146
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
  1147
symlinks:
47ea28293d30 tests: show cache of audited paths is never invalidated
Yuya Nishihara <yuya@tcha.org>
parents: 33607
diff changeset
  1148
47ea28293d30 tests: show cache of audited paths is never invalidated
Yuya Nishihara <yuya@tcha.org>
parents: 33607
diff changeset
  1149
  $ hg up -qC 0
47ea28293d30 tests: show cache of audited paths is never invalidated
Yuya Nishihara <yuya@tcha.org>
parents: 33607
diff changeset
  1150
  $ 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
  1151
  >>> 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
  1152
  >>> @check
47ea28293d30 tests: show cache of audited paths is never invalidated
Yuya Nishihara <yuya@tcha.org>
parents: 33607
diff changeset
  1153
  ... def files(server):
47ea28293d30 tests: show cache of audited paths is never invalidated
Yuya Nishihara <yuya@tcha.org>
parents: 33607
diff changeset
  1154
  ...     readchannel(server)
40354
f9f2faf25fc4 py3: byte-stringify most literals in test-commandserver.t
Yuya Nishihara <yuya@tcha.org>
parents: 39951
diff changeset
  1155
  ...     runcommand(server, [b'up', b'-qC', b'2'])
33648
47ea28293d30 tests: show cache of audited paths is never invalidated
Yuya Nishihara <yuya@tcha.org>
parents: 33607
diff changeset
  1156
  ...     # audit a/poisoned as a good path
40354
f9f2faf25fc4 py3: byte-stringify most literals in test-commandserver.t
Yuya Nishihara <yuya@tcha.org>
parents: 39951
diff changeset
  1157
  ...     runcommand(server, [b'files', b'a/poisoned'])
f9f2faf25fc4 py3: byte-stringify most literals in test-commandserver.t
Yuya Nishihara <yuya@tcha.org>
parents: 39951
diff changeset
  1158
  ...     runcommand(server, [b'up', b'-qC', b'0'])
f9f2faf25fc4 py3: byte-stringify most literals in test-commandserver.t
Yuya Nishihara <yuya@tcha.org>
parents: 39951
diff changeset
  1159
  ...     runcommand(server, [b'up', b'-qC', b'1'])
33648
47ea28293d30 tests: show cache of audited paths is never invalidated
Yuya Nishihara <yuya@tcha.org>
parents: 33607
diff changeset
  1160
  ...     # here 'a' is a symlink, so a/poisoned should be warned
40354
f9f2faf25fc4 py3: byte-stringify most literals in test-commandserver.t
Yuya Nishihara <yuya@tcha.org>
parents: 39951
diff changeset
  1161
  ...     runcommand(server, [b'files', b'a/poisoned'])
33648
47ea28293d30 tests: show cache of audited paths is never invalidated
Yuya Nishihara <yuya@tcha.org>
parents: 33607
diff changeset
  1162
  *** runcommand up -qC 2
47ea28293d30 tests: show cache of audited paths is never invalidated
Yuya Nishihara <yuya@tcha.org>
parents: 33607
diff changeset
  1163
  *** runcommand files a/poisoned
47ea28293d30 tests: show cache of audited paths is never invalidated
Yuya Nishihara <yuya@tcha.org>
parents: 33607
diff changeset
  1164
  a/poisoned
47ea28293d30 tests: show cache of audited paths is never invalidated
Yuya Nishihara <yuya@tcha.org>
parents: 33607
diff changeset
  1165
  *** runcommand up -qC 0
47ea28293d30 tests: show cache of audited paths is never invalidated
Yuya Nishihara <yuya@tcha.org>
parents: 33607
diff changeset
  1166
  *** runcommand up -qC 1
47ea28293d30 tests: show cache of audited paths is never invalidated
Yuya Nishihara <yuya@tcha.org>
parents: 33607
diff changeset
  1167
  *** runcommand files a/poisoned
33649
377e8ddaebef pathauditor: disable cache of audited paths by default (issue5628)
Yuya Nishihara <yuya@tcha.org>
parents: 33648
diff changeset
  1168
  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
  1169
   [255]
33648
47ea28293d30 tests: show cache of audited paths is never invalidated
Yuya Nishihara <yuya@tcha.org>
parents: 33607
diff changeset
  1170
47ea28293d30 tests: show cache of audited paths is never invalidated
Yuya Nishihara <yuya@tcha.org>
parents: 33607
diff changeset
  1171
  $ cd ..
47ea28293d30 tests: show cache of audited paths is never invalidated
Yuya Nishihara <yuya@tcha.org>
parents: 33607
diff changeset
  1172
47ea28293d30 tests: show cache of audited paths is never invalidated
Yuya Nishihara <yuya@tcha.org>
parents: 33607
diff changeset
  1173
#endif