Page MenuHomePhabricator
Feed Advanced Search

Yesterday

yuja added a comment to D6641: py3: source-transform only call-sites of iteritems(), not definitions.
  • a/mercurial/__init__.py

+++ b/mercurial/__init__.py
@@ -225,7 +225,9 @@

    1. It changes iteritems/values to items/values as they are not
    2. present in Python 3 world.
  • elif fn in ('iteritems', 'itervalues'):

+ elif (fn in ('iteritems', 'itervalues') and
+ not (tokens[i - 1].type == token.NAME and
+ tokens[i - 1].string == 'def')):

Mon, Jul 15, 7:39 PM

Thu, Jul 11

yuja added a comment to D6604: copies: follow copies across merge base without source file (issue6163).
We trace copies from the 'modify x' commit to commit 4 by going via
the merge base (commit 0). When tracing file 'y' (_tracefile()) in the
first case, we immediately find the rename from 'x'. We check to see
if 'x' exists in the merge base, which it does, so we consider it a
valid copy. In the second case, 'x' does not exist in the merge base,
so it's not considered a valid copy. As a workaround, this patch makes
it so we also attempt the check in mergecopies's base commit (commit 1
in the second case). That feels pretty ugly to me, but I don't have
any better ideas.
Thu, Jul 11, 8:15 PM

Wed, Jul 10

yuja committed rHGcad3dde7a573: rust-dirstate: add helper to iterate ancestor paths.
rust-dirstate: add helper to iterate ancestor paths
Wed, Jul 10, 9:30 AM

Tue, Jul 9

yuja added a comment to D6616: extdata: avoid crashing inside subprocess when we get a revset parse error.
if proc:
  • proc.communicate()

+ try:
+ proc.communicate()
+ except ValueError:
+ # This happens if we started iterating src and then
+ # get a parse error on a line. It should be safe to ignore.
+ pass

Tue, Jul 9, 8:18 PM
yuja added a comment to D6556: cleanup: use named constants for second arg to .seek().

@@ -16,6 +16,7 @@
import collections
import contextlib
import errno
+import io
import os
import struct
import zlib
@@ -2306,7 +2307,7 @@

try:
    with self._datafp() as f:
  • f.seek(0, 2)

+ f.seek(0, io.SEEK_END)

Tue, Jul 9, 8:10 PM

Mon, Jul 8

yuja added a comment to D6594: [ABANDONED] RFC dirstatemap.
> I heard boxing a PyObject has measurable cost,
Do you have a link to any benchmarks? I'd be interested.
Mon, Jul 8, 10:16 AM

Sun, Jul 7

yuja added a comment to D6594: [ABANDONED] RFC dirstatemap.

sharing references between Rust and Python:
https://raphaelgomes.dev/blog/articles/2019-07-01-sharing-references-between-python-and-rust.html.

Sun, Jul 7, 9:52 AM

Fri, Jul 5

yuja added a comment to D6593: rust-minor-fixes: remove Deref in favor of explicit methods.
Using `keys()` will change the behavior, as I actually need to expose an `Iter<Vec<u8>, u32>`. Is your issue with the naming?
Fri, Jul 5, 10:23 AM
yuja added a comment to D6593: rust-minor-fixes: remove Deref in favor of explicit methods.

+ pub fn contains_key(&self, key: &[u8]) -> bool {
+ self.inner.contains_key(key)
+ }
+
+ pub fn iter(&self) -> Iter<Vec<u8>, u32> {
+ self.inner.iter()
+ }

Fri, Jul 5, 8:51 AM

Thu, Jul 4

yuja added a comment to D6593: rust-minor-fixes: remove Deref in favor of explicit methods.

impl DirsMultiset {

/// Initializes the multiset from a dirstate or a manifest.
///

@@ -132,6 +123,22 @@

    Ok(())
}

+
+ pub fn contains_key(&self, key: &[u8]) -> bool {
+ self.inner.contains_key(key)
+ }
+
+ pub fn iter(&self) -> Iter<Vec<u8>, u32> {
+ self.inner.iter()
+ }
+
+ pub fn len(&self) -> usize {
+ self.inner.len()
+ }
+
+ pub fn get(&self, key: &[u8]) -> Option<&u32> {
+ self.inner.get(key)
+ }

Thu, Jul 4, 8:13 PM
yuja added a comment to D6394: rust-dirstate: add "dirs" rust-cpython binding.
To my eyes, the point of `Deref` is to make the `struct` act as a "fat pointer" from the outer interface code, but maybe this does not really help that much?
Thu, Jul 4, 10:48 AM

Sun, Jun 30

yuja committed rHG904e0da2e195: merge with stable.
merge with stable
Sun, Jun 30, 2:23 AM
yuja added a comment to D6553: shelve: move shelve extension to core.

Need to update extensions._builtin so the shelve "extension" is silently
ignored.

Sun, Jun 30, 12:07 AM

Sat, Jun 29

yuja added a comment to D6395: rust-dirstate: call new "dirs" rust implementation from Python.
  • a/rust/hg-core/src/dirstate/dirs_multiset.rs

+++ b/rust/hg-core/src/dirstate/dirs_multiset.rs
@@ -118,7 +118,9 @@

    entry.remove();
}
Entry::Vacant(_) => {
  • return Err(DirstateMapError::PathNotFound(path.to_owned()))

+ return Err(DirstateMapError::PathNotFound(
+ path.to_owned(),
+ ))

    }
};
Sat, Jun 29, 11:41 PM
yuja added a comment to D6394: rust-dirstate: add "dirs" rust-cpython binding.

+ def contains(&self, item: PyObject) -> PyResult<bool> {
+ Ok(self
+ .dirs_map(py)
+ .borrow()
+ .get(&item.extract::<PyBytes>(py)?.data(py).to_owned())
+ .is_some())

Sat, Jun 29, 11:41 PM
yuja added a comment to D6393: rust-dirstate: add "dirs" Rust implementation.

+impl DirsMultiset {
+ / Initializes the multiset from a dirstate or a manifest.
+
/
+ / If skip_state is provided, skips dirstate entries with equal state.
+ pub fn new(iterable: DirsIterable, skip_state: Option<i8>) -> Self {
+ let mut multiset = DirsMultiset {
+ inner: HashMap::new(),
+ };
+
+ match iterable {
+ DirsIterable::Dirstate(vec) => {
+ for (ref filename, DirstateEntry { state, .. }) in vec {
+
This if is optimized out of the loop
+ if let Some(skip) = skip_state {
+ if skip != state {
+ multiset.add_path(filename);
+ }
+ } else {
+ multiset.add_path(filename);
+ }
+ }
+ }
+ DirsIterable::Manifest(vec) => {
+ for ref filename in vec {
+ multiset.add_path(filename);
+ }
+ }
+ }
+
+ multiset
+ }

Sat, Jun 29, 11:40 PM

Tue, Jun 25

yuja added a comment to D6561: copies: simplify merging of copy dicts on merge commits.
while work:
  • r, i1, copies1 = heapq.heappop(work)

+ r, i1, copies = heapq.heappop(work)

if work and work[0][0] == r:
    # We are tracing copies from both parents
    r, i2, copies2 = heapq.heappop(work)
  • copies = {}
  • allcopies = set(copies1) | set(copies2)
  • for dst in allcopies:

+ for dst, src in copies2.items():

    1. Unlike when copies are stored in the filelog, we consider
    2. it a copy even if the destination already existed on the
    3. other branch. It's simply too expensive to check if the
    4. file existed in the manifest.
  • if dst in copies1:
  • # If it was copied on the p1 side, mark it as copied from

+ if dst not in copies:
+ # If it was copied on the p1 side, leave it as copied from

    1. that side, even if it was also copied on the p2 side.
  • copies[dst] = copies1[dst]
  • else: copies[dst] = copies2[dst]
Tue, Jun 25, 7:28 PM

Mon, Jun 17

yuja committed rHGa4a468b00d44: rust-filepatterns: silence warning of non_upper_case_globals.
rust-filepatterns: silence warning of non_upper_case_globals
Mon, Jun 17, 1:30 PM
yuja committed rHGf305f1d7d559: rust-filepatterns: add comment about Windows path handling.
rust-filepatterns: add comment about Windows path handling
Mon, Jun 17, 1:30 PM
yuja committed rHGcc4db4478467: rust: update Cargo.lock to include @generated comment.
rust: update Cargo.lock to include @generated comment
Mon, Jun 17, 1:30 PM
yuja committed rHGb6387a65851d: cborutil: fix streamencode() to handle subtypes.
cborutil: fix streamencode() to handle subtypes
Mon, Jun 17, 1:30 PM

Jun 11 2019

yuja committed rHGd279e4f453c4: revset: use nullrev constant in merge().
revset: use nullrev constant in merge()
Jun 11 2019, 10:11 AM
yuja committed rHG43c8f72184f4: revset: fix merge() to fall back to changectx API if wdir specified.
revset: fix merge() to fall back to changectx API if wdir specified
Jun 11 2019, 10:11 AM

Jun 8 2019

yuja added a comment to D6499: phabricator: make `hg debugcallconduit` work outside a hg repo.

-@vcrcommand(b'debugcallconduit', [], _(b'METHOD'))
-def debugcallconduit(ui, repo, name):
+@vcrcommand(b'debugcallconduit', [], _(b'METHOD'), norepo=True)
+def debugcallconduit(ui, name):

Jun 8 2019, 9:51 PM

Jun 6 2019

yuja added a comment to D6389: rust-dirstate: create dirstate submodule.

Amended this to reproduce the copy history. No content change.

Jun 6 2019, 7:26 PM

Jun 5 2019

yuja committed rHG69883775b27d: root: add template variables pointing to repository directories.
root: add template variables pointing to repository directories
Jun 5 2019, 8:26 AM
yuja committed rHG9803323048b6: root: add support for -Tformatter option.
root: add support for -Tformatter option
Jun 5 2019, 8:26 AM

May 28 2019

yuja added a comment to D6417: context: get filesadded() and filesremoved() from changeset if configured.
> I can't really comment on the storage format. I'm not keen on using extras
>  for this kind of stuff (including copies), but that seems be okay for
>  experiment.
Do we have a better place for it?
May 28 2019, 7:44 PM

May 26 2019

yuja added a comment to D6369: templatekw: make {file_*} compare to both merge parents (issue4292).

Test failures:

May 26 2019, 7:31 PM
yuja updated subscribers of D6417: context: get filesadded() and filesremoved() from changeset if configured.

I can't really comment on the storage format. I'm not keen on using extras
for this kind of stuff (including copies), but that seems be okay for
experiment.

May 26 2019, 7:31 PM

May 24 2019

yuja added a comment to D6432: match: de-flake test-doctest.py by not depending on util.dirs() order.
> > @@ -1384,26 +1384,26 @@
> > 
> >   >>> _rootsdirsandparents(
> >   ...     [(b'glob', b'g/h/*', b''), (b'glob', b'g/h', b''),
> >   ...      (b'glob', b'g*', b'')])
> > 
> > - (['g/h', 'g/h', ''], [], ['', 'g']) +    (['g/h', 'g/h', ''], [], set(['', 'g']))
>
> Perhaps, this would break py3 doctests. The repr syntax changed.
Good point. However, it turns out they were already broken (b'' prefixes), so I'll leave it for the py3 folks to clean up.
May 24 2019, 8:28 AM

May 22 2019

yuja added a comment to D6432: match: de-flake test-doctest.py by not depending on util.dirs() order.

Perhaps, this would break py3 doctests. The repr syntax changed.

May 22 2019, 7:26 PM

May 20 2019

yuja committed rHGde65ae32b82d: templatekw: change default value of 'requires' to ().
templatekw: change default value of 'requires' to ()
May 20 2019, 11:48 AM

May 17 2019

yuja added a comment to D6397: rust-python3: compatibility fix for incoming PyLong.

@@ -153,7 +153,7 @@

&dirstate_vec?,
&copies?,
DirstateParents { p1, p2 },
  • now.value(py) as i32,

+ now.into_object().extract::<i32>(py)?,

May 17 2019, 11:25 PM

May 16 2019

yuja committed rHGb162229ebe0d: log: flag topo-sorted set as such.
log: flag topo-sorted set as such
May 16 2019, 11:39 AM
yuja committed rHGa5d9096b3f84: log: flag topo-sorted set as such.
log: flag topo-sorted set as such
May 16 2019, 7:58 AM

May 14 2019

yuja added a comment to D6331: log: add config for making `hg log -G` always topo-sorted.

+def _maybetoposort(repo, revs, opts):
+ if opts.get('graph') and repo.ui.configbool('experimental', 'log.topo'):
+ revs = dagop.toposort(revs, repo.changelog.parentrevs)
+ # TODO: try to iterate the set lazily
+ revs = revset.baseset(list(revs))
+ return revs
+
def getrevs(repo, pats, opts):

"""Return (revs, differ) where revs is a smartset

@@ -727,7 +734,7 @@

limit = getlimit(opts)
revs = _initialrevs(repo, opts)
if not revs:
  • return smartset.baseset(), None

+ return _maybetoposort(repo, smartset.baseset(), opts), None

May 14 2019, 8:35 AM

May 11 2019

yuja added a comment to D6369: templatekw: make {file_*} compare to both merge parents (issue4292).
This redefines the template keywords by getting the lists from the
recently introduced context methods instead of getting them from
status compared to p1. A mentioned before, these are better defined on
merge commits. The total number of files from the three lists now
always add up to the number of files in {files}.
May 11 2019, 11:07 PM
yuja added a comment to D6367: context: add ctx.files{modified,added,removed}() methods.

+ def modified(self):
+ modified = set(self.files())
+ modified.difference_update(self.added())
+ modified.difference_update(self.removed())
+ return sorted(modified)
+ def added(self):
+ added = []
+ for f in self.files():
+ if not any(f in p for p in self.parents()):
+ added.append(f)
+ return added
+ def removed(self):
+ removed = []
+ for f in self.files():
+ if f not in self:
+ removed.append(f)
+ return removed

May 11 2019, 11:07 PM

May 8 2019

yuja committed rHG6bc1245cd598: revset: populate wdir() by its hash or revision number.
revset: populate wdir() by its hash or revision number
May 8 2019, 6:09 PM
yuja committed rHGa0c5e06e9b1a: revset: extract private constant of {nullrev, wdirrev} set.
revset: extract private constant of {nullrev, wdirrev} set
May 8 2019, 6:09 PM
yuja committed rHG96bc1ef4a302: help: suggest merge() revset instead of -m/--only-merges.
help: suggest merge() revset instead of -m/--only-merges
May 8 2019, 6:09 PM

May 3 2019

yuja committed rHG29798c9ba5c9: parser: fix crash by parsing "()" in keyword argument position.
parser: fix crash by parsing "()" in keyword argument position
May 3 2019, 12:29 PM

Apr 28 2019

yuja added a comment to D6312: branchcache: update the filteredhash if we update the tiprev.
if ntiprev > self.tiprev:
    self.tiprev = ntiprev
    self.tipnode = cl.node(ntiprev)

+ self.filteredhash = scmutil.filteredhash(repo, self.tiprev)

if not self.validfor(repo):
    # cache key are not valid anymore
Apr 28 2019, 4:38 AM

Apr 21 2019

yuja added a comment to D6290: branchcache: don't verify all nodes while writing.
However before this patch, writing the branchmap was validating all the nodes
whereas it should not. This patch fixes that.
Apr 21 2019, 5:47 AM

Apr 18 2019

yuja added a comment to D6232: rust-discovery: cpython bindings for the core logic.

+ def addinfo(&self, sample: PyObject) -> PyResult<PyObject> {
+ let mut missing: Vec<Revision> = Vec::new();
+ let mut common: Vec<Revision> = Vec::new();
+ for info in sample.iter(py)? { // info is a pair (Revision, bool)
+ let mut revknown = info?.iter(py)?;
+ let rev: Revision = revknown.next().unwrap()?.extract(py)?;
+ let known: bool = revknown.next().unwrap()?.extract(py)?;

Apr 18 2019, 7:22 PM

Apr 17 2019

yuja added a comment to D6233: rust-discovery: implementing and exposing stats().

Can't apply by :D6233. Can you rebase?

Apr 17 2019, 7:29 PM

Apr 16 2019

yuja added a comment to D6238: branchcache: don't verify while creating a copy.
def copy(self):
    """return an deep copy of the branchcache object"""
  • self._verifyall() return type(self)( self._entries, self.tipnode, self.tiprev, self.filteredhash, self._closednodes)
Apr 16 2019, 7:08 PM
yuja added a comment to D6207: branchcache: add functions to validate changelog nodes.
The motivation behind iteritems() change (https://phab.mercurial-scm.org/D6236) is optimizing https://www.mercurial-scm.org/repo/hg-committed/file/70b71421fd33/mercurial/commands.py#l1128.
Apr 16 2019, 7:08 PM

Apr 15 2019

yuja added a comment to D6207: branchcache: add functions to validate changelog nodes.

+ def _verifybranch(self, branch):
+ """ verify head nodes for the given branch. If branch is None, verify
+ for all the branches """

Apr 15 2019, 7:16 PM
yuja added a comment to D6208: branchcache: lazily validate nodes from the branchmap.
def copy(self):
    """return an deep copy of the branchcache object"""

+ self._verifyall()

return type(self)(
    self._entries, self.tipnode, self.tiprev, self.filteredhash,
    self._closednodes)
Apr 15 2019, 7:16 PM

Apr 14 2019

yuja added a comment to D6183: copies: add config option for writing copy metadata to file and/or changset.
> >   >  extras field. Almost all extras data are texts, and IIRC we regret that
> >   >  transplant sources are stored in binary form.
> >   
> >   Why not? I picked \0 and \n because they won't appear in filenames, so it's convenient in that way.
>
> I don't remember, but we do store even boolean value as text, not in binary
>  `\0`/`\1` form. `transplant_source` is the solo exception.
Perhaps it's just so `{extras}` doesn't print ANSI escape codes and such? (I assume that can still happen if put escape characters in your filenames, for example.)
Apr 14 2019, 7:02 PM

Apr 13 2019

yuja added a comment to D6183: copies: add config option for writing copy metadata to file and/or changset.
> It might be nitpicky, but I think it's better to not embed `\0` into the
>  extras field. Almost all extras data are texts, and IIRC we regret that
>  transplant sources are stored in binary form.
Why not? I picked \0 and \n because they won't appear in filenames, so it's convenient in that way.
Apr 13 2019, 8:26 PM
yuja added a comment to D6183: copies: add config option for writing copy metadata to file and/or changset.

+def encodecopies(copies):
+ items = [
+ '%s\0%s' % (_string_escape(k), _string_escape(copies[k]))
+ for k in sorted(copies)
+ ]
+ return "\n".join(items)

Apr 13 2019, 7:45 AM
yuja added a comment to D6185: changelog: pass default extras into decodeextra().

+def decodeextra(text, default):

"""
>>> from .pycompat import bytechr as chr
  • >>> sorted(decodeextra(encodeextra({b'foo': b'bar', b'baz': chr(0) + b'2'})
  • ... ).items())

+ >>> sorted(decodeextra(encodeextra({b'foo': b'bar', b'baz': chr(0) + b'2'}),
+ ... _defaultextra).items())

[('baz', '\\x002'), ('branch', 'default'), ('foo', 'bar')]
>>> sorted(decodeextra(encodeextra({b'foo': b'bar',
  • ... b'baz': chr(92) + chr(0) + b'2'})
  • ... ).items())

+ ... b'baz': chr(92) + chr(0) + b'2'}),
+ ... _defaultextra).items())

Apr 13 2019, 7:45 AM

Apr 12 2019

yuja added a comment to D6208: branchcache: lazily validate nodes from the branchmap.

The idea sounds good to me. Is this still an RFC (i.e. draft) patch?

Apr 12 2019, 9:12 PM

Apr 10 2019

yuja committed rHG509a0477b3a6: cext: cast s# arguments of Py_BuildValue() to Py_ssize_t.
cext: cast s# arguments of Py_BuildValue() to Py_ssize_t
Apr 10 2019, 6:41 AM

Apr 9 2019

yuja added a comment to D6196: cext: make revlog.c PY_SSIZE_T_CLEAN.
4   org.python.python             	0x00000001000eb761 va_build_value + 737
5   org.python.python             	0x00000001000eb837 _Py_BuildValue_SizeT + 167
Apr 9 2019, 9:05 AM

Apr 1 2019

yuja added a comment to D6169: unshelve: disable unshelve during merge (issue5123).
I saw some patches[0][1][2] trying to fix this issue. It seems like it's difficult to preserve the second parent.
[0]: http://mercurial.808500.n3.nabble.com/PATCH-shelve-adds-restoring-original-parents-after-unshelve-issue5123-tc4035657.html#none
[1]: http://mercurial.808500.n3.nabble.com/PATCH-V2-shelve-restore-parents-after-unshelve-issue5123-tc4036093.html#a4037370
[2]: http://mercurial.808500.n3.nabble.com/PATCH-V3-shelve-restore-parents-after-unshelve-issue5123-tt4036858.html#a4037408
Apr 1 2019, 7:04 PM

Mar 27 2019

yuja added a comment to D6169: unshelve: disable unshelve during merge (issue5123).
> Is it difficult to fix unshelve to not lose merge parents?
> 
> https://bz.mercurial-scm.org/show_bug.cgi?id=5123#c2
I'll try to come up with a fix. But, `hg shelve` is aborting during a merge. Can `unshelve` be aborted too?
Mar 27 2019, 6:35 PM

Mar 25 2019

yuja added a comment to D6169: unshelve: disable unshelve during merge (issue5123).
As stated in the issue5123, unshelve can destroy the second parent of
the context when tried to unshelve with an uncommitted merge. This
patch makes unshelve to abort when called with an uncommitted merge.
Mar 25 2019, 6:29 PM
yuja added a comment to D6027: mq: make unshelve to apply on modified mq patch (issue4318).
  • a/hgext/mq.py

+++ b/hgext/mq.py
@@ -3518,7 +3518,10 @@

        delattr(self.unfiltered(), r'mq')
def abortifwdirpatched(self, errmsg, force=False):
  • if self.mq.applied and self.mq.checkapplied and not force:

+ shelveinprogress = any('shelvedstate' in state
+ for state in cmdutil.unfinishedstates)
+ if (self.mq.applied and self.mq.checkapplied and not force and
+ not shelveinprogress):

Mar 25 2019, 6:29 PM

Mar 23 2019

yuja added a comment to D6156: branchcache: add attributes to track which nodes are verified.

@@ -231,8 +235,10 @@

    raise ValueError(
        r'node %s does not exist' % pycompat.sysstr(hex(node)))
self._entries.setdefault(label, []).append(node)

+ self._verifiedbranches.add(label)

Mar 23 2019, 9:26 PM
yuja added a comment to D6151: branchmap: remove the dict interface from the branchcache class (API).
def copy(self):
    """return an deep copy of the branchcache object"""
  • return type(self)(
  • self, self.tipnode, self.tiprev, self.filteredhash,

+ return branchcache(
+ self.entries, self.tipnode, self.tiprev, self.filteredhash,

self._closednodes)
Mar 23 2019, 9:10 PM
yuja committed rHGa66965406528: test-template: fix stdio mode on Windows.
test-template: fix stdio mode on Windows
Mar 23 2019, 11:25 AM

Mar 22 2019

yuja added a comment to D6168: readline: provide styled prompt to readline (issue6070).
Oh, right... I saw that and that was part of why I didn't mail earlier :D  I think this is just an "expected" difference in behavior,
Mar 22 2019, 10:01 PM
yuja committed rHG77ef3498ceb3: template: add CBOR output format.
template: add CBOR output format
Mar 22 2019, 1:05 PM
yuja committed rHG4df7c4b70e03: templatefilters: add {x|cbor} filter for custom CBOR output.
templatefilters: add {x|cbor} filter for custom CBOR output
Mar 22 2019, 1:05 PM

Mar 18 2019

yuja added a comment to D5296: store: don't read the whole fncache in memory.

+ self.entries = set()
+ chunk = b''
+ for c in iter(functools.partial(fp.read, fncache_chunksize), b''):
+ chunk += c
+ try:
+ p = chunk.rindex(b'\n')
+ self.entries.update(decodedir(chunk[:p + 1]).splitlines())
+ chunk = chunk[p + 1:]
+ except ValueError:
+ # substring '\n' not found, maybe the entry is bigger than the
+ # chunksize, so let's keep iterating
+ pass

Mar 18 2019, 8:29 AM

Mar 17 2019

yuja committed rHG406519302520: test-https: add some more known failure messages of client certs (issue6030).
test-https: add some more known failure messages of client certs (issue6030)
Mar 17 2019, 2:57 PM
yuja committed rHG4748938ee0c7: test-https: turn off system OpenSSL configuration.
test-https: turn off system OpenSSL configuration
Mar 17 2019, 2:57 PM

Mar 16 2019

yuja added a comment to D5296: store: don't read the whole fncache in memory.

+ for c in iter(functools.partial(fp.read, chunksize), b''):
+ chunk += c
+ try:
+ p = chunk.rindex(b'\n')
+ self.entries |= set(decodedir(chunk[:p + 1]).splitlines())

Mar 16 2019, 9:51 PM

Mar 15 2019

yuja added a comment to D6107: py3: use pycompat.byteskwargs on opts in phabricator.py.
I was under the impression that that was more of a hack, mainly useful for when there are lots of existing `opts.get(b'')` uses in a file, and when there are a few it was better to change to `r''`.
Mar 15 2019, 10:44 PM
yuja added a comment to D6113: py3: convert to/from bytes/unicode for json.(dump|load)s in debugcallconduit.
Ah,  we can indeed (thanks for the pointer), with one caveat:  the formatting.
The existing output is nicely formatted for human readability, with each entry on a new line and indented appropriately.  `templatefilters.json()` isn't capable of that.
Do we mind losing that?  It's also tested for in test-phabricator.t. Compare before:
Mar 15 2019, 10:44 PM
yuja added a comment to D6140: revset: add new contiguous(x) function for "x::x".

I think "contiguous" is good as it stands for the main use case. "closure"
seems confusing unless we have stronger math background than computer science.
The other candidates would require more knowledge about the theory.

Mar 15 2019, 10:43 PM

Mar 11 2019

yuja added a comment to D6081: i18n-ja: correct translation of "committing".

Maybe need a pullreq? We can't review i18n messages.

Mar 11 2019, 9:46 AM

Mar 9 2019

yuja added a comment to D6113: py3: convert to/from bytes/unicode for json.(dump|load)s in debugcallconduit.
  • params = json.loads(ui.fin.read())
  • result = callconduit(repo, name, params)
  • s = json.dumps(result, sort_keys=True, indent=2, separators=(b',', b': '))
  • ui.write(b'%s\n' % s)

+ # json.(load|dump)s only returns/accepts unicode strings
+ params = pycompat.rapply(lambda x:
+ encoding.unitolocal(x) if isinstance(x, pycompat.unicode) else x,
+ json.loads(ui.fin.read())
+ )

Mar 9 2019, 8:30 PM
yuja added a comment to D6107: py3: use pycompat.byteskwargs on opts in phabricator.py.

pycompat.byteskwargs() can be used instead.

Mar 9 2019, 8:29 PM
yuja added a comment to D6103: py3: use pycompat.iterbytestr to convert memoryview slice to bytestring before passing to itertools.takewhile.

Queued most of the patches in this series, thanks.

Mar 9 2019, 8:29 PM

Mar 5 2019

yuja added a comment to D6044: phabricator: convert conduit response JSON unicode to bytes inside callconduit.
> Perhaps some of `r''` would have to be changed to `b''` since dict keys
>  are now byte strings. See the wiki page for our Py3 hacks.
> 
> https://www.mercurial-scm.org/wiki/Python3
Ah, good point, thanks.  Would it be worth keeping the keys as r'' strings?  rapply can fairly easily be extended with an optional notkeys boolean that would allow doing so.
Mar 5 2019, 8:45 AM

Mar 3 2019

yuja added a comment to D6052: global: use raw string for setlocale() argument.
After this series, the number of test failures in that mode is ~70. Most of the remaining failures are in `stringutil.wrap()`. Essentially `textwrap` from the standard library wants to operate on native `str`. Our version is feeding in `unicode`. We get into trouble when the standard library code does a `''.join()` and some `unicode` is coerced into `str`. TBH I'm not sure how we're not seeing bugs due to this on Python 2. I'm guessing we're lacking test coverage for something passing non-ASCII into `stringutil.wrap()`?
Mar 3 2019, 5:01 AM
yuja added a comment to D6044: phabricator: convert conduit response JSON unicode to bytes inside callconduit.
  • parsed = json.loads(body)

+ parsed = pycompat.rapply(lambda x: encoding.unitolocal(x)
+ if isinstance(x, unicode) else x, json.loads(body))

Mar 3 2019, 4:47 AM

Mar 1 2019

yuja added a comment to D6042: py3: convert filtername to str if it's None.

+ filtername = repo.filtername
+ if filtername is None:
+ filtername = 'None'

repo.ui.log('branchcache', 'updated %s branch cache in %.4f seconds\n',
  • repo.filtername, duration)

+ filtername, duration)

Mar 1 2019, 8:36 PM
yuja committed rHG169c386cc9d8: merge with stable.
merge with stable
Mar 1 2019, 8:23 PM

Feb 27 2019

yuja added a comment to D5296: store: don't read the whole fncache in memory.

I don't think totalsize has to be stat()ed. We can just loop over until
fp.read() reaches to EOF. It's unreliable to assume that the stat('fncache')
see the identical file to the fp open()ed before.

Feb 27 2019, 8:03 PM

Feb 25 2019

yuja added a comment to D5296: store: don't read the whole fncache in memory.

(resend without the "On ... wrote:" line)

Feb 25 2019, 10:03 PM
yuja added a comment to D6023: branchcache: move loading of branch names and nodes into it's own function.
if not bcache.validfor(repo):
    # invalidate the cache
    raise ValueError(r'tip differs')
  • cl = repo.changelog
  • for line in lineiter:
  • line = line.rstrip('\n')
  • if not line:
  • continue
  • node, state, label = line.split(" ", 2)
  • if state not in 'oc':
  • raise ValueError(r'invalid branch state')
  • label = encoding.tolocal(label.strip())
  • node = bin(node)
  • if not cl.hasnode(node):
  • raise ValueError(
  • r'node %s does not exist' % pycompat.sysstr(hex(node)))
  • bcache.setdefault(label, []).append(node)
  • if state == 'c':
  • bcache._closednodes.add(node) -

+ bcache.load(repo, f)

except (IOError, OSError):
    return None

@@ -214,6 +198,26 @@

return bcache

+ def load(self, repo, f):
+ """ fully loads the branchcache by reading from the file f """
+ cl = repo.changelog
+ lineiter = iter(f)

Feb 25 2019, 5:58 PM

Feb 24 2019

yuja added a comment to D5997: mq: disable qrecord during histedit (issue5981).
with ui.configoverride(overrides, 'record'):

+ if repo.vfs.exists('histedit-state'):
+ raise error.Abort(_("histedit in progress, can't qrecord"))

cmdutil.dorecord(ui, repo, committomq, cmdsuggest, False,
Feb 24 2019, 8:36 PM
yuja added a comment to D6007: diff: make sure we output stat info even when --git is not passed (issue4037).
I looked into why we don't return diff headers in quiet mode and found the
behavior is from https://phab.mercurial-scm.org/rHG8f8bb77d560e70bcc95577e4dfa877df18d876ab which does not have
any mention about why it is done. We also show the diff headers in git, so I
think it's fine showing diff header in normal diff in quiet mode.
Feb 24 2019, 8:36 PM

Feb 20 2019

yuja committed rHGffbf742bfe1f: subrepo: add test for Windows relative-ish path with drive letter.
subrepo: add test for Windows relative-ish path with drive letter
Feb 20 2019, 1:03 AM

Feb 12 2019

yuja added a comment to D5813: revset: add expect to check the size of a set.

+@predicate('expectsize(set[, size])', safe=True, takeorder=True)
+def expectrevsetsize(repo, subset, x, order):
+ """Abort if the revset doesn't expect given size"""
+ args = getargsdict(x, 'expect', 'set size')

Feb 12 2019, 7:49 AM

Feb 11 2019

yuja added a comment to D5907: copy: respect ui.relative-paths in copy/rename.
`getuipathfn()` uses `repo.pathto()` when a relative path was requested (including by setting `legacyrelativevalue=True` or `forcerelativevalue=True`), so I think there shouldn't be much change in behavior with that commit.
Feb 11 2019, 8:43 AM
yuja added a comment to D5813: revset: add expect to check the size of a set.
nit-pick is resolved. `getintrange()` will throw a `ParseError` on setting size to one of `min:`, `:max` or `:`. In ideal case, on calling from `expectsize()` it shouldn't fail.
Feb 11 2019, 8:43 AM

Feb 10 2019

yuja added a comment to D5813: revset: add expect to check the size of a set.

Getting close.

Feb 10 2019, 9:16 PM
yuja added a comment to D5907: copy: respect ui.relative-paths in copy/rename.
> It might
>  break some Windows tests, but it should already be broken since https://phab.mercurial-scm.org/rHGa997163e7fae2fe933f8d0c6d1013205befd1ee4.
>  Some (or all?) `uipathfn()`s have to respect `ui.slash` config on Windows.
Did that commit change any behavior on Windows?
Feb 10 2019, 9:12 PM

Feb 9 2019

yuja added a comment to D5907: copy: respect ui.relative-paths in copy/rename.
  • a/mercurial/scmutil.py

+++ b/mercurial/scmutil.py
@@ -51,8 +51,10 @@
)
if pycompat.iswindows:
+ from . import windows as platform

from . import scmwindows as scmplatform

else:
+ from . import posix as platform

from . import scmposix as scmplatform
Feb 9 2019, 10:45 PM
yuja added a comment to D5896: diff: make --stat respect ui.relative-paths.
It would have been easy to make all diffs respect ui.relative-paths,
but we don't want that since it makes the diff invalid. Perhaps it
makes sense to do that with --noprefix since the point of that is to
make paths that are easy to copy&paste, and the diff is already
invalid anyway. But this patch just makes the --stat version respect
the config option. The --stat view is not even close to a valid diff,
so I think it makes sense to show the paths in more human-friendly
form.
Feb 9 2019, 10:45 PM
yuja added a comment to D5813: revset: add expect to check the size of a set.

+@predicate('expectsize(set[, size])', safe=True, takeorder=True)
+def expectrevsetsize(repo, subset, x, order):
+ """Abort if the revset doesn't expect given size"""
+ args = getargsdict(x, 'expect', 'set size')
+ size = args.get('size')
+ if size is not None:
+ minsize, maxsize = getintrange(size,
+ _('expectsize requires a size range'
+ ' or a positive integer'),
+ _('size range bounds must be integers'))

Feb 9 2019, 8:27 PM

Feb 7 2019

yuja added a comment to D5813: revset: add expect to check the size of a set.

+ $ hg log -r 'expectsize(0:2, 3)'
+ changeset: 0:2785f51eece5
+ branch: a
+ user: test
+ date: Thu Jan 01 00:00:00 1970 +0000
+ summary: 0

Feb 7 2019, 8:18 AM
yuja added a comment to D5490: commit: remove ignore whitespace option on --interactive (issue6042).
@spectral @yuja Can I close this?
Feb 7 2019, 8:06 AM