[Bug 6677] New: How to fix Cash App Transfer failed issue?

2022-04-12 Thread mercurial-bugs
https://bz.mercurial-scm.org/show_bug.cgi?id=6677

Bug ID: 6677
   Summary: How to fix Cash App Transfer failed issue?
   Product: Mercurial
   Version: 5.9.3
  Hardware: PC
OS: Windows
Status: UNCONFIRMED
  Severity: bug
  Priority: wish
 Component: bugzilla
  Assignee: bugzi...@mercurial-scm.org
  Reporter: starkharry...@gmail.com
CC: mercurial-devel@mercurial-scm.org
Python Version: ---

Created attachment 2138
  --> https://bz.mercurial-scm.org/attachment.cgi?id=2138=edit
How to fix Cash App Transfer failed issue?

Most often, hassles in sending the money through cash app lead to unexpected
problems cash app users are coming up with Cash App Transfer Failed concerns.
They can talk to the support team for a solution and to identify the reason.
However, several aspects include the management of the cash app account.
Problems with the cash app arise due to issues with internet connectivity as
well. Hence users should check out their network also.
https://www.emailsupport-contact.com/blog/cash-app-transfer-failed/

-- 
You are receiving this mail because:
You are on the CC list for the bug.
___
Mercurial-devel mailing list
Mercurial-devel@mercurial-scm.org
https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel


[Bug 6676] New: What Should I Do To Opt For An Instant Can I talk to a live person at Facebook??

2022-04-12 Thread mercurial-bugs
https://bz.mercurial-scm.org/show_bug.cgi?id=6676

Bug ID: 6676
   Summary: What Should I Do To Opt For An Instant Can I talk to a
live person at Facebook??
   Product: Mercurial
   Version: default branch
  Hardware: PC
OS: Windows
Status: UNCONFIRMED
  Severity: feature
  Priority: wish
 Component: blackbox
  Assignee: bugzi...@mercurial-scm.org
  Reporter: bannyscort1...@gmail.com
CC: mercurial-devel@mercurial-scm.org
Python Version: ---

Are you looking forward to getting instant Can I talk to a live person at
Facebook?to handle your problematic Facebook account? To do the same, you can
make a call at the helpline number which will assist you out to have a word
with the Facebook specialists who will let you know the right troubleshooting
support.
https://www.primotechy.com/blog/how-do-i-talk-to-a-live-person-at-facebook/

-- 
You are receiving this mail because:
You are on the CC list for the bug.
___
Mercurial-devel mailing list
Mercurial-devel@mercurial-scm.org
https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel


D12543: rhg: refactor to pass argv down, instead of caling args_os()

2022-04-12 Thread aalekseyev (Arseniy Alekseyev)
aalekseyev created this revision.
Herald added a reviewer: hg-reviewers.
Herald added a subscriber: mercurial-patches.

REVISION SUMMARY
  This refactoring makes it easy to patch some command-line preprocessing into 
rhg.
  We use this to support using rhg as a shebang interpreter, for example.

REPOSITORY
  rHG Mercurial

BRANCH
  default

REVISION DETAIL
  https://phab.mercurial-scm.org/D12543

AFFECTED FILES
  rust/rhg/src/blackbox.rs
  rust/rhg/src/main.rs

CHANGE DETAILS

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
@@ -25,6 +25,7 @@
 }
 
 fn main_with_result(
+argv: Vec,
 process_start_time: ::ProcessStartTime,
 ui: ::Ui,
 repo: Result<, >,
@@ -78,7 +79,7 @@
 .version("0.0.1");
 let app = add_subcommand_args(app);
 
-let matches = app.clone().get_matches_safe()?;
+let matches = app.clone().get_matches_from_safe(argv.iter())?;
 
 let (subcommand_name, subcommand_matches) = matches.subcommand();
 
@@ -123,9 +124,9 @@
 if config.is_extension_enabled(b"blackbox") {
 let blackbox =
 blackbox::Blackbox::new(, process_start_time)?;
-blackbox.log_command_start();
+blackbox.log_command_start(argv.iter());
 let result = run();
-blackbox.log_command_end(exit_code(
+blackbox.log_command_end(argv.iter(), exit_code(
 ,
 // TODO: show a warning or combine with original error if
 // `get_bool` returns an error
@@ -139,7 +140,7 @@
 }
 }
 
-fn main() {
+fn rhg_main(argv: Vec) -> ! {
 // Run this first, before we find out if the blackbox extension is even
 // enabled, in order to include everything in-between in the duration
 // measurements. Reading config files can be slow if they’re on NFS.
@@ -147,7 +148,7 @@
 
 env_logger::init();
 
-let early_args = EarlyArgs::parse(std::env::args_os());
+let early_args = EarlyArgs::parse();
 
 let initial_current_dir = early_args.cwd.map(|cwd| {
 let cwd = get_path_from_bytes();
@@ -158,6 +159,7 @@
 })
 .unwrap_or_else(|error| {
 exit(
+,
 ,
 ::new_infallible(::empty()),
 OnUnsupported::Abort,
@@ -179,6 +181,7 @@
 let on_unsupported = OnUnsupported::Abort;
 
 exit(
+,
 _current_dir,
 ::new_infallible(::empty()),
 on_unsupported,
@@ -191,6 +194,7 @@
 .load_cli_args(early_args.config, early_args.color)
 .unwrap_or_else(|error| {
 exit(
+,
 _current_dir,
 ::new_infallible(_repo_config),
 OnUnsupported::from_config(_repo_config),
@@ -209,6 +213,7 @@
 }
 if SCHEME_RE.is_match(_path_bytes) {
 exit(
+,
 _current_dir,
 ::new_infallible(_repo_config),
 OnUnsupported::from_config(_repo_config),
@@ -299,6 +304,7 @@
 Err(NoRepoInCwdError { cwd: at })
 }
 Err(error) => exit(
+,
 _current_dir,
 ::new_infallible(_repo_config),
 OnUnsupported::from_config(_repo_config),
@@ -318,6 +324,7 @@
 };
 let ui = Ui::new().unwrap_or_else(|error| {
 exit(
+,
 _current_dir,
 ::new_infallible(),
 OnUnsupported::from_config(),
@@ -330,12 +337,14 @@
 let on_unsupported = OnUnsupported::from_config(config);
 
 let result = main_with_result(
+argv.iter().map(|s| s.to_owned()).collect(),
 _start_time,
 ,
 repo_result.as_ref(),
 config,
 );
 exit(
+,
 _current_dir,
 ,
 on_unsupported,
@@ -348,6 +357,10 @@
 )
 }
 
+fn main() -> ! {
+rhg_main(std::env::args_os().collect())
+}
+
 fn exit_code(
 result: <(), CommandError>,
 use_detailed_exit_code: bool,
@@ -374,7 +387,8 @@
 }
 }
 
-fn exit(
+fn exit<'b>(
+original_args: &'b [OsString],
 initial_current_dir: ,
 ui: ,
 mut on_unsupported: OnUnsupported,
@@ -386,7 +400,7 @@
 Err(CommandError::UnsupportedFeature { message }),
 ) = (_unsupported, )
 {
-let mut args = std::env::args_os();
+let mut args = original_args.iter();
 let executable = match executable {
 None => {
 exit_no_fallback(
@@ -546,7 +560,7 @@
 }
 
 impl EarlyArgs {
-fn parse(args: impl IntoIterator) -> Self {
+fn parse<'a>(args: impl IntoIterator) -> Self {
 let mut args = args.into_iter().map(get_bytes_from_os_str);
 let mut config = Vec::new();
 let mut color = None;
diff --git a/rust/rhg/src/blackbox.rs b/rust/rhg/src/blackbox.rs
--- a/rust/rhg/src/blackbox.rs
+++ b/rust/rhg/src/blackbox.rs
@@ -5,6 +5,7 @@
 use 

D12542: narrow: support debugupgraderepo

2022-04-12 Thread aalekseyev (Arseniy Alekseyev)
aalekseyev created this revision.
Herald added a reviewer: durin42.
Herald added a reviewer: hg-reviewers.
Herald added a subscriber: mercurial-patches.

REPOSITORY
  rHG Mercurial

BRANCH
  default

REVISION DETAIL
  https://phab.mercurial-scm.org/D12542

AFFECTED FILES
  mercurial/upgrade_utils/actions.py
  tests/test-narrow.t

CHANGE DETAILS

diff --git a/tests/test-narrow.t b/tests/test-narrow.t
--- a/tests/test-narrow.t
+++ b/tests/test-narrow.t
@@ -71,6 +71,17 @@
   updating to branch default
   0 files updated, 0 files merged, 0 files removed, 0 files unresolved
 
+The "narrow" repo requirement is ignored by [debugupgraderepo]
+
+#if tree
+  $ (cd should-work; hg debugupgraderepo)
+  abort: cannot upgrade repository; unsupported source requirement: 
treemanifest
+  [255]
+#else
+  $ (cd should-work; hg debugupgraderepo | grep 'no format upgrades found in 
existing repository')
+  (no format upgrades found in existing repository)
+#endif
+
 Test repo with local changes
   $ hg clone --narrow ssh://user@dummy/master narrow-local-changes --include 
d0 --include d3 --include d6
   requesting all changes
diff --git a/mercurial/upgrade_utils/actions.py 
b/mercurial/upgrade_utils/actions.py
--- a/mercurial/upgrade_utils/actions.py
+++ b/mercurial/upgrade_utils/actions.py
@@ -33,10 +33,16 @@
 requirements.CHANGELOGV2_REQUIREMENT,
 }
 
-
 def preservedrequirements(repo):
 preserved = {
 requirements.SHARED_REQUIREMENT,
+# Blindly skipping the narrow requirement may not be correct in 
general,
+# for example if there are some upgrades that would replay the commits,
+# instead of doing a per-revlog rewrite.
+#
+# This is not a big deal for us, because
+# for rewrites like that we'll want to re-clone the repo, anyway.
+requirements.NARROW_REQUIREMENT,
 }
 return preserved & repo.requirements
 
@@ -1004,7 +1010,7 @@
 def supporteddestrequirements(repo):
 """Obtain requirements that upgrade supports in the destination.
 
-If the result of the upgrade would create requirements not in this set,
+If the result of the upgrade would have requirements not in this set,
 the upgrade is disallowed.
 
 Extensions should monkeypatch this to add their custom requirements.
@@ -1024,6 +1030,7 @@
 requirements.SHARESAFE_REQUIREMENT,
 requirements.SPARSEREVLOG_REQUIREMENT,
 requirements.STORE_REQUIREMENT,
+requirements.NARROW_REQUIREMENT,
 }
 for name in compression.compengines:
 engine = compression.compengines[name]



To: aalekseyev, 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@49058: 13 new changesets (5 on stable)

2022-04-12 Thread Mercurial Commits
13 new changesets (5 on stable) in mercurial:

https://www.mercurial-scm.org/repo/hg/rev/dd384ad01d88
changeset:   49046:dd384ad01d88
branch:  stable
parent:  49008:dd98bd0b6501
user:Pierre-Yves David 
date:Wed Apr 06 18:44:21 2022 +0200
summary: tests-racy-mutation: pass the editor through config instead of env 
variable

https://www.mercurial-scm.org/repo/hg/rev/c827bb7b5806
changeset:   49047:c827bb7b5806
branch:  stable
user:Pierre-Yves David 
date:Wed Apr 06 18:50:20 2022 +0200
summary: run-tests: introduce "forward-slash" version of everything on 
windows

https://www.mercurial-scm.org/repo/hg/rev/020378f32d57
changeset:   49048:020378f32d57
branch:  stable
user:Pierre-Yves David 
date:Wed Apr 06 18:39:15 2022 +0200
summary: debuglock: ignore ENOENT error when unlocking

https://www.mercurial-scm.org/repo/hg/rev/e31bba4c1be3
changeset:   49049:e31bba4c1be3
branch:  stable
user:Pierre-Yves David 
date:Thu Apr 07 15:46:07 2022 +0200
summary: help: clarify the unit of `ui.large-file-limit` config

https://www.mercurial-scm.org/repo/hg/rev/8653a2a33736
changeset:   49050:8653a2a33736
branch:  stable
user:Pierre-Yves David 
date:Thu Apr 07 15:53:48 2022 +0200
summary: help: set the large-file-limit to 10MB

https://www.mercurial-scm.org/repo/hg/rev/1d6c6ad645e1
changeset:   49051:1d6c6ad645e1
parent:  49045:a85c123c625a
user:Julien Cristau 
date:Mon Dec 02 14:45:00 2019 +0100
summary: mail: don't complain about a multi-word email.method

https://www.mercurial-scm.org/repo/hg/rev/34cdad07d06d
changeset:   49052:34cdad07d06d
user:Julien Cristau 
date:Mon Apr 11 11:14:55 2022 +0200
summary: test: deal with changed error message on python 3.10

https://www.mercurial-scm.org/repo/hg/rev/7d1daa1ef286
changeset:   49053:7d1daa1ef286
user:Julien Cristau 
date:Wed Apr 06 22:29:49 2022 +0200
summary: zeroconf: fix deprecation warning with python 3.10

https://www.mercurial-scm.org/repo/hg/rev/5144d3579a9c
changeset:   49054:5144d3579a9c
user:Julien Cristau 
date:Sat Apr 09 14:15:32 2022 +0200
summary: sslutil: avoid deprecation warnings from python 3.10's ssl module

https://www.mercurial-scm.org/repo/hg/rev/50bd2910d162
changeset:   49055:50bd2910d162
user:Julien Cristau 
date:Sat Apr 09 14:23:52 2022 +0200
summary: sslutil: be less strict about which ciphers are allowed when using 
--insecure

https://www.mercurial-scm.org/repo/hg/rev/7ea2bd2043d1
changeset:   49056:7ea2bd2043d1
user:Julien Cristau 
date:Sat Apr 09 14:28:17 2022 +0200
summary: test: override default cipher selection when connecting to TLS 
1.0/1.1 servers

https://www.mercurial-scm.org/repo/hg/rev/27ef2aa953dd
changeset:   49057:27ef2aa953dd
user:Julien Cristau 
date:Sat Apr 09 14:41:55 2022 +0200
summary: sslutil: support TLSV1_ALERT_PROTOCOL_VERSION reason code

https://www.mercurial-scm.org/repo/hg/rev/d8a38186a092
changeset:   49058:d8a38186a092
bookmark:@
tag: tip
user:Julien Cristau 
date:Sat Apr 09 14:43:30 2022 +0200
summary: test: accept another error message on lack of TLS client 
certificate

-- 
Repository URL: https://www.mercurial-scm.org/repo/hg
___
Mercurial-devel mailing list
Mercurial-devel@mercurial-scm.org
https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel


D12541: rust-dirstatemap: remove unused helper from the old API

2022-04-12 Thread Raphaël Gomès
Alphare 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/D12541

AFFECTED FILES
  rust/hg-core/src/dirstate_tree/dirstate_map.rs

CHANGE DETAILS

diff --git a/rust/hg-core/src/dirstate_tree/dirstate_map.rs 
b/rust/hg-core/src/dirstate_tree/dirstate_map.rs
--- a/rust/hg-core/src/dirstate_tree/dirstate_map.rs
+++ b/rust/hg-core/src/dirstate_tree/dirstate_map.rs
@@ -22,7 +22,6 @@
 use crate::DirstateMapError;
 use crate::DirstateParents;
 use crate::DirstateStatus;
-use crate::EntryState;
 use crate::FastHashbrownMap as FastHashMap;
 use crate::PatternFileWarning;
 use crate::StatusError;
@@ -346,18 +345,6 @@
 }
 }
 
-pub(super) fn state(
-,
-) -> Result, DirstateV2ParseError> {
-Ok(self.entry()?.and_then(|e| {
-if e.any_tracked() {
-Some(e.state())
-} else {
-None
-}
-}))
-}
-
 pub(super) fn cached_directory_mtime(
 ,
 ) -> Result, DirstateV2ParseError> {



To: Alphare, #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


D12540: rust-status: stop using `state()` in the dispatch logic

2022-04-12 Thread Raphaël Gomès
Alphare created this revision.
Herald added a reviewer: hg-reviewers.
Herald added a subscriber: mercurial-patches.

REVISION SUMMARY
  Let's use the new API.

REPOSITORY
  rHG Mercurial

BRANCH
  default

REVISION DETAIL
  https://phab.mercurial-scm.org/D12540

AFFECTED FILES
  rust/hg-core/src/dirstate_tree/status.rs

CHANGE DETAILS

diff --git a/rust/hg-core/src/dirstate_tree/status.rs 
b/rust/hg-core/src/dirstate_tree/status.rs
--- a/rust/hg-core/src/dirstate_tree/status.rs
+++ b/rust/hg-core/src/dirstate_tree/status.rs
@@ -13,7 +13,6 @@
 use crate::utils::hg_path::HgPath;
 use crate::BadMatch;
 use crate::DirstateStatus;
-use crate::EntryState;
 use crate::HgPathBuf;
 use crate::HgPathCow;
 use crate::PatternFileWarning;
@@ -459,17 +458,23 @@
 )?
 } else {
 if file_or_symlink && self.matcher.matches(hg_path) {
-if let Some(state) = dirstate_node.state()? {
-match state {
-EntryState::Added => {
-self.push_outcome(Outcome::Added, _node)?
-}
-EntryState::Removed => self
-.push_outcome(Outcome::Removed, _node)?,
-EntryState::Merged => self
-.push_outcome(Outcome::Modified, _node)?,
-EntryState::Normal => self
-.handle_normal_file(_node, fs_metadata)?,
+if let Some(entry) = dirstate_node.entry()? {
+if !entry.any_tracked() {
+// Forward-compat if we start tracking unknown/ignored
+// files for caching reasons
+self.mark_unknown_or_ignored(
+has_ignored_ancestor,
+hg_path,
+);
+}
+if entry.added() {
+self.push_outcome(Outcome::Added, _node)?;
+} else if entry.removed() {
+self.push_outcome(Outcome::Removed, _node)?;
+} else if entry.modified() {
+self.push_outcome(Outcome::Modified, _node)?;
+} else {
+self.handle_normal_file(_node, fs_metadata)?;
 }
 } else {
 // `node.entry.is_none()` indicates a "directory"
@@ -579,8 +584,7 @@
 Ok(())
 }
 
-/// A file with `EntryState::Normal` in the dirstate was found in the
-/// filesystem
+/// A file that is clean in the dirstate was found in the filesystem
 fn handle_normal_file(
 ,
 dirstate_node: <'tree, 'on_disk>,



To: Alphare, #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


D12539: rust-status: stop using `state()` in `handle_normal_file`

2022-04-12 Thread Raphaël Gomès
Alphare created this revision.
Herald added a reviewer: hg-reviewers.
Herald added a subscriber: mercurial-patches.

REVISION SUMMARY
  Let's use the new API

REPOSITORY
  rHG Mercurial

BRANCH
  default

REVISION DETAIL
  https://phab.mercurial-scm.org/D12539

AFFECTED FILES
  rust/hg-core/src/dirstate_tree/status.rs

CHANGE DETAILS

diff --git a/rust/hg-core/src/dirstate_tree/status.rs 
b/rust/hg-core/src/dirstate_tree/status.rs
--- a/rust/hg-core/src/dirstate_tree/status.rs
+++ b/rust/hg-core/src/dirstate_tree/status.rs
@@ -653,10 +653,15 @@
 ,
 dirstate_node: <'tree, 'on_disk>,
 ) -> Result<(), DirstateV2ParseError> {
-if let Some(state) = dirstate_node.state()? {
+if let Some(entry) = dirstate_node.entry()? {
+if !entry.any_tracked() {
+// Future-compat for when we start storing ignored and unknown
+// files for caching reasons
+return Ok(())
+}
 let path = dirstate_node.full_path(self.dmap.on_disk)?;
 if self.matcher.matches(path) {
-if let EntryState::Removed = state {
+if entry.removed() {
 self.push_outcome(Outcome::Removed, dirstate_node)?
 } else {
 self.push_outcome(Outcome::Deleted, _node)?



To: Alphare, #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


D12538: rust-dirstatemap: stop using `state()` in the cache logic

2022-04-12 Thread Raphaël Gomès
Alphare created this revision.
Herald added a reviewer: hg-reviewers.
Herald added a subscriber: mercurial-patches.

REVISION SUMMARY
  Let's use the new API

REPOSITORY
  rHG Mercurial

BRANCH
  default

REVISION DETAIL
  https://phab.mercurial-scm.org/D12538

AFFECTED FILES
  rust/hg-core/src/dirstate_tree/dirstate_map.rs

CHANGE DETAILS

diff --git a/rust/hg-core/src/dirstate_tree/dirstate_map.rs 
b/rust/hg-core/src/dirstate_tree/dirstate_map.rs
--- a/rust/hg-core/src/dirstate_tree/dirstate_map.rs
+++ b/rust/hg-core/src/dirstate_tree/dirstate_map.rs
@@ -1182,8 +1182,8 @@
 if let Some(node) = map.get_node(directory)? {
 // A node without a `DirstateEntry` was created to hold child
 // nodes, and is therefore a directory.
-let state = node.state()?;
-Ok(state.is_none() && node.tracked_descendants_count() > 0)
+let is_dir = node.entry()?.is_none();
+Ok(is_dir && node.tracked_descendants_count() > 0)
 } else {
 Ok(false)
 }
@@ -1198,8 +1198,8 @@
 if let Some(node) = map.get_node(directory)? {
 // A node without a `DirstateEntry` was created to hold child
 // nodes, and is therefore a directory.
-let state = node.state()?;
-Ok(state.is_none() && node.descendants_with_entry_count() > 0)
+let is_dir = node.entry()?.is_none();
+Ok(is_dir && node.descendants_with_entry_count() > 0)
 } else {
 Ok(false)
 }



To: Alphare, #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


D12537: rust-dirstatemap: stop using `.state` in `is_from_other_parent`

2022-04-12 Thread Raphaël Gomès
Alphare created this revision.
Herald added a reviewer: hg-reviewers.
Herald added a subscriber: mercurial-patches.

REVISION SUMMARY
  This is a deprecated API and will be removed one day.

REPOSITORY
  rHG Mercurial

BRANCH
  default

REVISION DETAIL
  https://phab.mercurial-scm.org/D12537

AFFECTED FILES
  rust/hg-core/src/dirstate/entry.rs

CHANGE DETAILS

diff --git a/rust/hg-core/src/dirstate/entry.rs 
b/rust/hg-core/src/dirstate/entry.rs
--- a/rust/hg-core/src/dirstate/entry.rs
+++ b/rust/hg-core/src/dirstate/entry.rs
@@ -655,8 +655,7 @@
 }
 
 pub(crate) fn is_from_other_parent() -> bool {
-self.state() == EntryState::Normal
-&& self.size() == SIZE_FROM_OTHER_PARENT
+self.flags.contains(Flags::WDIR_TRACKED | Flags::P2_INFO)
 }
 
 // TODO: other platforms



To: Alphare, #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


D12534: rust: use `entry.tracked()` directly

2022-04-12 Thread Raphaël Gomès
Alphare created this revision.
Herald added a reviewer: hg-reviewers.
Herald added a subscriber: mercurial-patches.

REVISION SUMMARY
  This is the new API

REPOSITORY
  rHG Mercurial

BRANCH
  default

REVISION DETAIL
  https://phab.mercurial-scm.org/D12534

AFFECTED FILES
  rust/hg-core/src/dirstate_tree/dirstate_map.rs
  rust/hg-core/src/dirstate_tree/on_disk.rs
  rust/hg-core/src/operations/list_tracked_files.rs
  rust/hg-core/src/repo.rs

CHANGE DETAILS

diff --git a/rust/hg-core/src/repo.rs b/rust/hg-core/src/repo.rs
--- a/rust/hg-core/src/repo.rs
+++ b/rust/hg-core/src/repo.rs
@@ -388,7 +388,7 @@
 
 pub fn has_subrepos() -> Result {
 if let Some(entry) = self.dirstate_map()?.get(HgPath::new(".hgsub"))? {
-Ok(entry.state().is_tracked())
+Ok(entry.tracked())
 } else {
 Ok(false)
 }
diff --git a/rust/hg-core/src/operations/list_tracked_files.rs 
b/rust/hg-core/src/operations/list_tracked_files.rs
--- a/rust/hg-core/src/operations/list_tracked_files.rs
+++ b/rust/hg-core/src/operations/list_tracked_files.rs
@@ -51,7 +51,7 @@
 let _parents = parse_dirstate_entries(
 ,
 |path, entry, _copy_source| {
-if entry.state().is_tracked() {
+if entry.tracked() {
 files.push(path)
 }
 Ok(())
diff --git a/rust/hg-core/src/dirstate_tree/on_disk.rs 
b/rust/hg-core/src/dirstate_tree/on_disk.rs
--- a/rust/hg-core/src/dirstate_tree/on_disk.rs
+++ b/rust/hg-core/src/dirstate_tree/on_disk.rs
@@ -587,7 +587,7 @@
 ) -> Result<(), DirstateV2ParseError> {
 for node in read_nodes(on_disk, nodes)? {
 if let Some(entry) = node.entry()? {
-if entry.state().is_tracked() {
+if entry.tracked() {
 f(node.full_path(on_disk)?)
 }
 }
diff --git a/rust/hg-core/src/dirstate_tree/dirstate_map.rs 
b/rust/hg-core/src/dirstate_tree/dirstate_map.rs
--- a/rust/hg-core/src/dirstate_tree/dirstate_map.rs
+++ b/rust/hg-core/src/dirstate_tree/dirstate_map.rs
@@ -477,7 +477,7 @@
 let parents = parse_dirstate_entries(
 map.on_disk,
 |path, entry, copy_source| {
-let tracked = entry.state().is_tracked();
+let tracked = entry.tracked();
 let node = Self::get_or_insert_node_inner(
 map.on_disk,
  map.unreachable_bytes,



To: Alphare, #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


D12536: rust-dirstate-entry: add `modified` method

2022-04-12 Thread Raphaël Gomès
Alphare created this revision.
Herald added a reviewer: hg-reviewers.
Herald added a subscriber: mercurial-patches.

REVISION SUMMARY
  This will also be used in other places later in the series.

REPOSITORY
  rHG Mercurial

BRANCH
  default

REVISION DETAIL
  https://phab.mercurial-scm.org/D12536

AFFECTED FILES
  rust/hg-core/src/dirstate/entry.rs

CHANGE DETAILS

diff --git a/rust/hg-core/src/dirstate/entry.rs 
b/rust/hg-core/src/dirstate/entry.rs
--- a/rust/hg-core/src/dirstate/entry.rs
+++ b/rust/hg-core/src/dirstate/entry.rs
@@ -417,6 +417,11 @@
 self.flags.contains(Flags::WDIR_TRACKED) && !self.in_either_parent()
 }
 
+pub fn modified() -> bool {
+self.flags
+.contains(Flags::WDIR_TRACKED | Flags::P1_TRACKED | Flags::P2_INFO)
+}
+
 pub fn maybe_clean() -> bool {
 if !self.flags.contains(Flags::WDIR_TRACKED) {
 false
@@ -463,10 +468,7 @@
 }
 if self.removed() {
 EntryState::Removed
-} else if self
-.flags
-.contains(Flags::WDIR_TRACKED | Flags::P1_TRACKED | Flags::P2_INFO)
-{
+} else if self.modified() {
 EntryState::Merged
 } else if self.added() {
 EntryState::Added



To: Alphare, #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


D12535: rust: remove use of `EntryState` in `DirsMultiset`

2022-04-12 Thread Raphaël Gomès
Alphare created this revision.
Herald added a reviewer: hg-reviewers.
Herald added a subscriber: mercurial-patches.

REVISION SUMMARY
  Let's use the new API.

REPOSITORY
  rHG Mercurial

BRANCH
  default

REVISION DETAIL
  https://phab.mercurial-scm.org/D12535

AFFECTED FILES
  rust/hg-core/src/dirstate/dirs_multiset.rs

CHANGE DETAILS

diff --git a/rust/hg-core/src/dirstate/dirs_multiset.rs 
b/rust/hg-core/src/dirstate/dirs_multiset.rs
--- a/rust/hg-core/src/dirstate/dirs_multiset.rs
+++ b/rust/hg-core/src/dirstate/dirs_multiset.rs
@@ -10,7 +10,6 @@
 //! Used to counts the references to directories in a manifest or dirstate.
 use crate::dirstate_tree::on_disk::DirstateV2ParseError;
 use crate::{
-dirstate::EntryState,
 utils::{
 files,
 hg_path::{HgPath, HgPathBuf, HgPathError},
@@ -49,7 +48,7 @@
 let filename = filename.as_ref();
 // This `if` is optimized out of the loop
 if only_tracked {
-if entry.state() != EntryState::Removed {
+if !entry.removed() {
 multiset.add_path(filename)?;
 }
 } else {
@@ -215,6 +214,8 @@
 
 #[cfg(test)]
 mod tests {
+use crate::EntryState;
+
 use super::*;
 
 #[test]



To: Alphare, #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


D12533: rust-hg-cpython: remove use of `EntryState`

2022-04-12 Thread Raphaël Gomès
Alphare created this revision.
Herald added a reviewer: hg-reviewers.
Herald added a subscriber: mercurial-patches.

REVISION SUMMARY
  Let's use the new API

REPOSITORY
  rHG Mercurial

BRANCH
  default

REVISION DETAIL
  https://phab.mercurial-scm.org/D12533

AFFECTED FILES
  rust/hg-cpython/src/dirstate/dirstate_map.rs

CHANGE DETAILS

diff --git a/rust/hg-cpython/src/dirstate/dirstate_map.rs 
b/rust/hg-cpython/src/dirstate/dirstate_map.rs
--- a/rust/hg-cpython/src/dirstate/dirstate_map.rs
+++ b/rust/hg-cpython/src/dirstate/dirstate_map.rs
@@ -26,7 +26,7 @@
 dirstate::StateMapIter, dirstate_tree::on_disk::DirstateV2ParseError,
 dirstate_tree::owning::OwningDirstateMap, revlog::Node,
 utils::files::normalize_case, utils::hg_path::HgPath, DirstateEntry,
-DirstateError, DirstateParents, EntryState,
+DirstateError, DirstateParents,
 };
 
 // TODO
@@ -269,7 +269,7 @@
 let dict = PyDict::new(py);
 for item in self.inner(py).borrow_mut().iter() {
 let (path, entry) = item.map_err(|e| v2_error(py, e))?;
-if entry.state() != EntryState::Removed {
+if !entry.removed() {
 let key = normalize_case(path);
 let value = path;
 dict.set_item(



To: Alphare, #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


D12532: rust-dirstatemap: use a checked sub instead of a potentially underflowing one

2022-04-12 Thread Raphaël Gomès
Alphare created this revision.
Herald added a reviewer: hg-reviewers.
Herald added a subscriber: mercurial-patches.

REVISION SUMMARY
  This was missed in 2593873cda0f 


REPOSITORY
  rHG Mercurial

BRANCH
  default

REVISION DETAIL
  https://phab.mercurial-scm.org/D12532

AFFECTED FILES
  rust/hg-core/src/dirstate_tree/dirstate_map.rs

CHANGE DETAILS

diff --git a/rust/hg-core/src/dirstate_tree/dirstate_map.rs 
b/rust/hg-core/src/dirstate_tree/dirstate_map.rs
--- a/rust/hg-core/src/dirstate_tree/dirstate_map.rs
+++ b/rust/hg-core/src/dirstate_tree/dirstate_map.rs
@@ -1337,7 +1337,9 @@
 )?
 .and_then(|node| {
 if let Some(source) = _source {
-*count -= 1;
+*count = count
+.checked_sub(1)
+.expect("nodes_with_copy_source_count should be >= 0");
 DirstateMap::count_dropped_path(unreachable_bytes, source);
 }
 node.copy_source.take().map(Cow::into_owned)



To: Alphare, #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


D12531: rust-dirstatemap: add simpler version of `get_node_mut`

2022-04-12 Thread Raphaël Gomès
Alphare created this revision.
Herald added a reviewer: hg-reviewers.
Herald added a subscriber: mercurial-patches.

REVISION SUMMARY
  This will help reduce code and footgun potential for simpler callers.

REPOSITORY
  rHG Mercurial

BRANCH
  default

REVISION DETAIL
  https://phab.mercurial-scm.org/D12531

AFFECTED FILES
  rust/hg-core/src/dirstate_tree/dirstate_map.rs

CHANGE DETAILS

diff --git a/rust/hg-core/src/dirstate_tree/dirstate_map.rs 
b/rust/hg-core/src/dirstate_tree/dirstate_map.rs
--- a/rust/hg-core/src/dirstate_tree/dirstate_map.rs
+++ b/rust/hg-core/src/dirstate_tree/dirstate_map.rs
@@ -545,13 +545,32 @@
 
 /// Returns a mutable reference to the node at `path` if it exists
 ///
+/// `each_ancestor` is a callback that is called for each ancestor node
+/// when descending the tree. It is used to keep the different counters
+/// of the `DirstateMap` up-to-date.
+fn get_node_mut<'tree>(
+&'tree mut self,
+path: ,
+each_ancestor: impl FnMut( Node),
+) -> Result>, DirstateV2ParseError> {
+Self::get_node_mut_inner(
+self.on_disk,
+ self.unreachable_bytes,
+ self.root,
+path,
+each_ancestor,
+)
+}
+
+/// Lower-level version of `get_node_mut`.
+///
 /// This takes `root` instead of ` self` so that callers can mutate
 /// other fields while the returned borrow is still valid.
 ///
 /// `each_ancestor` is a callback that is called for each ancestor node
 /// when descending the tree. It is used to keep the different counters
 /// of the `DirstateMap` up-to-date.
-fn get_node_mut<'tree>(
+fn get_node_mut_inner<'tree>(
 on_disk: &'on_disk [u8],
 unreachable_bytes:  u32,
 root: &'tree mut ChildNodes<'on_disk>,
@@ -746,19 +765,14 @@
 filename: ,
 old_entry: DirstateEntry,
 ) -> Result<(), DirstateV2ParseError> {
-let node = DirstateMap::get_node_mut(
-self.on_disk,
- self.unreachable_bytes,
- self.root,
-filename,
-|ancestor| {
+let node = self
+.get_node_mut(filename, |ancestor| {
 ancestor.tracked_descendants_count = ancestor
 .tracked_descendants_count
 .checked_sub(1)
 .expect("tracked_descendants_count should be >= 0");
-},
-)?
-.expect("node should exist");
+})?
+.expect("node should exist");
 let mut new_entry = old_entry.clone();
 new_entry.set_untracked();
 node.data = NodeData::Entry(new_entry);
@@ -780,18 +794,13 @@
 size: u32,
 mtime: TruncatedTimestamp,
 ) -> Result<(), DirstateError> {
-let node = DirstateMap::get_node_mut(
-self.on_disk,
- self.unreachable_bytes,
- self.root,
-filename,
-|ancestor| {
+let node = self
+.get_node_mut(filename, |ancestor| {
 if !old_entry.tracked() {
 ancestor.tracked_descendants_count += 1;
 }
-},
-)?
-.expect("node should exist");
+})?
+.expect("node should exist");
 let mut new_entry = old_entry.clone();
 new_entry.set_clean(mode, size, mtime);
 node.data = NodeData::Entry(new_entry);
@@ -807,14 +816,9 @@
  self,
 filename: ,
 ) -> Result<(), DirstateError> {
-let node = DirstateMap::get_node_mut(
-self.on_disk,
- self.unreachable_bytes,
- self.root,
-filename,
-|_ancestor| {},
-)?
-.expect("node should exist");
+let node = self
+.get_node_mut(filename, |_ancestor| {})?
+.expect("node should exist");
 let entry = node.data.as_entry_mut().expect("entry should exist");
 entry.set_possibly_dirty();
 node.data = NodeData::Entry(*entry);
@@ -826,13 +830,7 @@
  self,
 path: ,
 ) -> Result<(), DirstateV2ParseError> {
-let node = match DirstateMap::get_node_mut(
-self.on_disk,
- self.unreachable_bytes,
- self.root,
-path,
-|_ancestor| {},
-)? {
+let node = match self.get_node_mut(path, |_ancestor| {})? {
 Some(node) => node,
 None => return Ok(()),
 };
@@ -848,13 +846,7 @@
 path: ,
 mtime: TruncatedTimestamp,
 ) -> Result<(), DirstateV2ParseError> {
-let node = match DirstateMap::get_node_mut(
-self.on_disk,
- self.unreachable_bytes,
- self.root,
-path,
-|_ancestor| {},
-)? {
+let node = match self.get_node_mut(path, |_ancestor| {})? {
 Some(node) => node,
 None => 

D12530: rust-dirstatemap: use `get_node_mut` instead or `get_or_insert_node`

2022-04-12 Thread Raphaël Gomès
Alphare created this revision.
Herald added a reviewer: hg-reviewers.
Herald added a subscriber: mercurial-patches.

REVISION SUMMARY
  This (along with the docstring), makes it more obvious that we're not 
expecting
  to insert a node here. This is less prone to bugs in later refactorings.

REPOSITORY
  rHG Mercurial

BRANCH
  default

REVISION DETAIL
  https://phab.mercurial-scm.org/D12530

AFFECTED FILES
  rust/hg-core/src/dirstate_tree/dirstate_map.rs

CHANGE DETAILS

diff --git a/rust/hg-core/src/dirstate_tree/dirstate_map.rs 
b/rust/hg-core/src/dirstate_tree/dirstate_map.rs
--- a/rust/hg-core/src/dirstate_tree/dirstate_map.rs
+++ b/rust/hg-core/src/dirstate_tree/dirstate_map.rs
@@ -733,25 +733,45 @@
 Ok(new)
 }
 
-/// It is the responsibility of the caller to know that there was an entry
-/// there before. Does not handle the removal of copy source
+/// Set a node as untracked in the dirstate.
+///
+/// It is the responsibility of the caller to remove the copy source and/or
+/// the entry itself if appropriate.
+///
+/// # Panics
+///
+/// Panics if the node does not exist.
 fn set_untracked(
  self,
 filename: ,
 old_entry: DirstateEntry,
 ) -> Result<(), DirstateV2ParseError> {
-let node = self.get_or_insert_node(filename, |ancestor| {
-ancestor.tracked_descendants_count = ancestor
-.tracked_descendants_count
-.checked_sub(1)
-.expect("tracked_descendants_count should be >= 0");
-})?;
+let node = DirstateMap::get_node_mut(
+self.on_disk,
+ self.unreachable_bytes,
+ self.root,
+filename,
+|ancestor| {
+ancestor.tracked_descendants_count = ancestor
+.tracked_descendants_count
+.checked_sub(1)
+.expect("tracked_descendants_count should be >= 0");
+},
+)?
+.expect("node should exist");
 let mut new_entry = old_entry.clone();
 new_entry.set_untracked();
 node.data = NodeData::Entry(new_entry);
 Ok(())
 }
 
+/// Set a node as clean in the dirstate.
+///
+/// It is the responsibility of the caller to remove the copy source.
+///
+/// # Panics
+///
+/// Panics if the node does not exist.
 fn set_clean(
  self,
 filename: ,
@@ -760,22 +780,41 @@
 size: u32,
 mtime: TruncatedTimestamp,
 ) -> Result<(), DirstateError> {
-let node = self.get_or_insert_node(filename, |ancestor| {
-if !old_entry.tracked() {
-ancestor.tracked_descendants_count += 1;
-}
-})?;
+let node = DirstateMap::get_node_mut(
+self.on_disk,
+ self.unreachable_bytes,
+ self.root,
+filename,
+|ancestor| {
+if !old_entry.tracked() {
+ancestor.tracked_descendants_count += 1;
+}
+},
+)?
+.expect("node should exist");
 let mut new_entry = old_entry.clone();
 new_entry.set_clean(mode, size, mtime);
 node.data = NodeData::Entry(new_entry);
 Ok(())
 }
 
+/// Set a node as possibly dirty in the dirstate.
+///
+/// # Panics
+///
+/// Panics if the node does not exist.
 fn set_possibly_dirty(
  self,
 filename: ,
 ) -> Result<(), DirstateError> {
-let node = self.get_or_insert_node(filename, |_ancestor| {})?;
+let node = DirstateMap::get_node_mut(
+self.on_disk,
+ self.unreachable_bytes,
+ self.root,
+filename,
+|_ancestor| {},
+)?
+.expect("node should exist");
 let entry = node.data.as_entry_mut().expect("entry should exist");
 entry.set_possibly_dirty();
 node.data = NodeData::Entry(*entry);



To: Alphare, #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


D12529: rust-dirstatemap: add `each_ancestor` argument to `get_node_mut`

2022-04-12 Thread Raphaël Gomès
Alphare created this revision.
Herald added a reviewer: hg-reviewers.
Herald added a subscriber: mercurial-patches.

REVISION SUMMARY
  This forces the callers to think about if the counters in the ancestors
  need to be adjusted.

REPOSITORY
  rHG Mercurial

BRANCH
  default

REVISION DETAIL
  https://phab.mercurial-scm.org/D12529

AFFECTED FILES
  rust/hg-core/src/dirstate_tree/dirstate_map.rs

CHANGE DETAILS

diff --git a/rust/hg-core/src/dirstate_tree/dirstate_map.rs 
b/rust/hg-core/src/dirstate_tree/dirstate_map.rs
--- a/rust/hg-core/src/dirstate_tree/dirstate_map.rs
+++ b/rust/hg-core/src/dirstate_tree/dirstate_map.rs
@@ -546,12 +546,17 @@
 /// Returns a mutable reference to the node at `path` if it exists
 ///
 /// This takes `root` instead of ` self` so that callers can mutate
-/// other fields while the returned borrow is still valid
+/// other fields while the returned borrow is still valid.
+///
+/// `each_ancestor` is a callback that is called for each ancestor node
+/// when descending the tree. It is used to keep the different counters
+/// of the `DirstateMap` up-to-date.
 fn get_node_mut<'tree>(
 on_disk: &'on_disk [u8],
 unreachable_bytes:  u32,
 root: &'tree mut ChildNodes<'on_disk>,
 path: ,
+mut each_ancestor: impl FnMut( Node),
 ) -> Result>, DirstateV2ParseError> {
 let mut children = root;
 let mut components = path.components();
@@ -563,6 +568,7 @@
 .get_mut(component)
 {
 if let Some(next_component) = components.next() {
+each_ancestor(child);
 component = next_component;
 children =  child.children;
 } else {
@@ -786,6 +792,7 @@
  self.unreachable_bytes,
  self.root,
 path,
+|_ancestor| {},
 )? {
 Some(node) => node,
 None => return Ok(()),
@@ -807,6 +814,7 @@
  self.unreachable_bytes,
  self.root,
 path,
+|_ancestor| {},
 )? {
 Some(node) => node,
 None => return Ok(()),
@@ -1294,6 +1302,7 @@
 unreachable_bytes,
  map.root,
 key,
+|_ancestor| {},
 )?
 .and_then(|node| {
 if let Some(source) = _source {



To: Alphare, #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


D12528: rust-dirstatemap: add a simpler method `get_or_insert_node` for the common case

2022-04-12 Thread Raphaël Gomès
Alphare created this revision.
Herald added a reviewer: hg-reviewers.
Herald added a subscriber: mercurial-patches.

REVISION SUMMARY
  All but one case use the exact same input for most arguments, this simplifies
  code and reduces footgun potential.

REPOSITORY
  rHG Mercurial

BRANCH
  default

REVISION DETAIL
  https://phab.mercurial-scm.org/D12528

AFFECTED FILES
  rust/hg-core/src/dirstate_tree/dirstate_map.rs

CHANGE DETAILS

diff --git a/rust/hg-core/src/dirstate_tree/dirstate_map.rs 
b/rust/hg-core/src/dirstate_tree/dirstate_map.rs
--- a/rust/hg-core/src/dirstate_tree/dirstate_map.rs
+++ b/rust/hg-core/src/dirstate_tree/dirstate_map.rs
@@ -478,7 +478,7 @@
 map.on_disk,
 |path, entry, copy_source| {
 let tracked = entry.state().is_tracked();
-let node = Self::get_or_insert_node(
+let node = Self::get_or_insert_node_inner(
 map.on_disk,
  map.unreachable_bytes,
  map.root,
@@ -574,7 +574,30 @@
 }
 }
 
+/// Get a mutable reference to the node at `path`, creating it if it does
+/// not exist.
+///
+/// `each_ancestor` is a callback that is called for each ancestor node
+/// when descending the tree. It is used to keep the different counters
+/// of the `DirstateMap` up-to-date.
 fn get_or_insert_node<'tree, 'path>(
+&'tree mut self,
+path: &'path HgPath,
+each_ancestor: impl FnMut( Node),
+) -> Result<&'tree mut Node<'on_disk>, DirstateV2ParseError> {
+Self::get_or_insert_node_inner(
+self.on_disk,
+ self.unreachable_bytes,
+ self.root,
+path,
+WithBasename::to_cow_owned,
+each_ancestor,
+)
+}
+
+/// Lower-level version of `get_or_insert_node_inner`, which is used when
+/// parsing disk data to remove allocations for new nodes.
+fn get_or_insert_node_inner<'tree, 'path>(
 on_disk: &'on_disk [u8],
 unreachable_bytes:  u32,
 root: &'tree mut ChildNodes<'on_disk>,
@@ -620,30 +643,23 @@
 Some(old_entry) => (true, old_entry.tracked()),
 None => (false, false),
 };
-let node = Self::get_or_insert_node(
-self.on_disk,
- self.unreachable_bytes,
- self.root,
-filename,
-WithBasename::to_cow_owned,
-|ancestor| {
-if !had_entry {
-ancestor.descendants_with_entry_count += 1;
+let node = self.get_or_insert_node(filename, |ancestor| {
+if !had_entry {
+ancestor.descendants_with_entry_count += 1;
+}
+if was_tracked {
+if !wc_tracked {
+ancestor.tracked_descendants_count = ancestor
+.tracked_descendants_count
+.checked_sub(1)
+.expect("tracked count to be >= 0");
 }
-if was_tracked {
-if !wc_tracked {
-ancestor.tracked_descendants_count = ancestor
-.tracked_descendants_count
-.checked_sub(1)
-.expect("tracked count to be >= 0");
-}
-} else {
-if wc_tracked {
-ancestor.tracked_descendants_count += 1;
-}
+} else {
+if wc_tracked {
+ancestor.tracked_descendants_count += 1;
 }
-},
-)?;
+}
+})?;
 
 let v2_data = if let Some(parent_file_data) = parent_file_data_opt {
 DirstateV2Data {
@@ -666,10 +682,10 @@
 ..Default::default()
 }
 };
+node.data = NodeData::Entry(DirstateEntry::from_v2_data(v2_data));
 if !had_entry {
 self.nodes_with_entry_count += 1;
 }
-node.data = NodeData::Entry(DirstateEntry::from_v2_data(v2_data));
 Ok(())
 }
 
@@ -683,21 +699,14 @@
 let tracked_count_increment = if was_tracked { 0 } else { 1 };
 let mut new = false;
 
-let node = Self::get_or_insert_node(
-self.on_disk,
- self.unreachable_bytes,
- self.root,
-filename,
-WithBasename::to_cow_owned,
-|ancestor| {
-if !had_entry {
-ancestor.descendants_with_entry_count += 1;
-}
+let node = self.get_or_insert_node(filename, |ancestor| {
+if !had_entry {
+ancestor.descendants_with_entry_count += 1;
+}
 
-ancestor.tracked_descendants_count += tracked_count_increment;
-},
-)?;
-let new_entry = if let Some(old_entry) = 

D12527: rust-dirstatemap: inline the last `get_or_insert` call

2022-04-12 Thread Raphaël Gomès
Alphare created this revision.
Herald added a reviewer: hg-reviewers.
Herald added a subscriber: mercurial-patches.

REVISION SUMMARY
  The `get_or_insert` method was dangerous because it did not take the
  `DirstateMap` counters into account. This particular instance does not need
  to update the counters.

REPOSITORY
  rHG Mercurial

BRANCH
  default

REVISION DETAIL
  https://phab.mercurial-scm.org/D12527

AFFECTED FILES
  rust/hg-core/src/dirstate_tree/dirstate_map.rs

CHANGE DETAILS

diff --git a/rust/hg-core/src/dirstate_tree/dirstate_map.rs 
b/rust/hg-core/src/dirstate_tree/dirstate_map.rs
--- a/rust/hg-core/src/dirstate_tree/dirstate_map.rs
+++ b/rust/hg-core/src/dirstate_tree/dirstate_map.rs
@@ -574,20 +574,6 @@
 }
 }
 
-pub(super) fn get_or_insert<'tree, 'path>(
-&'tree mut self,
-path: ,
-) -> Result<&'tree mut Node<'on_disk>, DirstateV2ParseError> {
-Self::get_or_insert_node(
-self.on_disk,
- self.unreachable_bytes,
- self.root,
-path,
-WithBasename::to_cow_owned,
-|_| {},
-)
-}
-
 fn get_or_insert_node<'tree, 'path>(
 on_disk: &'on_disk [u8],
 unreachable_bytes:  u32,
@@ -1438,7 +1424,14 @@
 }
 self.with_dmap_mut(|map| {
 for path in files_with_p2_info.iter() {
-let node = map.get_or_insert(path)?;
+let node = DirstateMap::get_or_insert_node(
+map.on_disk,
+ map.unreachable_bytes,
+ map.root,
+path,
+WithBasename::to_cow_owned,
+|_| {},
+)?;
 let entry =
 node.data.as_entry_mut().expect("entry should exist");
 entry.drop_merge_data();



To: Alphare, #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


D12526: rust-dirstatemap: add `set_cached_mtime` helper method

2022-04-12 Thread Raphaël Gomès
Alphare created this revision.
Herald added a reviewer: hg-reviewers.
Herald added a subscriber: mercurial-patches.

REVISION SUMMARY
  This will help remove the `get_or_insert` method, which is dangerous because 
it
  does not take the `DirstateMap` counters into account

REPOSITORY
  rHG Mercurial

BRANCH
  default

REVISION DETAIL
  https://phab.mercurial-scm.org/D12526

AFFECTED FILES
  rust/hg-core/src/dirstate_tree/dirstate_map.rs
  rust/hg-core/src/dirstate_tree/status.rs

CHANGE DETAILS

diff --git a/rust/hg-core/src/dirstate_tree/status.rs 
b/rust/hg-core/src/dirstate_tree/status.rs
--- a/rust/hg-core/src/dirstate_tree/status.rs
+++ b/rust/hg-core/src/dirstate_tree/status.rs
@@ -4,7 +4,6 @@
 use crate::dirstate_tree::dirstate_map::BorrowedPath;
 use crate::dirstate_tree::dirstate_map::ChildNodesRef;
 use crate::dirstate_tree::dirstate_map::DirstateMap;
-use crate::dirstate_tree::dirstate_map::NodeData;
 use crate::dirstate_tree::dirstate_map::NodeRef;
 use crate::dirstate_tree::on_disk::DirstateV2ParseError;
 use crate::matchers::get_ignore_function;
@@ -143,13 +142,7 @@
 dmap.clear_cached_mtime(path)?;
 }
 for (path, mtime) in _cachable {
-let node = dmap.get_or_insert(path)?;
-match  {
-NodeData::Entry(_) => {} // Don’t overwrite an entry
-NodeData::CachedDirectory { .. } | NodeData::None => {
-node.data = NodeData::CachedDirectory { mtime: *mtime }
-}
-}
+dmap.set_cached_mtime(path, *mtime)?;
 }
 
 Ok((outcome, warnings))
diff --git a/rust/hg-core/src/dirstate_tree/dirstate_map.rs 
b/rust/hg-core/src/dirstate_tree/dirstate_map.rs
--- a/rust/hg-core/src/dirstate_tree/dirstate_map.rs
+++ b/rust/hg-core/src/dirstate_tree/dirstate_map.rs
@@ -823,6 +823,30 @@
 Ok(())
 }
 
+/// Sets the cached mtime for the (potential) folder at `path`.
+pub(super) fn set_cached_mtime(
+ self,
+path: ,
+mtime: TruncatedTimestamp,
+) -> Result<(), DirstateV2ParseError> {
+let node = match DirstateMap::get_node_mut(
+self.on_disk,
+ self.unreachable_bytes,
+ self.root,
+path,
+)? {
+Some(node) => node,
+None => return Ok(()),
+};
+match  {
+NodeData::Entry(_) => {} // Don’t overwrite an entry
+NodeData::CachedDirectory { .. } | NodeData::None => {
+node.data = NodeData::CachedDirectory { mtime }
+}
+}
+Ok(())
+}
+
 fn iter_nodes<'tree>(
 &'tree self,
 ) -> impl Iterator<



To: Alphare, #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


D12525: rust-dirstatemap: add `clear_cached_mtime` helper method

2022-04-12 Thread Raphaël Gomès
Alphare created this revision.
Herald added a reviewer: hg-reviewers.
Herald added a subscriber: mercurial-patches.

REVISION SUMMARY
  This will help remove the `get_or_insert` method, which is dangerous because 
it
  does not take the `DirstateMap` counters into account.

REPOSITORY
  rHG Mercurial

BRANCH
  default

REVISION DETAIL
  https://phab.mercurial-scm.org/D12525

AFFECTED FILES
  rust/hg-core/src/dirstate_tree/dirstate_map.rs
  rust/hg-core/src/dirstate_tree/status.rs

CHANGE DETAILS

diff --git a/rust/hg-core/src/dirstate_tree/status.rs 
b/rust/hg-core/src/dirstate_tree/status.rs
--- a/rust/hg-core/src/dirstate_tree/status.rs
+++ b/rust/hg-core/src/dirstate_tree/status.rs
@@ -140,10 +140,7 @@
 // Remove outdated mtimes before adding new mtimes, in case a given
 // directory is both
 for path in  {
-let node = dmap.get_or_insert(path)?;
-if let NodeData::CachedDirectory { .. } =  {
-node.data = NodeData::None
-}
+dmap.clear_cached_mtime(path)?;
 }
 for (path, mtime) in _cachable {
 let node = dmap.get_or_insert(path)?;
diff --git a/rust/hg-core/src/dirstate_tree/dirstate_map.rs 
b/rust/hg-core/src/dirstate_tree/dirstate_map.rs
--- a/rust/hg-core/src/dirstate_tree/dirstate_map.rs
+++ b/rust/hg-core/src/dirstate_tree/dirstate_map.rs
@@ -803,6 +803,26 @@
 Ok(())
 }
 
+/// Clears the cached mtime for the (potential) folder at `path`.
+pub(super) fn clear_cached_mtime(
+ self,
+path: ,
+) -> Result<(), DirstateV2ParseError> {
+let node = match DirstateMap::get_node_mut(
+self.on_disk,
+ self.unreachable_bytes,
+ self.root,
+path,
+)? {
+Some(node) => node,
+None => return Ok(()),
+};
+if let NodeData::CachedDirectory { .. } =  {
+node.data = NodeData::None
+}
+Ok(())
+}
+
 fn iter_nodes<'tree>(
 &'tree self,
 ) -> impl Iterator<



To: Alphare, #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


D12524: rust-dirstatemap: add unit tests

2022-04-12 Thread Raphaël Gomès
Alphare created this revision.
Herald added a reviewer: hg-reviewers.
Herald added a subscriber: mercurial-patches.

REVISION SUMMARY
  These were missing and have already proven valuable since they have found
  two bugs (fixed in previous patches).
  
  There may be other behavior to test, but this gives us a decent coverage.

REPOSITORY
  rHG Mercurial

BRANCH
  default

REVISION DETAIL
  https://phab.mercurial-scm.org/D12524

AFFECTED FILES
  rust/hg-core/src/dirstate_tree/dirstate_map.rs

CHANGE DETAILS

diff --git a/rust/hg-core/src/dirstate_tree/dirstate_map.rs 
b/rust/hg-core/src/dirstate_tree/dirstate_map.rs
--- a/rust/hg-core/src/dirstate_tree/dirstate_map.rs
+++ b/rust/hg-core/src/dirstate_tree/dirstate_map.rs
@@ -1433,3 +1433,417 @@
 }))
 }
 }
+#[cfg(test)]
+mod tests {
+use super::*;
+
+/// Shortcut to return tracked descendants of a path.
+/// Panics if the path does not exist.
+fn tracked_descendants(map: , path: &[u8]) -> u32 {
+let path = dbg!(HgPath::new(path));
+let node = map.get_map().get_node(path);
+node.unwrap().unwrap().tracked_descendants_count()
+}
+
+/// Shortcut to return descendants with an entry.
+/// Panics if the path does not exist.
+fn descendants_with_an_entry(map: , path: &[u8]) -> u32 {
+let path = dbg!(HgPath::new(path));
+let node = map.get_map().get_node(path);
+node.unwrap().unwrap().descendants_with_entry_count()
+}
+
+fn assert_does_not_exist(map: , path: &[u8]) {
+let path = dbg!(HgPath::new(path));
+let node = map.get_map().get_node(path);
+assert!(node.unwrap().is_none());
+}
+
+/// Shortcut for path creation in tests
+fn p(b: &[u8]) ->  {
+HgPath::new(b)
+}
+
+/// Test the very simple case a single tracked file
+#[test]
+fn test_tracked_descendants_simple() -> Result<(), DirstateError> {
+let mut map = OwningDirstateMap::new_empty(vec![]);
+assert_eq!(map.len(), 0);
+
+map.set_tracked(p(b"some/nested/path"))?;
+
+assert_eq!(map.len(), 1);
+assert_eq!(tracked_descendants(, b"some"), 1);
+assert_eq!(tracked_descendants(, b"some/nested"), 1);
+assert_eq!(tracked_descendants(, b"some/nested/path"), 0);
+
+map.set_untracked(p(b"some/nested/path"))?;
+assert_eq!(map.len(), 0);
+assert!(map.get_map().get_node(p(b"some"))?.is_none());
+
+Ok(())
+}
+
+/// Test the simple case of all tracked, but multiple files
+#[test]
+fn test_tracked_descendants_multiple() -> Result<(), DirstateError> {
+let mut map = OwningDirstateMap::new_empty(vec![]);
+
+map.set_tracked(p(b"some/nested/path"))?;
+map.set_tracked(p(b"some/nested/file"))?;
+// one layer without any files to test deletion cascade
+map.set_tracked(p(b"some/other/nested/path"))?;
+map.set_tracked(p(b"root_file"))?;
+map.set_tracked(p(b"some/file"))?;
+map.set_tracked(p(b"some/file2"))?;
+map.set_tracked(p(b"some/file3"))?;
+
+assert_eq!(map.len(), 7);
+assert_eq!(tracked_descendants(, b"some"), 6);
+assert_eq!(tracked_descendants(, b"some/nested"), 2);
+assert_eq!(tracked_descendants(, b"some/other"), 1);
+assert_eq!(tracked_descendants(, b"some/other/nested"), 1);
+assert_eq!(tracked_descendants(, b"some/nested/path"), 0);
+
+map.set_untracked(p(b"some/nested/path"))?;
+assert_eq!(map.len(), 6);
+assert_eq!(tracked_descendants(, b"some"), 5);
+assert_eq!(tracked_descendants(, b"some/nested"), 1);
+assert_eq!(tracked_descendants(, b"some/other"), 1);
+assert_eq!(tracked_descendants(, b"some/other/nested"), 1);
+
+map.set_untracked(p(b"some/nested/file"))?;
+assert_eq!(map.len(), 5);
+assert_eq!(tracked_descendants(, b"some"), 4);
+assert_eq!(tracked_descendants(, b"some/other"), 1);
+assert_eq!(tracked_descendants(, b"some/other/nested"), 1);
+assert_does_not_exist(, b"some_nested");
+
+map.set_untracked(p(b"some/other/nested/path"))?;
+assert_eq!(map.len(), 4);
+assert_eq!(tracked_descendants(, b"some"), 3);
+assert_does_not_exist(, b"some/other");
+
+map.set_untracked(p(b"root_file"))?;
+assert_eq!(map.len(), 3);
+assert_eq!(tracked_descendants(, b"some"), 3);
+assert_does_not_exist(, b"root_file");
+
+map.set_untracked(p(b"some/file"))?;
+assert_eq!(map.len(), 2);
+assert_eq!(tracked_descendants(, b"some"), 2);
+assert_does_not_exist(, b"some/file");
+
+map.set_untracked(p(b"some/file2"))?;
+assert_eq!(map.len(), 1);
+assert_eq!(tracked_descendants(, b"some"), 1);
+assert_does_not_exist(, b"some/file2");
+
+map.set_untracked(p(b"some/file3"))?;
+assert_eq!(map.len(), 0);
+

D12523: rust: add `Debug` trait to a bunch of structs

2022-04-12 Thread Raphaël Gomès
Alphare created this revision.
Herald added a reviewer: hg-reviewers.
Herald added a subscriber: mercurial-patches.

REVISION SUMMARY
  This is useful when... debugging. Right now the output is not in the most
  readable state it could be, but this is very low effort and is good enough
  for now. We may want to write a nicer custom debug formatter for some of those
  structs in the future.

REPOSITORY
  rHG Mercurial

BRANCH
  default

REVISION DETAIL
  https://phab.mercurial-scm.org/D12523

AFFECTED FILES
  rust/hg-core/src/dirstate_tree/dirstate_map.rs
  rust/hg-core/src/dirstate_tree/on_disk.rs

CHANGE DETAILS

diff --git a/rust/hg-core/src/dirstate_tree/on_disk.rs 
b/rust/hg-core/src/dirstate_tree/on_disk.rs
--- a/rust/hg-core/src/dirstate_tree/on_disk.rs
+++ b/rust/hg-core/src/dirstate_tree/on_disk.rs
@@ -84,7 +84,7 @@
 
 /// Fields are documented in the *The data file format*
 /// section of `mercurial/helptext/internals/dirstate-v2.txt`
-#[derive(BytesCast)]
+#[derive(BytesCast, Debug)]
 #[repr(C)]
 pub(super) struct Node {
 full_path: PathSlice,
@@ -124,7 +124,7 @@
 }
 
 /// Duration since the Unix epoch
-#[derive(BytesCast, Copy, Clone)]
+#[derive(BytesCast, Copy, Clone, Debug)]
 #[repr(C)]
 struct PackedTruncatedTimestamp {
 truncated_seconds: U32Be,
@@ -152,7 +152,7 @@
 /// Always sorted by ascending `full_path`, to allow binary search.
 /// Since nodes with the same parent nodes also have the same parent path,
 /// only the `base_name`s need to be compared during binary search.
-#[derive(BytesCast, Copy, Clone)]
+#[derive(BytesCast, Copy, Clone, Debug)]
 #[repr(C)]
 struct ChildNodes {
 start: Offset,
@@ -160,7 +160,7 @@
 }
 
 /// A `HgPath` of `len` bytes
-#[derive(BytesCast, Copy, Clone)]
+#[derive(BytesCast, Copy, Clone, Debug)]
 #[repr(C)]
 struct PathSlice {
 start: Offset,
diff --git a/rust/hg-core/src/dirstate_tree/dirstate_map.rs 
b/rust/hg-core/src/dirstate_tree/dirstate_map.rs
--- a/rust/hg-core/src/dirstate_tree/dirstate_map.rs
+++ b/rust/hg-core/src/dirstate_tree/dirstate_map.rs
@@ -32,6 +32,7 @@
 /// anymore) is less than this fraction of the total amount of existing data.
 const ACCEPTABLE_UNREACHABLE_BYTES_RATIO: f32 = 0.5;
 
+#[derive(Debug)]
 pub struct DirstateMap<'on_disk> {
 /// Contents of the `.hg/dirstate` file
 pub(super) on_disk: &'on_disk [u8],
@@ -61,21 +62,25 @@
 
 /// Similar to `&'tree Cow<'on_disk, HgPath>`, but can also be returned
 /// for on-disk nodes that don’t actually have a `Cow` to borrow.
+#[derive(Debug)]
 pub(super) enum BorrowedPath<'tree, 'on_disk> {
 InMemory(&'tree HgPathBuf),
 OnDisk(&'on_disk HgPath),
 }
 
+#[derive(Debug)]
 pub(super) enum ChildNodes<'on_disk> {
 InMemory(FastHashMap, Node<'on_disk>>),
 OnDisk(&'on_disk [on_disk::Node]),
 }
 
+#[derive(Debug)]
 pub(super) enum ChildNodesRef<'tree, 'on_disk> {
 InMemory(&'tree FastHashMap, Node<'on_disk>>),
 OnDisk(&'on_disk [on_disk::Node]),
 }
 
+#[derive(Debug)]
 pub(super) enum NodeRef<'tree, 'on_disk> {
 InMemory(&'tree NodeKey<'on_disk>, &'tree Node<'on_disk>),
 OnDisk(&'on_disk on_disk::Node),
@@ -383,7 +388,7 @@
 }
 
 /// Represents a file or a directory
-#[derive(Default)]
+#[derive(Default, Debug)]
 pub(super) struct Node<'on_disk> {
 pub(super) data: NodeData,
 
@@ -399,6 +404,7 @@
 pub(super) tracked_descendants_count: u32,
 }
 
+#[derive(Debug)]
 pub(super) enum NodeData {
 Entry(DirstateEntry),
 CachedDirectory { mtime: TruncatedTimestamp },



To: Alphare, #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


D12522: rust-dirstatemap: use `` instead of `HgPathBuf` in `copy_map_insert`

2022-04-12 Thread Raphaël Gomès
Alphare created this revision.
Herald added a reviewer: hg-reviewers.
Herald added a subscriber: mercurial-patches.

REVISION SUMMARY
  No reason to require an owned path here.

REPOSITORY
  rHG Mercurial

BRANCH
  default

REVISION DETAIL
  https://phab.mercurial-scm.org/D12522

AFFECTED FILES
  rust/hg-core/src/dirstate_tree/dirstate_map.rs
  rust/hg-cpython/src/dirstate/dirstate_map.rs

CHANGE DETAILS

diff --git a/rust/hg-cpython/src/dirstate/dirstate_map.rs 
b/rust/hg-cpython/src/dirstate/dirstate_map.rs
--- a/rust/hg-cpython/src/dirstate/dirstate_map.rs
+++ b/rust/hg-cpython/src/dirstate/dirstate_map.rs
@@ -23,13 +23,10 @@
 pybytes_deref::PyBytesDeref,
 };
 use hg::{
-dirstate::StateMapIter,
-dirstate_tree::on_disk::DirstateV2ParseError,
-dirstate_tree::owning::OwningDirstateMap,
-revlog::Node,
-utils::files::normalize_case,
-utils::hg_path::{HgPath, HgPathBuf},
-DirstateEntry, DirstateError, DirstateParents, EntryState,
+dirstate::StateMapIter, dirstate_tree::on_disk::DirstateV2ParseError,
+dirstate_tree::owning::OwningDirstateMap, revlog::Node,
+utils::files::normalize_case, utils::hg_path::HgPath, DirstateEntry,
+DirstateError, DirstateParents, EntryState,
 };
 
 // TODO
@@ -411,8 +408,8 @@
 self.inner(py)
 .borrow_mut()
 .copy_map_insert(
-HgPathBuf::from_bytes(key.data(py)),
-HgPathBuf::from_bytes(value.data(py)),
+HgPath::new(key.data(py)),
+HgPath::new(value.data(py)),
 )
 .map_err(|e| v2_error(py, e))?;
 Ok(py.None())
diff --git a/rust/hg-core/src/dirstate_tree/dirstate_map.rs 
b/rust/hg-core/src/dirstate_tree/dirstate_map.rs
--- a/rust/hg-core/src/dirstate_tree/dirstate_map.rs
+++ b/rust/hg-core/src/dirstate_tree/dirstate_map.rs
@@ -1284,8 +1284,8 @@
 
 pub fn copy_map_insert(
  self,
-key: HgPathBuf,
-value: HgPathBuf,
+key: ,
+value: ,
 ) -> Result, DirstateV2ParseError> {
 self.with_dmap_mut(|map| {
 let node = DirstateMap::get_or_insert_node(
@@ -1299,7 +1299,10 @@
 if node.copy_source.is_none() {
 map.nodes_with_copy_source_count += 1
 }
-Ok(node.copy_source.replace(value.into()).map(Cow::into_owned))
+Ok(node
+.copy_source
+.replace(value.to_owned().into())
+.map(Cow::into_owned))
 })
 }
 



To: Alphare, #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


D12521: rust-dirstatemap: use `DirstateEntry::tracked` directly

2022-04-12 Thread Raphaël Gomès
Alphare created this revision.
Herald added a reviewer: hg-reviewers.
Herald added a subscriber: mercurial-patches.

REVISION SUMMARY
  `state()` is a legacy API that will be removed at some point, let's use the
  newer API.

REPOSITORY
  rHG Mercurial

BRANCH
  default

REVISION DETAIL
  https://phab.mercurial-scm.org/D12521

AFFECTED FILES
  rust/hg-core/src/dirstate_tree/dirstate_map.rs

CHANGE DETAILS

diff --git a/rust/hg-core/src/dirstate_tree/dirstate_map.rs 
b/rust/hg-core/src/dirstate_tree/dirstate_map.rs
--- a/rust/hg-core/src/dirstate_tree/dirstate_map.rs
+++ b/rust/hg-core/src/dirstate_tree/dirstate_map.rs
@@ -988,9 +988,7 @@
  self,
 filename: ,
 ) -> Result<(), DirstateError> {
-let was_tracked = self
-.get(filename)?
-.map_or(false, |e| e.state().is_tracked());
+let was_tracked = self.get(filename)?.map_or(false, |e| e.tracked());
 struct Dropped {
 was_tracked: bool,
 had_entry: bool,



To: Alphare, #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


D12519: rust-dirstatemap: remove `set_dirstate_entry`/`set_entry` methods

2022-04-12 Thread Raphaël Gomès
Alphare created this revision.
Herald added a reviewer: hg-reviewers.
Herald added a subscriber: mercurial-patches.

REVISION SUMMARY
  These methods were needed crutches before the Rust implementation caught up
  to Python. Calling `set_entry` (whether from Python or Rust) was dangerous
  since it didn't update any of the counters of the DirstateMap data structure,
  while having no real way of knowing when to use it "correctly" except it you
  were one of the 3 people who looked deep enough into the soul of this code.

REPOSITORY
  rHG Mercurial

BRANCH
  default

REVISION DETAIL
  https://phab.mercurial-scm.org/D12519

AFFECTED FILES
  rust/hg-core/src/dirstate_tree/dirstate_map.rs
  rust/hg-cpython/src/dirstate/dirstate_map.rs

CHANGE DETAILS

diff --git a/rust/hg-cpython/src/dirstate/dirstate_map.rs 
b/rust/hg-cpython/src/dirstate/dirstate_map.rs
--- a/rust/hg-cpython/src/dirstate/dirstate_map.rs
+++ b/rust/hg-cpython/src/dirstate/dirstate_map.rs
@@ -104,20 +104,6 @@
 }
 }
 
-def set_dirstate_item(
-,
-path: PyObject,
-item: DirstateItem
-) -> PyResult {
-let f = path.extract::(py)?;
-let filename = HgPath::new(f.data(py));
-self.inner(py)
-.borrow_mut()
-.set_entry(filename, item.get_entry(py))
-.map_err(|e| v2_error(py, e))?;
-Ok(py.None())
-}
-
 def set_tracked(, f: PyObject) -> PyResult {
 let bytes = f.extract::(py)?;
 let path = HgPath::new(bytes.data(py));
diff --git a/rust/hg-core/src/dirstate_tree/dirstate_map.rs 
b/rust/hg-core/src/dirstate_tree/dirstate_map.rs
--- a/rust/hg-core/src/dirstate_tree/dirstate_map.rs
+++ b/rust/hg-core/src/dirstate_tree/dirstate_map.rs
@@ -884,17 +884,6 @@
 });
 }
 
-pub fn set_entry(
- self,
-filename: ,
-entry: DirstateEntry,
-) -> Result<(), DirstateV2ParseError> {
-self.with_dmap_mut(|map| {
-map.get_or_insert()?.data = NodeData::Entry(entry);
-Ok(())
-})
-}
-
 pub fn set_tracked(
  self,
 filename: ,



To: Alphare, #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


D12520: rust-cpython: remove unused API to `drop_entry_and_copy_source`

2022-04-12 Thread Raphaël Gomès
Alphare created this revision.
Herald added a reviewer: hg-reviewers.
Herald added a subscriber: mercurial-patches.

REVISION SUMMARY
  This is not used anywhere anymore and its use cases are covered by the new API

REPOSITORY
  rHG Mercurial

BRANCH
  default

REVISION DETAIL
  https://phab.mercurial-scm.org/D12520

AFFECTED FILES
  rust/hg-cpython/src/dirstate/dirstate_map.rs

CHANGE DETAILS

diff --git a/rust/hg-cpython/src/dirstate/dirstate_map.rs 
b/rust/hg-cpython/src/dirstate/dirstate_map.rs
--- a/rust/hg-cpython/src/dirstate/dirstate_map.rs
+++ b/rust/hg-cpython/src/dirstate/dirstate_map.rs
@@ -205,17 +205,6 @@
 Ok(PyNone)
 }
 
-def drop_item_and_copy_source(
-,
-f: PyBytes,
-) -> PyResult {
-self.inner(py)
-.borrow_mut()
-.drop_entry_and_copy_source(HgPath::new(f.data(py)))
-.map_err(|e |dirstate_error(py, e))?;
-Ok(PyNone)
-}
-
 def hastrackeddir(, d: PyObject) -> PyResult {
 let d = d.extract::(py)?;
 Ok(self.inner(py).borrow_mut()



To: Alphare, #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


D12518: rust-dirstatemap: implement part of the `setparents` logic

2022-04-12 Thread Raphaël Gomès
Alphare created this revision.
Herald added a reviewer: hg-reviewers.
Herald added a subscriber: mercurial-patches.

REVISION SUMMARY
  The Python code does many round-trip calls to the Rust dirstatemap when copy
  information needs to be dropped in `setparents`.
  
  This may result in improved performance on `commit`, `update` and other such
  commands, but was mostly done to drop the last use of `set_dirstate_item`.
  See inline comments for an asterisk about performance, and see next patch for
  why `set_dirstate_item` has to go.

REPOSITORY
  rHG Mercurial

BRANCH
  default

REVISION DETAIL
  https://phab.mercurial-scm.org/D12518

AFFECTED FILES
  mercurial/dirstatemap.py
  rust/hg-core/src/dirstate_tree/dirstate_map.rs
  rust/hg-cpython/src/dirstate/dirstate_map.rs

CHANGE DETAILS

diff --git a/rust/hg-cpython/src/dirstate/dirstate_map.rs 
b/rust/hg-cpython/src/dirstate/dirstate_map.rs
--- a/rust/hg-cpython/src/dirstate/dirstate_map.rs
+++ b/rust/hg-cpython/src/dirstate/dirstate_map.rs
@@ -489,6 +489,19 @@
 Ok(dirs)
 }
 
+def setparents_fixup() -> PyResult {
+let dict = PyDict::new(py);
+let copies = self.inner(py).borrow_mut().setparents_fixup();
+for (key, value) in copies.map_err(|e| v2_error(py, e))? {
+dict.set_item(
+py,
+PyBytes::new(py, key.as_bytes()),
+PyBytes::new(py, value.as_bytes()),
+)?;
+}
+Ok(dict)
+}
+
 def debug_iter(, all: bool) -> PyResult {
 let dirs = PyList::new(py, &[]);
 for item in self.inner(py).borrow().debug_iter(all) {
diff --git a/rust/hg-core/src/dirstate_tree/dirstate_map.rs 
b/rust/hg-core/src/dirstate_tree/dirstate_map.rs
--- a/rust/hg-core/src/dirstate_tree/dirstate_map.rs
+++ b/rust/hg-core/src/dirstate_tree/dirstate_map.rs
@@ -1375,6 +1375,41 @@
 )))
 }
 
+/// Only public because it needs to be exposed to the Python layer.
+/// It is not the full `setparents` logic, only the parts that mutate the
+/// entries.
+pub fn setparents_fixup(
+ self,
+) -> Result, DirstateV2ParseError> {
+// XXX
+// All the copying and re-querying is quite inefficient, but this is
+// still a lot better than doing it from Python.
+//
+// The better solution is to develop a mechanism for `iter_mut`,
+// which will be a lot more involved: we're dealing with a lazy,
+// append-mostly, tree-like data structure. This will do for now.
+let mut copies = vec![];
+let mut files_with_p2_info = vec![];
+for res in self.iter() {
+let (path, entry) = res?;
+if entry.p2_info() {
+files_with_p2_info.push(path.to_owned())
+}
+}
+self.with_dmap_mut(|map| {
+for path in files_with_p2_info.iter() {
+let node = map.get_or_insert(path)?;
+let entry =
+node.data.as_entry_mut().expect("entry should exist");
+entry.drop_merge_data();
+if let Some(source) = node.copy_source.take().as_deref() {
+copies.push((path.to_owned(), source.to_owned()));
+}
+}
+Ok(copies)
+})
+}
+
 pub fn debug_iter(
 ,
 all: bool,
diff --git a/mercurial/dirstatemap.py b/mercurial/dirstatemap.py
--- a/mercurial/dirstatemap.py
+++ b/mercurial/dirstatemap.py
@@ -593,22 +593,7 @@
 self._dirtyparents = True
 copies = {}
 if fold_p2:
-# Collect into an intermediate list to avoid a `RuntimeError`
-# exception due to mutation during iteration.
-# TODO: move this the whole loop to Rust where `iter_mut`
-# enables in-place mutation of elements of a collection while
-# iterating it, without mutating the collection itself.
-files_with_p2_info = [
-f for f, s in self._map.items() if s.p2_info
-]
-rust_map = self._map
-for f in files_with_p2_info:
-e = rust_map.get(f)
-source = self.copymap.pop(f, None)
-if source:
-copies[f] = source
-e.drop_merge_data()
-rust_map.set_dirstate_item(f, e)
+copies = self._map.setparents_fixup()
 return copies
 
 ### disk interaction



To: Alphare, #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


D12517: dirstate-item: add missing bit of docstring

2022-04-12 Thread Raphaël Gomès
Alphare 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/D12517

AFFECTED FILES
  mercurial/pure/parsers.py

CHANGE DETAILS

diff --git a/mercurial/pure/parsers.py b/mercurial/pure/parsers.py
--- a/mercurial/pure/parsers.py
+++ b/mercurial/pure/parsers.py
@@ -278,7 +278,7 @@
 self._mtime_ns = None
 
 def drop_merge_data(self):
-"""remove all "merge-only" from a DirstateItem
+"""remove all "merge-only" information from a DirstateItem
 
 This is to be call by the dirstatemap code when the second parent is 
dropped
 """



To: Alphare, #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


D12516: dirstatemap: move `_dirs_incr` and `_dirs_decr` methods out of the common

2022-04-12 Thread Raphaël Gomès
Alphare created this revision.
Herald added a reviewer: hg-reviewers.
Herald added a subscriber: mercurial-patches.

REVISION SUMMARY
  They are only used by the Python implementation now

REPOSITORY
  rHG Mercurial

BRANCH
  default

REVISION DETAIL
  https://phab.mercurial-scm.org/D12516

AFFECTED FILES
  mercurial/dirstatemap.py

CHANGE DETAILS

diff --git a/mercurial/dirstatemap.py b/mercurial/dirstatemap.py
--- a/mercurial/dirstatemap.py
+++ b/mercurial/dirstatemap.py
@@ -79,25 +79,6 @@
 def __getitem__(self, item):
 return self._map[item]
 
-### sub-class utility method
-#
-# Use to allow for generic implementation of some method while still coping
-# with minor difference between implementation.
-
-def _dirs_incr(self, filename, old_entry=None):
-"""increment the dirstate counter if applicable
-
-This might be a no-op for some subclasses who deal with directory
-tracking in a different way.
-"""
-
-def _dirs_decr(self, filename, old_entry=None, remove_variant=False):
-"""decrement the dirstate counter if applicable
-
-This might be a no-op for some subclasses who deal with directory
-tracking in a different way.
-"""
-
 ### disk interaction
 
 def _opendirstatefile(self):
@@ -354,7 +335,7 @@
 # (e.g. "has_dir")
 
 def _dirs_incr(self, filename, old_entry=None):
-"""incremente the dirstate counter if applicable"""
+"""increment the dirstate counter if applicable"""
 if (
 old_entry is None or old_entry.removed
 ) and "_dirs" in self.__dict__:
@@ -363,7 +344,7 @@
 self._alldirs.addpath(filename)
 
 def _dirs_decr(self, filename, old_entry=None, remove_variant=False):
-"""decremente the dirstate counter if applicable"""
+"""decrement the dirstate counter if applicable"""
 if old_entry is not None:
 if "_dirs" in self.__dict__ and not old_entry.removed:
 self._dirs.delpath(filename)



To: Alphare, #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


D12515: dirstatemap: move `_refresh_entry` out of the common methods

2022-04-12 Thread Raphaël Gomès
Alphare created this revision.
Herald added a reviewer: hg-reviewers.
Herald added a subscriber: mercurial-patches.

REVISION SUMMARY
  This is only used in the Python implementation now

REPOSITORY
  rHG Mercurial

BRANCH
  default

REVISION DETAIL
  https://phab.mercurial-scm.org/D12515

AFFECTED FILES
  mercurial/dirstatemap.py

CHANGE DETAILS

diff --git a/mercurial/dirstatemap.py b/mercurial/dirstatemap.py
--- a/mercurial/dirstatemap.py
+++ b/mercurial/dirstatemap.py
@@ -98,9 +98,6 @@
 tracking in a different way.
 """
 
-def _refresh_entry(self, f, entry):
-"""record updated state of an entry"""
-
 ### disk interaction
 
 def _opendirstatefile(self):
@@ -523,6 +520,7 @@
 self._refresh_entry(filename, entry)
 
 def _refresh_entry(self, f, entry):
+"""record updated state of an entry"""
 if not entry.any_tracked:
 self._map.pop(f, None)
 



To: Alphare, #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


D12514: dirstatemap: move `_drop_entry` out of the common methods

2022-04-12 Thread Raphaël Gomès
Alphare created this revision.
Herald added a reviewer: hg-reviewers.
Herald added a subscriber: mercurial-patches.

REVISION SUMMARY
  Only the Python implementation uses it.

REPOSITORY
  rHG Mercurial

BRANCH
  default

REVISION DETAIL
  https://phab.mercurial-scm.org/D12514

AFFECTED FILES
  mercurial/dirstatemap.py

CHANGE DETAILS

diff --git a/mercurial/dirstatemap.py b/mercurial/dirstatemap.py
--- a/mercurial/dirstatemap.py
+++ b/mercurial/dirstatemap.py
@@ -101,13 +101,6 @@
 def _refresh_entry(self, f, entry):
 """record updated state of an entry"""
 
-def _drop_entry(self, f):
-"""remove any entry for file f
-
-This should also drop associated copy information
-
-The fact we actually need to drop it is the responsability of the 
caller"""
-
 ### disk interaction
 
 def _opendirstatefile(self):
@@ -534,6 +527,11 @@
 self._map.pop(f, None)
 
 def _drop_entry(self, f):
+"""remove any entry for file f
+
+This should also drop associated copy information
+
+The fact we actually need to drop it is the responsability of the 
caller"""
 self._map.pop(f, None)
 self.copymap.pop(f, None)
 



To: Alphare, #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


D12513: rust-dirstatemap: remove `_drop_entry`

2022-04-12 Thread Raphaël Gomès
Alphare created this revision.
Herald added a reviewer: hg-reviewers.
Herald added a subscriber: mercurial-patches.

REVISION SUMMARY
  This is not used anywhere anymore

REPOSITORY
  rHG Mercurial

BRANCH
  default

REVISION DETAIL
  https://phab.mercurial-scm.org/D12513

AFFECTED FILES
  mercurial/dirstatemap.py

CHANGE DETAILS

diff --git a/mercurial/dirstatemap.py b/mercurial/dirstatemap.py
--- a/mercurial/dirstatemap.py
+++ b/mercurial/dirstatemap.py
@@ -730,6 +730,3 @@
 has_meaningful_mtime,
 parentfiledata,
 )
-
-def _drop_entry(self, f):
-self._map.drop_item_and_copy_source(f)



To: Alphare, #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


D12512: rust-dirstatemap: remove `__settitem__`

2022-04-12 Thread Raphaël Gomès
Alphare created this revision.
Herald added a reviewer: hg-reviewers.
Herald added a subscriber: mercurial-patches.

REVISION SUMMARY
  This is not used anywhere now.

REPOSITORY
  rHG Mercurial

BRANCH
  default

REVISION DETAIL
  https://phab.mercurial-scm.org/D12512

AFFECTED FILES
  mercurial/dirstatemap.py

CHANGE DETAILS

diff --git a/mercurial/dirstatemap.py b/mercurial/dirstatemap.py
--- a/mercurial/dirstatemap.py
+++ b/mercurial/dirstatemap.py
@@ -733,7 +733,3 @@
 
 def _drop_entry(self, f):
 self._map.drop_item_and_copy_source(f)
-
-def __setitem__(self, key, value):
-assert isinstance(value, DirstateItem)
-self._map.set_dirstate_item(key, value)



To: Alphare, #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


D12511: rust-dirstatemap: remove unused `_refresh_entry` implementation

2022-04-12 Thread Raphaël Gomès
Alphare created this revision.
Herald added a reviewer: hg-reviewers.
Herald added a subscriber: mercurial-patches.

REVISION SUMMARY
  This was only used in the newer APIs, all of which have been rewritten in Rust

REPOSITORY
  rHG Mercurial

BRANCH
  default

REVISION DETAIL
  https://phab.mercurial-scm.org/D12511

AFFECTED FILES
  mercurial/dirstatemap.py

CHANGE DETAILS

diff --git a/mercurial/dirstatemap.py b/mercurial/dirstatemap.py
--- a/mercurial/dirstatemap.py
+++ b/mercurial/dirstatemap.py
@@ -701,12 +701,6 @@
 
 ### code related to manipulation of entries and copy-sources
 
-def _refresh_entry(self, f, entry):
-if not entry.any_tracked:
-self._map.drop_item_and_copy_source(f)
-else:
-self._map.addfile(f, entry)
-
 def set_tracked(self, f):
 return self._map.set_tracked(f)
 



To: Alphare, #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


D12510: rust-distatemap: remove `addfile` API

2022-04-12 Thread Raphaël Gomès
Alphare created this revision.
Herald added a reviewer: hg-reviewers.
Herald added a subscriber: mercurial-patches.

REVISION SUMMARY
  All of its users have been migrated to the new API

REPOSITORY
  rHG Mercurial

BRANCH
  default

REVISION DETAIL
  https://phab.mercurial-scm.org/D12510

AFFECTED FILES
  rust/hg-core/src/dirstate_tree/dirstate_map.rs
  rust/hg-cpython/src/dirstate/dirstate_map.rs

CHANGE DETAILS

diff --git a/rust/hg-cpython/src/dirstate/dirstate_map.rs 
b/rust/hg-cpython/src/dirstate/dirstate_map.rs
--- a/rust/hg-cpython/src/dirstate/dirstate_map.rs
+++ b/rust/hg-cpython/src/dirstate/dirstate_map.rs
@@ -118,20 +118,6 @@
 Ok(py.None())
 }
 
-def addfile(
-,
-f: PyBytes,
-item: DirstateItem,
-) -> PyResult {
-let filename = HgPath::new(f.data(py));
-let entry = item.get_entry(py);
-self.inner(py)
-.borrow_mut()
-.add_file(filename, entry)
-.map_err(|e |dirstate_error(py, e))?;
-Ok(PyNone)
-}
-
 def set_tracked(, f: PyObject) -> PyResult {
 let bytes = f.extract::(py)?;
 let path = HgPath::new(bytes.data(py));
diff --git a/rust/hg-core/src/dirstate_tree/dirstate_map.rs 
b/rust/hg-core/src/dirstate_tree/dirstate_map.rs
--- a/rust/hg-core/src/dirstate_tree/dirstate_map.rs
+++ b/rust/hg-core/src/dirstate_tree/dirstate_map.rs
@@ -727,49 +727,6 @@
 Ok(new)
 }
 
-fn add_or_remove_file(
- self,
-path: ,
-old_state: Option,
-new_entry: DirstateEntry,
-) -> Result<(), DirstateV2ParseError> {
-let had_entry = old_state.is_some();
-let was_tracked = old_state.map_or(false, |s| s.is_tracked());
-let tracked_count_increment =
-match (was_tracked, new_entry.state().is_tracked()) {
-(false, true) => 1,
-(true, false) => -1,
-_ => 0,
-};
-
-let node = Self::get_or_insert_node(
-self.on_disk,
- self.unreachable_bytes,
- self.root,
-path,
-WithBasename::to_cow_owned,
-|ancestor| {
-if !had_entry {
-ancestor.descendants_with_entry_count += 1;
-}
-
-// We can’t use `+= increment` because the counter is unsigned,
-// and we want debug builds to detect accidental underflow
-// through zero
-match tracked_count_increment {
-1 => ancestor.tracked_descendants_count += 1,
--1 => ancestor.tracked_descendants_count -= 1,
-_ => {}
-}
-},
-)?;
-if !had_entry {
-self.nodes_with_entry_count += 1
-}
-node.data = NodeData::Entry(new_entry);
-Ok(())
-}
-
 /// It is the responsibility of the caller to know that there was an entry
 /// there before. Does not handle the removal of copy source
 fn set_untracked(
@@ -938,17 +895,6 @@
 })
 }
 
-pub fn add_file(
- self,
-filename: ,
-entry: DirstateEntry,
-) -> Result<(), DirstateError> {
-let old_state = self.get(filename)?.map(|e| e.state());
-self.with_dmap_mut(|map| {
-Ok(map.add_or_remove_file(filename, old_state, entry)?)
-})
-}
-
 pub fn set_tracked(
  self,
 filename: ,



To: Alphare, #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


D12509: rust-dirstatemap: remove `removefile` API

2022-04-12 Thread Raphaël Gomès
Alphare created this revision.
Herald added a reviewer: hg-reviewers.
Herald added a subscriber: mercurial-patches.

REVISION SUMMARY
  Its callers have been migrated to the newer dirstate API.

REPOSITORY
  rHG Mercurial

BRANCH
  default

REVISION DETAIL
  https://phab.mercurial-scm.org/D12509

AFFECTED FILES
  rust/hg-core/src/dirstate_tree/dirstate_map.rs
  rust/hg-cpython/src/dirstate/dirstate_map.rs

CHANGE DETAILS

diff --git a/rust/hg-cpython/src/dirstate/dirstate_map.rs 
b/rust/hg-cpython/src/dirstate/dirstate_map.rs
--- a/rust/hg-cpython/src/dirstate/dirstate_map.rs
+++ b/rust/hg-cpython/src/dirstate/dirstate_map.rs
@@ -233,25 +233,6 @@
 Ok(PyNone)
 }
 
-def removefile(
-,
-f: PyObject,
-in_merge: PyObject
-) -> PyResult {
-self.inner(py).borrow_mut()
-.remove_file(
-HgPath::new(f.extract::(py)?.data(py)),
-in_merge.extract::(py)?.is_true(),
-)
-.or_else(|_| {
-Err(PyErr::new::(
-py,
-"Dirstate error".to_string(),
-))
-})?;
-Ok(py.None())
-}
-
 def drop_item_and_copy_source(
 ,
 f: PyBytes,
diff --git a/rust/hg-core/src/dirstate_tree/dirstate_map.rs 
b/rust/hg-core/src/dirstate_tree/dirstate_map.rs
--- a/rust/hg-core/src/dirstate_tree/dirstate_map.rs
+++ b/rust/hg-core/src/dirstate_tree/dirstate_map.rs
@@ -15,8 +15,6 @@
 use crate::dirstate::ParentFileData;
 use crate::dirstate::StateMapIter;
 use crate::dirstate::TruncatedTimestamp;
-use crate::dirstate::SIZE_FROM_OTHER_PARENT;
-use crate::dirstate::SIZE_NON_NORMAL;
 use crate::matchers::Matcher;
 use crate::utils::hg_path::{HgPath, HgPathBuf};
 use crate::DirstateEntry;
@@ -1051,40 +1049,6 @@
 })
 }
 
-pub fn remove_file(
- self,
-filename: ,
-in_merge: bool,
-) -> Result<(), DirstateError> {
-let old_entry_opt = self.get(filename)?;
-let old_state = old_entry_opt.map(|e| e.state());
-let mut size = 0;
-if in_merge {
-// XXX we should not be able to have 'm' state and 'FROM_P2' if not
-// during a merge. So I (marmoute) am not sure we need the
-// conditionnal at all. Adding double checking this with assert
-// would be nice.
-if let Some(old_entry) = old_entry_opt {
-// backup the previous state
-if old_entry.state() == EntryState::Merged {
-size = SIZE_NON_NORMAL;
-} else if old_entry.state() == EntryState::Normal
-&& old_entry.size() == SIZE_FROM_OTHER_PARENT
-{
-// other parent
-size = SIZE_FROM_OTHER_PARENT;
-}
-}
-}
-if size == 0 {
-self.copy_map_remove(filename)?;
-}
-self.with_dmap_mut(|map| {
-let entry = DirstateEntry::new_removed(size);
-Ok(map.add_or_remove_file(filename, old_state, entry)?)
-})
-}
-
 pub fn drop_entry_and_copy_source(
  self,
 filename: ,



To: Alphare, #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


D12508: rhg: use the new `set_clean` API

2022-04-12 Thread Raphaël Gomès
Alphare 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/D12508

AFFECTED FILES
  rust/rhg/src/commands/status.rs

CHANGE DETAILS

diff --git a/rust/rhg/src/commands/status.rs b/rust/rhg/src/commands/status.rs
--- a/rust/rhg/src/commands/status.rs
+++ b/rust/rhg/src/commands/status.rs
@@ -15,7 +15,6 @@
 use hg::dirstate::has_exec_bit;
 use hg::dirstate::status::StatusPath;
 use hg::dirstate::TruncatedTimestamp;
-use hg::dirstate::RANGE_MASK_31BIT;
 use hg::errors::{HgError, IoResultExt};
 use hg::lock::LockError;
 use hg::manifest::Manifest;
@@ -390,12 +389,8 @@
 .when_reading_file(_path)?
 {
 let mode = fs_metadata.mode();
-let size = fs_metadata.len() as u32 & RANGE_MASK_31BIT;
-let mut entry = dmap
-.get(_path)?
-.expect("ambiguous file not in dirstate");
-entry.set_clean(mode, size, mtime);
-dmap.add_file(_path, entry)?;
+let size = fs_metadata.len();
+dmap.set_clean(_path, mode, size as u32, mtime)?;
 dirstate_write_needed = true
 }
 }



To: Alphare, #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


D12506: rust-dirstatemap: add `set_untracked` method

2022-04-12 Thread Raphaël Gomès
Alphare created this revision.
Herald added a reviewer: hg-reviewers.
Herald added a subscriber: mercurial-patches.

REVISION SUMMARY
  This is the new API that Python has already migrated to

REPOSITORY
  rHG Mercurial

BRANCH
  default

REVISION DETAIL
  https://phab.mercurial-scm.org/D12506

AFFECTED FILES
  rust/hg-core/src/dirstate_tree/dirstate_map.rs
  rust/hg-cpython/src/dirstate/dirstate_map.rs

CHANGE DETAILS

diff --git a/rust/hg-cpython/src/dirstate/dirstate_map.rs 
b/rust/hg-cpython/src/dirstate/dirstate_map.rs
--- a/rust/hg-cpython/src/dirstate/dirstate_map.rs
+++ b/rust/hg-cpython/src/dirstate/dirstate_map.rs
@@ -142,6 +142,16 @@
 Ok(was_tracked.to_py_object(py))
 }
 
+def set_untracked(, f: PyObject) -> PyResult {
+let bytes = f.extract::(py)?;
+let path = HgPath::new(bytes.data(py));
+let res = self.inner(py).borrow_mut().set_untracked(path);
+let was_tracked = res.or_else(|_| {
+Err(PyErr::new::(py, "Dirstate 
error".to_string()))
+})?;
+Ok(was_tracked.to_py_object(py))
+}
+
 def set_clean(
 ,
 f: PyObject,
diff --git a/rust/hg-core/src/dirstate_tree/dirstate_map.rs 
b/rust/hg-core/src/dirstate_tree/dirstate_map.rs
--- a/rust/hg-core/src/dirstate_tree/dirstate_map.rs
+++ b/rust/hg-core/src/dirstate_tree/dirstate_map.rs
@@ -772,6 +772,32 @@
 Ok(())
 }
 
+/// It is the responsibility of the caller to know that there was an entry
+/// there before. Does not handle the removal of copy source
+fn set_untracked(
+ self,
+filename: ,
+old_entry: DirstateEntry,
+) -> Result<(), DirstateV2ParseError> {
+let node = Self::get_or_insert_node(
+self.on_disk,
+ self.unreachable_bytes,
+ self.root,
+filename,
+WithBasename::to_cow_owned,
+|ancestor| {
+ancestor.tracked_descendants_count = ancestor
+.tracked_descendants_count
+.checked_sub(1)
+.expect("tracked_descendants_count should be >= 0");
+},
+)?;
+let mut new_entry = old_entry.clone();
+new_entry.set_untracked();
+node.data = NodeData::Entry(new_entry);
+Ok(())
+}
+
 fn set_clean(
  self,
 filename: ,
@@ -933,6 +959,39 @@
 self.with_dmap_mut(|map| map.set_tracked(filename, old_entry_opt))
 }
 
+pub fn set_untracked(
+ self,
+filename: ,
+) -> Result {
+let old_entry_opt = self.get(filename)?;
+match old_entry_opt {
+None => Ok(false),
+Some(old_entry) => {
+if !old_entry.tracked() {
+// `DirstateMap::set_untracked` is not a noop if
+// already not tracked as it will decrement the
+// tracked counters while going down.
+return Ok(true);
+}
+if old_entry.added() {
+// Untracking an "added" entry will just result in a
+// worthless entry (and other parts of the code will
+// complain about it), just drop it entirely.
+self.drop_entry_and_copy_source(filename)?;
+return Ok(true);
+}
+if !old_entry.p2_info() {
+self.copy_map_remove(filename)?;
+}
+
+self.with_dmap_mut(|map| {
+map.set_untracked(filename, old_entry)?;
+Ok(true)
+})
+}
+}
+}
+
 pub fn set_clean(
  self,
 filename: ,



To: Alphare, #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


D12507: dirstatemap: move `set_untracked` out of the common methods

2022-04-12 Thread Raphaël Gomès
Alphare created this revision.
Herald added a reviewer: hg-reviewers.
Herald added a subscriber: mercurial-patches.

REVISION SUMMARY
  There is a dedicated Rust implementation now

REPOSITORY
  rHG Mercurial

BRANCH
  default

REVISION DETAIL
  https://phab.mercurial-scm.org/D12507

AFFECTED FILES
  mercurial/dirstatemap.py

CHANGE DETAILS

diff --git a/mercurial/dirstatemap.py b/mercurial/dirstatemap.py
--- a/mercurial/dirstatemap.py
+++ b/mercurial/dirstatemap.py
@@ -108,21 +108,6 @@
 
 The fact we actually need to drop it is the responsability of the 
caller"""
 
-### method to manipulate the entries
-
-def set_untracked(self, f):
-"""Mark a file as no longer tracked in the dirstate map"""
-entry = self.get(f)
-if entry is None:
-return False
-else:
-self._dirs_decr(f, old_entry=entry, remove_variant=not entry.added)
-if not entry.p2_info:
-self.copymap.pop(f, None)
-entry.set_untracked()
-self._refresh_entry(f, entry)
-return True
-
 ### disk interaction
 
 def _opendirstatefile(self):
@@ -517,6 +502,19 @@
 self._refresh_entry(filename, entry)
 return new
 
+def set_untracked(self, f):
+"""Mark a file as no longer tracked in the dirstate map"""
+entry = self.get(f)
+if entry is None:
+return False
+else:
+self._dirs_decr(f, old_entry=entry, remove_variant=not entry.added)
+if not entry.p2_info:
+self.copymap.pop(f, None)
+entry.set_untracked()
+self._refresh_entry(f, entry)
+return True
+
 def set_clean(self, filename, mode, size, mtime):
 """mark a file as back to a clean state"""
 entry = self[filename]
@@ -712,6 +710,9 @@
 def set_tracked(self, f):
 return self._map.set_tracked(f)
 
+def set_untracked(self, f):
+return self._map.set_untracked(f)
+
 def set_clean(self, filename, mode, size, mtime):
 self._map.set_clean(filename, mode, size, mtime)
 



To: Alphare, #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


D12505: dirstatemap: move `set_possibly_dirty` out of the common methods

2022-04-12 Thread Raphaël Gomès
Alphare created this revision.
Herald added a reviewer: hg-reviewers.
Herald added a subscriber: mercurial-patches.

REVISION SUMMARY
  There exists now a dedicated Rust implementation

REPOSITORY
  rHG Mercurial

BRANCH
  default

REVISION DETAIL
  https://phab.mercurial-scm.org/D12505

AFFECTED FILES
  mercurial/dirstatemap.py

CHANGE DETAILS

diff --git a/mercurial/dirstatemap.py b/mercurial/dirstatemap.py
--- a/mercurial/dirstatemap.py
+++ b/mercurial/dirstatemap.py
@@ -110,12 +110,6 @@
 
 ### method to manipulate the entries
 
-def set_possibly_dirty(self, filename):
-"""record that the current state of the file on disk is unknown"""
-entry = self[filename]
-entry.set_possibly_dirty()
-self._refresh_entry(filename, entry)
-
 def set_untracked(self, f):
 """Mark a file as no longer tracked in the dirstate map"""
 entry = self.get(f)
@@ -531,6 +525,12 @@
 self._refresh_entry(filename, entry)
 self.copymap.pop(filename, None)
 
+def set_possibly_dirty(self, filename):
+"""record that the current state of the file on disk is unknown"""
+entry = self[filename]
+entry.set_possibly_dirty()
+self._refresh_entry(filename, entry)
+
 def _refresh_entry(self, f, entry):
 if not entry.any_tracked:
 self._map.pop(f, None)
@@ -715,6 +715,9 @@
 def set_clean(self, filename, mode, size, mtime):
 self._map.set_clean(filename, mode, size, mtime)
 
+def set_possibly_dirty(self, f):
+self._map.set_possibly_dirty(f)
+
 def reset_state(
 self,
 filename,



To: Alphare, #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


D12504: rust-dirstatemap: add `set_possibly_dirty` method

2022-04-12 Thread Raphaël Gomès
Alphare created this revision.
Herald added a reviewer: hg-reviewers.
Herald added a subscriber: mercurial-patches.

REVISION SUMMARY
  This is the new API that Python has already migrated to.

REPOSITORY
  rHG Mercurial

BRANCH
  default

REVISION DETAIL
  https://phab.mercurial-scm.org/D12504

AFFECTED FILES
  rust/hg-core/src/dirstate_tree/dirstate_map.rs
  rust/hg-cpython/src/dirstate/dirstate_map.rs

CHANGE DETAILS

diff --git a/rust/hg-cpython/src/dirstate/dirstate_map.rs 
b/rust/hg-cpython/src/dirstate/dirstate_map.rs
--- a/rust/hg-cpython/src/dirstate/dirstate_map.rs
+++ b/rust/hg-cpython/src/dirstate/dirstate_map.rs
@@ -164,6 +164,16 @@
 Ok(PyNone)
 }
 
+def set_possibly_dirty(, f: PyObject) -> PyResult {
+let bytes = f.extract::(py)?;
+let path = HgPath::new(bytes.data(py));
+let res = self.inner(py).borrow_mut().set_possibly_dirty(path);
+res.or_else(|_| {
+Err(PyErr::new::(py, "Dirstate 
error".to_string()))
+})?;
+Ok(PyNone)
+}
+
 def reset_state(
 ,
 f: PyObject,
diff --git a/rust/hg-core/src/dirstate_tree/dirstate_map.rs 
b/rust/hg-core/src/dirstate_tree/dirstate_map.rs
--- a/rust/hg-core/src/dirstate_tree/dirstate_map.rs
+++ b/rust/hg-core/src/dirstate_tree/dirstate_map.rs
@@ -427,6 +427,13 @@
 _ => None,
 }
 }
+
+fn as_entry_mut( self) -> Option< DirstateEntry> {
+match self {
+NodeData::Entry(entry) => Some(entry),
+_ => None,
+}
+}
 }
 
 impl<'on_disk> DirstateMap<'on_disk> {
@@ -791,6 +798,24 @@
 Ok(())
 }
 
+fn set_possibly_dirty(
+ self,
+filename: ,
+) -> Result<(), DirstateError> {
+let node = Self::get_or_insert_node(
+self.on_disk,
+ self.unreachable_bytes,
+ self.root,
+filename,
+WithBasename::to_cow_owned,
+|_ancestor| {},
+)?;
+let entry = node.data.as_entry_mut().expect("entry should exist");
+entry.set_possibly_dirty();
+node.data = NodeData::Entry(*entry);
+Ok(())
+}
+
 fn iter_nodes<'tree>(
 &'tree self,
 ) -> impl Iterator<
@@ -929,6 +954,16 @@
 })
 }
 
+pub fn set_possibly_dirty(
+ self,
+filename: ,
+) -> Result<(), DirstateError> {
+if self.get(filename)?.is_none() {
+return Err(DirstateMapError::PathNotFound(filename.into()).into());
+}
+self.with_dmap_mut(|map| map.set_possibly_dirty(filename))
+}
+
 pub fn reset_state(
  self,
 filename: ,



To: Alphare, #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


D12502: rust-dirstatemap: add `set_clean` method

2022-04-12 Thread Raphaël Gomès
Alphare created this revision.
Herald added a reviewer: hg-reviewers.
Herald added a subscriber: mercurial-patches.

REVISION SUMMARY
  This is the new dirstate API that has already been moved to in Python.

REPOSITORY
  rHG Mercurial

BRANCH
  default

REVISION DETAIL
  https://phab.mercurial-scm.org/D12502

AFFECTED FILES
  rust/hg-core/src/dirstate_tree/dirstate_map.rs
  rust/hg-cpython/src/dirstate/dirstate_map.rs

CHANGE DETAILS

diff --git a/rust/hg-cpython/src/dirstate/dirstate_map.rs 
b/rust/hg-cpython/src/dirstate/dirstate_map.rs
--- a/rust/hg-cpython/src/dirstate/dirstate_map.rs
+++ b/rust/hg-cpython/src/dirstate/dirstate_map.rs
@@ -142,6 +142,28 @@
 Ok(was_tracked.to_py_object(py))
 }
 
+def set_clean(
+,
+f: PyObject,
+mode: u32,
+size: u32,
+mtime: (i64, u32, bool)
+) -> PyResult {
+let (mtime_s, mtime_ns, second_ambiguous) = mtime;
+let timestamp = TruncatedTimestamp::new_truncate(
+mtime_s, mtime_ns, second_ambiguous
+);
+let bytes = f.extract::(py)?;
+let path = HgPath::new(bytes.data(py));
+let res = self.inner(py).borrow_mut().set_clean(
+path, mode, size, timestamp,
+);
+res.or_else(|_| {
+Err(PyErr::new::(py, "Dirstate 
error".to_string()))
+})?;
+Ok(PyNone)
+}
+
 def reset_state(
 ,
 f: PyObject,
diff --git a/rust/hg-core/src/dirstate_tree/dirstate_map.rs 
b/rust/hg-core/src/dirstate_tree/dirstate_map.rs
--- a/rust/hg-core/src/dirstate_tree/dirstate_map.rs
+++ b/rust/hg-core/src/dirstate_tree/dirstate_map.rs
@@ -21,6 +21,7 @@
 use crate::utils::hg_path::{HgPath, HgPathBuf};
 use crate::DirstateEntry;
 use crate::DirstateError;
+use crate::DirstateMapError;
 use crate::DirstateParents;
 use crate::DirstateStatus;
 use crate::EntryState;
@@ -764,6 +765,32 @@
 Ok(())
 }
 
+fn set_clean(
+ self,
+filename: ,
+old_entry: DirstateEntry,
+mode: u32,
+size: u32,
+mtime: TruncatedTimestamp,
+) -> Result<(), DirstateError> {
+let node = Self::get_or_insert_node(
+self.on_disk,
+ self.unreachable_bytes,
+ self.root,
+filename,
+WithBasename::to_cow_owned,
+|ancestor| {
+if !old_entry.tracked() {
+ancestor.tracked_descendants_count += 1;
+}
+},
+)?;
+let mut new_entry = old_entry.clone();
+new_entry.set_clean(mode, size, mtime);
+node.data = NodeData::Entry(new_entry);
+Ok(())
+}
+
 fn iter_nodes<'tree>(
 &'tree self,
 ) -> impl Iterator<
@@ -881,6 +908,27 @@
 self.with_dmap_mut(|map| map.set_tracked(filename, old_entry_opt))
 }
 
+pub fn set_clean(
+ self,
+filename: ,
+mode: u32,
+size: u32,
+mtime: TruncatedTimestamp,
+) -> Result<(), DirstateError> {
+let old_entry = match self.get(filename)? {
+None => {
+return Err(
+DirstateMapError::PathNotFound(filename.into()).into()
+)
+}
+Some(e) => e,
+};
+self.copy_map_remove(filename)?;
+self.with_dmap_mut(|map| {
+map.set_clean(filename, old_entry, mode, size, mtime)
+})
+}
+
 pub fn reset_state(
  self,
 filename: ,



To: Alphare, #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


D12503: dirstatemap: move `set_clean` out of common methods

2022-04-12 Thread Raphaël Gomès
Alphare created this revision.
Herald added a reviewer: hg-reviewers.
Herald added a subscriber: mercurial-patches.

REVISION SUMMARY
  This now has a dedicated Rust implementation

REPOSITORY
  rHG Mercurial

BRANCH
  default

REVISION DETAIL
  https://phab.mercurial-scm.org/D12503

AFFECTED FILES
  mercurial/dirstatemap.py

CHANGE DETAILS

diff --git a/mercurial/dirstatemap.py b/mercurial/dirstatemap.py
--- a/mercurial/dirstatemap.py
+++ b/mercurial/dirstatemap.py
@@ -116,14 +116,6 @@
 entry.set_possibly_dirty()
 self._refresh_entry(filename, entry)
 
-def set_clean(self, filename, mode, size, mtime):
-"""mark a file as back to a clean state"""
-entry = self[filename]
-size = size & rangemask
-entry.set_clean(mode, size, mtime)
-self._refresh_entry(filename, entry)
-self.copymap.pop(filename, None)
-
 def set_untracked(self, f):
 """Mark a file as no longer tracked in the dirstate map"""
 entry = self.get(f)
@@ -531,6 +523,14 @@
 self._refresh_entry(filename, entry)
 return new
 
+def set_clean(self, filename, mode, size, mtime):
+"""mark a file as back to a clean state"""
+entry = self[filename]
+size = size & rangemask
+entry.set_clean(mode, size, mtime)
+self._refresh_entry(filename, entry)
+self.copymap.pop(filename, None)
+
 def _refresh_entry(self, f, entry):
 if not entry.any_tracked:
 self._map.pop(f, None)
@@ -712,6 +712,9 @@
 def set_tracked(self, f):
 return self._map.set_tracked(f)
 
+def set_clean(self, filename, mode, size, mtime):
+self._map.set_clean(filename, mode, size, mtime)
+
 def reset_state(
 self,
 filename,



To: Alphare, #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


D12499: rust-dirstatemap: add Rust implementation of `reset_state`

2022-04-12 Thread Raphaël Gomès
Alphare created this revision.
Herald added a reviewer: hg-reviewers.
Herald added a subscriber: mercurial-patches.

REVISION SUMMARY
  This is the new API which has already been defined in Python

REPOSITORY
  rHG Mercurial

BRANCH
  default

REVISION DETAIL
  https://phab.mercurial-scm.org/D12499

AFFECTED FILES
  rust/hg-core/src/dirstate/entry.rs
  rust/hg-core/src/dirstate_tree/dirstate_map.rs
  rust/hg-cpython/src/dirstate/dirstate_map.rs

CHANGE DETAILS

diff --git a/rust/hg-cpython/src/dirstate/dirstate_map.rs 
b/rust/hg-cpython/src/dirstate/dirstate_map.rs
--- a/rust/hg-cpython/src/dirstate/dirstate_map.rs
+++ b/rust/hg-cpython/src/dirstate/dirstate_map.rs
@@ -15,6 +15,7 @@
 exc, PyBool, PyBytes, PyClone, PyDict, PyErr, PyList, PyNone, PyObject,
 PyResult, Python, PythonObject, ToPyObject, UnsafePyLeaked,
 };
+use hg::dirstate::{ParentFileData, TruncatedTimestamp};
 
 use crate::{
 dirstate::copymap::{CopyMap, CopyMapItemsIterator, CopyMapKeysIterator},
@@ -141,6 +142,55 @@
 Ok(was_tracked.to_py_object(py))
 }
 
+def reset_state(
+,
+f: PyObject,
+wc_tracked: bool,
+p1_tracked: bool,
+p2_info: bool,
+has_meaningful_mtime: bool,
+parentfiledata: Option<(u32, u32, Option<(i64, u32, bool)>)>,
+) -> PyResult {
+let mut has_meaningful_mtime = has_meaningful_mtime;
+let parent_file_data = match parentfiledata {
+None => {
+has_meaningful_mtime = false;
+None
+},
+Some(data) => {
+let (mode, size, mtime_info) = data;
+let mtime = if let Some(mtime_info) = mtime_info {
+let (mtime_s, mtime_ns, second_ambiguous) = mtime_info;
+let timestamp = TruncatedTimestamp::new_truncate(
+mtime_s, mtime_ns, second_ambiguous
+);
+Some(timestamp)
+} else {
+has_meaningful_mtime = false;
+None
+};
+Some(ParentFileData {
+mode_size: Some((mode, size)),
+mtime,
+})
+}
+};
+let bytes = f.extract::(py)?;
+let path = HgPath::new(bytes.data(py));
+let res = self.inner(py).borrow_mut().reset_state(
+path,
+wc_tracked,
+p1_tracked,
+p2_info,
+has_meaningful_mtime,
+parent_file_data,
+);
+res.or_else(|_| {
+Err(PyErr::new::(py, "Dirstate 
error".to_string()))
+})?;
+Ok(PyNone)
+}
+
 def removefile(
 ,
 f: PyObject,
diff --git a/rust/hg-core/src/dirstate_tree/dirstate_map.rs 
b/rust/hg-core/src/dirstate_tree/dirstate_map.rs
--- a/rust/hg-core/src/dirstate_tree/dirstate_map.rs
+++ b/rust/hg-core/src/dirstate_tree/dirstate_map.rs
@@ -11,6 +11,8 @@
 use crate::dirstate::parsers::packed_entry_size;
 use crate::dirstate::parsers::parse_dirstate_entries;
 use crate::dirstate::CopyMapIter;
+use crate::dirstate::DirstateV2Data;
+use crate::dirstate::ParentFileData;
 use crate::dirstate::StateMapIter;
 use crate::dirstate::TruncatedTimestamp;
 use crate::dirstate::SIZE_FROM_OTHER_PARENT;
@@ -606,6 +608,73 @@
 }
 }
 
+fn reset_state(
+ self,
+filename: ,
+old_entry_opt: Option,
+wc_tracked: bool,
+p1_tracked: bool,
+p2_info: bool,
+has_meaningful_mtime: bool,
+parent_file_data_opt: Option,
+) -> Result<(), DirstateError> {
+let (had_entry, was_tracked) = match old_entry_opt {
+Some(old_entry) => (true, old_entry.tracked()),
+None => (false, false),
+};
+let node = Self::get_or_insert_node(
+self.on_disk,
+ self.unreachable_bytes,
+ self.root,
+filename,
+WithBasename::to_cow_owned,
+|ancestor| {
+if !had_entry {
+ancestor.descendants_with_entry_count += 1;
+}
+if was_tracked {
+if !wc_tracked {
+ancestor.tracked_descendants_count = ancestor
+.tracked_descendants_count
+.checked_sub(1)
+.expect("tracked count to be >= 0");
+}
+} else {
+if wc_tracked {
+ancestor.tracked_descendants_count += 1;
+}
+}
+},
+)?;
+
+let v2_data = if let Some(parent_file_data) = parent_file_data_opt {
+DirstateV2Data {
+wc_tracked,
+p1_tracked,
+p2_info,
+mode_size: parent_file_data.mode_size,
+mtime: if 

D12501: dirstatemap: remove `_insert_entry`

2022-04-12 Thread Raphaël Gomès
Alphare created this revision.
Herald added a reviewer: hg-reviewers.
Herald added a subscriber: mercurial-patches.

REVISION SUMMARY
  This was needed as a compatibility layer for the Python and Rust
  implementations, but it is not called from anywhere in Rust anymore.
  
  The two remaining calls have been inlined.

REPOSITORY
  rHG Mercurial

BRANCH
  default

REVISION DETAIL
  https://phab.mercurial-scm.org/D12501

AFFECTED FILES
  mercurial/dirstatemap.py

CHANGE DETAILS

diff --git a/mercurial/dirstatemap.py b/mercurial/dirstatemap.py
--- a/mercurial/dirstatemap.py
+++ b/mercurial/dirstatemap.py
@@ -101,12 +101,6 @@
 def _refresh_entry(self, f, entry):
 """record updated state of an entry"""
 
-def _insert_entry(self, f, entry):
-"""add a new dirstate entry (or replace an unrelated one)
-
-The fact it is actually new is the responsability of the caller
-"""
-
 def _drop_entry(self, f):
 """remove any entry for file f
 
@@ -511,7 +505,7 @@
 has_meaningful_mtime=has_meaningful_mtime,
 parentfiledata=parentfiledata,
 )
-self._insert_entry(filename, entry)
+self._map[filename] = entry
 
 def set_tracked(self, filename):
 new = False
@@ -522,7 +516,7 @@
 wc_tracked=True,
 )
 
-self._insert_entry(filename, entry)
+self._map[filename] = entry
 new = True
 elif not entry.tracked:
 self._dirs_incr(filename, entry)
@@ -541,9 +535,6 @@
 if not entry.any_tracked:
 self._map.pop(f, None)
 
-def _insert_entry(self, f, entry):
-self._map[f] = entry
-
 def _drop_entry(self, f):
 self._map.pop(f, None)
 self.copymap.pop(f, None)
@@ -718,9 +709,6 @@
 else:
 self._map.addfile(f, entry)
 
-def _insert_entry(self, f, entry):
-self._map.addfile(f, entry)
-
 def set_tracked(self, f):
 return self._map.set_tracked(f)
 



To: Alphare, #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


D12500: dirstatemap: move `reset_state` out of common methods

2022-04-12 Thread Raphaël Gomès
Alphare created this revision.
Herald added a reviewer: hg-reviewers.
Herald added a subscriber: mercurial-patches.

REVISION SUMMARY
  Now that we have a Rust implementation, we defer to that accordingly.

REPOSITORY
  rHG Mercurial

BRANCH
  default

REVISION DETAIL
  https://phab.mercurial-scm.org/D12500

AFFECTED FILES
  mercurial/dirstatemap.py

CHANGE DETAILS

diff --git a/mercurial/dirstatemap.py b/mercurial/dirstatemap.py
--- a/mercurial/dirstatemap.py
+++ b/mercurial/dirstatemap.py
@@ -143,45 +143,6 @@
 self._refresh_entry(f, entry)
 return True
 
-def reset_state(
-self,
-filename,
-wc_tracked=False,
-p1_tracked=False,
-p2_info=False,
-has_meaningful_mtime=True,
-parentfiledata=None,
-):
-"""Set a entry to a given state, diregarding all previous state
-
-This is to be used by the part of the dirstate API dedicated to
-adjusting the dirstate after a update/merge.
-
-note: calling this might result to no entry existing at all if the
-dirstate map does not see any point at having one for this file
-anymore.
-"""
-# copy information are now outdated
-# (maybe new information should be in directly passed to this function)
-self.copymap.pop(filename, None)
-
-if not (p1_tracked or p2_info or wc_tracked):
-old_entry = self._map.get(filename)
-self._drop_entry(filename)
-self._dirs_decr(filename, old_entry=old_entry)
-return
-
-old_entry = self._map.get(filename)
-self._dirs_incr(filename, old_entry)
-entry = DirstateItem(
-wc_tracked=wc_tracked,
-p1_tracked=p1_tracked,
-p2_info=p2_info,
-has_meaningful_mtime=has_meaningful_mtime,
-parentfiledata=parentfiledata,
-)
-self._insert_entry(filename, entry)
-
 ### disk interaction
 
 def _opendirstatefile(self):
@@ -513,6 +474,45 @@
 
 ### code related to manipulation of entries and copy-sources
 
+def reset_state(
+self,
+filename,
+wc_tracked=False,
+p1_tracked=False,
+p2_info=False,
+has_meaningful_mtime=True,
+parentfiledata=None,
+):
+"""Set a entry to a given state, diregarding all previous state
+
+This is to be used by the part of the dirstate API dedicated to
+adjusting the dirstate after a update/merge.
+
+note: calling this might result to no entry existing at all if the
+dirstate map does not see any point at having one for this file
+anymore.
+"""
+# copy information are now outdated
+# (maybe new information should be in directly passed to this function)
+self.copymap.pop(filename, None)
+
+if not (p1_tracked or p2_info or wc_tracked):
+old_entry = self._map.get(filename)
+self._drop_entry(filename)
+self._dirs_decr(filename, old_entry=old_entry)
+return
+
+old_entry = self._map.get(filename)
+self._dirs_incr(filename, old_entry)
+entry = DirstateItem(
+wc_tracked=wc_tracked,
+p1_tracked=p1_tracked,
+p2_info=p2_info,
+has_meaningful_mtime=has_meaningful_mtime,
+parentfiledata=parentfiledata,
+)
+self._insert_entry(filename, entry)
+
 def set_tracked(self, filename):
 new = False
 entry = self.get(filename)
@@ -724,6 +724,24 @@
 def set_tracked(self, f):
 return self._map.set_tracked(f)
 
+def reset_state(
+self,
+filename,
+wc_tracked=False,
+p1_tracked=False,
+p2_info=False,
+has_meaningful_mtime=True,
+parentfiledata=None,
+):
+return self._map.reset_state(
+filename,
+wc_tracked,
+p1_tracked,
+p2_info,
+has_meaningful_mtime,
+parentfiledata,
+)
+
 def _drop_entry(self, f):
 self._map.drop_item_and_copy_source(f)
 



To: Alphare, #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


D12498: rust-dirstate: introduce intermediate struct for dirstate-v2 data

2022-04-12 Thread Raphaël Gomès
Alphare created this revision.
Herald added a reviewer: hg-reviewers.
Herald added a subscriber: mercurial-patches.

REVISION SUMMARY
  This is passed often as a long tuple that is not easy to know the form of, so
  we refactor everything in this struct.
  
  This also renames `wdir_tracked` to follow the Python `wc_tracked`, even 
though
  the on-disk format uses `WDIR_TRACKED`.
  I think a single naming scheme is better, but we can't easily break the Python
  impl now because of extensions, so this is low-effort enough and facilitates
  grepping.

REPOSITORY
  rHG Mercurial

BRANCH
  default

REVISION DETAIL
  https://phab.mercurial-scm.org/D12498

AFFECTED FILES
  rust/hg-core/src/dirstate/entry.rs
  rust/hg-core/src/dirstate_tree/on_disk.rs
  rust/hg-cpython/src/dirstate/item.rs

CHANGE DETAILS

diff --git a/rust/hg-cpython/src/dirstate/item.rs 
b/rust/hg-cpython/src/dirstate/item.rs
--- a/rust/hg-cpython/src/dirstate/item.rs
+++ b/rust/hg-cpython/src/dirstate/item.rs
@@ -8,6 +8,7 @@
 use cpython::Python;
 use cpython::PythonObject;
 use hg::dirstate::DirstateEntry;
+use hg::dirstate::DirstateV2Data;
 use hg::dirstate::TruncatedTimestamp;
 use std::cell::Cell;
 
@@ -38,15 +39,15 @@
 }
 }
 }
-let entry = DirstateEntry::from_v2_data(
-wc_tracked,
+let entry = DirstateEntry::from_v2_data(DirstateV2Data {
+wc_tracked: wc_tracked,
 p1_tracked,
 p2_info,
-mode_size_opt,
-mtime_opt,
+mode_size: mode_size_opt,
+mtime: mtime_opt,
 fallback_exec,
 fallback_symlink,
-);
+});
 DirstateItem::create_instance(py, Cell::new(entry))
 }
 
diff --git a/rust/hg-core/src/dirstate_tree/on_disk.rs 
b/rust/hg-core/src/dirstate_tree/on_disk.rs
--- a/rust/hg-core/src/dirstate_tree/on_disk.rs
+++ b/rust/hg-core/src/dirstate_tree/on_disk.rs
@@ -2,7 +2,7 @@
 //!
 //! See `mercurial/helptext/internals/dirstate-v2.txt`
 
-use crate::dirstate::TruncatedTimestamp;
+use crate::dirstate::{DirstateV2Data, TruncatedTimestamp};
 use crate::dirstate_tree::dirstate_map::{self, DirstateMap, NodeRef};
 use crate::dirstate_tree::path_with_basename::WithBasename;
 use crate::errors::HgError;
@@ -412,7 +412,7 @@
 
 fn assume_entry() -> Result {
 // TODO: convert through raw bits instead?
-let wdir_tracked = self.flags().contains(Flags::WDIR_TRACKED);
+let wc_tracked = self.flags().contains(Flags::WDIR_TRACKED);
 let p1_tracked = self.flags().contains(Flags::P1_TRACKED);
 let p2_info = self.flags().contains(Flags::P2_INFO);
 let mode_size = if self.flags().contains(Flags::HAS_MODE_AND_SIZE)
@@ -442,15 +442,15 @@
 } else {
 None
 };
-Ok(DirstateEntry::from_v2_data(
-wdir_tracked,
+Ok(DirstateEntry::from_v2_data(DirstateV2Data {
+wc_tracked,
 p1_tracked,
 p2_info,
 mode_size,
 mtime,
 fallback_exec,
 fallback_symlink,
-))
+}))
 }
 
 pub(super) fn entry(
@@ -490,18 +490,18 @@
 fn from_dirstate_entry(
 entry: ,
 ) -> (Flags, U32Be, PackedTruncatedTimestamp) {
-let (
-wdir_tracked,
+let DirstateV2Data {
+wc_tracked,
 p1_tracked,
 p2_info,
-mode_size_opt,
-mtime_opt,
+mode_size: mode_size_opt,
+mtime: mtime_opt,
 fallback_exec,
 fallback_symlink,
-) = entry.v2_data();
-// TODO: convert throug raw flag bits instead?
+} = entry.v2_data();
+// TODO: convert through raw flag bits instead?
 let mut flags = Flags::empty();
-flags.set(Flags::WDIR_TRACKED, wdir_tracked);
+flags.set(Flags::WDIR_TRACKED, wc_tracked);
 flags.set(Flags::P1_TRACKED, p1_tracked);
 flags.set(Flags::P2_INFO, p2_info);
 let size = if let Some((m, s)) = mode_size_opt {
diff --git a/rust/hg-core/src/dirstate/entry.rs 
b/rust/hg-core/src/dirstate/entry.rs
--- a/rust/hg-core/src/dirstate/entry.rs
+++ b/rust/hg-core/src/dirstate/entry.rs
@@ -248,23 +248,35 @@
 /// dirstate v1 format.
 pub const SIZE_NON_NORMAL: i32 = -1;
 
+#[derive(Debug, Default, Copy, Clone)]
+pub struct DirstateV2Data {
+pub wc_tracked: bool,
+pub p1_tracked: bool,
+pub p2_info: bool,
+pub mode_size: Option<(u32, u32)>,
+pub mtime: Option,
+pub fallback_exec: Option,
+pub fallback_symlink: Option,
+}
+
 impl DirstateEntry {
-pub fn from_v2_data(
-wdir_tracked: bool,
-p1_tracked: bool,
-p2_info: bool,
-mode_size: Option<(u32, u32)>,
-mtime: Option,
-fallback_exec: Option,
-fallback_symlink: Option,
-) -> Self {
+pub fn from_v2_data(v2_data: DirstateV2Data) -> Self {
+let 

D12497: dirstatemap: remove unused parameter from `reset_state`

2022-04-12 Thread Raphaël Gomès
Alphare created this revision.
Herald added a reviewer: hg-reviewers.
Herald added a subscriber: mercurial-patches.

REVISION SUMMARY
  This has no callers using it and is not used inside the method itself.

REPOSITORY
  rHG Mercurial

BRANCH
  default

REVISION DETAIL
  https://phab.mercurial-scm.org/D12497

AFFECTED FILES
  mercurial/dirstatemap.py

CHANGE DETAILS

diff --git a/mercurial/dirstatemap.py b/mercurial/dirstatemap.py
--- a/mercurial/dirstatemap.py
+++ b/mercurial/dirstatemap.py
@@ -150,7 +150,6 @@
 p1_tracked=False,
 p2_info=False,
 has_meaningful_mtime=True,
-has_meaningful_data=True,
 parentfiledata=None,
 ):
 """Set a entry to a given state, diregarding all previous state



To: Alphare, #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


D12496: dirstatemap: move `set_tracked` out of common methods and plug in Rust

2022-04-12 Thread Raphaël Gomès
Alphare created this revision.
Herald added a reviewer: hg-reviewers.
Herald added a subscriber: mercurial-patches.

REVISION SUMMARY
  We now have a Rust-specific implementation of this method, it is no longer
  shared between both implementations.

REPOSITORY
  rHG Mercurial

BRANCH
  default

REVISION DETAIL
  https://phab.mercurial-scm.org/D12496

AFFECTED FILES
  mercurial/dirstatemap.py
  rust/hg-cpython/src/dirstate/dirstate_map.rs

CHANGE DETAILS

diff --git a/rust/hg-cpython/src/dirstate/dirstate_map.rs 
b/rust/hg-cpython/src/dirstate/dirstate_map.rs
--- a/rust/hg-cpython/src/dirstate/dirstate_map.rs
+++ b/rust/hg-cpython/src/dirstate/dirstate_map.rs
@@ -131,6 +131,16 @@
 Ok(PyNone)
 }
 
+def set_tracked(, f: PyObject) -> PyResult {
+let bytes = f.extract::(py)?;
+let path = HgPath::new(bytes.data(py));
+let res = self.inner(py).borrow_mut().set_tracked(path);
+let was_tracked = res.or_else(|_| {
+Err(PyErr::new::(py, "Dirstate 
error".to_string()))
+})?;
+Ok(was_tracked.to_py_object(py))
+}
+
 def removefile(
 ,
 f: PyObject,
diff --git a/mercurial/dirstatemap.py b/mercurial/dirstatemap.py
--- a/mercurial/dirstatemap.py
+++ b/mercurial/dirstatemap.py
@@ -130,30 +130,6 @@
 self._refresh_entry(filename, entry)
 self.copymap.pop(filename, None)
 
-def set_tracked(self, filename):
-new = False
-entry = self.get(filename)
-if entry is None:
-self._dirs_incr(filename)
-entry = DirstateItem(
-wc_tracked=True,
-)
-
-self._insert_entry(filename, entry)
-new = True
-elif not entry.tracked:
-self._dirs_incr(filename, entry)
-entry.set_tracked()
-self._refresh_entry(filename, entry)
-new = True
-else:
-# XXX This is probably overkill for more case, but we need this to
-# fully replace the `normallookup` call with `set_tracked` one.
-# Consider smoothing this in the future.
-entry.set_possibly_dirty()
-self._refresh_entry(filename, entry)
-return new
-
 def set_untracked(self, f):
 """Mark a file as no longer tracked in the dirstate map"""
 entry = self.get(f)
@@ -538,6 +514,30 @@
 
 ### code related to manipulation of entries and copy-sources
 
+def set_tracked(self, filename):
+new = False
+entry = self.get(filename)
+if entry is None:
+self._dirs_incr(filename)
+entry = DirstateItem(
+wc_tracked=True,
+)
+
+self._insert_entry(filename, entry)
+new = True
+elif not entry.tracked:
+self._dirs_incr(filename, entry)
+entry.set_tracked()
+self._refresh_entry(filename, entry)
+new = True
+else:
+# XXX This is probably overkill for more case, but we need this to
+# fully replace the `normallookup` call with `set_tracked` one.
+# Consider smoothing this in the future.
+entry.set_possibly_dirty()
+self._refresh_entry(filename, entry)
+return new
+
 def _refresh_entry(self, f, entry):
 if not entry.any_tracked:
 self._map.pop(f, None)
@@ -722,6 +722,9 @@
 def _insert_entry(self, f, entry):
 self._map.addfile(f, entry)
 
+def set_tracked(self, f):
+return self._map.set_tracked(f)
+
 def _drop_entry(self, f):
 self._map.drop_item_and_copy_source(f)
 



To: Alphare, #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


D12495: rust-dirstatemap: add `set_tracked` method

2022-04-12 Thread Raphaël Gomès
Alphare created this revision.
Herald added a reviewer: hg-reviewers.
Herald added a subscriber: mercurial-patches.

REVISION SUMMARY
  This is the new dirstate API that has already been moved to in Python.
  It will be used in place of the old `addfile`/`removefile` one.

REPOSITORY
  rHG Mercurial

BRANCH
  default

REVISION DETAIL
  https://phab.mercurial-scm.org/D12495

AFFECTED FILES
  rust/hg-core/src/dirstate/entry.rs
  rust/hg-core/src/dirstate_tree/dirstate_map.rs

CHANGE DETAILS

diff --git a/rust/hg-core/src/dirstate_tree/dirstate_map.rs 
b/rust/hg-core/src/dirstate_tree/dirstate_map.rs
--- a/rust/hg-core/src/dirstate_tree/dirstate_map.rs
+++ b/rust/hg-core/src/dirstate_tree/dirstate_map.rs
@@ -606,6 +606,52 @@
 }
 }
 
+fn set_tracked(
+ self,
+filename: ,
+old_entry_opt: Option,
+) -> Result {
+let was_tracked = old_entry_opt.map_or(false, |e| e.tracked());
+let had_entry = old_entry_opt.is_some();
+let tracked_count_increment = if was_tracked { 0 } else { 1 };
+let mut new = false;
+
+let node = Self::get_or_insert_node(
+self.on_disk,
+ self.unreachable_bytes,
+ self.root,
+filename,
+WithBasename::to_cow_owned,
+|ancestor| {
+if !had_entry {
+ancestor.descendants_with_entry_count += 1;
+}
+
+ancestor.tracked_descendants_count += tracked_count_increment;
+},
+)?;
+let new_entry = if let Some(old_entry) = old_entry_opt {
+let mut e = old_entry.clone();
+if e.tracked() {
+// XXX
+// This is probably overkill for more case, but we need this to
+// fully replace the `normallookup` call with `set_tracked`
+// one. Consider smoothing this in the future.
+e.set_possibly_dirty();
+} else {
+new = true;
+e.set_tracked();
+}
+e
+} else {
+self.nodes_with_entry_count += 1;
+new = true;
+DirstateEntry::new_tracked()
+};
+node.data = NodeData::Entry(new_entry);
+Ok(new)
+}
+
 fn add_or_remove_file(
  self,
 path: ,
@@ -758,6 +804,14 @@
 })
 }
 
+pub fn set_tracked(
+ self,
+filename: ,
+) -> Result {
+let old_entry_opt = self.get(filename)?;
+self.with_dmap_mut(|map| map.set_tracked(filename, old_entry_opt))
+}
+
 pub fn remove_file(
  self,
 filename: ,
diff --git a/rust/hg-core/src/dirstate/entry.rs 
b/rust/hg-core/src/dirstate/entry.rs
--- a/rust/hg-core/src/dirstate/entry.rs
+++ b/rust/hg-core/src/dirstate/entry.rs
@@ -367,6 +367,10 @@
 Self::from_v1_data(EntryState::Removed, 0, size, 0)
 }
 
+pub fn new_tracked() -> Self {
+Self::from_v2_data(true, false, false, None, None, None, None)
+}
+
 pub fn tracked() -> bool {
 self.flags.contains(Flags::WDIR_TRACKED)
 }



To: Alphare, #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 | Failed pipeline for branch/default | a01f64c5

2022-04-12 Thread Heptapod


Pipeline #53149 has failed!

Project: mercurial-devel ( https://foss.heptapod.net/mercurial/mercurial-devel )
Branch: branch/default ( 
https://foss.heptapod.net/mercurial/mercurial-devel/-/commits/branch/default )

Commit: a01f64c5 ( 
https://foss.heptapod.net/mercurial/mercurial-devel/-/commit/a01f64c5472ac725c2598392fc3ef3f075413c22
 )
Commit Message: test: accept another error message on lack of T...
Commit Author: Julien Cristau

Pipeline #53149 ( 
https://foss.heptapod.net/mercurial/mercurial-devel/-/pipelines/53149 ) 
triggered by Administrator ( https://foss.heptapod.net/root )
had 1 failed job.

Job #546465 ( 
https://foss.heptapod.net/mercurial/mercurial-devel/-/jobs/546465/raw )

Stage: tests
Name: checks

-- 
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 | Failed pipeline for branch/default | a01f64c5

2022-04-12 Thread Heptapod


Pipeline #53149 has failed!

Project: mercurial-devel ( https://foss.heptapod.net/mercurial/mercurial-devel )
Branch: branch/default ( 
https://foss.heptapod.net/mercurial/mercurial-devel/-/commits/branch/default )

Commit: a01f64c5 ( 
https://foss.heptapod.net/mercurial/mercurial-devel/-/commit/a01f64c5472ac725c2598392fc3ef3f075413c22
 )
Commit Message: test: accept another error message on lack of T...
Commit Author: Julien Cristau

Pipeline #53149 ( 
https://foss.heptapod.net/mercurial/mercurial-devel/-/pipelines/53149 ) 
triggered by Administrator ( https://foss.heptapod.net/root )
had 3 failed jobs.

Job #546454 ( 
https://foss.heptapod.net/mercurial/mercurial-devel/-/jobs/546454/raw )

Stage: tests
Name: checks
Job #546459 ( 
https://foss.heptapod.net/mercurial/mercurial-devel/-/jobs/546459/raw )

Stage: tests
Name: test-rhg
Job #546461 ( 
https://foss.heptapod.net/mercurial/mercurial-devel/-/jobs/546461/raw )

Stage: tests
Name: check-pytype

-- 
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


D7542: mail: don't complain about a multi-word email.method

2022-04-12 Thread jcristau (Julien Cristau)
Closed by commit rHG1d6c6ad645e1: mail: dont complain about a multi-word 
email.method (authored by jcristau).
This revision was automatically updated to reflect the committed changes.

REPOSITORY
  rHG Mercurial

CHANGES SINCE LAST UPDATE
  https://phab.mercurial-scm.org/D7542?vs=33000=33015

CHANGES SINCE LAST ACTION
  https://phab.mercurial-scm.org/D7542/new/

REVISION DETAIL
  https://phab.mercurial-scm.org/D7542

AFFECTED FILES
  mercurial/mail.py

CHANGE DETAILS

diff --git a/mercurial/mail.py b/mercurial/mail.py
--- a/mercurial/mail.py
+++ b/mercurial/mail.py
@@ -260,9 +260,11 @@
 )
 )
 else:
-if not procutil.findexe(method):
+command = procutil.shellsplit(method)
+command = command[0] if command else b''
+if not (command and procutil.findexe(command)):
 raise error.Abort(
-_(b'%r specified as email transport, but not in PATH') % method
+_(b'%r specified as email transport, but not in PATH') % 
command
 )
 
 



To: jcristau, #hg-reviewers, Alphare
Cc: Alphare, mercurial-patches, yuja, mercurial-devel
___
Mercurial-devel mailing list
Mercurial-devel@mercurial-scm.org
https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel


D7542: mail: don't complain about a multi-word email.method

2022-04-12 Thread Raphaël Gomès
This revision is now accepted and ready to land.
Alphare added a comment.
Alphare accepted this revision.


  That's an oldie

REPOSITORY
  rHG Mercurial

BRANCH
  default

CHANGES SINCE LAST ACTION
  https://phab.mercurial-scm.org/D7542/new/

REVISION DETAIL
  https://phab.mercurial-scm.org/D7542

To: jcristau, #hg-reviewers, Alphare
Cc: Alphare, mercurial-patches, yuja, mercurial-devel
___
Mercurial-devel mailing list
Mercurial-devel@mercurial-scm.org
https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel


mercurial-devel | Failed pipeline for branch/stable | 8b475050

2022-04-12 Thread Heptapod


Pipeline #53136 has failed!

Project: mercurial-devel ( https://foss.heptapod.net/mercurial/mercurial-devel )
Branch: branch/stable ( 
https://foss.heptapod.net/mercurial/mercurial-devel/-/commits/branch/stable )

Commit: 8b475050 ( 
https://foss.heptapod.net/mercurial/mercurial-devel/-/commit/8b4750507caaf1cf25760a79234d308fa88e585e
 )
Commit Message: help: set the large-file-limit to 10MB

This is...
Commit Author: Pierre-Yves David ( https://foss.heptapod.net/marmoute )

Pipeline #53136 ( 
https://foss.heptapod.net/mercurial/mercurial-devel/-/pipelines/53136 ) 
triggered by Administrator ( https://foss.heptapod.net/root )
had 2 failed jobs.

Job #546366 ( 
https://foss.heptapod.net/mercurial/mercurial-devel/-/jobs/546366/raw )

Stage: tests
Name: checks-py3
Job #546365 ( 
https://foss.heptapod.net/mercurial/mercurial-devel/-/jobs/546365/raw )

Stage: tests
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


[Bug 6675] New: Visa Simple

2022-04-12 Thread mercurial-bugs
https://bz.mercurial-scm.org/show_bug.cgi?id=6675

Bug ID: 6675
   Summary: Visa Simple
   Product: Mercurial
   Version: unspecified
  Hardware: PC
OS: Windows
Status: UNCONFIRMED
  Severity: feature
  Priority: wish
 Component: automv
  Assignee: bugzi...@mercurial-scm.org
  Reporter: lilyj8...@gmail.com
CC: mercurial-devel@mercurial-scm.org
Python Version: ---

ILR Visa UK: Are you eligible to apply for Indefinite Leave to Remain UK or
Settlement visa UK? Call our experienced Immigration experts on 0203 640 6663
for a free assessment.

https://www.visasimple.com/ilr-visa-uk.html

-- 
You are receiving this mail because:
You are on the CC list for the bug.
___
Mercurial-devel mailing list
Mercurial-devel@mercurial-scm.org
https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel