D8113: debugcommands: add templated command for reading the merge state for e.g. IDEs

2020-02-12 Thread martinvonz (Martin von Zweigbergk)
martinvonz created this revision.
Herald added a subscriber: mercurial-devel.
Herald added a reviewer: hg-reviewers.

REVISION SUMMARY
  Our IntelliJ team wants to be able to read the merge state in order to
  help the user resolve merge conflicts. They had so far been reading
  file contents from p1() and p2() and their merge base. That is not
  ideal for several reasons (merge base is not necessarily the "graft
  base", renames are not handled, commands like `hg update -m` is not
  handled). It will get especially bad as of my D7827 
. This patch adds a
  simple templated command for dumping the merge state. I haven't
  bothered to make it complete (e.g. merge driver states are not
  handled), but it's probably good enough as a start.

REPOSITORY
  rHG Mercurial

BRANCH
  default

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

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

CHANGE DETAILS

diff --git a/tests/test-resolve.t b/tests/test-resolve.t
--- a/tests/test-resolve.t
+++ b/tests/test-resolve.t
@@ -327,6 +327,20 @@
   R file1
   U file2
 
+test debugmergestatetemplate
+
+  $ hg debugmergestatetemplated
+  abort: template required
+  [255]
+  $ hg debugmergestatetemplated -T json
+  [
+   {
+"commits": [{"label": "working copy", "name": "local", "node": 
"57653b9f834a4493f7240b0681efcb9ae7cab745"}, {"label": "merge rev", "name": 
"other", "node": "dc77451844e37f03f5c559e3b8529b2b48d381d1"}],
+"files": [{"extras": [{"key": "ancestorlinknode", "value": 
"99726c03216e233810a2564cbc0adfe395007eac"}], "name": "file1", "state": "r"}, 
{"ancestor_node": "2ed2a3912a0b24502043eae84ee4b279c18b90dd", "ancestor_path": 
"file2", "extras": [{"key": "ancestorlinknode", "value": 
"99726c03216e233810a2564cbc0adfe395007eac"}], "local_flags": "", "local_key": 
"cb99b709a1978bd205ab9dfd4c5aaa1fc91c7523", "local_path": "file2", "name": 
"file2", "other_node": "6f4310b00b9a147241b071a60c28a650827fb03d", 
"other_path": "file2", "state": "u"}]
+   }
+  ]
+
+
 insert unsupported mandatory merge record
 
   $ hg --config extensions.fakemergerecord=$TESTDIR/fakemergerecord.py 
fakemergerecord -X
diff --git a/tests/test-help.t b/tests/test-help.t
--- a/tests/test-help.t
+++ b/tests/test-help.t
@@ -1022,6 +1022,8 @@
  cache
debugmergestate
  print merge state
+   debugmergestatetemplated
+ templated output about the merge state
debugnamecomplete
  complete "names" - tags, open branch names, bookmark names
debugnodemap  write and inspect on disk nodemap
diff --git a/tests/test-completion.t b/tests/test-completion.t
--- a/tests/test-completion.t
+++ b/tests/test-completion.t
@@ -106,6 +106,7 @@
   debuglocks
   debugmanifestfulltextcache
   debugmergestate
+  debugmergestatetemplated
   debugnamecomplete
   debugnodemap
   debugobsolete
@@ -290,6 +291,7 @@
   debuglocks: force-lock, force-wlock, set-lock, set-wlock
   debugmanifestfulltextcache: clear, add
   debugmergestate: 
+  debugmergestatetemplated: style, template
   debugnamecomplete: 
   debugnodemap: dump-new, dump-disk, check, metadata
   debugobsolete: flags, record-parents, rev, exclusive, index, delete, date, 
user, template
diff --git a/mercurial/debugcommands.py b/mercurial/debugcommands.py
--- a/mercurial/debugcommands.py
+++ b/mercurial/debugcommands.py
@@ -2060,6 +2060,62 @@
 printrecords(2)
 
 
+@command(b'debugmergestatetemplated', [] + cmdutil.templateopts, b'')
+def debugmergestatetemplated(ui, repo, *args, **opts):
+"""templated output about the merge state
+
+This command requires a template (such as '-T json').
+"""
+
+opts = pycompat.byteskwargs(opts)
+if not opts[b'template']:
+raise error.Abort(_(b'template required'))
+
+ms = mergemod.mergestate.read(repo)
+if not ms.active():
+return
+
+fm = ui.formatter(b'debugmergestatetemplated', opts)
+fm.startitem()
+
+fm_commits = fm.nested(b'commits')
+for name, node, label_index in (
+(b'local', ms.local, 0),
+(b'other', ms.other, 1),
+):
+fm_commits.startitem()
+fm_commits.data(name=name)
+fm_commits.data(node=hex(node))
+if ms._labels and len(ms._labels) > label_index:
+fm_commits.data(label=ms._labels[label_index])
+fm_commits.end()
+
+fm_files = fm.nested(b'files')
+for f in ms:
+fm_files.startitem()
+fm_files.data(name=f)
+state = ms._state[f]
+fm_files.data(state=state[0])
+if state[0] == mergemod.MERGE_RECORD_UNRESOLVED:
+fm_files.data(local_key=state[1])
+fm_files.data(local_path=state[2])
+fm_files.data(ancestor_path=state[3])
+fm_files.data(ancestor_node=state[4])
+fm_files.data(other_path=state[5])
+fm_files.data(other_node=state[6])
+fm_f

D7894: nodemap: introduce an option to use mmap to read the nodemap mapping

2020-02-12 Thread marmoute (Pierre-Yves David)
marmoute added a comment.


  phabricator seems to be very confused about the performance number formatting…
  
  It is easier to read here: 
https://foss.heptapod.net/octobus/mercurial-devel/commit/fb04cf42b051ef84bce081f9d10f5ff75c3e0445
  
  and can be pulled using `hg pull --rev "nodemap-python-side" 
https://foss.heptapod.net/octobus/mercurial-devel/`
  
  I can also confirm that phabricator will silently devour anything added after 
the `Differential Revision: ` line

REPOSITORY
  rHG Mercurial

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

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

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


D8112: test: pin the number of CPU for issue4074 tests

2020-02-12 Thread marmoute (Pierre-Yves David)
marmoute created this revision.
Herald added a subscriber: mercurial-devel.
Herald added a reviewer: hg-reviewers.

REVISION SUMMARY
  On machine with an hundreds of CPUs, the "user" CPU time reported can be
  inflated by the status steps. Since the test especially focus on the diff
  computation, we restrict the number of CPU to avoid potential issues.

REPOSITORY
  rHG Mercurial

BRANCH
  stable

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

AFFECTED FILES
  tests/test-issue4074.t

CHANGE DETAILS

diff --git a/tests/test-issue4074.t b/tests/test-issue4074.t
--- a/tests/test-issue4074.t
+++ b/tests/test-issue4074.t
@@ -25,5 +25,5 @@
 
 Time a check-in, should never take more than 10 seconds user time:
 
-  $ hg ci --time -m1
+  $ hg ci --time -m1 --config worker.enabled=no
   time: real .* secs .user [0-9][.].* sys .* (re)



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


D8111: rust-dirstatemap: add `NonNormalEntries` class

2020-02-12 Thread marmoute (Pierre-Yves David)
marmoute created this revision.
marmoute added a comment.
Herald added subscribers: mercurial-devel, kevincox.
Herald added a reviewer: hg-reviewers.


  INTENDED FOR STABLE

REVISION SUMMARY
  This fix introduces the same encapsulation as the `copymap`. There is no easy
  way of doing this any better for now.
  
  `hg up -r null && time HGRCPATH= HGMODULEPOLICY=rust+c hg up tip` on Mozilla
  Central, (not super recent, but it doesn't matter):
  
  Before: 7:44,08 total
  After: 1:03,23 total
  
  Pretty brutal regression!
  
  This is a graft on stable of cf1f8660e568 


REPOSITORY
  rHG Mercurial

BRANCH
  stable

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

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

CHANGE DETAILS

diff --git a/rust/hg-cpython/src/dirstate/non_normal_entries.rs 
b/rust/hg-cpython/src/dirstate/non_normal_entries.rs
new file mode 100644
--- /dev/null
+++ b/rust/hg-cpython/src/dirstate/non_normal_entries.rs
@@ -0,0 +1,52 @@
+// non_normal_other_parent_entries.rs
+//
+// Copyright 2020 Raphaël Gomès 
+//
+// This software may be used and distributed according to the terms of the
+// GNU General Public License version 2 or any later version.
+
+use cpython::{
+exc::NotImplementedError, CompareOp, ObjectProtocol, PyErr, PyList,
+PyObject, PyResult, PyString, Python, PythonObject, ToPyObject,
+};
+
+use crate::dirstate::DirstateMap;
+
+py_class!(pub class NonNormalEntries |py| {
+data dmap: DirstateMap;
+
+def __contains__(&self, key: PyObject) -> PyResult {
+self.dmap(py).non_normal_entries_contains(py, key)
+}
+def remove(&self, key: PyObject) -> PyResult {
+self.dmap(py).non_normal_entries_remove(py, key)
+}
+def union(&self, other: PyObject) -> PyResult {
+self.dmap(py).non_normal_entries_union(py, other)
+}
+def __richcmp__(&self, other: PyObject, op: CompareOp) -> PyResult {
+match op {
+CompareOp::Eq => self.is_equal_to(py, other),
+CompareOp::Ne => Ok(!self.is_equal_to(py, other)?),
+_ => Err(PyErr::new::(py, ""))
+}
+}
+def __repr__(&self) -> PyResult {
+self.dmap(py).non_normal_entries_display(py)
+}
+});
+
+impl NonNormalEntries {
+pub fn from_inner(py: Python, dm: DirstateMap) -> PyResult {
+Self::create_instance(py, dm)
+}
+
+fn is_equal_to(&self, py: Python, other: PyObject) -> PyResult {
+for item in other.iter(py)? {
+if !self.dmap(py).non_normal_entries_contains(py, item?)? {
+return Ok(false);
+}
+}
+Ok(true)
+}
+}
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
@@ -13,12 +13,13 @@
 use std::time::Duration;
 
 use cpython::{
-exc, ObjectProtocol, PyBool, PyBytes, PyClone, PyDict, PyErr, PyObject,
-PyResult, PyTuple, Python, PythonObject, ToPyObject,
+exc, ObjectProtocol, PyBool, PyBytes, PyClone, PyDict, PyErr, PyList,
+PyObject, PyResult, PyString, PyTuple, Python, PythonObject, ToPyObject,
 };
 
 use crate::{
 dirstate::copymap::{CopyMap, CopyMapItemsIterator, CopyMapKeysIterator},
+dirstate::non_normal_entries::NonNormalEntries,
 dirstate::{dirs_multiset::Dirs, make_dirstate_tuple},
 ref_sharing::{PyLeaked, PySharedRefCell},
 };
@@ -168,32 +169,86 @@
 Ok(py.None())
 }
 
-// TODO share the reference
-def nonnormalentries(&self) -> PyResult {
-let (non_normal, other_parent) =
-self.inner_shared(py).borrow().non_normal_other_parent_entries();
+def other_parent_entries(&self) -> PyResult {
+let mut inner_shared = self.inner_shared(py).borrow_mut()?;
+let (_, other_parent) =
+inner_shared.get_non_normal_other_parent_entries();
 
 let locals = PyDict::new(py);
 locals.set_item(
 py,
-"non_normal",
-non_normal
-.iter()
-.map(|v| PyBytes::new(py, v.as_ref()))
-.collect::>()
-.to_py_object(py),
-)?;
-locals.set_item(
-py,
 "other_parent",
-other_parent
+other_parent.as_ref()
+.unwrap()
 .iter()
 .map(|v| PyBytes::new(py, v.as_ref()))
 .collect::>()
 .to_py_object(py),
 )?;
 
-py.eval("set(non_normal), set(other_parent)", None, Some(&locals))
+py.eval("set(other_parent)", None, Some(&locals))
+}
+
+def non_normal_entries(&self) -> PyResult {
+NonNormalEntries::from_inner(py, self.clone_ref(py))
+

D8110: rust-dirstatemap: cache non normal and other parent set

2020-02-12 Thread marmoute (Pierre-Yves David)
marmoute created this revision.
marmoute added a comment.
Herald added subscribers: mercurial-devel, kevincox.
Herald added a reviewer: hg-reviewers.


  INTENDED FOR STABLE

REVISION SUMMARY
  Performance of `hg update` was significantly worse since the introduction of
  the Rust `dirstatemap`. This regression was noticed by Valentin Gatien-Baron
  when working on a large repository, as it goes unnoticed for smaller
  repositories like Mercurial itself.
  
  This fix introduces the same getter/setter mechanism at `hg-core` level as
  for `set/get_dirs`.
  
  While this technique is, as previously discussed, quite suboptimal, it fixes 
an
  important enough problem. Refactoring `hg-core` to use the typestate
  pattern could be a good approach to improving code quality in a future patch.
  
  This is a graft of stable of 83b2b829c94e 


REPOSITORY
  rHG Mercurial

BRANCH
  stable

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

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

CHANGE DETAILS

diff --git a/rust/hg-core/src/dirstate/dirstate_map.rs 
b/rust/hg-core/src/dirstate/dirstate_map.rs
--- a/rust/hg-core/src/dirstate/dirstate_map.rs
+++ b/rust/hg-core/src/dirstate/dirstate_map.rs
@@ -34,8 +34,8 @@
 file_fold_map: Option,
 pub dirs: Option,
 pub all_dirs: Option,
-non_normal_set: HashSet,
-other_parent_set: HashSet,
+non_normal_set: Option>,
+other_parent_set: Option>,
 parents: Option,
 dirty_parents: bool,
 }
@@ -69,8 +69,8 @@
 self.state_map.clear();
 self.copy_map.clear();
 self.file_fold_map = None;
-self.non_normal_set.clear();
-self.other_parent_set.clear();
+self.non_normal_set = None;
+self.other_parent_set = None;
 self.set_parents(&DirstateParents {
 p1: NULL_ID,
 p2: NULL_ID,
@@ -98,11 +98,19 @@
 self.state_map.insert(filename.to_owned(), entry.to_owned());
 
 if entry.state != EntryState::Normal || entry.mtime == MTIME_UNSET {
-self.non_normal_set.insert(filename.to_owned());
+self.get_non_normal_other_parent_entries()
+.0
+.as_mut()
+.unwrap()
+.insert(filename.to_owned());
 }
 
 if entry.size == SIZE_FROM_OTHER_PARENT {
-self.other_parent_set.insert(filename.to_owned());
+self.get_non_normal_other_parent_entries()
+.1
+.as_mut()
+.unwrap()
+.insert(filename.to_owned());
 }
 Ok(())
 }
@@ -142,7 +150,11 @@
 mtime: 0,
 },
 );
-self.non_normal_set.insert(filename.to_owned());
+self.get_non_normal_other_parent_entries()
+.0
+.as_mut()
+.unwrap()
+.insert(filename.to_owned());
 Ok(())
 }
 
@@ -168,7 +180,11 @@
 if let Some(ref mut file_fold_map) = self.file_fold_map {
 file_fold_map.remove(&normalize_case(filename));
 }
-self.non_normal_set.remove(filename);
+self.get_non_normal_other_parent_entries()
+.0
+.as_mut()
+.unwrap()
+.remove(filename);
 
 Ok(exists)
 }
@@ -193,14 +209,55 @@
 }
 });
 if changed {
-self.non_normal_set.insert(filename.to_owned());
+self.get_non_normal_other_parent_entries()
+.0
+.as_mut()
+.unwrap()
+.insert(filename.to_owned());
 }
 }
 }
 
-pub fn non_normal_other_parent_entries(
-&self,
-) -> (HashSet, HashSet) {
+pub fn non_normal_entries_remove(
+&mut self,
+key: impl AsRef,
+) -> bool {
+self.get_non_normal_other_parent_entries()
+.0
+.as_mut()
+.unwrap()
+.remove(key.as_ref())
+}
+pub fn non_normal_entries_union(
+&mut self,
+other: HashSet,
+) -> Vec {
+self.get_non_normal_other_parent_entries()
+.0
+.as_mut()
+.unwrap()
+.union(&other)
+.map(|e| e.to_owned())
+.collect()
+}
+
+pub fn get_non_normal_other_parent_entries(
+&mut self,
+) -> (
+&mut Option>,
+&mut Option>,
+) {
+self.set_non_normal_other_parent_entries(false);
+(&mut self.non_normal_set, &mut self.other_parent_set)
+}
+
+pub fn set_non_normal_other_parent_entries(&mut self, force: bool) {
+if !force
+&& self.non_normal_set.is_some()
+&& self.other_parent_set.is_some()
+{
+return;
+}
 let mut non_normal = HashSet::new();
 let mut oth

D8033: copy: move argument validation a little earlier

2020-02-12 Thread martinvonz (Martin von Zweigbergk)
martinvonz added a comment.


  In D8033#120581 , @durin42 wrote:
  
  > Oddly, this had some rejects (I didn't look why) but i"d be happy to see 
this earlier in the series.
  
  I moved some revisions around, but it wasn't trivial to move this one. I 
don't mind waiting until the parents are accepted anyway.

REPOSITORY
  rHG Mercurial

BRANCH
  default

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

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

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


D8029: copy: add option to unmark file as copied

2020-02-12 Thread martinvonz (Martin von Zweigbergk)
martinvonz updated this revision to Diff 20174.

REPOSITORY
  rHG Mercurial

CHANGES SINCE LAST UPDATE
  https://phab.mercurial-scm.org/D8029?vs=20148&id=20174

BRANCH
  default

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

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

AFFECTED FILES
  mercurial/cmdutil.py
  mercurial/commands.py
  relnotes/next
  tests/test-completion.t
  tests/test-copy.t

CHANGE DETAILS

diff --git a/tests/test-copy.t b/tests/test-copy.t
--- a/tests/test-copy.t
+++ b/tests/test-copy.t
@@ -262,5 +262,62 @@
   xyzzy: not overwriting - file exists
   ('hg copy --after' to record the copy)
   [1]
+  $ hg co -qC .
+  $ rm baz xyzzy
+
+
+Test unmarking copy of a single file
+
+# Set up by creating a copy
+  $ hg cp bar baz
+# Test uncopying a non-existent file
+  $ hg copy --forget non-existent
+  non-existent: $ENOENT$
+# Test uncopying an tracked but unrelated file
+  $ hg copy --forget foo
+  foo: not unmarking as copy - file is not marked as copied
+# Test uncopying a copy source
+  $ hg copy --forget bar
+  bar: not unmarking as copy - file is not marked as copied
+# baz should still be marked as a copy
+  $ hg st -C
+  A baz
+bar
+# Test the normal case
+  $ hg copy --forget baz
+  $ hg st -C
+  A baz
+# Test uncopy with matching an non-matching patterns
+  $ hg cp bar baz --after
+  $ hg copy --forget bar baz
+  bar: not unmarking as copy - file is not marked as copied
+  $ hg st -C
+  A baz
+# Test uncopy with no exact matches
+  $ hg cp bar baz --after
+  $ hg copy --forget .
+  $ hg st -C
+  A baz
+  $ hg forget baz
+  $ rm baz
+
+Test unmarking copy of a directory
+
+  $ mkdir dir
+  $ echo foo > dir/foo
+  $ echo bar > dir/bar
+  $ hg add dir
+  adding dir/bar
+  adding dir/foo
+  $ hg ci -m 'add dir/'
+  $ hg cp dir dir2
+  copying dir/bar to dir2/bar
+  copying dir/foo to dir2/foo
+  $ touch dir2/untracked
+  $ hg copy --forget dir2
+  $ hg st -C
+  A dir2/bar
+  A dir2/foo
+  ? dir2/untracked
 
   $ cd ..
diff --git a/tests/test-completion.t b/tests/test-completion.t
--- a/tests/test-completion.t
+++ b/tests/test-completion.t
@@ -257,7 +257,7 @@
   commit: addremove, close-branch, amend, secret, edit, force-close-branch, 
interactive, include, exclude, message, logfile, date, user, subrepos
   config: untrusted, edit, local, global, template
   continue: dry-run
-  copy: after, force, include, exclude, dry-run
+  copy: forget, after, force, include, exclude, dry-run
   debugancestor: 
   debugapplystreamclonebundle: 
   debugbuilddag: mergeable-file, overwritten-file, new-file
diff --git a/relnotes/next b/relnotes/next
--- a/relnotes/next
+++ b/relnotes/next
@@ -12,6 +12,8 @@
commits that are being merged, when there are conflicts. Also works
for conflicts caused by e.g. `hg graft`.
 
+ * `hg copy --forget` can be used to unmark a file as copied.
+
 
 == New Experimental Features ==
 
diff --git a/mercurial/commands.py b/mercurial/commands.py
--- a/mercurial/commands.py
+++ b/mercurial/commands.py
@@ -2309,6 +2309,7 @@
 @command(
 b'copy|cp',
 [
+(b'', b'forget', None, _(b'unmark a file as copied')),
 (b'A', b'after', None, _(b'record a copy that has already occurred')),
 (
 b'f',
@@ -2333,8 +2334,11 @@
 exist in the working directory. If invoked with -A/--after, the
 operation is recorded, but no copying is performed.
 
-This command takes effect with the next commit. To undo a copy
-before that, see :hg:`revert`.
+To undo marking a file as copied, use --forget. With that option,
+both SOURCE and DEST are interpreted as destinations. The destination
+file(s) will be left in place (still tracked).
+
+This command takes effect with the next commit.
 
 Returns 0 on success, 1 if errors are encountered.
 """
diff --git a/mercurial/cmdutil.py b/mercurial/cmdutil.py
--- a/mercurial/cmdutil.py
+++ b/mercurial/cmdutil.py
@@ -1410,12 +1410,15 @@
 
 
 def copy(ui, repo, pats, opts, rename=False):
+check_incompatible_arguments(opts, b'forget', [b'dry_run'])
+
 # called with the repo lock held
 #
 # hgsep => pathname that uses "/" to separate directories
 # ossep => pathname that uses os.sep to separate directories
 cwd = repo.getcwd()
 targets = {}
+forget = opts.get(b"forget")
 after = opts.get(b"after")
 dryrun = opts.get(b"dry_run")
 wctx = repo[None]
@@ -1423,6 +1426,24 @@
 
 uipathfn = scmutil.getuipathfn(repo, legacyrelativevalue=True)
 
+if forget:
+match = scmutil.match(wctx, pats, opts)
+
+current_copies = wctx.p1copies()
+current_copies.update(wctx.p2copies())
+
+for f in wctx.walk(match):
+if f in current_copies:
+wctx[f].markcopied(None)
+elif match.exact(f):
+ui.warn(
+_(
+b'%s: not unmarking as copy - file is not marked as 
copied\n'
+)
+  

D8031: copy: rewrite walkpat() to depend less on dirstate

2020-02-12 Thread martinvonz (Martin von Zweigbergk)
martinvonz updated this revision to Diff 20171.

REPOSITORY
  rHG Mercurial

CHANGES SINCE LAST UPDATE
  https://phab.mercurial-scm.org/D8031?vs=20150&id=20171

BRANCH
  default

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

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

AFFECTED FILES
  mercurial/cmdutil.py

CHANGE DETAILS

diff --git a/mercurial/cmdutil.py b/mercurial/cmdutil.py
--- a/mercurial/cmdutil.py
+++ b/mercurial/cmdutil.py
@@ -1419,32 +1419,35 @@
 after = opts.get(b"after")
 dryrun = opts.get(b"dry_run")
 wctx = repo[None]
+pctx = wctx.p1()
 
 uipathfn = scmutil.getuipathfn(repo, legacyrelativevalue=True)
 
 def walkpat(pat):
 srcs = []
-if after:
-badstates = b'?'
-else:
-badstates = b'?r'
 m = scmutil.match(wctx, [pat], opts, globbed=True)
 for abs in wctx.walk(m):
-state = repo.dirstate[abs]
 rel = uipathfn(abs)
 exact = m.exact(abs)
-if state in badstates:
-if exact and state == b'?':
-ui.warn(_(b'%s: not copying - file is not managed\n') % 
rel)
-if exact and state == b'r':
-ui.warn(
-_(
-b'%s: not copying - file has been marked for'
-b' remove\n'
+if abs not in wctx:
+if abs in pctx:
+if not after:
+if exact:
+ui.warn(
+_(
+b'%s: not copying - file has been marked '
+b'for remove\n'
+)
+% rel
+)
+continue
+else:
+if exact:
+ui.warn(
+_(b'%s: not copying - file is not managed\n') % rel
 )
-% rel
-)
-continue
+continue
+
 # abs: hgsep
 # rel: ossep
 srcs.append((abs, rel, exact))



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


D8035: copy: add support for marking committed copies

2020-02-12 Thread durin42 (Augie Fackler)
This revision is now accepted and ready to land.
durin42 added a comment.
durin42 accepted this revision.


  In D8035#119861 , @marmoute 
wrote:
  
  > See my comment in D8030 , the feature 
is interresting, but it seems to me that we should implement that through 
regular amend.
  
  On the one hand that's a thought, but I mostly feel like the functionality 
belongs in `hg copy` since that's where I'd look for it.

REPOSITORY
  rHG Mercurial

BRANCH
  default

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

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

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


D8034: check-code: allow `hg cp -r`, by using a negative lookbehind

2020-02-12 Thread durin42 (Augie Fackler)
This revision is now accepted and ready to land.
durin42 added a comment.
durin42 accepted this revision.


  Nevermind, I misread.

REPOSITORY
  rHG Mercurial

BRANCH
  default

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

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

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


D8034: check-code: allow `hg cp -r`, by using a negative lookbehind

2020-02-12 Thread durin42 (Augie Fackler)
durin42 added a comment.


  I think this is obsolete now? Maybe?

REPOSITORY
  rHG Mercurial

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

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

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


D8033: copy: move argument validation a little earlier

2020-02-12 Thread durin42 (Augie Fackler)
This revision is now accepted and ready to land.
durin42 added a comment.
durin42 accepted this revision.


  Oddly, this had some rejects (I didn't look why) but i"d be happy to see this 
earlier in the series.

REPOSITORY
  rHG Mercurial

BRANCH
  default

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

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

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


D8030: copy: add support for unmarking committed copies

2020-02-12 Thread durin42 (Augie Fackler)
durin42 added a comment.
durin42 accepted this revision.


  I remain happy with this.

REPOSITORY
  rHG Mercurial

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

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

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


Re: [PATCH] pathutil: resurrect comment about path auditing order

2020-02-12 Thread Augie Fackler
queued, thanks

> On Feb 1, 2020, at 00:29, Yuya Nishihara  wrote:
> 
> # HG changeset patch
> # User Yuya Nishihara 
> # Date 1580529452 -32400
> #  Sat Feb 01 12:57:32 2020 +0900
> # Node ID c30168a6a58660a119379c36e83c41ad7535d129
> # Parent  6b7aef44274b457847d912cf1eada1dd8396f650
> pathutil: resurrect comment about path auditing order
> 
> It was removed at 51c86c6167c1, but expensive symlink traversal isn't the
> only reason we should walk path components from the root.
> 
> diff --git a/mercurial/pathutil.py b/mercurial/pathutil.py
> --- a/mercurial/pathutil.py
> +++ b/mercurial/pathutil.py
> @@ -100,8 +100,10 @@ class pathauditor(object):
> parts.pop()
> normparts.pop()
> # It's important that we check the path parts starting from the root.
> -# This means we won't accidentally traverse a symlink into some other
> -# filesystem (which is potentially expensive to access).
> +# We don't want to add "foo/bar/baz" to auditeddir before checking if
> +# there's a "foo/.hg" directory. This also means we won't 
> accidentally
> +# traverse a symlink into some other filesystem (which is potentially
> +# expensive to access).
> for i in range(len(parts)):
> prefix = pycompat.ossep.join(parts[: i + 1])
> normprefix = pycompat.ossep.join(normparts[: i + 1])
> ___
> Mercurial-devel mailing list
> Mercurial-devel@mercurial-scm.org
> https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel

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


Re: [PATCH STABLE] chgserver: spawn new process if schemes change

2020-02-12 Thread Augie Fackler
queued for stable, tahnks

> On Feb 11, 2020, at 06:07, Yuya Nishihara  wrote:
> 
> # HG changeset patch
> # User Yuya Nishihara 
> # Date 1581418436 -32400
> #  Tue Feb 11 19:53:56 2020 +0900
> # Branch stable
> # Node ID 3dcf73d0733d87e7a231809d23da4883f4ab3711
> # Parent  84d98fa814a8bab0dd94a133187dc9d42a5e433f
> chgserver: spawn new process if schemes change
> 
> The schemes extension updates hg.schemes table. It's technically possible
> for hg.repository() to look for e.g. ui.schemes instead of depending on
> module-local table, but I don't think the change would make much sense
> since [schemes] is usually specified in ~/.hgrc and thus it can be considered
> static data.
> 
> diff --git a/mercurial/chgserver.py b/mercurial/chgserver.py
> --- a/mercurial/chgserver.py
> +++ b/mercurial/chgserver.py
> @@ -83,6 +83,7 @@ def _hashlist(items):
> b'eol',  # uses setconfig('eol', ...)
> b'extdiff',  # uisetup will register new commands
> b'extensions',
> +b'schemes',  # extsetup will update global hg.schemes
> ]
> 
> _configsectionitems = [
> diff --git a/tests/test-chg.t b/tests/test-chg.t
> --- a/tests/test-chg.t
> +++ b/tests/test-chg.t
> @@ -245,6 +245,54 @@ is different when using py3):
>   /MM/DD HH:MM:SS (PID)> worker process exited (pid=...)
>   /MM/DD HH:MM:SS (PID)> $TESTTMP/extreload/chgsock/server-... is not 
> owned, exiting.
> 
> +global data mutated by schems
> +-
> +
> +  $ hg init schemes
> +  $ cd schemes
> +
> +initial state
> +
> +  $ cat > .hg/hgrc <<'EOF'
> +  > [extensions]
> +  > schemes =
> +  > [schemes]
> +  > foo = https://foo.example.org/
> +  > EOF
> +  $ hg debugexpandscheme foo://expanded
> +  https://foo.example.org/expanded
> +  $ hg debugexpandscheme bar://unexpanded
> +  bar://unexpanded
> +
> +add bar
> +
> +  $ cat > .hg/hgrc <<'EOF'
> +  > [extensions]
> +  > schemes =
> +  > [schemes]
> +  > foo = https://foo.example.org/
> +  > bar = https://bar.example.org/
> +  > EOF
> +  $ hg debugexpandscheme foo://expanded
> +  https://foo.example.org/expanded
> +  $ hg debugexpandscheme bar://expanded
> +  https://bar.example.org/expanded
> +
> +remove foo
> +
> +  $ cat > .hg/hgrc <<'EOF'
> +  > [extensions]
> +  > schemes =
> +  > [schemes]
> +  > bar = https://bar.example.org/
> +  > EOF
> +  $ hg debugexpandscheme foo://unexpanded
> +  foo://unexpanded
> +  $ hg debugexpandscheme bar://expanded
> +  https://bar.example.org/expanded
> +
> +  $ cd ..
> +
> repository cache
> 
> 
> @@ -317,6 +365,8 @@ shut down servers and restore environmen
> check server log:
> 
>   $ cat log/server.log | filterlog
> +  /MM/DD HH:MM:SS (PID)> worker process exited (pid=...)
> +  /MM/DD HH:MM:SS (PID)> worker process exited (pid=...)
>   /MM/DD HH:MM:SS (PID)> init cached
>   /MM/DD HH:MM:SS (PID)> id -R cached
>   /MM/DD HH:MM:SS (PID)> loaded repo into cache: $TESTTMP/cached (in  
> ...s)
> ___
> Mercurial-devel mailing list
> Mercurial-devel@mercurial-scm.org
> https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel

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


D8029: copy: add option to unmark file as copied

2020-02-12 Thread durin42 (Augie Fackler)
durin42 added a comment.
durin42 accepted this revision.


  LGTM, would like @marmoute to chime in.

REPOSITORY
  rHG Mercurial

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

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

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


D7119: rust-dirstatemap: remove additional lookup in dirstate.matches

2020-02-12 Thread Raphaël Gomès
Closed by commit rHGbed8d08cfcb2: rust-dirstatemap: remove additional lookup in 
dirstate.matches (authored by Alphare).
This revision was automatically updated to reflect the committed changes.
This revision was not accepted when it landed; it landed in state "Needs 
Review".

REPOSITORY
  rHG Mercurial

CHANGES SINCE LAST UPDATE
  https://phab.mercurial-scm.org/D7119?vs=18565&id=20170

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

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

AFFECTED FILES
  mercurial/dirstate.py

CHANGE DETAILS

diff --git a/mercurial/dirstate.py b/mercurial/dirstate.py
--- a/mercurial/dirstate.py
+++ b/mercurial/dirstate.py
@@ -1262,6 +1262,9 @@
 return files in the dirstate (in whatever state) filtered by match
 '''
 dmap = self._map
+if rustmod is not None:
+dmap = self._map._rustmap
+
 if match.always():
 return dmap.keys()
 files = match.files()



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


D7932: debugstripbackups: introduce command to interact with strip backups

2020-02-12 Thread durin42 (Augie Fackler)
This revision now requires changes to proceed.
durin42 added a comment.
durin42 requested changes to this revision.


  I think I'd prefer debugbackupbundle per marmoute's suggestion.

REPOSITORY
  rHG Mercurial

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

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

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


D7258: makefile: use Python 3 by default outside of Windows (BC)

2020-02-12 Thread durin42 (Augie Fackler)
durin42 added a comment.
durin42 accepted this revision.


  I like this, but I'm too chicken to queue it.

REPOSITORY
  rHG Mercurial

BRANCH
  default

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

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

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


D7972: recover: don't verify by default

2020-02-12 Thread valentin.gatienbaron (Valentin Gatien-Baron)
Closed by commit rHG7a4e1d245f19: recover: don't verify by default 
(authored by valentin.gatienbaron).
This revision was automatically updated to reflect the committed changes.

REPOSITORY
  rHG Mercurial

CHANGES SINCE LAST UPDATE
  https://phab.mercurial-scm.org/D7972?vs=19520&id=20168

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

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

AFFECTED FILES
  mercurial/commands.py
  tests/test-fncache.t
  tests/test-journal-exists.t
  tests/test-repair-strip.t
  tests/test-rollback.t

CHANGE DETAILS

diff --git a/tests/test-rollback.t b/tests/test-rollback.t
--- a/tests/test-rollback.t
+++ b/tests/test-rollback.t
@@ -190,7 +190,7 @@
 
 corrupt journal test
   $ echo "foo" > .hg/store/journal
-  $ hg recover
+  $ hg recover --verify
   rolling back interrupted transaction
   couldn't read journal entry 'foo\n'!
   checking changesets
diff --git a/tests/test-repair-strip.t b/tests/test-repair-strip.t
--- a/tests/test-repair-strip.t
+++ b/tests/test-repair-strip.t
@@ -25,7 +25,9 @@
   >   else
   >   echo "(no journal)"
   >   fi
-  >   ls .hg/store/journal >/dev/null 2>&1 && hg recover
+  >   if ls .hg/store/journal >/dev/null 2>&1; then
+  > hg recover --verify
+  >   fi
   >   ls .hg/strip-backup/* >/dev/null 2>&1 && hg unbundle -q 
.hg/strip-backup/*
   >   rm -rf .hg/strip-backup
   > }
diff --git a/tests/test-journal-exists.t b/tests/test-journal-exists.t
--- a/tests/test-journal-exists.t
+++ b/tests/test-journal-exists.t
@@ -15,11 +15,7 @@
 
   $ hg recover
   rolling back interrupted transaction
-  checking changesets
-  checking manifests
-  crosschecking files in changesets and manifests
-  checking files
-  checked 1 changesets with 1 changes to 1 files
+  (verify step skipped, run `hg verify` to check your repository content)
 
 recover, explicit verify
 
diff --git a/tests/test-fncache.t b/tests/test-fncache.t
--- a/tests/test-fncache.t
+++ b/tests/test-fncache.t
@@ -356,7 +356,7 @@
   $ cat .hg/store/fncache | sort
   data/y.i
   data/z.i
-  $ hg recover
+  $ hg recover --verify
   rolling back interrupted transaction
   checking changesets
   checking manifests
diff --git a/mercurial/commands.py b/mercurial/commands.py
--- a/mercurial/commands.py
+++ b/mercurial/commands.py
@@ -5669,7 +5669,7 @@
 
 @command(
 b'recover',
-[(b'', b'verify', True, b"run `hg verify` after successful recover"),],
+[(b'', b'verify', False, b"run `hg verify` after successful recover"),],
 helpcategory=command.CATEGORY_MAINTENANCE,
 )
 def recover(ui, repo, **opts):



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


D7795: rust-nodemap: insert method

2020-02-12 Thread gracinet (Georges Racinet)
Closed by commit rHGd2da8667125b: rust-nodemap: insert method (authored by 
gracinet).
This revision was automatically updated to reflect the committed changes.
This revision was not accepted when it landed; it landed in state "Needs 
Review".

CHANGED PRIOR TO COMMIT
  https://phab.mercurial-scm.org/D7795?vs=20024&id=20169#toc

REPOSITORY
  rHG Mercurial

CHANGES SINCE LAST UPDATE
  https://phab.mercurial-scm.org/D7795?vs=20024&id=20169

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

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

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

CHANGE DETAILS

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
@@ -15,6 +15,7 @@
 use super::{
 Node, NodeError, NodePrefix, NodePrefixRef, Revision, RevlogIndex,
 };
+
 use std::fmt;
 use std::ops::Deref;
 use std::ops::Index;
@@ -96,6 +97,15 @@
 }
 }
 
+pub trait MutableNodeMap: NodeMap {
+fn insert(
+&mut self,
+index: &I,
+node: &Node,
+rev: Revision,
+) -> Result<(), NodeMapError>;
+}
+
 /// Low level NodeTree [`Blocks`] elements
 ///
 /// These are exactly as for instance on persistent storage.
@@ -292,6 +302,112 @@
 done: false,
 }
 }
+/// Return a mutable reference for `Block` at index `idx`.
+///
+/// If `idx` lies in the immutable area, then the reference is to
+/// a newly appended copy.
+///
+/// Returns (new_idx, glen, mut_ref) where
+///
+/// - `new_idx` is the index of the mutable `Block`
+/// - `mut_ref` is a mutable reference to the mutable Block.
+/// - `glen` is the new length of `self.growable`
+///
+/// Note: the caller wouldn't be allowed to query `self.growable.len()`
+/// itself because of the mutable borrow taken with the returned `Block`
+fn mutable_block(&mut self, idx: usize) -> (usize, &mut Block, usize) {
+let ro_blocks = &self.readonly;
+let ro_len = ro_blocks.len();
+let glen = self.growable.len();
+if idx < ro_len {
+// TODO OPTIM I think this makes two copies
+self.growable.push(ro_blocks[idx].clone());
+(glen + ro_len, &mut self.growable[glen], glen + 1)
+} else if glen + ro_len == idx {
+(idx, &mut self.root, glen)
+} else {
+(idx, &mut self.growable[idx - ro_len], glen)
+}
+}
+
+/// Main insertion method
+///
+/// This will dive in the node tree to find the deepest `Block` for
+/// `node`, split it as much as needed and record `node` in there.
+/// The method then backtracks, updating references in all the visited
+/// blocks from the root.
+///
+/// All the mutated `Block` are copied first to the growable part if
+/// needed. That happens for those in the immutable part except the root.
+pub fn insert(
+&mut self,
+index: &I,
+node: &Node,
+rev: Revision,
+) -> Result<(), NodeMapError> {
+let ro_len = &self.readonly.len();
+
+let mut visit_steps: Vec<_> = self.visit(node.into()).collect();
+let read_nybbles = visit_steps.len();
+// visit_steps cannot be empty, since we always visit the root block
+let deepest = visit_steps.pop().unwrap();
+
+let (mut block_idx, mut block, mut glen) =
+self.mutable_block(deepest.block_idx);
+
+if let Element::Rev(old_rev) = deepest.element {
+let old_node = index
+.node(old_rev)
+.ok_or_else(|| NodeMapError::RevisionNotInIndex(old_rev))?;
+if old_node == node {
+return Ok(()); // avoid creating lots of useless blocks
+}
+
+// Looping over the tail of nybbles in both nodes, creating
+// new blocks until we find the difference
+let mut new_block_idx = ro_len + glen;
+let mut nybble = deepest.nybble;
+for nybble_pos in read_nybbles..node.nybbles_len() {
+block.set(nybble, Element::Block(new_block_idx));
+
+let new_nybble = node.get_nybble(nybble_pos);
+let old_nybble = old_node.get_nybble(nybble_pos);
+
+if old_nybble == new_nybble {
+self.growable.push(Block::new());
+block = &mut self.growable[glen];
+glen += 1;
+new_block_idx += 1;
+nybble = new_nybble;
+} else {
+let mut new_block = Block::new();
+new_block.set(old_nybble, Element::Rev(old_rev));
+new_block.set(new_nybble, Element::Rev(rev));
+self.growable.push(new_block);
+break;
+}
+}
+} else {
+// Free sl

D6846: packaging: script the building of a MacOS installer using a custom python

2020-02-12 Thread mharbison72 (Matt Harbison)
mharbison72 added a comment.


  In D6846#120513 , @indygreg 
wrote:
  
  > macOS supports a `@loader_path` and related magic tokens in rpath to load 
libraries relative to the current binary. See e.g. 
https://blogs.oracle.com/dipol/dynamic-libraries,-rpath,-and-mac-os and 
https://medium.com/@donblas/fun-with-rpath-otool-and-install-name-tool-e3e41ae86172
 for examples.
  
  I saw those, thanks.  I guess what's confusing is I don't see RPATH being 
configured when building OpenSSL for the TortoiseHg build, nor do I see it 
being overwritten when running py2app.  I also interpreted this to mean that is 
should be automatic on Mac, but I guess not:
  
  https://wiki.openssl.org/index.php/Compilation_and_Installation#Using_RPATHs

INLINE COMMENTS

> indygreg wrote in python.py:54
> Where did you get this line and `enable-cms` from?

From the scripts used to build TortoiseHg on Mac, and the OpenSSL wiki:

https://bitbucket.org/Weeds2000/tortoisehg-osx-build-scripts/src/e459bb439730d7e7e3a4b8c474f74aab164d6c9f/toolchain/receipts/openssl.sh#lines-41

https://wiki.openssl.org/index.php/Compilation_and_Installation#OS_X

> indygreg wrote in build.py:170
> `fp.truncate()`?

The original shebang line was much longer, so after writing it out with the 
shorter one, I think this was meant to trim the file. too the proper content.

REPOSITORY
  rHG Mercurial

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

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

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


D7796: rust-nodemap: input/output primitives

2020-02-12 Thread durin42 (Augie Fackler)
This revision now requires changes to proceed.
durin42 added a comment.
durin42 requested changes to this revision.


  I'm just not comfortable with the `unsafe` block here, especially with the 
comments from @kevincox . That said, if the `unsafe` can't disappear, it 
probably needs a pretty thorough explanation of why it's correct for a novice 
rust reader to follow?

REPOSITORY
  rHG Mercurial

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

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

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


D7795: rust-nodemap: insert method

2020-02-12 Thread durin42 (Augie Fackler)
durin42 added a comment.


  In D7795#119774 , @marmoute 
wrote:
  
  > The change seesm good to me.  However kevincox proposal to use 
`#[cfg(test)]` for `pad_node` seems worth applying inflight.
  
  For future reference, I'm going to add it here, but if you're going to the 
trouble of uploading a new revision, it would have been nice to do this and 
save reviewer toil.

REPOSITORY
  rHG Mercurial

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

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

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


D7972: recover: don't verify by default

2020-02-12 Thread durin42 (Augie Fackler)
This revision is now accepted and ready to land.
durin42 added a comment.
durin42 accepted this revision.


  In D7972#120504 , 
@valentin.gatienbaron wrote:
  
  >> I _think_ it's just paranoia. As long as the bundle wasn't woefully 
corrupt, it shouldn't be a problem. I _think_ if we set some of the 
[server]-section bundle validation options (which should be cheap enough) we 
could ditch this completely safely.
  >> As it stands, I'm fine with this patch if someone else has the confidence 
to push it.
  >
  > How does the validity of an input bundle affect recover?
  
  It could have borked linknodes or missing filenodes. That can happen in some 
cases with subtle revlog corruption. Back when I helped run code.google.com we 
saw a few cases of that, where clients couldn't push specific changes unless 
they pushed their whole repo. But anyway, I was mis-thinking about this and 
this is about `hg recover` and not recovering something from a backup bundle 
(sigh) so we've been talking past each other.
  
  > I would have thought it's only the validity of the journal that matters, 
and that's created entirely based on local data (file lengths or contents 
before writes).
  
  Yes, you're right.
  
  > Now I suppose the journal itself may well be truncated or not written at 
all when running out of disk space or other error situations where the OS does 
the writes out of order.
  
  Yeah, it's possible on a network FS or something, but this honeslty seems 
like a safe change to me. Sorry I misread it last time through. :/

REPOSITORY
  rHG Mercurial

BRANCH
  default

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

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

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


D7894: nodemap: introduce an option to use mmap to read the nodemap mapping

2020-02-12 Thread durin42 (Augie Fackler)
This revision now requires changes to proceed.
durin42 added a comment.
durin42 requested changes to this revision.


  (Marking this as wanting changes per discussions about adding some headline 
numbers in the log message so I stop looking at it until that happens.)

REPOSITORY
  rHG Mercurial

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

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

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


D7929: rust-status: add bare `hg status` support in hg-core

2020-02-12 Thread kevincox (Kevin Cox)
kevincox added inline comments.

INLINE COMMENTS

> Alphare wrote in status.rs:456
> `traverse` returns some `Cow::Owned`, I felt that it was simpler to share the 
> same return signature for all functions, but I can map the output, I guess.

I can definitely see that this is a judgement call. However 
`.map(Cow::Borrowed)` is easy enough to write that I think it makes sense in 
this case. However both ways are acceptable.

REPOSITORY
  rHG Mercurial

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

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

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


D7927: rust-status: add util for listing a directory

2020-02-12 Thread kevincox (Kevin Cox)
kevincox added inline comments.

INLINE COMMENTS

> Alphare wrote in status.rs:76
> I didn't realize that `sort_unstable_by_key` needed to return a `T` and not a 
> `&T`, that forces a `clone()`. I'm not sure that matters, we'll go with the 
> shortest code and see if that shows up in profiling later.

`sort_unstable_by_key` doesn't require the function to return a T at all. It 
just needs to return an `Ord` type.  Note that `&Ord` is `Ord` automatically.

https://doc.rust-lang.org/std/primitive.slice.html#method.sort_unstable_by_key

REPOSITORY
  rHG Mercurial

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

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

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


D7797: rust-nodemap: pure Rust example

2020-02-12 Thread kevincox (Kevin Cox)
kevincox added inline comments.
kevincox accepted this revision.

INLINE COMMENTS

> index.rs:6
> +
> +/// Minimal `RevlogIndex`, readable from standard Mercurial file format
> +use hg::*;

Since this is a file-level comment it should use `//!` 
https://doc.rust-lang.org/reference/comments.html#examples

> index.rs:47
> +if i >= self.len() {
> +None
> +} else {

I would make this an early return and remove the else. It seems to me like an 
unexpected condition. If it should never happen then please add a debug_assert 
as well.

> index.rs:76
> +let ptr = self.0.as_ptr() as *const IndexEntry;
> +// Any misaligned data will be ignored.
> +unsafe { slice::from_raw_parts(ptr, self.0.len() / INDEX_ENTRY_SIZE) 
> }

Could you add at least a debug_assert that the alignment is correct?

> index.rs:84
> +let file = File::open(path).unwrap();
> +let mmap = unsafe { MmapOptions::new().map(&file).unwrap() };
> +Self {

Please put the `unsafe` block around only the unsafe operation. This makes it 
more obvious what I should look at.

  let mmap = unsafe { MmapOptions::new().map(&file) }.unwrap();

> index.rs:84
> +let file = File::open(path).unwrap();
> +let mmap = unsafe { MmapOptions::new().map(&file).unwrap() };
> +Self {

It seems like we should handle this error. At the very least we should be 
providing context such as "your index file {:?} is missing".

> main.rs:8
> +extern crate hg;
> +extern crate memmap;
> +

We should be using Rust 2018 so externs aren't required.

> main.rs:41
> +fn create(index: &Index, path: &Path) -> io::Result<()> {
> +let mut file = File::create(path)?;
> +let start = Instant::now();

Do you create this at the start to avoid the work if you don't have permission? 
If not it seems to be that it would be better to avoid creating the file if 
creating the nodemap fails. Otherwise we are leaving an empty file around.  If 
so please document your reasoning.

REPOSITORY
  rHG Mercurial

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

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

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


D7929: rust-status: add bare `hg status` support in hg-core

2020-02-12 Thread Raphaël Gomès
Alphare added inline comments.
Alphare marked an inline comment as done.

INLINE COMMENTS

> kevincox wrote in status.rs:456
> Why was this changed when IIUC all of the returns are references? If a caller 
> wants that I would prefer to do a map in the caller.

`traverse` returns some `Cow::Owned`, I felt that it was simpler to share the 
same return signature for all functions, but I can map the output, I guess.

REPOSITORY
  rHG Mercurial

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

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

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


D7927: rust-status: add util for listing a directory

2020-02-12 Thread Raphaël Gomès
Alphare added inline comments.

INLINE COMMENTS

> kevincox wrote in status.rs:76
> It would be more clear to do `.sort_by_key(|e| e.0)`
> 
> And I don't think stability matters here so you could use 
> `sort_unstable_by_key`.

I didn't realize that `sort_unstable_by_key` needed to return a `T` and not a 
`&T`, that forces a `clone()`. I'm not sure that matters, we'll go with the 
shortest code and see if that shows up in profiling later.

REPOSITORY
  rHG Mercurial

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

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

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


D7929: rust-status: add bare `hg status` support in hg-core

2020-02-12 Thread kevincox (Kevin Cox)
This revision now requires changes to proceed.
kevincox added inline comments.
kevincox requested changes to this revision.

INLINE COMMENTS

> status.rs:201
>  root_dir: impl AsRef + Sync + Send,
> +work: mpsc::Sender<&'a HgPath>,
>  options: StatusOptions,

Please describe this parameter.

> status.rs:241
> +// The channel always outlives the sender, unwrap
> +work.send(normalized).unwrap()
> +} else {

This seems like something that should be handled in the caller. It is trivial 
for the caller to separate files from directories if they wish to do so.

> status.rs:275
> +.filter(|s| s.is_some())
> +.map(|s| s.unwrap())
>  }

I believe these two can be replaced with `.flatten()`

> status.rs:456
>  options: StatusOptions,
> -) -> impl ParallelIterator> {
> +) -> impl ParallelIterator, Dispatch)>> {
>  dmap.par_iter().map(move |(filename, entry)| {

Why was this changed when IIUC all of the returns are references? If a caller 
wants that I would prefer to do a map in the caller.

> status.rs:617
> +// Step 1: check the files explicitly mentioned by the user
> +let (tx, rx) = mpsc::channel();
> +results.par_extend(walk_explicit(files, &dmap, root_dir, tx, options));

tx and rx are bad names, please indicate what is being sent and recieved.

> status.rs:618
> +let (tx, rx) = mpsc::channel();
> +results.par_extend(walk_explicit(files, &dmap, root_dir, tx, options));
> +while let Ok(dir) = rx.recv() {

Instead of creating a vec then extending use collect.

> status.rs:619
> +results.par_extend(walk_explicit(files, &dmap, root_dir, tx, options));
> +while let Ok(dir) = rx.recv() {
> +if options.list_ignored || options.list_unknown && 
> !dir_ignore_fn(dir)

You are first collecting all of `results`, then collecting all of `work`. It 
looks like you intended to do this in parallel but I don't think that is what 
is happening.

A better approach is to make walk_explicit return both items and partition them 
here.

REPOSITORY
  rHG Mercurial

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

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

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


D7927: rust-status: add util for listing a directory

2020-02-12 Thread kevincox (Kevin Cox)
kevincox added inline comments.
kevincox accepted this revision.

INLINE COMMENTS

> status.rs:76
> +
> +results.sort_by(|a, b| a.0.cmp(&b.0));
> +Ok(results)

It would be more clear to do `.sort_by_key(|e| e.0)`

And I don't think stability matters here so you could use 
`sort_unstable_by_key`.

REPOSITORY
  rHG Mercurial

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

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

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


D8048: rust-dirstatemap: cache non normal and other parent set

2020-02-12 Thread kevincox (Kevin Cox)
kevincox added inline comments.

INLINE COMMENTS

> dirstate_map.rs:251
> +self.set_non_normal_other_parent_entries(false);
> +(&mut self.non_normal_set, &mut self.other_parent_set)
> +}

If we have just set the fields to `Some(..)` in the previous line can't we do 
the unwrap here where it is obviously correct?

REPOSITORY
  rHG Mercurial

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

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

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