##// END OF EJS Templates
ci: add a runner for Windows 10...
ci: add a runner for Windows 10 This is currently only manually invoked, and allows for failure because we only have a single runner that takes over 2h for a full run, and there are a handful of flakey tests, plus 3 known failing tests. The system being used here is running MSYS, Python, Visual Studio, etc, as installed by `install-windows-dependencies.ps1`. This script installs everything to a specific directory instead of using the defaults, so we adjust the MinGW shell path to compensate. Additionally, the script doesn't install the launcher `py.exe`. It is possible to adjust the script to install it, but it's an option to an existing python install (instead of a standalone installer), and I've had the whole python install fail and rollback when requested to install the launcher if it detects a newer one is already installed. In short, it is a point of failure for a feature we don't (yet?) need. Unlike other systems where the intepreter name includes the version, everything here is `python.exe`, so they can't all exist on `PATH` and let the script choose the desired one. (The `py.exe` launcher would accomplish, using the registry instead of `PATH`, but that wouldn't allow for venv installs.) Because of this, switch to the absolute path of the python interpreter to be used (in this case a venv created from the py39 install, which is old, but what both pyoxidizer and TortoiseHg currently use). The `RUNTEST_ARGS` hardcodes `-j8` because this system has 4 cores, and therefore runs 4 parallel tests by default. However on Windows, using more parallel tests than cores results in better performance for whatever reason. I don't have an optimal value yet (ideally the runner itself can make the adjustment on Windows), but this results in saving ~15m on a full run that otherwise takes ~2.5h. I'm also not concerned about how it would affect other Windows machines, because we don't have any at this point, and I have no idea when we can get more. As far as system setup goes, the CI is run by a dedicated user that lacks admin rights. The install script was run by an admin user, and then the standard user was configured to use it. If I set this up again, I'd probably give the dedicated user admin rights to run the install script, and reset to standard user rights when done. The python intepreter failed in weird ways when run by the standard user until it was manually reinstalled by the standard user: Fatal Python error: init_fs_encoding: failed to get the Python codec of the filesystem encoding Additionally, changing the environment through the Windows UI prompts to escalate to an admin user, and then setting the user level environment variables like `TEMP` and `PATH` (to try to avoid exceeding the 260 character path limit) didn't actually change the user's environment. (Likely it changed the admin user's environment, but I didn't confirm that.) I ended up having to use the registry editor for the standard user to make those changes.

File last commit:

r52761:db7dbe6f default
r53049:8766d47e stable
Show More
requirements.rs
185 lines | 6.7 KiB | application/rls-services+xml | RustLexer
use crate::errors::{HgError, HgResultExt};
use crate::repo::Repo;
use crate::utils::join_display;
use crate::vfs::VfsImpl;
use std::collections::HashSet;
fn parse(bytes: &[u8]) -> Result<HashSet<String>, HgError> {
// The Python code reading this file uses `str.splitlines`
// which looks for a number of line separators (even including a couple of
// non-ASCII ones), but Python code writing it always uses `\n`.
let lines = bytes.split(|&byte| byte == b'\n');
lines
.filter(|line| !line.is_empty())
.map(|line| {
// Python uses Unicode `str.isalnum` but feature names are all
// ASCII
if line[0].is_ascii_alphanumeric() && line.is_ascii() {
Ok(String::from_utf8(line.into()).unwrap())
} else {
Err(HgError::corrupted("parse error in 'requires' file"))
}
})
.collect()
}
pub(crate) fn load(hg_vfs: VfsImpl) -> Result<HashSet<String>, HgError> {
parse(&hg_vfs.read("requires")?)
}
pub(crate) fn load_if_exists(
hg_vfs: &VfsImpl,
) -> Result<HashSet<String>, HgError> {
if let Some(bytes) = hg_vfs.read("requires").io_not_found_as_none()? {
parse(&bytes)
} else {
// Treat a missing file the same as an empty file.
// From `mercurial/localrepo.py`:
// > requires file contains a newline-delimited list of
// > features/capabilities the opener (us) must have in order to use
// > the repository. This file was introduced in Mercurial 0.9.2,
// > which means very old repositories may not have one. We assume
// > a missing file translates to no requirements.
Ok(HashSet::new())
}
}
pub(crate) fn check(repo: &Repo) -> Result<(), HgError> {
let unknown: Vec<_> = repo
.requirements()
.iter()
.map(String::as_str)
// .filter(|feature| !ALL_SUPPORTED.contains(feature.as_str()))
.filter(|feature| {
!REQUIRED.contains(feature) && !SUPPORTED.contains(feature)
})
.collect();
if !unknown.is_empty() {
return Err(HgError::unsupported(format!(
"repository requires feature unknown to this Mercurial: {}",
join_display(&unknown, ", ")
)));
}
let missing: Vec<_> = REQUIRED
.iter()
.filter(|&&feature| !repo.requirements().contains(feature))
.collect();
if !missing.is_empty() {
return Err(HgError::unsupported(format!(
"repository is missing feature required by this Mercurial: {}",
join_display(&missing, ", ")
)));
}
Ok(())
}
/// rhg does not support repositories that are *missing* any of these features
const REQUIRED: &[&str] = &["revlogv1", "store", "fncache", "dotencode"];
/// rhg supports repository with or without these
const SUPPORTED: &[&str] = &[
GENERALDELTA_REQUIREMENT,
SHARED_REQUIREMENT,
SHARESAFE_REQUIREMENT,
SPARSEREVLOG_REQUIREMENT,
RELATIVE_SHARED_REQUIREMENT,
REVLOG_COMPRESSION_ZSTD,
DIRSTATE_V2_REQUIREMENT,
DIRSTATE_TRACKED_HINT_V1,
// As of this writing everything rhg does is read-only.
// When it starts writing to the repository, it’ll need to either keep the
// persistent nodemap up to date or remove this entry:
NODEMAP_REQUIREMENT,
// Not all commands support `sparse` and `narrow`. The commands that do
// not should opt out by checking `has_sparse` and `has_narrow`.
SPARSE_REQUIREMENT,
NARROW_REQUIREMENT,
// rhg doesn't care about bookmarks at all yet
BOOKMARKS_IN_STORE_REQUIREMENT,
];
// Copied from mercurial/requirements.py:
pub const DIRSTATE_V2_REQUIREMENT: &str = "dirstate-v2";
pub const GENERALDELTA_REQUIREMENT: &str = "generaldelta";
/// A repository that uses the tracked hint dirstate file
#[allow(unused)]
pub const DIRSTATE_TRACKED_HINT_V1: &str = "dirstate-tracked-key-v1";
/// When narrowing is finalized and no longer subject to format changes,
/// we should move this to just "narrow" or similar.
#[allow(unused)]
pub const NARROW_REQUIREMENT: &str = "narrowhg-experimental";
/// Bookmarks must be stored in the `store` part of the repository and will be
/// share accross shares
#[allow(unused)]
pub const BOOKMARKS_IN_STORE_REQUIREMENT: &str = "bookmarksinstore";
/// Enables sparse working directory usage
#[allow(unused)]
pub const SPARSE_REQUIREMENT: &str = "exp-sparse";
/// Enables the internal phase which is used to hide changesets instead
/// of stripping them
#[allow(unused)]
pub const INTERNAL_PHASE_REQUIREMENT: &str = "internal-phase";
/// Stores manifest in Tree structure
#[allow(unused)]
pub const TREEMANIFEST_REQUIREMENT: &str = "treemanifest";
/// Whether to use the "RevlogNG" or V1 of the revlog format
#[allow(unused)]
pub const REVLOGV1_REQUIREMENT: &str = "revlogv1";
/// Increment the sub-version when the revlog v2 format changes to lock out old
/// clients.
#[allow(unused)]
pub const REVLOGV2_REQUIREMENT: &str = "exp-revlogv2.1";
/// Increment the sub-version when the revlog v2 format changes to lock out old
/// clients.
#[allow(unused)]
pub const CHANGELOGV2_REQUIREMENT: &str = "exp-changelog-v2";
/// A repository with the sparserevlog feature will have delta chains that
/// can spread over a larger span. Sparse reading cuts these large spans into
/// pieces, so that each piece isn't too big.
/// Without the sparserevlog capability, reading from the repository could use
/// huge amounts of memory, because the whole span would be read at once,
/// including all the intermediate revisions that aren't pertinent for the
/// chain. This is why once a repository has enabled sparse-read, it becomes
/// required.
#[allow(unused)]
pub const SPARSEREVLOG_REQUIREMENT: &str = "sparserevlog";
/// A repository with the the copies-sidedata-changeset requirement will store
/// copies related information in changeset's sidedata.
#[allow(unused)]
pub const COPIESSDC_REQUIREMENT: &str = "exp-copies-sidedata-changeset";
/// The repository use persistent nodemap for the changelog and the manifest.
#[allow(unused)]
pub const NODEMAP_REQUIREMENT: &str = "persistent-nodemap";
/// Denotes that the current repository is a share
#[allow(unused)]
pub const SHARED_REQUIREMENT: &str = "shared";
/// Denotes that current repository is a share and the shared source path is
/// relative to the current repository root path
#[allow(unused)]
pub const RELATIVE_SHARED_REQUIREMENT: &str = "relshared";
/// A repository with share implemented safely. The repository has different
/// store and working copy requirements i.e. both `.hg/requires` and
/// `.hg/store/requires` are present.
#[allow(unused)]
pub const SHARESAFE_REQUIREMENT: &str = "share-safe";
/// A repository that use zstd compression inside its revlog
#[allow(unused)]
pub const REVLOG_COMPRESSION_ZSTD: &str = "revlog-compression-zstd";