D8450: rust-chg: clean up excessive indents

2020-04-23 Thread yuja (Yuya Nishihara)
Herald added a subscriber: mercurial-patches. Closed by commit rHG27fe8cc1338f: rust-chg: clean up excessive indents (authored by yuja). This revision was automatically updated to reflect the committed changes. This revision was not accepted when it landed; it landed in state "Needs Review".

D8449: rust-chg: do not terminate tokio runtime until pager exits

2020-04-23 Thread yuja (Yuya Nishihara)
Herald added a subscriber: mercurial-patches. Closed by commit rHG4b0185841058: rust-chg: do not terminate tokio runtime until pager exits (authored by yuja). This revision was automatically updated to reflect the committed changes. This revision was not accepted when it landed; it landed in

D8448: rust-chg: modernize entry function

2020-04-23 Thread yuja (Yuya Nishihara)
Closed by commit rHG9fc9526e283a: rust-chg: modernize entry function (authored by yuja). 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

D8447: rust-chg: reimplement locator by using async/await and tokio-0.2

2020-04-23 Thread yuja (Yuya Nishihara)
Herald added a subscriber: mercurial-patches. Closed by commit rHGa347a329e48d: rust-chg: reimplement locator by using async/await and tokio-0.2 (authored by yuja). This revision was automatically updated to reflect the committed changes. This revision was not accepted when it landed; it landed

D8446: rust-chg: reimplement ChgClientExt as ChgClient wrapper

2020-04-23 Thread yuja (Yuya Nishihara)
Herald added a subscriber: mercurial-patches. Closed by commit rHGd6f706929120: rust-chg: reimplement ChgClientExt as ChgClient wrapper (authored by yuja). This revision was automatically updated to reflect the committed changes. This revision was not accepted when it landed; it landed in state

D8445: rust-chg: reimplement run_command operation as async function

2020-04-23 Thread yuja (Yuya Nishihara)
Herald added a subscriber: mercurial-patches. Closed by commit rHG94cace4b80ea: rust-chg: reimplement run_command operation as async function (authored by yuja). This revision was automatically updated to reflect the committed changes. This revision was not accepted when it landed; it landed in

D8444: rust-chg: reimplement uihandler by using async-trait and tokio-0.2

2020-04-23 Thread yuja (Yuya Nishihara)
Herald added a subscriber: mercurial-patches. Closed by commit rHGc794d0da5fb2: rust-chg: reimplement uihandler by using async-trait and tokio-0.2 (authored by yuja). This revision was automatically updated to reflect the committed changes. This revision was not accepted when it landed; it landed

D8441: rust-chg: upgrade to futures-0.3 based libraries

2020-04-23 Thread yuja (Yuya Nishihara)
Herald added a subscriber: mercurial-patches. Closed by commit rHGe9e44e61042b: rust-chg: upgrade to futures-0.3 based libraries (authored by yuja). This revision was automatically updated to reflect the committed changes. This revision was not accepted when it landed; it landed in state "Needs

D8443: rust-chg: have attach_io() simply take reference of AsRawFd object

2020-04-23 Thread yuja (Yuya Nishihara)
Herald added a subscriber: mercurial-patches. Closed by commit rHGcb5822e6e545: rust-chg: have attach_io() simply take reference of AsRawFd object (authored by yuja). This revision was automatically updated to reflect the committed changes. This revision was not accepted when it landed; it landed

D8442: rust-chg: reimplement attach_io operation as async function

2020-04-23 Thread yuja (Yuya Nishihara)
Herald added a subscriber: mercurial-patches. Closed by commit rHG1be605526c34: rust-chg: reimplement attach_io operation as async function (authored by yuja). This revision was automatically updated to reflect the committed changes. This revision was not accepted when it landed; it landed in

D8440: rust-chg: exclude futures-dependent modules from build and break things

2020-04-23 Thread yuja (Yuya Nishihara)
Herald added a subscriber: mercurial-patches. Closed by commit rHG8685add122ff: rust-chg: exclude futures-dependent modules from build and break things (authored by yuja). This revision was automatically updated to reflect the committed changes. This revision was not accepted when it landed; it

D8399: rust-chg: upgrade to 2018 edition and remove useless extern crates

2020-04-23 Thread yuja (Yuya Nishihara)
yuja added a comment. > Should we get this on stable instead of default ? Nah. rust-chg isn't a stable thing yet. REPOSITORY rHG Mercurial CHANGES SINCE LAST ACTION https://phab.mercurial-scm.org/D8399/new/ REVISION DETAIL https://phab.mercurial-scm.org/D8399 To: yuja,

D8448: rust-chg: modernize entry function

2020-04-17 Thread yuja (Yuya Nishihara)
yuja added a comment. > `+ error[E0670]: `async fn` is not permitted in the 2015 edition` Appears that we need to specify `--edition=2018`. Sent patch. REPOSITORY rHG Mercurial CHANGES SINCE LAST ACTION https://phab.mercurial-scm.org/D8448/new/ REVISION DETAIL

D8450: rust-chg: clean up excessive indents

2020-04-16 Thread yuja (Yuya Nishihara)
yuja created this revision. Herald added a subscriber: mercurial-devel. Herald added a reviewer: hg-reviewers. REPOSITORY rHG Mercurial BRANCH default REVISION DETAIL https://phab.mercurial-scm.org/D8450 AFFECTED FILES rust/chg/src/attachio.rs rust/chg/src/locator.rs

D8449: rust-chg: do not terminate tokio runtime until pager exits

2020-04-16 Thread yuja (Yuya Nishihara)
yuja created this revision. Herald added a subscriber: mercurial-devel. Herald added a reviewer: hg-reviewers. REVISION SUMMARY We no longer need to spawn a task just to keep the pager handle. The pager handle can be held by ChgUiHandler since the handler itself is not consumed and

D8448: rust-chg: modernize entry function

2020-04-16 Thread yuja (Yuya Nishihara)
yuja created this revision. Herald added a subscriber: mercurial-devel. Herald added a reviewer: hg-reviewers. REVISION SUMMARY Finally the entire build passes. There's a bug that run() no longer waits for the spawned pager, which will be fixed by the next patch. REPOSITORY rHG

D8447: rust-chg: reimplement locator by using async/await and tokio-0.2

2020-04-16 Thread yuja (Yuya Nishihara)
yuja created this revision. Herald added a subscriber: mercurial-devel. Herald added a reviewer: hg-reviewers. REVISION SUMMARY connect_spawned() is rewritten from scratch by using std::process. Before, it would select completion of either connection or server process. New code could be

D8446: rust-chg: reimplement ChgClientExt as ChgClient wrapper

2020-04-16 Thread yuja (Yuya Nishihara)
yuja created this revision. Herald added a subscriber: mercurial-devel. Herald added a reviewer: hg-reviewers. REVISION SUMMARY ChgClient is no longer an extension trait because: a. Client object is not consumed and recreated in future-0.3 world, which unblocks writing a simple

D8445: rust-chg: reimplement run_command operation as async function

2020-04-16 Thread yuja (Yuya Nishihara)
yuja created this revision. Herald added a subscriber: mercurial-devel. Herald added a reviewer: hg-reviewers. REVISION SUMMARY The crafted state machine is no longer needed thanks to async/await. The state machine is basically rewritten as follows: - Ready(..) -> return .. -

D8444: rust-chg: reimplement uihandler by using async-trait and tokio-0.2

2020-04-16 Thread yuja (Yuya Nishihara)
yuja created this revision. Herald added a subscriber: mercurial-devel. Herald added a reviewer: hg-reviewers. REVISION SUMMARY We no longer have to consume self and arguments. REPOSITORY rHG Mercurial BRANCH default REVISION DETAIL https://phab.mercurial-scm.org/D8444 AFFECTED FILES

D8441: rust-chg: upgrade to futures-0.3 based libraries

2020-04-16 Thread yuja (Yuya Nishihara)
yuja created this revision. Herald added a subscriber: mercurial-devel. Herald added a reviewer: hg-reviewers. REVISION SUMMARY And do some trivial fixes: - BytesMut::put_u32_be() -> put_u32() - tokio_process -> tokio::process, CommandExt -> Command, spawn_async() -> spawn(), stdin() ->

D8443: rust-chg: have attach_io() simply take reference of AsRawFd object

2020-04-16 Thread yuja (Yuya Nishihara)
yuja created this revision. Herald added a subscriber: mercurial-devel. Herald added a reviewer: hg-reviewers. REVISION SUMMARY We no longer have to deal with the restriction of the Future type. Before, these file objects couldn't be references and that's the only reason why we had to make

D8442: rust-chg: reimplement attach_io operation as async function

2020-04-16 Thread yuja (Yuya Nishihara)
yuja created this revision. Herald added a subscriber: mercurial-devel. Herald added a reviewer: hg-reviewers. REVISION SUMMARY In short, MessageLoop was redesigned as Protocol, and the protocol methods no longer consume self. API changes are briefly documented in the following page:

D8440: rust-chg: exclude futures-dependent modules from build and break things

2020-04-16 Thread yuja (Yuya Nishihara)
yuja created this revision. Herald added a subscriber: mercurial-devel. Herald added a reviewer: hg-reviewers. REVISION SUMMARY It's impractical to upgrade the codebase incrementally since futures 0.1 and 0.3 APIs are fundamentally different. So this patch temporarily excludes

D8372: manifest: remove a final 40-byte assumption from pure-python parser

2020-04-15 Thread yuja (Yuya Nishihara)
yuja added a comment. > diff --git a/mercurial/manifest.py b/mercurial/manifest.py > > - a/mercurial/manifest.py > > +++ b/mercurial/manifest.py > @@ -57,7 +57,10 @@ > > raise ValueError(b'Manifest lines not in sorted order.') > prev = l > f, n = l.split(b'\0') >

D8401: rust-chg: leverage impl trait at argument position

2020-04-14 Thread yuja (Yuya Nishihara)
Closed by commit rHG61fda2dbc522: rust-chg: leverage impl trait at argument position (authored by yuja). 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

D8403: rust-chg: indent process_message() to prepare mass rewrite to futures-0.3

2020-04-14 Thread yuja (Yuya Nishihara)
Closed by commit rHGf87804825df5: rust-chg: indent process_message() to prepare mass rewrite to futures-0.3 (authored by yuja). 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

D8402: rust-chg: move get_umask() call out of run() function

2020-04-14 Thread yuja (Yuya Nishihara)
Closed by commit rHG5ac5c25ea97b: rust-chg: move get_umask() call out of run() function (authored by yuja). 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

D8403: rust-chg: indent process_message() to prepare mass rewrite to futures-0.3

2020-04-14 Thread yuja (Yuya Nishihara)
yuja added a comment. > Because you expect to add an async block or something that will make the diff harder to read, I suppose? The `match` will be surrounded by a simple `loop {}`, which was previously a state machine. And yes, reading the subsequent 10 patches would be painful

D8403: rust-chg: indent process_message() to prepare mass rewrite to futures-0.3

2020-04-14 Thread yuja (Yuya Nishihara)
yuja added a comment. >> +{ >> +match msg { > > Not sure I understand the extra bracket here. It's just for rustfmt to indent one more depth. REPOSITORY rHG Mercurial CHANGES SINCE LAST ACTION https://phab.mercurial-scm.org/D8403/new/ REVISION DETAIL

D8400: rust-chg: use "crate::" to import local modules

2020-04-13 Thread yuja (Yuya Nishihara)
Closed by commit rHGfb1adb7588c6: rust-chg: use crate:: to import local modules (authored by yuja). This revision was automatically updated to reflect the committed changes. REPOSITORY rHG Mercurial CHANGES SINCE LAST UPDATE https://phab.mercurial-scm.org/D8400?vs=21035=21042 CHANGES SINCE

D8399: rust-chg: upgrade to 2018 edition and remove useless extern crates

2020-04-13 Thread yuja (Yuya Nishihara)
Closed by commit rHG3e6e5953c671: rust-chg: upgrade to 2018 edition and remove useless extern crates (authored by yuja). This revision was automatically updated to reflect the committed changes. REPOSITORY rHG Mercurial CHANGES SINCE LAST UPDATE

D8401: rust-chg: leverage impl trait at argument position

2020-04-11 Thread yuja (Yuya Nishihara)
yuja created this revision. Herald added a subscriber: mercurial-devel. Herald added a reviewer: hg-reviewers. REPOSITORY rHG Mercurial BRANCH default REVISION DETAIL https://phab.mercurial-scm.org/D8401 AFFECTED FILES rust/chg/src/clientext.rs rust/chg/src/locator.rs

D8403: rust-chg: indent process_message() to prepare mass rewrite to futures-0.3

2020-04-11 Thread yuja (Yuya Nishihara)
yuja created this revision. Herald added a subscriber: mercurial-devel. Herald added a reviewer: hg-reviewers. REVISION SUMMARY I'll start upgrading the codebase to modern async/await-based implementation, which cannot be done incrementally. This is the last non-breaking patch to prepare

D8400: rust-chg: use "crate::" to import local modules

2020-04-11 Thread yuja (Yuya Nishihara)
yuja created this revision. Herald added a subscriber: mercurial-devel. Herald added a reviewer: hg-reviewers. REVISION SUMMARY I feel it's easier to follow to resolve modules from the crate root than relative path from self module. REPOSITORY rHG Mercurial BRANCH default REVISION

D8399: rust-chg: upgrade to 2018 edition and remove useless extern crates

2020-04-11 Thread yuja (Yuya Nishihara)
yuja created this revision. Herald added a subscriber: mercurial-devel. Herald added a reviewer: hg-reviewers. REPOSITORY rHG Mercurial BRANCH default REVISION DETAIL https://phab.mercurial-scm.org/D8399 AFFECTED FILES rust/chg/Cargo.toml rust/chg/build.rs rust/chg/src/attachio.rs

D8402: rust-chg: move get_umask() call out of run() function

2020-04-11 Thread yuja (Yuya Nishihara)
yuja created this revision. Herald added a subscriber: mercurial-devel. Herald added a reviewer: hg-reviewers. REVISION SUMMARY run() will be an async function, but get_umask() isn't thread safe. REPOSITORY rHG Mercurial BRANCH default REVISION DETAIL

D8382: rust-chg: send client side umask to server

2020-04-09 Thread yuja (Yuya Nishihara)
Closed by commit rHG065048e66f32: rust-chg: send client side umask to server (authored by yuja). 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

D8384: rust-chg: silence warning about dated coding style

2020-04-09 Thread yuja (Yuya Nishihara)
Closed by commit rHG90e05b304902: rust-chg: silence warning about dated coding style (authored by yuja). 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

D8383: rust-chg: update name of the server process

2020-04-09 Thread yuja (Yuya Nishihara)
Closed by commit rHG80d6e3415636: rust-chg: update name of the server process (authored by yuja). 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

D8380: rust-chg: collect server flags from command arguments

2020-04-09 Thread yuja (Yuya Nishihara)
Closed by commit rHG00ac60658654: rust-chg: collect server flags from command arguments (authored by yuja). 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

D8381: rust-chg: add config validation and process returned instructions

2020-04-09 Thread yuja (Yuya Nishihara)
Closed by commit rHG9ce613d648de: rust-chg: add config validation and process returned instructions (authored by yuja). 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

D8379: rust-chg: add interface to run "validate" request

2020-04-09 Thread yuja (Yuya Nishihara)
Closed by commit rHG43513444bb88: rust-chg: add interface to run validate request (authored by yuja). 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

D8378: rust-chg: add helper to parse instructions sent from server

2020-04-09 Thread yuja (Yuya Nishihara)
Closed by commit rHG82adc720c0a3: rust-chg: add helper to parse instructions sent from server (authored by yuja). This revision was automatically updated to reflect the committed changes. REPOSITORY rHG Mercurial CHANGES SINCE LAST UPDATE https://phab.mercurial-scm.org/D8378?vs=20994=21016

D8384: rust-chg: silence warning about dated coding style

2020-04-06 Thread yuja (Yuya Nishihara)
yuja created this revision. Herald added a subscriber: mercurial-devel. Herald added a reviewer: hg-reviewers. REPOSITORY rHG Mercurial BRANCH default REVISION DETAIL https://phab.mercurial-scm.org/D8384 AFFECTED FILES rust/chg/src/message.rs rust/chg/src/runcommand.rs CHANGE

D8382: rust-chg: send client side umask to server

2020-04-06 Thread yuja (Yuya Nishihara)
yuja created this revision. Herald added a subscriber: mercurial-devel. Herald added a reviewer: hg-reviewers. REVISION SUMMARY This is equivalent to forwardumask() of hgclient.c. REPOSITORY rHG Mercurial BRANCH default REVISION DETAIL https://phab.mercurial-scm.org/D8382 AFFECTED

D8383: rust-chg: update name of the server process

2020-04-06 Thread yuja (Yuya Nishihara)
yuja created this revision. Herald added a subscriber: mercurial-devel. Herald added a reviewer: hg-reviewers. REVISION SUMMARY This is a copy of updateprocname() of hgclient.c. At this point, rust-chg is basically functional. I did dogfooding for a couple of weeks in 2018. There are a

D8381: rust-chg: add config validation and process returned instructions

2020-04-06 Thread yuja (Yuya Nishihara)
yuja created this revision. Herald added a subscriber: mercurial-devel. Herald added a reviewer: hg-reviewers. REVISION SUMMARY This is the reimplementation of runinstructions() and main() in chg.c. In Rust version, we only pass in early arguments to the server as the locator doesn't

D8380: rust-chg: collect server flags from command arguments

2020-04-06 Thread yuja (Yuya Nishihara)
yuja created this revision. Herald added a subscriber: mercurial-devel. Herald added a reviewer: hg-reviewers. REVISION SUMMARY This is the reimplementation of testsensitiveflag() and setcmdserverargs() of chg.c. REPOSITORY rHG Mercurial BRANCH default REVISION DETAIL

D8379: rust-chg: add interface to run "validate" request

2020-04-06 Thread yuja (Yuya Nishihara)
yuja created this revision. Herald added a subscriber: mercurial-devel. Herald added a reviewer: hg-reviewers. REPOSITORY rHG Mercurial BRANCH default REVISION DETAIL https://phab.mercurial-scm.org/D8379 AFFECTED FILES rust/chg/src/clientext.rs CHANGE DETAILS diff --git

D8378: rust-chg: add helper to parse instructions sent from server

2020-04-06 Thread yuja (Yuya Nishihara)
yuja created this revision. Herald added a subscriber: mercurial-devel. Herald added a reviewer: hg-reviewers. REVISION SUMMARY This is well structured version of runinstructions() of chg.c. REPOSITORY rHG Mercurial BRANCH default REVISION DETAIL https://phab.mercurial-scm.org/D8378

D8364: rust-chg: send client-side environment variables to server

2020-04-03 Thread yuja (Yuya Nishihara)
Closed by commit rHG97e6d435ff7e: rust-chg: send client-side environment variables to server (authored by yuja). 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

D8363: rust-chg: add helper to pack environment variables

2020-04-03 Thread yuja (Yuya Nishihara)
Closed by commit rHG8a7beeea655f: rust-chg: add helper to pack environment variables (authored by yuja). 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

D8360: rust-chg: spawn server process if not running

2020-04-03 Thread yuja (Yuya Nishihara)
Closed by commit rHGbb936e25a84a: rust-chg: spawn server process if not running (authored by yuja). 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

D8362: rust-chg: move set_current_dir() to Locator

2020-04-03 Thread yuja (Yuya Nishihara)
Closed by commit rHG0a2516efc463: rust-chg: move set_current_dir() to Locator (authored by yuja). 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

D8361: rust-chg: abort if server doesn't have required capabilities

2020-04-03 Thread yuja (Yuya Nishihara)
Closed by commit rHG7bf45ed9e25e: rust-chg: abort if server doesnt have required capabilities (authored by yuja). 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

D8358: rust-chg: depend on released version of tokio-process

2020-04-03 Thread yuja (Yuya Nishihara)
Closed by commit rHG1c385b99a360: rust-chg: depend on released version of tokio-process (authored by yuja). 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

D8359: rust-chg: update dependencies

2020-04-03 Thread yuja (Yuya Nishihara)
Closed by commit rHGcf144f50f413: rust-chg: update dependencies (authored by yuja). 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

D8357: rust-chg: add brief comment about initial capacity of temp_sock_path()

2020-04-03 Thread yuja (Yuya Nishihara)
Closed by commit rHGc11d98cff883: rust-chg: add brief comment about initial capacity of temp_sock_path() (authored by yuja). 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

D8359: rust-chg: update dependencies

2020-04-03 Thread yuja (Yuya Nishihara)
yuja added a comment. > Shouldn't this be merged with the previous change? I made a separate commit since there are many unrelated changes to tokio-process and the diff was noisy. Thanks for reviewing the series. REPOSITORY rHG Mercurial CHANGES SINCE LAST ACTION

D8364: rust-chg: send client-side environment variables to server

2020-04-02 Thread yuja (Yuya Nishihara)
yuja created this revision. Herald added a subscriber: mercurial-devel. Herald added a reviewer: hg-reviewers. REVISION SUMMARY This is also needed to run config validation. The "validate" request and its response handling will be implemented in the next batch. REPOSITORY rHG

D8363: rust-chg: add helper to pack environment variables

2020-04-02 Thread yuja (Yuya Nishihara)
yuja created this revision. Herald added a subscriber: mercurial-devel. Herald added a reviewer: hg-reviewers. REVISION SUMMARY On my machine, "printenv | wc -c" says 3422. That's the only reason why the initial buffer capacity is set to 4kB. REPOSITORY rHG Mercurial BRANCH default

D8362: rust-chg: move set_current_dir() to Locator

2020-04-02 Thread yuja (Yuya Nishihara)
yuja created this revision. Herald added a subscriber: mercurial-devel. Herald added a reviewer: hg-reviewers. REVISION SUMMARY This is necessary to run config validation in proper environment. REPOSITORY rHG Mercurial BRANCH default REVISION DETAIL https://phab.mercurial-scm.org/D8362

D8361: rust-chg: abort if server doesn't have required capabilities

2020-04-02 Thread yuja (Yuya Nishihara)
yuja created this revision. Herald added a subscriber: mercurial-devel. Herald added a reviewer: hg-reviewers. REVISION SUMMARY It's checked at Locator::connect() since we'll have to do more stuff in this function. REPOSITORY rHG Mercurial BRANCH default REVISION DETAIL

D8360: rust-chg: spawn server process if not running

2020-04-02 Thread yuja (Yuya Nishihara)
yuja created this revision. Herald added a subscriber: mercurial-devel. Herald added a reviewer: hg-reviewers. REVISION SUMMARY This is the minimal reimplementation of gethgcmd(), execcmdserver(), retryconnectcmdserver(), and connectcmdserver() in chg.c. No config validation is

D8359: rust-chg: update dependencies

2020-04-02 Thread yuja (Yuya Nishihara)
yuja created this revision. Herald added a subscriber: mercurial-devel. Herald added a reviewer: hg-reviewers. REPOSITORY rHG Mercurial BRANCH default REVISION DETAIL https://phab.mercurial-scm.org/D8359 AFFECTED FILES rust/chg/Cargo.lock CHANGE DETAILS diff --git

D8358: rust-chg: depend on released version of tokio-process

2020-04-02 Thread yuja (Yuya Nishihara)
yuja created this revision. Herald added a subscriber: mercurial-devel. Herald added a reviewer: hg-reviewers. REVISION SUMMARY Still it is futures-0.1 based. REPOSITORY rHG Mercurial BRANCH default REVISION DETAIL https://phab.mercurial-scm.org/D8358 AFFECTED FILES

D8357: rust-chg: add brief comment about initial capacity of temp_sock_path()

2020-04-02 Thread yuja (Yuya Nishihara)
yuja created this revision. Herald added a subscriber: mercurial-devel. Herald added a reviewer: hg-reviewers. REVISION SUMMARY I don't know if it can be expressed as a compile-time constant, so it's a comment for now. About this series: This is quite old patches for rust-chg. I heard

D8337: pycompat: change argv conversion semantics

2020-03-31 Thread yuja (Yuya Nishihara)
yuja added a comment. > > On Windows, my assumption was os.fsencode() == .encode("mbcs") if > > sys._enablelegacywindowsfsencoding(). So this looks good to me. > > Perhaps, the "ignore" error mode would match the legacy Windows behavior. > Does this mean it could be a problem

D8337: pycompat: change argv conversion semantics

2020-03-29 Thread yuja (Yuya Nishihara)
yuja added a comment. > - # Since Python 3 converts argv to wchar_t type by Py_DecodeLocale() on Unix, > - # we can use os.fsencode() to get back bytes argv. > - # > - # https://hg.python.org/cpython/file/v3.5.1/Programs/python.c#l55 > - # > - # On Windows, the native argv is

D8318: setup: build C extensions with -Werror=declaration-after-statement

2020-03-20 Thread yuja (Yuya Nishihara)
yuja added a comment. > MSVC 2008 still needs declarations at the top of the scope. Can you copy this to the code so we can recall why we enable this weird warning option? > +if os.name != 'nt': > +common_cflags = ['-Werror=declaration-after-statement'] REPOSITORY rHG

D8304: cext: move variable declaration to the top of the block for C89 support

2020-03-20 Thread yuja (Yuya Nishihara)
yuja added a comment. > > -Wdeclaration-after-statement for gcc and maybe clang. > Nice, any idea of how to make it verbosely complaining part of the test-suite ? -Werror=declaration-after-statement will prevent the test from running at all. I think setup.py can be adjusted to

D8304: cext: move variable declaration to the top of the block for C89 support

2020-03-20 Thread yuja (Yuya Nishihara)
yuja added a comment. > Could we enable some kind of warning to catch this in the tests ? -Wdeclaration-after-statement for gcc and maybe clang. REPOSITORY rHG Mercurial CHANGES SINCE LAST ACTION https://phab.mercurial-scm.org/D8304/new/ REVISION DETAIL

D8232: phabricator: add a helper function to convert DREVSPECs to a DREV dict list

2020-03-20 Thread yuja (Yuya Nishihara)
yuja added a comment. >> +def _getdrevs(ui, stack, *specs): >> +"""convert user supplied DREVSPECs into "Differential Revision" dicts >> + >> +See ``hg help phabread`` for how to specify each DREVSPEC. >> +""" >> +if len(*specs) > 0: > > ^^ > > Fixed bad

D8232: phabricator: add a helper function to convert DREVSPECs to a DREV dict list

2020-03-20 Thread yuja (Yuya Nishihara)
yuja added a comment. > +def _getdrevs(ui, stack, *specs): > +"""convert user supplied DREVSPECs into "Differential Revision" dicts > + > +See ``hg help phabread`` for how to specify each DREVSPEC. > +""" > +if len(*specs) > 0: ^^ Fixed bad argument

D8246: hg-core: add a compilation error if trying to compile outside of Linux

2020-03-12 Thread yuja (Yuya Nishihara)
yuja added a comment. > +/// Remove this to see (potential) non-artificial compile failures. MacOS > +/// *should* compile, but fail to compile tests for example as of 2020-03-06 Un-doccommented this to silence build warning. REPOSITORY rHG Mercurial CHANGES SINCE LAST ACTION

D7796: rust-nodemap: input/output primitives

2020-02-14 Thread yuja (Yuya Nishihara)
yuja added a comment. > +) -> (Box + Send>, Vec) { > +let (readonly, vec) = self.into_readonly_and_added(); > +// Prevent running `v`'s destructor so we are in complete control > +// of the allocation. > +let vec = mem::ManuallyDrop::new(vec); > +

D8076: worker: Manually buffer reads from pickle stream

2020-02-07 Thread yuja (Yuya Nishihara)
yuja added a comment. > > Might be better to optimize the common case `wrapped.read(size) == size`. > I thought my code was already pretty optimized: We allocate the buffer to read into just once (no matter how many reads we issue) and give it to the unpickler without copying the

D8076: worker: Manually buffer reads from pickle stream

2020-02-06 Thread yuja (Yuya Nishihara)
yuja added a comment. > +if pycompat.ispy3: > + > +class _blockingreader(object): > +def __init__(self, wrapped): > +self._wrapped = wrapped > + > +def __getattr__(self, attr): > +return getattr(self._wrapped, attr) > + > +#

D8039: chg: force-set LC_CTYPE on server start to actual value from the environment

2020-02-06 Thread yuja (Yuya Nishihara)
yuja added a comment. I like the simplicity of this patch. Queued, thanks. > Computing the hash on the client avoids the restart loop, but doesn't avoid the behavior difference - chg will still call setenv and replace the modified version with the original one. Indeed. REPOSITORY

D8051: worker: Use buffered input from the pickle stream

2020-02-04 Thread yuja (Yuya Nishihara)
yuja added a comment. > for rfd, wfd in pipes: > os.close(wfd) > > - selector.register(os.fdopen(rfd, 'rb', 0), selectors.EVENT_READ) > > +selector.register(os.fdopen(rfd, 'rb'), selectors.EVENT_READ) Using buffered I/O can cause a deadlock (until the worker

D8039: chg: force-set LC_CTYPE on server start to actual value from the environment

2020-01-30 Thread yuja (Yuya Nishihara)
yuja added a comment. > What do you think about this approach: > 1. The server detects that LC_TYPE is coerced. > 2. When handling the "validate" command, the server sends back "invalidate this server, and fallback to original hg" response. > This makes chg/non-chg behave

D8041: revset: add a revset for parents in merge state

2020-01-30 Thread yuja (Yuya Nishihara)
yuja added a comment. > +@predicate(b'conflictparents()', safe=True) > +def parents(repo, subset, x): ^^^ Nit: copy-paste error? REPOSITORY rHG Mercurial CHANGES SINCE LAST ACTION https://phab.mercurial-scm.org/D8041/new/ REVISION DETAIL

D8039: chg: force-set LC_CTYPE on server start to actual value from the environment

2020-01-30 Thread yuja (Yuya Nishihara)
yuja added a comment. > - # Python3 has some logic to "coerce" the C locale to a UTF-8 capable > - # one, and it sets LC_CTYPE in the environment to C.UTF-8 if none of > - # 'LC_CTYPE', 'LC_ALL' or 'LANG' are set (to any value). This can be > - # disabled with PYTHONCOERCECLOCALE=0 in

D8022: chg: pass copies of some envvars so we can detect py37+ modifications

2020-01-30 Thread yuja (Yuya Nishihara)
yuja added a comment. > Getting this implemented "correctly" using daemon_postexec is getting relatively complicated - there's no way to backwards- and forwards-compatibly do this since there's no capabilities mechanism for daemon_postexec. If I blindly do it, it fails when connecting to

D8022: chg: pass copies of some envvars so we can detect py37+ modifications

2020-01-28 Thread yuja (Yuya Nishihara)
yuja added a comment. > This would cause a difference in behavior between hg and chg. I don't know how big of an issue that would be. > hg: starts up, python coerces LC_CTYPE, hg spawns a non-python subprocess, LC_CTYPE is set to the coerced value > chg: starts up, python coerces

D8022: chg: pass copies of some envvars so we can detect py37+ modifications

2020-01-28 Thread yuja (Yuya Nishihara)
yuja added a comment. Another idea. How about sending the true LC_CTYPE value as a command argument so the env mangling can be reverted? 1. spawn `hg serve --cmdserver chgunix ...` with `--daemon-postexec setenv:LC_CTYPE=$LC_CTYPE` 2. `runservice()` overwrites `LC_CTYPE` to the

D8021: chg: switch to using global `environ` instead of envp from main

2020-01-28 Thread yuja (Yuya Nishihara)
yuja added a comment. > { > > if (getenv("CHGDEBUG")) > enabledebugmsg(); > > @@ -429,7 +431,7 @@ > > hgc = connectcmdserver(); > if (!hgc) > abortmsg("cannot open hg client"); > > - hgc_setenv(hgc, envp); >

D7993: merge: use check_incompatible_arguments() for --abort

2020-01-27 Thread yuja (Yuya Nishihara)
yuja added a comment. > +cmdutil.check_incompatible_arguments(opts, b'abort', b'rev', b'preview') It's a bit late, but I feel the arguments of `check_incompatible_arguments()` is confusing since `b'abort'` isn't the same kind of arguments as the others. I think `(opts, b'abort',

D7864: rust-utils: add Rust implementation of Python's "os.path.splitdrive"

2020-01-21 Thread yuja (Yuya Nishihara)
yuja added a comment. So `HgPath` type is no longer intended for "a repository-relative path"? REPOSITORY rHG Mercurial CHANGES SINCE LAST ACTION https://phab.mercurial-scm.org/D7864/new/ REVISION DETAIL https://phab.mercurial-scm.org/D7864 To: Alphare, #hg-reviewers, kevincox,

D7913: cext: fix compiler warning about sign changing

2020-01-17 Thread yuja (Yuya Nishihara)
yuja added a comment. > static PyObject *hashflags(line *l) > { > > char *s = l->start; > > - size_t plen = pathlen(l); > > + Py_ssize_t plen = pathlen(l); We'll probably want to change `hplen` to `Py_ssize_t` as well. REPOSITORY rHG Mercurial CHANGES SINCE LAST

D7903: sha1dc: avoid including the nonexistent stdint.h with Visual Studio 2008

2020-01-16 Thread yuja (Yuya Nishihara)
yuja added a comment. > #ifndef SHA1DC_NO_STANDARD_INCLUDES > +#if !defined(_MSC_VER) || _MSC_VER >= 1600 > #include > +#else > +/* prior to Visual Studio 2010 */ > +typedef unsigned int uint32_t; `unsigned __int32` for consistency. REPOSITORY rHG Mercurial CHANGES SINCE

D7705: phases: make the working directory consistently a draft

2020-01-09 Thread yuja (Yuya Nishihara)
yuja added a comment. > @@ -252,25 +254,44 @@ > > revs = set.union(*[self._phasesets[p] for p in phases]) > if repo.changelog.filteredrevs: > revs = revs - repo.changelog.filteredrevs > > + > > if subset is None: > return smartset.baseset(revs) >

D7543: revlog: made C Capsule an array of function pointers

2020-01-04 Thread yuja (Yuya Nishihara)
yuja added a comment. > A possibility, since we're now on this data + functions capsule would be to introduce an ABI version number in the capsule. > At least, that's the first thing that comes to mind. Yeah, parsers.c:version could be embedded, for example. > If that check

D7543: revlog: made C Capsule an array of function pointers

2020-01-04 Thread yuja (Yuya Nishihara)
yuja added a comment. > +typedef struct { > + int (*index_parents)(PyObject *, int, int *); > +} Revlog_CAPI; Do we have any plan to detect C-Rust ABI mismatch? Renaming the symbol? REPOSITORY rHG Mercurial CHANGES SINCE LAST ACTION https://phab.mercurial-scm.org/D7543/new/

D7685: rebase: use rewriteutil.precheck() instead of reimplementing it

2019-12-18 Thread yuja (Yuya Nishihara)
yuja added a comment. > - hint=_(b'use --keep to keep original changesets'), > - ) > > +if not self.keepf: > +try: > +rewriteutil.precheck(self.repo, rebaseset, action=b'rebase') > +except error.Abort as e: > +if

D7641: rebase: use cmdutil.check_at_most_one_arg() for --confirm/--dry-run

2019-12-18 Thread yuja (Yuya Nishihara)
yuja added a comment. > - a/mercurial/cmdutil.py > > +++ b/mercurial/cmdutil.py > @@ -268,6 +268,7 @@ > > previous = None > for x in args: > if opts.get(x): > > +x = x.replace(b'_', b'-') > > if previous: > raise error.Abort( >

D7641: rebase: use cmdutil.check_at_most_one_arg() for --confirm/--dry-run

2019-12-17 Thread yuja (Yuya Nishihara)
yuja added a comment. >> Spotted in a later patch, need to replace `_` back to `-` before printing output. > > Strings are immutable in Python, so it wasn't actually replaced, right? Or do I misunderstand your concern? Maybe he meant `opts[b'dry_run']` vs `--dry-run`. `*args` should

D7570: match: resolve filesets against the passed `cwd`, not the current one

2019-12-14 Thread yuja (Yuya Nishihara)
yuja added a comment. > In D7570#112206 , @yuja wrote: > Good catch. I don't see the meaning of b'' in this context defined anywhere. But since `subinclude:` uses it to define the matcher, I'm assuming that's all of the adjustment we

D7614: rust-cpython: do not convert warning pattern to utf-8 bytes

2019-12-13 Thread yuja (Yuya Nishihara)
Closed by commit rHGb06cf2809ec3: rust-cpython: do not convert warning pattern to utf-8 bytes (authored by yuja). 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

  1   2   3   4   5   6   7   8   9   10   >