Re: [PATCH STABLE] setup: only allow Python 3 from a source checkout (issue5804)
On Fri, 23 Feb 2018 18:02:20 -0800, Gregory Szorc wrote: > # HG changeset patch > # User Gregory Szorc > # Date 1519437424 28800 > # Fri Feb 23 17:57:04 2018 -0800 > # Branch stable > # Node ID 5b80235fd920c02ff430d8b0989fc55a58f11a0c > # Parent 5da7b8cb6f751fa7a331ed501d26f336e1bbc8f9 > setup: only allow Python 3 from a source checkout (issue5804) Queued for stable, thanks. ___ Mercurial-devel mailing list Mercurial-devel@mercurial-scm.org https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel
Re: [PATCH 03 of 11] py3: use pycompat.bytestr to convert str returned by getpass.getuser to bytes
On Fri, 23 Feb 2018 23:45:16 +0530, Pulkit Goyal wrote: > # HG changeset patch > # User Pulkit Goyal <7895pul...@gmail.com> > # Date 1519386265 -19800 > # Fri Feb 23 17:14:25 2018 +0530 > # Node ID dbcf3a406cf79d296d7e29ea2786fd647facd367 > # Parent 70c096e42cb8a63a62efe69b87cd7ccc5c539dba > py3: use pycompat.bytestr to convert str returned by getpass.getuser to bytes > > diff --git a/hgext/acl.py b/hgext/acl.py > --- a/hgext/acl.py > +++ b/hgext/acl.py > @@ -200,6 +200,7 @@ from mercurial import ( > error, > extensions, > match, > +pycompat, > registrar, > util, > ) > @@ -340,7 +341,7 @@ def hook(ui, repo, hooktype, node=None, > user = urlreq.unquote(url[3]) > > if user is None: > -user = getpass.getuser() > +user = pycompat.bytestr(getpass.getuser()) getuser() may return non-ASCII characters. Last time we've fixed posix.getuser() by applying fsencode() because of the implementation detail of Python 3. Perhaps we can switch this to util.getuser(). ___ Mercurial-devel mailing list Mercurial-devel@mercurial-scm.org https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel
Re: [PATCH 08 of 11] py3: pass ctx.rev() instead of ctx in range()
On Fri, 23 Feb 2018 18:54:53 -0800, Gregory Szorc wrote: > Speaking of __int__, it is only defined in one place in the repo: on > context.basectx. I think we should consider removing it: it is too much > coercion magic for my liking. +1 for removing int(ctx) and '%d' % ctx. Actually it doesn't always return an int because rev() may be None. ___ Mercurial-devel mailing list Mercurial-devel@mercurial-scm.org https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel
Re: [PATCH] namespace: fastpath name lookup on invalid name
On Thu, 22 Feb 2018 20:33:36 +0100, Boris Feld wrote: > # HG changeset patch > # User Boris Feld > # Date 1519313522 -3600 > # Thu Feb 22 16:32:02 2018 +0100 > # Node ID b65a85952c09cf4c71a1458fbc4ec77c49683314 > # Parent 428de1a59f2df3d6d07ff1d7164c8ee56cbb7825 > # EXP-Topic noname > # Available At https://bitbucket.org/octobus/mercurial-devel/ > # hg pull https://bitbucket.org/octobus/mercurial-devel/ -r > b65a85952c09 > namespace: fastpath name lookup on invalid name > > Since label cannot contains leading or trailing whitespace we can skip looking > for them. This is useful in repositories with slow labels (eg: special type of > tags). Short command running on a specific revision can benefit from such > shortcut. > > eg on a repository where loading tags take 0.4s: > > 1: hg log --template '{node}\n' --rev 'rev(0)' >0.560 seconds > > 2: hg log --template '{node}\n' --rev ' rev(0)' >0.109 seconds > > The changeset introduce a generic way to do such fast-pathing to help > extensions writer to apply the same principle to their extensions. So is this basically the same as the previous version in that we have to suggest using a weird syntax (leading/trailing space) to get to the fast path? https://www.mercurial-scm.org/pipermail/mercurial-devel/2018-February/111432.html > Instead, maybe we can make lookup() to not search slow labels assuming these > labeling schemes didn't exist in pre-revset era. Alternatively, we could add > a config knob to switch off the old-style range support. ___ Mercurial-devel mailing list Mercurial-devel@mercurial-scm.org https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel
Re: [PATCH] tests: add HTTP POST and PUT support to the $LOGDATE$ substitution
On Fri, 23 Feb 2018 22:02:10 -0500, Matt Harbison wrote: > # HG changeset patch > # User Matt Harbison > # Date 1519437010 18000 > # Fri Feb 23 20:50:10 2018 -0500 > # Node ID 14510712ffab7d3b779fe3eeba6b94f003ca10f7 > # Parent 762820292aea1fe3948e05b3ac65f2d448386626 > tests: add HTTP POST and PUT support to the $LOGDATE$ substitution Queued, thanks. ___ Mercurial-devel mailing list Mercurial-devel@mercurial-scm.org https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel
[PATCH] tests: add HTTP POST and PUT support to the $LOGDATE$ substitution
# HG changeset patch # User Matt Harbison # Date 1519437010 18000 # Fri Feb 23 20:50:10 2018 -0500 # Node ID 14510712ffab7d3b779fe3eeba6b94f003ca10f7 # Parent 762820292aea1fe3948e05b3ac65f2d448386626 tests: add HTTP POST and PUT support to the $LOGDATE$ substitution The lfs serving code uses both POST and PUT requests (and there's existing support for POST). diff --git a/tests/common-pattern.py b/tests/common-pattern.py --- a/tests/common-pattern.py +++ b/tests/common-pattern.py @@ -69,8 +69,8 @@ br'$USUAL_BUNDLE2_CAPS_SERVER$' ), # HTTP log dates -(br' - - \[\d\d/.../2\d\d\d \d\d:\d\d:\d\d] "GET', - br' - - [$LOGDATE$] "GET' +(br' - - \[\d\d/.../2\d\d\d \d\d:\d\d:\d\d] "(GET|PUT|POST)', + lambda m: br' - - [$LOGDATE$] "' + m.group(1) ), # Windows has an extra '/' in the following lines that get globbed away: # pushing to file:/*/$TESTTMP/r2 (glob) ___ Mercurial-devel mailing list Mercurial-devel@mercurial-scm.org https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel
Re: [PATCH 08 of 11] py3: pass ctx.rev() instead of ctx in range()
On Fri, Feb 23, 2018 at 10:15 AM, Pulkit Goyal <7895pul...@gmail.com> wrote: > # HG changeset patch > # User Pulkit Goyal <7895pul...@gmail.com> > # Date 1519389273 -19800 > # Fri Feb 23 18:04:33 2018 +0530 > # Node ID a2b469c5995b4c2602f1bb1c3959d67ee9c08141 > # Parent 457aea9470d03f8e69c873b9aec845256abf9023 > py3: pass ctx.rev() instead of ctx in range() > > diff --git a/hgext/acl.py b/hgext/acl.py > --- a/hgext/acl.py > +++ b/hgext/acl.py > @@ -356,7 +356,7 @@ def hook(ui, repo, hooktype, node=None, > allow = buildmatch(ui, repo, user, 'acl.allow') > deny = buildmatch(ui, repo, user, 'acl.deny') > > -for rev in xrange(repo[node], len(repo)): > +for rev in xrange(repo[node].rev(), len(repo)): > If someone could enlighten me as to why this works in Python 2 but not Python 3, I would appreciate it. The new code is obviously correct. I'm just curious what Python 3 changed about the semantics of range(). I guess it no longer calls __int__??? Speaking of __int__, it is only defined in one place in the repo: on context.basectx. I think we should consider removing it: it is too much coercion magic for my liking. > ctx = repo[rev] > branch = ctx.branch() > if denybranches and denybranches(branch): > ___ > Mercurial-devel mailing list > Mercurial-devel@mercurial-scm.org > https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel > ___ Mercurial-devel mailing list Mercurial-devel@mercurial-scm.org https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel
Re: [PATCH 01 of 11] py3: add b'' prefixes in test-dispatch.py
On Fri, Feb 23, 2018 at 10:15 AM, Pulkit Goyal <7895pul...@gmail.com> wrote: > # HG changeset patch > # User Pulkit Goyal <7895pul...@gmail.com> > # Date 1519236803 -19800 > # Wed Feb 21 23:43:23 2018 +0530 > # Node ID ea8a43155c3d51289609afeda8659b4d604b2e1e > # Parent b8d0761a85c7421071750de23228415306852d69 > py3: add b'' prefixes in test-dispatch.py > Queued this series. (I missed Phabricator's diff highlighting when reviewing this: it makes things like b'' prefixes so much easier to review.) > > # skip-blame because this is just adding b'' prefixes > > diff --git a/tests/test-dispatch.py b/tests/test-dispatch.py > --- a/tests/test-dispatch.py > +++ b/tests/test-dispatch.py > @@ -9,27 +9,27 @@ def testdispatch(cmd): > > Prints command and result value, but does not handle quoting. > """ > -print("running: %s" % (cmd,)) > +print(b"running: %s" % (cmd,)) > req = dispatch.request(cmd.split()) > result = dispatch.dispatch(req) > -print("result: %r" % (result,)) > +print(b"result: %r" % (result,)) > > -testdispatch("init test1") > +testdispatch(b"init test1") > os.chdir('test1') > > # create file 'foo', add and commit > f = open('foo', 'wb') > -f.write('foo\n') > +f.write(b'foo\n') > f.close() > -testdispatch("add foo") > -testdispatch("commit -m commit1 -d 2000-01-01 foo") > +testdispatch(b"add foo") > +testdispatch(b"commit -m commit1 -d 2000-01-01 foo") > > # append to file 'foo' and commit > f = open('foo', 'ab') > -f.write('bar\n') > +f.write(b'bar\n') > f.close() > -testdispatch("commit -m commit2 -d 2000-01-02 foo") > +testdispatch(b"commit -m commit2 -d 2000-01-02 foo") > > # check 88803a69b24 (fancyopts modified command table) > -testdispatch("log -r 0") > -testdispatch("log -r tip") > +testdispatch(b"log -r 0") > +testdispatch(b"log -r tip") > ___ > Mercurial-devel mailing list > Mercurial-devel@mercurial-scm.org > https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel > ___ Mercurial-devel mailing list Mercurial-devel@mercurial-scm.org https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel
D2403: stack: remove destutil.stackbase
indygreg added a comment. Oh, I guess the series never did formerly define a revset for stack :/ I think there is room for one. We have the ability to mark revsets as experimental or internal, right? Could/should we do that so we don't need `hg debugstack`? Anyway, I could probably queue this with some minor rework. But I'm going to hold off a bit and see if others have opinions. REPOSITORY rHG Mercurial REVISION DETAIL https://phab.mercurial-scm.org/D2403 To: lothiraldan, #hg-reviewers Cc: indygreg, mercurial-devel ___ Mercurial-devel mailing list Mercurial-devel@mercurial-scm.org https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel
D2398: histedit: use the new stack definition for histedit
indygreg requested changes to this revision. indygreg added inline comments. This revision now requires changes to proceed. INLINE COMMENTS > destutil.py:345 > """Default base revision to edit for `hg histedit`.""" > -default = ui.config('histedit', 'defaultrev', histeditdefaultrevset) > -if default: > +default = ui.config('histedit', 'defaultrev', None) > + This means we can mark the default value for this option as `None`. REPOSITORY rHG Mercurial REVISION DETAIL https://phab.mercurial-scm.org/D2398 To: lothiraldan, #hg-reviewers, indygreg Cc: indygreg, mercurial-devel ___ Mercurial-devel mailing list Mercurial-devel@mercurial-scm.org https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel
D2399: stack: return a sorted smartrev by default
indygreg requested changes to this revision. indygreg added a comment. This revision now requires changes to proceed. Looks good. But only marking as needing changes because I think we may get rid of `hg debugstack`. REPOSITORY rHG Mercurial REVISION DETAIL https://phab.mercurial-scm.org/D2399 To: lothiraldan, #hg-reviewers, indygreg Cc: indygreg, mercurial-devel ___ Mercurial-devel mailing list Mercurial-devel@mercurial-scm.org https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel
D2396: stack: import Evolve stack test file
indygreg added a comment. I haven't looked at the remainder of the series, but it feels weird to basically reinvent a special case of `hg log` as a debug command. I do see there is a commit introducing a revset for `stack`. Perhaps we could move it up in the series so we don't need what might be a not-very-useful debug command? REPOSITORY rHG Mercurial REVISION DETAIL https://phab.mercurial-scm.org/D2396 To: lothiraldan, #hg-reviewers Cc: indygreg, mercurial-devel ___ Mercurial-devel mailing list Mercurial-devel@mercurial-scm.org https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel
D2395: stack: add a new module for stack-related commands
indygreg requested changes to this revision. indygreg added a comment. This revision now requires changes to proceed. Requires a minor style change. But I like where this is going... INLINE COMMENTS > stack.py:10 > + > +from . import revsetlang, scmutil > + Nit: this doesn't following our import conventions. This should be: from . import ( revsetlang, scmutil, ) REPOSITORY rHG Mercurial REVISION DETAIL https://phab.mercurial-scm.org/D2395 To: lothiraldan, #hg-reviewers, indygreg Cc: indygreg, mercurial-devel ___ Mercurial-devel mailing list Mercurial-devel@mercurial-scm.org https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel
D2392: debugcommands: add debugwireproto command
indygreg planned changes to this revision. indygreg added inline comments. INLINE COMMENTS > debugcommands.py:2630 > +# separation. This prevents a whole class of potential bugs around > +# shared state from interfering with server operation. > + I'm having second thoughts about this. The reason is that from a testing perspective (which is the primary driver behind this work), `read()` isn't very reliable because of timing issues. Depending on operating system settings, system performance, etc, operations like `read(-1)` can return a variable number of bytes because they return only what's available on the wire. `write()`, however, is more reliable. When you `write()` to something in Python, Python makes as many system calls as necessary to ensure all bytes are delivered. So a `write()` at the Python level is mostly deterministic. I think the concerns around process separation here aren't that significant. So I think I'm going to rework this (yet again) to spawn the SSH server in process and to only monitor I/O operations that are deterministic. This may mean only monitoring `write()` calls on pipes and *possibly* monitoring `readline()` and `read(N)`. But if we monitor `write()` on both peers since they are both in-process, then `read()` monitoring is redundant. That could be useful to debug behavior. But for tests demonstrating the wire protocol exchange, it's less useful. REPOSITORY rHG Mercurial REVISION DETAIL https://phab.mercurial-scm.org/D2392 To: indygreg, #hg-reviewers Cc: sid0, mercurial-devel ___ Mercurial-devel mailing list Mercurial-devel@mercurial-scm.org https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel
[PATCH STABLE] setup: only allow Python 3 from a source checkout (issue5804)
# HG changeset patch # User Gregory Szorc # Date 1519437424 28800 # Fri Feb 23 17:57:04 2018 -0800 # Branch stable # Node ID 5b80235fd920c02ff430d8b0989fc55a58f11a0c # Parent 5da7b8cb6f751fa7a331ed501d26f336e1bbc8f9 setup: only allow Python 3 from a source checkout (issue5804) People are running `pip install Mercurial` with Python 3 and that is working because not everything performs a Python version compatibility check. Modern versions of pip do recognize the "python_requires" keyword (https://packaging.python.org/tutorials/distributing-packages/#python-requires) which we set if using setuptools. But this isn't set nor recognized everywhere. To prevent people from accidentally installing Mercurial with Python 3 until Python 3 is officially supported, have setup.py fail when run with Python 3. But don't fail if we're running from a source checkout, as we don't want to anger Mercurial developers hacking on Python 3 nor Mercurial's test automation running from source checkouts. People running setup.py from source checkouts could still fall through a Python 3 crack. But at least the `pip install Mercurial` attempt will get nipped in the bud. diff --git a/setup.py b/setup.py --- a/setup.py +++ b/setup.py @@ -67,6 +67,26 @@ Python {py} detected. printf(error, file=sys.stderr) sys.exit(1) +# We don't yet officially support Python 3. But we want to allow developers to +# hack on. Detect and disallow running on Python 3 by default. But provide a +# backdoor to enable working on Python 3. +if sys.version_info[0] != 2: +badpython = True + +# Allow Python 3 from source checkouts. +if os.path.isdir('.hg'): +badpython = False + +if badpython: +error = """ +Mercurial only supports Python 2.7. +Python {py} detected. +Please re-run with Python 2.7. +""".format(py=sys.version_info) + +printf(error, file=sys.stderr) +sys.exit(1) + # Solaris Python packaging brain damage try: import hashlib ___ Mercurial-devel mailing list Mercurial-devel@mercurial-scm.org https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel
[Bug 5804] New: Simple pull causes: AttributeError: 'str' object has no attribute 'decode'
https://bz.mercurial-scm.org/show_bug.cgi?id=5804 Bug ID: 5804 Summary: Simple pull causes: AttributeError: 'str' object has no attribute 'decode' Product: Mercurial Version: unspecified Hardware: PC OS: Linux Status: UNCONFIRMED Severity: feature Priority: wish Component: Mercurial Assignee: bugzi...@mercurial-scm.org Reporter: bz.mercurial-scm@assarbad.net CC: mercurial-devel@mercurial-scm.org Hi, the Hg version that came with Ubuntu 14.04 (2.8.2) failed to pull from the official Hg repo, because bundle2 support was missing. So I decided to install Mercurial using `pip install --user mercurial`. After installing I see this: --- $ hg --version Mercurial Distributed SCM (version 4.5) (see https://mercurial-scm.org for more information) Copyright (C) 2005-2018 Matt Mackall and others This is free software; see the source for copying conditions. There is NO warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. --- When I then attempted to pull again, I was met with an exception as follows: --- $ hg pull pulling from https://www.mercurial-scm.org/repo/hg ** unknown exception encountered, please report by visiting ** https://mercurial-scm.org/wiki/BugTracker ** Python 3.6.4 (default, Jan 1 2018, 22:34:23) [GCC 4.8.4] ** Mercurial Distributed SCM (version 4.5) ** Extensions loaded: extdiff, fetch, strip, mq, purge, rebase, record, schemes, shelve, transplant Traceback (most recent call last): File "/home/oliver/.local/bin/hg", line 41, in dispatch.run() File "/home/oliver/.local/lib/python3.6/site-packages/mercurial/dispatch.py", line 88, in run status = (dispatch(req) or 0) & 255 File "/home/oliver/.local/lib/python3.6/site-packages/mercurial/dispatch.py", line 183, in dispatch ret = _runcatch(req) File "/home/oliver/.local/lib/python3.6/site-packages/mercurial/dispatch.py", line 324, in _runcatch return _callcatch(ui, _runcatchfunc) File "/home/oliver/.local/lib/python3.6/site-packages/mercurial/dispatch.py", line 332, in _callcatch return scmutil.callcatch(ui, func) File "/home/oliver/.local/lib/python3.6/site-packages/mercurial/scmutil.py", line 154, in callcatch return func() File "/home/oliver/.local/lib/python3.6/site-packages/mercurial/dispatch.py", line 314, in _runcatchfunc return _dispatch(req) File "/home/oliver/.local/lib/python3.6/site-packages/mercurial/dispatch.py", line 918, in _dispatch cmdpats, cmdoptions) File "/home/oliver/.local/lib/python3.6/site-packages/mercurial/dispatch.py", line 673, in runcommand ret = _runcommand(ui, options, cmd, d) File "/home/oliver/.local/lib/python3.6/site-packages/mercurial/dispatch.py", line 926, in _runcommand return cmdfunc() File "/home/oliver/.local/lib/python3.6/site-packages/mercurial/dispatch.py", line 915, in d = lambda: util.checksignature(func)(ui, *args, **strcmdopt) File "/home/oliver/.local/lib/python3.6/site-packages/mercurial/util.py", line 1195, in check return func(*args, **kwargs) File "/home/oliver/.local/lib/python3.6/site-packages/mercurial/util.py", line 1195, in check return func(*args, **kwargs) File "/home/oliver/.local/lib/python3.6/site-packages/hgext/mq.py", line 3583, in mqcommand return orig(ui, repo, *args, **kwargs) File "/home/oliver/.local/lib/python3.6/site-packages/mercurial/util.py", line 1195, in check return func(*args, **kwargs) File "/home/oliver/.local/lib/python3.6/site-packages/mercurial/util.py", line 1195, in check return func(*args, **kwargs) File "/home/oliver/.local/lib/python3.6/site-packages/hgext/rebase.py", line 1772, in pullrebase ret = orig(ui, repo, *args, **opts) File "/home/oliver/.local/lib/python3.6/site-packages/mercurial/util.py", line 1195, in check return func(*args, **kwargs) File "/home/oliver/.local/lib/python3.6/site-packages/mercurial/commands.py", line 3989, in pull other = hg.peer(repo, opts, source) File "/home/oliver/.local/lib/python3.6/site-packages/mercurial/hg.py", line 181, in peer return _peerorrepo(rui, path, create).peer() File "/home/oliver/.local/lib/python3.6/site-packages/mercurial/hg.py", line 156, in _peerorrepo obj = _peerlookup(path).instance(ui, path, create) File "/home/oliver/.local/lib/python3.6/site-packages/mercurial/httppeer.py", line 497, in instance inst._fetchcaps() File "/home/oliver/.local/lib/python3.6/site-packages/mercurial/httppeer.py", line 239, in _fetchcaps self._caps = set(self._call('capabilities').split()) File "/home/oliver/.local/lib/python3.6/site-packages/mercurial/httppeer.py", line 407, in _call fp = self._callstream(cmd, **args) File "/home/oliver/.local/lib/python3.6/site-packages/mercurial/httppeer.py", line 336,
D2404: util: enable observing of util.bufferedinputpipe
indygreg updated this revision to Diff 6025. indygreg edited the summary of this revision. indygreg retitled this revision from "util: enable observing of os.read() from bufferedinputpipe" to "util: enable observing of util.bufferedinputpipe". REPOSITORY rHG Mercurial CHANGES SINCE LAST UPDATE https://phab.mercurial-scm.org/D2404?vs=6021&id=6025 REVISION DETAIL https://phab.mercurial-scm.org/D2404 AFFECTED FILES mercurial/util.py CHANGE DETAILS diff --git a/mercurial/util.py b/mercurial/util.py --- a/mercurial/util.py +++ b/mercurial/util.py @@ -371,6 +371,13 @@ This class lives in the 'util' module because it makes use of the 'os' module from the python stdlib. """ +def __new__(cls, fh): +# If we receive a fileobjectproxy, we need to use a variation of this +# class that notifies observers about activity. +if isinstance(fh, fileobjectproxy): +cls = observedbufferedinputpipe + +return super(bufferedinputpipe, cls).__new__(cls) def __init__(self, input): self._input = input @@ -451,6 +458,8 @@ self._lenbuf += len(data) self._buffer.append(data) +return data + def mmapread(fp): try: fd = getattr(fp, 'fileno', lambda: fp)() @@ -503,6 +512,8 @@ def __getattribute__(self, name): ours = { +r'_observer', + # IOBase r'close', # closed if a property @@ -637,6 +648,46 @@ return object.__getattribute__(self, r'_observedcall')( r'read1', *args, **kwargs) +class observedbufferedinputpipe(bufferedinputpipe): +"""A variation of bufferedinputpipe that is aware of fileobjectproxy. + +``bufferedinputpipe`` makes low-level calls to ``os.read()`` that +bypass ``fileobjectproxy``. Because of this, we need to make +``bufferedinputpipe`` aware of these operations. + +This variation of ``bufferedinputpipe`` can notify observers about +``os.read()`` events. It also re-publishes other events, such as +``read()`` and ``readline()``. +""" +def _fillbuffer(self): +res = super(observedbufferedinputpipe, self)._fillbuffer() + +fn = getattr(self._input._observer, r'osread', None) +if fn: +fn(res, _chunksize) + +return res + +# We use different observer methods because the operation isn't +# performed on the actual file object but on us. +def read(self, size): +res = super(observedbufferedinputpipe, self).read(size) + +fn = getattr(self._input._observer, r'bufferedread', None) +if fn: +fn(res, size) + +return res + +def readline(self, *args, **kwargs): +res = super(observedbufferedinputpipe, self).readline(*args, **kwargs) + +fn = getattr(self._input._observer, r'bufferedreadline', None) +if fn: +fn(res) + +return res + DATA_ESCAPE_MAP = {pycompat.bytechr(i): br'\x%02x' % i for i in range(256)} DATA_ESCAPE_MAP.update({ b'\\': b'', @@ -686,6 +737,16 @@ def flush(self, res): self.fh.write('%s> flush() -> %r\n' % (self.name, res)) +# For observedbufferedinputpipe. +def bufferedread(self, res, size): +self.fh.write('%s> bufferedread(%d) -> %d' % ( +self.name, size, len(res))) +self._writedata(res) + +def bufferedreadline(self, res): +self.fh.write('%s> bufferedreadline() -> %d' % (self.name, len(res))) +self._writedata(res) + def makeloggingfileobject(logh, fh, name, logdata=False): """Turn a file object into a logging file object.""" To: indygreg, #hg-reviewers Cc: mercurial-devel ___ Mercurial-devel mailing list Mercurial-devel@mercurial-scm.org https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel
D2406: debugcommands: allow sending of simple commands with debugwireproto
indygreg updated this revision to Diff 6026. indygreg edited the summary of this revision. REPOSITORY rHG Mercurial CHANGES SINCE LAST UPDATE https://phab.mercurial-scm.org/D2406?vs=6023&id=6026 REVISION DETAIL https://phab.mercurial-scm.org/D2406 AFFECTED FILES mercurial/debugcommands.py tests/test-ssh-proto.t CHANGE DETAILS diff --git a/tests/test-ssh-proto.t b/tests/test-ssh-proto.t --- a/tests/test-ssh-proto.t +++ b/tests/test-ssh-proto.t @@ -1,3 +1,23 @@ + $ cat > hgrc-sshv2 << EOF + > %include $HGRCPATH + > [experimental] + > sshpeer.advertise-v2 = true + > sshserver.support-v2 = true + > EOF + +Helper function to run protocol tests against multiple protocol versions. +This is easier than using #testcases because managing differences between +protocols with inline conditional output is hard to read. + + $ debugwireproto() { + > commands=`cat -` + > echo 'testing ssh1' + > echo "${commands}" | hg --verbose debugwireproto --localssh + > echo "" + > echo 'testing ssh2' + > echo "${commands}" | HGRCPATH=$TESTTMP/hgrc-sshv2 hg --verbose debugwireproto --localssh + > } + $ cat >> $HGRCPATH << EOF > [ui] > ssh = $PYTHON "$TESTDIR/dummyssh" @@ -1215,3 +1235,561 @@ e> read(-1) -> 49: e> malformed handshake protocol: missing pairs 81\n e> -\n + + $ cd .. + +Test listkeys for listing namespaces + + $ hg init empty + $ cd empty + $ debugwireproto << EOF + > command listkeys + > namespace namespaces + > EOF + testing ssh1 + creating ssh peer from handshake results + i> write(104) -> None: + i> hello\n + i> between\n + i> pairs 81\n + i> - + i> flush() -> None + o> readline() -> 4: + o> 384\n + o> readline() -> 384: + o> capabilities: lookup changegroupsubset branchmap pushkey known getbundle unbundlehash batch streamreqs=generaldelta,revlogv1 $USUAL_BUNDLE2_CAPS_SERVER$ unbundle=HG10GZ,HG10BZ,HG10UN\n + o> readline() -> 2: + o> 1\n + o> readline() -> 1: + o> \n + sending listkeys command + i> write(9) -> None: + i> listkeys\n + i> write(13) -> None: + i> namespace 10\n + i> write(10) -> None: namespaces + i> flush() -> None + o> bufferedreadline() -> 3: + o> 30\n + o> bufferedread(30) -> 30: + o> bookmarks \n + o> namespaces\n + o> phases + response: bookmarks \nnamespaces\nphases + + testing ssh2 + creating ssh peer from handshake results + i> write(171) -> None: + i> upgrade * proto=exp-ssh-v2-0001\n (glob) + i> hello\n + i> between\n + i> pairs 81\n + i> - + i> flush() -> None + o> readline() -> 62: + o> upgraded * exp-ssh-v2-0001\n (glob) + o> readline() -> 4: + o> 383\n + o> read(383) -> 383: capabilities: lookup changegroupsubset branchmap pushkey known getbundle unbundlehash batch streamreqs=generaldelta,revlogv1 $USUAL_BUNDLE2_CAPS_SERVER$ unbundle=HG10GZ,HG10BZ,HG10UN + o> read(1) -> 1: + o> \n + sending listkeys command + i> write(9) -> None: + i> listkeys\n + i> write(13) -> None: + i> namespace 10\n + i> write(10) -> None: namespaces + i> flush() -> None + o> bufferedreadline() -> 3: + o> 30\n + o> bufferedread(30) -> 30: + o> bookmarks \n + o> namespaces\n + o> phases + response: bookmarks \nnamespaces\nphases + + $ cd .. + +Test listkeys for bookmarks + + $ hg init bookmarkrepo + $ cd bookmarkrepo + $ echo 0 > foo + $ hg add foo + $ hg -q commit -m initial + $ echo 1 > foo + $ hg commit -m second + +With no bookmarks set + + $ debugwireproto << EOF + > command listkeys + > namespace bookmarks + > EOF + testing ssh1 + creating ssh peer from handshake results + i> write(104) -> None: + i> hello\n + i> between\n + i> pairs 81\n + i> - + i> flush() -> None + o> readline() -> 4: + o> 384\n + o> readline() -> 384: + o> capabilities: lookup changegroupsubset branchmap pushkey known getbundle unbundlehash batch streamreqs=generaldelta,revlogv1 $USUAL_BUNDLE2_CAPS_SERVER$ unbundle=HG10GZ,HG10BZ,HG10UN\n + o> readline() -> 2: + o> 1\n + o> readline() -> 1: + o> \n + sending listkeys command + i> write(9) -> None: + i> listkeys\n + i> write(12) -> None: + i> namespace 9\n + i> write(9) -> None: bookmarks + i> flush() -> None + o> bufferedreadline() -> 2: + o> 0\n + response: + + testing ssh2 + creating ssh peer from handshake results + i> write(171) -> None: + i> upgrade * proto=exp-ssh-v2-0001\n (glob) + i> hello\n + i> between\n + i> pairs 81\n + i> - + i> flush(
D2408: debugcommands: support for sending "batch" requests
indygreg created this revision. Herald added a subscriber: mercurial-devel. Herald added a reviewer: hg-reviewers. REVISION SUMMARY Let's teach `hg debugwireproto` to send "batch" requests. The easiest way to implement this was as a pair of instructions to begin and end a batched operation. Otherwise, we would have to reinvent the parsing wheel or factor out the parsing code. To prove it works, we add a batched request to test-ssh-proto.t. REPOSITORY rHG Mercurial REVISION DETAIL https://phab.mercurial-scm.org/D2408 AFFECTED FILES mercurial/debugcommands.py tests/test-ssh-proto.t CHANGE DETAILS diff --git a/tests/test-ssh-proto.t b/tests/test-ssh-proto.t --- a/tests/test-ssh-proto.t +++ b/tests/test-ssh-proto.t @@ -1793,3 +1793,105 @@ o> 15\n o> bufferedread(15) -> 15: publishingTrue response: publishing True + + $ cd .. + +Test batching of requests + + $ hg init batching + $ cd batching + $ echo 0 > foo + $ hg add foo + $ hg -q commit -m initial + $ hg phase --public + $ echo 1 > foo + $ hg commit -m 'commit 1' + $ hg -q up 0 + $ echo 2 > foo + $ hg commit -m 'commit 2' + created new head + $ hg book -r 1 bookA + $ hg book -r 2 bookB + + $ debugwireproto << EOF + > batchbegin + > command heads + > command listkeys + > namespace bookmarks + > command listkeys + > namespace phases + > batchsubmit + > EOF + testing ssh1 + creating ssh peer from handshake results + i> write(104) -> None: + i> hello\n + i> between\n + i> pairs 81\n + i> - + i> flush() -> None + o> readline() -> 4: + o> 384\n + o> readline() -> 384: + o> capabilities: lookup changegroupsubset branchmap pushkey known getbundle unbundlehash batch streamreqs=generaldelta,revlogv1 $USUAL_BUNDLE2_CAPS_SERVER$ unbundle=HG10GZ,HG10BZ,HG10UN\n + o> readline() -> 2: + o> 1\n + o> readline() -> 1: + o> \n + sending batch with 3 sub-commands + i> write(6) -> None: + i> batch\n + i> write(4) -> None: + i> * 0\n + i> write(8) -> None: + i> cmds 61\n + i> write(61) -> None: heads ;listkeys namespace=bookmarks;listkeys namespace=phases + i> flush() -> None + o> bufferedreadline() -> 4: + o> 278\n + o> bufferedread(278) -> 278: + o> bfebe6bd38eebc6f8202e419c1171268987ea6a6 4ee3fcef1c800fa2bf23e20af7c83ff111d9c7ab\n + o> ;bookA4ee3fcef1c800fa2bf23e20af7c83ff111d9c7ab\n + o> bookB bfebe6bd38eebc6f8202e419c1171268987ea6a6;4ee3fcef1c800fa2bf23e20af7c83ff111d9c7ab 1\n + o> bfebe6bd38eebc6f8202e419c1171268987ea6a6 1\n + o> publishingTrue + response #0: bfebe6bd38eebc6f8202e419c1171268987ea6a6 4ee3fcef1c800fa2bf23e20af7c83ff111d9c7ab\n + response #1: bookA 4ee3fcef1c800fa2bf23e20af7c83ff111d9c7ab\nbookB bfebe6bd38eebc6f8202e419c1171268987ea6a6 + response #2: 4ee3fcef1c800fa2bf23e20af7c83ff111d9c7ab 1\nbfebe6bd38eebc6f8202e419c1171268987ea6a6 1\npublishing True + + testing ssh2 + creating ssh peer from handshake results + i> write(171) -> None: + i> upgrade * proto=exp-ssh-v2-0001\n (glob) + i> hello\n + i> between\n + i> pairs 81\n + i> - + i> flush() -> None + o> readline() -> 62: + o> upgraded * exp-ssh-v2-0001\n (glob) + o> readline() -> 4: + o> 383\n + o> read(383) -> 383: capabilities: lookup changegroupsubset branchmap pushkey known getbundle unbundlehash batch streamreqs=generaldelta,revlogv1 $USUAL_BUNDLE2_CAPS_SERVER$ unbundle=HG10GZ,HG10BZ,HG10UN + o> read(1) -> 1: + o> \n + sending batch with 3 sub-commands + i> write(6) -> None: + i> batch\n + i> write(4) -> None: + i> * 0\n + i> write(8) -> None: + i> cmds 61\n + i> write(61) -> None: heads ;listkeys namespace=bookmarks;listkeys namespace=phases + i> flush() -> None + o> bufferedreadline() -> 4: + o> 278\n + o> bufferedread(278) -> 278: + o> bfebe6bd38eebc6f8202e419c1171268987ea6a6 4ee3fcef1c800fa2bf23e20af7c83ff111d9c7ab\n + o> ;bookA4ee3fcef1c800fa2bf23e20af7c83ff111d9c7ab\n + o> bookB bfebe6bd38eebc6f8202e419c1171268987ea6a6;4ee3fcef1c800fa2bf23e20af7c83ff111d9c7ab 1\n + o> bfebe6bd38eebc6f8202e419c1171268987ea6a6 1\n + o> publishingTrue + response #0: bfebe6bd38eebc6f8202e419c1171268987ea6a6 4ee3fcef1c800fa2bf23e20af7c83ff111d9c7ab\n + response #1: bookA 4ee3fcef1c800fa2bf23e20af7c83ff111d9c7ab\nbookB bfebe6bd38eebc6f8202e419c1171268987ea6a6 + response #2: 4ee3fcef1c800fa2bf23e20af7c83ff111d9c7ab 1\nbfebe6bd38eebc6f8202e419c1171268987ea6a6 1\npublishing True diff --git a/mercurial/debugcommands.py b/mercurial/debugcommands.py --- a/mercurial/debugcommands.py +++ b/mercurial/debugcommands.py @@ -2599,6 +2599,21 @@ Values are interpreted as Python b'' literal
D2404: util: enable observing of os.read() from bufferedinputpipe
indygreg planned changes to this revision. indygreg added a comment. I have some revisions to this... REPOSITORY rHG Mercurial REVISION DETAIL https://phab.mercurial-scm.org/D2404 To: indygreg, #hg-reviewers Cc: mercurial-devel ___ Mercurial-devel mailing list Mercurial-devel@mercurial-scm.org https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel
mercurial@36363: 5 new changesets
5 new changesets in mercurial: https://www.mercurial-scm.org/repo/hg/rev/df3f7f00a3fc changeset: 36359:df3f7f00a3fc user:Boris Feld date:Wed Feb 21 12:13:16 2018 +0100 summary: perfbranchmap: display 'unfiltered' for unfiltered performance https://www.mercurial-scm.org/repo/hg/rev/c25290b98190 changeset: 36360:c25290b98190 user:Boris Feld date:Wed Feb 21 11:43:12 2018 +0100 summary: perfbranchmap: allow to select the filter to benchmark https://www.mercurial-scm.org/repo/hg/rev/a2d11d23bb25 changeset: 36361:a2d11d23bb25 user:Boris Feld date:Mon Feb 05 15:03:51 2018 +0100 summary: patches: release the GIL while applying the patch https://www.mercurial-scm.org/repo/hg/rev/01e29e885600 changeset: 36362:01e29e885600 user:Gregory Szorc date:Wed Feb 21 13:41:20 2018 -0800 summary: util: add a file object proxy that can read at most N bytes https://www.mercurial-scm.org/repo/hg/rev/7f8f74531b0b changeset: 36363:7f8f74531b0b bookmark:@ tag: tip user:Gregory Szorc date:Mon Feb 19 15:57:28 2018 -0800 summary: sshpeer: rename _recv and _send to _readframed and _writeframed -- Repository URL: https://www.mercurial-scm.org/repo/hg ___ Mercurial-devel mailing list Mercurial-devel@mercurial-scm.org https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel
D2406: debugcommands: allow sending of simple commands with debugwireproto
indygreg created this revision. Herald added a subscriber: mercurial-devel. Herald added a reviewer: hg-reviewers. REVISION SUMMARY Previously, we only had support for low-level "raw" operations. A goal of `hg debugwireproto` is to allow easily performing higher-level primitives, such as sending a wire protocol command and reading its response. We implement a "command" action that does just this. Currently, we only support simple commands (those without payloads). We have basic support for sending command arguments. We don't yet support sending dictionary arguments. This will be implemented later. REPOSITORY rHG Mercurial REVISION DETAIL https://phab.mercurial-scm.org/D2406 AFFECTED FILES mercurial/debugcommands.py CHANGE DETAILS diff --git a/mercurial/debugcommands.py b/mercurial/debugcommands.py --- a/mercurial/debugcommands.py +++ b/mercurial/debugcommands.py @@ -2584,6 +2584,21 @@ Behaves like ``raw`` except flushes output afterwards. +command +--- + +Send a request to run a named command, whose name follows the ``command`` +string. + +Arguments to the command are defined as lines in this block. The format of +each line is `` ``. e.g.:: + + command listkeys + namespace bookmarks + +Values are interpreted as Python b'' literals. This allows encoding +special byte sequences via backslash escaping. + close - @@ -2683,6 +2698,24 @@ stdin.flush() elif action == 'flush': stdin.flush() +elif action.startswith('command'): +if not peer: +raise error.Abort(_('cannot send commands unless peer instance ' +'is available')) + +command = action.split(' ', 1)[1] + +args = {} +for line in lines: +fields = line.lstrip().split() +if len(fields) == 2: +key, value = fields +args[key] = ast.literal_eval(b'b"%s"' % value) +else: +raise error.Abort(_('value-less arguments not supported')) + +peer._call(command, **args) + elif action == 'close': peer.close() elif action == 'readavailable': To: indygreg, #hg-reviewers Cc: mercurial-devel ___ Mercurial-devel mailing list Mercurial-devel@mercurial-scm.org https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel
D2405: wireproto: sort response to listkeys
indygreg created this revision. Herald added a subscriber: mercurial-devel. Herald added a reviewer: hg-reviewers. REVISION SUMMARY The listkeys protocol is defined to produce a dictionary. pushkey.decodekeys() uses a plain dict to hold the decoded results of the wire protocol response. So order should not matter. Upcoming tests will verify low-level output of wire protocol commands and the non-deterministic emitting of listkeys was causing intermittent failures. So we make the output of listkeys deterministic. REPOSITORY rHG Mercurial REVISION DETAIL https://phab.mercurial-scm.org/D2405 AFFECTED FILES mercurial/wireproto.py CHANGE DETAILS diff --git a/mercurial/wireproto.py b/mercurial/wireproto.py --- a/mercurial/wireproto.py +++ b/mercurial/wireproto.py @@ -916,7 +916,7 @@ @wireprotocommand('listkeys', 'namespace') def listkeys(repo, proto, namespace): -d = repo.listkeys(encoding.tolocal(namespace)).items() +d = sorted(repo.listkeys(encoding.tolocal(namespace)).items()) return bytesresponse(pushkeymod.encodekeys(d)) @wireprotocommand('lookup', 'key') To: indygreg, #hg-reviewers Cc: mercurial-devel ___ Mercurial-devel mailing list Mercurial-devel@mercurial-scm.org https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel
D2404: util: enable observing of os.read() from bufferedinputpipe
indygreg created this revision. Herald added a subscriber: mercurial-devel. Herald added a reviewer: hg-reviewers. REVISION SUMMARY Our file object proxy is useful. But it doesn't capture all I/O. The "os" module offers low-level interfaces to various system calls. For example, os.read() exposes read(2) to read from a file descriptor. This commit teaches the bufferedinputpipe to be aware of when a file object is a fileobjectproxy and to signal into its observer when an os.read() operation is performed. If we end up doing this for multiple os.* functions, we may want a more generic way to do this wrapping and signaling. But until then, a one-off seems appropriate. This change will allow us to observe I/O on non-raw sshpeer instances, since they convert stdout into a bufferedinputpipe. REPOSITORY rHG Mercurial REVISION DETAIL https://phab.mercurial-scm.org/D2404 AFFECTED FILES mercurial/util.py CHANGE DETAILS diff --git a/mercurial/util.py b/mercurial/util.py --- a/mercurial/util.py +++ b/mercurial/util.py @@ -451,6 +451,13 @@ self._lenbuf += len(data) self._buffer.append(data) +# If this is our special proxied file object class, log this I/O, +# since os.read() bypasses the proxy. +if isinstance(self._input, fileobjectproxy): +fn = getattr(self._input._observer, r'osread', None) +if fn: +self._input._observer.osread(data, _chunksize) + def mmapread(fp): try: fd = getattr(fp, 'fileno', lambda: fp)() @@ -503,6 +510,8 @@ def __getattribute__(self, name): ours = { +r'_observer', + # IOBase r'close', # closed if a property @@ -679,6 +688,10 @@ self.fh.write('%s> readline() -> %d' % (self.name, len(res))) self._writedata(res) +def osread(self, res, size): +self.fh.write('%s> osread(%d) -> %d' % (self.name, size, len(res))) +self._writedata(res) + def write(self, res, data): self.fh.write('%s> write(%d) -> %r' % (self.name, len(data), res)) self._writedata(data) To: indygreg, #hg-reviewers Cc: mercurial-devel ___ Mercurial-devel mailing list Mercurial-devel@mercurial-scm.org https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel
D2407: tests: add low-level SSH protocol tests for listkeys
indygreg created this revision. Herald added a subscriber: mercurial-devel. Herald added a reviewer: hg-reviewers. REVISION SUMMARY We previously lacked test coverage of the low-level output of the "listkeys" wire protocol command. We add basic testing for the "namespaces," "bookmarks," and "phases" pushkey namespaces. We introduce a helper shell function for running tests with version 1 and 2 of the SSH protocol as separate invocations. We could have used #testcases. However, as the protocols diverge, managing differences with inline (sshv1 !) syntax will quickly become unwieldy. The output is much easier to reason about and manage when each protocol version is self-contained within a continuous block. REPOSITORY rHG Mercurial REVISION DETAIL https://phab.mercurial-scm.org/D2407 AFFECTED FILES tests/test-ssh-proto.t CHANGE DETAILS diff --git a/tests/test-ssh-proto.t b/tests/test-ssh-proto.t --- a/tests/test-ssh-proto.t +++ b/tests/test-ssh-proto.t @@ -1,3 +1,23 @@ + $ cat > hgrc-sshv2 << EOF + > %include $HGRCPATH + > [experimental] + > sshpeer.advertise-v2 = true + > sshserver.support-v2 = true + > EOF + +Helper function to run protocol tests against multiple protocol versions. +This is easier than using #testcases because managing differences between +protocols with inline conditional output is hard to read. + + $ debugwireproto() { + > commands=`cat -` + > echo 'testing ssh1' + > echo "${commands}" | hg --verbose debugwireproto --localssh + > echo "" + > echo 'testing ssh2' + > echo "${commands}" | HGRCPATH=$TESTTMP/hgrc-sshv2 hg --verbose debugwireproto --localssh + > } + $ cat >> $HGRCPATH << EOF > [ui] > ssh = $PYTHON "$TESTDIR/dummyssh" @@ -1215,3 +1235,521 @@ e> read(-1) -> 49: e> malformed handshake protocol: missing pairs 81\n e> -\n + + $ cd .. + +Test listkeys for listing namespaces + + $ hg init empty + $ cd empty + $ debugwireproto << EOF + > command listkeys + > namespace namespaces + > EOF + testing ssh1 + creating ssh peer from handshake results + i> write(104) -> None: + i> hello\n + i> between\n + i> pairs 81\n + i> - + i> flush() -> None + o> readline() -> 4: + o> 384\n + o> readline() -> 384: + o> capabilities: lookup changegroupsubset branchmap pushkey known getbundle unbundlehash batch streamreqs=generaldelta,revlogv1 $USUAL_BUNDLE2_CAPS_SERVER$ unbundle=HG10GZ,HG10BZ,HG10UN\n + o> readline() -> 2: + o> 1\n + o> readline() -> 1: + o> \n + i> write(9) -> None: + i> listkeys\n + i> write(13) -> None: + i> namespace 10\n + i> write(10) -> None: namespaces + i> flush() -> None + o> osread(4096) -> 33: + o> 30\n + o> bookmarks \n + o> namespaces\n + o> phases + + testing ssh2 + creating ssh peer from handshake results + i> write(171) -> None: + i> upgrade * proto=exp-ssh-v2-0001\n (glob) + i> hello\n + i> between\n + i> pairs 81\n + i> - + i> flush() -> None + o> readline() -> 62: + o> upgraded * exp-ssh-v2-0001\n (glob) + o> readline() -> 4: + o> 383\n + o> read(383) -> 383: capabilities: lookup changegroupsubset branchmap pushkey known getbundle unbundlehash batch streamreqs=generaldelta,revlogv1 $USUAL_BUNDLE2_CAPS_SERVER$ unbundle=HG10GZ,HG10BZ,HG10UN + o> read(1) -> 1: + o> \n + i> write(9) -> None: + i> listkeys\n + i> write(13) -> None: + i> namespace 10\n + i> write(10) -> None: namespaces + i> flush() -> None + o> osread(4096) -> 33: + o> 30\n + o> bookmarks \n + o> namespaces\n + o> phases + + $ cd .. + +Test listkeys for bookmarks + + $ hg init bookmarkrepo + $ cd bookmarkrepo + $ echo 0 > foo + $ hg add foo + $ hg -q commit -m initial + $ echo 1 > foo + $ hg commit -m second + +With no bookmarks set + + $ debugwireproto << EOF + > command listkeys + > namespace bookmarks + > EOF + testing ssh1 + creating ssh peer from handshake results + i> write(104) -> None: + i> hello\n + i> between\n + i> pairs 81\n + i> - + i> flush() -> None + o> readline() -> 4: + o> 384\n + o> readline() -> 384: + o> capabilities: lookup changegroupsubset branchmap pushkey known getbundle unbundlehash batch streamreqs=generaldelta,revlogv1 $USUAL_BUNDLE2_CAPS_SERVER$ unbundle=HG10GZ,HG10BZ,HG10UN\n + o> readline() -> 2: + o> 1\n + o> readline() -> 1: + o> \n + i> write(9) -> None: + i> listkeys\n + i> write(12) -> None: + i> namespace 9\n + i> write(9) -> None: bookmarks + i> flush() -> None + o> osread(4096) -> 2: + o> 0\n + + testing ssh2 + creating ssh peer from handshake
[PATCH 09 of 11] py3: add missing b'' in test-arbitraryfilectx.t
# HG changeset patch # User Pulkit Goyal <7895pul...@gmail.com> # Date 1519389740 -19800 # Fri Feb 23 18:12:20 2018 +0530 # Node ID 1e72b28e804b014573a8e156ae46129f44979c51 # Parent a2b469c5995b4c2602f1bb1c3959d67ee9c08141 py3: add missing b'' in test-arbitraryfilectx.t # skip-blame as just b'' prefix diff --git a/tests/test-arbitraryfilectx.t b/tests/test-arbitraryfilectx.t --- a/tests/test-arbitraryfilectx.t +++ b/tests/test-arbitraryfilectx.t @@ -5,7 +5,7 @@ Setup: > from mercurial import commands, context, registrar > cmdtable = {} > command = registrar.command(cmdtable) - > @command(b'eval', [], 'hg eval CMD') + > @command(b'eval', [], b'hg eval CMD') > def eval_(ui, repo, *cmds, **opts): > cmd = b" ".join(cmds) > res = str(eval(cmd, globals(), locals())) ___ Mercurial-devel mailing list Mercurial-devel@mercurial-scm.org https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel
[PATCH 03 of 11] py3: use pycompat.bytestr to convert str returned by getpass.getuser to bytes
# HG changeset patch # User Pulkit Goyal <7895pul...@gmail.com> # Date 1519386265 -19800 # Fri Feb 23 17:14:25 2018 +0530 # Node ID dbcf3a406cf79d296d7e29ea2786fd647facd367 # Parent 70c096e42cb8a63a62efe69b87cd7ccc5c539dba py3: use pycompat.bytestr to convert str returned by getpass.getuser to bytes diff --git a/hgext/acl.py b/hgext/acl.py --- a/hgext/acl.py +++ b/hgext/acl.py @@ -200,6 +200,7 @@ from mercurial import ( error, extensions, match, +pycompat, registrar, util, ) @@ -340,7 +341,7 @@ def hook(ui, repo, hooktype, node=None, user = urlreq.unquote(url[3]) if user is None: -user = getpass.getuser() +user = pycompat.bytestr(getpass.getuser()) ui.debug('acl: checking access for user "%s"\n' % user) ___ Mercurial-devel mailing list Mercurial-devel@mercurial-scm.org https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel
[PATCH 10 of 11] py3: replace types.NoneType with type(None)
# HG changeset patch # User Pulkit Goyal <7895pul...@gmail.com> # Date 1519390431 -19800 # Fri Feb 23 18:23:51 2018 +0530 # Node ID c8124f3591d41903f701df60f6786db8c77fb13d # Parent 1e72b28e804b014573a8e156ae46129f44979c51 py3: replace types.NoneType with type(None) types.NoneType is not present in Python 3. diff --git a/mercurial/fancyopts.py b/mercurial/fancyopts.py --- a/mercurial/fancyopts.py +++ b/mercurial/fancyopts.py @@ -9,7 +9,6 @@ from __future__ import absolute_import import abc import functools -import types from .i18n import _ from . import ( @@ -222,7 +221,7 @@ class customopt(object): class _simpleopt(customopt): def _isboolopt(self): -return isinstance(self.defaultvalue, (bool, types.NoneType)) +return isinstance(self.defaultvalue, (bool, type(None))) def newstate(self, oldstate, newparam, abort): return newparam ___ Mercurial-devel mailing list Mercurial-devel@mercurial-scm.org https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel
[PATCH 08 of 11] py3: pass ctx.rev() instead of ctx in range()
# HG changeset patch # User Pulkit Goyal <7895pul...@gmail.com> # Date 1519389273 -19800 # Fri Feb 23 18:04:33 2018 +0530 # Node ID a2b469c5995b4c2602f1bb1c3959d67ee9c08141 # Parent 457aea9470d03f8e69c873b9aec845256abf9023 py3: pass ctx.rev() instead of ctx in range() diff --git a/hgext/acl.py b/hgext/acl.py --- a/hgext/acl.py +++ b/hgext/acl.py @@ -356,7 +356,7 @@ def hook(ui, repo, hooktype, node=None, allow = buildmatch(ui, repo, user, 'acl.allow') deny = buildmatch(ui, repo, user, 'acl.deny') -for rev in xrange(repo[node], len(repo)): +for rev in xrange(repo[node].rev(), len(repo)): ctx = repo[rev] branch = ctx.branch() if denybranches and denybranches(branch): ___ Mercurial-devel mailing list Mercurial-devel@mercurial-scm.org https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel
[PATCH 06 of 11] py3: add b'' prefixes in test-revset.t
# HG changeset patch # User Pulkit Goyal <7895pul...@gmail.com> # Date 1519387005 -19800 # Fri Feb 23 17:26:45 2018 +0530 # Node ID 1e72a81291eaee764c8cf7d0a40ea950bf92735c # Parent 66968eaf19d62767cbdb446d0c173e67d5a925ce py3: add b'' prefixes in test-revset.t # skip-blame because it's just b'' diff --git a/tests/test-revset.t b/tests/test-revset.t --- a/tests/test-revset.t +++ b/tests/test-revset.t @@ -16,7 +16,7 @@ >return baseset() > return baseset([3,3,2,2]) > - > mercurial.revset.symbols['r3232'] = r3232 + > mercurial.revset.symbols[b'r3232'] = r3232 > EOF $ cat >> $HGRCPATH << EOF > [extensions] @@ -47,8 +47,8 @@ these predicates use '\0' as a separator > cmdtable = {} > command = registrar.command(cmdtable) > @command(b'debugrevlistspec', - > [('', 'optimize', None, 'print parsed tree after optimizing'), - > ('', 'bin', None, 'unhexlify arguments')]) + > [(b'', b'optimize', None, b'print parsed tree after optimizing'), + > (b'', b'bin', None, b'unhexlify arguments')]) > def debugrevlistspec(ui, repo, fmt, *args, **opts): > if opts['bin']: > args = map(nodemod.bin, args) @@ -58,14 +58,14 @@ these predicates use '\0' as a separator > ui.note(revsetlang.prettyformat(tree), "\n") > if opts["optimize"]: > opttree = revsetlang.optimize(revsetlang.analyze(tree)) - > ui.note("* optimized:\n", revsetlang.prettyformat(opttree), - > "\n") + > ui.note(b"* optimized:\n", revsetlang.prettyformat(opttree), + > b"\n") > func = revset.match(ui, expr, repo) > revs = func(repo) > if ui.verbose: - > ui.note("* set:\n", smartset.prettyformat(revs), "\n") + > ui.note(b"* set:\n", smartset.prettyformat(revs), b"\n") > for c in revs: - > ui.write("%s\n" % c) + > ui.write(b"%s\n" % c) > EOF $ cat <> $HGRCPATH > [extensions] ___ Mercurial-devel mailing list Mercurial-devel@mercurial-scm.org https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel
[PATCH 04 of 11] py3: fix keyword arguments handling in hgext/acl.py
# HG changeset patch # User Pulkit Goyal <7895pul...@gmail.com> # Date 1519386336 -19800 # Fri Feb 23 17:15:36 2018 +0530 # Node ID 6610c379cb0f90d9dbdc787e3d7982fce07ded86 # Parent dbcf3a406cf79d296d7e29ea2786fd647facd367 py3: fix keyword arguments handling in hgext/acl.py # skip-blame because we added r'' prefixes diff --git a/hgext/acl.py b/hgext/acl.py --- a/hgext/acl.py +++ b/hgext/acl.py @@ -335,8 +335,8 @@ def hook(ui, repo, hooktype, node=None, return user = None -if source == 'serve' and 'url' in kwargs: -url = kwargs['url'].split(':') +if source == 'serve' and r'url' in kwargs: +url = kwargs[r'url'].split(':') if url[0] == 'remote' and url[1].startswith('http'): user = urlreq.unquote(url[3]) ___ Mercurial-devel mailing list Mercurial-devel@mercurial-scm.org https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel
[PATCH 02 of 11] py3: add b'' prefixes in test-abort-checkin.t
# HG changeset patch # User Pulkit Goyal <7895pul...@gmail.com> # Date 1519385237 -19800 # Fri Feb 23 16:57:17 2018 +0530 # Node ID 70c096e42cb8a63a62efe69b87cd7ccc5c539dba # Parent ea8a43155c3d51289609afeda8659b4d604b2e1e py3: add b'' prefixes in test-abort-checkin.t # skip-blame because we just added a b'' prefix. diff --git a/tests/test-abort-checkin.t b/tests/test-abort-checkin.t --- a/tests/test-abort-checkin.t +++ b/tests/test-abort-checkin.t @@ -1,9 +1,9 @@ $ cat > abortcommit.py < from mercurial import error > def hook(**args): - > raise error.Abort("no commits allowed") + > raise error.Abort(b"no commits allowed") > def reposetup(ui, repo): - > repo.ui.setconfig("hooks", "pretxncommit.nocommits", hook) + > repo.ui.setconfig(b"hooks", b"pretxncommit.nocommits", hook) > EOF $ abspath=`pwd`/abortcommit.py ___ Mercurial-devel mailing list Mercurial-devel@mercurial-scm.org https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel
[PATCH 11 of 11] py3: make regex bytes in hgweb/webcommands.py
# HG changeset patch # User Pulkit Goyal <7895pul...@gmail.com> # Date 1519391846 -19800 # Fri Feb 23 18:47:26 2018 +0530 # Node ID f22ce7b97364996db41168e4386329a4b223e0ed # Parent c8124f3591d41903f701df60f6786db8c77fb13d py3: make regex bytes in hgweb/webcommands.py # skip-blame because just b'' prefix diff --git a/mercurial/hgweb/webcommands.py b/mercurial/hgweb/webcommands.py --- a/mercurial/hgweb/webcommands.py +++ b/mercurial/hgweb/webcommands.py @@ -1116,7 +1116,7 @@ def archive(web, req, tmpl): msg = 'Archive type not allowed: %s' % type_ raise ErrorResponse(HTTP_FORBIDDEN, msg) -reponame = re.sub(r"\W+", "-", os.path.basename(web.reponame)) +reponame = re.sub(br"\W+", "-", os.path.basename(web.reponame)) cnode = web.repo.lookup(key) arch_version = key if cnode == key or key == 'tip': ___ Mercurial-devel mailing list Mercurial-devel@mercurial-scm.org https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel
[PATCH 07 of 11] py3: add b'' prefixes in test-alias.t
# HG changeset patch # User Pulkit Goyal <7895pul...@gmail.com> # Date 1519389238 -19800 # Fri Feb 23 18:03:58 2018 +0530 # Node ID 457aea9470d03f8e69c873b9aec845256abf9023 # Parent 1e72a81291eaee764c8cf7d0a40ea950bf92735c py3: add b'' prefixes in test-alias.t # skip-blame as it's just b'' prefixes diff --git a/tests/test-alias.t b/tests/test-alias.t --- a/tests/test-alias.t +++ b/tests/test-alias.t @@ -548,12 +548,12 @@ environment variable changes in alias co > from mercurial import cmdutil, commands, registrar > cmdtable = {} > command = registrar.command(cmdtable) - > @command('expandalias') + > @command(b'expandalias') > def expandalias(ui, repo, name): > alias = cmdutil.findcmd(name, commands.table)[1][0] - > ui.write('%s args: %s\n' % (name, ' '.join(alias.args))) + > ui.write(b'%s args: %s\n' % (name, b' '.join(alias.args))) > os.environ['COUNT'] = '2' - > ui.write('%s args: %s (with COUNT=2)\n' % (name, ' '.join(alias.args))) + > ui.write(b'%s args: %s (with COUNT=2)\n' % (name, b' '.join(alias.args))) > EOF $ cat >> $HGRCPATH <<'EOF' ___ Mercurial-devel mailing list Mercurial-devel@mercurial-scm.org https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel
[PATCH 05 of 11] py3: make sure we use bytes in generate-working-copy-states.py
# HG changeset patch # User Pulkit Goyal <7895pul...@gmail.com> # Date 1519386951 -19800 # Fri Feb 23 17:25:51 2018 +0530 # Node ID 66968eaf19d62767cbdb446d0c173e67d5a925ce # Parent 6610c379cb0f90d9dbdc787e3d7982fce07ded86 py3: make sure we use bytes in generate-working-copy-states.py diff --git a/tests/generate-working-copy-states.py b/tests/generate-working-copy-states.py --- a/tests/generate-working-copy-states.py +++ b/tests/generate-working-copy-states.py @@ -42,12 +42,12 @@ import sys def generatestates(maxchangesets, parentcontents): depth = len(parentcontents) if depth == maxchangesets + 1: -for tracked in ('untracked', 'tracked'): -filename = "_".join([(content is None and 'missing' or content) for - content in parentcontents]) + "-" + tracked +for tracked in (b'untracked', b'tracked'): +filename = b"_".join([(content is None and b'missing' or content) +for content in parentcontents]) + b"-" + tracked yield (filename, parentcontents) else: -for content in ({None, 'content' + str(depth + 1)} | +for content in ({None, b'content' + (b"%d" % (depth + 1))} | set(parentcontents)): for combination in generatestates(maxchangesets, parentcontents + [content]): @@ -71,7 +71,7 @@ for filename, states in combinations: if depth == 'wc': # Make sure there is content so the file gets written and can be # tracked. It will be deleted outside of this script. -content.append((filename, states[maxchangesets] or 'TOBEDELETED')) +content.append((filename, states[maxchangesets] or b'TOBEDELETED')) else: content.append((filename, states[int(depth) - 1])) else: @@ -82,7 +82,7 @@ for filename, states in combinations: for filename, data in content: if data is not None: f = open(filename, 'wb') -f.write(data + '\n') +f.write(data + b'\n') f.close() elif os.path.exists(filename): os.remove(filename) ___ Mercurial-devel mailing list Mercurial-devel@mercurial-scm.org https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel
[PATCH 01 of 11] py3: add b'' prefixes in test-dispatch.py
# HG changeset patch # User Pulkit Goyal <7895pul...@gmail.com> # Date 1519236803 -19800 # Wed Feb 21 23:43:23 2018 +0530 # Node ID ea8a43155c3d51289609afeda8659b4d604b2e1e # Parent b8d0761a85c7421071750de23228415306852d69 py3: add b'' prefixes in test-dispatch.py # skip-blame because this is just adding b'' prefixes diff --git a/tests/test-dispatch.py b/tests/test-dispatch.py --- a/tests/test-dispatch.py +++ b/tests/test-dispatch.py @@ -9,27 +9,27 @@ def testdispatch(cmd): Prints command and result value, but does not handle quoting. """ -print("running: %s" % (cmd,)) +print(b"running: %s" % (cmd,)) req = dispatch.request(cmd.split()) result = dispatch.dispatch(req) -print("result: %r" % (result,)) +print(b"result: %r" % (result,)) -testdispatch("init test1") +testdispatch(b"init test1") os.chdir('test1') # create file 'foo', add and commit f = open('foo', 'wb') -f.write('foo\n') +f.write(b'foo\n') f.close() -testdispatch("add foo") -testdispatch("commit -m commit1 -d 2000-01-01 foo") +testdispatch(b"add foo") +testdispatch(b"commit -m commit1 -d 2000-01-01 foo") # append to file 'foo' and commit f = open('foo', 'ab') -f.write('bar\n') +f.write(b'bar\n') f.close() -testdispatch("commit -m commit2 -d 2000-01-02 foo") +testdispatch(b"commit -m commit2 -d 2000-01-02 foo") # check 88803a69b24 (fancyopts modified command table) -testdispatch("log -r 0") -testdispatch("log -r tip") +testdispatch(b"log -r 0") +testdispatch(b"log -r tip") ___ Mercurial-devel mailing list Mercurial-devel@mercurial-scm.org https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel
D2393: cleanup: say goodbye to manifestv2 format
This revision was automatically updated to reflect the committed changes. Closed by commit rHG0147a4730420: cleanup: say goodbye to manifestv2 format (authored by durin42, committed by ). REPOSITORY rHG Mercurial CHANGES SINCE LAST UPDATE https://phab.mercurial-scm.org/D2393?vs=6019&id=6020 REVISION DETAIL https://phab.mercurial-scm.org/D2393 AFFECTED FILES mercurial/configitems.py mercurial/help/internals/requirements.txt mercurial/localrepo.py mercurial/manifest.py mercurial/upgrade.py tests/test-manifest.py tests/test-manifestv2.t tests/test-upgrade-repo.t CHANGE DETAILS diff --git a/tests/test-upgrade-repo.t b/tests/test-upgrade-repo.t --- a/tests/test-upgrade-repo.t +++ b/tests/test-upgrade-repo.t @@ -31,23 +31,18 @@ abort: cannot upgrade repository; unsupported source requirement: shared [255] -Do not yet support upgrading manifestv2 and treemanifest repos - - $ hg --config experimental.manifestv2=true init manifestv2 - $ hg -R manifestv2 debugupgraderepo - abort: cannot upgrade repository; unsupported source requirement: manifestv2 - [255] +Do not yet support upgrading treemanifest repos $ hg --config experimental.treemanifest=true init treemanifest $ hg -R treemanifest debugupgraderepo abort: cannot upgrade repository; unsupported source requirement: treemanifest [255] -Cannot add manifestv2 or treemanifest requirement during upgrade +Cannot add treemanifest requirement during upgrade $ hg init disallowaddedreq - $ hg -R disallowaddedreq --config experimental.manifestv2=true --config experimental.treemanifest=true debugupgraderepo - abort: cannot upgrade repository; do not support adding requirement: manifestv2, treemanifest + $ hg -R disallowaddedreq --config experimental.treemanifest=true debugupgraderepo + abort: cannot upgrade repository; do not support adding requirement: treemanifest [255] An upgrade of a repository created with recommended settings only suggests optimizations diff --git a/tests/test-manifestv2.t b/tests/test-manifestv2.t deleted file mode 100644 --- a/tests/test-manifestv2.t +++ /dev/null @@ -1,102 +0,0 @@ -Create repo with old manifest - - $ cat << EOF >> $HGRCPATH - > [format] - > usegeneraldelta=yes - > EOF - - $ hg init existing - $ cd existing - $ echo footext > foo - $ hg add foo - $ hg commit -m initial - -We're using v1, so no manifestv2 entry is in requires yet. - - $ grep manifestv2 .hg/requires - [1] - -Let's clone this with manifestv2 enabled to switch to the new format for -future commits. - - $ cd .. - $ hg clone --pull existing new --config experimental.manifestv2=1 - requesting all changes - adding changesets - adding manifests - adding file changes - added 1 changesets with 1 changes to 1 files - new changesets 0fc9a4fafa44 - updating to branch default - 1 files updated, 0 files merged, 0 files removed, 0 files unresolved - $ cd new - -Check that entry was added to .hg/requires. - - $ grep manifestv2 .hg/requires - manifestv2 - -Make a new commit. - - $ echo newfootext > foo - $ hg commit -m new - -Check that the manifest actually switched to v2. - - $ hg debugdata -m 0 - foo\x0021e958b1dca695a60ee2e9cf151753204ee0f9e9 (esc) - - $ hg debugdata -m 1 - \x00 (esc) - \x00foo\x00 (esc) - I\xab\x7f\xb8(\x83\xcas\x15\x9d\xc2\xd3\xd3:5\x08\xbad5_ (esc) - -Check that manifestv2 is used if the requirement is present, even if it's -disabled in the config. - - $ echo newerfootext > foo - $ hg --config experimental.manifestv2=False commit -m newer - - $ hg debugdata -m 2 - \x00 (esc) - \x00foo\x00 (esc) - \xa6\xb1\xfb\xef]\x91\xa1\x19`\xf3.#\x90S\xf8\x06 \xe2\x19\x00 (esc) - -Check that we can still read v1 manifests. - - $ hg files -r 0 - foo - - $ cd .. - -Check that entry is added to .hg/requires on repo creation - - $ hg --config experimental.manifestv2=True init repo - $ cd repo - $ grep manifestv2 .hg/requires - manifestv2 - -Set up simple repo - - $ echo a > file1 - $ echo b > file2 - $ echo c > file3 - $ hg ci -Aqm 'initial' - $ echo d > file2 - $ hg ci -m 'modify file2' - -Check that 'hg verify', which uses manifest.readdelta(), works - - $ hg verify - checking changesets - checking manifests - crosschecking files in changesets and manifests - checking files - 3 files, 2 changesets, 4 total revisions - -Check that manifest revlog is smaller than for v1 - - $ hg debugindex -m - revoffset length delta linkrev nodeid p1 p2 - 0 0 81 -1 0 57361477c778 - 181 33 0 1 aeaab5a2ef74 57361477c778 diff --git a/tests/test-manifest.py b/tests/test-manifest.py --- a/tests/test-manifest.py +++ b/tests/test-manifest.py @@ -11,7 +11,6 @@ ) EMTPY_MANIFEST = b'' -EMTPY_MANIFEST_V2 = b'\0\n' HASH_1 = b'1' * 40 BIN_HASH_1 = binascii.unhexlify(HASH_1) @@ -28,42 +27,6 @@ b'flag2': b'l', } -# Same dat
D2394: histedit: make histedit's commands accept revsets (issue5746)
krbullock added a comment. Oh sorry, I see you're already on the case. Carry on! REPOSITORY rHG Mercurial REVISION DETAIL https://phab.mercurial-scm.org/D2394 To: sangeet259, durin42, #hg-reviewers Cc: krbullock, rishabhmadan96, mercurial-devel ___ Mercurial-devel mailing list Mercurial-devel@mercurial-scm.org https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel
D2394: histedit: make histedit's commands accept revsets (issue5746)
krbullock added a comment. Can we get some test coverage on this? REPOSITORY rHG Mercurial REVISION DETAIL https://phab.mercurial-scm.org/D2394 To: sangeet259, durin42, #hg-reviewers Cc: krbullock, rishabhmadan96, mercurial-devel ___ Mercurial-devel mailing list Mercurial-devel@mercurial-scm.org https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel
D2393: cleanup: say goodbye to manifestv2 format
durin42 updated this revision to Diff 6019. REPOSITORY rHG Mercurial CHANGES SINCE LAST UPDATE https://phab.mercurial-scm.org/D2393?vs=6006&id=6019 REVISION DETAIL https://phab.mercurial-scm.org/D2393 AFFECTED FILES mercurial/configitems.py mercurial/help/internals/requirements.txt mercurial/localrepo.py mercurial/manifest.py mercurial/upgrade.py tests/test-manifest.py tests/test-manifestv2.t tests/test-upgrade-repo.t CHANGE DETAILS diff --git a/tests/test-upgrade-repo.t b/tests/test-upgrade-repo.t --- a/tests/test-upgrade-repo.t +++ b/tests/test-upgrade-repo.t @@ -31,23 +31,18 @@ abort: cannot upgrade repository; unsupported source requirement: shared [255] -Do not yet support upgrading manifestv2 and treemanifest repos - - $ hg --config experimental.manifestv2=true init manifestv2 - $ hg -R manifestv2 debugupgraderepo - abort: cannot upgrade repository; unsupported source requirement: manifestv2 - [255] +Do not yet support upgrading treemanifest repos $ hg --config experimental.treemanifest=true init treemanifest $ hg -R treemanifest debugupgraderepo abort: cannot upgrade repository; unsupported source requirement: treemanifest [255] -Cannot add manifestv2 or treemanifest requirement during upgrade +Cannot add treemanifest requirement during upgrade $ hg init disallowaddedreq - $ hg -R disallowaddedreq --config experimental.manifestv2=true --config experimental.treemanifest=true debugupgraderepo - abort: cannot upgrade repository; do not support adding requirement: manifestv2, treemanifest + $ hg -R disallowaddedreq --config experimental.treemanifest=true debugupgraderepo + abort: cannot upgrade repository; do not support adding requirement: treemanifest [255] An upgrade of a repository created with recommended settings only suggests optimizations diff --git a/tests/test-manifestv2.t b/tests/test-manifestv2.t deleted file mode 100644 --- a/tests/test-manifestv2.t +++ /dev/null @@ -1,102 +0,0 @@ -Create repo with old manifest - - $ cat << EOF >> $HGRCPATH - > [format] - > usegeneraldelta=yes - > EOF - - $ hg init existing - $ cd existing - $ echo footext > foo - $ hg add foo - $ hg commit -m initial - -We're using v1, so no manifestv2 entry is in requires yet. - - $ grep manifestv2 .hg/requires - [1] - -Let's clone this with manifestv2 enabled to switch to the new format for -future commits. - - $ cd .. - $ hg clone --pull existing new --config experimental.manifestv2=1 - requesting all changes - adding changesets - adding manifests - adding file changes - added 1 changesets with 1 changes to 1 files - new changesets 0fc9a4fafa44 - updating to branch default - 1 files updated, 0 files merged, 0 files removed, 0 files unresolved - $ cd new - -Check that entry was added to .hg/requires. - - $ grep manifestv2 .hg/requires - manifestv2 - -Make a new commit. - - $ echo newfootext > foo - $ hg commit -m new - -Check that the manifest actually switched to v2. - - $ hg debugdata -m 0 - foo\x0021e958b1dca695a60ee2e9cf151753204ee0f9e9 (esc) - - $ hg debugdata -m 1 - \x00 (esc) - \x00foo\x00 (esc) - I\xab\x7f\xb8(\x83\xcas\x15\x9d\xc2\xd3\xd3:5\x08\xbad5_ (esc) - -Check that manifestv2 is used if the requirement is present, even if it's -disabled in the config. - - $ echo newerfootext > foo - $ hg --config experimental.manifestv2=False commit -m newer - - $ hg debugdata -m 2 - \x00 (esc) - \x00foo\x00 (esc) - \xa6\xb1\xfb\xef]\x91\xa1\x19`\xf3.#\x90S\xf8\x06 \xe2\x19\x00 (esc) - -Check that we can still read v1 manifests. - - $ hg files -r 0 - foo - - $ cd .. - -Check that entry is added to .hg/requires on repo creation - - $ hg --config experimental.manifestv2=True init repo - $ cd repo - $ grep manifestv2 .hg/requires - manifestv2 - -Set up simple repo - - $ echo a > file1 - $ echo b > file2 - $ echo c > file3 - $ hg ci -Aqm 'initial' - $ echo d > file2 - $ hg ci -m 'modify file2' - -Check that 'hg verify', which uses manifest.readdelta(), works - - $ hg verify - checking changesets - checking manifests - crosschecking files in changesets and manifests - checking files - 3 files, 2 changesets, 4 total revisions - -Check that manifest revlog is smaller than for v1 - - $ hg debugindex -m - revoffset length delta linkrev nodeid p1 p2 - 0 0 81 -1 0 57361477c778 - 181 33 0 1 aeaab5a2ef74 57361477c778 diff --git a/tests/test-manifest.py b/tests/test-manifest.py --- a/tests/test-manifest.py +++ b/tests/test-manifest.py @@ -11,7 +11,6 @@ ) EMTPY_MANIFEST = b'' -EMTPY_MANIFEST_V2 = b'\0\n' HASH_1 = b'1' * 40 BIN_HASH_1 = binascii.unhexlify(HASH_1) @@ -28,42 +27,6 @@ b'flag2': b'l', } -# Same data as A_SHORT_MANIFEST -A_SHORT_MANIFEST_V2 = ( -b'\0\n' -b'\x00bar/baz/qux.py\0%(flag2)s\n%(hash2)s\n' -b'\x00foo\0%(flag1)s\n%(hash1
[PATCH evolve-ext V2] obsdiscovery: include units in ui.progress() calls (issue5773)
# HG changeset patch # User Anton Shestakov # Date 1519388837 -28800 # Fri Feb 23 20:27:17 2018 +0800 # Node ID 82551a1622d4240668da3f8958391705d2795578 # Parent 25155eb05f5f1657e325e7b77e3f190f72d25577 obsdiscovery: include units in ui.progress() calls (issue5773) diff --git a/hgext3rd/evolve/obsdiscovery.py b/hgext3rd/evolve/obsdiscovery.py --- a/hgext3rd/evolve/obsdiscovery.py +++ b/hgext3rd/evolve/obsdiscovery.py @@ -95,7 +95,8 @@ def findcommonobsmarkers(ui, local, remo common = set() undecided = set(probeset) totalnb = len(undecided) -ui.progress(_("comparing with other"), 0, total=totalnb) +ui.progress(_("comparing with other"), 0, total=totalnb, +unit=_("changesets")) _takefullsample = setdiscovery._takefullsample if remote.capable('_evoext_obshash_1'): getremotehash = remote.evoext_obshash1 @@ -114,7 +115,7 @@ def findcommonobsmarkers(ui, local, remo roundtrips += 1 ui.progress(_("comparing with other"), totalnb - len(undecided), -total=totalnb) +total=totalnb, unit=_("changesets")) ui.debug("query %i; still undecided: %i, sample size is: %i\n" % (roundtrips, len(undecided), len(sample))) # indices between sample and externalized version must match @@ -175,7 +176,8 @@ def findmissingrange(ui, local, remote, local.obsstore.rangeobshashcache.update(local) querycount = 0 -ui.progress(_("comparing obsmarker with other"), querycount) +ui.progress(_("comparing obsmarker with other"), querycount, +unit=_("obsmarkers")) overflow = [] while sample or overflow: if overflow: @@ -230,7 +232,8 @@ def findmissingrange(ui, local, remote, addentry(new) assert nbsample == nbreplies querycount += 1 -ui.progress(_("comparing obsmarker with other"), querycount) +ui.progress(_("comparing obsmarker with other"), querycount, +unit=_("obsmarkers")) ui.progress(_("comparing obsmarker with other"), None) local.obsstore.rangeobshashcache.save(local) duration = timer() - starttime @@ -771,7 +774,8 @@ def _obsrelsethashtree(repo, encodeonema cache = [] unfi = repo.unfiltered() markercache = {} -repo.ui.progress(_("preparing locally"), 0, total=len(unfi)) +repo.ui.progress(_("preparing locally"), 0, total=len(unfi), + unit=_("changesets")) for i in unfi: ctx = unfi[i] entry = 0 @@ -801,7 +805,8 @@ def _obsrelsethashtree(repo, encodeonema cache.append((ctx.node(), sha.digest())) else: cache.append((ctx.node(), node.nullid)) -repo.ui.progress(_("preparing locally"), i, total=len(unfi)) +repo.ui.progress(_("preparing locally"), i, total=len(unfi), + unit=_("changesets")) repo.ui.progress(_("preparing locally"), None) return cache ___ Mercurial-devel mailing list Mercurial-devel@mercurial-scm.org https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel
D2391: sshpeer: factor out code for creating peers from pipes
indygreg updated this revision to Diff 6018. REPOSITORY rHG Mercurial CHANGES SINCE LAST UPDATE https://phab.mercurial-scm.org/D2391?vs=6004&id=6018 REVISION DETAIL https://phab.mercurial-scm.org/D2391 AFFECTED FILES mercurial/sshpeer.py CHANGE DETAILS diff --git a/mercurial/sshpeer.py b/mercurial/sshpeer.py --- a/mercurial/sshpeer.py +++ b/mercurial/sshpeer.py @@ -531,6 +531,35 @@ # And handshake is performed before the peer is instantiated. So # we need no custom code. +def makepeer(ui, path, proc, stdin, stdout, stderr): +"""Make a peer instance from existing pipes. + +``path`` and ``proc`` are stored on the eventual peer instance and may +not be used for anything meaningful. + +``stdin``, ``stdout``, and ``stderr`` are the pipes connected to the +SSH server's stdio handles. + +This function is factored out to allow creating peers that don't +actually spawn a new process. It is useful for starting SSH protocol +servers and clients via non-standard means, which can be useful for +testing. +""" +try: +protoname, caps = _performhandshake(ui, stdin, stdout, stderr) +except Exception: +_cleanuppipes(ui, stdout, stdin, stderr) +raise + +if protoname == wireprotoserver.SSHV1: +return sshv1peer(ui, path, proc, stdin, stdout, stderr, caps) +elif protoname == wireprotoserver.SSHV2: +return sshv2peer(ui, path, proc, stdin, stdout, stderr, caps) +else: +_cleanuppipes(ui, stdout, stdin, stderr) +raise error.RepoError(_('unknown version of SSH protocol: %s') % + protoname) + def instance(ui, path, create): """Create an SSH peer. @@ -565,17 +594,4 @@ proc, stdin, stdout, stderr = _makeconnection(ui, sshcmd, args, remotecmd, remotepath, sshenv) -try: -protoname, caps = _performhandshake(ui, stdin, stdout, stderr) -except Exception: -_cleanuppipes(ui, stdout, stdin, stderr) -raise - -if protoname == wireprotoserver.SSHV1: -return sshv1peer(ui, path, proc, stdin, stdout, stderr, caps) -elif protoname == wireprotoserver.SSHV2: -return sshv2peer(ui, path, proc, stdin, stdout, stderr, caps) -else: -_cleanuppipes(ui, stdout, stdin, stderr) -raise error.RepoError(_('unknown version of SSH protocol: %s') % - protoname) +return makepeer(ui, path, proc, stdin, stdout, stderr) To: indygreg, #hg-reviewers Cc: dhduvall, mercurial-devel ___ Mercurial-devel mailing list Mercurial-devel@mercurial-scm.org https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel
Re: [PATCH] diff: do not split function name if character encoding is unknown
On Fri, Feb 23, 2018 at 23:53:18 +0900, Yuya Nishihara wrote: > # HG changeset patch > # User Yuya Nishihara > # Date 1519394998 -32400 > # Fri Feb 23 23:09:58 2018 +0900 > # Node ID 98cfd7926442dc0a649e0359455ad6962815bd13 > # Parent b8d0761a85c7421071750de23228415306852d69 > diff: do not split function name if character encoding is unknown > > Only ASCII characters can be split reliably at any byte positions, so let's > just leave long multi-byte sequence long. It's probably less bad than putting > an invalid byte sequence into a diff. > > This doesn't try to split the first ASCII slice from multi-byte sequence > because a combining character may follow. I like it! Thanks, Jeff. > > diff --git a/mercurial/mdiff.py b/mercurial/mdiff.py > --- a/mercurial/mdiff.py > +++ b/mercurial/mdiff.py > @@ -13,6 +13,7 @@ import zlib > > from .i18n import _ > from . import ( > +encoding, > error, > policy, > pycompat, > @@ -348,7 +349,11 @@ def _unidiff(t1, t2, opts=defaultopts): > # alphanumeric char. > for i in xrange(astart - 1, lastpos - 1, -1): > if l1[i][0:1].isalnum(): > -func = ' ' + l1[i].rstrip()[:40] > +func = b' ' + l1[i].rstrip() > +# split long function name if ASCII. otherwise we have no > +# idea where the multi-byte boundary is, so just leave > it. > +if encoding.isasciistr(func): > +func = func[:41] > lastfunc[1] = func > break > # by recording this hunk's starting point as the next place to > diff --git a/tests/test-diff-unified.t b/tests/test-diff-unified.t > --- a/tests/test-diff-unified.t > +++ b/tests/test-diff-unified.t > @@ -386,3 +386,73 @@ If [diff] git is set to true, but the us > } > >$ cd .. > + > +Long function names should be abbreviated, but multi-byte character shouldn't > +be broken up > + > + $ hg init longfunc > + $ cd longfunc > + > + >>> with open('a', 'wb') as f: > + ... f.write(b'a' * 39 + b'bb' + b'\n') > + ... f.write(b' .\n' * 3) > + ... f.write(b' 0 b\n') > + ... f.write(b' .\n' * 3) > + ... f.write(b'a' * 39 + b'\xc3\xa0' + b'\n') > + ... f.write(b' .\n' * 3) > + ... f.write(b' 0 a with grave (single code point)\n') > + ... f.write(b' .\n' * 3) > + ... f.write(b'a' * 39 + b'a\xcc\x80' + b'\n') > + ... f.write(b' .\n' * 3) > + ... f.write(b' 0 a with grave (composition)\n') > + ... f.write(b' .\n' * 3) > + $ hg ci -qAm0 > + > + >>> with open('a', 'wb') as f: > + ... f.write(b'a' * 39 + b'bb' + b'\n') > + ... f.write(b' .\n' * 3) > + ... f.write(b' 1 b\n') > + ... f.write(b' .\n' * 3) > + ... f.write(b'a' * 39 + b'\xc3\xa0' + b'\n') > + ... f.write(b' .\n' * 3) > + ... f.write(b' 1 a with grave (single code point)\n') > + ... f.write(b' .\n' * 3) > + ... f.write(b'a' * 39 + b'a\xcc\x80' + b'\n') > + ... f.write(b' .\n' * 3) > + ... f.write(b' 1 a with grave (composition)\n') > + ... f.write(b' .\n' * 3) > + $ hg ci -m1 > + > + $ hg diff -c1 --nodates --show-function > + diff -r 3e92dd6fa812 -r a256341606cb a > + --- a/a > + +++ b/a > + @@ -2,7 +2,7 @@ aaab > +. > +. > +. > + - 0 b > + + 1 b > +. > +. > +. > + @@ -10,7 +10,7 @@ aaa\xc3\xa0 (esc) > +. > +. > +. > + - 0 a with grave (single code point) > + + 1 a with grave (single code point) > +. > +. > +. > + @@ -18,7 +18,7 @@ \xcc\x80 (esc) > +. > +. > +. > + - 0 a with grave (composition) > + + 1 a with grave (composition) > +. > +. > +. > + > + $ cd .. -- In personal conversations with technical people, I call myself a hacker. But when I'm talking to journalists I just say "programmer" or something like that. - Linus Torvalds ___ Mercurial-devel mailing list Mercurial-devel@mercurial-scm.org https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel
[PATCH] diff: do not split function name if character encoding is unknown
# HG changeset patch # User Yuya Nishihara # Date 1519394998 -32400 # Fri Feb 23 23:09:58 2018 +0900 # Node ID 98cfd7926442dc0a649e0359455ad6962815bd13 # Parent b8d0761a85c7421071750de23228415306852d69 diff: do not split function name if character encoding is unknown Only ASCII characters can be split reliably at any byte positions, so let's just leave long multi-byte sequence long. It's probably less bad than putting an invalid byte sequence into a diff. This doesn't try to split the first ASCII slice from multi-byte sequence because a combining character may follow. diff --git a/mercurial/mdiff.py b/mercurial/mdiff.py --- a/mercurial/mdiff.py +++ b/mercurial/mdiff.py @@ -13,6 +13,7 @@ import zlib from .i18n import _ from . import ( +encoding, error, policy, pycompat, @@ -348,7 +349,11 @@ def _unidiff(t1, t2, opts=defaultopts): # alphanumeric char. for i in xrange(astart - 1, lastpos - 1, -1): if l1[i][0:1].isalnum(): -func = ' ' + l1[i].rstrip()[:40] +func = b' ' + l1[i].rstrip() +# split long function name if ASCII. otherwise we have no +# idea where the multi-byte boundary is, so just leave it. +if encoding.isasciistr(func): +func = func[:41] lastfunc[1] = func break # by recording this hunk's starting point as the next place to diff --git a/tests/test-diff-unified.t b/tests/test-diff-unified.t --- a/tests/test-diff-unified.t +++ b/tests/test-diff-unified.t @@ -386,3 +386,73 @@ If [diff] git is set to true, but the us } $ cd .. + +Long function names should be abbreviated, but multi-byte character shouldn't +be broken up + + $ hg init longfunc + $ cd longfunc + + >>> with open('a', 'wb') as f: + ... f.write(b'a' * 39 + b'bb' + b'\n') + ... f.write(b' .\n' * 3) + ... f.write(b' 0 b\n') + ... f.write(b' .\n' * 3) + ... f.write(b'a' * 39 + b'\xc3\xa0' + b'\n') + ... f.write(b' .\n' * 3) + ... f.write(b' 0 a with grave (single code point)\n') + ... f.write(b' .\n' * 3) + ... f.write(b'a' * 39 + b'a\xcc\x80' + b'\n') + ... f.write(b' .\n' * 3) + ... f.write(b' 0 a with grave (composition)\n') + ... f.write(b' .\n' * 3) + $ hg ci -qAm0 + + >>> with open('a', 'wb') as f: + ... f.write(b'a' * 39 + b'bb' + b'\n') + ... f.write(b' .\n' * 3) + ... f.write(b' 1 b\n') + ... f.write(b' .\n' * 3) + ... f.write(b'a' * 39 + b'\xc3\xa0' + b'\n') + ... f.write(b' .\n' * 3) + ... f.write(b' 1 a with grave (single code point)\n') + ... f.write(b' .\n' * 3) + ... f.write(b'a' * 39 + b'a\xcc\x80' + b'\n') + ... f.write(b' .\n' * 3) + ... f.write(b' 1 a with grave (composition)\n') + ... f.write(b' .\n' * 3) + $ hg ci -m1 + + $ hg diff -c1 --nodates --show-function + diff -r 3e92dd6fa812 -r a256341606cb a + --- a/a + +++ b/a + @@ -2,7 +2,7 @@ aaab +. +. +. + - 0 b + + 1 b +. +. +. + @@ -10,7 +10,7 @@ aaa\xc3\xa0 (esc) +. +. +. + - 0 a with grave (single code point) + + 1 a with grave (single code point) +. +. +. + @@ -18,7 +18,7 @@ \xcc\x80 (esc) +. +. +. + - 0 a with grave (composition) + + 1 a with grave (composition) +. +. +. + + $ cd .. ___ Mercurial-devel mailing list Mercurial-devel@mercurial-scm.org https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel
[PATCH evolve-ext RFC] obsdiscovery: include units in ui.progress() calls (issue5773)
# HG changeset patch # User Anton Shestakov # Date 1519388837 -28800 # Fri Feb 23 20:27:17 2018 +0800 # Node ID 24a9c27666d2f33851647324a8632f3f07afbbd6 # Parent 25155eb05f5f1657e325e7b77e3f190f72d25577 obsdiscovery: include units in ui.progress() calls (issue5773) diff --git a/hgext3rd/evolve/obsdiscovery.py b/hgext3rd/evolve/obsdiscovery.py --- a/hgext3rd/evolve/obsdiscovery.py +++ b/hgext3rd/evolve/obsdiscovery.py @@ -95,7 +95,8 @@ def findcommonobsmarkers(ui, local, remo common = set() undecided = set(probeset) totalnb = len(undecided) -ui.progress(_("comparing with other"), 0, total=totalnb) +ui.progress(_("comparing with other"), 0, total=totalnb, +unit=_("apples with oranges")) _takefullsample = setdiscovery._takefullsample if remote.capable('_evoext_obshash_1'): getremotehash = remote.evoext_obshash1 @@ -114,7 +115,7 @@ def findcommonobsmarkers(ui, local, remo roundtrips += 1 ui.progress(_("comparing with other"), totalnb - len(undecided), -total=totalnb) +total=totalnb, unit=_("apples with oranges")) ui.debug("query %i; still undecided: %i, sample size is: %i\n" % (roundtrips, len(undecided), len(sample))) # indices between sample and externalized version must match @@ -175,7 +176,8 @@ def findmissingrange(ui, local, remote, local.obsstore.rangeobshashcache.update(local) querycount = 0 -ui.progress(_("comparing obsmarker with other"), querycount) +ui.progress(_("comparing obsmarker with other"), querycount, +unit=_("obsmarkers")) overflow = [] while sample or overflow: if overflow: @@ -230,7 +232,8 @@ def findmissingrange(ui, local, remote, addentry(new) assert nbsample == nbreplies querycount += 1 -ui.progress(_("comparing obsmarker with other"), querycount) +ui.progress(_("comparing obsmarker with other"), querycount, +unit=_("obsmarkers")) ui.progress(_("comparing obsmarker with other"), None) local.obsstore.rangeobshashcache.save(local) duration = timer() - starttime @@ -771,7 +774,8 @@ def _obsrelsethashtree(repo, encodeonema cache = [] unfi = repo.unfiltered() markercache = {} -repo.ui.progress(_("preparing locally"), 0, total=len(unfi)) +repo.ui.progress(_("preparing locally"), 0, total=len(unfi), + unit=_("changesets")) for i in unfi: ctx = unfi[i] entry = 0 @@ -801,7 +805,8 @@ def _obsrelsethashtree(repo, encodeonema cache.append((ctx.node(), sha.digest())) else: cache.append((ctx.node(), node.nullid)) -repo.ui.progress(_("preparing locally"), i, total=len(unfi)) +repo.ui.progress(_("preparing locally"), i, total=len(unfi), + unit=_("changesets")) repo.ui.progress(_("preparing locally"), None) return cache ___ Mercurial-devel mailing list Mercurial-devel@mercurial-scm.org https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel
D2399: stack: return a sorted smartrev by default
lothiraldan created this revision. Herald added a subscriber: mercurial-devel. Herald added a reviewer: hg-reviewers. REVISION SUMMARY Most stack customers will display a list of revisions, sort it by default. REPOSITORY rHG Mercurial REVISION DETAIL https://phab.mercurial-scm.org/D2399 AFFECTED FILES mercurial/destutil.py mercurial/stack.py tests/test-stack.t CHANGE DETAILS diff --git a/tests/test-stack.t b/tests/test-stack.t --- a/tests/test-stack.t +++ b/tests/test-stack.t @@ -57,8 +57,8 @@ $ hg up other 0 files updated, 0 files merged, 4 files removed, 0 files unresolved $ hg debugstack + 0 1 - 0 $ hg phase --public 'branch("other")' $ hg debugstack $ hg up foo @@ -72,10 +72,10 @@ $ hg branch foo $ hg debugstack + 2 + 3 + 4 5 - 4 - 3 - 2 Case with some of the branch unstable @@ -105,8 +105,8 @@ $ hg up -r "desc(c_e)" 2 files updated, 0 files merged, 0 files removed, 0 files unresolved $ hg debugstack + 3 4 - 3 $ hg up -r "desc(c_d)" 1 files updated, 0 files merged, 1 files removed, 0 files unresolved @@ -167,13 +167,13 @@ Test output $ hg debugstack + 9 10 - 9 $ hg up 'desc(c_f)' 2 files updated, 0 files merged, 2 files removed, 0 files unresolved $ hg debugstack + 7 8 - 7 Case with multiple heads with unstability involved -- diff --git a/mercurial/stack.py b/mercurial/stack.py --- a/mercurial/stack.py +++ b/mercurial/stack.py @@ -10,8 +10,8 @@ from . import revsetlang, scmutil def getstack(repo, rev=None): -"""return a smartrev of the stack containing either rev if it is not None -or the current working directory parent. +"""return a sorted smartrev of the stack containing either rev if it is +not None or the current working directory parent. The stack will always contain all drafts changesets which are ancestors to the revision and are not merges. @@ -21,4 +21,6 @@ revspec = 'reverse(only(%s) and not public() and not ::merge())' revset = revsetlang.formatspec(revspec, rev) -return scmutil.revrange(repo, [revset]) +revisions = scmutil.revrange(repo, [revset]) +revisions.sort() +return revisions diff --git a/mercurial/destutil.py b/mercurial/destutil.py --- a/mercurial/destutil.py +++ b/mercurial/destutil.py @@ -359,7 +359,7 @@ def stackbase(ui, repo): revs = stack.getstack(repo) -return revs.last() if revs else None +return revs.first() if revs else None def _statusotherbook(ui, repo): bmheads = bookmarks.headsforactive(repo) To: lothiraldan, #hg-reviewers Cc: mercurial-devel ___ Mercurial-devel mailing list Mercurial-devel@mercurial-scm.org https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel
D2400: stack: begin to make the stack revset configurable
lothiraldan created this revision. Herald added a subscriber: mercurial-devel. Herald added a reviewer: hg-reviewers. REVISION SUMMARY First extrat the not-merge part in its own configuration knob `stack.not- merge`. REPOSITORY rHG Mercurial REVISION DETAIL https://phab.mercurial-scm.org/D2400 AFFECTED FILES mercurial/configitems.py mercurial/stack.py CHANGE DETAILS diff --git a/mercurial/stack.py b/mercurial/stack.py --- a/mercurial/stack.py +++ b/mercurial/stack.py @@ -9,18 +9,34 @@ from . import revsetlang, scmutil +baserevspec = "only(%s) and not public()" + def getstack(repo, rev=None): """return a sorted smartrev of the stack containing either rev if it is not None or the current working directory parent. The stack will always contain all drafts changesets which are ancestors to -the revision and are not merges. +the revision. + +There are several config options to restrict the changesets that will be +part of the stack: + +[stack] +not-merge = (boolean) # The stack will contains only non-merge changesets + # if set to True (default: True) """ if rev is None: rev = '.' -revspec = 'reverse(only(%s) and not public() and not ::merge())' -revset = revsetlang.formatspec(revspec, rev) +revspecargs = [revsetlang.formatspec(baserevspec, rev)] +revspec = ["%r"] + +if repo.ui.configbool("stack", "not-merge"): +revspecargs.append("not ::merge()") +revspec.append("%r") + +finalrevspec = " and ".join(revspec) +revset = revsetlang.formatspec(finalrevspec, *revspecargs) revisions = scmutil.revrange(repo, [revset]) revisions.sort() return revisions diff --git a/mercurial/configitems.py b/mercurial/configitems.py --- a/mercurial/configitems.py +++ b/mercurial/configitems.py @@ -950,6 +950,9 @@ coreconfigitem('sparse', 'missingwarning', default=True, ) +coreconfigitem('stack', 'not-merge', +default=True, +) coreconfigitem('subrepos', 'allowed', default=dynamicdefault, # to make backporting simpler ) To: lothiraldan, #hg-reviewers Cc: mercurial-devel ___ Mercurial-devel mailing list Mercurial-devel@mercurial-scm.org https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel
D2401: stack: introduce an option to disable the restriction on ancestor
lothiraldan created this revision. Herald added a subscriber: mercurial-devel. Herald added a reviewer: hg-reviewers. REVISION SUMMARY The default stack revset restrict on only the ancestors of a revision. Some tools might want to display the current stack even if the working directory parent is in the middle of the stack. Add the `stack.restrict-ancestors` option to disable that. REPOSITORY rHG Mercurial REVISION DETAIL https://phab.mercurial-scm.org/D2401 AFFECTED FILES mercurial/configitems.py mercurial/stack.py CHANGE DETAILS diff --git a/mercurial/stack.py b/mercurial/stack.py --- a/mercurial/stack.py +++ b/mercurial/stack.py @@ -9,28 +9,34 @@ from . import revsetlang, scmutil -baserevspec = "only(%s) and not public()" +baserevspec = "not public()" def getstack(repo, rev=None): """return a sorted smartrev of the stack containing either rev if it is not None or the current working directory parent. -The stack will always contain all drafts changesets which are ancestors to -the revision. +The stack will always contain all drafts changesets. There are several config options to restrict the changesets that will be part of the stack: [stack] not-merge = (boolean) # The stack will contains only non-merge changesets # if set to True (default: True) +restrict-ancestors = (boolean) # The stack will contain only the + # ancestors of the revision if set to True + # (default: True) """ if rev is None: rev = '.' -revspecargs = [revsetlang.formatspec(baserevspec, rev)] +revspecargs = [baserevspec] revspec = ["%r"] +if repo.ui.configbool("stack", "restrict-ancestors"): +revspecargs.append(revsetlang.formatspec("only(%s)", rev)) +revspec.append("%r") + if repo.ui.configbool("stack", "not-merge"): revspecargs.append("not ::merge()") revspec.append("%r") diff --git a/mercurial/configitems.py b/mercurial/configitems.py --- a/mercurial/configitems.py +++ b/mercurial/configitems.py @@ -953,6 +953,9 @@ coreconfigitem('stack', 'not-merge', default=True, ) +coreconfigitem('stack', 'restrict-ancestors', +default=True, +) coreconfigitem('subrepos', 'allowed', default=dynamicdefault, # to make backporting simpler ) To: lothiraldan, #hg-reviewers Cc: mercurial-devel ___ Mercurial-devel mailing list Mercurial-devel@mercurial-scm.org https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel
D2398: histedit: use the new stack definition for histedit
lothiraldan created this revision. Herald added a subscriber: mercurial-devel. Herald added a reviewer: hg-reviewers. REVISION SUMMARY Now that we have a common stack definition, use it in the hg histedit command. REPOSITORY rHG Mercurial REVISION DETAIL https://phab.mercurial-scm.org/D2398 AFFECTED FILES mercurial/destutil.py CHANGE DETAILS diff --git a/mercurial/destutil.py b/mercurial/destutil.py --- a/mercurial/destutil.py +++ b/mercurial/destutil.py @@ -340,18 +340,20 @@ onheadcheck=onheadcheck, destspace=destspace) return repo[node].rev() -histeditdefaultrevset = 'reverse(only(.) and not public() and not ::merge())' - def desthistedit(ui, repo): """Default base revision to edit for `hg histedit`.""" -default = ui.config('histedit', 'defaultrev', histeditdefaultrevset) -if default: +default = ui.config('histedit', 'defaultrev', None) + +if default is None: +revs = stack.getstack(repo) +elif default: revs = scmutil.revrange(repo, [default]) -if revs: -# The revset supplied by the user may not be in ascending order nor -# take the first revision. So do this manually. -revs.sort() -return revs.first() + +if revs: +# The revset supplied by the user may not be in ascending order nor +# take the first revision. So do this manually. +revs.sort() +return revs.first() return None To: lothiraldan, #hg-reviewers Cc: mercurial-devel ___ Mercurial-devel mailing list Mercurial-devel@mercurial-scm.org https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel
D2402: stack: introduce an option to limit the selection on the current branch
lothiraldan created this revision. Herald added a subscriber: mercurial-devel. Herald added a reviewer: hg-reviewers. REPOSITORY rHG Mercurial REVISION DETAIL https://phab.mercurial-scm.org/D2402 AFFECTED FILES mercurial/configitems.py mercurial/stack.py tests/test-stack.t CHANGE DETAILS diff --git a/tests/test-stack.t b/tests/test-stack.t --- a/tests/test-stack.t +++ b/tests/test-stack.t @@ -51,6 +51,25 @@ o 0 other draft c_a +Check that stack show draft changesets from all branches by default +--- + + $ hg debugstack + 0 + 1 + 2 + 3 + 4 + 5 + +But not if we restrict on the branch + + $ hg debugstack --config experimental.stack.same-branch=true + 2 + 3 + 4 + 5 + Check that stack doesn't include public changesets -- diff --git a/mercurial/stack.py b/mercurial/stack.py --- a/mercurial/stack.py +++ b/mercurial/stack.py @@ -41,6 +41,10 @@ revspecargs.append("not ::merge()") revspec.append("%r") +if repo.ui.configbool("experimental", "stack.same-branch"): +revspecargs.append(revsetlang.formatspec("branch(%s)", rev)) +revspec.append("%r") + finalrevspec = " and ".join(revspec) revset = revsetlang.formatspec(finalrevspec, *revspecargs) revisions = scmutil.revrange(repo, [revset]) diff --git a/mercurial/configitems.py b/mercurial/configitems.py --- a/mercurial/configitems.py +++ b/mercurial/configitems.py @@ -956,6 +956,9 @@ coreconfigitem('stack', 'restrict-ancestors', default=True, ) +coreconfigitem('experimental', 'stack.same-branch', +default=False, +) coreconfigitem('subrepos', 'allowed', default=dynamicdefault, # to make backporting simpler ) To: lothiraldan, #hg-reviewers Cc: mercurial-devel ___ Mercurial-devel mailing list Mercurial-devel@mercurial-scm.org https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel
D2396: stack: import Evolve stack test file
lothiraldan created this revision. Herald added a subscriber: mercurial-devel. Herald added a reviewer: hg-reviewers. REVISION SUMMARY Import Evolve stack test file for starting to have good coverage on stack definition. REPOSITORY rHG Mercurial REVISION DETAIL https://phab.mercurial-scm.org/D2396 AFFECTED FILES mercurial/debugcommands.py tests/test-completion.t tests/test-help.t tests/test-stack.t CHANGE DETAILS diff --git a/tests/test-stack.t b/tests/test-stack.t new file mode 100644 --- /dev/null +++ b/tests/test-stack.t @@ -0,0 +1,213 @@ + +This test test the low-level definition of stack, agnostic from all formatting + +Initial setup + + $ cat << EOF >> $HGRCPATH + > [ui] + > logtemplate = {rev} {branch} {phase} {desc|firstline}\n + > [extensions] + > rebase= + > [experimental] + > evolution=createmarkers,exchange,allowunstable + > EOF + + $ hg init main + $ cd main + $ hg branch other + marked working directory as branch other + (branches are permanent and global, did you want a bookmark?) + $ echo aaa > aaa + $ hg add aaa + $ hg commit -m c_a + $ echo aaa > bbb + $ hg add bbb + $ hg commit -m c_b + $ hg branch foo + marked working directory as branch foo + $ echo aaa > ccc + $ hg add ccc + $ hg commit -m c_c + $ echo aaa > ddd + $ hg add ddd + $ hg commit -m c_d + $ echo aaa > eee + $ hg add eee + $ hg commit -m c_e + $ echo aaa > fff + $ hg add fff + $ hg commit -m c_f + $ hg log -G + @ 5 foo draft c_f + | + o 4 foo draft c_e + | + o 3 foo draft c_d + | + o 2 foo draft c_c + | + o 1 other draft c_b + | + o 0 other draft c_a + + +Check that stack doesn't include public changesets +-- + + $ hg up other + 0 files updated, 0 files merged, 4 files removed, 0 files unresolved + $ hg debugstack + 1 + 0 + $ hg phase --public 'branch("other")' + $ hg debugstack + $ hg up foo + 4 files updated, 0 files merged, 0 files removed, 0 files unresolved + +Simple test +--- + +'hg debugstack' list all changeset in the branch + + $ hg branch + foo + $ hg debugstack + 5 + 4 + 3 + 2 + +Case with some of the branch unstable + + + $ hg up 3 + 0 files updated, 0 files merged, 2 files removed, 0 files unresolved + $ echo bbb > ddd + $ hg commit --amend + 2 new orphan changesets + $ hg log -G + @ 6 foo draft c_d + | + | * 5 foo draft c_f + | | + | * 4 foo draft c_e + | | + | x 3 foo draft c_d + |/ + o 2 foo draft c_c + | + o 1 other public c_b + | + o 0 other public c_a + + $ hg debugstack + 6 + $ hg up -r "desc(c_e)" + 2 files updated, 0 files merged, 0 files removed, 0 files unresolved + $ hg debugstack + 4 + 3 + $ hg up -r "desc(c_d)" + 1 files updated, 0 files merged, 1 files removed, 0 files unresolved + + $ hg debugstack + 6 + +Case with multiple topological heads + + +Make things linear again + + $ hg rebase -s 'desc(c_e)' -d 'desc(c_d) - obsolete()' + rebasing 4:4f2a69f6d380 "c_e" + rebasing 5:913c298d8b0a "c_f" + $ hg log -G + o 8 foo draft c_f + | + o 7 foo draft c_e + | + @ 6 foo draft c_d + | + o 2 foo draft c_c + | + o 1 other public c_b + | + o 0 other public c_a + + +Create the second branch + + $ hg up 'desc(c_d)' + 0 files updated, 0 files merged, 0 files removed, 0 files unresolved + $ echo aaa > ggg + $ hg add ggg + $ hg commit -m c_g + created new head + $ echo aaa > hhh + $ hg add hhh + $ hg commit -m c_h + $ hg log -G + @ 10 foo draft c_h + | + o 9 foo draft c_g + | + | o 8 foo draft c_f + | | + | o 7 foo draft c_e + |/ + o 6 foo draft c_d + | + o 2 foo draft c_c + | + o 1 other public c_b + | + o 0 other public c_a + + +Test output + + $ hg debugstack + 10 + 9 + $ hg up 'desc(c_f)' + 2 files updated, 0 files merged, 2 files removed, 0 files unresolved + $ hg debugstack + 8 + 7 + +Case with multiple heads with unstability involved +-- + +We amend the message to make sure the display base pick the right changeset + + $ hg up 'desc(c_d)' + 0 files updated, 0 files merged, 2 files removed, 0 files unresolved + $ echo ccc > ddd + $ hg commit --amend -m 'c_D' + 4 new orphan changesets + $ hg rebase -d . -s 'desc(c_g)' + rebasing 9:2ebb6e48ab8a "c_g" + rebasing 10:634f38e27a1d "c_h" + $ hg log -G + o 13 foo draft c_h + | + o 12 foo draft c_g + | + @ 11 foo draft c_D + | + | * 8 foo draft c_f + | | + | * 7 foo draft c_e + | | + | x 6 foo draft c_d + |/ + o 2 foo draft c_c + | + o 1 other public c_b + | + o 0 other public c_a + + +We should improve stack definition to also show 12 and 13 here + $ hg debugstack + 11 diff --git a/tests/test-help.t b/tests/test-help.t --- a/tests/test-help.t +++ b/tests/test-help.t @@ -970,6 +970,7 @@ debugsetparents manually set the parents of the current
D2403: stack: remove destutil.stackbase
lothiraldan created this revision. Herald added a subscriber: mercurial-devel. Herald added a reviewer: hg-reviewers. REVISION SUMMARY Use directly stack.getstack in show stack command. Remove destutil.stackbase. Import a TODO from the show stack in the code. REPOSITORY rHG Mercurial REVISION DETAIL https://phab.mercurial-scm.org/D2403 AFFECTED FILES hgext/show.py mercurial/destutil.py CHANGE DETAILS diff --git a/mercurial/destutil.py b/mercurial/destutil.py --- a/mercurial/destutil.py +++ b/mercurial/destutil.py @@ -357,10 +357,6 @@ return None -def stackbase(ui, repo): -revs = stack.getstack(repo) -return revs.first() if revs else None - def _statusotherbook(ui, repo): bmheads = bookmarks.headsforactive(repo) curhead = repo[repo._activebookmark].node() diff --git a/hgext/show.py b/hgext/show.py --- a/hgext/show.py +++ b/hgext/show.py @@ -35,7 +35,6 @@ from mercurial import ( cmdutil, commands, -destutil, error, formatter, graphmod, @@ -45,6 +44,7 @@ registrar, revset, revsetlang, +stack ) # Note for extension authors: ONLY specify testedwith = 'ships-with-hg-core' for @@ -193,17 +193,17 @@ 'changeset)\n')) return -# TODO extract "find stack" into a function to facilitate -# customization and reuse. - -baserev = destutil.stackbase(ui, repo) basectx = None +_stack = stack.getstack(repo) +baserev = _stack.first() + +# TODO doesn't yet handle case where wdir is a draft merge if baserev is None: baserev = wdirctx.rev() stackrevs = {wdirctx.rev()} else: -stackrevs = set(repo.revs('%d::.', baserev)) +stackrevs = set(_stack) ctx = repo[baserev] if ctx.p1().rev() != nullrev: To: lothiraldan, #hg-reviewers Cc: mercurial-devel ___ Mercurial-devel mailing list Mercurial-devel@mercurial-scm.org https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel
D2397: show: use the new stack definition for show stack
lothiraldan created this revision. Herald added a subscriber: mercurial-devel. Herald added a reviewer: hg-reviewers. REVISION SUMMARY Now that we have a common stack definition, use it in the hg show stack command. REPOSITORY rHG Mercurial REVISION DETAIL https://phab.mercurial-scm.org/D2397 AFFECTED FILES mercurial/destutil.py CHANGE DETAILS diff --git a/mercurial/destutil.py b/mercurial/destutil.py --- a/mercurial/destutil.py +++ b/mercurial/destutil.py @@ -13,6 +13,7 @@ error, obsutil, scmutil, +stack ) def _destupdateobs(repo, clean): @@ -355,9 +356,7 @@ return None def stackbase(ui, repo): -# The histedit default base stops at public changesets, branchpoints, -# and merges, which is exactly what we want for a stack. -revs = scmutil.revrange(repo, [histeditdefaultrevset]) +revs = stack.getstack(repo) return revs.last() if revs else None def _statusotherbook(ui, repo): To: lothiraldan, #hg-reviewers Cc: mercurial-devel ___ Mercurial-devel mailing list Mercurial-devel@mercurial-scm.org https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel
D2395: stack: add a new module for stack-related commands
lothiraldan created this revision. Herald added a subscriber: mercurial-devel. Herald added a reviewer: hg-reviewers. REVISION SUMMARY Bootstrap the module with a function that returns the stack for the current revision. The definition of the stack is ihnerited from histedit default revset and used by hg show stack. REPOSITORY rHG Mercurial REVISION DETAIL https://phab.mercurial-scm.org/D2395 AFFECTED FILES mercurial/stack.py CHANGE DETAILS diff --git a/mercurial/stack.py b/mercurial/stack.py new file mode 100644 --- /dev/null +++ b/mercurial/stack.py @@ -0,0 +1,24 @@ +# stack.py - Mercurial functions for stack definition +# +# Copyright Matt Mackall and other +# +# This software may be used and distributed according to the terms of the +# GNU General Public License version 2 or any later version. + +from __future__ import absolute_import + +from . import revsetlang, scmutil + +def getstack(repo, rev=None): +"""return a smartrev of the stack containing either rev if it is not None +or the current working directory parent. + +The stack will always contain all drafts changesets which are ancestors to +the revision and are not merges. +""" +if rev is None: +rev = '.' + +revspec = 'reverse(only(%s) and not public() and not ::merge())' +revset = revsetlang.formatspec(revspec, rev) +return scmutil.revrange(repo, [revset]) To: lothiraldan, #hg-reviewers Cc: mercurial-devel ___ Mercurial-devel mailing list Mercurial-devel@mercurial-scm.org https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel
[Bug 5803] New: Update repo with Cyrillic characters on APFS (High Sierra)
https://bz.mercurial-scm.org/show_bug.cgi?id=5803 Bug ID: 5803 Summary: Update repo with Cyrillic characters on APFS (High Sierra) Product: Mercurial Version: default branch Hardware: Macintosh OS: Mac OS Status: UNCONFIRMED Severity: bug Priority: wish Component: Mercurial Assignee: bugzi...@mercurial-scm.org Reporter: sambr...@gmail.com CC: mercurial-devel@mercurial-scm.org Not sure if it is mercurial or APFS bug, but when I try to update a repo on APFS partition to commit which contains Cyrillic characters(possibly cp-1251 from Windows commit), hg throws: abort: illegal byte sequence: [Code: 255] Workaround: put your repo on HFS+ partition. -- You are receiving this mail because: You are on the CC list for the bug. ___ Mercurial-devel mailing list Mercurial-devel@mercurial-scm.org https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel