D9405: packaging: add pygit2 to the py3 Windows installers
mharbison72 created this revision. Herald added a reviewer: hg-reviewers. Herald added a subscriber: mercurial-patches. REVISION SUMMARY This is needed to be able to use the git extension. A couple of issues here. First, the PyOxidizer target looks in the py2.txt file for requirements instead of py3. I first noticed this when it was still including the cryptography package, even though it had been dropped from py3. I dropped it from py2 in the previous commit, and then it stopped bundling it. I did a test build by generating py2.txt with `pip-compile` from py3. That bundled everything properly, but doing `hg log -r .` on a repo that works in WSL yielded a TypeError: ... File "mercurial.hg", line 188, in _peerorrepo File "mercurial.localrepo", line 3224, in instance File "mercurial.localrepo", line 623, in makelocalrepository File "hgext.git", line 117, in _makestore File "hgext.git", line 48, in __init__ TypeError: Repository unable to unpack backend. REPOSITORY rHG Mercurial BRANCH default REVISION DETAIL https://phab.mercurial-scm.org/D9405 AFFECTED FILES contrib/packaging/requirements-windows-py3.txt contrib/packaging/requirements-windows.txt.in CHANGE DETAILS diff --git a/contrib/packaging/requirements-windows.txt.in b/contrib/packaging/requirements-windows.txt.in --- a/contrib/packaging/requirements-windows.txt.in +++ b/contrib/packaging/requirements-windows.txt.in @@ -3,6 +3,7 @@ dulwich < 0.20 ; python_version <= '2.7' dulwich ; python_version >= '3' keyring +pygit2 ; python_version >= '3' pygments # Need to list explicitly so dependency gets pulled in when # not running on Windows. diff --git a/contrib/packaging/requirements-windows-py3.txt b/contrib/packaging/requirements-windows-py3.txt --- a/contrib/packaging/requirements-windows-py3.txt +++ b/contrib/packaging/requirements-windows-py3.txt @@ -4,10 +4,50 @@ # #pip-compile --generate-hashes --output-file=contrib/packaging/requirements-windows-py3.txt contrib/packaging/requirements-windows.txt.in # +cached-property==1.5.2 \ + --hash=sha256:9fa5755838eecbb2d234c3aa390bd80fbd3ac6b6869109bfc1b499f7bd89a130 \ + --hash=sha256:df4f613cf7ad9a588cc381aaf4a512d26265ecebd5eb9e1ba12f1319eb85a6a0 \ +# via pygit2 certifi==2020.6.20 \ --hash=sha256:5930595817496dd21bb8dc35dad090f1c2cd0adfaf21204bf6732ca5d8ee34d3 \ --hash=sha256:8fc0819f1f30ba15bdb34cceffb9ef04d99f420f68eb75d901e9560b8749fc41 \ # via dulwich +cffi==1.14.4 \ + --hash=sha256:00a1ba5e2e95684448de9b89888ccd02c98d512064b4cb987d48f4b40aa0421e \ + --hash=sha256:00e28066507bfc3fe865a31f325c8391a1ac2916219340f87dfad602c3e48e5d \ + --hash=sha256:045d792900a75e8b1e1b0ab6787dd733a8190ffcf80e8c8ceb2fb10a29ff238a \ + --hash=sha256:0638c3ae1a0edfb77c6765d487fee624d2b1ee1bdfeffc1f0b58c64d149e7eec \ + --hash=sha256:105abaf8a6075dc96c1fe5ae7aae073f4696f2905fde6aeada4c9d2926752362 \ + --hash=sha256:155136b51fd733fa94e1c2ea5211dcd4c8879869008fc811648f16541bf99668 \ + --hash=sha256:1a465cbe98a7fd391d47dce4b8f7e5b921e6cd805ef421d04f5f66ba8f06086c \ + --hash=sha256:1d2c4994f515e5b485fd6d3a73d05526aa0fcf248eb135996b088d25dfa1865b \ + --hash=sha256:2c24d61263f511551f740d1a065eb0212db1dd241db758f5244281590c06 \ + --hash=sha256:51a8b381b16ddd370178a65360ebe15fbc1c71cf6f584613a7ea08bfad946698 \ + --hash=sha256:594234691ac0e9b770aee9fcdb8fa02c22e43e5c619456efd0d6c2bf276f3eb2 \ + --hash=sha256:5cf4be6c304ad0b6602f5c4e90e2f59b47653ac1ed9c662ed379fe48a8f26b0c \ + --hash=sha256:64081b3f8f6f3c3de6191ec89d7dc6c86a8a43911f7ecb422c60e90c70be41c7 \ + --hash=sha256:6bc25fc545a6b3d57b5f8618e59fc13d3a3a68431e8ca5fd4c13241cd70d0009 \ + --hash=sha256:798caa2a2384b1cbe8a2a139d80734c9db54f9cc155c99d7cc92441a23871c03 \ + --hash=sha256:7c6b1dece89874d9541fc974917b631406233ea0440d0bdfbb8e03bf39a49b3b \ + --hash=sha256:840793c68105fe031f34d6a086eaea153a0cd5c491cde82a74b420edd0a2b909 \ + --hash=sha256:8d6603078baf4e11edc4168a514c5ce5b3ba6e3e9c374298cb88437957960a53 \ + --hash=sha256:9cc46bc107224ff5b6d04369e7c595acb700c3613ad7bcf2e2012f62ece80c35 \ + --hash=sha256:9f7a31251289b2ab6d4012f6e83e58bc3b96bd151f5b5262467f4bb6b34a7c26 \ + --hash=sha256:9ffb888f19d54a4d4dfd4b3f29bc2c16aa4972f1c2ab9c4ab09b8ab8685b9c2b \ + --hash=sha256:a7711edca4dcef1a75257b50a2fbfe92a65187c47dab5a0f1b9b332c5919a3fb \ + --hash=sha256:af5c59122a011049aad5dd87424b8e65a80e4a6477419c0c1015f73fb5ea0293 \ + --hash=sha256:b18e0a9ef57d2b41f5c68beefa32317d286c3d6ac0484efd10d6e07491bb95dd \ + --hash=sha256:b4e248d1087abf9f4c10f3c398896c87ce82a9856494a7155823eb45a892395d \ + --hash=sha256:ba4e9e0ae13fc41c6b23299545e5ef73055213e466bd107953e4a013a5ddd7e3 \ + --hash=sha256:c6332685306b6417a91b1ff9fae889b3ba65c2292d64bd9245c093b1b284809d \ + --hash=sha256:d9efd8b7a3ef378dd61a1e77367f1924375befc2eba06168b6ebfa903a5e59ca \ +
D9404: packaging: regenerate the Windows requirements manifest on Windows
mharbison72 created this revision. Herald added a reviewer: hg-reviewers. Herald added a subscriber: mercurial-patches. REVISION SUMMARY SecretStorage is a Linux package, and the other stuff removed is a dependency of it. I assume this was last generated on Linux, and noticed this trying to add another package and regenerating on Windows. REPOSITORY rHG Mercurial BRANCH default REVISION DETAIL https://phab.mercurial-scm.org/D9404 AFFECTED FILES contrib/packaging/requirements-windows-py2.txt contrib/packaging/requirements-windows-py3.txt CHANGE DETAILS diff --git a/contrib/packaging/requirements-windows-py3.txt b/contrib/packaging/requirements-windows-py3.txt --- a/contrib/packaging/requirements-windows-py3.txt +++ b/contrib/packaging/requirements-windows-py3.txt @@ -8,68 +8,6 @@ --hash=sha256:5930595817496dd21bb8dc35dad090f1c2cd0adfaf21204bf6732ca5d8ee34d3 \ --hash=sha256:8fc0819f1f30ba15bdb34cceffb9ef04d99f420f68eb75d901e9560b8749fc41 \ # via dulwich -cffi==1.14.3 \ - --hash=sha256:005f2bfe11b6745d726dbb07ace4d53f057de66e336ff92d61b8c7e9c8f4777d \ - --hash=sha256:09e96138280241bd355cd585148dec04dbbedb4f46128f340d696eaafc82dd7b \ - --hash=sha256:0b1ad452cc824665ddc682400b62c9e4f5b64736a2ba99110712fdee5f2505c4 \ - --hash=sha256:0ef488305fdce2580c8b2708f22d7785ae222d9825d3094ab073e22e93dfe51f \ - --hash=sha256:15f351bed09897fbda218e4db5a3d5c06328862f6198d4fb385f3e14e19decb3 \ - --hash=sha256:22399ff4870fb4c7ef19fff6eeb20a8bbf15571913c181c78cb361024d574579 \ - --hash=sha256:23e5d2040367322824605bc29ae8ee9175200b92cb5483ac7d466927a9b3d537 \ - --hash=sha256:2791f68edc5749024b4722500e86303a10d342527e1e3bcac47f35fbd25b764e \ - --hash=sha256:2f9674623ca39c9ebe38afa3da402e9326c245f0f5ceff0623dccdac15023e05 \ - --hash=sha256:3363e77a6176afb8823b6e06db78c46dbc4c7813b00a41300a4873b6ba63b171 \ - --hash=sha256:33c6cdc071ba5cd6d96769c8969a0531be2d08c2628a0143a10a7dcffa9719ca \ - --hash=sha256:3b8eaf915ddc0709779889c472e553f0d3e8b7bdf62dab764c8921b09bf94522 \ - --hash=sha256:3cb3e1b9ec43256c4e0f8d2837267a70b0e1ca8c4f456685508ae6106b1f504c \ - --hash=sha256:3eeeb0405fd145e714f7633a5173318bd88d8bbfc3dd0a5751f8c4f70ae629bc \ - --hash=sha256:44f60519595eaca110f248e5017363d751b12782a6f2bd6a7041cba275215f5d \ - --hash=sha256:4d7c26bfc1ea9f92084a1d75e11999e97b62d63128bcc90c3624d07813c52808 \ - --hash=sha256:529c4ed2e10437c205f38f3691a68be66c39197d01062618c55f74294a4a4828 \ - --hash=sha256:6642f15ad963b5092d65aed022d033c77763515fdc07095208f15d3563003869 \ - --hash=sha256:85ba797e1de5b48aa5a8427b6ba62cf69607c18c5d4eb747604b7302f1ec382d \ - --hash=sha256:8f0f1e499e4000c4c347a124fa6a27d37608ced4fe9f7d45070563b7c4c370c9 \ - --hash=sha256:a624fae282e81ad2e4871bdb767e2c914d0539708c0f078b5b355258293c98b0 \ - --hash=sha256:b0358e6fefc74a16f745afa366acc89f979040e0cbc4eec55ab26ad1f6a9bfbc \ - --hash=sha256:bbd2f4dfee1079f76943767fce837ade3087b578aeb9f69aec7857d5bf25db15 \ - --hash=sha256:bf39a9e19ce7298f1bd6a9758fa99707e9e5b1ebe5e90f2c3913a47bc548747c \ - --hash=sha256:c11579638288e53fc94ad60022ff1b67865363e730ee41ad5e6f0a17188b327a \ - --hash=sha256:c150eaa3dadbb2b5339675b88d4573c1be3cb6f2c33a6c83387e10cc0bf05bd3 \ - --hash=sha256:c53af463f4a40de78c58b8b2710ade243c81cbca641e34debf3396a9640d6ec1 \ - --hash=sha256:cb763ceceae04803adcc4e2d80d611ef201c73da32d8f2722e9d0ab0c7f10768 \ - --hash=sha256:cc75f58cdaf043fe6a7a6c04b3b5a0e694c6a9e24050967747251fb80d7bce0d \ - --hash=sha256:d80998ed59176e8cba74028762fbd9b9153b9afc71ea118e63bbf5d4d0f9552b \ - --hash=sha256:de31b5164d44ef4943db155b3e8e17929707cac1e5bd2f363e67a56e3af4af6e \ - --hash=sha256:e66399cf0fc07de4dce4f588fc25bfe84a6d1285cc544e67987d22663393926d \ - --hash=sha256:f0620511387790860b249b9241c2f13c3a80e21a73e0b861a2df24e9d6f56730 \ - --hash=sha256:f4eae045e6ab2bb54ca279733fe4eb85f1effda392666308250714e01907f394 \ - --hash=sha256:f92cdecb618e5fa4658aeb97d5eb3d2f47aa94ac6477c6daf0f306c5a3b9e6b1 \ - --hash=sha256:f92f789e4f9241cd262ad7a555ca2c648a98178a953af117ef7fad46aa1d5591 \ -# via cryptography -cryptography==3.1.1 \ - --hash=sha256:21b47c59fcb1c36f1113f3709d37935368e34815ea1d7073862e92f810dc7499 \ - --hash=sha256:451cdf60be4dafb6a3b78802006a020e6cd709c22d240f94f7a0696240a17154 \ - --hash=sha256:4549b137d8cbe3c2eadfa56c0c858b78acbeff956bd461e4b2164d9167c6 \ - --hash=sha256:48ee615a779ffa749d7d50c291761dc921d93d7cf203dca2db663b4f193f0e49 \ - --hash=sha256:559d622aef2a2dff98a892eef321433ba5bc55b2485220a8ca289c1ecc2bd54f \ - --hash=sha256:5d52c72449bb02dd45a773a203196e6d4fae34e158769c896012401f33064396 \ - --hash=sha256:65beb15e7f9c16e15934569d29fb4def74ea1469d8781f6b3507ab896d6d8719 \ - --hash=sha256:680da076cad81cdf5ffcac50c477b6790be81768d30f9da9e01960c4b18a66db \ - --hash=sha256:762bc5a0df03c51ee3f09c621e1cee64e3a079a2b5020de82f1613873d79ee70 \ -
D9403: git: update test for hg and git output changes
durin42 created this revision. Herald added a reviewer: hg-reviewers. Herald added a subscriber: mercurial-patches. REVISION SUMMARY Clearly nobody is running this in their CI. :( REPOSITORY rHG Mercurial BRANCH default REVISION DETAIL https://phab.mercurial-scm.org/D9403 AFFECTED FILES tests/test-git-interop.t CHANGE DETAILS diff --git a/tests/test-git-interop.t b/tests/test-git-interop.t --- a/tests/test-git-interop.t +++ b/tests/test-git-interop.t @@ -67,8 +67,8 @@ Without creating the .hg, hg status fails: $ hg status - abort: no repository found in '$TESTTMP/foo' (.hg not found)! - [255] + abort: no repository found in '$TESTTMP/foo' (.hg not found) + [10] But if you run hg init --git, it works: $ hg init --git $ hg id --traceback @@ -304,14 +304,10 @@ $ hg status heads mismatch, rebuilding dagcache M beta - $ git status + $ git status | egrep -v '^$|^ \(use ' On branch master Changes not staged for commit: -(use "git add ..." to update what will be committed) -(use "git checkout -- ..." to discard changes in working directory) - modified: beta - no changes added to commit (use "git add" and/or "git commit -a") Contents of each commit should be the same To: durin42, #hg-reviewers Cc: mercurial-patches, mercurial-devel ___ Mercurial-devel mailing list Mercurial-devel@mercurial-scm.org https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel
D9402: gitlog: add tiprev() function
durin42 created this revision. Herald added a reviewer: hg-reviewers. Herald added a subscriber: mercurial-patches. REVISION SUMMARY Lots of stuff was broken because this was missing. REPOSITORY rHG Mercurial BRANCH default REVISION DETAIL https://phab.mercurial-scm.org/D9402 AFFECTED FILES hgext/git/gitlog.py CHANGE DETAILS diff --git a/hgext/git/gitlog.py b/hgext/git/gitlog.py --- a/hgext/git/gitlog.py +++ b/hgext/git/gitlog.py @@ -148,6 +148,14 @@ ) return (int(r[0]) for r in t) +def tiprev(self): +t = self._db.execute( +'SELECT rev FROM changelog ' +'ORDER BY REV DESC ' +'LIMIT 1' +) +return next(t) + def _partialmatch(self, id): if nodemod.wdirhex.startswith(id): raise error.WdirUnsupported To: durin42, #hg-reviewers Cc: mercurial-patches, mercurial-devel ___ Mercurial-devel mailing list Mercurial-devel@mercurial-scm.org https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel
mercurial-devel | Pipeline #13300 has failed for branch/default | 15d4f524
Your pipeline has failed. Project: mercurial-devel ( https://foss.heptapod.net/octobus/mercurial-devel ) Branch: branch/default ( https://foss.heptapod.net/octobus/mercurial-devel/-/commits/branch/default ) Commit: 15d4f524 ( https://foss.heptapod.net/octobus/mercurial-devel/-/commit/15d4f52421821eeb790b57e71875e66cc1ed6cd5 ) Commit Message: errors: raise InputError on bad bookmark argume... Commit Author: Martin von Zweigbergk ( https://foss.heptapod.net/martinvonz ) Pipeline #13300 ( https://foss.heptapod.net/octobus/mercurial-devel/-/pipelines/13300 ) triggered by Pierre-Yves David ( https://foss.heptapod.net/marmoute ) had 2 failed builds. Job #124688 ( https://foss.heptapod.net/octobus/mercurial-devel/-/jobs/124688/raw ) Stage: test Name: test-py2-chg Job #124676 ( https://foss.heptapod.net/octobus/mercurial-devel/-/jobs/124676/raw ) Stage: test Name: checks-py2 -- You're receiving this email because of your account on foss.heptapod.net. ___ Mercurial-devel mailing list Mercurial-devel@mercurial-scm.org https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel
mercurial-devel | Pipeline #13274 has failed for branch/default | 9355cec3
Your pipeline has failed. Project: mercurial-devel ( https://foss.heptapod.net/octobus/mercurial-devel ) Branch: branch/default ( https://foss.heptapod.net/octobus/mercurial-devel/-/commits/branch/default ) Commit: 9355cec3 ( https://foss.heptapod.net/octobus/mercurial-devel/-/commit/9355cec390f86c30e771423c0d6a454886de1c65 ) Commit Message: tests: make test-worker.t pass on py2 I broke ... Commit Author: Martin von Zweigbergk ( https://foss.heptapod.net/martinvonz ) Pipeline #13274 ( https://foss.heptapod.net/octobus/mercurial-devel/-/pipelines/13274 ) triggered by Pierre-Yves David ( https://foss.heptapod.net/marmoute ) had 1 failed build. Job #124514 ( https://foss.heptapod.net/octobus/mercurial-devel/-/jobs/124514/raw ) Stage: test Name: test-py2-chg -- You're receiving this email because of your account on foss.heptapod.net. ___ Mercurial-devel mailing list Mercurial-devel@mercurial-scm.org https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel
D9401: pyoxidizer: make sure defaultrc directory exists before trying to write to it
durin42 created this revision. Herald added a reviewer: hg-reviewers. Herald added a subscriber: mercurial-patches. REVISION SUMMARY When doing some work involving one-file binaries, this line is failing for me. It seems reasonable to just make sure the destination directory exists before splatting the file into it. REPOSITORY rHG Mercurial BRANCH default REVISION DETAIL https://phab.mercurial-scm.org/D9401 AFFECTED FILES contrib/packaging/hgpackaging/pyoxidizer.py CHANGE DETAILS diff --git a/contrib/packaging/hgpackaging/pyoxidizer.py b/contrib/packaging/hgpackaging/pyoxidizer.py --- a/contrib/packaging/hgpackaging/pyoxidizer.py +++ b/contrib/packaging/hgpackaging/pyoxidizer.py @@ -127,6 +127,7 @@ # Write out a default editor.rc file to configure notepad as the # default editor. +os.makedirs(out_dir / "defaultrc") with (out_dir / "defaultrc" / "editor.rc").open( "w", encoding="utf-8" ) as fh: To: durin42, #hg-reviewers Cc: mercurial-patches, mercurial-devel ___ Mercurial-devel mailing list Mercurial-devel@mercurial-scm.org https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel
D9398: requirements: move loading to hg-core and add parsing
SimonSapin created this revision. Herald added a reviewer: hg-reviewers. Herald added a subscriber: mercurial-patches. REVISION SUMMARY No functional change, checking comes later. REPOSITORY rHG Mercurial BRANCH default REVISION DETAIL https://phab.mercurial-scm.org/D9398 AFFECTED FILES rust/hg-core/src/lib.rs rust/hg-core/src/requirements.rs rust/rhg/src/commands/debugrequirements.rs rust/rhg/src/error.rs CHANGE DETAILS diff --git a/rust/rhg/src/error.rs b/rust/rhg/src/error.rs --- a/rust/rhg/src/error.rs +++ b/rust/rhg/src/error.rs @@ -1,6 +1,7 @@ use crate::exitcode; use crate::ui::UiError; use hg::operations::{FindRootError, FindRootErrorKind}; +use hg::requirements::RequirementsError; use hg::utils::files::get_bytes_from_path; use std::convert::From; use std::path::PathBuf; @@ -12,9 +13,8 @@ RootNotFound(PathBuf), /// The current directory cannot be found CurrentDirNotFound(std::io::Error), -/// Error while reading or writing a file -// TODO: add the file name/path? -FileError(std::io::Error), +/// `.hg/requires` +RequirementsError(RequirementsError), /// The standard output stream cannot be written to StdoutError, /// The standard error stream cannot be written to @@ -30,7 +30,7 @@ match self { CommandErrorKind::RootNotFound(_) => exitcode::ABORT, CommandErrorKind::CurrentDirNotFound(_) => exitcode::ABORT, -CommandErrorKind::FileError(_) => exitcode::ABORT, +CommandErrorKind::RequirementsError(_) => exitcode::ABORT, CommandErrorKind::StdoutError => exitcode::ABORT, CommandErrorKind::StderrError => exitcode::ABORT, CommandErrorKind::Abort(_) => exitcode::ABORT, @@ -62,6 +62,11 @@ ] .concat(), ), +CommandErrorKind::RequirementsError( +RequirementsError::Corrupted, +) => Some( +"abort: .hg/requires is corrupted\n".as_bytes().to_owned(), +), CommandErrorKind::Abort(message) => message.to_owned(), _ => None, } @@ -115,3 +120,11 @@ } } } + +impl From for CommandError { +fn from(err: RequirementsError) -> Self { +CommandError { +kind: CommandErrorKind::RequirementsError(err), +} +} +} diff --git a/rust/rhg/src/commands/debugrequirements.rs b/rust/rhg/src/commands/debugrequirements.rs --- a/rust/rhg/src/commands/debugrequirements.rs +++ b/rust/rhg/src/commands/debugrequirements.rs @@ -1,7 +1,8 @@ use crate::commands::Command; -use crate::error::{CommandError, CommandErrorKind}; +use crate::error::CommandError; use crate::ui::Ui; use hg::operations::FindRoot; +use hg::requirements; pub const HELP_TEXT: = " Print the current repo requirements. @@ -18,23 +19,12 @@ impl Command for DebugRequirementsCommand { fn run(, ui: ) -> Result<(), CommandError> { let root = FindRoot::new().run()?; -let requires = root.join(".hg").join("requires"); -let requirements = match std::fs::read(requires) { -Ok(bytes) => bytes, - -// 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. -Err(error) if error.kind() == std::io::ErrorKind::NotFound => Vec::new(), - -Err(error) => Err(CommandErrorKind::FileError(error))?, -}; - -ui.write_stdout()?; +let mut output = String::new(); +for req in requirements::load()? { +output.push_str(); +output.push('\n'); +} +ui.write_stdout(output.as_bytes())?; Ok(()) } } diff --git a/rust/hg-core/src/requirements.rs b/rust/hg-core/src/requirements.rs new file mode 100644 --- /dev/null +++ b/rust/hg-core/src/requirements.rs @@ -0,0 +1,53 @@ +use std::io; +use std::path::Path; + +#[derive(Debug)] +pub enum RequirementsError { +// TODO: include a path? +Io(io::Error), +/// The `requires` file is corrupted +Corrupted, +/// The repository requires a feature that we don’t support +Unsupported { +feature: String, +}, +} + +fn parse(bytes: &[u8]) -> Result, ()> { +// 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 == b'\n'); + +lines +.filter(|line| !line.is_empty()) +.map(|line| { +// Python
D9397: rhg: add a `debugrequirements` subcommand
SimonSapin created this revision. Herald added a reviewer: hg-reviewers. Herald added a subscriber: mercurial-patches. REVISION SUMMARY For now it only prints the contents of `.hg/requires` as-is, without parsing. REPOSITORY rHG Mercurial BRANCH default REVISION DETAIL https://phab.mercurial-scm.org/D9397 AFFECTED FILES rust/rhg/src/commands.rs rust/rhg/src/commands/debugrequirements.rs rust/rhg/src/error.rs rust/rhg/src/main.rs tests/test-rhg.t CHANGE DETAILS diff --git a/tests/test-rhg.t b/tests/test-rhg.t --- a/tests/test-rhg.t +++ b/tests/test-rhg.t @@ -115,3 +115,12 @@ $ hg commit -m "add copy of original" $ rhg cat -r 1 copy_of_original original content + +Requirements + $ rhg debugrequirements + dotencode + fncache + generaldelta + revlogv1 + sparserevlog + store diff --git a/rust/rhg/src/main.rs b/rust/rhg/src/main.rs --- a/rust/rhg/src/main.rs +++ b/rust/rhg/src/main.rs @@ -83,6 +83,10 @@ .required(true) .value_name("REV"), ), +) +.subcommand( +SubCommand::with_name("debugrequirements") +.about(commands::debugrequirements::HELP_TEXT), ); let matches = app.clone().get_matches_safe().unwrap_or_else(|err| { @@ -124,6 +128,10 @@ ("debugdata", Some(matches)) => { commands::debugdata::DebugDataCommand::try_from(matches)?.run() } +("debugrequirements", _) => { +commands::debugrequirements::DebugRequirementsCommand::new() +.run() +} _ => unreachable!(), // Because of AppSettings::SubcommandRequired, } } diff --git a/rust/rhg/src/error.rs b/rust/rhg/src/error.rs --- a/rust/rhg/src/error.rs +++ b/rust/rhg/src/error.rs @@ -12,6 +12,9 @@ RootNotFound(PathBuf), /// The current directory cannot be found CurrentDirNotFound(std::io::Error), +/// Error while reading or writing a file +// TODO: add the file name/path? +FileError(std::io::Error), /// The standard output stream cannot be written to StdoutError, /// The standard error stream cannot be written to @@ -27,6 +30,7 @@ match self { CommandErrorKind::RootNotFound(_) => exitcode::ABORT, CommandErrorKind::CurrentDirNotFound(_) => exitcode::ABORT, +CommandErrorKind::FileError(_) => exitcode::ABORT, CommandErrorKind::StdoutError => exitcode::ABORT, CommandErrorKind::StderrError => exitcode::ABORT, CommandErrorKind::Abort(_) => exitcode::ABORT, diff --git a/rust/rhg/src/commands/debugrequirements.rs b/rust/rhg/src/commands/debugrequirements.rs new file mode 100644 --- /dev/null +++ b/rust/rhg/src/commands/debugrequirements.rs @@ -0,0 +1,40 @@ +use crate::commands::Command; +use crate::error::{CommandError, CommandErrorKind}; +use crate::ui::Ui; +use hg::operations::FindRoot; + +pub const HELP_TEXT: = " +Print the current repo requirements. +"; + +pub struct DebugRequirementsCommand {} + +impl DebugRequirementsCommand { +pub fn new() -> Self { +DebugRequirementsCommand {} +} +} + +impl Command for DebugRequirementsCommand { +fn run(, ui: ) -> Result<(), CommandError> { +let root = FindRoot::new().run()?; +let requires = root.join(".hg").join("requires"); +let requirements = match std::fs::read(requires) { +Ok(bytes) => bytes, + +// 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. +Err(error) if error.kind() == std::io::ErrorKind::NotFound => Vec::new(), + +Err(error) => Err(CommandErrorKind::FileError(error))?, +}; + +ui.write_stdout()?; +Ok(()) +} +} diff --git a/rust/rhg/src/commands.rs b/rust/rhg/src/commands.rs --- a/rust/rhg/src/commands.rs +++ b/rust/rhg/src/commands.rs @@ -1,5 +1,6 @@ pub mod cat; pub mod debugdata; +pub mod debugrequirements; pub mod files; pub mod root; use crate::error::CommandError; To: SimonSapin, #hg-reviewers Cc: mercurial-patches, mercurial-devel ___ Mercurial-devel mailing list Mercurial-devel@mercurial-scm.org https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel
D9400: rhg: check that .hg/requires is ASCII
SimonSapin created this revision. Herald added a reviewer: hg-reviewers. Herald added a subscriber: mercurial-patches. REPOSITORY rHG Mercurial BRANCH default REVISION DETAIL https://phab.mercurial-scm.org/D9400 AFFECTED FILES rust/hg-core/src/requirements.rs tests/test-rhg.t CHANGE DETAILS diff --git a/tests/test-rhg.t b/tests/test-rhg.t --- a/tests/test-rhg.t +++ b/tests/test-rhg.t @@ -140,3 +140,8 @@ sparserevlog store indoor-pool + + $ echo -e '\xFF' >> .hg/requires + $ rhg debugrequirements + abort: .hg/requires is corrupted + [255] diff --git a/rust/hg-core/src/requirements.rs b/rust/hg-core/src/requirements.rs --- a/rust/hg-core/src/requirements.rs +++ b/rust/hg-core/src/requirements.rs @@ -24,7 +24,7 @@ .map(|line| { // Python uses Unicode `str.isalnum` but feature names are all // ASCII -if line[0].is_ascii_alphanumeric() { +if line[0].is_ascii_alphanumeric() && line.is_ascii() { Ok(String::from_utf8(line.into()).unwrap()) } else { Err(()) To: SimonSapin, #hg-reviewers Cc: mercurial-patches, mercurial-devel ___ Mercurial-devel mailing list Mercurial-devel@mercurial-scm.org https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel
D9399: rhg: exit with relevant code for unsupported requirements
SimonSapin created this revision. Herald added a reviewer: hg-reviewers. Herald added a subscriber: mercurial-patches. REPOSITORY rHG Mercurial BRANCH default REVISION DETAIL https://phab.mercurial-scm.org/D9399 AFFECTED FILES rust/hg-core/src/requirements.rs rust/rhg/src/commands/cat.rs rust/rhg/src/commands/files.rs rust/rhg/src/error.rs tests/test-rhg.t CHANGE DETAILS diff --git a/tests/test-rhg.t b/tests/test-rhg.t --- a/tests/test-rhg.t +++ b/tests/test-rhg.t @@ -124,3 +124,19 @@ revlogv1 sparserevlog store + + $ echo indoor-pool >> .hg/requires + $ rhg files + [252] + + $ rhg cat -r 1 copy_of_original + [252] + + $ rhg debugrequirements + dotencode + fncache + generaldelta + revlogv1 + sparserevlog + store + indoor-pool diff --git a/rust/rhg/src/error.rs b/rust/rhg/src/error.rs --- a/rust/rhg/src/error.rs +++ b/rust/rhg/src/error.rs @@ -30,6 +30,9 @@ match self { CommandErrorKind::RootNotFound(_) => exitcode::ABORT, CommandErrorKind::CurrentDirNotFound(_) => exitcode::ABORT, +CommandErrorKind::RequirementsError( +RequirementsError::Unsupported { .. }, +) => exitcode::UNIMPLEMENTED_COMMAND, CommandErrorKind::RequirementsError(_) => exitcode::ABORT, CommandErrorKind::StdoutError => exitcode::ABORT, CommandErrorKind::StderrError => exitcode::ABORT, diff --git a/rust/rhg/src/commands/files.rs b/rust/rhg/src/commands/files.rs --- a/rust/rhg/src/commands/files.rs +++ b/rust/rhg/src/commands/files.rs @@ -11,6 +11,7 @@ ListRevTrackedFiles, ListRevTrackedFilesError, ListRevTrackedFilesErrorKind, }; +use hg::requirements; use hg::utils::files::{get_bytes_from_path, relativize_path}; use hg::utils::hg_path::{HgPath, HgPathBuf}; use std::path::PathBuf; @@ -57,6 +58,7 @@ impl<'a> Command for FilesCommand<'a> { fn run(, ui: ) -> Result<(), CommandError> { let root = FindRoot::new().run()?; +requirements::check()?; if let Some(rev) = self.rev { let mut operation = ListRevTrackedFiles::new(, rev) .map_err(|e| map_rev_error(rev, e))?; diff --git a/rust/rhg/src/commands/cat.rs b/rust/rhg/src/commands/cat.rs --- a/rust/rhg/src/commands/cat.rs +++ b/rust/rhg/src/commands/cat.rs @@ -4,6 +4,7 @@ use crate::ui::Ui; use hg::operations::FindRoot; use hg::operations::{CatRev, CatRevError, CatRevErrorKind}; +use hg::requirements; use hg::utils::hg_path::HgPathBuf; use micro_timer::timed; use std::convert::TryFrom; @@ -32,6 +33,7 @@ #[timed] fn run(, ui: ) -> Result<(), CommandError> { let root = FindRoot::new().run()?; +requirements::check()?; let cwd = std::env::current_dir() .or_else(|e| Err(CommandErrorKind::CurrentDirNotFound(e)))?; diff --git a/rust/hg-core/src/requirements.rs b/rust/hg-core/src/requirements.rs --- a/rust/hg-core/src/requirements.rs +++ b/rust/hg-core/src/requirements.rs @@ -51,3 +51,22 @@ Err(error) => Err(RequirementsError::Io(error))?, } } + +pub fn check(repo_root: ) -> Result<(), RequirementsError> { +for feature in load(repo_root)? { +if !SUPPORTED.contains(&&*feature) { +return Err(RequirementsError::Unsupported { feature }) +} +} +Ok(()) +} + +// TODO: set this to actually-supported features +const SUPPORTED: &[] = &[ +"dotencode", +"fncache", +"generaldelta", +"revlogv1", +"sparserevlog", +"store", +]; To: SimonSapin, #hg-reviewers Cc: mercurial-patches, mercurial-devel ___ Mercurial-devel mailing list Mercurial-devel@mercurial-scm.org https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel
mercurial@45878: 24 new changesets
24 new changesets in mercurial: https://www.mercurial-scm.org/repo/hg/rev/c10683da6889 changeset: 45855:c10683da6889 user:Martin von Zweigbergk date:Thu Nov 12 17:06:45 2020 -0800 summary: tests: show how `hg split` can put color codes in commit template https://www.mercurial-scm.org/repo/hg/rev/8357e0e81bb7 changeset: 45856:8357e0e81bb7 user:Martin von Zweigbergk date:Fri Nov 13 09:41:49 2020 -0800 summary: split: disable color while rendering template for use in commit message https://www.mercurial-scm.org/repo/hg/rev/ec6ba70be853 changeset: 45857:ec6ba70be853 user:Martin von Zweigbergk date:Mon Nov 16 10:30:06 2020 -0800 summary: tests: show how `hg histedit` can put color codes in histedit plan https://www.mercurial-scm.org/repo/hg/rev/62983988bbf5 changeset: 45858:62983988bbf5 user:Martin von Zweigbergk date:Mon Nov 16 10:30:53 2020 -0800 summary: histedit: disable color while rendering template for use in plan https://www.mercurial-scm.org/repo/hg/rev/781b09790633 changeset: 45859:781b09790633 user:Martin von Zweigbergk date:Mon Nov 16 22:38:36 2020 -0800 summary: tests: show that interactive shelve can leave the repo with a merge state https://www.mercurial-scm.org/repo/hg/rev/073bb7563931 changeset: 45860:073bb7563931 user:Martin von Zweigbergk date:Mon Nov 16 21:28:42 2020 -0800 summary: shelve: clear merge state after partial shelve https://www.mercurial-scm.org/repo/hg/rev/c9c3c277e5a5 changeset: 45861:c9c3c277e5a5 user:Raphaël Gomès date:Mon Nov 16 16:36:00 2020 +0100 summary: rust-status: properly translate OSError to Python https://www.mercurial-scm.org/repo/hg/rev/5c736ba5dc27 changeset: 45862:5c736ba5dc27 user:Raphaël Gomès date:Mon Nov 16 16:38:57 2020 +0100 summary: rust-status: don't bubble up os errors, translate them to bad matches https://www.mercurial-scm.org/repo/hg/rev/68aedad4c11c changeset: 45863:68aedad4c11c user:Gregory Szorc date:Sat Nov 07 16:45:58 2020 -0800 summary: pure: guard against empty blocks https://www.mercurial-scm.org/repo/hg/rev/11842aad3195 changeset: 45864:11842aad3195 user:Gregory Szorc date:Sat Nov 07 16:36:19 2020 -0800 summary: revlog: pass sidedata argument to flagutil.processflagswrite() https://www.mercurial-scm.org/repo/hg/rev/d7a508a75d72 changeset: 45865:d7a508a75d72 user:Valentin Gatien-Baron date:Sun Nov 08 16:23:35 2020 -0500 summary: strip: move into core https://www.mercurial-scm.org/repo/hg/rev/996cd73431a3 changeset: 45866:996cd73431a3 user:Martin von Zweigbergk date:Fri Oct 30 13:26:18 2020 -0700 summary: help: document the new [command-templates] config section https://www.mercurial-scm.org/repo/hg/rev/774b1c0f2507 changeset: 45867:774b1c0f2507 user:Martin von Zweigbergk date:Fri Oct 30 12:46:38 2020 -0700 summary: relnotes: document new [command-templates] section https://www.mercurial-scm.org/repo/hg/rev/f67741e8264b changeset: 45868:f67741e8264b user:Martin von Zweigbergk date:Thu Nov 12 14:07:34 2020 -0800 summary: templates: define a {onelinesummary} keyword https://www.mercurial-scm.org/repo/hg/rev/63edc384d3b7 changeset: 45869:63edc384d3b7 user:Joerg Sonnenberger date:Sat Nov 07 17:56:01 2020 +0100 summary: transaction: drop per-file extra data support https://www.mercurial-scm.org/repo/hg/rev/a6f08085edfe changeset: 45870:a6f08085edfe user:Joerg Sonnenberger date:Sat Nov 07 19:24:12 2020 +0100 summary: transaction: rename find to findoffset and drop backup file support https://www.mercurial-scm.org/repo/hg/rev/a985c4fb23ca changeset: 45871:a985c4fb23ca user:Joerg Sonnenberger date:Sat Nov 07 21:34:09 2020 +0100 summary: transaction: change list of journal entries into a dictionary https://www.mercurial-scm.org/repo/hg/rev/ec73a6a75985 changeset: 45872:ec73a6a75985 user:Joerg Sonnenberger date:Sat Nov 07 22:31:29 2020 +0100 summary: transaction: split new files into a separate set https://www.mercurial-scm.org/repo/hg/rev/c8860a212770 changeset: 45873:c8860a212770 user:Martin von Zweigbergk date:Mon Nov 16 16:25:04 2020 -0800 summary: errors: raise InputError when line range to followlines() is out of bounds https://www.mercurial-scm.org/repo/hg/rev/1a72e4839795 changeset: 45874:1a72e4839795 user:Martin von Zweigbergk date:Tue Nov 17 15:37:18 2020 -0800 summary: errors: raise InputError in `hg debugobsolete` https://www.mercurial-scm.org/repo/hg/rev/e641bb2a6159 changeset: 45875:e641bb2a6159 user:Martin von Zweigbergk date:Tue Nov 17 15:42:42 2020 -0800 summary: errors: raise StateError in `hg bisect`