D5551: rust-cpython: using MissingAncestors from Python code

2019-01-10 Thread gracinet (Georges Racinet)
gracinet created this revision. Herald added a reviewer: indygreg. Herald added a subscriber: mercurial-devel. Herald added a reviewer: hg-reviewers. REVISION SUMMARY As precedently done with LazyAncestors on cpython.rs, we test for the presence of the 'rustext' module. For now, on

D5550: rust-cpython: bindings for MissingAncestors

2019-01-10 Thread gracinet (Georges Racinet)
gracinet created this revision. Herald added subscribers: mercurial-devel, kevincox, durin42. Herald added a reviewer: hg-reviewers. REVISION SUMMARY The exposition is rather straightforward, except for the remove_ancestors_from() method, which forces us to an inefficient conversion between

D5549: rust-cpython: generalised conversion function

2019-01-10 Thread gracinet (Georges Racinet)
gracinet created this revision. Herald added subscribers: mercurial-devel, kevincox, durin42. Herald added a reviewer: hg-reviewers. REVISION SUMMARY Because `hg::ancestors::MissingAncestors` has methods taking some `HashSet` besides `impl IntoIterator` as parameters we'll need the more

D5548: rust-cpython: style consistency leftovers

2019-01-10 Thread gracinet (Georges Racinet)
gracinet created this revision. Herald added subscribers: mercurial-devel, kevincox, durin42. Herald added a reviewer: hg-reviewers. REVISION SUMMARY In particular, during review of `LazyAncestors` bindings, most `match` statements for error conversion have been replaced by higher level

D5546: rust-cpython: rustdoc improvements

2019-01-10 Thread gracinet (Georges Racinet)
@ +// ancestors.rs +// +// Copyright 2018 Georges Racinet +// +// This software may be used and distributed according to the terms of the +// GNU General Public License version 2 or any later version. + +//! Bindings for Rust errors +//! +//! [`GraphError`] exposes `hg::GraphError` as a subcl

D5547: rust-cpython: consistency in use of hg-core constructs

2019-01-10 Thread gracinet (Georges Racinet)
gracinet created this revision. Herald added subscribers: mercurial-devel, kevincox, durin42. Herald added a reviewer: hg-reviewers. REVISION SUMMARY While not everybody likes the `CoreLazy` and `CoreIterator` aliases, it's better not to mix them with direct references. Note: it's quite

D5442: rust-cpython: using the new bindings from Python

2019-01-05 Thread gracinet (Georges Racinet)
This revision was automatically updated to reflect the committed changes. Closed by commit rHG536c83535cbd: rust-cpython: using the new bindings from Python (authored by gracinet, committed by ). REPOSITORY rHG Mercurial CHANGES SINCE LAST UPDATE

D5441: rust-cpython: binding for LazyAncestors

2019-01-05 Thread gracinet (Georges Racinet)
This revision was automatically updated to reflect the committed changes. Closed by commit rHGb31a41f24864: rust-cpython: binding for LazyAncestors (authored by gracinet, committed by ). REPOSITORY rHG Mercurial CHANGES SINCE LAST UPDATE https://phab.mercurial-scm.org/D5441?vs=13007=13014

D5443: ancestor: uniformity of calling lazyancestors classes

2019-01-05 Thread gracinet (Georges Racinet)
gracinet abandoned this revision. gracinet added a comment. Given this conversation, and its outcome as materialised with latest versions of https://phab.mercurial-scm.org/D5441 and https://phab.mercurial-scm.org/D5442, we can now simply abandon this one. REPOSITORY rHG Mercurial

D5442: rust-cpython: using the new bindings from Python

2019-01-04 Thread gracinet (Georges Racinet)
gracinet updated this revision to Diff 13008. REPOSITORY rHG Mercurial CHANGES SINCE LAST UPDATE https://phab.mercurial-scm.org/D5442?vs=12879=13008 REVISION DETAIL https://phab.mercurial-scm.org/D5442 AFFECTED FILES mercurial/revlog.py CHANGE DETAILS diff --git a/mercurial/revlog.py

D5441: rust-cpython: binding for LazyAncestors

2019-01-04 Thread gracinet (Georges Racinet)
gracinet added a comment. @yuja this new version exports the LazyAncestors name to Python, expecting `revlog.ancestors` to do the right thing (as a factory then). I agree that the destiny of the older `rustlazyancestors` is to disappear, but I'd prefer to wait a bit before doing that

D5441: rust-cpython: binding for LazyAncestors

2019-01-04 Thread gracinet (Georges Racinet)
gracinet updated this revision to Diff 13007. gracinet marked an inline comment as done. gracinet edited the summary of this revision. REPOSITORY rHG Mercurial CHANGES SINCE LAST UPDATE https://phab.mercurial-scm.org/D5441?vs=12952=13007 REVISION DETAIL

D5442: rust-cpython: using the new bindings from Python

2018-12-27 Thread gracinet (Georges Racinet)
gracinet added a comment. @yuja about the lazy importer, and just to clarify: so you're saying it's not worth it to delay until rustext is actually used. I'm fine with that, will do it. I didn't amend that patch yet, but you might have received notifications due to evolve of the whole

D5441: rust-cpython: binding for LazyAncestors

2018-12-27 Thread gracinet (Georges Racinet)
gracinet marked 2 inline comments as done. gracinet added a comment. > Does the class name actually matter? Personally I don't care if > lazyancestors() function returns a LazyAncestors object. We'll anyway > need a wrapper function to make pure ancestors and rustext ancestors >

D5438: rust-cpython: implementing Graph using C parents function

2018-12-27 Thread gracinet (Georges Racinet)
gracinet added a comment. @yuja, thanks for the queueing ! > Index could be backed by e.g. Rc> to allow any objects to own > copies, but I don't feel like this is a good design. If we want one day to have Mercurial work in a multi-threaded way, I guess that something like `Arc>`

D5438: rust-cpython: implementing Graph using C parents function

2018-12-23 Thread gracinet (Georges Racinet)
, PyInit_rustext, |py, m| { diff --git a/rust/hg-cpython/src/cindex.rs b/rust/hg-cpython/src/cindex.rs new file mode 100644 --- /dev/null +++ b/rust/hg-cpython/src/cindex.rs @@ -0,0 +1,121 @@ +// cindex.rs +// +// Copyright 2018 Georges Racinet +// +// This software may be used and distributed

D5440: rust: core implementation for lazyancestors

2018-12-23 Thread gracinet (Georges Racinet)
This revision was automatically updated to reflect the committed changes. Closed by commit rHGef54bd33b476: rust: core implementation for lazyancestors (authored by gracinet, committed by ). REPOSITORY rHG Mercurial CHANGES SINCE LAST UPDATE

D5439: rust-cpython: binding for AncestorsIterator

2018-12-23 Thread gracinet (Georges Racinet)
This revision was automatically updated to reflect the committed changes. Closed by commit rHGd9f439fcdb4c: rust-cpython: binding for AncestorsIterator (authored by gracinet, committed by ). REPOSITORY rHG Mercurial CHANGES SINCE LAST UPDATE

D5441: rust-cpython: binding for LazyAncestors

2018-12-22 Thread gracinet (Georges Racinet)
gracinet added inline comments. INLINE COMMENTS > kevincox wrote in ancestors.rs:98 > It should be fine with tbe GIL. RefCell is basically a single-thread lock. In > this case it should be fine to have no renterance. Yes, I'll remove these comments, same with the ones for RW lock, it's pretty

D5439: rust-cpython: binding for AncestorsIterator

2018-12-22 Thread gracinet (Georges Racinet)
gracinet added a comment. @yuja actually my first version of `CoreIterator` (and later `CoreLazy`) used the `hg::AncestorsIterator` spelling, but actually I believe we might end up after a while not exporting everything at the top of the `hg` crate, leaving us either to `use hg::ancestors`,

D5440: rust: core implementation for lazyancestors

2018-12-22 Thread gracinet (Georges Racinet)
gracinet updated this revision to Diff 12954. REPOSITORY rHG Mercurial CHANGES SINCE LAST UPDATE https://phab.mercurial-scm.org/D5440?vs=12951=12954 REVISION DETAIL https://phab.mercurial-scm.org/D5440 AFFECTED FILES rust/hg-core/src/ancestors.rs rust/hg-core/src/lib.rs

D5440: rust: core implementation for lazyancestors

2018-12-22 Thread gracinet (Georges Racinet)
gracinet updated this revision to Diff 12951. gracinet marked 4 inline comments as done. REPOSITORY rHG Mercurial CHANGES SINCE LAST UPDATE https://phab.mercurial-scm.org/D5440?vs=12877=12951 REVISION DETAIL https://phab.mercurial-scm.org/D5440 AFFECTED FILES

D5439: rust-cpython: binding for AncestorsIterator

2018-12-22 Thread gracinet (Georges Racinet)
gracinet updated this revision to Diff 12953. REPOSITORY rHG Mercurial CHANGES SINCE LAST UPDATE https://phab.mercurial-scm.org/D5439?vs=12950=12953 REVISION DETAIL https://phab.mercurial-scm.org/D5439 AFFECTED FILES rust/hg-cpython/src/ancestors.rs tests/test-rust-ancestor.py

D5438: rust-cpython: implementing Graph using C parents function

2018-12-22 Thread gracinet (Georges Racinet)
@@ +// cindex.rs +// +// Copyright 2018 Georges Racinet +// +// This software may be used and distributed according to the terms of the +// GNU General Public License version 2 or any later version. + +//! Bindings to use the Index defined by the parsers C extension +//! +//! Ideally, we should use an Index

D5441: rust-cpython: binding for LazyAncestors

2018-12-22 Thread gracinet (Georges Racinet)
gracinet updated this revision to Diff 12952. REPOSITORY rHG Mercurial CHANGES SINCE LAST UPDATE https://phab.mercurial-scm.org/D5441?vs=12878=12952 REVISION DETAIL https://phab.mercurial-scm.org/D5441 AFFECTED FILES rust/hg-cpython/src/ancestors.rs tests/test-rust-ancestor.py

D5439: rust-cpython: binding for AncestorsIterator

2018-12-22 Thread gracinet (Georges Racinet)
gracinet updated this revision to Diff 12950. REPOSITORY rHG Mercurial CHANGES SINCE LAST UPDATE https://phab.mercurial-scm.org/D5439?vs=12876=12950 REVISION DETAIL https://phab.mercurial-scm.org/D5439 AFFECTED FILES rust/hg-cpython/src/ancestors.rs rust/hg-cpython/src/lib.rs

D5440: rust: core implementation for lazyancestors

2018-12-22 Thread gracinet (Georges Racinet)
gracinet added a comment. @yuja, yes a `Graph` not implementing `Clone` is already a good thing, as it avoids to implement `Clone` in `hg-direct-ffi` prematurely. I think the whole `hg::LazyAncestors` can end up being useful from core Rust code, too, that's why I prefer that to a

D5443: ancestor: uniformity of calling lazyancestors classes

2018-12-22 Thread gracinet (Georges Racinet)
gracinet added a comment. @yuja I'm not sure by what you consider exactly to be internals here. If that's the `[5]` and [6]`, maybe a `parents(revision)` method on the index would be better ? The obvious drawback would be to write more C code. Given that my ultimate goal here is to

D5446: rust-cpython: build and support for Python3

2018-12-18 Thread gracinet (Georges Racinet)
gracinet added a comment. @yuja great, thanks. Didn't know about this suffix, apparently it can be obtained through the `sysconfig` module (thats what `$PYTHON-config` does) ~ $ python2 -c "import sysconfig; print(sysconfig.get_config_var('SO'))" .so ~ $ python3 -c

D5446: rust-cpython: build and support for Python3

2018-12-18 Thread gracinet (Georges Racinet)
This revision was automatically updated to reflect the committed changes. Closed by commit rHG4277e20cfec4: rust-cpython: build and support for Python3 (authored by gracinet, committed by ). REPOSITORY rHG Mercurial CHANGES SINCE LAST UPDATE

D5439: rust-cpython: binding for AncestorsIterator

2018-12-17 Thread gracinet (Georges Racinet)
gracinet added a comment. @yuja you're right! My first attempt was tainted with assigning to a `Vec`, whereas upon type inference with the actual return type `PyResult`, the compiler does the right thing so that was the escape plan for early returns in closures :-) amazing. REPOSITORY

D5446: rust-cpython: build and support for Python3

2018-12-17 Thread gracinet (Georges Racinet)
gracinet created this revision. Herald added subscribers: mercurial-devel, mjpieters. Herald added a reviewer: hg-reviewers. REVISION SUMMARY Defined Cargo features for Python3, making them overall simpler to use, hooked them in build and made mercurial.rustext importable. This is tested

D5439: rust-cpython: binding for AncestorsIterator

2018-12-17 Thread gracinet (Georges Racinet)
gracinet added a comment. @yuja thanks for spotting the Python3 incompatibility. As you can guess, I didn't compile with Python 3, and actually I hadn't even defined the features to that extent. I will submit separately a change that takes care of the build with Python 3 before updating

D5438: rust-cpython: implementing Graph using C parents function

2018-12-17 Thread gracinet (Georges Racinet)
gracinet added a comment. I gave the solution to reacquire the GIL explicitely from Index a quick try, without even releasing it from the callers (which is ok according to https://docs.python.org/2.7/c-api/init.html#c.PyGILState_Ensure), and it is more than a 20% penalty. I'm measuring

D5438: rust-cpython: implementing Graph using C parents function

2018-12-17 Thread gracinet (Georges Racinet)
gracinet added a comment. @yuja yes sorry, forgot to adapt to the new signature. That'll be fixed in next version, and in `revlog.c`, the capsule pointer declaration is now at the top. About protecting parents() with the GIL `Python<'p>`, I'll have to think more about it, but the

D5434: rust-cpython: started cpython crate bindings

2018-12-15 Thread gracinet (Georges Racinet)
-cpython/src/exceptions.rs rust/hg-cpython/src/lib.rs CHANGE DETAILS diff --git a/rust/hg-cpython/src/lib.rs b/rust/hg-cpython/src/lib.rs new file mode 100644 --- /dev/null +++ b/rust/hg-cpython/src/lib.rs @@ -0,0 +1,40 @@ +// lib.rs +// +// Copyright 2018 Georges Racinet +// +// This software may

D5433: rust-cpython: excluded hgcli from workspace

2018-12-15 Thread gracinet (Georges Racinet)
This revision was automatically updated to reflect the committed changes. Closed by commit rHG6e815adf91de: rust-cpython: exclude hgcli from workspace (authored by gracinet, committed by ). CHANGED PRIOR TO COMMIT https://phab.mercurial-scm.org/D5433?vs=12870=12882#toc REPOSITORY rHG

D5436: rust-cpython: build via HGWITHRUSTEXT=cpython

2018-12-15 Thread gracinet (Georges Racinet)
This revision was automatically updated to reflect the committed changes. Closed by commit rHG9e755c16f05d: rust-cpython: build via HGWITHRUSTEXT=cpython (authored by gracinet, committed by ). CHANGED PRIOR TO COMMIT https://phab.mercurial-scm.org/D5436?vs=12873=12885#toc REPOSITORY rHG

D5437: rust-cpython: testing the bindings from Python

2018-12-15 Thread gracinet (Georges Racinet)
This revision was automatically updated to reflect the committed changes. Closed by commit rHG57e3dfeb3a5d: rust-cpython: testing the bindings from Python (authored by gracinet, committed by ). REPOSITORY rHG Mercurial CHANGES SINCE LAST UPDATE

D5435: rust: better treatment of cargo/rustc errors

2018-12-15 Thread gracinet (Georges Racinet)
This revision was automatically updated to reflect the committed changes. Closed by commit rHG5955cf85ed74: rust: better treatment of cargo/rustc errors (authored by gracinet, committed by ). CHANGED PRIOR TO COMMIT https://phab.mercurial-scm.org/D5435?vs=12872=12884#toc REPOSITORY rHG

D5443: ancestor: uniformity of calling lazyancestors classes

2018-12-15 Thread gracinet (Georges Racinet)
gracinet added a comment. obviously, this one could be adapted for application before the rust-cpython bindings, and extended for the `incrementalmissingancestors` as well REPOSITORY rHG Mercurial REVISION DETAIL https://phab.mercurial-scm.org/D5443 To: gracinet, indygreg,

D5438: rust-cpython: implementing Graph using C parents function

2018-12-15 Thread gracinet (Georges Racinet)
gracinet added a comment. Here, I'd be tempted to submit a `py_capsule_fn` macro to rust-cpython, but I guess it can wait. REPOSITORY rHG Mercurial REVISION DETAIL https://phab.mercurial-scm.org/D5438 To: gracinet, #hg-reviewers Cc: durin42, kevincox, mercurial-devel

D5370: rust: core implementation of missingancestors (no bindings)

2018-12-15 Thread gracinet (Georges Racinet)
gracinet abandoned this revision. gracinet marked an inline comment as done. gracinet added a comment. This Differential has been superseded by https://phab.mercurial-scm.org/D5414 through https://phab.mercurial-scm.org/D5417 REPOSITORY rHG Mercurial REVISION DETAIL

D5443: ancestor: uniformity of calling lazyancestors classes

2018-12-15 Thread gracinet (Georges Racinet)
gracinet created this revision. Herald added a reviewer: indygreg. Herald added a subscriber: mercurial-devel. Herald added a reviewer: hg-reviewers. REVISION SUMMARY Up to now, the pure Python lazyancestors had been taking the parents function in its constructor, whereas Rust-backed variants

D5442: rust-cpython: using the new bindings from Python

2018-12-15 Thread gracinet (Georges Racinet)
gracinet created this revision. Herald added a reviewer: indygreg. Herald added a subscriber: mercurial-devel. Herald added a reviewer: hg-reviewers. REVISION SUMMARY The Python callers detect if we have cpython or direct-ffi bindings and fallback to the Python implementation if none is

D5440: rust: core implementation for lazyancestors

2018-12-15 Thread gracinet (Georges Racinet)
gracinet created this revision. Herald added subscribers: mercurial-devel, kevincox, durin42. Herald added a reviewer: hg-reviewers. REVISION SUMMARY Once exposed through appropriate bindings, this should be able to replace ancestor.lazyancestors entirely. REPOSITORY rHG Mercurial

D5441: rust-cpython: binding for LazyAncestors

2018-12-15 Thread gracinet (Georges Racinet)
gracinet created this revision. Herald added subscribers: mercurial-devel, kevincox, durin42. Herald added a reviewer: hg-reviewers. REVISION SUMMARY For consistency with Python implementation, we're exposing it with the lower case spelling, so that if one day the whole ancestor module has a

D5438: rust-cpython: implementing Graph using C parents function

2018-12-15 Thread gracinet (Georges Racinet)
tern crate cpython; extern crate hg; +extern crate libc; mod ancestors; mod exceptions; diff --git a/rust/hg-cpython/src/cindex.rs b/rust/hg-cpython/src/cindex.rs new file mode 100644 --- /dev/null +++ b/rust/hg-cpython/src/cindex.rs @@ -0,0 +1,95 @@ +// cindex.rs +// +// Copyright 20

D5434: rust-cpython: started cpython crate bindings

2018-12-15 Thread gracinet (Georges Racinet)
+// +// Copyright 2018 Georges Racinet +// +// This software may be used and distributed according to the terms of the +// GNU General Public License version 2 or any later version. + +//! Python bindings of `hg-core` objects using the `cpython` crate. +//! Once compiled, the resulting single shared library

D5437: rust-cpython: testing the bindings from Python

2018-12-15 Thread gracinet (Georges Racinet)
gracinet created this revision. Herald added a subscriber: mercurial-devel. Herald added a reviewer: hg-reviewers. REVISION SUMMARY This is easier and more convincing than doing the same tests from a Rust tests module. REPOSITORY rHG Mercurial REVISION DETAIL

D5439: rust-cpython: binding for AncestorsIterator

2018-12-15 Thread gracinet (Georges Racinet)
gracinet created this revision. Herald added subscribers: mercurial-devel, kevincox, durin42. Herald added a reviewer: hg-reviewers. REVISION SUMMARY It's now reachable from Python as rustext.ancestor.AncestorsIterator Tests are provided in the previously introduced Python testcase:

D5436: rust-cpython: build via HGWITHRUSTEXT=cpython

2018-12-15 Thread gracinet (Georges Racinet)
gracinet created this revision. Herald added a subscriber: mercurial-devel. Herald added a reviewer: hg-reviewers. REVISION SUMMARY The existing behaviour, building the direct ffi bindings if HGIWTHRUSTEXT is just set is unchanged, but if HGWITHRUSTEXT is cpython, then the cpython bindings

D5435: rust: better treatment of cargo/rustc errors

2018-12-15 Thread gracinet (Georges Racinet)
gracinet created this revision. Herald added a subscriber: mercurial-devel. Herald added a reviewer: hg-reviewers. REPOSITORY rHG Mercurial REVISION DETAIL https://phab.mercurial-scm.org/D5435 AFFECTED FILES setup.py CHANGE DETAILS diff --git a/setup.py b/setup.py --- a/setup.py +++

D5433: rust-cpython: excluded hgcli from workspace

2018-12-15 Thread gracinet (Georges Racinet)
gracinet created this revision. Herald added a subscriber: mercurial-devel. Herald added a reviewer: hg-reviewers. REVISION SUMMARY hgcli uses a specific rust-cpython commit by indygreg, of which a PR has been derived which is not merged nor released yet. But we can't use several

D5417: rust: translated random test of missingancestors

2018-12-15 Thread gracinet (Georges Racinet)
gracinet added a comment. @yuja: I'll look into it, maybe that's a case for benches (I've not played with them yet). REPOSITORY rHG Mercurial REVISION DETAIL https://phab.mercurial-scm.org/D5417 To: gracinet, #hg-reviewers Cc: yuja, durin42, kevincox, mercurial-devel

D5416: rust: translation of missingancestors

2018-12-14 Thread gracinet (Georges Racinet)
This revision was automatically updated to reflect the committed changes. gracinet marked an inline comment as done. Closed by commit rHG5817c3b186a7: rust: translation of missingancestors (authored by gracinet, committed by ). REPOSITORY rHG Mercurial CHANGES SINCE LAST UPDATE

D5416: rust: translation of missingancestors

2018-12-14 Thread gracinet (Georges Racinet)
gracinet marked 2 inline comments as done. gracinet added a comment. Thanks for the useful tips! INLINE COMMENTS > kevincox wrote in ancestors.rs:154 > Why not just write: > > self.bases.iter().any(|b| != NULL_REVISION) > > It is much clearer what you mean and I suspect the performance

D5417: rust: translated random test of missingancestors

2018-12-14 Thread gracinet (Georges Racinet)
gracinet updated this revision to Diff 12856. REPOSITORY rHG Mercurial CHANGES SINCE LAST UPDATE https://phab.mercurial-scm.org/D5417?vs=12833=12856 REVISION DETAIL https://phab.mercurial-scm.org/D5417 AFFECTED FILES rust/Cargo.lock rust/hg-core/Cargo.toml

D5416: rust: translation of missingancestors

2018-12-14 Thread gracinet (Georges Racinet)
gracinet updated this revision to Diff 12855. gracinet marked an inline comment as done. REPOSITORY rHG Mercurial CHANGES SINCE LAST UPDATE https://phab.mercurial-scm.org/D5416?vs=12832=12855 REVISION DETAIL https://phab.mercurial-scm.org/D5416 AFFECTED FILES

D5418: perfdiscovery: benching findcommonheads()

2018-12-14 Thread gracinet (Georges Racinet)
This revision was automatically updated to reflect the committed changes. Closed by commit rHG716ce792886c: perfdiscovery: benching findcommonheads() (authored by gracinet, committed by ). REPOSITORY rHG Mercurial CHANGES SINCE LAST UPDATE https://phab.mercurial-scm.org/D5418?vs=12837=12838

D5418: perfdiscovery: benching findcommonheads()

2018-12-14 Thread gracinet (Georges Racinet)
gracinet updated this revision to Diff 12837. REPOSITORY rHG Mercurial CHANGES SINCE LAST UPDATE https://phab.mercurial-scm.org/D5418?vs=12836=12837 REVISION DETAIL https://phab.mercurial-scm.org/D5418 AFFECTED FILES contrib/perf.py tests/test-contrib-perf.t CHANGE DETAILS diff

D5418: perfdiscovery: benching findcommonheads()

2018-12-13 Thread gracinet (Georges Racinet)
gracinet added a comment. @pulkit indeed, I didn't think of that, seems like a good idea, thanks. I wouldn't go as far as putting `path=default` by default, though, so that users don't start hammering providers unwillingly. REPOSITORY rHG Mercurial REVISION DETAIL

D5418: perfdiscovery: benching findcommonheads()

2018-12-13 Thread gracinet (Georges Racinet)
gracinet created this revision. Herald added a subscriber: mercurial-devel. Herald added a reviewer: hg-reviewers. REVISION SUMMARY This works between the local repo and any peer given by its path, and should be useful for further work on discovery REPOSITORY rHG Mercurial REVISION DETAIL

D5415: rust: changed Graph.parents to return [Revision; 2]

2018-12-13 Thread gracinet (Georges Racinet)
This revision was automatically updated to reflect the committed changes. gracinet marked 2 inline comments as done. Closed by commit rHGa6ba978d9ffb: rust: changed Graph.parents to return [Revision; 2] (authored by gracinet, committed by ). REPOSITORY rHG Mercurial CHANGES SINCE LAST UPDATE

D5414: rust: improved docstring

2018-12-13 Thread gracinet (Georges Racinet)
This revision was automatically updated to reflect the committed changes. Closed by commit rHGceb695c3c154: rust: improved docstring (authored by gracinet, committed by ). REPOSITORY rHG Mercurial CHANGES SINCE LAST UPDATE https://phab.mercurial-scm.org/D5414?vs=12827=12834 REVISION DETAIL

D5415: rust: changed Graph.parents to return [Revision; 2]

2018-12-12 Thread gracinet (Georges Racinet)
gracinet marked 2 inline comments as done. gracinet added a subscriber: yuja. gracinet added a comment. Thanks ! About the fact to always returning two elements, I've been hesitating about that. This is what the C function we're wrapping provides anyway, so you could say it's for simplicity.

D5417: rust: translated random test of missingancestors

2018-12-12 Thread gracinet (Georges Racinet)
gracinet updated this revision to Diff 12833. REPOSITORY rHG Mercurial CHANGES SINCE LAST UPDATE https://phab.mercurial-scm.org/D5417?vs=12830=12833 REVISION DETAIL https://phab.mercurial-scm.org/D5417 AFFECTED FILES rust/Cargo.lock rust/hg-core/Cargo.toml

D5416: rust: translation of missingancestors

2018-12-12 Thread gracinet (Georges Racinet)
gracinet updated this revision to Diff 12832. REPOSITORY rHG Mercurial CHANGES SINCE LAST UPDATE https://phab.mercurial-scm.org/D5416?vs=12829=12832 REVISION DETAIL https://phab.mercurial-scm.org/D5416 AFFECTED FILES rust/hg-core/src/ancestors.rs rust/hg-core/src/lib.rs

D5415: rust: changed Graph.parents to return [Revision; 2]

2018-12-12 Thread gracinet (Georges Racinet)
gracinet updated this revision to Diff 12831. REPOSITORY rHG Mercurial CHANGES SINCE LAST UPDATE https://phab.mercurial-scm.org/D5415?vs=12828=12831 REVISION DETAIL https://phab.mercurial-scm.org/D5415 AFFECTED FILES rust/hg-core/src/ancestors.rs rust/hg-core/src/lib.rs

D5417: rust: translated random test of missingancestors

2018-12-12 Thread gracinet (Georges Racinet)
gracinet created this revision. Herald added subscribers: mercurial-devel, kevincox, durin42. Herald added a reviewer: hg-reviewers. REVISION SUMMARY In case of a failed example, all needed information for reproduction is included in the panic message, so that we don't need to seed the

D5416: rust: translation of missingancestors

2018-12-12 Thread gracinet (Georges Racinet)
gracinet created this revision. Herald added subscribers: mercurial-devel, mjpieters, kevincox, durin42. Herald added a reviewer: hg-reviewers. REVISION SUMMARY This is as direct as possible a translation of the ancestor.missingancestors Python class in pure Rust. The goal for this changeset

D5415: rust: changed Graph.parents to return [Revision; 2]

2018-12-12 Thread gracinet (Georges Racinet)
gracinet created this revision. Herald added subscribers: mercurial-devel, kevincox, durin42. Herald added a reviewer: hg-reviewers. REVISION SUMMARY This will allow for simple iteration on parent revisions, such as: for parent in graph.parents(rev)?.iter().cloned() This seems to

D5414: rust: improved docstring

2018-12-12 Thread gracinet (Georges Racinet)
gracinet created this revision. Herald added subscribers: mercurial-devel, kevincox, durin42. Herald added a reviewer: hg-reviewers. REVISION SUMMARY In the previous wording, rustfmt wanted to cut at the == which is not very readable in my taste. REPOSITORY rHG Mercurial REVISION DETAIL

D5370: rust: core implementation of missingancestors (no bindings)

2018-12-12 Thread gracinet (Georges Racinet)
gracinet marked 11 inline comments as done. gracinet added a comment. @yuja trying to submit the v2 with phabsend instead of arcanist… hope it'll be linked properly INLINE COMMENTS > kevincox wrote in ancestors.rs:201 > Isn't this loop redundant with the retain call above? indeed, must

[PATCH] rust: adapted hg-core tests for iteration over Result

2018-12-12 Thread Georges Racinet
# HG changeset patch # User Georges Racinet # Date 1544544797 -3600 # Tue Dec 11 17:13:17 2018 +0100 # Node ID 7255a67d19ac54af80085ebfc9b62a684532aabe # Parent 76d8b20139a3b8b5835c7262216b97275845b582 # EXP-Topic rustancestors-tests rust: adapted hg-core tests for iteration over Result

Re: [PATCH 4 of 6] revlog: add public CPython function to get parent revisions

2018-12-12 Thread Georges Racinet
On 12/11/18 2:10 PM, Yuya Nishihara wrote: > On Mon, 10 Dec 2018 18:54:56 +0100, Georges Racinet wrote: >> On 12/9/18 6:02 AM, Yuya Nishihara wrote: >>> On Wed, 05 Dec 2018 22:43:35 +0900, Yuya Nishihara wrote: >>>> # HG changeset patch >>>> # User Yuy

Re: [PATCH 6 of 6] rust: propagate error of index_get_parents() properly

2018-12-10 Thread Georges Racinet
L_REVISION, > +}; > +rev as c_long > } > > #[no_mangle] > @@ -157,10 +161,10 @@ fn raw_contains( > target: c_long, > ) -> c_int { > let as_ref = unsafe { *raw }; > -if as_ref.contains(target as Revision) { > - return 1; > +

Re: [PATCH 5 of 6] rust: look up HgRevlogIndex_GetParents() from symbol table

2018-12-10 Thread Georges Racinet
> @@ -68,7 +70,7 @@ pub extern "C" fn rustlazyancestors_init > assert!(initrevslen >= 0); > unsafe { > raw_init( > -Index::new(index, parents), > +Index::new(index), > initrevslen as usize, >

Re: [PATCH 4 of 6] revlog: add public CPython function to get parent revisions

2018-12-10 Thread Georges Racinet
lazyancestorsType.tp_new = PyType_GenericNew;     if (PyType_Ready() < 0) So, to summarize, I think we should maybe promote capsules as the preferred way to interface Rust code with inner C code. It wouldn't be hard to document either. What do you think ? And yes, I should submit formally those

D5370: rust: core implementation of missingancestors (no bindings)

2018-12-06 Thread gracinet (Georges Racinet)
gracinet added a comment. @yuja: do you mean one of those Differential Revisions of this system for each commit, sure I can do. With respect to rust-cpython bindings, I'm currently waiting for feedback on https://github.com/dgrunwald/rust-cpython/issues/164 Perhaps you'd have an idea

D5370: rust: core implementation of missingancestors (no bindings)

2018-12-05 Thread gracinet (Georges Racinet)
gracinet added a comment. I'll include your remark in the upcoming v2, thanks again ! INLINE COMMENTS > kevincox wrote in ancestors.rs:159 > Is always having an item in the set actually saving many corner cases? It > seems like you usually check for empty sets anyways. Not sure about this,

D5365: rust: AncestorsIterator::next, renamed local variables

2018-12-05 Thread gracinet (Georges Racinet)
This revision was automatically updated to reflect the committed changes. Closed by commit rHG70976974c14a: rust: rename local variables in AncestorsIterator::next (authored by gracinet, committed by ). REPOSITORY rHG Mercurial CHANGES SINCE LAST UPDATE

D5369: rust: make clean takes care of rust/target

2018-12-05 Thread gracinet (Georges Racinet)
This revision was automatically updated to reflect the committed changes. Closed by commit rHG9072a890e523: rust: make clean takes care of rust/target (authored by gracinet, committed by ). CHANGED PRIOR TO COMMIT https://phab.mercurial-scm.org/D5369?vs=12700=12710#toc REPOSITORY rHG

D5370: rust: core implementation of missingancestors (no bindings)

2018-12-04 Thread gracinet (Georges Racinet)
gracinet created this revision. Herald added subscribers: mercurial-devel, mjpieters, kevincox, durin42. Herald added a reviewer: hg-reviewers. REVISION SUMMARY rust: iterator version of Graph.parents This is handy for callers that want to simply do: for p in graph.parents_iter(rev)

D5369: rust: make clean takes care of rust/target

2018-12-04 Thread gracinet (Georges Racinet)
gracinet created this revision. Herald added a subscriber: mercurial-devel. Herald added a reviewer: hg-reviewers. REVISION SUMMARY This isn't the prettiest way of doing it, but it doesn't require looking up cargo, or wondering whether that should be part of setup.py clean. REPOSITORY rHG

D5365: rust: AncestorsIterator::next, renamed local variables

2018-12-04 Thread gracinet (Georges Racinet)
gracinet created this revision. Herald added subscribers: mercurial-devel, kevincox, durin42. Herald added a reviewer: hg-reviewers. REVISION SUMMARY It was confusing to have p1 and parents.1 ; (p1, p2) is clearer. REPOSITORY rHG Mercurial BRANCH default REVISION DETAIL

D5358: rust: peek_mut optim for lazy ancestors

2018-12-04 Thread gracinet (Georges Racinet)
This revision was automatically updated to reflect the committed changes. Closed by commit rHG04ebdb33e5d0: rust: peek_mut optim for lazy ancestors (authored by gracinet, committed by ). CHANGED PRIOR TO COMMIT https://phab.mercurial-scm.org/D5358?vs=12683=12694#toc REPOSITORY rHG Mercurial

D5358: rust: peek_mut optim for lazy ancestors

2018-12-03 Thread gracinet (Georges Racinet)
gracinet created this revision. Herald added subscribers: mercurial-devel, kevincox, durin42. Herald added a reviewer: hg-reviewers. REVISION SUMMARY This is one of the two optimizations that are also present in the Python code: replacing pairs of pop/push on the BinaryHeap by single

Re: [PATCH 3 of 3 STABLE] rust: propagate Python exception raised from index_get_parents_checked()

2018-10-30 Thread Georges Racinet
___ > Mercurial-devel mailing list > Mercurial-devel@mercurial-scm.org > https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel -- Georges Racinet Anybox SAS, http://anybox.fr Téléphone: +33 6 51 32 07 27 GPG: B59E 22AB B842 CAED

Re: Rust extensions: the next step

2018-10-18 Thread Georges Racinet
f milksnake can automate it, that's an easy win to be added later (for now I still need to call in the C modules from the Rust code). In both cases, we need to tighten it with comprehensive integration tests. Cheers, -- Georges Racinet Anybox SAS, http://anybox.fr Téléphone: +33 6 51 32 07 27 GPG: B59E

Re: Rust extensions: the next step

2018-10-18 Thread Georges Racinet
of what mercurial.ancestor provides. Therefore to have mercurial.policy handle it, we'll need either to take such partial cases into account, or decide to translate the whole Python module in Rust. For the time being, I'm simply doing an import and catch the error to fallback to the Python version. R

Rust extensions: the next step

2018-10-17 Thread Georges Racinet
(have to switch soon to other, unrelated, works) and we're too close to the freeze anyway, but if someone wants to see it, I can share it right away. Also, I could summarize some of these thoughts on the Oxidation wiki page. Greg, are you okay with that ? Regards, -- Georges Racinet Anybox SAS

Re: [PATCH 2 of 2 V4] rust: rustlazyancestors.__contains__

2018-10-15 Thread Georges Racinet
On 10/14/2018 05:42 PM, Yuya Nishihara wrote: > On Sun, 14 Oct 2018 15:22:07 +0200, Georges Racinet wrote: >> # HG changeset patch >> # User Georges Racinet >> # Date 1539018701 -7200 >> # Mon Oct 08 19:11:41 2018 +0200 >> # Node ID 50d03c9079ffe393295

[PATCH 1 of 2 V5] rust: rustlazyancestors.__contains__

2018-10-15 Thread Georges Racinet
# HG changeset patch # User Georges Racinet # Date 1539018701 -7200 # Mon Oct 08 19:11:41 2018 +0200 # Node ID a7cbd02e936e6724068219ee4c1c50dd4da2b22c # Parent 9cadb0f5f2279a60a79b1d0e50eccd60638495c0 # EXP-Topic rustancestors-contains rust: rustlazyancestors.__contains__ This changeset

[PATCH 2 of 2 V5] rust: rustfmt config for hg-direct-ffi

2018-10-15 Thread Georges Racinet
# HG changeset patch # User Georges Racinet on ishtar.racinet.fr # Date 1539594972 -7200 # Mon Oct 15 11:16:12 2018 +0200 # Node ID 58a939a95d72e90a78f795609fe59a1adef88ddf # Parent a7cbd02e936e6724068219ee4c1c50dd4da2b22c # EXP-Topic rustancestors-contains rust: rustfmt config for hg

[PATCH 2 of 2 V4] rust: rustlazyancestors.__contains__

2018-10-14 Thread Georges Racinet
# HG changeset patch # User Georges Racinet # Date 1539018701 -7200 # Mon Oct 08 19:11:41 2018 +0200 # Node ID 50d03c9079ffe3932955353be076ff24c4e87804 # Parent c04176c0f8b9aeaf196bd1eac00207d526f3d53b # EXP-Topic rustancestors-contains rust: rustlazyancestors.__contains__ This changeset

[PATCH 1 of 2 V4] rust: hooking into Python code

2018-10-14 Thread Georges Racinet
# HG changeset patch # User Georges Racinet # Date 1538060144 -7200 # Thu Sep 27 16:55:44 2018 +0200 # Node ID c04176c0f8b9aeaf196bd1eac00207d526f3d53b # Parent 3b275f5497771d8a71336273a77575dbf4882798 # EXP-Topic rustancestors-contains rust: hooking into Python code We introduce a new

[PATCH 5 of 5 V3] rust: rustlazyancestors.__contains__

2018-10-13 Thread Georges Racinet
# HG changeset patch # User Georges Racinet # Date 1539018701 -7200 # Mon Oct 08 19:11:41 2018 +0200 # Node ID 5c3f0974b9afb074df9acd626813064eb6f2ffec # Parent 98f0f668f63b143eba344a74c8b22a0588f46935 # EXP-Topic rustancestors-contains rust: rustlazyancestors.__contains__ This changeset

[PATCH 3 of 5 V3] rust: exposing in parsers module

2018-10-13 Thread Georges Racinet
# HG changeset patch # User Georges Racinet # Date 1538060175 -7200 # Thu Sep 27 16:56:15 2018 +0200 # Node ID b1d2b4a4684a51ba9bfc3ea5bc6e177be65e4b69 # Parent 4b490e500a3551b03c41dc06f16aa506523719c6 # EXP-Topic rustancestors-contains rust: exposing in parsers module To build

[PATCH 4 of 5 V3] rust: hooking into Python code

2018-10-13 Thread Georges Racinet
# HG changeset patch # User Georges Racinet # Date 1538060144 -7200 # Thu Sep 27 16:55:44 2018 +0200 # Node ID 98f0f668f63b143eba344a74c8b22a0588f46935 # Parent b1d2b4a4684a51ba9bfc3ea5bc6e177be65e4b69 # EXP-Topic rustancestors-contains rust: hooking into Python code We introduce a new

<    1   2   3   4   5   6   >