Page MenuHomePhabricator

yuja (Yuya Nishihara)
User

Projects

User Details

User Since
Jun 29 2017, 11:25 AM (143 w, 3 d)

Recent Activity

Yesterday

yuja added a comment to D8337: pycompat: change argv conversion semantics.
  • # 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 unicode and is converted to MBCS bytes
  • # since we do enable the legacy filesystem encoding. if getattr(sys, 'argv', None) is not None:
  • sysargv = list(map(os.fsencode, sys.argv))

+ # On POSIX, the char argv array is converted to Python str using
+ # Py_DecodeLocale(). The inverse of this is Py_EncodeLocale(), which isn't
+ # directly callable from Python code. So, we need to emulate it.
+ # Py_DecodeLocale() calls mbstowcs() and falls back to mbrtowc() with
+ # surrogateescape error handling on failure. These functions take the
+ # current system locale into account. So, the inverse operation is to
+ # .encode() using the system locale's encoding and using the
+ # surrogateescape error handler. The only tricky part here is getting
+ # the system encoding correct, since locale.getlocale() can return
+ # None. We fall back to the filesystem encoding if lookups via locale
+ # fail, as this seems like a reasonable thing to do.
+ #
+ # On Windows, the wchar_t
argv is passed into the interpreter as-is.
+ # Like POSIX, we need to emulate what Py_EncodeLocale() would do. But
+ # there's an additional wrinkle. What we really want to access is the
+ # ANSI codepage representation of the arguments, as this is what
+ # int main() would receive if Python 3 didn't define int wmain()
+ # (this is how Python 2 worked). To get that, we encode with the mbcs
+ # encoding, which will pass CP_ACP to the underlying Windows API to
+ # produce bytes.
+ if os.name == r'nt':
+ sysargv = [a.encode("mbcs", "ignore") for a in sys.argv]

Sun, Mar 29, 6:52 AM

Wed, Mar 25

yuja committed rHG7333e8bb9781: templater: fix cbor() filter to recursively convert smartset to list.
templater: fix cbor() filter to recursively convert smartset to list
Wed, Mar 25, 4:31 PM

Tue, Mar 24

yuja committed rHG7cd5c0968139: templater: add subsetparents(rev, revset) function.
templater: add subsetparents(rev, revset) function
Tue, Mar 24, 7:01 PM
yuja committed rHG1f81f680912f: templater: remember cache key of evaluated revset.
templater: remember cache key of evaluated revset
Tue, Mar 24, 7:01 PM
yuja committed rHGe3e44e6e7245: templater: fix cbor() filter to accept smartset.
templater: fix cbor() filter to accept smartset
Tue, Mar 24, 7:01 PM
yuja committed rHGfc1fa3a07af6: templater: introduce wrapper for smartset (API).
templater: introduce wrapper for smartset (API)
Tue, Mar 24, 7:01 PM
yuja committed rHG090a1a78be4a: merge with stable.
merge with stable
Tue, Mar 24, 8:56 AM

Mon, Mar 23

yuja committed rHG0424a9134bcf: osutil: move declaration to top of the scope.
osutil: move declaration to top of the scope
Mon, Mar 23, 12:06 PM
yuja committed rHGf913ece27ff5: revset: leverage internal _rev() function to implement rev().
revset: leverage internal _rev() function to implement rev()
Mon, Mar 23, 12:06 PM
yuja committed rHG2d63a8910db6: phabricator: remove *-argument from _getdrevs().
phabricator: remove *-argument from _getdrevs()
Mon, Mar 23, 12:06 PM
yuja committed rHG967e2e81f762: revset: fix crash by repo.revs('%d', tip + 1).
revset: fix crash by repo.revs('%d', tip + 1)
Mon, Mar 23, 12:06 PM
yuja committed rHG482a6aac1f15: revset: allow repo.revs('%d', wdirrev).
revset: allow repo.revs('%d', wdirrev)
Mon, Mar 23, 12:06 PM

Sat, Mar 21

yuja added a comment to D8318: setup: build C extensions with -Werror=declaration-after-statement.
MSVC 2008 still needs declarations at the top of the scope.
Sat, Mar 21, 12:55 AM

Fri, Mar 20

yuja added a comment to D8304: cext: move variable declaration to the top of the block for C89 support.
> -Wdeclaration-after-statement for gcc and maybe clang.
Nice, any idea of how to make it verbosely complaining part of the test-suite ?
Fri, Mar 20, 11:18 AM
yuja added a comment to D8304: cext: move variable declaration to the top of the block for C89 support.
Could we enable some kind of warning to catch this in the tests ?
Fri, Mar 20, 10:40 AM
yuja added a comment to D8232: phabricator: add a helper function to convert DREVSPECs to a DREV dict list.

+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 expansion since I had to rebase this. Please let me
know if that's wrong.

Fri, Mar 20, 4:47 AM
yuja committed rHGf8427841c8fc: merge with stable.
merge with stable
Fri, Mar 20, 4:45 AM
yuja added a comment to D8232: phabricator: add a helper function to convert DREVSPECs to a DREV dict list.

+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 expansion since I had to rebase this. Please let me
know if that's wrong.

Fri, Mar 20, 4:37 AM

Thu, Mar 12

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

+/ Remove this to see (potential) non-artificial compile failures. MacOS
+
/ *should* compile, but fail to compile tests for example as of 2020-03-06

Thu, Mar 12, 9:02 AM

Feb 24 2020

yuja committed rHG98c14f0108b8: py3: fix EOL detection in commandserver.channeledinput.
py3: fix EOL detection in commandserver.channeledinput
Feb 24 2020, 12:44 PM

Feb 14 2020

yuja added a comment to D7796: rust-nodemap: input/output primitives.

+ ) -> (Box<dyn Deref<Target = [Block]> + Send>, Vec<u8>) {
+ 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);
+
+ let bytes = unsafe {
+ This is safe because we check at compile-time that there is no
+
padding.
+ // /!\ Any use of vec after this is use-after-free.
+
+ let _: [u8; 4 * BLOCK_SIZE] =
+ std::mem::transmute([Block::new(); 4]);
+ Vec::from_raw_parts(
+ vec.as_ptr() as *mut u8,
+ vec.len() * BLOCK_SIZE,
+ vec.capacity() * BLOCK_SIZE,
+ )

Feb 14 2020, 8:19 AM

Feb 12 2020

yuja committed rHGd52e3826cd4b: pathutil: resurrect comment about path auditing order.
pathutil: resurrect comment about path auditing order
Feb 12 2020, 2:40 PM
yuja committed rHG5cd2d91eeebd: chgserver: spawn new process if schemes change.
chgserver: spawn new process if schemes change
Feb 12 2020, 2:36 PM

Feb 7 2020

yuja added a comment to D8076: worker: Manually buffer reads from pickle stream.
> 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 data.
Feb 7 2020, 10:52 AM

Feb 6 2020

yuja added a comment to D8076: worker: Manually buffer reads from pickle stream.

+if pycompat.ispy3:
+
+ class _blockingreader(object):
+ def init(self, wrapped):
+ self._wrapped = wrapped
+
+ def getattr(self, attr):
+ return getattr(self._wrapped, attr)
+
+ # issue multiple reads until size is fulfilled
+ def read(self, size=-1):
+ if size < 0:
+ return self._wrapped.readall()
+
+ buf = bytearray(size)
+ view = memoryview(buf)
+ pos = 0
+
+ while pos < size:
+ ret = self._wrapped.readinto(view[pos:])
+ if not ret:
+ break
+ pos += ret
+
+ del view
+ del buf[pos:]
+ return buf

Feb 6 2020, 10:11 AM
yuja added a comment to D8039: chg: force-set LC_CTYPE on server start to actual value from the environment.

I like the simplicity of this patch. Queued, thanks.

Feb 6 2020, 9:29 AM

Feb 4 2020

yuja added a comment to D8051: worker: Use buffered input from the pickle stream.
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)

Feb 4 2020, 7:38 AM

Jan 31 2020

yuja committed rHG6b7aef44274b: rust-cpython: remove PySharedRefCell and its companion structs.
rust-cpython: remove PySharedRefCell and its companion structs
Jan 31 2020, 2:21 PM
yuja committed rHGbad4e7b361d2: rust-cpython: switch to upstreamed version of PySharedRefCell.
rust-cpython: switch to upstreamed version of PySharedRefCell
Jan 31 2020, 2:21 PM
yuja committed rHG281642cd1d04: rust-cpython: rename inner_shared() to inner().
rust-cpython: rename inner_shared() to inner()
Jan 31 2020, 2:21 PM
yuja committed rHG06df075b8925: rust-cpython: use PyList.insert() instead of .insert_item().
rust-cpython: use PyList.insert() instead of .insert_item()
Jan 31 2020, 2:21 PM
yuja committed rHG25ed4d8e707f: rust-cpython: bump cpython to 0.4 to switch to upstreamed PySharedRef.
rust-cpython: bump cpython to 0.4 to switch to upstreamed PySharedRef
Jan 31 2020, 2:21 PM
yuja committed rHG3e794419d234: rust: update dependencies.
rust: update dependencies
Jan 31 2020, 2:21 PM
yuja committed rHGe960c30d7e50: rust-cpython: mark all PyLeaked methods as unsafe.
rust-cpython: mark all PyLeaked methods as unsafe
Jan 31 2020, 10:18 AM
yuja committed rHG9804badd5970: rust-cpython: make PySharedRef::try_borrow_mut() return BorrowMutError.
rust-cpython: make PySharedRef::try_borrow_mut() return BorrowMutError
Jan 31 2020, 10:18 AM
yuja committed rHGbafdaf4858d8: rust-cpython: inline PySharedState::try_borrow_mut().
rust-cpython: inline PySharedState::try_borrow_mut()
Jan 31 2020, 10:18 AM
yuja committed rHGf015d679f08c: rust-cpython: inline PySharedState::leak_immutable() and PyLeaked::new().
rust-cpython: inline PySharedState::leak_immutable() and PyLeaked::new()
Jan 31 2020, 10:18 AM
yuja committed rHG2a24ead003f0: rust-cpython: add panicking version of borrow_mut() and use it.
rust-cpython: add panicking version of borrow_mut() and use it
Jan 31 2020, 10:18 AM

Jan 30 2020

yuja added a comment to D8039: chg: force-set LC_CTYPE on server start to actual value from the environment.
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 consistently with some startup overhead in mis-configured environment. The chg client can potentially print a warning to remind the user to fix their environment.
Jan 30 2020, 12:02 PM
yuja added a comment to D8041: revset: add a revset for parents in merge state.

+@predicate(b'conflictparents()', safe=True)
+def parents(repo, subset, x):

^^^^^^^

Nit: copy-paste error?

Jan 30 2020, 10:25 AM
yuja added a comment to D8039: chg: force-set LC_CTYPE on server start to actual value from the environment.
  • # 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 the environment.
  • #
  • # When fromui is called via _inithashstate, python has already set
  • # this, so that's in the environment right when we start up the hg
  • # process. Then chg will call us and tell us to set the environment to
  • # the one it has; this might NOT have LC_CTYPE, so we'll need to
  • # carry-forward the LC_CTYPE that was coerced in these situations.
  • #
  • # If this is not handled, we will fail config+env validation and fail
  • # to start chg. If this is just ignored instead of carried forward, we
  • # may have different behavior between chg and non-chg.
Jan 30 2020, 10:05 AM
yuja added a comment to D8022: chg: pass copies of some envvars so we can detect py37+ modifications.
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 an older hg saying it doesn't know how to do handle that command.
Jan 30 2020, 9:41 AM

Jan 29 2020

yuja committed rHG71457ff69c2f: rust-cpython: mark all PyLeaked methods as unsafe.
rust-cpython: mark all PyLeaked methods as unsafe
Jan 29 2020, 6:59 PM
yuja committed rHGb556400bee95: rust-cpython: make PySharedRef::try_borrow_mut() return BorrowMutError.
rust-cpython: make PySharedRef::try_borrow_mut() return BorrowMutError
Jan 29 2020, 6:59 PM
yuja committed rHG22d39bb6d777: rust-cpython: inline PySharedState::leak_immutable() and PyLeaked::new().
rust-cpython: inline PySharedState::leak_immutable() and PyLeaked::new()
Jan 29 2020, 6:59 PM
yuja committed rHG0ca7018c6531: rust-cpython: inline PySharedState::try_borrow_mut().
rust-cpython: inline PySharedState::try_borrow_mut()
Jan 29 2020, 6:59 PM
yuja committed rHGcacdc766825d: rust-cpython: add panicking version of borrow_mut() and use it.
rust-cpython: add panicking version of borrow_mut() and use it
Jan 29 2020, 6:59 PM

Jan 28 2020

yuja committed rHG4a4c3b9fd91b: rust-cpython: make sure PySharedRef::borrow_mut() never panics.
rust-cpython: make sure PySharedRef::borrow_mut() never panics
Jan 28 2020, 8:33 PM
yuja committed rHG1f9e6fbdd3e6: rust-cpython: remove useless wrappers from PyLeaked, just move by map().
rust-cpython: remove useless wrappers from PyLeaked, just move by map()
Jan 28 2020, 8:33 PM
yuja added a comment to D8022: chg: pass copies of some envvars so we can detect py37+ modifications.
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 LC_CTYPE, chg fixes it, hg spawns a non-python subprocess, LC_CTYPE is set to the original value (or unset).
Jan 28 2020, 7:31 PM
yuja added a comment to D8022: chg: pass copies of some envvars so we can detect py37+ modifications.

Another idea. How about sending the true LC_CTYPE value as a command
argument so the env mangling can be reverted?

Jan 28 2020, 11:10 AM
yuja added a comment to D8021: chg: switch to using global `environ` instead of envp from main.

{

	if (getenv("CHGDEBUG"))
		enabledebugmsg();

@@ -429,7 +431,7 @@

		hgc = connectcmdserver(&opts);
		if (!hgc)
			abortmsg("cannot open hg client");
  • hgc_setenv(hgc, envp);

+ hgc_setenv(hgc);

Jan 28 2020, 11:10 AM

Jan 27 2020

yuja added a comment to D7993: merge: use check_incompatible_arguments() for --abort.

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', [b'rev', b'preview']) is more explicit.

Jan 27 2020, 5:32 AM

Jan 21 2020

yuja added a comment to D7864: rust-utils: add Rust implementation of Python's "os.path.splitdrive".

So HgPath type is no longer intended for "a repository-relative path"?

Jan 21 2020, 9:41 AM

Jan 17 2020

yuja added a comment to D7913: cext: fix compiler warning about sign changing.

static PyObject *hashflags(line *l)
{

	char *s = l->start;
  • size_t plen = pathlen(l);

+ Py_ssize_t plen = pathlen(l);

Jan 17 2020, 7:14 AM

Jan 16 2020

yuja added a comment to D7903: sha1dc: avoid including the nonexistent stdint.h with Visual Studio 2008.

#ifndef SHA1DC_NO_STANDARD_INCLUDES
+#if !defined(_MSC_VER) || _MSC_VER >= 1600
#include <stdint.h>
+#else
+/* prior to Visual Studio 2010 */
+typedef unsigned int uint32_t;

Jan 16 2020, 10:08 AM

Jan 9 2020

yuja added a comment to D7705: phases: make the working directory consistently a draft.

@@ -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)
else:

+ if wdirrev in subset and repo[None].phase() in phases:
+ # The working dir would never be in the cache, but it was
+ # in the subset being filtered for its phase, so add it to
+ # the output.
+ revs.add(wdirrev)

Jan 9 2020, 8:54 AM

Jan 4 2020

yuja added a comment to D7543: revlog: made C Capsule an array of function pointers.
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.
Jan 4 2020, 8:04 AM
yuja added a comment to D7543: revlog: made C Capsule an array of function pointers.

+typedef struct {
+ int (*index_parents)(PyObject *, int, int *);
+} Revlog_CAPI;

Jan 4 2020, 4:35 AM

Dec 18 2019

yuja added a comment to D7685: rebase: use rewriteutil.precheck() instead of reimplementing it.
  • 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 e.hint is None:
+ e.hint = b'use --keep to keep original changesets'

Dec 18 2019, 10:11 AM
yuja added a comment to D7641: rebase: use cmdutil.check_at_most_one_arg() for --confirm/--dry-run.
  • 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(
        _(b'cannot specify both --%s and --%s') % (previous, x)
Dec 18 2019, 7:53 AM

Dec 17 2019

yuja added a comment to D7641: rebase: use cmdutil.check_at_most_one_arg() for --confirm/--dry-run.

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?

Dec 17 2019, 10:32 AM

Dec 14 2019

yuja added a comment to D7570: match: resolve filesets against the passed `cwd`, not the current one.
In D7570#112206 <https://phab.mercurial-scm.org/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 need?
Dec 14 2019, 4:28 AM

Dec 13 2019

yuja closed D7614: rust-cpython: do not convert warning pattern to utf-8 bytes.
Dec 13 2019, 1:18 PM
yuja closed D7613: rust-cpython: import utils::files::* function at module level.
Dec 13 2019, 1:18 PM
yuja committed rHGb06cf2809ec3: rust-cpython: do not convert warning pattern to utf-8 bytes.
rust-cpython: do not convert warning pattern to utf-8 bytes
Dec 13 2019, 1:17 PM
yuja committed rHG4f1cddd1939e: rust-cpython: import utils::files::* function at module level.
rust-cpython: import utils::files::* function at module level
Dec 13 2019, 1:17 PM

Dec 12 2019

yuja added a comment to D7570: match: resolve filesets against the passed `cwd`, not the current one.
> In D7570#111892 <https://phab.mercurial-scm.org/D7570#111892>, @durin42 wrote:
>
>> I'm happy with this, but didn't spend time figuring out if all concerns have been addressed (I'm mostly doing a fast triage path).
>
> I *think* they're addressed, but we there's no rush to get this in so let's give Yuya a chance to comment, because I'm not sure if the issue with subrepos is an existing or new issue.
@yuja, what do you think?
Dec 12 2019, 7:20 PM
yuja added a comment to D7550: chg: fix chg to work with py3.7+ "coercing" the locale.
> Sigh. Can we work around this weird behavior by making chg do
> `putenv("PYTHONCOERCECLOCALE=0")`? I think it's simple and more desired
> behavior than the default of Python 3.
I had considered that and was concerned it would create an observable, surprising/confusing difference between chg and non-chg: if chg sets PYTHONCOERCECLOCALE=0, hg won't have LC_CTYPE in the environment, and it WILL have PYTHONCOERCECLOCALE in the environment. When it starts external tools (like merge tools), this may change behavior in some observable fashion, and if the user stops using chg and uses just plain hg, it will have LC_CTYPE in the environment.
Dec 12 2019, 9:07 AM

Dec 6 2019

yuja added a comment to D7570: match: resolve filesets against the passed `cwd`, not the current one.
if listsubrepos:
    for subpath in ctx.substate:
  • sm = ctx.sub(subpath).matchfileset(pat, badfn=badfn)

+ sm = ctx.sub(subpath).matchfileset(
+ pat, badfn=badfn, cwd=cwd
+ )

Dec 6 2019, 11:56 PM
yuja added a comment to D7550: chg: fix chg to work with py3.7+ "coercing" the locale.
When the environment is empty (specifically: it doesn't contain LC_ALL,
LC_CTYPE, or LANG), Python will "coerce" the locale environment variables to be
a UTF-8 capable one. It sets LC_CTYPE in the environment, and this breaks chg,
since chg operates by:
- start hg, using whatever environment the user has when chg starts
- hg stores a hash of this "original" environment, but python has already set LC_CTYPE even though the user doesn't have it in their environment
- chg calls setenv over the commandserver. This clears the environment inside of hg and sets it to be exactly what the environment in chg is (without LC_CTYPE).
- chg calls validate to ensure that the environment hg is using (after the setenv call) is the one that the chg process has - if not, it is assumed the user changed their environment and we should use a different server. This will *never* be true in this situation because LC_CTYPE was removed.
Dec 6 2019, 10:57 PM

Dec 3 2019

yuja committed rHGb5f183eedd98: status: fix default value of status struct.
status: fix default value of status struct
Dec 3 2019, 10:59 AM
yuja committed rHGfaa8a59f4a06: graphlog: change state dict to attr struct.
graphlog: change state dict to attr struct
Dec 3 2019, 10:59 AM
yuja committed rHG064c9a4ced4a: typing: fix return type of logcmdutil.getrevs().
typing: fix return type of logcmdutil.getrevs()
Dec 3 2019, 10:59 AM
yuja committed rHGf79377f24487: rust-cpython: import utils::files::* function at module level.
rust-cpython: import utils::files::* function at module level
Dec 3 2019, 10:59 AM
yuja committed rHGee3872c14ab3: rust-cpython: do not convert warning pattern to utf-8 bytes.
rust-cpython: do not convert warning pattern to utf-8 bytes
Dec 3 2019, 10:59 AM
yuja committed rHG7b14d649af1b: typing: consolidate "if not globals():" trick.
typing: consolidate "if not globals():" trick
Dec 3 2019, 10:59 AM
yuja added a comment to D7542: mail: don't complain about a multi-word email.method.

+ command = procutil.shellsplit(method)
+ if not (command and procutil.findexe(command[0])):

Dec 3 2019, 7:56 AM

Nov 29 2019

yuja added a comment to D7503: rust-dirs: address failing tests for `dirs` impl with a temporary fix.
I am fine with not having all test passing from the start. However here we have a test that used to pass that is now failing, so we regressed here. I would rather not regress in test coverage here. Without this, all mercurial test pass with the Rust code, I would like to keep it that way.
Nov 29 2019, 10:15 AM
yuja added a comment to D7503: rust-dirs: address failing tests for `dirs` impl with a temporary fix.
>>   > Okay, then using non-debug `assert!()` seems more appropriate. If we prefer
>>   > being stricter, "checked" HgPath type can be introduced.
>>   > ...
>>   > Actually I tried to suppress these warnings by propagating Result upwards,
>>   > and I got a feeling that we're doing wrong.
>>   I sent a followup as D7522 <https://phab.mercurial-scm.org/D7522> because that gets rid of the warnings. As explained in the commit message, I am unhappy about this change, as you seem to be.
>
> Thanks. Given Rust impl is still unstable, I think it's better to back out
> the changes in Rust and leave the test failure until we find a right solution.
I am -1 for this. Having the test broken is a big overhead for people actually using Rust and testing it. The rust support is experimental but not "unstable". We use it in production in a couple of places. Keeping the test suite
Nov 29 2019, 9:57 AM

Nov 28 2019

yuja added a comment to D7503: rust-dirs: address failing tests for `dirs` impl with a temporary fix.
> Okay, then using non-debug `assert!()` seems more appropriate. If we prefer
> being stricter, "checked" HgPath type can be introduced.
> ...
> Actually I tried to suppress these warnings by propagating Result upwards,
> and I got a feeling that we're doing wrong.
I sent a followup as D7522 <https://phab.mercurial-scm.org/D7522> because that gets rid of the warnings. As explained in the commit message, I am unhappy about this change, as you seem to be.
Nov 28 2019, 8:14 AM

Nov 27 2019

yuja added a comment to D7503: rust-dirs: address failing tests for `dirs` impl with a temporary fix.
> I generally prefer adding safety checks at ABI boundary. If malicious input
> makes Rust code crash or exhaust CPU/memory resource, I would add sanity
> check to rust-cpython layer.
Sure, that makes sense in our configuration, but we need to consider `hg-core` as its own standalone library when making decisions like this.
Nov 27 2019, 8:30 AM

Nov 26 2019

yuja added a comment to D7512: exchange: guard against method invocation on `b2caps=None` args.
>>   """add a changegroup part to the requested bundle"""
>>
>> - if not kwargs.get('cg', True):
>>
>> +    if not kwargs.get('cg', True) or not b2caps:
>>
>>   return
>
> Is it valid to call these functions with `b2caps=None`? I suspect it would
> be a bug or a data corruption.
The only caller I can find[1] will indeed pass something, even if it is `{}`.  I can change these to asserts if you want.
[1] https://www.mercurial-scm.org/repo/hg/file/tip/mercurial/exchange.py#l2448
Nov 26 2019, 8:09 AM

Nov 25 2019

yuja committed rHG7d237fd3b207: status: fix default value of status struct.
status: fix default value of status struct
Nov 25 2019, 10:28 AM
yuja committed rHGe006f09e77de: graphlog: change state dict to attr struct.
graphlog: change state dict to attr struct
Nov 25 2019, 10:28 AM
yuja committed rHG47b8ca03c518: typing: consolidate "if not globals():" trick.
typing: consolidate "if not globals():" trick
Nov 25 2019, 10:28 AM
yuja committed rHGf892089b19a0: typing: fix return type of logcmdutil.getrevs().
typing: fix return type of logcmdutil.getrevs()
Nov 25 2019, 10:28 AM
yuja committed rHG3078f9a48546: rust-cpython: do not convert warning pattern to utf-8 bytes.
rust-cpython: do not convert warning pattern to utf-8 bytes
Nov 25 2019, 10:28 AM
yuja committed rHGba95d137deb6: rust-cpython: import utils::files::* function at module level.
rust-cpython: import utils::files::* function at module level
Nov 25 2019, 10:28 AM
yuja added a comment to D7503: rust-dirs: address failing tests for `dirs` impl with a temporary fix.
> Might be better to do `path.check_state()` in cpython layer, and insert
> `debug_assert` to hg-core.
That would be cleaner for the current purposes, but using `debug_assert` in `hg-core` indicates to me that we want the Rust code to not worry about checking for consecutive slashes in `dirs`, because we would have the `pathauditor`. Am I correct?
Nov 25 2019, 8:47 AM

Nov 24 2019

yuja added a comment to D7516: webutil: add missing argument to join().
It could be, since I didn’t see any callers either (but wasn’t sure if there was templater magic in play here).  It also might be a WIP, given the comment in `join()`.  @yuja?
Nov 24 2019, 10:07 AM
yuja added a comment to D7512: exchange: guard against method invocation on `b2caps=None` args.
"""add a changegroup part to the requested bundle"""
  • if not kwargs.get('cg', True):

+ if not kwargs.get('cg', True) or not b2caps:

return
Nov 24 2019, 12:16 AM
yuja added a comment to D7511: exchange: eliminate some bytes.format() calls.
if invalid_includes:
    raise error.Abort(
  • _(b"The following includes are not accessible for {}: {}").format(
  • username, invalid_includes
  • )

+ _(b"The following includes are not accessible for %s: %s")
+ % (username, invalid_includes)

Nov 24 2019, 12:16 AM

Nov 23 2019

yuja added a comment to D7481: localrepo: recognize trivial "null" queries in `anyrev`.

+ if specs == [b'null']:
+ return revset.baseset([nullrev])

Nov 23 2019, 11:57 PM
yuja added a comment to D7503: rust-dirs: address failing tests for `dirs` impl with a temporary fix.

Many unhandled results:

Nov 23 2019, 1:13 AM

Nov 22 2019

yuja committed rHG7eb701e355bd: merge with stable.
merge with stable
Nov 22 2019, 7:52 AM

Nov 16 2019

yuja committed rHGda925257a39e: typing: add pseudo localstr.__init__() to help pytype.
typing: add pseudo localstr.__init__() to help pytype
Nov 16 2019, 2:46 PM
yuja committed rHG009c115eba95: typing: fix argument type of encoding.localstr().
typing: fix argument type of encoding.localstr()
Nov 16 2019, 2:46 PM
yuja committed rHG7f51bc36194d: typing: suppress error of py2 encoding.strtolocal() and .strfromlocal().
typing: suppress error of py2 encoding.strtolocal() and .strfromlocal()
Nov 16 2019, 2:46 PM
yuja committed rHG83a349aaeba3: typing: constrain argument/return types of encoding.toutf8b().
typing: constrain argument/return types of encoding.toutf8b()
Nov 16 2019, 2:46 PM