Skip to content
  • Gregory Szorc's avatar
    rust: implementation of `hg` · 964212780daf
    Gregory Szorc authored
    This commit provides a mostly-working implementation of the
    `hg` script in Rust along with scaffolding to support Rust in
    the repository.
    
    If you are familiar with Rust, the contents of the added rust/
    directory should be pretty straightforward. We create an "hgcli"
    package that implements a binary application to run Mercurial.
    The output of this package is an "hg" binary.
    
    Our Rust `hg` (henceforth "rhg") essentially is a port of the existing
    `hg` Python script. The main difference is the creation of the embedded
    CPython interpreter is handled by the binary itself instead of relying
    on the shebang. In that sense, rhg is more similar to the "exe wrapper"
    we currently use on Windows. However, unlike the exe wrapper, rhg does
    not call the `hg` Python script. Instead, it uses the CPython APIs to
    import mercurial modules and call appropriate functions. The amount of
    code here is surprisingly small.
    
    It is my intent to replace the existing C-based exe wrapper with rhg.
    Preferably i...
    964212780daf