Mercurial > public > mercurial-scm > hg-stable
view hgweb.cgi @ 53017:3ac28aa1430e
rust-annotate: do not impl Sync for Lines
I failed to notice before that bdiff_diff mutates its inputs by storing
bookkeeping information in the `n` and `e` fields. This means &Lines can't be
shared across threads, so Lines cannot be Sync. Fortunately nothing was using
this. The parallel file reading and line splitting only relies on Send.
The reason I didn't notice this to begin with was that Lines contains a
*mut ffi::bdiffline, which is accessible from &Lines, so I never wrote or
thought about &mut Lines. This pattern (using a mutable pointer stored in an
immutable struct) would be expressed with RefCell if this was pure safe Rust.
author | Mitchell Kember <mkember@janestreet.com> |
---|---|
date | Mon, 24 Feb 2025 16:56:09 -0500 |
parents | d5cd1fd690f3 |
children |
line wrap: on
line source
#!/usr/bin/env python3 # # An example hgweb CGI script, edit as necessary # See also https://mercurial-scm.org/wiki/PublishingRepositories # Path to repo or hgweb config to serve (see 'hg help hgweb') config = b"/path/to/repo/or/config" # Uncomment and adjust if Mercurial is not installed system-wide # (consult "installed modules" path from 'hg debuginstall'): # import sys; sys.path.insert(0, "/path/to/python/lib") from mercurial import demandimport demandimport.enable() from mercurial.hgweb import hgweb, wsgicgi application = hgweb(config) wsgicgi.launch(application)