pysh /

Filename Size Date modified Message
75 B
135 B
17.6 KB
5.0 KB
310 B
pysh - Mercurial test shell
Author: Patrick Mezard <>

Execute mercurial test shell scripts under WinNT platforms.

- Python 2.4 or higher.
- Cygwin utilities setup in LF-only mode, visible in PATH.
- PsKill from sysinternals. Could be replaced by anything killing Windows process from PID (see builtin.utility_kill).

Run installation script:

    python install
pysh.bat is copied in python/scripts. Move it somewhere in your PATH to allow
mercurial to call it.

0.4 - 2007-07-10
* Fix "if" keyword being used as a command argument.
* Add -c option to pass command string to pysh
* Upgrade to ply 2.2
* Fix strange sed issue with missing trailing whitespace.
* Add unit tests.
* Add colon utility

0.3 - 2007-05-01
* Fix many bugs related to shebangs and quoted fields parsing/expansion.

0.2 - 2007-02-21
* Support shebang mechanism, implemented for /usr/bin/env and /bin/sh.
* Add shift, env, kill (requires pskill), sort.
* Fix quote within quotes escaping.

Design Notes
* Implement whatever is necessary to run mercurial tests under Win32.

* Implement as specified by OpenGroup:

* Add whatever extension (shebang, ...) is necessary to run tests.

* All streams are handled internally in binary mode to generate the same output
  as unix systems and preserve mercurial signatures. This will probably hide
  Windows related bugs (CR-LF issues), and may change in the future.
* Lexing is done by basic hand-written state-machines. Test coverage is pretty
  good. Parsing is implemented via PLY (, an SLR
  parser generator. PLY modules are pretty old by now and might be replaced
  when a real pull mode is implemented (for interactive mode).
* The parsing modules were implemented to work on incremental inputs. However,
  they do not currently run in pull mode, mostly because it was unnecessary to
  run mercurial tests, and also because I understood too late how it needed to
  be done. Assuming that PLY can run in pull mode, there should not be any
  structural issues with the lexer. Sub-lexers were not thoroughly tests in
  incremental mode though.
* The grammar handles most mercurial tests. When using it in another context,
  be ready to encounter the following issues:
  - Asynchronous lists are not implemented. It is likely to be done in next
    releases since many mercurial tests rely on it.
  - Several constructs (until, case) are not implemented.
  - Using reserved words in basic token contexts (command arguments) may be
    unsupported. Several priority rules were added for specific words already.
* Cygwin utilities are (not very reliably, see detected since they
  already output in binary LF mode. CRLF to LF conversion is performed on other
  external utilities.
* Unit tests coverage is good for the lexer, medium on the parser and partial
  for the interpreter. The latter relies on mercurial tests which are a pretty
  good test in themselves.  
Mercurial Tests Coverage
* pysh/ is still used to run tests, it makes it easier to select tests
  to run since several still hang. With many win32 patches run-tests returns:
    # Ran 173 tests, 0 skipped, 23 failed.
* Failures comes from:
    'test-server',                          # standard stream cannot be redirected in daemon mode
    'test-issue352',                        # Cannot create files with newlines under win32.
    'test-hup',                             # mkfifo
    'test-clone-failure',                   # mkfifo
    'test-symlinks',                        # mkfifo
    'test-symlink-basic',                   # No symlink
    'test-symlink-root',                    # No symlink
    'test-git-import',                      # executable bit
    'test-rename',                          # lnk files are created (probably symlink related)
    'test-flags',                           # umask
    'test-archive',                         # problem with pipes under win32
    'test-git-export',                      # ignored permissions
    'test-oldcgi',                          # pysh redirection is broken (operation on closed file)
    'test-pull-pull-corruption2',           # Asynchronous list
    'test-clone-pull-corruption',           # Asynchronous list
    'test-bad-pull',                        # Asynchronous list
    'test-webraw',                          # Asynchronous list
    'test-static-http',                     # Asynchronous list
    'test-http-proxy',                      # Asynchronous list
    'test-pull-pull-corruption',            # Asynchronous list
  Unfortunately, these are usually the most complicated and most useful tests
  which fail. Some of them could be split to increase actual test coverage or 
  move things in OS specific tests.
Tip: Filter by directory path e.g. /media app.js to search for public/media/app.js.
Tip: Use camelCasing e.g. ProjME to search for
Tip: Filter by extension type e.g. /repo .js to search for all .js files in the /repo directory.
Tip: Separate your search with spaces e.g. /ssh pom.xml to search for src/ssh/pom.xml.
Tip: Use ↑ and ↓ arrow keys to navigate and return to view the file.
Tip: You can also navigate files with Ctrl+j (next) and Ctrl+k (previous) and view the file with Ctrl+o.
Tip: You can also navigate files with Alt+j (next) and Alt+k (previous) and view the file with Alt+o.