[PATCH 1 of 5 stable] py3: unbyteify arguments to warnings.filterwarnings()

2020-06-15 Thread Manuel Jacob
# HG changeset patch
# User Manuel Jacob 
# Date 1592183395 -7200
#  Mon Jun 15 03:09:55 2020 +0200
# Branch stable
# Node ID 0dddc84a6a1ac5bb027b66c12d79aa5916d2b05b
# Parent  6c8384afbf770be2167478fff3cb9b92e1182a06
# EXP-Topic convert-svn
py3: unbyteify arguments to warnings.filterwarnings()

This fixes a crash when trying to import the convert extension on Python 3.

diff --git a/hgext/convert/subversion.py b/hgext/convert/subversion.py
--- a/hgext/convert/subversion.py
+++ b/hgext/convert/subversion.py
@@ -55,7 +55,7 @@
 import warnings
 
 warnings.filterwarnings(
-b'ignore', module=b'svn.core', category=DeprecationWarning
+'ignore', module='svn.core', category=DeprecationWarning
 )
 svn.core.SubversionException  # trigger import to catch error
 

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


[PATCH 5 of 5 stable] py3: ignore warning about deprecated `base64.encodestring()`

2020-06-15 Thread Manuel Jacob
# HG changeset patch
# User Manuel Jacob 
# Date 1592185813 -7200
#  Mon Jun 15 03:50:13 2020 +0200
# Branch stable
# Node ID 4771e5ae53c4d6fe4c4cc66497930f06c16e6179
# Parent  f86ca8753fb2a1c15c8abda7991181e09ad36071
# EXP-Topic convert-svn
py3: ignore warning about deprecated `base64.encodestring()`

It fixes the following warning:
hgext/convert/common.py:89: DeprecationWarning: encodestring() is a deprecated 
alias since 3.1, use encodebytes()
  lines = base64.encodestring(s)

`base64.encodebytes()` doesn’t exist on Python 2. Therefore, we continue to use
`base64.encodestring()`.

An alternative way to get rid of this warning would have been to call
`base64.encodebytes()` if available, and `base64.encodestring()` otherwise.

diff --git a/mercurial/util.py b/mercurial/util.py
--- a/mercurial/util.py
+++ b/mercurial/util.py
@@ -191,6 +191,9 @@
 DeprecationWarning,
 'mercurial',
 )
+warnings.filterwarnings(
+'ignore', 'encodestring', DeprecationWarning, 'hgext'
+)
 
 
 def nouideprecwarn(msg, version, stacklevel=1):
___
Mercurial-devel mailing list
Mercurial-devel@mercurial-scm.org
https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel


[PATCH 2 of 5 stable] py3: fix bytes iteration

2020-06-15 Thread Manuel Jacob
# HG changeset patch
# User Manuel Jacob 
# Date 1592184624 -7200
#  Mon Jun 15 03:30:24 2020 +0200
# Branch stable
# Node ID 343142bb73bafe1ad2a244905e63770fb31a0ee0
# Parent  0dddc84a6a1ac5bb027b66c12d79aa5916d2b05b
# EXP-Topic convert-svn
py3: fix bytes iteration

diff --git a/hgext/convert/common.py b/hgext/convert/common.py
--- a/hgext/convert/common.py
+++ b/hgext/convert/common.py
@@ -87,7 +87,7 @@
 def encodeargs(args):
 def encodearg(s):
 lines = base64.encodestring(s)
-lines = [l.splitlines()[0] for l in lines]
+lines = [l.splitlines()[0] for l in pycompat.iterbytestr(lines)]
 return b''.join(lines)
 
 s = pickle.dumps(args)

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


[PATCH 4 of 5 stable] py3: use `pycompat.ziplist()`

2020-06-15 Thread Manuel Jacob
# HG changeset patch
# User Manuel Jacob 
# Date 1592185082 -7200
#  Mon Jun 15 03:38:02 2020 +0200
# Branch stable
# Node ID f86ca8753fb2a1c15c8abda7991181e09ad36071
# Parent  23c7b0389ff76d99d4fb245092720b7229b66544
# EXP-Topic convert-svn
py3: use `pycompat.ziplist()`

diff --git a/hgext/convert/subversion.py b/hgext/convert/subversion.py
--- a/hgext/convert/subversion.py
+++ b/hgext/convert/subversion.py
@@ -597,7 +597,7 @@
 self.removed = set()
 
 files.sort()
-files = zip(files, [rev] * len(files))
+files = pycompat.ziplist(files, [rev] * len(files))
 return (files, copies)
 
 def getchanges(self, rev, full):

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


[PATCH 3 of 5 stable] py3: use `%d` for int in % formatting

2020-06-15 Thread Manuel Jacob
# HG changeset patch
# User Manuel Jacob 
# Date 1592184863 -7200
#  Mon Jun 15 03:34:23 2020 +0200
# Branch stable
# Node ID 23c7b0389ff76d99d4fb245092720b7229b66544
# Parent  343142bb73bafe1ad2a244905e63770fb31a0ee0
# EXP-Topic convert-svn
py3: use `%d` for int in % formatting

On Python 3, `%s` is an alias to `%b`, which requires that the object implements
`__bytes__()`, which is not the case for `int`.

diff --git a/hgext/convert/subversion.py b/hgext/convert/subversion.py
--- a/hgext/convert/subversion.py
+++ b/hgext/convert/subversion.py
@@ -773,7 +773,7 @@
 self.convertfp.flush()
 
 def revid(self, revnum, module=None):
-return b'svn:%s%s@%s' % (self.uuid, module or self.module, revnum)
+return b'svn:%s%s@%d' % (self.uuid, module or self.module, revnum)
 
 def revnum(self, rev):
 return int(rev.split(b'@')[-1])

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


mercurial@44962: 3 new changesets

2020-06-15 Thread Mercurial Commits
3 new changesets in mercurial:

https://www.mercurial-scm.org/repo/hg/rev/78cafd48b9b2
changeset:   44960:78cafd48b9b2
parent:  44953:50005af3c7a8
parent:  44959:170f8a43b5b8
user:Augie Fackler 
date:Mon Jun 15 12:00:15 2020 -0400
summary: merge with stable

https://www.mercurial-scm.org/repo/hg/rev/ee5f27d7b9fb
changeset:   44961:ee5f27d7b9fb
user:Augie Fackler 
date:Mon Jun 15 15:13:01 2020 -0400
summary: pyutil: this has taken so long to fix, I'm using 3.8 now

https://www.mercurial-scm.org/repo/hg/rev/ef8dcee272ac
changeset:   44962:ef8dcee272ac
bookmark:@
tag: tip
user:Augie Fackler 
date:Mon Jun 15 15:14:16 2020 -0400
summary: fuzz: add config knob for PYTHON_CONFIG_FLAGS

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


D8636: pyutil: this has taken so long to fix, I'm using 3.8 now

2020-06-15 Thread durin42 (Augie Fackler)
durin42 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/D8636

AFFECTED FILES
  contrib/fuzz/pyutil.cc

CHANGE DETAILS

diff --git a/contrib/fuzz/pyutil.cc b/contrib/fuzz/pyutil.cc
--- a/contrib/fuzz/pyutil.cc
+++ b/contrib/fuzz/pyutil.cc
@@ -21,7 +21,7 @@
 void initpy(const char *cselfpath)
 {
 #ifdef HG_FUZZER_PY3
-   const std::string subdir = "/sanpy/lib/python3.7";
+   const std::string subdir = "/sanpy/lib/python3.8";
 #else
const std::string subdir = "/sanpy/lib/python2.7";
 #endif



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


D8637: fuzz: add config knob for PYTHON_CONFIG_FLAGS

2020-06-15 Thread durin42 (Augie Fackler)
durin42 created this revision.
Herald added a reviewer: hg-reviewers.
Herald added a subscriber: mercurial-patches.

REVISION SUMMARY
  I'll clean this up once we get oss-fuzz to use Python 3.8 instead of
  2.7, but for now we need a way to evolve the flags passed to
  python-config in lockstep with the Python version. Yuck.

REPOSITORY
  rHG Mercurial

BRANCH
  default

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

AFFECTED FILES
  contrib/fuzz/Makefile

CHANGE DETAILS

diff --git a/contrib/fuzz/Makefile b/contrib/fuzz/Makefile
--- a/contrib/fuzz/Makefile
+++ b/contrib/fuzz/Makefile
@@ -11,6 +11,7 @@
 LIB_FUZZING_ENGINE ?= standalone_fuzz_target_runner.o
 
 PYTHON_CONFIG ?= $$OUT/sanpy/bin/python-config
+PYTHON_CONFIG_FLAGS ?= --ldflags
 
 CXXFLAGS += -Wno-deprecated-register
 
@@ -67,7 +68,7 @@
  -Wno-register -Wno-macro-redefined \
  -I../../mercurial dirs.cc \
  pyutil.o $(PARSERS_OBJS) \
- $(LIB_FUZZING_ENGINE) `$(PYTHON_CONFIG) --ldflags` \
+ $(LIB_FUZZING_ENGINE) `$(PYTHON_CONFIG) $(PYTHON_CONFIG_FLAGS)` \
  -o $$OUT/dirs_fuzzer
 
 fncache_fuzzer: fncache.cc 
@@ -75,7 +76,7 @@
  -Wno-register -Wno-macro-redefined \
  -I../../mercurial fncache.cc \
  pyutil.o $(PARSERS_OBJS) \
- $(LIB_FUZZING_ENGINE) `$(PYTHON_CONFIG) --ldflags` \
+ $(LIB_FUZZING_ENGINE) `$(PYTHON_CONFIG) $(PYTHON_CONFIG_FLAGS)` \
  -o $$OUT/fncache_fuzzer
 
 jsonescapeu8fast_fuzzer: jsonescapeu8fast.cc pyutil.o $(PARSERS_OBJS)
@@ -83,7 +84,7 @@
  -Wno-register -Wno-macro-redefined \
  -I../../mercurial jsonescapeu8fast.cc \
  pyutil.o $(PARSERS_OBJS) \
- $(LIB_FUZZING_ENGINE) `$(PYTHON_CONFIG) --ldflags` \
+ $(LIB_FUZZING_ENGINE) `$(PYTHON_CONFIG) $(PYTHON_CONFIG_FLAGS)` \
  -o $$OUT/jsonescapeu8fast_fuzzer
 
 manifest_fuzzer: manifest.cc pyutil.o $(PARSERS_OBJS) 
$$OUT/manifest_fuzzer_seed_corpus.zip
@@ -91,7 +92,7 @@
  -Wno-register -Wno-macro-redefined \
  -I../../mercurial manifest.cc \
  pyutil.o $(PARSERS_OBJS) \
- $(LIB_FUZZING_ENGINE) `$(PYTHON_CONFIG) --ldflags` \
+ $(LIB_FUZZING_ENGINE) `$(PYTHON_CONFIG) $(PYTHON_CONFIG_FLAGS)` \
  -o $$OUT/manifest_fuzzer
 
 revlog_fuzzer: revlog.cc pyutil.o $(PARSERS_OBJS) 
$$OUT/revlog_fuzzer_seed_corpus.zip
@@ -99,7 +100,7 @@
  -Wno-register -Wno-macro-redefined \
  -I../../mercurial revlog.cc \
  pyutil.o $(PARSERS_OBJS) \
- $(LIB_FUZZING_ENGINE) `$(PYTHON_CONFIG) --ldflags` \
+ $(LIB_FUZZING_ENGINE) `$(PYTHON_CONFIG) $(PYTHON_CONFIG_FLAGS)` \
  -o $$OUT/revlog_fuzzer
 
 dirstate_fuzzer: dirstate.cc pyutil.o $(PARSERS_OBJS) 
$$OUT/dirstate_fuzzer_seed_corpus.zip
@@ -107,7 +108,7 @@
  -Wno-register -Wno-macro-redefined \
  -I../../mercurial dirstate.cc \
  pyutil.o $(PARSERS_OBJS) \
- $(LIB_FUZZING_ENGINE) `$(PYTHON_CONFIG) --ldflags` \
+ $(LIB_FUZZING_ENGINE) `$(PYTHON_CONFIG) $(PYTHON_CONFIG_FLAGS)` \
  -o $$OUT/dirstate_fuzzer
 
 fm1readmarkers_fuzzer: fm1readmarkers.cc pyutil.o $(PARSERS_OBJS) 
$$OUT/fm1readmarkers_fuzzer_seed_corpus.zip
@@ -115,7 +116,7 @@
  -Wno-register -Wno-macro-redefined \
  -I../../mercurial fm1readmarkers.cc \
  pyutil.o $(PARSERS_OBJS) \
- $(LIB_FUZZING_ENGINE) `$(PYTHON_CONFIG) --ldflags` \
+ $(LIB_FUZZING_ENGINE) `$(PYTHON_CONFIG) $(PYTHON_CONFIG_FLAGS)` \
  -o $$OUT/fm1readmarkers_fuzzer
 
 clean:



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


D8635: rust: do a clippy pass

2020-06-15 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 result of running `cargo clippy` on hg-core/hg-cpython and fixing
  the lints that do not require too much code churn (and would warrant a 
separate
  commit/complete refactor) and only come from our code (a lot of warnings in
  hg-cpython come from `rust-cpython`).
  
  Most of those were good lints, two of them was the linter not being smart
  enough (or compiler to get up to `clippy`'s level depending on how you see 
it).
  
  Maybe in the future we could have `clippy` be part of the CI.

REPOSITORY
  rHG Mercurial

BRANCH
  default

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

AFFECTED FILES
  rust/hg-core/src/ancestors.rs
  rust/hg-core/src/dagops.rs
  rust/hg-core/src/dirstate/dirs_multiset.rs
  rust/hg-core/src/dirstate/dirstate_map.rs
  rust/hg-core/src/dirstate/parsers.rs
  rust/hg-core/src/dirstate/status.rs
  rust/hg-core/src/discovery.rs
  rust/hg-core/src/filepatterns.rs
  rust/hg-core/src/matchers.rs
  rust/hg-core/src/revlog.rs
  rust/hg-core/src/revlog/node.rs
  rust/hg-core/src/revlog/nodemap.rs
  rust/hg-core/src/utils.rs
  rust/hg-core/src/utils/files.rs
  rust/hg-core/src/utils/hg_path.rs
  rust/hg-core/src/utils/path_auditor.rs
  rust/hg-cpython/src/cindex.rs
  rust/hg-cpython/src/dirstate/copymap.rs
  rust/hg-cpython/src/dirstate/dirs_multiset.rs
  rust/hg-cpython/src/dirstate/dirstate_map.rs
  rust/hg-cpython/src/dirstate/non_normal_entries.rs
  rust/hg-cpython/src/dirstate/status.rs
  rust/hg-cpython/src/parsers.rs
  rust/hg-cpython/src/utils.rs

CHANGE DETAILS

diff --git a/rust/hg-cpython/src/utils.rs b/rust/hg-cpython/src/utils.rs
--- a/rust/hg-cpython/src/utils.rs
+++ b/rust/hg-cpython/src/utils.rs
@@ -32,10 +32,7 @@
 
 /// Clone incoming Python bytes given as `PyBytes` as a `Node`,
 /// doing the necessary checks.
-pub fn node_from_py_bytes<'a>(
-py: Python,
-bytes: &'a PyBytes,
-) -> PyResult {
+pub fn node_from_py_bytes(py: Python, bytes: ) -> PyResult {
 ::try_from(bytes.data(py))
 .map_err(|_| {
 PyErr::new::(
@@ -43,5 +40,5 @@
 format!("{}-byte hash required", NODE_BYTES_LENGTH),
 )
 })
-.map(|n| n.into())
+.map(Into::into)
 }
diff --git a/rust/hg-cpython/src/parsers.rs b/rust/hg-cpython/src/parsers.rs
--- a/rust/hg-cpython/src/parsers.rs
+++ b/rust/hg-cpython/src/parsers.rs
@@ -37,15 +37,15 @@
 for (filename, entry) in _map {
 dmap.set_item(
 py,
-PyBytes::new(py, filename.as_ref()),
+PyBytes::new(py, filename.as_bytes()),
 make_dirstate_tuple(py, entry)?,
 )?;
 }
 for (path, copy_path) in copies {
 copymap.set_item(
 py,
-PyBytes::new(py, path.as_ref()),
-PyBytes::new(py, copy_path.as_ref()),
+PyBytes::new(py, path.as_bytes()),
+PyBytes::new(py, copy_path.as_bytes()),
 )?;
 }
 Ok(
@@ -116,7 +116,7 @@
 for (filename, entry) in _map {
 dmap.set_item(
 py,
-PyBytes::new(py, filename.as_ref()),
+PyBytes::new(py, filename.as_bytes()),
 make_dirstate_tuple(py, entry)?,
 )?;
 }
diff --git a/rust/hg-cpython/src/dirstate/status.rs 
b/rust/hg-cpython/src/dirstate/status.rs
--- a/rust/hg-cpython/src/dirstate/status.rs
+++ b/rust/hg-cpython/src/dirstate/status.rs
@@ -236,12 +236,10 @@
 
 build_response(py, lookup, status_res, all_warnings)
 }
-e => {
-return Err(PyErr::new::(
-py,
-format!("Unsupported matcher {}", e),
-));
-}
+e => Err(PyErr::new::(
+py,
+format!("Unsupported matcher {}", e),
+)),
 }
 }
 
diff --git a/rust/hg-cpython/src/dirstate/non_normal_entries.rs 
b/rust/hg-cpython/src/dirstate/non_normal_entries.rs
--- a/rust/hg-cpython/src/dirstate/non_normal_entries.rs
+++ b/rust/hg-cpython/src/dirstate/non_normal_entries.rs
@@ -62,7 +62,7 @@
 py: Python,
 key: ,
 ) -> PyResult> {
-Ok(Some(PyBytes::new(py, key.as_ref(
+Ok(Some(PyBytes::new(py, key.as_bytes(
 }
 }
 
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
@@ -179,7 +179,7 @@
 "other_parent",
 other_parent
 .iter()
-.map(|v| PyBytes::new(py, v.as_ref()))
+.map(|v| PyBytes::new(py, v.as_bytes()))
 .collect::>()
  

D8634: hg-core: commit forgotten Cargo.lock

2020-06-15 Thread Raphaël Gomès
Alphare created this revision.
Herald added a reviewer: hg-reviewers.
Herald added a subscriber: mercurial-patches.

REVISION SUMMARY
  This should have been in 2093b2fc70d4 
, 
but I apparently forgot.

REPOSITORY
  rHG Mercurial

BRANCH
  default

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

AFFECTED FILES
  rust/Cargo.lock

CHANGE DETAILS

diff --git a/rust/Cargo.lock b/rust/Cargo.lock
--- a/rust/Cargo.lock
+++ b/rust/Cargo.lock
@@ -210,7 +210,7 @@
  "log 0.4.8 (registry+https://github.com/rust-lang/crates.io-index)",
  "memchr 2.3.3 (registry+https://github.com/rust-lang/crates.io-index)",
  "memmap 0.7.0 (registry+https://github.com/rust-lang/crates.io-index)",
- "micro-timer 0.2.1 (registry+https://github.com/rust-lang/crates.io-index)",
+ "micro-timer 0.3.0 (registry+https://github.com/rust-lang/crates.io-index)",
  "pretty_assertions 0.6.1 
(registry+https://github.com/rust-lang/crates.io-index)",
  "rand 0.7.3 (registry+https://github.com/rust-lang/crates.io-index)",
  "rand_distr 0.2.2 (registry+https://github.com/rust-lang/crates.io-index)",
@@ -280,16 +280,16 @@
 
 [[package]]
 name = "micro-timer"
-version = "0.2.1"
+version = "0.3.0"
 source = "registry+https://github.com/rust-lang/crates.io-index;
 dependencies = [
- "micro-timer-macros 0.2.0 
(registry+https://github.com/rust-lang/crates.io-index)",
+ "micro-timer-macros 0.3.0 
(registry+https://github.com/rust-lang/crates.io-index)",
  "scopeguard 1.1.0 (registry+https://github.com/rust-lang/crates.io-index)",
 ]
 
 [[package]]
 name = "micro-timer-macros"
-version = "0.2.0"
+version = "0.3.0"
 source = "registry+https://github.com/rust-lang/crates.io-index;
 dependencies = [
  "proc-macro2 1.0.9 (registry+https://github.com/rust-lang/crates.io-index)",
@@ -672,8 +672,8 @@
 "checksum memchr 2.3.3 
(registry+https://github.com/rust-lang/crates.io-index)" = 
"3728d817d99e5ac407411fa471ff9800a778d88a24685968b36824eaf4bee400"
 "checksum memmap 0.7.0 
(registry+https://github.com/rust-lang/crates.io-index)" = 
"6585fd95e7bb50d6cc31e20d4cf9afb4e2ba16c5846fc76793f11218da9c475b"
 "checksum memoffset 0.5.3 
(registry+https://github.com/rust-lang/crates.io-index)" = 
"75189eb85871ea5c2e2c15abbdd541185f63b408415e5051f5cac122d8c774b9"
-"checksum micro-timer 0.2.1 
(registry+https://github.com/rust-lang/crates.io-index)" = 
"987429cd6162a80ed5ff44fc790f5090b1c6d617ac73a2e272965ed91201d79b"
-"checksum micro-timer-macros 0.2.0 
(registry+https://github.com/rust-lang/crates.io-index)" = 
"43cec5c0b38783eb33ef7bccf4b250b7a085703e11f5f2238fa31969e629388a"
+"checksum micro-timer 0.3.0 
(registry+https://github.com/rust-lang/crates.io-index)" = 
"25b31d6cb9112984323d05d7a353f272ae5d7a307074f9ab9b25c00121b8c947"
+"checksum micro-timer-macros 0.3.0 
(registry+https://github.com/rust-lang/crates.io-index)" = 
"5694085dd384bb9e824207facc040c248d9df653f55e28c3ad0686958b448504"
 "checksum num-integer 0.1.42 
(registry+https://github.com/rust-lang/crates.io-index)" = 
"3f6ea62e9d81a77cd3ee9a2a5b9b609447857f3d358704331e4ef39eb247fcba"
 "checksum num-traits 0.2.11 
(registry+https://github.com/rust-lang/crates.io-index)" = 
"c62be47e61d1842b9170f0fdeec8eba98e60e90e5446449a0545e5152acd7096"
 "checksum num_cpus 1.12.0 
(registry+https://github.com/rust-lang/crates.io-index)" = 
"46203554f085ff89c235cd12f7075f3233af9b11ed7c9e16dfe2560d03313ce6"



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@44959: 6 new changesets (6 on stable)

2020-06-15 Thread Mercurial Commits
6 new changesets (6 on stable) in mercurial:

https://www.mercurial-scm.org/repo/hg/rev/affe0fb42250
changeset:   44954:affe0fb42250
branch:  stable
parent:  44924:6c8384afbf77
user:Pierre-Yves David 
date:Sat Jun 13 11:57:58 2020 +0200
summary: nodemap: fix validity checking when revlog is too short

https://www.mercurial-scm.org/repo/hg/rev/b77d5b568496
changeset:   44955:b77d5b568496
branch:  stable
user:Adam Hull 
date:Fri Jun 12 14:22:34 2020 -0700
summary: ignore: note debugignore on ignore man page

https://www.mercurial-scm.org/repo/hg/rev/ba7eda4fcf8e
changeset:   44956:ba7eda4fcf8e
branch:  stable
user:Pierre-Yves David 
date:Sat Jun 13 11:06:22 2020 +0200
summary: zeroconf: fix non existant formatting in the vendored zeroconf 
module

https://www.mercurial-scm.org/repo/hg/rev/1ca0d5cae9bc
changeset:   44957:1ca0d5cae9bc
branch:  stable
user:Anton Shestakov 
date:Sat Jun 06 19:19:27 2020 +0800
summary: tests: skip pyflakes for mercurial/thirdparty/

https://www.mercurial-scm.org/repo/hg/rev/f9099e210c57
changeset:   44958:f9099e210c57
branch:  stable
user:Anton Shestakov 
date:Sat Jun 06 19:12:49 2020 +0800
summary: tests: consistently use pyflakes as a Python module

https://www.mercurial-scm.org/repo/hg/rev/170f8a43b5b8
changeset:   44959:170f8a43b5b8
branch:  stable
tag: tip
user:Anton Shestakov 
date:Sat Jun 06 19:15:11 2020 +0800
summary: tests: adjust to the new format in pyflakes output

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


D8633: share: introduce config option to store requires in .hg/store

2020-06-15 Thread pulkit (Pulkit Goyal)
pulkit created this revision.
Herald added a reviewer: hg-reviewers.
Herald added a subscriber: mercurial-patches.

REVISION SUMMARY
  This introduces a config option which enabled stores the requirements on a
  repository in store instead.
  
  When enabled, `.hg/requires` will contain the exp-share-safe requirement which
  marks that the requirements are present in the store.
  This is done so that repository requirements can be shared with shares made
  using `hg share` command.
  
  After this patch, `hg share` checks whether the source repository has
  exp-share-safe requirement, if yes, it does not copy the requirements.
  
  Logic to read requirements from store of source of shared repository is also
  added.

REPOSITORY
  rHG Mercurial

BRANCH
  default

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

AFFECTED FILES
  mercurial/configitems.py
  mercurial/localrepo.py
  mercurial/store.py
  tests/test-share-safe.t

CHANGE DETAILS

diff --git a/tests/test-share-safe.t b/tests/test-share-safe.t
new file mode 100644
--- /dev/null
+++ b/tests/test-share-safe.t
@@ -0,0 +1,69 @@
+setup
+
+  $ cat >> $HGRCPATH < [extensions]
+  > share =
+  > [format]
+  > exp-share-safe = True
+  > EOF
+
+prepare source repo
+
+  $ hg init source
+  $ cd source
+  $ cat .hg/requires
+  exp-sharesafe
+  $ cat .hg/store/requires
+  dotencode
+  fncache
+  generaldelta
+  revlogv1
+  sparserevlog
+  store
+  $ hg debugrequirements
+  dotencode
+  exp-sharesafe
+  fncache
+  generaldelta
+  revlogv1
+  sparserevlog
+  store
+
+  $ echo a > a
+  $ hg ci -Aqm "added a"
+  $ echo b > b
+  $ hg ci -Aqm "added b"
+  $ cd ..
+
+Create a shared repo and check the requirements are shared and read correctly
+  $ hg share source shared1
+  updating working directory
+  2 files updated, 0 files merged, 0 files removed, 0 files unresolved
+  $ cd shared1
+  $ cat .hg/requires
+  exp-sharesafe
+  shared
+
+  $ hg debugrequirements -R ../source
+  dotencode
+  exp-sharesafe
+  fncache
+  generaldelta
+  revlogv1
+  sparserevlog
+  store
+
+  $ hg debugrequirements
+  dotencode
+  exp-sharesafe
+  fncache
+  generaldelta
+  revlogv1
+  shared
+  sparserevlog
+  store
+
+  $ echo c > c
+  $ hg ci -Aqm "added c"
+
+  $ hg unshare
diff --git a/mercurial/store.py b/mercurial/store.py
--- a/mercurial/store.py
+++ b/mercurial/store.py
@@ -375,7 +375,7 @@
 
 _data = (
 b'bookmarks narrowspec data meta 00manifest.d 00manifest.i'
-b' 00changelog.d 00changelog.i phaseroots obsstore'
+b' 00changelog.d 00changelog.i phaseroots obsstore requires'
 )
 
 
@@ -447,7 +447,7 @@
 yield x
 
 def copylist(self):
-return [b'requires'] + _data.split()
+return _data.split()
 
 def write(self, tr):
 pass
@@ -687,7 +687,7 @@
 def copylist(self):
 d = (
 b'bookmarks narrowspec data meta dh fncache phaseroots obsstore'
-b' 00manifest.d 00manifest.i 00changelog.d 00changelog.i'
+b' 00manifest.d 00manifest.i 00changelog.d 00changelog.i requires'
 )
 return [b'requires', b'00changelog.i'] + [
 b'store/' + f for f in d.split()
diff --git a/mercurial/localrepo.py b/mercurial/localrepo.py
--- a/mercurial/localrepo.py
+++ b/mercurial/localrepo.py
@@ -449,6 +449,11 @@
 # The repository use persistent nodemap for the changelog and the manifest.
 NODEMAP_REQUIREMENT = b'persistent-nodemap'
 
+# A repository with share implemented safely. The repository has different
+# store and working copy requirements i.e. both `.hg/requires` and
+# `.hg/store/requires` are present.
+SHARESAFE_REQUIREMENT = b'exp-sharesafe'
+
 # Functions receiving (ui, features) that extensions can register to impact
 # the ability to load repositories with custom requirements. Only
 # functions defined in loaded extensions are called.
@@ -529,6 +534,23 @@
 raise
 requirements = set()
 
+# if .hg/requires contains the exp-sharesafe requirement, it means
+# there exists a `.hg/store/requires` too and we should read it
+# TODO: make this code more stricter by checking whether store exists
+# and other checks
+if SHARESAFE_REQUIREMENT in requirements:
+if hgvfs.exists(b'sharedpath'):
+# This is a shared repo
+sharedsource = hgvfs.read(b'sharedpath')
+storevfs = vfsmod.vfs(vfsmod.vfs(sharedsource).join(b'store'))
+else:
+storevfs = vfsmod.vfs(hgvfs.join(b'store'), cacheaudited=True)
+try:
+store_requirements = set(storevfs.read(b'requires').splitlines())
+requirements |= store_requirements
+except IOError as e:
+pass
+
 # The .hg/hgrc file may load extensions or contain config options
 # that influence repository construction. Attempt to load it and
 # process any new extensions that it may have pulled in.
@@ -1034,6 +1056,7 @@
 SPARSEREVLOG_REQUIREMENT,
 NODEMAP_REQUIREMENT,
 

D8632: debugcommands: introduce new debugrequirements command

2020-06-15 Thread pulkit (Pulkit Goyal)
pulkit created this revision.
Herald added a reviewer: hg-reviewers.
Herald added a subscriber: mercurial-patches.

REVISION SUMMARY
  This for now just prints out the list of current requirements. In future this
  will be helpful in reading requirements from couple of sources, and checking
  which requirement comes from where.

REPOSITORY
  rHG Mercurial

BRANCH
  default

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

AFFECTED FILES
  mercurial/debugcommands.py
  tests/test-completion.t
  tests/test-help.t
  tests/test-requires.t

CHANGE DETAILS

diff --git a/tests/test-requires.t b/tests/test-requires.t
--- a/tests/test-requires.t
+++ b/tests/test-requires.t
@@ -48,6 +48,14 @@
   > # enable extension locally
   > supportlocally = $TESTTMP/supported-locally/supportlocally.py
   > EOF
+  $ hg -R supported debugrequirements
+  dotencode
+  featuresetup-test
+  fncache
+  generaldelta
+  revlogv1
+  sparserevlog
+  store
   $ hg -R supported status
 
   $ hg init push-dst
diff --git a/tests/test-help.t b/tests/test-help.t
--- a/tests/test-help.t
+++ b/tests/test-help.t
@@ -1051,6 +1051,8 @@
debugrebuildfncache
  rebuild the fncache file
debugrename   dump rename information
+   debugrequires
+ print the current repo requirements
debugrevlog   show data and statistics about a revlog
debugrevlogindex
  dump the contents of a revlog index
diff --git a/tests/test-completion.t b/tests/test-completion.t
--- a/tests/test-completion.t
+++ b/tests/test-completion.t
@@ -121,6 +121,7 @@
   debugrebuilddirstate
   debugrebuildfncache
   debugrename
+  debugrequires
   debugrevlog
   debugrevlogindex
   debugrevspec
@@ -306,6 +307,7 @@
   debugrebuilddirstate: rev, minimal
   debugrebuildfncache: 
   debugrename: rev
+  debugrequires: 
   debugrevlog: changelog, manifest, dir, dump
   debugrevlogindex: changelog, manifest, dir, format
   debugrevspec: optimize, show-revs, show-set, show-stage, no-optimized, 
verify-optimized
diff --git a/mercurial/debugcommands.py b/mercurial/debugcommands.py
--- a/mercurial/debugcommands.py
+++ b/mercurial/debugcommands.py
@@ -2651,6 +2651,13 @@
 ui.write(_(b"%s not renamed\n") % rel)
 
 
+@command(b'debugrequires|debugrequirements', [], b'')
+def debugrequirements(ui, repo):
+""" print the current repo requirements """
+for r in sorted(repo.requirements):
+ui.write(b"%s\n" % r)
+
+
 @command(
 b'debugrevlog',
 cmdutil.debugrevlogopts + [(b'd', b'dump', False, _(b'dump index data'))],



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


D8631: localrepo: add writerequirements() and route requires writing through it

2020-06-15 Thread pulkit (Pulkit Goyal)
pulkit created this revision.
Herald added a reviewer: hg-reviewers.
Herald added a subscriber: mercurial-patches.

REVISION SUMMARY
  In upcoming patches, to implement Share Safe plan we will be introducing
  requires file in store. We need to route all callers to check for
  a share-safe requirement and if present, write requirements to
  .hg/store/requires instead.
  
  After this patch, callers directly calling scmutil.writerequires() are once
  where we don't have the repo object, for example when initializing the object
  itself.

REPOSITORY
  rHG Mercurial

BRANCH
  default

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

AFFECTED FILES
  mercurial/interfaces/repository.py
  mercurial/localrepo.py
  mercurial/sparse.py
  mercurial/upgrade.py

CHANGE DETAILS

diff --git a/mercurial/upgrade.py b/mercurial/upgrade.py
--- a/mercurial/upgrade.py
+++ b/mercurial/upgrade.py
@@ -21,7 +21,6 @@
 metadata,
 pycompat,
 revlog,
-scmutil,
 util,
 vfs as vfsmod,
 )
@@ -1091,9 +1090,7 @@
 b'unable to read from repository\n'
 )
 )
-scmutil.writerequires(
-srcrepo.vfs, srcrepo.requirements | {b'upgradeinprogress'}
-)
+srcrepo.writerequirements(srcrepo.requirements | {b'upgradeinprogress'})
 
 ui.status(_(b'starting in-place swap of repository data\n'))
 ui.status(_(b'replaced files will be backed up at %s\n') % backuppath)
@@ -1122,7 +1119,7 @@
 b'again\n'
 )
 )
-scmutil.writerequires(srcrepo.vfs, requirements)
+srcrepo.writerequirements(requirements)
 
 # The lock file from the old store won't be removed because nothing has a
 # reference to its new location. So clean it up manually. Alternatively, we
diff --git a/mercurial/sparse.py b/mercurial/sparse.py
--- a/mercurial/sparse.py
+++ b/mercurial/sparse.py
@@ -21,7 +21,6 @@
 mergestate as mergestatemod,
 pathutil,
 pycompat,
-scmutil,
 util,
 )
 from .utils import hashutil
@@ -601,10 +600,10 @@
 
 if b'exp-sparse' in oldrequires and removing:
 repo.requirements.discard(b'exp-sparse')
-scmutil.writerequires(repo.vfs, repo.requirements)
+repo.writerequirements(repo.requirements)
 elif b'exp-sparse' not in oldrequires:
 repo.requirements.add(b'exp-sparse')
-scmutil.writerequires(repo.vfs, repo.requirements)
+repo.writerequirements(repo.requirements)
 
 try:
 writeconfig(repo, includes, excludes, profiles)
@@ -613,7 +612,7 @@
 if repo.requirements != oldrequires:
 repo.requirements.clear()
 repo.requirements |= oldrequires
-scmutil.writerequires(repo.vfs, repo.requirements)
+repo.writerequirements(repo.requirements)
 writeconfig(repo, oldincludes, oldexcludes, oldprofiles)
 raise
 
diff --git a/mercurial/localrepo.py b/mercurial/localrepo.py
--- a/mercurial/localrepo.py
+++ b/mercurial/localrepo.py
@@ -1297,6 +1297,10 @@
 caps.add(b'bundle2=' + urlreq.quote(capsblob))
 return caps
 
+def writerequirements(self, requirements):
+self.requirements = requirements
+self._writerequirements()
+
 def _writerequirements(self):
 scmutil.writerequires(self.vfs, self.requirements)
 
diff --git a/mercurial/interfaces/repository.py 
b/mercurial/interfaces/repository.py
--- a/mercurial/interfaces/repository.py
+++ b/mercurial/interfaces/repository.py
@@ -1809,6 +1809,9 @@
 def savecommitmessage(text):
 pass
 
+def writerequirements(requirements):
+""" writes current repository requirements """
+
 
 class completelocalrepository(
 ilocalrepositorymain, ilocalrepositoryfilestorage



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


D8374: fuzz: tell manifest fuzzer about longer node hashes

2020-06-15 Thread pulkit (Pulkit Goyal)
Herald added a subscriber: mercurial-patches.
pulkit added a comment.


  I am not sure what's the status of this one. @durin42 does this needs to be 
reviewed? If yes, can you rebase and push?

REPOSITORY
  rHG Mercurial

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

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

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