mercurial-devel | Pipeline #17010 has failed for branch/default | 0390fb73

2021-01-25 Thread Heptapod


Your pipeline has failed.

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

Commit: 0390fb73 ( 
https://foss.heptapod.net/octobus/mercurial-devel/-/commit/0390fb731528fe668640690d8bcb0caca2f869de
 )
Commit Message: store: use `endswith` to detect revlog extensio...
Commit Author: Pierre-Yves David ( https://foss.heptapod.net/marmoute )

Pipeline #17010 ( 
https://foss.heptapod.net/octobus/mercurial-devel/-/pipelines/17010 ) triggered 
by Administrator ( https://foss.heptapod.net/root )
had 4 failed builds.

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

Stage: tests
Name: test-py2-pure
Job #156494 ( 
https://foss.heptapod.net/octobus/mercurial-devel/-/jobs/156494/raw )

Stage: tests
Name: test-py2-chg
Job #156488 ( 
https://foss.heptapod.net/octobus/mercurial-devel/-/jobs/156488/raw )

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

Stage: tests
Name: test-py2-rust

-- 
You're receiving this email because of your account on foss.heptapod.net.



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


mercurial-devel | Pipeline #17009 has failed for branch/default | ea5728bc

2021-01-25 Thread Heptapod


Your pipeline has failed.

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

Commit: ea5728bc ( 
https://foss.heptapod.net/octobus/mercurial-devel/-/commit/ea5728bc828a06940442608b3e65102b47fb3786
 )
Commit Message: black: merge config into main pyproject.toml no...
Commit Author: Augie Fackler

Pipeline #17009 ( 
https://foss.heptapod.net/octobus/mercurial-devel/-/pipelines/17009 ) triggered 
by Administrator ( https://foss.heptapod.net/root )
had 4 failed builds.

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

Stage: tests
Name: test-py2-rust
Job #156481 ( 
https://foss.heptapod.net/octobus/mercurial-devel/-/jobs/156481/raw )

Stage: tests
Name: test-py2-chg
Job #156475 ( 
https://foss.heptapod.net/octobus/mercurial-devel/-/jobs/156475/raw )

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

Stage: tests
Name: test-py2-pure

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


D9872: command-namespace: use `::` are the command separator

2021-01-25 Thread marmoute (Pierre-Yves David)
marmoute created this revision.
Herald added a reviewer: hg-reviewers.
Herald added a subscriber: mercurial-patches.

REVISION SUMMARY
  This was discussed on the mailing list / phab and `::` got a couple of 
positive
  feedback.
  
  I dediced to not introduce automatic folding of `::`, I feel like it make 
sense
  for `-`, but I like the expliciteness of `::`.
  
  So I am adding alias for backward compatibility.

REPOSITORY
  rHG Mercurial

BRANCH
  default

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

AFFECTED FILES
  contrib/perf.py
  tests/test-contrib-perf.t

CHANGE DETAILS

diff --git a/tests/test-contrib-perf.t b/tests/test-contrib-perf.t
--- a/tests/test-contrib-perf.t
+++ b/tests/test-contrib-perf.t
@@ -78,126 +78,126 @@
   
   list of commands:
   
-   perf--addremove
+   perf::addremove
  (no help text available)
-   perf--ancestors
+   perf::ancestors
  (no help text available)
-   perf--ancestorset
+   perf::ancestorset
  (no help text available)
-   perf--annotate
+   perf::annotate
  (no help text available)
-   perf--bdiff   benchmark a bdiff between revisions
-   perf--bookmarks
+   perf::bdiff   benchmark a bdiff between revisions
+   perf::bookmarks
  benchmark parsing bookmarks from disk to memory
-   perf--branchmap
+   perf::branchmap
  benchmark the update of a branchmap
-   perf--branchmapload
+   perf::branchmapload
  benchmark reading the branchmap
-   perf--branchmapupdate
+   perf::branchmapupdate
  benchmark branchmap update from for  revs to 
  revs
-   perf--bundleread
+   perf::bundleread
  Benchmark reading of bundle files.
-   perf--cca (no help text available)
-   perf--changegroupchangelog
+   perf::cca (no help text available)
+   perf::changegroupchangelog
  Benchmark producing a changelog group for a changegroup.
-   perf--changeset
+   perf::changeset
  (no help text available)
-   perf--ctxfiles
+   perf::ctxfiles
  (no help text available)
-   perf--diffwd  Profile diff of working directory changes
-   perf--dirfoldmap
+   perf::diffwd  Profile diff of working directory changes
+   perf::dirfoldmap
  benchmap a 'dirstate._map.dirfoldmap.get()' request
-   perf--dirs(no help text available)
-   perf--dirstate
+   perf::dirs(no help text available)
+   perf::dirstate
  benchmap the time of various distate operations
-   perf--dirstatedirs
+   perf::dirstatedirs
  benchmap a 'dirstate.hasdir' call from an empty 'dirs' cache
-   perf--dirstatefoldmap
+   perf::dirstatefoldmap
  benchmap a 'dirstate._map.filefoldmap.get()' request
-   perf--dirstatewrite
+   perf::dirstatewrite
  benchmap the time it take to write a dirstate on disk
-   perf--discovery
+   perf::discovery
  benchmark discovery between local repo and the peer at given
  path
-   perf--fncacheencode
+   perf::fncacheencode
  (no help text available)
-   perf--fncacheload
+   perf::fncacheload
  (no help text available)
-   perf--fncachewrite
+   perf::fncachewrite
  (no help text available)
-   perf--heads   benchmark the computation of a changelog heads
-   perf--helper-mergecopies
+   perf::heads   benchmark the computation of a changelog heads
+   perf::helper-mergecopies
  find statistics about potential parameters for
  'perfmergecopies'
-   perf--helper-pathcopies
+   perf::helper-pathcopies
  find statistic about potential parameters for the
  'perftracecopies'
-   perf--ignore  benchmark operation related to computing ignore
-   perf--index   benchmark index creation time followed by a lookup
-   perf--linelogedits
+   perf::ignore  benchmark operation related to computing ignore
+   perf::index   benchmark index creation time followed by a lookup
+   perf::linelogedits
  (no help text available)
-   perf--loadmarkers
+   perf::loadmarkers
  benchmark the time to parse the on-disk markers for a repo
-   perf--log (no help text available)
-   perf--lookup  (no help text available)
-   perf--lrucachedict
+   perf::log (no help text available)
+   perf::lookup  (no help text available)
+   perf::lrucachedict
  (no help text available)
-   perf--manifest
+   perf::manifest
  benchmark the time to read a manifest from disk and return a
  usable
-   perf--mergecalculate
+   perf::mergecalculate
  (no help text available)
-   perf--mergecopies
+   perf::mergecopies
  measure runtime of 'copies.mergecopies'
-   perf--moonwalk
+   perf::moonwalk
  benchmark walking the changelog backwards
-   perf--nodelookup
+   perf::n

D9868: run-test: avoid byte issue when replacing output file of python test

2021-01-25 Thread marmoute (Pierre-Yves David)
marmoute created this revision.
Herald added a reviewer: hg-reviewers.
Herald added a subscriber: mercurial-patches.

REVISION SUMMARY
  Otherwise we get error like::
  
FileNotFoundError: [Errno 2] No such file or directory: 
"b'…/tests/test-minirst.py'.out"

REPOSITORY
  rHG Mercurial

BRANCH
  default

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

AFFECTED FILES
  tests/run-tests.py

CHANGE DETAILS

diff --git a/tests/run-tests.py b/tests/run-tests.py
--- a/tests/run-tests.py
+++ b/tests/run-tests.py
@@ -2278,7 +2278,7 @@
 if test.path.endswith(b'.t'):
 rename(test.errpath, test.path)
 else:
-rename(test.errpath, '%s.out' % test.path)
+rename(test.errpath, b'%s.out' % test.path)
 accepted = True
 if not accepted:
 self.faildata[test.name] = b''.join(lines)



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


D9869: minirst: respect escaping in definition list key

2021-01-25 Thread marmoute (Pierre-Yves David)
marmoute created this revision.
Herald added a reviewer: hg-reviewers.
Herald added a subscriber: mercurial-patches.

REVISION SUMMARY
  If we start adding `:` in command names… we need minirst to not choke on them.

REPOSITORY
  rHG Mercurial

BRANCH
  default

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

AFFECTED FILES
  mercurial/minirst.py
  tests/test-minirst.py
  tests/test-minirst.py.out

CHANGE DETAILS

diff --git a/tests/test-minirst.py.out b/tests/test-minirst.py.out
--- a/tests/test-minirst.py.out
+++ b/tests/test-minirst.py.out
@@ -439,6 +439,8 @@
 a First item.
 abSecond item. Indentation and wrapping is
   handled automatically.
+c:d   a key with colon
+efg::hh   a key with many colon
 
 Next list:
 
@@ -456,6 +458,9 @@
   wrapping is
   handled
   automatically.
+c:d   a key with colon
+efg::hh   a key with many
+  colon
 
 Next list:
 
@@ -476,6 +481,10 @@
  First item.
  ab
  Second item. Indentation and wrapping is handled automatically.
+ c:d
+ a key with colon
+ efg::hh
+ a key with many colon
 
 
 Next list:
diff --git a/tests/test-minirst.py b/tests/test-minirst.py
--- a/tests/test-minirst.py
+++ b/tests/test-minirst.py
@@ -159,6 +159,8 @@
 :a: First item.
 :ab: Second item. Indentation and wrapping
  is handled automatically.
+:c\:d: a key with colon
+:efg\:\:hh: a key with many colon
 
 Next list:
 
diff --git a/mercurial/minirst.py b/mercurial/minirst.py
--- a/mercurial/minirst.py
+++ b/mercurial/minirst.py
@@ -158,7 +158,7 @@
 _optionre = re.compile(
 br'^(-([a-zA-Z0-9]), )?(--[a-z0-9-]+)' br'((.*)  +)(.*)$'
 )
-_fieldre = re.compile(br':(?![: ])([^:]*)(?https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel


D9871: perf: test the formatting of a command help

2021-01-25 Thread marmoute (Pierre-Yves David)
marmoute created this revision.
Herald added a reviewer: hg-reviewers.
Herald added a subscriber: mercurial-patches.

REVISION SUMMARY
  Since we are about to addd ':' in command name I want this covered.

REPOSITORY
  rHG Mercurial

BRANCH
  default

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

AFFECTED FILES
  tests/test-contrib-perf.t

CHANGE DETAILS

diff --git a/tests/test-contrib-perf.t b/tests/test-contrib-perf.t
--- a/tests/test-contrib-perf.t
+++ b/tests/test-contrib-perf.t
@@ -195,6 +195,20 @@
perf--write   microbenchmark ui.write (and others)
   
   (use 'hg help -v perf' to show built-in aliases and global options)
+
+  $ hg help perfaddremove
+  hg perf--addremove
+  
+  aliases: perfaddremove
+  
+  (no help text available)
+  
+  options:
+  
+   -T --template TEMPLATE display with template
+  
+  (some details hidden, use --verbose to show complete help)
+
   $ hg perfaddremove
   $ hg perfancestors
   $ hg perfancestorset 2



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


D9870: help: escape ':' (as '\:') when generating command names

2021-01-25 Thread marmoute (Pierre-Yves David)
marmoute created this revision.
Herald added a reviewer: hg-reviewers.
Herald added a subscriber: mercurial-patches.

REVISION SUMMARY
  We need this before we can use ":" in command names.

REPOSITORY
  rHG Mercurial

BRANCH
  default

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

AFFECTED FILES
  mercurial/help.py

CHANGE DETAILS

diff --git a/mercurial/help.py b/mercurial/help.py
--- a/mercurial/help.py
+++ b/mercurial/help.py
@@ -829,10 +829,11 @@
 def appendcmds(cmds):
 cmds = sorted(cmds)
 for c in cmds:
+display_cmd = c
 if ui.verbose:
-rst.append(b" :%s: %s\n" % (b', '.join(syns[c]), h[c]))
-else:
-rst.append(b' :%s: %s\n' % (c, h[c]))
+display_cmd = b', '.join(syns[c])
+display_cmd = display_cmd.replace(b':', br'\:')
+rst.append(b' :%s: %s\n' % (display_cmd, h[c]))
 
 if name in (b'shortlist', b'debug'):
 # List without categories.



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


D9867: cext: restore the ability to build on Windows with py2

2021-01-25 Thread mharbison72 (Matt Harbison)
mharbison72 created this revision.
Herald added a reviewer: hg-reviewers.
Herald added a subscriber: mercurial-patches.

REVISION SUMMARY
  This broke in e92ca942ddca 
.

REPOSITORY
  rHG Mercurial

BRANCH
  default

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

AFFECTED FILES
  contrib/python-zstandard/zstd/common/pythoncapi_compat.h
  mercurial/pythoncapi_compat.h

CHANGE DETAILS

diff --git a/mercurial/pythoncapi_compat.h b/mercurial/pythoncapi_compat.h
--- a/mercurial/pythoncapi_compat.h
+++ b/mercurial/pythoncapi_compat.h
@@ -20,6 +20,11 @@
 #include "frameobject.h"  // PyFrameObject, PyFrame_GetBack()
 
 
+/* VC 2008 doesn't know about the inline keyword. */
+#if defined(_MSC_VER) && _MSC_VER < 1900
+#define inline __forceinline
+#endif
+
 // Cast argument to PyObject* type.
 #ifndef _PyObject_CAST
 #  define _PyObject_CAST(op) ((PyObject*)(op))
diff --git a/contrib/python-zstandard/zstd/common/pythoncapi_compat.h 
b/contrib/python-zstandard/zstd/common/pythoncapi_compat.h
--- a/contrib/python-zstandard/zstd/common/pythoncapi_compat.h
+++ b/contrib/python-zstandard/zstd/common/pythoncapi_compat.h
@@ -20,6 +20,11 @@
 #include "frameobject.h"  // PyFrameObject, PyFrame_GetBack()
 
 
+/* VC 2008 doesn't know about the inline keyword. */
+#if defined(_MSC_VER) && _MSC_VER < 1900
+#define inline __forceinline
+#endif
+
 // Cast argument to PyObject* type.
 #ifndef _PyObject_CAST
 #  define _PyObject_CAST(op) ((PyObject*)(op))



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


D9866: debugshell: add a simple command for starting an interactive shell

2021-01-25 Thread joerg.sonnenberger (Joerg Sonnenberger)
joerg.sonnenberger created this revision.
Herald added a reviewer: hg-reviewers.
Herald added a subscriber: mercurial-patches.

REVISION SUMMARY
  This simplifies interactive exploration of the Mercurial APIs.
  The ui and repo instances are provided as local variables.

REPOSITORY
  rHG Mercurial

BRANCH
  default

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

AFFECTED FILES
  mercurial/debugcommands.py

CHANGE DETAILS

diff --git a/mercurial/debugcommands.py b/mercurial/debugcommands.py
--- a/mercurial/debugcommands.py
+++ b/mercurial/debugcommands.py
@@ -3717,6 +3717,15 @@
 ui.writenoi18n(b' revision %s\n' % v[1])
 
 
+@command(b'debugshell')
+def debugshell(ui, repo):
+import code
+imported_objects = {
+'ui': ui,
+'repo': repo,
+}
+code.interact(local=imported_objects)
+
 @command(
 b'debugsuccessorssets',
 [(b'', b'closest', False, _(b'return closest successors sets only'))],



To: joerg.sonnenberger, #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


D9865: store: use `endswith` to detect revlog extension

2021-01-25 Thread marmoute (Pierre-Yves David)
marmoute created this revision.
Herald added a reviewer: hg-reviewers.
Herald added a subscriber: mercurial-patches.

REVISION SUMMARY
  Suggested by Gregory Szorc.

REPOSITORY
  rHG Mercurial

BRANCH
  default

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

AFFECTED FILES
  mercurial/store.py

CHANGE DETAILS

diff --git a/mercurial/store.py b/mercurial/store.py
--- a/mercurial/store.py
+++ b/mercurial/store.py
@@ -387,13 +387,12 @@
 b'requires',
 ]
 
+REVLOG_FILES_EXT = (b'.i', b'.d', b'.n', b'.nd')
 
 def isrevlog(f, kind, st):
 if kind != stat.S_IFREG:
 return False
-if f[-2:] in (b'.i', b'.d', b'.n'):
-return True
-return f[-3:] == b'.nd'
+return f.endswith(REVLOG_FILES_EXT)
 
 
 class basicstore(object):



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


D9863: rust: Make NodePrefix allocation-free and Copy, remove NodePrefixRef

2021-01-25 Thread SimonSapin
SimonSapin created this revision.
Herald added a reviewer: hg-reviewers.
Herald added a subscriber: mercurial-patches.

REVISION SUMMARY
  The `*Ref` struct only existed to avoid allocating `Vec`s
  when cloning `NodePrefix`, but we can avoid having `Vec`
  in the first place by using an inline array instead.
  
  This makes `NodePrefix` 21 bytes (with 1 for the length)
  which is smaller than before as `Vec` alone is 24 bytes.

REPOSITORY
  rHG Mercurial

BRANCH
  default

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

AFFECTED FILES
  rust/Cargo.lock
  rust/hg-core/Cargo.toml
  rust/hg-core/src/operations/cat.rs
  rust/hg-core/src/operations/debugdata.rs
  rust/hg-core/src/operations/list_tracked_files.rs
  rust/hg-core/src/revlog.rs
  rust/hg-core/src/revlog/changelog.rs
  rust/hg-core/src/revlog/manifest.rs
  rust/hg-core/src/revlog/node.rs
  rust/hg-core/src/revlog/nodemap.rs
  rust/hg-core/src/revlog/revlog.rs
  rust/hg-cpython/src/revlog.rs

CHANGE DETAILS

diff --git a/rust/hg-cpython/src/revlog.rs b/rust/hg-cpython/src/revlog.rs
--- a/rust/hg-cpython/src/revlog.rs
+++ b/rust/hg-cpython/src/revlog.rs
@@ -64,7 +64,7 @@
 let nt = opt.as_ref().unwrap();
 let idx = &*self.cindex(py).borrow();
 let node = node_from_py_bytes(py, &node)?;
-nt.find_bin(idx, (&node).into()).map_err(|e| nodemap_error(py, e))
+nt.find_bin(idx, node.into()).map_err(|e| nodemap_error(py, e))
 }
 
 /// same as `get_rev()` but raises a bare `error.RevlogError` if node
diff --git a/rust/hg-core/src/revlog/revlog.rs 
b/rust/hg-core/src/revlog/revlog.rs
--- a/rust/hg-core/src/revlog/revlog.rs
+++ b/rust/hg-core/src/revlog/revlog.rs
@@ -11,7 +11,7 @@
 use zstd;
 
 use super::index::Index;
-use super::node::{NodePrefixRef, NODE_BYTES_LENGTH, NULL_NODE};
+use super::node::{NodePrefix, NODE_BYTES_LENGTH, NULL_NODE};
 use super::nodemap;
 use super::nodemap::NodeMap;
 use super::nodemap_docket::NodeMapDocket;
@@ -111,7 +111,7 @@
 #[timed]
 pub fn get_node_rev(
 &self,
-node: NodePrefixRef,
+node: NodePrefix,
 ) -> Result {
 if let Some(nodemap) = &self.nodemap {
 return nodemap
diff --git a/rust/hg-core/src/revlog/nodemap.rs 
b/rust/hg-core/src/revlog/nodemap.rs
--- a/rust/hg-core/src/revlog/nodemap.rs
+++ b/rust/hg-core/src/revlog/nodemap.rs
@@ -13,8 +13,8 @@
 //! is used in a more abstract context.
 
 use super::{
-node::NULL_NODE, FromHexError, Node, NodePrefix, NodePrefixRef, Revision,
-RevlogIndex, NULL_REVISION,
+node::NULL_NODE, FromHexError, Node, NodePrefix, Revision, RevlogIndex,
+NULL_REVISION,
 };
 
 use std::cmp::max;
@@ -82,7 +82,7 @@
 fn find_bin<'a>(
 &self,
 idx: &impl RevlogIndex,
-prefix: NodePrefixRef<'a>,
+prefix: NodePrefix,
 ) -> Result, NodeMapError>;
 
 /// Find the unique Revision whose `Node` hexadecimal string representation
@@ -97,7 +97,7 @@
 idx: &impl RevlogIndex,
 prefix: &str,
 ) -> Result, NodeMapError> {
-self.find_bin(idx, NodePrefix::from_hex(prefix)?.borrow())
+self.find_bin(idx, NodePrefix::from_hex(prefix)?)
 }
 
 /// Give the size of the shortest node prefix that determines
@@ -114,7 +114,7 @@
 fn unique_prefix_len_bin<'a>(
 &self,
 idx: &impl RevlogIndex,
-node_prefix: NodePrefixRef<'a>,
+node_prefix: NodePrefix,
 ) -> Result, NodeMapError>;
 
 /// Same as `unique_prefix_len_bin`, with the hexadecimal representation
@@ -124,7 +124,7 @@
 idx: &impl RevlogIndex,
 prefix: &str,
 ) -> Result, NodeMapError> {
-self.unique_prefix_len_bin(idx, NodePrefix::from_hex(prefix)?.borrow())
+self.unique_prefix_len_bin(idx, NodePrefix::from_hex(prefix)?)
 }
 
 /// Same as `unique_prefix_len_bin`, with a full `Node` as input
@@ -295,7 +295,7 @@
 /// Return `None` unless the `Node` for `rev` has given prefix in `index`.
 fn has_prefix_or_none(
 idx: &impl RevlogIndex,
-prefix: NodePrefixRef,
+prefix: NodePrefix,
 rev: Revision,
 ) -> Result, NodeMapError> {
 idx.node(rev)
@@ -316,7 +316,7 @@
 /// revision is the only one for a *subprefix* of the one being looked up.
 fn validate_candidate(
 idx: &impl RevlogIndex,
-prefix: NodePrefixRef,
+prefix: NodePrefix,
 candidate: (Option, usize),
 ) -> Result<(Option, usize), NodeMapError> {
 let (rev, steps) = candidate;
@@ -442,7 +442,7 @@
 /// `NodeTree`).
 fn lookup(
 &self,
-prefix: NodePrefixRef,
+prefix: NodePrefix,
 ) -> Result<(Option, usize), NodeMapError> {
 for (i, visit_item) in self.visit(prefix).enumerate() {
 if let Some(opt) = visit_item.final_revision() {
@@ -452,10 +452,7 @@
 Err(NodeMapError::MultipleResults)
 }
 
-fn visit<'n, 'p>(
-&'n self,
-prefix: NodePrefixRef<'p>,
-) -> NodeTreeVisitor<'n, 'p> {
+fn visit<'n>(&'n s

D9864: rust: Remove hex parsing from the nodemap

2021-01-25 Thread SimonSapin
SimonSapin created this revision.
Herald added a reviewer: hg-reviewers.
Herald added a subscriber: mercurial-patches.

REVISION SUMMARY
  Separating concerns simplifies error types.

REPOSITORY
  rHG Mercurial

BRANCH
  default

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

AFFECTED FILES
  rust/hg-core/examples/nodemap/main.rs
  rust/hg-core/src/revlog/nodemap.rs
  rust/hg-cpython/src/revlog.rs

CHANGE DETAILS

diff --git a/rust/hg-cpython/src/revlog.rs b/rust/hg-cpython/src/revlog.rs
--- a/rust/hg-cpython/src/revlog.rs
+++ b/rust/hg-cpython/src/revlog.rs
@@ -17,7 +17,7 @@
 };
 use hg::{
 nodemap::{Block, NodeMapError, NodeTree},
-revlog::{nodemap::NodeMap, RevlogIndex},
+revlog::{nodemap::NodeMap, NodePrefix, RevlogIndex},
 Revision,
 };
 use std::cell::RefCell;
@@ -107,7 +107,9 @@
 String::from_utf8_lossy(node.data(py)).to_string()
 };
 
-nt.find_hex(idx, &node_as_string)
+let prefix = NodePrefix::from_hex(&node_as_string).map_err(|_| 
PyErr::new::(py, "Invalid node or prefix"))?;
+
+nt.find_bin(idx, prefix)
 // TODO make an inner API returning the node directly
 .map(|opt| opt.map(
 |rev| PyBytes::new(py, idx.node(rev).unwrap().as_bytes(
@@ -468,9 +470,6 @@
 match err {
 NodeMapError::MultipleResults => revlog_error(py),
 NodeMapError::RevisionNotInIndex(r) => rev_not_in_index(py, r),
-NodeMapError::InvalidNodePrefix => {
-PyErr::new::(py, "Invalid node or prefix")
-}
 }
 }
 
diff --git a/rust/hg-core/src/revlog/nodemap.rs 
b/rust/hg-core/src/revlog/nodemap.rs
--- a/rust/hg-core/src/revlog/nodemap.rs
+++ b/rust/hg-core/src/revlog/nodemap.rs
@@ -13,8 +13,7 @@
 //! is used in a more abstract context.
 
 use super::{
-node::NULL_NODE, FromHexError, Node, NodePrefix, Revision, RevlogIndex,
-NULL_REVISION,
+node::NULL_NODE, Node, NodePrefix, Revision, RevlogIndex, NULL_REVISION,
 };
 
 use std::cmp::max;
@@ -27,17 +26,10 @@
 #[derive(Debug, PartialEq)]
 pub enum NodeMapError {
 MultipleResults,
-InvalidNodePrefix,
 /// A `Revision` stored in the nodemap could not be found in the index
 RevisionNotInIndex(Revision),
 }
 
-impl From for NodeMapError {
-fn from(_: FromHexError) -> Self {
-NodeMapError::InvalidNodePrefix
-}
-}
-
 /// Mapping system from Mercurial nodes to revision numbers.
 ///
 /// ## `RevlogIndex` and `NodeMap`
@@ -85,21 +77,6 @@
 prefix: NodePrefix,
 ) -> Result, NodeMapError>;
 
-/// Find the unique Revision whose `Node` hexadecimal string representation
-/// starts with a given prefix
-///
-/// If no Revision matches the given prefix, `Ok(None)` is returned.
-///
-/// If several Revisions match the given prefix, a [`MultipleResults`]
-/// error is returned.
-fn find_hex(
-&self,
-idx: &impl RevlogIndex,
-prefix: &str,
-) -> Result, NodeMapError> {
-self.find_bin(idx, NodePrefix::from_hex(prefix)?)
-}
-
 /// Give the size of the shortest node prefix that determines
 /// the revision uniquely.
 ///
@@ -117,16 +94,6 @@
 node_prefix: NodePrefix,
 ) -> Result, NodeMapError>;
 
-/// Same as `unique_prefix_len_bin`, with the hexadecimal representation
-/// of the prefix as input.
-fn unique_prefix_len_hex(
-&self,
-idx: &impl RevlogIndex,
-prefix: &str,
-) -> Result, NodeMapError> {
-self.unique_prefix_len_bin(idx, NodePrefix::from_hex(prefix)?)
-}
-
 /// Same as `unique_prefix_len_bin`, with a full `Node` as input
 fn unique_prefix_len_node(
 &self,
@@ -819,6 +786,10 @@
 ])
 }
 
+fn hex(s: &str) -> NodePrefix {
+NodePrefix::from_hex(s).unwrap()
+}
+
 #[test]
 fn test_nt_debug() {
 let nt = sample_nodetree();
@@ -837,11 +808,11 @@
 pad_insert(&mut idx, 1, "1234deadcafe");
 
 let nt = NodeTree::from(vec![block! {1: Rev(1)}]);
-assert_eq!(nt.find_hex(&idx, "1")?, Some(1));
-assert_eq!(nt.find_hex(&idx, "12")?, Some(1));
-assert_eq!(nt.find_hex(&idx, "1234de")?, Some(1));
-assert_eq!(nt.find_hex(&idx, "1a")?, None);
-assert_eq!(nt.find_hex(&idx, "ab")?, None);
+assert_eq!(nt.find_bin(&idx, hex("1"))?, Some(1));
+assert_eq!(nt.find_bin(&idx, hex("12"))?, Some(1));
+assert_eq!(nt.find_bin(&idx, hex("1234de"))?, Some(1));
+assert_eq!(nt.find_bin(&idx, hex("1a"))?, None);
+assert_eq!(nt.find_bin(&idx, hex("ab"))?, None);
 
 // and with full binary Nodes
 assert_eq!(nt.find_node(&idx, idx.get(&1).unwrap())?, Some(1));
@@ -858,12 +829,12 @@
 
 let nt = sample_nodetree();
 
-assert_eq!(nt.find_hex(&idx, "0"), Err(MultipleResults));
-assert_eq!(nt.find_hex(&idx, "01"), Ok(Some(9)));
-assert_eq!(nt.find_hex(&idx, "00"), Err(MultipleResults));
-

D9862: rust: Exclude empty node prefixes

2021-01-25 Thread SimonSapin
SimonSapin created this revision.
Herald added a reviewer: hg-reviewers.
Herald added a subscriber: mercurial-patches.

REVISION SUMMARY
  We presumably don’t want `--rev ""` to select every single revision,
  even though the empty string is a prefix of all strings.

REPOSITORY
  rHG Mercurial

BRANCH
  default

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

AFFECTED FILES
  rust/hg-core/src/revlog/node.rs

CHANGE DETAILS

diff --git a/rust/hg-core/src/revlog/node.rs b/rust/hg-core/src/revlog/node.rs
--- a/rust/hg-core/src/revlog/node.rs
+++ b/rust/hg-core/src/revlog/node.rs
@@ -159,7 +159,7 @@
 pub fn from_hex(hex: impl AsRef<[u8]>) -> Result {
 let hex = hex.as_ref();
 let len = hex.len();
-if len > NODE_NYBBLES_LENGTH {
+if len > NODE_NYBBLES_LENGTH || len == 0 {
 return Err(FromHexError);
 }
 
@@ -200,10 +200,6 @@
 }
 }
 
-pub fn is_empty(&self) -> bool {
-self.len() == 0
-}
-
 pub fn is_prefix_of(&self, node: &Node) -> bool {
 if self.is_odd {
 let buf = self.buf;



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


D9861: rust: Simplify error type for reading hex node IDs

2021-01-25 Thread SimonSapin
SimonSapin created this revision.
Herald added a reviewer: hg-reviewers.
Herald added a subscriber: mercurial-patches.

REVISION SUMMARY
  If a string is not valid hexadecimal it’s not that useful to track the 
precise reason.

REPOSITORY
  rHG Mercurial

BRANCH
  default

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

AFFECTED FILES
  rust/hg-core/src/revlog.rs
  rust/hg-core/src/revlog/node.rs
  rust/hg-core/src/revlog/nodemap.rs
  rust/hg-cpython/src/revlog.rs

CHANGE DETAILS

diff --git a/rust/hg-cpython/src/revlog.rs b/rust/hg-cpython/src/revlog.rs
--- a/rust/hg-cpython/src/revlog.rs
+++ b/rust/hg-cpython/src/revlog.rs
@@ -18,7 +18,7 @@
 use hg::{
 nodemap::{Block, NodeMapError, NodeTree},
 revlog::{nodemap::NodeMap, RevlogIndex},
-NodeError, Revision,
+Revision,
 };
 use std::cell::RefCell;
 
@@ -468,17 +468,12 @@
 match err {
 NodeMapError::MultipleResults => revlog_error(py),
 NodeMapError::RevisionNotInIndex(r) => rev_not_in_index(py, r),
-NodeMapError::InvalidNodePrefix(s) => invalid_node_prefix(py, &s),
+NodeMapError::InvalidNodePrefix => {
+PyErr::new::(py, "Invalid node or prefix")
+}
 }
 }
 
-fn invalid_node_prefix(py: Python, ne: &NodeError) -> PyErr {
-PyErr::new::(
-py,
-format!("Invalid node or prefix: {:?}", ne),
-)
-}
-
 /// Create the module, with __package__ given from parent
 pub fn init_module(py: Python, package: &str) -> PyResult {
 let dotted_name = &format!("{}.revlog", package);
diff --git a/rust/hg-core/src/revlog/nodemap.rs 
b/rust/hg-core/src/revlog/nodemap.rs
--- a/rust/hg-core/src/revlog/nodemap.rs
+++ b/rust/hg-core/src/revlog/nodemap.rs
@@ -13,7 +13,7 @@
 //! is used in a more abstract context.
 
 use super::{
-node::NULL_NODE, Node, NodeError, NodePrefix, NodePrefixRef, Revision,
+node::NULL_NODE, FromHexError, Node, NodePrefix, NodePrefixRef, Revision,
 RevlogIndex, NULL_REVISION,
 };
 
@@ -27,14 +27,14 @@
 #[derive(Debug, PartialEq)]
 pub enum NodeMapError {
 MultipleResults,
-InvalidNodePrefix(NodeError),
+InvalidNodePrefix,
 /// A `Revision` stored in the nodemap could not be found in the index
 RevisionNotInIndex(Revision),
 }
 
-impl From for NodeMapError {
-fn from(err: NodeError) -> Self {
-NodeMapError::InvalidNodePrefix(err)
+impl From for NodeMapError {
+fn from(_: FromHexError) -> Self {
+NodeMapError::InvalidNodePrefix
 }
 }
 
diff --git a/rust/hg-core/src/revlog/node.rs b/rust/hg-core/src/revlog/node.rs
--- a/rust/hg-core/src/revlog/node.rs
+++ b/rust/hg-core/src/revlog/node.rs
@@ -8,7 +8,7 @@
 //! In Mercurial code base, it is customary to call "a node" the binary SHA
 //! of a revision.
 
-use hex::{self, FromHex, FromHexError};
+use hex::{self, FromHex};
 use std::convert::{TryFrom, TryInto};
 use std::fmt;
 
@@ -46,10 +46,9 @@
 /// if they need a loop boundary.
 ///
 /// All methods that create a `Node` either take a type that enforces
-/// the size or fail immediately at runtime with [`ExactLengthRequired`].
+/// the size or return an error at runtime.
 ///
 /// [`nybbles_len`]: #method.nybbles_len
-/// [`ExactLengthRequired`]: struct.NodeError#variant.ExactLengthRequired
 #[derive(Clone, Debug, PartialEq)]
 #[repr(transparent)]
 pub struct Node {
@@ -89,12 +88,8 @@
 }
 }
 
-#[derive(Debug, PartialEq)]
-pub enum NodeError {
-ExactLengthRequired(usize, String),
-PrefixTooLong(String),
-HexError(FromHexError, String),
-}
+#[derive(Debug)]
+pub struct FromHexError;
 
 /// Low level utility function, also for prefixes
 fn get_nybble(s: &[u8], i: usize) -> u8 {
@@ -127,9 +122,9 @@
 ///
 /// To be used in FFI and I/O only, in order to facilitate future
 /// changes of hash format.
-pub fn from_hex(hex: impl AsRef<[u8]>) -> Result {
+pub fn from_hex(hex: impl AsRef<[u8]>) -> Result {
 Ok(NodeData::from_hex(hex.as_ref())
-.map_err(|e| NodeError::from((e, hex)))?
+.map_err(|_| FromHexError)?
 .into())
 }
 
@@ -142,19 +137,6 @@
 }
 }
 
-impl> From<(FromHexError, T)> for NodeError {
-fn from(err_offender: (FromHexError, T)) -> Self {
-let (err, offender) = err_offender;
-let offender = String::from_utf8_lossy(offender.as_ref()).into_owned();
-match err {
-FromHexError::InvalidStringLength => {
-NodeError::ExactLengthRequired(NODE_NYBBLES_LENGTH, offender)
-}
-_ => NodeError::HexError(err, offender),
-}
-}
-}
-
 /// The beginning of a binary revision SHA.
 ///
 /// Since it can potentially come from an hexadecimal representation with
@@ -174,31 +156,22 @@
 ///
 /// To be used in FFI and I/O only, in order to facilitate future
 /// changes of hash format.
-pub fn from_hex(hex: impl AsRef<[u8]>) -> Result {
+pub fn from_hex(hex: impl AsRef<[u8]>) -> Result {
 let hex = hex.as_ref();

D9860: rust: replace Node::encode_hex with std::fmt::LowerHex

2021-01-25 Thread SimonSapin
SimonSapin created this revision.
Herald added a reviewer: hg-reviewers.
Herald added a subscriber: mercurial-patches.

REVISION SUMMARY
  This avoids allocating intermediate strings.

REPOSITORY
  rHG Mercurial

BRANCH
  default

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

AFFECTED FILES
  rust/hg-core/examples/nodemap/main.rs
  rust/hg-core/src/revlog/node.rs

CHANGE DETAILS

diff --git a/rust/hg-core/src/revlog/node.rs b/rust/hg-core/src/revlog/node.rs
--- a/rust/hg-core/src/revlog/node.rs
+++ b/rust/hg-core/src/revlog/node.rs
@@ -10,6 +10,7 @@
 
 use hex::{self, FromHex, FromHexError};
 use std::convert::{TryFrom, TryInto};
+use std::fmt;
 
 /// The length in bytes of a `Node`
 ///
@@ -79,6 +80,15 @@
 }
 }
 
+impl fmt::LowerHex for Node {
+fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
+for &byte in &self.data {
+write!(f, "{:02x}", byte)?
+}
+Ok(())
+}
+}
+
 #[derive(Debug, PartialEq)]
 pub enum NodeError {
 ExactLengthRequired(usize, String),
@@ -123,14 +133,6 @@
 .into())
 }
 
-/// Convert to hexadecimal string representation
-///
-/// To be used in FFI and I/O only, in order to facilitate future
-/// changes of hash format.
-pub fn encode_hex(&self) -> String {
-hex::encode(self.data)
-}
-
 /// Provide access to binary data
 ///
 /// This is needed by FFI layers, for instance to return expected
@@ -348,7 +350,7 @@
 
 #[test]
 fn test_node_encode_hex() {
-assert_eq!(sample_node().encode_hex(), sample_node_hex());
+assert_eq!(format!("{:x}", sample_node()), sample_node_hex());
 }
 
 #[test]
@@ -390,7 +392,7 @@
 "testgr".to_string()
 ))
 );
-let mut long = NULL_NODE.encode_hex();
+let mut long = format!("{:x}", NULL_NODE);
 long.push('c');
 match NodePrefix::from_hex(&long)
 .expect_err("should be refused as too long")
diff --git a/rust/hg-core/examples/nodemap/main.rs 
b/rust/hg-core/examples/nodemap/main.rs
--- a/rust/hg-core/examples/nodemap/main.rs
+++ b/rust/hg-core/examples/nodemap/main.rs
@@ -66,7 +66,7 @@
 .collect();
 if queries < 10 {
 let nodes_hex: Vec =
-nodes.iter().map(|n| n.encode_hex()).collect();
+nodes.iter().map(|n| format!("{:x}", n)).collect();
 println!("Nodes: {:?}", nodes_hex);
 }
 let mut last: Option = None;
@@ -76,11 +76,11 @@
 }
 let elapsed = start.elapsed();
 println!(
-"Did {} queries in {:?} (mean {:?}), last was {:?} with result {:?}",
+"Did {} queries in {:?} (mean {:?}), last was {:x} with result {:?}",
 queries,
 elapsed,
 elapsed / (queries as u32),
-nodes.last().unwrap().encode_hex(),
+nodes.last().unwrap(),
 last
 );
 }



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


mercurial@46353: new changeset (1 on stable)

2021-01-25 Thread Mercurial Commits
New changeset (1 on stable) in mercurial:

https://www.mercurial-scm.org/repo/hg/rev/a6c5ec6b4728
changeset:   46353:a6c5ec6b4728
branch:  stable
tag: tip
user:Gregory Szorc 
date:Sun Jan 24 18:24:11 2021 -0800
summary: contrib: update PyOxidizer to 0.10.3

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


[Bug 6475] New: sparse ext fails on getdirstate even if repo not use it

2021-01-25 Thread mercurial-bugs
https://bz.mercurial-scm.org/show_bug.cgi?id=6475

Bug ID: 6475
   Summary: sparse ext fails on getdirstate even if repo not use
it
   Product: Mercurial
   Version: 5.5.1
  Hardware: PC
OS: Windows
Status: UNCONFIRMED
  Severity: bug
  Priority: wish
 Component: Mercurial
  Assignee: bugzi...@mercurial-scm.org
  Reporter: alexraynepe...@gmail.com
CC: mercurial-devel@mercurial-scm.org
Python Version: ---

hallow!
use hg 5.5.1 installed on win8.1 py3.8

enabled sparse extention, and after it refreshing directry state always fail:

```
#!python
** Mercurial version (5.5.1).  TortoiseHg version (5.6.1+31-84d8dee08b86)
** Command: --nofork
** CWD: D:\projects\hg\thg\thg.work
** Encoding: cp1251
** Extensions loaded: convert, strip, mq, rebase, record, transplant,
highlight, show, commitextras, fix, share, hggit, censor, histedit, narrow,
closehead, remotenames, schemes, eol, extdiff, patchbomb, amend, evolve, topic,
absorb, split, uncommit, sparse, tortoisehg.util.configitems
** Python version: 3.8.3 (tags/v3.8.3:6f8c832, May 13 2020, 22:37:02) [MSC
v.1924 64 bit (AMD64)]
** Windows version: sys.getwindowsversion(major=6, minor=3, build=9600,
platform=2, service_pack='')
** Processor architecture: x64
** Qt-5.13.2 PyQt-5.13.2 QScintilla-2.10.8
Traceback (most recent call last):
  File "D:/projects/hg/hg-git\hggit\gitdirstate.py", line 77, in gignore
ignorefunc = matchmod.match(root, b'', [], allpats)
  File
"D:\projects\hg\thg\thg.work\venv.py38\lib\site-packages\mercurial\match.py",
line 276, in match
kindpats = normalize(include, b'glob', root, cwd, auditor, warn)
  File
"D:\projects\hg\thg\thg.work\venv.py38\lib\site-packages\mercurial\match.py",
line 329, in _donormalize
pat = pathutil.canonpath(root, cwd, pat, auditor=auditor)
  File
"D:\projects\hg\thg\thg.work\venv.py38\lib\site-packages\mercurial\pathutil.py",
line 263, in canonpath
raise error.Abort(
mercurial.error.Abort: \.directory not under root
'D:\projects\askon\spodes\DLMS.meterkit\cosemlib'

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "D:/projects/hg/hg-git\hggit\gitdirstate.py", line 83, in gignore
matchmod.match(root, b'', [], extrapatterns)
  File
"D:\projects\hg\thg\thg.work\venv.py38\lib\site-packages\mercurial\match.py",
line 276, in match
kindpats = normalize(include, b'glob', root, cwd, auditor, warn)
  File
"D:\projects\hg\thg\thg.work\venv.py38\lib\site-packages\mercurial\match.py",
line 329, in _donormalize
pat = pathutil.canonpath(root, cwd, pat, auditor=auditor)
  File
"D:\projects\hg\thg\thg.work\venv.py38\lib\site-packages\mercurial\pathutil.py",
line 263, in canonpath
raise error.Abort(
mercurial.error.Abort: \.directory not under root
'D:\projects\askon\spodes\DLMS.meterkit\cosemlib'

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "D:\projects\hg\thg\thg.work\tortoisehg\hgqt\status.py", line 760,
in run
status = self.repo.status(**stopts)
  File
"D:\projects\hg\thg\thg.work\venv.py38\lib\site-packages\mercurial\localrepo.py",
line 3324, in status
return self[node1].status(
  File
"D:\projects\hg\thg\thg.work\venv.py38\lib\site-packages\mercurial\context.py",
line 427, in status
r = ctx2._buildstatus(
  File
"D:\projects\hg\thg\thg.work\venv.py38\lib\site-packages\mercurial\context.py",
line 1961, in _buildstatus
s = self._dirstatestatus(match, listignored, listclean, listunknown)
  File
"D:\projects\hg\thg\thg.work\venv.py38\lib\site-packages\mercurial\context.py",
line 1870, in _dirstatestatus
cmp, s = self._repo.dirstate.status(
  File
"D:\projects\hg\thg\thg.work\venv.py38\lib\site-packages\mercurial\dirstate.py",
line 1247, in status
self.walk(match, subrepos, listunknown, listignored, full=full)
  File
"D:\projects\hg\thg\thg.work\venv.py38\lib\site-packages\mercurial\extensions.py",
line 509, in closure
return func(*(args + a), **kw)
  File
"D:\projects\hg\thg\thg.work\venv.py38\lib\site-packages\hgext\sparse.py", line
234, in walk
return orig(self, match, subrepos, unknown, ignored, full)
  File
"D:\projects\hg\thg\thg.work\venv.py38\lib\site-packages\mercurial\dirstate.py",
line 925, in walk
ignore = self._ignore
  File
"D:\projects\hg\thg\thg.work\venv.py38\lib\site-packages\mercurial\scmutil.py",
line 1622, in __get__
entry.obj = self.func(obj)
  File "D:/projects/hg/hg-git\hggit\gitdirstate.py", line 113, in _ignore
return gignore(self._root, files, self._ui.warn,
  File "D:/projects/hg/hg-git\hggit\gitdirstate.py", line 85, in gignore

[Bug 6474] New: narrow extention loose it`s page

2021-01-25 Thread mercurial-bugs
https://bz.mercurial-scm.org/show_bug.cgi?id=6474

Bug ID: 6474
   Summary: narrow extention loose it`s page
   Product: Mercurial
   Version: 5.6.1
  Hardware: All
OS: All
Status: UNCONFIRMED
  Severity: feature
  Priority: wish
 Component: Mercurial
  Assignee: bugzi...@mercurial-scm.org
  Reporter: alexraynepe...@gmail.com
CC: mercurial-devel@mercurial-scm.org
Python Version: ---

Hallow!

walk there https://www.mercurial-scm.org/wiki/UsingExtensions and try to poss
to `narrowhg` - it jumps to bitbucket droped repo.

where can i see how to use narrow extention?

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


D9859: rust: replace an unsafe use of transmute with a safe use of bytes-cast

2021-01-25 Thread SimonSapin
SimonSapin created this revision.
Herald added a reviewer: hg-reviewers.
Herald added a subscriber: mercurial-patches.

REPOSITORY
  rHG Mercurial

BRANCH
  default

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

AFFECTED FILES
  rust/hg-core/src/revlog/node.rs

CHANGE DETAILS

diff --git a/rust/hg-core/src/revlog/node.rs b/rust/hg-core/src/revlog/node.rs
--- a/rust/hg-core/src/revlog/node.rs
+++ b/rust/hg-core/src/revlog/node.rs
@@ -8,8 +8,9 @@
 //! In Mercurial code base, it is customary to call "a node" the binary SHA
 //! of a revision.
 
+use bytes_cast::BytesCast;
 use hex::{self, FromHex, FromHexError};
-use std::convert::{TryFrom, TryInto};
+use std::convert::TryFrom;
 
 /// The length in bytes of a `Node`
 ///
@@ -49,7 +50,7 @@
 ///
 /// [`nybbles_len`]: #method.nybbles_len
 /// [`ExactLengthRequired`]: struct.NodeError#variant.ExactLengthRequired
-#[derive(Clone, Debug, PartialEq)]
+#[derive(Clone, Debug, PartialEq, BytesCast)]
 #[repr(transparent)]
 pub struct Node {
 data: NodeData,
@@ -68,14 +69,14 @@
 
 /// Return an error if the slice has an unexpected length
 impl<'a> TryFrom<&'a [u8]> for &'a Node {
-type Error = std::array::TryFromSliceError;
+type Error = ();
 
 #[inline]
 fn try_from(bytes: &'a [u8]) -> Result<&'a Node, Self::Error> {
-let data = bytes.try_into()?;
-// Safety: `#[repr(transparent)]` makes it ok to "wrap" the target
-// of a reference to the type of the single field.
-Ok(unsafe { std::mem::transmute::<&NodeData, &Node>(data) })
+match Node::from_bytes(bytes) {
+Ok((node, rest)) if rest.is_empty() => Ok(node),
+_ => Err(()),
+}
 }
 }
 



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