D2130: py3: replace file() with open() in test-encoding.t
This revision was automatically updated to reflect the committed changes. Closed by commit rHG035af48b2903: py3: replace file() with open() in test-encoding.t (authored by pulkit, committed by ). REPOSITORY rHG Mercurial CHANGES SINCE LAST UPDATE https://phab.mercurial-scm.org/D2130?vs=5479=5483 REVISION DETAIL https://phab.mercurial-scm.org/D2130 AFFECTED FILES tests/test-encoding.t CHANGE DETAILS diff --git a/tests/test-encoding.t b/tests/test-encoding.t --- a/tests/test-encoding.t +++ b/tests/test-encoding.t @@ -15,9 +15,9 @@ $ hg co 1 files updated, 0 files merged, 0 files removed, 0 files unresolved $ $PYTHON << EOF - > f = file('latin-1', 'w'); f.write("latin-1 e' encoded: \xe9"); f.close() - > f = file('utf-8', 'w'); f.write("utf-8 e' encoded: \xc3\xa9"); f.close() - > f = file('latin-1-tag', 'w'); f.write("\xe9"); f.close() + > f = open('latin-1', 'wb'); f.write(b"latin-1 e' encoded: \xe9"); f.close() + > f = open('utf-8', 'wb'); f.write(b"utf-8 e' encoded: \xc3\xa9"); f.close() + > f = open('latin-1-tag', 'wb'); f.write(b"\xe9"); f.close() > EOF should fail with encoding error To: pulkit, #hg-reviewers, yuja Cc: yuja, mercurial-devel ___ Mercurial-devel mailing list Mercurial-devel@mercurial-scm.org https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel
D2131: py3: replace file() with open() in test-encoding-align.t
This revision was automatically updated to reflect the committed changes. Closed by commit rHGaf9cb761b5f3: py3: replace file() with open() in test-encoding-align.t (authored by pulkit, committed by ). REPOSITORY rHG Mercurial CHANGES SINCE LAST UPDATE https://phab.mercurial-scm.org/D2131?vs=5480=5484 REVISION DETAIL https://phab.mercurial-scm.org/D2131 AFFECTED FILES tests/test-encoding-align.t CHANGE DETAILS diff --git a/tests/test-encoding-align.t b/tests/test-encoding-align.t --- a/tests/test-encoding-align.t +++ b/tests/test-encoding-align.t @@ -6,16 +6,16 @@ $ cd t $ $PYTHON << EOF > # (byte, width) = (6, 4) - > s = "\xe7\x9f\xad\xe5\x90\x8d" + > s = b"\xe7\x9f\xad\xe5\x90\x8d" > # (byte, width) = (7, 7): odd width is good for alignment test - > m = "MIDDLE_" + > m = b"MIDDLE_" > # (byte, width) = (18, 12) - > l = "\xe9\x95\xb7\xe3\x81\x84\xe9\x95\xb7\xe3\x81\x84\xe5\x90\x8d\xe5\x89\x8d" - > f = file('s', 'w'); f.write(s); f.close() - > f = file('m', 'w'); f.write(m); f.close() - > f = file('l', 'w'); f.write(l); f.close() + > l = b"\xe9\x95\xb7\xe3\x81\x84\xe9\x95\xb7\xe3\x81\x84\xe5\x90\x8d\xe5\x89\x8d" + > f = open('s', 'wb'); f.write(s); f.close() + > f = open('m', 'wb'); f.write(m); f.close() + > f = open('l', 'wb'); f.write(l); f.close() > # instant extension to show list of options - > f = file('showoptlist.py', 'w'); f.write("""# encoding: utf-8 + > f = open('showoptlist.py', 'wb'); f.write(b"""# encoding: utf-8 > from mercurial import registrar > cmdtable = {} > command = registrar.command(cmdtable) To: pulkit, #hg-reviewers, yuja Cc: yuja, mercurial-devel ___ Mercurial-devel mailing list Mercurial-devel@mercurial-scm.org https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel
D2109: py3: make sure we return str from __repr__
This revision was automatically updated to reflect the committed changes. Closed by commit rHGc4fa47f880d3: py3: make sure we return str from __repr__ (authored by pulkit, committed by ). REPOSITORY rHG Mercurial CHANGES SINCE LAST UPDATE https://phab.mercurial-scm.org/D2109?vs=5478=5482 REVISION DETAIL https://phab.mercurial-scm.org/D2109 AFFECTED FILES mercurial/match.py CHANGE DETAILS diff --git a/mercurial/match.py b/mercurial/match.py --- a/mercurial/match.py +++ b/mercurial/match.py @@ -13,6 +13,7 @@ from .i18n import _ from . import ( +encoding, error, pathutil, util, @@ -345,7 +346,7 @@ return 'all' def __repr__(self): -return '' +return r'' class nevermatcher(basematcher): '''Matches nothing.''' @@ -368,7 +369,7 @@ return False def __repr__(self): -return '' +return r'' class patternmatcher(basematcher): @@ -397,6 +398,7 @@ def prefix(self): return self._prefix +@encoding.strmethod def __repr__(self): return ('' % self._pats) @@ -424,6 +426,7 @@ any(parentdir in self._roots for parentdir in util.finddirs(dir))) +@encoding.strmethod def __repr__(self): return ('' % self._pats) @@ -452,6 +455,7 @@ def isexact(self): return True +@encoding.strmethod def __repr__(self): return ('' % self._files) @@ -492,6 +496,7 @@ def isexact(self): return self._m1.isexact() +@encoding.strmethod def __repr__(self): return ('' % (self._m1, self._m2)) @@ -558,6 +563,7 @@ def isexact(self): return self._m1.isexact() or self._m2.isexact() +@encoding.strmethod def __repr__(self): return ('' % (self._m1, self._m2)) @@ -638,6 +644,7 @@ def prefix(self): return self._matcher.prefix() and not self._always +@encoding.strmethod def __repr__(self): return ('' % (self._path, self._matcher)) @@ -671,6 +678,7 @@ r |= v return r +@encoding.strmethod def __repr__(self): return ('' % self._matchers) To: pulkit, #hg-reviewers, durin42, yuja Cc: yuja, mercurial-devel ___ Mercurial-devel mailing list Mercurial-devel@mercurial-scm.org https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel
D2132: py3: replace file() with open() in test-convert-hg-source.t
This revision was automatically updated to reflect the committed changes. Closed by commit rHG3c9f2d4dbb39: py3: replace file() with open() in test-convert-hg-source.t (authored by pulkit, committed by ). REPOSITORY rHG Mercurial CHANGES SINCE LAST UPDATE https://phab.mercurial-scm.org/D2132?vs=5481=5485 REVISION DETAIL https://phab.mercurial-scm.org/D2132 AFFECTED FILES tests/test-convert-hg-source.t CHANGE DETAILS diff --git a/tests/test-convert-hg-source.t b/tests/test-convert-hg-source.t --- a/tests/test-convert-hg-source.t +++ b/tests/test-convert-hg-source.t @@ -126,9 +126,9 @@ $ cat > rewrite.py < import sys > # Interlace LF and CRLF - > lines = [(l.rstrip() + ((i % 2) and '\n' or '\r\n')) - > for i, l in enumerate(file(sys.argv[1]))] - > file(sys.argv[1], 'wb').write(''.join(lines)) + > lines = [(l.rstrip() + ((i % 2) and b'\n' or b'\r\n')) + > for i, l in enumerate(open(sys.argv[1], 'rb'))] + > open(sys.argv[1], 'wb').write(b''.join(lines)) > EOF $ $PYTHON rewrite.py new/.hg/shamap $ cd orig To: pulkit, #hg-reviewers, yuja Cc: yuja, mercurial-devel ___ Mercurial-devel mailing list Mercurial-devel@mercurial-scm.org https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel
D1755: logexchange: introduce helper function to get remote path name
pulkit added a comment. I will like to get this series review and iterated upon early in cycle so that we can ship remotenames in the next release. REPOSITORY rHG Mercurial REVISION DETAIL https://phab.mercurial-scm.org/D1755 To: pulkit, #hg-reviewers, durin42 Cc: durin42, mercurial-devel ___ Mercurial-devel mailing list Mercurial-devel@mercurial-scm.org https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel
Re: [PATCH] test-merge-tools: stabilize for Windows
On Sun, 11 Feb 2018 21:39:14 -0500, Matt Harbison wrote: > # HG changeset patch > # User Matt Harbison> # Date 1518400775 18000 > # Sun Feb 11 20:59:35 2018 -0500 > # Node ID 29c42f65c6b609a6bc429fc6d0963d1eb7cc951b > # Parent f91b7f26c68ac87961aa6ef883ba96e5a2822ad3 > test-merge-tools: stabilize for Windows > > This masks the Windows argument parsing insanity[1], so it needs a bit of > explanation. (The security reference in the footnote is probably useful to > keep > in mind if we ever whitelist certain in-repo config settings.) > > 9037c29e9f53 introduced tests that were failing on Windows with an unbalanced > double quote[2]. What ends up happening here is util.shellquote() is double > quoting the file path, but the shell script is placing this ->": "<- right > next > to it. So cmd.exe gets launched with 'lb:base": ""c:\...\f~base.xyz"', which > got interpreted as 'lb:base: "c:\...\f~base.xyz'. If the test is adjusted to > quote like "lb:$labelbase: $base", then MSYS runs interference and strips the > '\' characters. I was able to get the expected result by dropping the quotes > from '": "', and changing the space to underscore. But since we need to glob > away the C: part anyway, just glob away the quote and leave the test > unchanged. > > [1] > https://blogs.msdn.microsoft.com/twistylittlepassagesallalike/2011/04/23/everyone-quotes-command-line-arguments-the-wrong-way/ > [2] > https://buildbot.mercurial-scm.org/builders/Win7%20x86_64%20hg%20tests/builds/441/steps/run-tests.py%20%28python%202.7.13%29/logs/stdio Perhaps, we can instead fix printargs_merge_tool to take prefix:variable pairs as separate arguments: echo "arg: $1:$2" shift 2 ___ Mercurial-devel mailing list Mercurial-devel@mercurial-scm.org https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel
Re: [PATCH 4 of 4] log: add TODO comments about --line-range processing
Yuya Nishihara a écrit : > This is totally unrelated topic, but how would we do if we want to support > non-contiguous range? > > -L file,a:b,c:d > > is ambiguous because file may contain ",". I guess we could iteratively rsplit(",", 1) the file pattern and try to parse "from:to" until it fails, meaning that the remaining would be the file name. Slightly more complicated than it is now, but still doable I think. ___ Mercurial-devel mailing list Mercurial-devel@mercurial-scm.org https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel
Re: [PATCH 6 of 6 V2] merge: invoke cmdutil.fileprefetchhooks() prior to applying updates
On Sun, 11 Feb 2018 22:58:08 -0500, Matt Harbison wrote: > # HG changeset patch > # User Matt Harbison> # Date 1518373556 18000 > # Sun Feb 11 13:25:56 2018 -0500 > # Node ID add5bc8012bbedd24d2b9d3a301bfe0eba892ca4 > # Parent d05ecbfd419747d580100f86a3ffdc3b85574166 > merge: invoke cmdutil.fileprefetchhooks() prior to applying updates > > This moves the file list calculation into core, so other extensions don't need > to duplicate it. > > An alternative to the local import is maybe doing something similar to the > localrepo.prepushoutgoinghooks property. But both of these things seem like > special cases, and I have no idea which is better/preferred. > diff --git a/mercurial/merge.py b/mercurial/merge.py > --- a/mercurial/merge.py > +++ b/mercurial/merge.py > @@ -1385,6 +1385,19 @@ > if i > 0: > yield i, f > > +def _prefetchfiles(repo, ctx, actions): > +"""Invoke ``cmdutil.fileprefetchhooks()`` for the files relevant to the > dict > +of merge actions. ``ctx`` is the context being merged in.""" > + > +# avoid import cycle > +from . import cmdutil cmdutil->merge is reverse dependency. Maybe prefetchfiles() could be moved to scmutil? ___ Mercurial-devel mailing list Mercurial-devel@mercurial-scm.org https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel
D2133: py3: replace file() with open() in test-convert-git.t
yuja added inline comments. INLINE COMMENTS > pulkit wrote in test-convert-git.t:423 > To make chr() return bytes, I did chr().encode('latin-1') but there is > `UnicodeDecodeError: 'ascii' codec can't decode byte 0x80 in position 0: > ordinal not in range(128) `error while writing to file. Python 2 also don't > have the encoding argument to open which Python 3 has. Looks like need to > write a .py file and execute that. Maybe we can steal pycompat.bytechr of py3. It should work on both Pythons. REPOSITORY rHG Mercurial REVISION DETAIL https://phab.mercurial-scm.org/D2133 To: pulkit, #hg-reviewers, yuja Cc: yuja, mercurial-devel ___ Mercurial-devel mailing list Mercurial-devel@mercurial-scm.org https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel
Re: [PATCH 4 of 4] log: add TODO comments about --line-range processing
On Mon, 12 Feb 2018 12:04:21 +0100, Denis Laxalde wrote: > Yuya Nishihara a écrit : > > This is totally unrelated topic, but how would we do if we want to support > > non-contiguous range? > > > > -L file,a:b,c:d > > > > is ambiguous because file may contain ",". > > I guess we could iteratively rsplit(",", 1) the file pattern and try to > parse "from:to" until it fails, meaning that the remaining would be the > file name. Slightly more complicated than it is now, but still doable I > think. That doesn't sound nice because only reason we've introduced -L was to reliably split linerange from file pattern. "1:2" looks odd, but is a valid filename on non-Windows. ___ Mercurial-devel mailing list Mercurial-devel@mercurial-scm.org https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel
Re: [PATCH 4 of 4] log: add TODO comments about --line-range processing
Yuya Nishihara a écrit : > On Mon, 12 Feb 2018 12:04:21 +0100, Denis Laxalde wrote: >> Yuya Nishihara a écrit : >>> This is totally unrelated topic, but how would we do if we want to support >>> non-contiguous range? >>> >>> -L file,a:b,c:d >>> >>> is ambiguous because file may contain ",". >> >> I guess we could iteratively rsplit(",", 1) the file pattern and try to >> parse "from:to" until it fails, meaning that the remaining would be the >> file name. Slightly more complicated than it is now, but still doable I >> think. > > That doesn't sound nice because only reason we've introduced -L was to > reliably > split linerange from file pattern. "1:2" looks odd, but is a valid filename on > non-Windows. I'm afraid I don't follow, could you elaborate a bit? By the way, I worked on this a bit earlier, just after your first email today: https://hg.logilab.org/users/dlaxalde/hg/rev/6d8c75041b21 It seems to be working, but I may have missed something of course. ___ Mercurial-devel mailing list Mercurial-devel@mercurial-scm.org https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel
Re: [PATCH 4 of 4] log: add TODO comments about --line-range processing
On Mon, 12 Feb 2018 08:20:29 +0100, Denis Laxalde wrote: > > if linerange and pats: > > +# TODO: take pats as patterns with no line-range filter > > Do you mean handling "--line-range file1,from:to file2", where "file2" > would be "a pattern with no line-range filter"? Yes. I think that is the only useful interpretation. > > @@ -3421,6 +3422,8 @@ def log(ui, repo, *pats, **opts): > > repo = scmutil.unhidehashlikerevs(repo, opts.get('rev'), 'nowarn') > > revs, differ = logcmdutil.getrevs(repo, pats, opts) > > if linerange: > > +# TODO: should follow file history from logcmdutil._initialrevs(), > > +# then filter the result by logcmdutil._makerevset() and --limit > > I remember having tried something like that earlier but it got too > complicated. Maybe your recent refactorings would make this easier now. I hope so. Currently --limit doesn't work as expected. This is totally unrelated topic, but how would we do if we want to support non-contiguous range? -L file,a:b,c:d is ambiguous because file may contain ",". ___ Mercurial-devel mailing list Mercurial-devel@mercurial-scm.org https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel
D2158: py3: use raw string for open() mode
yuja added a comment. I wanna leave it with no prefix as possible. I think we'll have to bulk-replace `''`s to `b''`s at some point so we can leverage static analysis tools, where `r''` will be unneeded. REPOSITORY rHG Mercurial REVISION DETAIL https://phab.mercurial-scm.org/D2158 To: indygreg, #hg-reviewers Cc: yuja, pulkit, mercurial-devel ___ Mercurial-devel mailing list Mercurial-devel@mercurial-scm.org https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel
[PATCH hglib] [b] ignore close() on non-open clients (issue5751)
# HG changeset patch # User Gábor Stefanik# Date 1518443649 -3600 # Mon Feb 12 14:54:09 2018 +0100 # Node ID fe38aeeb1586464769caa6e9bb819078028fc858 # Parent 1085c904d8c04d51c6897027fe9c7bae0964b64b [b] ignore close() on non-open clients (issue5751) Closing a client twice currently triggers a rather confusing exception. Instead, follow the convention set by Python's file objects, and ignore close() commands on non-open clients. diff -r 1085c904d8c0 -r fe38aeeb1586 hglib/client.py --- a/hglib/client.py Thu Feb 01 15:10:02 2018 -0500 +++ b/hglib/client.py Mon Feb 12 14:54:09 2018 +0100 @@ -294,6 +294,8 @@ return self._close()[0] def _close(self): +if not self.server: +return 0, '' _sout, serr = self.server.communicate() ret = self.server.returncode self.server = None This message, including its attachments, is confidential and the property of NNG Llc. For more information please read NNG's email policy here: https://www.nng.com/email-policy/ By responding to this email you accept the email policy. ___ Mercurial-devel mailing list Mercurial-devel@mercurial-scm.org https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel
D1973: bdiff: write a native version of splitnewlines
durin42 updated this revision to Diff 5487. durin42 marked an inline comment as done. REPOSITORY rHG Mercurial CHANGES SINCE LAST UPDATE https://phab.mercurial-scm.org/D1973?vs=5160=5487 REVISION DETAIL https://phab.mercurial-scm.org/D1973 AFFECTED FILES mercurial/cext/bdiff.c mercurial/mdiff.py mercurial/policy.py mercurial/pure/bdiff.py CHANGE DETAILS diff --git a/mercurial/pure/bdiff.py b/mercurial/pure/bdiff.py --- a/mercurial/pure/bdiff.py +++ b/mercurial/pure/bdiff.py @@ -90,3 +90,13 @@ text = re.sub('[ \t\r]+', ' ', text) text = text.replace(' \n', '\n') return text + +def splitnewlines(text): +'''like str.splitlines, but only split on newlines.''' +lines = [l + '\n' for l in text.split('\n')] +if lines: +if lines[-1] == '\n': +lines.pop() +else: +lines[-1] = lines[-1][:-1] +return lines diff --git a/mercurial/policy.py b/mercurial/policy.py --- a/mercurial/policy.py +++ b/mercurial/policy.py @@ -71,7 +71,7 @@ # keep in sync with "version" in C modules _cextversions = { (r'cext', r'base85'): 1, -(r'cext', r'bdiff'): 1, +(r'cext', r'bdiff'): 2, (r'cext', r'diffhelpers'): 1, (r'cext', r'mpatch'): 1, (r'cext', r'osutil'): 3, diff --git a/mercurial/mdiff.py b/mercurial/mdiff.py --- a/mercurial/mdiff.py +++ b/mercurial/mdiff.py @@ -29,16 +29,7 @@ patches = mpatch.patches patchedsize = mpatch.patchedsize textdiff = bdiff.bdiff - -def splitnewlines(text): -'''like str.splitlines, but only split on newlines.''' -lines = [l + '\n' for l in text.split('\n')] -if lines: -if lines[-1] == '\n': -lines.pop() -else: -lines[-1] = lines[-1][:-1] -return lines +splitnewlines = bdiff.splitnewlines class diffopts(object): '''context is the number of context lines diff --git a/mercurial/cext/bdiff.c b/mercurial/cext/bdiff.c --- a/mercurial/cext/bdiff.c +++ b/mercurial/cext/bdiff.c @@ -180,16 +180,66 @@ return result ? result : PyErr_NoMemory(); } +static bool sliceintolist(PyObject *list, Py_ssize_t destidx, + const char *source, Py_ssize_t len) +{ + PyObject *sliced = PyBytes_FromStringAndSize(source, len); + if (sliced == NULL) + return false; + PyList_SET_ITEM(list, destidx, sliced); + return true; +} + +static PyObject *splitnewlines(PyObject *self, PyObject *args) +{ + const char *text; + Py_ssize_t nelts = 0, size, i, start = 0; + PyObject *result = NULL; + + if (!PyArg_ParseTuple(args, "s#", , )) { + goto abort; + } + if (!size) { + return PyList_New(0); + } + /* This loops to size-1 because if the last byte is a newline, +* we don't want to perform a split there. */ + for (i = 0; i < size - 1; ++i) { + if (text[i] == '\n') { + ++nelts; + } + } + if ((result = PyList_New(nelts + 1)) == NULL) + goto abort; + nelts = 0; + for (i = 0; i < size - 1; ++i) { + if (text[i] == '\n') { + if (!sliceintolist(result, nelts++, text + start, + i - start + 1)) + goto abort; + start = i + 1; + } + } + if (!sliceintolist(result, nelts++, text + start, size - start)) + goto abort; + return result; +abort: + Py_XDECREF(result); + return NULL; +} + static char mdiff_doc[] = "Efficient binary diff."; static PyMethodDef methods[] = { {"bdiff", bdiff, METH_VARARGS, "calculate a binary diff\n"}, {"blocks", blocks, METH_VARARGS, "find a list of matching lines\n"}, {"fixws", fixws, METH_VARARGS, "normalize diff whitespaces\n"}, +{"splitnewlines", splitnewlines, METH_VARARGS, + "like str.splitlines, but only split on newlines\n"}, {NULL, NULL}, }; -static const int version = 1; +static const int version = 2; #ifdef IS_PY3K static struct PyModuleDef bdiff_module = { To: durin42, #hg-reviewers, indygreg, yuja Cc: indygreg, yuja, mercurial-devel ___ Mercurial-devel mailing list Mercurial-devel@mercurial-scm.org https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel
Re: [PATCH] test-merge-tools: stabilize for Windows
On Mon, 12 Feb 2018 08:06:12 -0500, Matt Harbison wrote: > > > On Feb 12, 2018, at 5:27 AM, Yuya Nishiharawrote: > > > >> On Sun, 11 Feb 2018 21:39:14 -0500, Matt Harbison wrote: > >> # HG changeset patch > >> # User Matt Harbison > >> # Date 1518400775 18000 > >> # Sun Feb 11 20:59:35 2018 -0500 > >> # Node ID 29c42f65c6b609a6bc429fc6d0963d1eb7cc951b > >> # Parent f91b7f26c68ac87961aa6ef883ba96e5a2822ad3 > >> test-merge-tools: stabilize for Windows > >> > >> This masks the Windows argument parsing insanity[1], so it needs a bit of > >> explanation. (The security reference in the footnote is probably useful > >> to keep > >> in mind if we ever whitelist certain in-repo config settings.) > >> > >> 9037c29e9f53 introduced tests that were failing on Windows with an > >> unbalanced > >> double quote[2]. What ends up happening here is util.shellquote() is > >> double > >> quoting the file path, but the shell script is placing this ->": "<- right > >> next > >> to it. So cmd.exe gets launched with 'lb:base": ""c:\...\f~base.xyz"', > >> which > >> got interpreted as 'lb:base: "c:\...\f~base.xyz'. If the test is adjusted > >> to > >> quote like "lb:$labelbase: $base", then MSYS runs interference and strips > >> the > >> '\' characters. I was able to get the expected result by dropping the > >> quotes > >> from '": "', and changing the space to underscore. But since we need to > >> glob > >> away the C: part anyway, just glob away the quote and leave the test > >> unchanged. > >> > >> [1] > >> https://blogs.msdn.microsoft.com/twistylittlepassagesallalike/2011/04/23/everyone-quotes-command-line-arguments-the-wrong-way/ > >> [2] > >> https://buildbot.mercurial-scm.org/builders/Win7%20x86_64%20hg%20tests/builds/441/steps/run-tests.py%20%28python%202.7.13%29/logs/stdio > > > > Perhaps, we can instead fix printargs_merge_tool to take prefix:variable > > pairs > > as separate arguments: > > > > echo "arg: $1:$2" > > shift 2 > > I can try that, but the glob adjustment is still necessary (the drive letter > isn’t the same on all platforms), so this fix is effectively hidden. Indeed. Queued the patch, thanks. ___ Mercurial-devel mailing list Mercurial-devel@mercurial-scm.org https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel
D2180: charencode: adjust clang-format enable/disable comments
durin42 created this revision. Herald added a subscriber: mercurial-devel. Herald added a reviewer: hg-reviewers. REVISION SUMMARY We're pretty close to being able to let clang-format manage most of these files. REPOSITORY rHG Mercurial REVISION DETAIL https://phab.mercurial-scm.org/D2180 AFFECTED FILES mercurial/cext/charencode.c mercurial/cext/charencode.h CHANGE DETAILS diff --git a/mercurial/cext/charencode.h b/mercurial/cext/charencode.h --- a/mercurial/cext/charencode.h +++ b/mercurial/cext/charencode.h @@ -25,6 +25,7 @@ PyObject *make_file_foldmap(PyObject *self, PyObject *args); PyObject *jsonescapeu8fast(PyObject *self, PyObject *args); +/* clang-format off */ static const int8_t hextable[256] = { -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, @@ -43,6 +44,7 @@ -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1 }; +/* clang-format on */ static inline int hexdigit(const char *p, Py_ssize_t off) { diff --git a/mercurial/cext/charencode.c b/mercurial/cext/charencode.c --- a/mercurial/cext/charencode.c +++ b/mercurial/cext/charencode.c @@ -65,7 +65,6 @@ '\x58', '\x59', '\x5a', /* x-z */ '\x7b', '\x7c', '\x7d', '\x7e', '\x7f' }; -/* clang-format on */ /* 1: no escape, 2: \, 6: \u */ static const uint8_t jsonlentable[256] = { @@ -102,6 +101,7 @@ '0', '1', '2', '3', '4', '5', '6', '7', '8', '9', 'a', 'b', 'c', 'd', 'e', 'f', }; +/* clang-format on */ /* * Turn a hex-encoded string into binary. To: durin42, #hg-reviewers Cc: mercurial-devel ___ Mercurial-devel mailing list Mercurial-devel@mercurial-scm.org https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel
D2178: pathencode: allow clang-format oversight
durin42 created this revision. Herald added a subscriber: mercurial-devel. Herald added a reviewer: hg-reviewers. REVISION SUMMARY Only had to add two trailing commas to make the file format acceptably! REPOSITORY rHG Mercurial REVISION DETAIL https://phab.mercurial-scm.org/D2178 AFFECTED FILES contrib/clang-format-blacklist mercurial/cext/pathencode.c CHANGE DETAILS diff --git a/mercurial/cext/pathencode.c b/mercurial/cext/pathencode.c --- a/mercurial/cext/pathencode.c +++ b/mercurial/cext/pathencode.c @@ -26,34 +26,34 @@ /* state machine for the fast path */ enum path_state { - START, /* first byte of a path component */ - A, /* "AUX" */ + START, /* first byte of a path component */ + A, /* "AUX" */ AU, - THIRD, /* third of a 3-byte sequence, e.g. "AUX", "NUL" */ - C, /* "CON" or "COMn" */ + THIRD, /* third of a 3-byte sequence, e.g. "AUX", "NUL" */ + C, /* "CON" or "COMn" */ CO, - COMLPT, /* "COM" or "LPT" */ + COMLPT, /* "COM" or "LPT" */ COMLPTn, L, LP, N, NU, - P, /* "PRN" */ + P, /* "PRN" */ PR, - LDOT,/* leading '.' */ - DOT, /* '.' in a non-leading position */ - H, /* ".h" */ - HGDI,/* ".hg", ".d", or ".i" */ + LDOT, /* leading '.' */ + DOT, /* '.' in a non-leading position */ + H,/* ".h" */ + HGDI, /* ".hg", ".d", or ".i" */ SPACE, - DEFAULT /* byte of a path component after the first */ + DEFAULT, /* byte of a path component after the first */ }; /* state machine for dir-encoding */ enum dir_state { DDOT, DH, DHGDI, - DDEFAULT + DDEFAULT, }; static inline int inset(const uint32_t bitset[], char c) @@ -82,7 +82,7 @@ } static inline void hexencode(char *dest, Py_ssize_t *destlen, size_t destsize, -uint8_t c) + uint8_t c) { static const char hexdigit[] = "0123456789abcdef"; @@ -92,14 +92,14 @@ /* 3-byte escape: tilde followed by two hex digits */ static inline void escape3(char *dest, Py_ssize_t *destlen, size_t destsize, - char c) + char c) { charcopy(dest, destlen, destsize, '~'); hexencode(dest, destlen, destsize, c); } -static Py_ssize_t _encodedir(char *dest, size_t destsize, - const char *src, Py_ssize_t len) +static Py_ssize_t _encodedir(char *dest, size_t destsize, const char *src, + Py_ssize_t len) { enum dir_state state = DDEFAULT; Py_ssize_t i = 0, destlen = 0; @@ -126,8 +126,8 @@ if (src[i] == 'g') { state = DHGDI; charcopy(dest, , destsize, src[i++]); - } - else state = DDEFAULT; + } else + state = DDEFAULT; break; case DHGDI: if (src[i] == '/') { @@ -173,17 +173,15 @@ if (newobj) { assert(PyBytes_Check(newobj)); Py_SIZE(newobj)--; - _encodedir(PyBytes_AS_STRING(newobj), newlen, path, - len + 1); + _encodedir(PyBytes_AS_STRING(newobj), newlen, path, len + 1); } return newobj; } static Py_ssize_t _encode(const uint32_t twobytes[8], const uint32_t onebyte[8], - char *dest, Py_ssize_t destlen, size_t destsize, - const char *src, Py_ssize_t len, - int encodedir) + char *dest, Py_ssize_t destlen, size_t destsize, + const char *src, Py_ssize_t len, int encodedir) { enum path_state state = START; Py_ssize_t i = 0; @@ -237,15 +235,15 @@ if (src[i] == 'u') { state = AU; charcopy(dest, , destsize, src[i++]); - } - else state = DEFAULT; + } else + state = DEFAULT; break; case AU: if (src[i] == 'x') { state = THIRD; i++; - } - else state = DEFAULT; + } else + state = DEFAULT; break; case THIRD: state = DEFAULT; @@ -264,24 +262,30 @@ if (src[i] == 'o') { state = CO; charcopy(dest, , destsize, src[i++]); -
D2181: charencode: allow clang-format oversight
durin42 created this revision. Herald added a subscriber: mercurial-devel. Herald added a reviewer: hg-reviewers. REVISION SUMMARY Nice and easy. REPOSITORY rHG Mercurial REVISION DETAIL https://phab.mercurial-scm.org/D2181 AFFECTED FILES contrib/clang-format-blacklist mercurial/cext/charencode.c mercurial/cext/charencode.h CHANGE DETAILS diff --git a/mercurial/cext/charencode.h b/mercurial/cext/charencode.h --- a/mercurial/cext/charencode.h +++ b/mercurial/cext/charencode.h @@ -8,8 +8,8 @@ #ifndef _HG_CHARENCODE_H_ #define _HG_CHARENCODE_H_ +#include "compat.h" #include -#include "compat.h" /* This should be kept in sync with normcasespecs in encoding.py. */ enum normcase_spec { diff --git a/mercurial/cext/charencode.c b/mercurial/cext/charencode.c --- a/mercurial/cext/charencode.c +++ b/mercurial/cext/charencode.c @@ -151,9 +151,8 @@ Py_RETURN_TRUE; } -static inline PyObject *_asciitransform(PyObject *str_obj, - const char table[128], - PyObject *fallback_fn) +static inline PyObject * +_asciitransform(PyObject *str_obj, const char table[128], PyObject *fallback_fn) { char *str, *newstr; Py_ssize_t i, len; @@ -173,12 +172,12 @@ char c = str[i]; if (c & 0x80) { if (fallback_fn != NULL) { - ret = PyObject_CallFunctionObjArgs(fallback_fn, - str_obj, NULL); + ret = PyObject_CallFunctionObjArgs( + fallback_fn, str_obj, NULL); } else { PyObject *err = PyUnicodeDecodeError_Create( - "ascii", str, len, i, (i + 1), - "unexpected code byte"); + "ascii", str, len, i, (i + 1), + "unexpected code byte"); PyErr_SetObject(PyExc_UnicodeDecodeError, err); Py_XDECREF(err); } @@ -220,10 +219,9 @@ Py_ssize_t pos = 0; const char *table; - if (!PyArg_ParseTuple(args, "O!O!O!:make_file_foldmap", - _Type, , - _Type, _obj, - _Type, _fallback)) + if (!PyArg_ParseTuple(args, "O!O!O!:make_file_foldmap", _Type, + , _Type, _obj, _Type, + _fallback)) goto quit; spec = (int)PyInt_AS_LONG(spec_obj); @@ -251,19 +249,19 @@ while (PyDict_Next(dmap, , , )) { if (!dirstate_tuple_check(v)) { PyErr_SetString(PyExc_TypeError, - "expected a dirstate tuple"); + "expected a dirstate tuple"); goto quit; } tuple = (dirstateTupleObject *)v; if (tuple->state != 'r') { PyObject *normed; if (table != NULL) { normed = _asciitransform(k, table, - normcase_fallback); +normcase_fallback); } else { normed = PyObject_CallFunctionObjArgs( - normcase_fallback, k, NULL); + normcase_fallback, k, NULL); } if (normed == NULL) @@ -292,13 +290,13 @@ char c = buf[i]; if (c & 0x80) { PyErr_SetString(PyExc_ValueError, - "cannot process non-ascii str"); + "cannot process non-ascii str"); return -1; } esclen += jsonparanoidlentable[(unsigned char)c]; if (esclen < 0) { PyErr_SetString(PyExc_MemoryError, - "overflow in jsonescapelen"); + "overflow in jsonescapelen"); return -1; } } @@ -308,7 +306,7 @@ esclen += jsonlentable[(unsigned char)c]; if (esclen < 0) { PyErr_SetString(PyExc_MemoryError, - "overflow in jsonescapelen"); + "overflow in jsonescapelen"); return -1;
D2179: diffhelpers: allow clang-format oversight
durin42 created this revision. Herald added a subscriber: mercurial-devel. Herald added a reviewer: hg-reviewers. REVISION SUMMARY One trailing comma! REPOSITORY rHG Mercurial REVISION DETAIL https://phab.mercurial-scm.org/D2179 AFFECTED FILES contrib/clang-format-blacklist mercurial/cext/diffhelpers.c CHANGE DETAILS diff --git a/mercurial/cext/diffhelpers.c b/mercurial/cext/diffhelpers.c --- a/mercurial/cext/diffhelpers.c +++ b/mercurial/cext/diffhelpers.c @@ -16,42 +16,40 @@ static char diffhelpers_doc[] = "Efficient diff parsing"; static PyObject *diffhelpers_Error; - /* fixup the last lines of a and b when the patch has no newline at eof */ static void _fix_newline(PyObject *hunk, PyObject *a, PyObject *b) { Py_ssize_t hunksz = PyList_Size(hunk); - PyObject *s = PyList_GET_ITEM(hunk, hunksz-1); + PyObject *s = PyList_GET_ITEM(hunk, hunksz - 1); char *l = PyBytes_AsString(s); Py_ssize_t alen = PyList_Size(a); Py_ssize_t blen = PyList_Size(b); char c = l[0]; PyObject *hline; Py_ssize_t sz = PyBytes_GET_SIZE(s); - if (sz > 1 && l[sz-2] == '\r') + if (sz > 1 && l[sz - 2] == '\r') /* tolerate CRLF in last line */ sz -= 1; - hline = PyBytes_FromStringAndSize(l, sz-1); + hline = PyBytes_FromStringAndSize(l, sz - 1); if (!hline) { return; } if (c == ' ' || c == '+') { PyObject *rline = PyBytes_FromStringAndSize(l + 1, sz - 2); - PyList_SetItem(b, blen-1, rline); + PyList_SetItem(b, blen - 1, rline); } if (c == ' ' || c == '-') { Py_INCREF(hline); - PyList_SetItem(a, alen-1, hline); + PyList_SetItem(a, alen - 1, hline); } - PyList_SetItem(hunk, hunksz-1, hline); + PyList_SetItem(hunk, hunksz - 1, hline); } /* python callable form of _fix_newline */ -static PyObject * -fix_newline(PyObject *self, PyObject *args) +static PyObject *fix_newline(PyObject *self, PyObject *args) { PyObject *hunk, *a, *b; if (!PyArg_ParseTuple(args, "OOO", , , )) @@ -72,8 +70,7 @@ * The control char from the hunk is saved when inserting into a, but not b * (for performance while deleting files) */ -static PyObject * -addlines(PyObject *self, PyObject *args) +static PyObject *addlines(PyObject *self, PyObject *args) { PyObject *fp, *hunk, *a, *b, *x; @@ -83,16 +80,16 @@ Py_ssize_t todoa, todob; char *s, c; PyObject *l; - if (!PyArg_ParseTuple(args, addlines_format, - , , , , , )) + if (!PyArg_ParseTuple(args, addlines_format, , , , , + , )) return NULL; while (1) { todoa = lena - PyList_Size(a); todob = lenb - PyList_Size(b); num = todoa > todob ? todoa : todob; if (num == 0) - break; + break; for (i = 0; i < num; i++) { x = PyFile_GetLine(fp, 0); s = PyBytes_AsString(x); @@ -131,8 +128,7 @@ * a control char at the start of each line, this char is ignored in the * compare */ -static PyObject * -testhunk(PyObject *self, PyObject *args) +static PyObject *testhunk(PyObject *self, PyObject *args) { PyObject *a, *b; @@ -158,21 +154,16 @@ } static PyMethodDef methods[] = { - {"addlines", addlines, METH_VARARGS, "add lines to a hunk\n"}, - {"fix_newline", fix_newline, METH_VARARGS, "fixup newline counters\n"}, - {"testhunk", testhunk, METH_VARARGS, "test lines in a hunk\n"}, - {NULL, NULL} -}; +{"addlines", addlines, METH_VARARGS, "add lines to a hunk\n"}, +{"fix_newline", fix_newline, METH_VARARGS, "fixup newline counters\n"}, +{"testhunk", testhunk, METH_VARARGS, "test lines in a hunk\n"}, +{NULL, NULL}}; static const int version = 1; #ifdef IS_PY3K static struct PyModuleDef diffhelpers_module = { - PyModuleDef_HEAD_INIT, - "diffhelpers", - diffhelpers_doc, - -1, - methods +PyModuleDef_HEAD_INIT, "diffhelpers", diffhelpers_doc, -1, methods, }; PyMODINIT_FUNC PyInit_diffhelpers(void) @@ -183,22 +174,21 @@ if (m == NULL) return NULL; - diffhelpers_Error = PyErr_NewException("diffhelpers.diffhelpersError", - NULL, NULL); + diffhelpers_Error = + PyErr_NewException("diffhelpers.diffhelpersError", NULL, NULL); Py_INCREF(diffhelpers_Error); PyModule_AddObject(m, "diffhelpersError", diffhelpers_Error); PyModule_AddIntConstant(m, "version", version); return m; } #else -PyMODINIT_FUNC -initdiffhelpers(void) +PyMODINIT_FUNC initdiffhelpers(void) {
D2182: base85: allow clang-format oversight
durin42 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/D2182 AFFECTED FILES contrib/clang-format-blacklist mercurial/cext/base85.c CHANGE DETAILS diff --git a/mercurial/cext/base85.c b/mercurial/cext/base85.c --- a/mercurial/cext/base85.c +++ b/mercurial/cext/base85.c @@ -14,8 +14,9 @@ #include "util.h" -static const char b85chars[] = "0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ" - "abcdefghijklmnopqrstuvwxyz!#$%&()*+-;<=>?@^_`{|}~"; +static const char b85chars[] = +"0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ" +"abcdefghijklmnopqrstuvwxyz!#$%&()*+-;<=>?@^_`{|}~"; static char b85dec[256]; static void b85prep(void) @@ -105,25 +106,25 @@ c = b85dec[(int)*text++] - 1; if (c < 0) return PyErr_Format( - PyExc_ValueError, - "bad base85 character at position %d", - (int)i); + PyExc_ValueError, + "bad base85 character at position %d", + (int)i); acc = acc * 85 + c; } if (i++ < len) { c = b85dec[(int)*text++] - 1; if (c < 0) return PyErr_Format( - PyExc_ValueError, - "bad base85 character at position %d", - (int)i); + PyExc_ValueError, + "bad base85 character at position %d", + (int)i); /* overflow detection: 0x == "|NsC0", * "|NsC" == 0x03030303 */ if (acc > 0x03030303 || (acc *= 85) > 0x - c) return PyErr_Format( - PyExc_ValueError, - "bad base85 sequence at position %d", - (int)i); + PyExc_ValueError, + "bad base85 sequence at position %d", + (int)i); acc += c; } @@ -145,23 +146,19 @@ static char base85_doc[] = "Base85 Data Encoding"; static PyMethodDef methods[] = { - {"b85encode", b85encode, METH_VARARGS, -"Encode text in base85.\n\n" -"If the second parameter is true, pad the result to a multiple of " -"five characters.\n"}, - {"b85decode", b85decode, METH_VARARGS, "Decode base85 text.\n"}, - {NULL, NULL} +{"b85encode", b85encode, METH_VARARGS, + "Encode text in base85.\n\n" + "If the second parameter is true, pad the result to a multiple of " + "five characters.\n"}, +{"b85decode", b85decode, METH_VARARGS, "Decode base85 text.\n"}, +{NULL, NULL}, }; static const int version = 1; #ifdef IS_PY3K static struct PyModuleDef base85_module = { - PyModuleDef_HEAD_INIT, - "base85", - base85_doc, - -1, - methods +PyModuleDef_HEAD_INIT, "base85", base85_doc, -1, methods, }; PyMODINIT_FUNC PyInit_base85(void) diff --git a/contrib/clang-format-blacklist b/contrib/clang-format-blacklist --- a/contrib/clang-format-blacklist +++ b/contrib/clang-format-blacklist @@ -1,6 +1,5 @@ # Files that just need to be migrated to the formatter. # Do not add new files here! -mercurial/cext/base85.c mercurial/cext/bdiff.c mercurial/cext/dirs.c mercurial/cext/manifest.c To: durin42, #hg-reviewers Cc: mercurial-devel ___ Mercurial-devel mailing list Mercurial-devel@mercurial-scm.org https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel
D2183: mpatch: allow clang-format oversight
durin42 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/D2183 AFFECTED FILES contrib/clang-format-blacklist mercurial/cext/mpatch.c CHANGE DETAILS diff --git a/mercurial/cext/mpatch.c b/mercurial/cext/mpatch.c --- a/mercurial/cext/mpatch.c +++ b/mercurial/cext/mpatch.c @@ -55,10 +55,10 @@ ssize_t blen; int r; - PyObject *tmp = PyList_GetItem((PyObject*)bins, pos); + PyObject *tmp = PyList_GetItem((PyObject *)bins, pos); if (!tmp) return NULL; - if (PyObject_AsCharBuffer(tmp, , (Py_ssize_t*))) + if (PyObject_AsCharBuffer(tmp, , (Py_ssize_t *))) return NULL; if ((r = mpatch_decode(buffer, blen, )) < 0) { if (!PyErr_Occurred()) @@ -68,8 +68,7 @@ return res; } -static PyObject * -patches(PyObject *self, PyObject *args) +static PyObject *patches(PyObject *self, PyObject *args) { PyObject *text, *bins, *result; struct mpatch_flist *patch; @@ -123,8 +122,7 @@ } /* calculate size of a patched file directly */ -static PyObject * -patchedsize(PyObject *self, PyObject *args) +static PyObject *patchedsize(PyObject *self, PyObject *args) { long orig, start, end, len, outlen = 0, last = 0, pos = 0; Py_ssize_t patchlen; @@ -147,29 +145,26 @@ if (pos != patchlen) { if (!PyErr_Occurred()) - PyErr_SetString(mpatch_Error, "patch cannot be decoded"); + PyErr_SetString(mpatch_Error, + "patch cannot be decoded"); return NULL; } outlen += orig - last; return Py_BuildValue("l", outlen); } static PyMethodDef methods[] = { - {"patches", patches, METH_VARARGS, "apply a series of patches\n"}, - {"patchedsize", patchedsize, METH_VARARGS, "calculed patched size\n"}, - {NULL, NULL} +{"patches", patches, METH_VARARGS, "apply a series of patches\n"}, +{"patchedsize", patchedsize, METH_VARARGS, "calculed patched size\n"}, +{NULL, NULL}, }; static const int version = 1; #ifdef IS_PY3K static struct PyModuleDef mpatch_module = { - PyModuleDef_HEAD_INIT, - "mpatch", - mpatch_doc, - -1, - methods +PyModuleDef_HEAD_INIT, "mpatch", mpatch_doc, -1, methods, }; PyMODINIT_FUNC PyInit_mpatch(void) @@ -180,22 +175,21 @@ if (m == NULL) return NULL; - mpatch_Error = PyErr_NewException("mercurial.cext.mpatch.mpatchError", - NULL, NULL); + mpatch_Error = + PyErr_NewException("mercurial.cext.mpatch.mpatchError", NULL, NULL); Py_INCREF(mpatch_Error); PyModule_AddObject(m, "mpatchError", mpatch_Error); PyModule_AddIntConstant(m, "version", version); return m; } #else -PyMODINIT_FUNC -initmpatch(void) +PyMODINIT_FUNC initmpatch(void) { PyObject *m; m = Py_InitModule3("mpatch", methods, mpatch_doc); - mpatch_Error = PyErr_NewException("mercurial.cext.mpatch.mpatchError", - NULL, NULL); + mpatch_Error = + PyErr_NewException("mercurial.cext.mpatch.mpatchError", NULL, NULL); PyModule_AddIntConstant(m, "version", version); } #endif diff --git a/contrib/clang-format-blacklist b/contrib/clang-format-blacklist --- a/contrib/clang-format-blacklist +++ b/contrib/clang-format-blacklist @@ -3,7 +3,6 @@ mercurial/cext/bdiff.c mercurial/cext/dirs.c mercurial/cext/manifest.c -mercurial/cext/mpatch.c mercurial/cext/osutil.c mercurial/cext/revlog.c # Vendored code that we should never format: To: durin42, #hg-reviewers Cc: mercurial-devel ___ Mercurial-devel mailing list Mercurial-devel@mercurial-scm.org https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel
Re: [PATCH] test-merge-tools: stabilize for Windows
> On Feb 12, 2018, at 5:27 AM, Yuya Nishiharawrote: > >> On Sun, 11 Feb 2018 21:39:14 -0500, Matt Harbison wrote: >> # HG changeset patch >> # User Matt Harbison >> # Date 1518400775 18000 >> # Sun Feb 11 20:59:35 2018 -0500 >> # Node ID 29c42f65c6b609a6bc429fc6d0963d1eb7cc951b >> # Parent f91b7f26c68ac87961aa6ef883ba96e5a2822ad3 >> test-merge-tools: stabilize for Windows >> >> This masks the Windows argument parsing insanity[1], so it needs a bit of >> explanation. (The security reference in the footnote is probably useful to >> keep >> in mind if we ever whitelist certain in-repo config settings.) >> >> 9037c29e9f53 introduced tests that were failing on Windows with an unbalanced >> double quote[2]. What ends up happening here is util.shellquote() is double >> quoting the file path, but the shell script is placing this ->": "<- right >> next >> to it. So cmd.exe gets launched with 'lb:base": ""c:\...\f~base.xyz"', which >> got interpreted as 'lb:base: "c:\...\f~base.xyz'. If the test is adjusted to >> quote like "lb:$labelbase: $base", then MSYS runs interference and strips the >> '\' characters. I was able to get the expected result by dropping the quotes >> from '": "', and changing the space to underscore. But since we need to glob >> away the C: part anyway, just glob away the quote and leave the test >> unchanged. >> >> [1] >> https://blogs.msdn.microsoft.com/twistylittlepassagesallalike/2011/04/23/everyone-quotes-command-line-arguments-the-wrong-way/ >> [2] >> https://buildbot.mercurial-scm.org/builders/Win7%20x86_64%20hg%20tests/builds/441/steps/run-tests.py%20%28python%202.7.13%29/logs/stdio > > Perhaps, we can instead fix printargs_merge_tool to take prefix:variable pairs > as separate arguments: > > echo "arg: $1:$2" > shift 2 I can try that, but the glob adjustment is still necessary (the drive letter isn’t the same on all platforms), so this fix is effectively hidden. ___ Mercurial-devel mailing list Mercurial-devel@mercurial-scm.org https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel
Re: [PATCH hglib] [b] ignore close() on non-open clients (issue5751)
On Mon, 12 Feb 2018 14:55:57 +0100, Gábor Stefanik wrote: > # HG changeset patch > # User Gábor Stefanik> # Date 1518443649 -3600 > # Mon Feb 12 14:54:09 2018 +0100 > # Node ID fe38aeeb1586464769caa6e9bb819078028fc858 > # Parent 1085c904d8c04d51c6897027fe9c7bae0964b64b > [b] ignore close() on non-open clients (issue5751) ^^^ what's [b]? Thanks, this looks good, except the patch is malformed because of a corporate mail server? > diff -r 1085c904d8c0 -r fe38aeeb1586 hglib/client.py > --- a/hglib/client.py Thu Feb 01 15:10:02 2018 -0500 > +++ b/hglib/client.py Mon Feb 12 14:54:09 2018 +0100 > @@ -294,6 +294,8 @@ > return self._close()[0] > > def _close(self): > +if not self.server: > +return 0, '' I slight prefer moving this to close() so _close() stays as a low-level helper, but that doesn't matter in practice. > _sout, serr = self.server.communicate() > ret = self.server.returncode > self.server = None ___ Mercurial-devel mailing list Mercurial-devel@mercurial-scm.org https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel
D2177: bdiff: add to clang-format oversight
durin42 created this revision. Herald added a subscriber: mercurial-devel. Herald added a reviewer: hg-reviewers. REVISION SUMMARY This file didn't require any complex fixes, so we may as well enable clang-format while I'm editing it. REPOSITORY rHG Mercurial REVISION DETAIL https://phab.mercurial-scm.org/D2177 AFFECTED FILES contrib/clang-format-blacklist mercurial/cext/bdiff.c CHANGE DETAILS diff --git a/mercurial/cext/bdiff.c b/mercurial/cext/bdiff.c --- a/mercurial/cext/bdiff.c +++ b/mercurial/cext/bdiff.c @@ -19,7 +19,6 @@ #include "bitmanipulation.h" #include "util.h" - static PyObject *blocks(PyObject *self, PyObject *args) { PyObject *sa, *sb, *rl = NULL, *m; @@ -82,9 +81,7 @@ _save = PyEval_SaveThread(); lmax = la > lb ? lb : la; - for (ia = sa, ib = sb; -li < lmax && *ia == *ib; -++li, ++ia, ++ib) + for (ia = sa, ib = sb; li < lmax && *ia == *ib; ++li, ++ia, ++ib) if (*ia == '\n') lcommon = li + 1; /* we can almost add: if (li == lmax) lcommon = li; */ @@ -122,7 +119,8 @@ if (h->a1 != la || h->b1 != lb) { len = bl[h->b1].l - bl[lb].l; putbe32((uint32_t)(al[la].l + lcommon - al->l), rb); - putbe32((uint32_t)(al[h->a1].l + lcommon - al->l), rb + 4); + putbe32((uint32_t)(al[h->a1].l + lcommon - al->l), + rb + 4); putbe32((uint32_t)len, rb + 8); memcpy(rb + 12, bl[lb].l, len); rb += 12 + len; @@ -167,8 +165,8 @@ if (c == ' ' || c == '\t' || c == '\r') { if (!allws && (wlen == 0 || w[wlen - 1] != ' ')) w[wlen++] = ' '; - } else if (c == '\n' && !allws - && wlen > 0 && w[wlen - 1] == ' ') { + } else if (c == '\n' && !allws && wlen > 0 && + w[wlen - 1] == ' ') { w[wlen - 1] = '\n'; } else { w[wlen++] = c; @@ -182,25 +180,20 @@ return result ? result : PyErr_NoMemory(); } - static char mdiff_doc[] = "Efficient binary diff."; static PyMethodDef methods[] = { - {"bdiff", bdiff, METH_VARARGS, "calculate a binary diff\n"}, - {"blocks", blocks, METH_VARARGS, "find a list of matching lines\n"}, - {"fixws", fixws, METH_VARARGS, "normalize diff whitespaces\n"}, - {NULL, NULL} +{"bdiff", bdiff, METH_VARARGS, "calculate a binary diff\n"}, +{"blocks", blocks, METH_VARARGS, "find a list of matching lines\n"}, +{"fixws", fixws, METH_VARARGS, "normalize diff whitespaces\n"}, +{NULL, NULL}, }; static const int version = 1; #ifdef IS_PY3K static struct PyModuleDef bdiff_module = { - PyModuleDef_HEAD_INIT, - "bdiff", - mdiff_doc, - -1, - methods +PyModuleDef_HEAD_INIT, "bdiff", mdiff_doc, -1, methods, }; PyMODINIT_FUNC PyInit_bdiff(void) diff --git a/contrib/clang-format-blacklist b/contrib/clang-format-blacklist --- a/contrib/clang-format-blacklist +++ b/contrib/clang-format-blacklist @@ -1,7 +1,6 @@ # Files that just need to be migrated to the formatter. # Do not add new files here! mercurial/cext/base85.c -mercurial/cext/bdiff.c mercurial/cext/charencode.c mercurial/cext/charencode.h mercurial/cext/diffhelpers.c To: durin42, #hg-reviewers Cc: mercurial-devel ___ Mercurial-devel mailing list Mercurial-devel@mercurial-scm.org https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel
Re: [PATCH 4 of 4] log: add TODO comments about --line-range processing
On Mon, 12 Feb 2018 13:42:54 +0100, Denis Laxalde wrote: > Yuya Nishihara a écrit : > > On Mon, 12 Feb 2018 12:04:21 +0100, Denis Laxalde wrote: > >> Yuya Nishihara a écrit : > >>> This is totally unrelated topic, but how would we do if we want to support > >>> non-contiguous range? > >>> > >>> -L file,a:b,c:d > >>> > >>> is ambiguous because file may contain ",". > >> > >> I guess we could iteratively rsplit(",", 1) the file pattern and try to > >> parse "from:to" until it fails, meaning that the remaining would be the > >> file name. Slightly more complicated than it is now, but still doable I > >> think. > > > > That doesn't sound nice because only reason we've introduced -L was to > > reliably > > split linerange from file pattern. "1:2" looks odd, but is a valid filename > > on > > non-Windows. > > I'm afraid I don't follow, could you elaborate a bit? > > By the way, I worked on this a bit earlier, just after your first email > today: > > https://hg.logilab.org/users/dlaxalde/hg/rev/6d8c75041b21 > > It seems to be working, but I may have missed something of course. I meant "1:2,3:4,5:6" could be parsed as either file="1:2,3:4" linerange="5:6" or file="1:2" linerange="3:4,5:6" because "1:2,3:4" is a valid filename. This would get more complicated if we want to support other types of linerange specifier seen in git. ___ Mercurial-devel mailing list Mercurial-devel@mercurial-scm.org https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel
D1973: bdiff: write a native version of splitnewlines
durin42 marked an inline comment as done. durin42 added a comment. Good catches. This should be ready now. I also added bdiff.c to clang-format oversight in a newly inserted parent, because the file is simple enough that doing so was easy. REPOSITORY rHG Mercurial REVISION DETAIL https://phab.mercurial-scm.org/D1973 To: durin42, #hg-reviewers, indygreg, yuja Cc: indygreg, yuja, mercurial-devel ___ Mercurial-devel mailing list Mercurial-devel@mercurial-scm.org https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel
D2189: narrowrevlog: add a TODO around remotefilelog moving to core
durin42 created this revision. Herald added a subscriber: mercurial-devel. Herald added a reviewer: hg-reviewers. REVISION SUMMARY We should clean this up considerably when remotefilelog lands, which we expect to try and accomplish in the near-ish future. REPOSITORY rHG Mercurial REVISION DETAIL https://phab.mercurial-scm.org/D2189 AFFECTED FILES hgext/narrow/narrowrevlog.py CHANGE DETAILS diff --git a/hgext/narrow/narrowrevlog.py b/hgext/narrow/narrowrevlog.py --- a/hgext/narrow/narrowrevlog.py +++ b/hgext/narrow/narrowrevlog.py @@ -156,6 +156,10 @@ # rename-checking logic when on remotefilelog. This # might be incorrect on other non-revlog-based storage # engines, but for now this seems to be fine. +# +# TODO: when remotefilelog is in core, improve this to +# explicitly look for remotefilelog instead of cheating +# with a hasattr check. if util.safehasattr(self, 'node'): node = self.node(rev) # Because renamed() is overridden above to To: durin42, #hg-reviewers Cc: mercurial-devel ___ Mercurial-devel mailing list Mercurial-devel@mercurial-scm.org https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel
D2186: narrowrevlog: replace AssertionError with ProgrammingError
durin42 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/D2186 AFFECTED FILES hgext/narrow/narrowrevlog.py CHANGE DETAILS diff --git a/hgext/narrow/narrowrevlog.py b/hgext/narrow/narrowrevlog.py --- a/hgext/narrow/narrowrevlog.py +++ b/hgext/narrow/narrowrevlog.py @@ -8,6 +8,7 @@ from __future__ import absolute_import from mercurial import ( + error, manifest, revlog, util, @@ -67,8 +68,8 @@ return excludeddir(self._dir, self._node) def write(self, *args): -raise AssertionError('Attempt to write manifest from excluded dir %s' % - self._dir) +raise error.ProgrammingError( +'attempt to write manifest from excluded dir %s' % self._dir) class excludedmanifestrevlog(manifest.manifestrevlog): """Stand-in for excluded treemanifest revlogs. @@ -84,20 +85,20 @@ self._dir = dir def __len__(self): -raise AssertionError('Attempt to get length of excluded dir %s' % - self._dir) +raise error.ProgrammingError( +'attempt to get length of excluded dir %s' % self._dir) def rev(self, node): -raise AssertionError('Attempt to get rev from excluded dir %s' % - self._dir) +raise error.ProgrammingError( +'attempt to get rev from excluded dir %s' % self._dir) def linkrev(self, node): -raise AssertionError('Attempt to get linkrev from excluded dir %s' % - self._dir) +raise error.ProgrammingError( +'attempt to get linkrev from excluded dir %s' % self._dir) def node(self, rev): -raise AssertionError('Attempt to get node from excluded dir %s' % - self._dir) +raise error.ProgrammingError( +'attempt to get node from excluded dir %s' % self._dir) def add(self, *args, **kwargs): # We should never write entries in dirlogs outside the narrow clone. To: durin42, #hg-reviewers Cc: mercurial-devel ___ Mercurial-devel mailing list Mercurial-devel@mercurial-scm.org https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel
D2185: narrowrevlog: document excludeddir class and friends
durin42 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/D2185 AFFECTED FILES hgext/narrow/narrowrevlog.py CHANGE DETAILS diff --git a/hgext/narrow/narrowrevlog.py b/hgext/narrow/narrowrevlog.py --- a/hgext/narrow/narrowrevlog.py +++ b/hgext/narrow/narrowrevlog.py @@ -31,6 +31,16 @@ pass class excludeddir(manifest.treemanifest): +"""Stand-in for a directory that is excluded from the repository. + +With narrowing active on a repository that uses treemanifests, +some of the directory revlogs will be excluded from the resulting +clone. This is a huge storage win for clients, but means we need +some sort of pseudo-manifest to surface to internals so we can +detect a merge conflict outside the narrowspec. That's what this +class is: it stands in for a directory whose node is known, but +whose contents are unknown. +""" def __init__(self, dir, node): super(excludeddir, self).__init__(dir) self._node = node @@ -48,6 +58,7 @@ return self class excludeddirmanifestctx(manifest.treemanifestctx): +"""context wrapper for excludeddir - see that docstring for rationale""" def __init__(self, dir, node): self._dir = dir self._node = node @@ -60,6 +71,15 @@ self._dir) class excludedmanifestrevlog(manifest.manifestrevlog): +"""Stand-in for excluded treemanifest revlogs. + +When narrowing is active on a treemanifest repository, we'll have +references to directories we can't see due to the revlog being +skipped. This class exists to conform to the manifestrevlog +interface for those directories and proactively prevent writes to +outside the narrowspec. +""" + def __init__(self, dir): self._dir = dir To: durin42, #hg-reviewers Cc: mercurial-devel ___ Mercurial-devel mailing list Mercurial-devel@mercurial-scm.org https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel
D2187: manifest: clean up dirlog() to take a d parameter to avoid shadowing dir()
durin42 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/D2187 AFFECTED FILES hgext/narrow/narrowrevlog.py mercurial/manifest.py CHANGE DETAILS diff --git a/mercurial/manifest.py b/mercurial/manifest.py --- a/mercurial/manifest.py +++ b/mercurial/manifest.py @@ -1245,15 +1245,15 @@ self._fulltextcache.clear() self._dirlogcache = {'': self} -def dirlog(self, dir): -if dir: +def dirlog(self, d): +if d: assert self._treeondisk -if dir not in self._dirlogcache: -mfrevlog = manifestrevlog(self.opener, dir, +if d not in self._dirlogcache: +mfrevlog = manifestrevlog(self.opener, d, self._dirlogcache, treemanifest=self._treeondisk) -self._dirlogcache[dir] = mfrevlog -return self._dirlogcache[dir] +self._dirlogcache[d] = mfrevlog +return self._dirlogcache[d] def add(self, m, transaction, link, p1, p2, added, removed, readtree=None): if (p1 in self.fulltextcache and util.safehasattr(m, 'fastdelta') diff --git a/hgext/narrow/narrowrevlog.py b/hgext/narrow/narrowrevlog.py --- a/hgext/narrow/narrowrevlog.py +++ b/hgext/narrow/narrowrevlog.py @@ -116,12 +116,12 @@ # This function is called via debug{revlog,index,data}, but also during # at least some push operations. This will be used to wrap/exclude the # child directories when using treemanifests. -def dirlog(self, dir): -if dir and not dir.endswith('/'): -dir = dir + '/' -if not repo.narrowmatch().visitdir(dir[:-1] or '.'): -return excludedmanifestrevlog(dir) -result = super(narrowmanifestrevlog, self).dirlog(dir) +def dirlog(self, d): +if d and not d.endswith('/'): +d = d + '/' +if not repo.narrowmatch().visitdir(d[:-1] or '.'): +return excludedmanifestrevlog(d) +result = super(narrowmanifestrevlog, self).dirlog(d) makenarrowmanifestrevlog(result, repo) return result To: durin42, #hg-reviewers Cc: mercurial-devel ___ Mercurial-devel mailing list Mercurial-devel@mercurial-scm.org https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel
D2191: narrowspec: consistently use set() to copy sets
durin42 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/D2191 AFFECTED FILES hgext/narrow/narrowspec.py CHANGE DETAILS diff --git a/hgext/narrow/narrowspec.py b/hgext/narrow/narrowspec.py --- a/hgext/narrow/narrowspec.py +++ b/hgext/narrow/narrowspec.py @@ -180,7 +180,7 @@ >>> restrictpatterns({'f1/$non_exitent_var'}, {}, ['f1','f2'], []) (set(['f1/$non_exitent_var']), {}) """ -res_excludes = req_excludes.copy() +res_excludes = set(req_excludes) res_excludes.update(repo_excludes) if not req_includes: res_includes = set(repo_includes) To: durin42, #hg-reviewers Cc: mercurial-devel ___ Mercurial-devel mailing list Mercurial-devel@mercurial-scm.org https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel
D2193: narrowwirepeer: rename expandnarrow capability to exp-expandnarrow
durin42 created this revision. Herald added a subscriber: mercurial-devel. Herald added a reviewer: hg-reviewers. REVISION SUMMARY The expandnarrow functionality lets a client have a shorthand (for Google it's a reference to a checked-in file) for a set of includes and excludes. For testing we should probably implement a simple version of that functionality here. For now, rename the capability so we don't burn the good name in the future if we need to change behavior. It's plausible that this functionality should be dropped from the narrowhg we ship long-term, but I'm dubious as it seems pretty likely other organizations will want similar shorthands for commonly-used subsets of their trees. REPOSITORY rHG Mercurial REVISION DETAIL https://phab.mercurial-scm.org/D2193 AFFECTED FILES hgext/narrow/narrowwirepeer.py CHANGE DETAILS diff --git a/hgext/narrow/narrowwirepeer.py b/hgext/narrow/narrowwirepeer.py --- a/hgext/narrow/narrowwirepeer.py +++ b/hgext/narrow/narrowwirepeer.py @@ -24,7 +24,7 @@ class expandingpeer(peer.__class__): def expandnarrow(self, narrow_include, narrow_exclude, nodes): ui.status(_("expanding narrowspec\n")) -if not self.capable('expandnarrow'): +if not self.capable('exp-expandnarrow'): raise error.Abort( 'peer does not support expanding narrowspecs') To: durin42, #hg-reviewers Cc: mercurial-devel ___ Mercurial-devel mailing list Mercurial-devel@mercurial-scm.org https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel
D2188: narrowrevlog: add what little I can remember about rename filtering
durin42 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/D2188 AFFECTED FILES hgext/narrow/narrowrevlog.py CHANGE DETAILS diff --git a/hgext/narrow/narrowrevlog.py b/hgext/narrow/narrowrevlog.py --- a/hgext/narrow/narrowrevlog.py +++ b/hgext/narrow/narrowrevlog.py @@ -139,6 +139,12 @@ def makenarrowfilelog(fl, narrowmatch): class narrowfilelog(fl.__class__): def renamed(self, node): +# Renames that come from outside the narrowspec are +# problematic at least for git-diffs, because we lack the +# base text for the rename. This logic was introduced in +# 3cd72b1 of narrowhg (authored by martinvonz, reviewed by +# adgar), but that revision doesn't have any additional +# commentary on what problems we can encounter. m = super(narrowfilelog, self).renamed(node) if m and not narrowmatch(m[0]): return None To: durin42, #hg-reviewers Cc: mercurial-devel ___ Mercurial-devel mailing list Mercurial-devel@mercurial-scm.org https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel
D2008: revlog: move ELLIPSIS_NODE_FLAG to core from narrowrevlog
durin42 updated this revision to Diff 5499. REPOSITORY rHG Mercurial CHANGES SINCE LAST UPDATE https://phab.mercurial-scm.org/D2008?vs=5158=5499 REVISION DETAIL https://phab.mercurial-scm.org/D2008 AFFECTED FILES hgext/narrow/narrowchangegroup.py hgext/narrow/narrowrevlog.py hgext/narrow/narrowtemplates.py mercurial/revlog.py CHANGE DETAILS diff --git a/mercurial/revlog.py b/mercurial/revlog.py --- a/mercurial/revlog.py +++ b/mercurial/revlog.py @@ -58,6 +58,7 @@ # Dummy value until file format is finalized. # Reminder: change the bounds check in revlog.__init__ when this is changed. REVLOGV2 = 0xDEAD +ELLIPSIS_NODE_FLAG = (1 << 14) FLAG_INLINE_DATA = (1 << 16) FLAG_GENERALDELTA = (1 << 17) REVLOG_DEFAULT_FLAGS = FLAG_INLINE_DATA @@ -76,6 +77,7 @@ REVIDX_ISCENSORED, REVIDX_ELLIPSIS, REVIDX_EXTSTORED, +ELLIPSIS_NODE_FLAG, ] REVIDX_KNOWN_FLAGS = util.bitsfrom(REVIDX_FLAGS_ORDER) diff --git a/hgext/narrow/narrowtemplates.py b/hgext/narrow/narrowtemplates.py --- a/hgext/narrow/narrowtemplates.py +++ b/hgext/narrow/narrowtemplates.py @@ -8,15 +8,14 @@ from __future__ import absolute_import from mercurial import ( +revlog, revset, templatekw, util, ) -from . import narrowrevlog - def _isellipsis(repo, rev): -if repo.changelog.flags(rev) & narrowrevlog.ELLIPSIS_NODE_FLAG: +if repo.changelog.flags(rev) & revlog.ELLIPSIS_NODE_FLAG: return True return False diff --git a/hgext/narrow/narrowrevlog.py b/hgext/narrow/narrowrevlog.py --- a/hgext/narrow/narrowrevlog.py +++ b/hgext/narrow/narrowrevlog.py @@ -13,11 +13,6 @@ util, ) -ELLIPSIS_NODE_FLAG = 1 << 14 -revlog.REVIDX_KNOWN_FLAGS |= ELLIPSIS_NODE_FLAG -if ELLIPSIS_NODE_FLAG not in revlog.REVIDX_FLAGS_ORDER: -revlog.REVIDX_FLAGS_ORDER.append(ELLIPSIS_NODE_FLAG) - def readtransform(self, text): return text, False @@ -27,7 +22,7 @@ def rawtransform(self, text): return False -revlog.addflagprocessor(ELLIPSIS_NODE_FLAG, +revlog.addflagprocessor(revlog.ELLIPSIS_NODE_FLAG, (readtransform, writetransform, rawtransform)) def setup(): diff --git a/hgext/narrow/narrowchangegroup.py b/hgext/narrow/narrowchangegroup.py --- a/hgext/narrow/narrowchangegroup.py +++ b/hgext/narrow/narrowchangegroup.py @@ -15,12 +15,12 @@ manifest, mdiff, node, +revlog, util, ) from . import ( narrowrepo, -narrowrevlog, ) def setup(): @@ -83,11 +83,11 @@ extensions.wrapfunction( changegroup.cg1packer, 'generatefiles', generatefiles) -def ellipsisdata(packer, rev, revlog, p1, p2, data, linknode): -n = revlog.node(rev) -p1n, p2n = revlog.node(p1), revlog.node(p2) -flags = revlog.flags(rev) -flags |= narrowrevlog.ELLIPSIS_NODE_FLAG +def ellipsisdata(packer, rev, revlog_, p1, p2, data, linknode): +n = revlog_.node(rev) +p1n, p2n = revlog_.node(p1), revlog_.node(p2) +flags = revlog_.flags(rev) +flags |= revlog.ELLIPSIS_NODE_FLAG meta = packer.builddeltaheader( n, p1n, p2n, node.nullid, linknode, flags) # TODO: try and actually send deltas for ellipsis data blocks To: durin42, indygreg, #hg-reviewers Cc: martinvonz, mercurial-devel ___ Mercurial-devel mailing list Mercurial-devel@mercurial-scm.org https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel
D2184: narrowrepo: add docstring for narrowpats
durin42 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/D2184 AFFECTED FILES hgext/narrow/narrowrepo.py CHANGE DETAILS diff --git a/hgext/narrow/narrowrepo.py b/hgext/narrow/narrowrepo.py --- a/hgext/narrow/narrowrepo.py +++ b/hgext/narrow/narrowrepo.py @@ -75,6 +75,10 @@ @localrepo.repofilecache(narrowspec.FILENAME) def narrowpats(self): +"""matcher patterns for this repository's narrowspec + +A tuple of (includes, excludes). +""" return narrowspec.load(self) @localrepo.repofilecache(narrowspec.FILENAME) To: durin42, #hg-reviewers Cc: mercurial-devel ___ Mercurial-devel mailing list Mercurial-devel@mercurial-scm.org https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel
[PATCH 1 of 2 V2] label: enforce the lack of leading or trailing white space
# HG changeset patch # User Boris Feld# Date 1518448171 -3600 # Mon Feb 12 16:09:31 2018 +0100 # Node ID f02fd7ca256d044c4a51c3f3fc0ecaf95d23e03d # Parent 80e5210df25c330bd2a4e8f12385422545cb69bf # EXP-Topic noname # Available At https://bitbucket.org/octobus/mercurial-devel/ # hg pull https://bitbucket.org/octobus/mercurial-devel/ -r f02fd7ca256d label: enforce the lack of leading or trailing white space In practice, all commands create label are currently striping external white space. Let us enforce this logic at a lower level before starting to rely on it elsewhere. diff --git a/mercurial/scmutil.py b/mercurial/scmutil.py --- a/mercurial/scmutil.py +++ b/mercurial/scmutil.py @@ -267,6 +267,8 @@ def checknewlabel(repo, lbl, kind): raise error.Abort(_("cannot use an integer as a name")) except ValueError: pass +if lbl.strip() != lbl: +raise error.Abort(_("leading or trailing whitespace in name %r") % lbl) def checkfilename(f): '''Check that the filename f is an acceptable filename for a tracked file''' ___ Mercurial-devel mailing list Mercurial-devel@mercurial-scm.org https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel
[PATCH 2 of 2 V2] revset: skip old style lookup if external whitespace are detected
# HG changeset patch # User Boris Feld# Date 1518448909 -3600 # Mon Feb 12 16:21:49 2018 +0100 # Node ID b0f45e1376e2d0f32023e197c51802bc21c60490 # Parent f02fd7ca256d044c4a51c3f3fc0ecaf95d23e03d # EXP-Topic noname # Available At https://bitbucket.org/octobus/mercurial-devel/ # hg pull https://bitbucket.org/octobus/mercurial-devel/ -r b0f45e1376e2 revset: skip old style lookup if external whitespace are detected Since label cannot contains leading or trailing whitespace we can skip looking for them. This is useful in repository 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 diff --git a/mercurial/revsetlang.py b/mercurial/revsetlang.py --- a/mercurial/revsetlang.py +++ b/mercurial/revsetlang.py @@ -96,7 +96,7 @@ def tokenize(program, lookup=None, symin # attempt to parse old-style ranges first to deal with # things like old-tag which contain query metacharacters parts = program.split(':', 1) -if all(lookup(sym) for sym in parts if sym): +if all((sym.strip() == sym and lookup(sym)) for sym in parts if sym): if parts[0]: yield ('symbol', parts[0], 0) if len(parts) > 1: ___ Mercurial-devel mailing list Mercurial-devel@mercurial-scm.org https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel
D1973: bdiff: write a native version of splitnewlines
indygreg accepted this revision. indygreg added a comment. I'm happy with this as a first revision. While I'm accepting as hg-reviewers, I think C code should have an extra set of eyes. So I'll defer to @yuja to queue it. For the record, I'm no fan of not having braces for all bodies of conditionals. Can't wait to globally reformat our code to fix that. INLINE COMMENTS > yuja wrote in bdiff.c:185 > Nit: `static bool sliceintolist(` This doesn't need to be static. I'd declare it as `inline bool sliceintolist(`. REPOSITORY rHG Mercurial REVISION DETAIL https://phab.mercurial-scm.org/D1973 To: durin42, #hg-reviewers, indygreg, yuja Cc: indygreg, yuja, mercurial-devel ___ Mercurial-devel mailing list Mercurial-devel@mercurial-scm.org https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel
D2180: charencode: adjust clang-format enable/disable comments
This revision was automatically updated to reflect the committed changes. Closed by commit rHG81199632fa42: charencode: adjust clang-format enable/disable comments (authored by durin42, committed by ). REPOSITORY rHG Mercurial CHANGES SINCE LAST UPDATE https://phab.mercurial-scm.org/D2180?vs=5490=5497 REVISION DETAIL https://phab.mercurial-scm.org/D2180 AFFECTED FILES mercurial/cext/charencode.c mercurial/cext/charencode.h CHANGE DETAILS diff --git a/mercurial/cext/charencode.h b/mercurial/cext/charencode.h --- a/mercurial/cext/charencode.h +++ b/mercurial/cext/charencode.h @@ -25,6 +25,7 @@ PyObject *make_file_foldmap(PyObject *self, PyObject *args); PyObject *jsonescapeu8fast(PyObject *self, PyObject *args); +/* clang-format off */ static const int8_t hextable[256] = { -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, @@ -43,6 +44,7 @@ -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1 }; +/* clang-format on */ static inline int hexdigit(const char *p, Py_ssize_t off) { diff --git a/mercurial/cext/charencode.c b/mercurial/cext/charencode.c --- a/mercurial/cext/charencode.c +++ b/mercurial/cext/charencode.c @@ -65,7 +65,6 @@ '\x58', '\x59', '\x5a', /* x-z */ '\x7b', '\x7c', '\x7d', '\x7e', '\x7f' }; -/* clang-format on */ /* 1: no escape, 2: \, 6: \u */ static const uint8_t jsonlentable[256] = { @@ -102,6 +101,7 @@ '0', '1', '2', '3', '4', '5', '6', '7', '8', '9', 'a', 'b', 'c', 'd', 'e', 'f', }; +/* clang-format on */ /* * Turn a hex-encoded string into binary. To: durin42, #hg-reviewers, indygreg Cc: mercurial-devel ___ Mercurial-devel mailing list Mercurial-devel@mercurial-scm.org https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel
D2195: tests: use `hello` not `capabilities` over ssh
durin42 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/D2195 AFFECTED FILES tests/test-narrow-clone-non-narrow-server.t CHANGE DETAILS diff --git a/tests/test-narrow-clone-non-narrow-server.t b/tests/test-narrow-clone-non-narrow-server.t --- a/tests/test-narrow-clone-non-narrow-server.t +++ b/tests/test-narrow-clone-non-narrow-server.t @@ -18,7 +18,7 @@ $ cat hg.pid >> "$DAEMON_PIDS" Verify that narrow is advertised in the bundle2 capabilities: - $ echo capabilities | hg -R . serve --stdio | \ + $ echo hello | hg -R . serve --stdio | \ > python -c "import sys, urllib; print urllib.unquote_plus(list(sys.stdin)[1])" | grep narrow narrow=v0 To: durin42, #hg-reviewers Cc: mercurial-devel ___ Mercurial-devel mailing list Mercurial-devel@mercurial-scm.org https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel
D2192: narrow: make restrictpatterns a little more idiomatic
durin42 created this revision. Herald added a subscriber: mercurial-devel. Herald added a reviewer: hg-reviewers. REVISION SUMMARY I'm not sure why invalid_includes was an out-param, but it doesn't look like there's any reason for it to be now. REPOSITORY rHG Mercurial REVISION DETAIL https://phab.mercurial-scm.org/D2192 AFFECTED FILES hgext/narrow/narrowbundle2.py hgext/narrow/narrowcommands.py hgext/narrow/narrowspec.py CHANGE DETAILS diff --git a/hgext/narrow/narrowspec.py b/hgext/narrow/narrowspec.py --- a/hgext/narrow/narrowspec.py +++ b/hgext/narrow/narrowspec.py @@ -153,35 +153,34 @@ repo = share._getsrcrepo(repo) repo.vfs.write(FILENAME, spec) -def restrictpatterns(req_includes, req_excludes, repo_includes, repo_excludes, - invalid_includes=None): +def restrictpatterns(req_includes, req_excludes, repo_includes, repo_excludes): r""" Restricts the patterns according to repo settings, results in a logical AND operation :param req_includes: requested includes :param req_excludes: requested excludes :param repo_includes: repo includes :param repo_excludes: repo excludes -:param invalid_includes: an array to collect invalid includes -:return: include and exclude patterns +:return: include patterns, exclude patterns, and invalid include patterns. >>> restrictpatterns({'f1','f2'}, {}, ['f1'], []) -(set(['f1']), {}) +(set(['f1']), {}, []) >>> restrictpatterns({'f1'}, {}, ['f1','f2'], []) -(set(['f1']), {}) +(set(['f1']), {}, []) >>> restrictpatterns({'f1/fc1', 'f3/fc3'}, {}, ['f1','f2'], []) -(set(['f1/fc1']), {}) +(set(['f1/fc1']), {}, []) >>> restrictpatterns({'f1_fc1'}, {}, ['f1','f2'], []) -([], set(['path:.'])) +([], set(['path:.']), []) >>> restrictpatterns({'f1/../f2/fc2'}, {}, ['f1','f2'], []) -(set(['f2/fc2']), {}) +(set(['f2/fc2']), {}, []) >>> restrictpatterns({'f1/../f3/fc3'}, {}, ['f1','f2'], []) -([], set(['path:.'])) +([], set(['path:.']), []) >>> restrictpatterns({'f1/$non_exitent_var'}, {}, ['f1','f2'], []) -(set(['f1/$non_exitent_var']), {}) +(set(['f1/$non_exitent_var']), {}, []) """ res_excludes = set(req_excludes) res_excludes.update(repo_excludes) +invalid_includes = [] if not req_includes: res_includes = set(repo_includes) elif 'path:.' not in repo_includes: @@ -197,12 +196,12 @@ valid = True res_includes.append(req_include) break -if not valid and invalid_includes is not None: +if not valid: invalid_includes.append(req_include) if len(res_includes) == 0: res_excludes = {'path:.'} else: res_includes = set(res_includes) else: res_includes = set(req_includes) -return res_includes, res_excludes +return res_includes, res_excludes, invalid_includes diff --git a/hgext/narrow/narrowcommands.py b/hgext/narrow/narrowcommands.py --- a/hgext/narrow/narrowcommands.py +++ b/hgext/narrow/narrowcommands.py @@ -134,7 +134,7 @@ repo_includes, repo_excludes = repo.narrowpats includes = set(opts.get('include', [])) excludes = set(opts.get('exclude', [])) -includes, excludes = narrowspec.restrictpatterns( +includes, excludes, unused_invalid = narrowspec.restrictpatterns( includes, excludes, repo_includes, repo_excludes) if includes: opts['include'] = includes diff --git a/hgext/narrow/narrowbundle2.py b/hgext/narrow/narrowbundle2.py --- a/hgext/narrow/narrowbundle2.py +++ b/hgext/narrow/narrowbundle2.py @@ -346,10 +346,8 @@ req_includes = set(kwargs.get('includepats', [])) req_excludes = set(kwargs.get('excludepats', [])) -invalid_includes = [] -req_includes, req_excludes = narrowspec.restrictpatterns( -req_includes, req_excludes, -user_includes, user_excludes, invalid_includes) +req_includes, req_excludes, invalid_includes = narrowspec.restrictpatterns( +req_includes, req_excludes, user_includes, user_excludes) if invalid_includes: raise error.Abort( To: durin42, #hg-reviewers Cc: mercurial-devel ___ Mercurial-devel mailing list Mercurial-devel@mercurial-scm.org https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel
D2194: narrowwirepeer: add TODO about how we add wireproto args to unbundle :(
durin42 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/D2194 AFFECTED FILES hgext/narrow/narrowwirepeer.py CHANGE DETAILS diff --git a/hgext/narrow/narrowwirepeer.py b/hgext/narrow/narrowwirepeer.py --- a/hgext/narrow/narrowwirepeer.py +++ b/hgext/narrow/narrowwirepeer.py @@ -43,6 +43,8 @@ def wirereposetup(ui, peer): def wrapped(orig, cmd, *args, **kwargs): if cmd == 'unbundle': +# TODO: don't blindly add include/exclude wireproto +# arguments to unbundle. include, exclude = repo.narrowpats kwargs["includepats"] = ','.join(include) kwargs["excludepats"] = ','.join(exclude) To: durin42, #hg-reviewers Cc: mercurial-devel ___ Mercurial-devel mailing list Mercurial-devel@mercurial-scm.org https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel
D2178: pathencode: allow clang-format oversight
indygreg accepted this revision. indygreg added inline comments. This revision is now accepted and ready to land. INLINE COMMENTS > pathencode.c:129-130 > charcopy(dest, , destsize, src[i++]); > - } > - else state = DDEFAULT; > + } else > + state = DDEFAULT; > break; I actually prefer the old style. But the good thing about using clang-format is we can bikeshed on the style later and mass rewrite things after that debate has concluded with minimal effort. So getting things to clang format is the important goal here, not bikeshedding about the style it is using today. > pathencode.c:283-284 > switch (src[i]) { > - case '1': case '2': case '3': case '4': case '5': > - case '6': case '7': case '8': case '9': > state = COMLPTn; /me screams REPOSITORY rHG Mercurial REVISION DETAIL https://phab.mercurial-scm.org/D2178 To: durin42, #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
D2178: pathencode: allow clang-format oversight
This revision was automatically updated to reflect the committed changes. Closed by commit rHG44cb058bc0d3: pathencode: allow clang-format oversight (authored by durin42, committed by ). REPOSITORY rHG Mercurial CHANGES SINCE LAST UPDATE https://phab.mercurial-scm.org/D2178?vs=5488=5495 REVISION DETAIL https://phab.mercurial-scm.org/D2178 AFFECTED FILES contrib/clang-format-blacklist mercurial/cext/pathencode.c CHANGE DETAILS diff --git a/mercurial/cext/pathencode.c b/mercurial/cext/pathencode.c --- a/mercurial/cext/pathencode.c +++ b/mercurial/cext/pathencode.c @@ -26,34 +26,34 @@ /* state machine for the fast path */ enum path_state { - START, /* first byte of a path component */ - A, /* "AUX" */ + START, /* first byte of a path component */ + A, /* "AUX" */ AU, - THIRD, /* third of a 3-byte sequence, e.g. "AUX", "NUL" */ - C, /* "CON" or "COMn" */ + THIRD, /* third of a 3-byte sequence, e.g. "AUX", "NUL" */ + C, /* "CON" or "COMn" */ CO, - COMLPT, /* "COM" or "LPT" */ + COMLPT, /* "COM" or "LPT" */ COMLPTn, L, LP, N, NU, - P, /* "PRN" */ + P, /* "PRN" */ PR, - LDOT,/* leading '.' */ - DOT, /* '.' in a non-leading position */ - H, /* ".h" */ - HGDI,/* ".hg", ".d", or ".i" */ + LDOT, /* leading '.' */ + DOT, /* '.' in a non-leading position */ + H,/* ".h" */ + HGDI, /* ".hg", ".d", or ".i" */ SPACE, - DEFAULT /* byte of a path component after the first */ + DEFAULT, /* byte of a path component after the first */ }; /* state machine for dir-encoding */ enum dir_state { DDOT, DH, DHGDI, - DDEFAULT + DDEFAULT, }; static inline int inset(const uint32_t bitset[], char c) @@ -82,7 +82,7 @@ } static inline void hexencode(char *dest, Py_ssize_t *destlen, size_t destsize, -uint8_t c) + uint8_t c) { static const char hexdigit[] = "0123456789abcdef"; @@ -92,14 +92,14 @@ /* 3-byte escape: tilde followed by two hex digits */ static inline void escape3(char *dest, Py_ssize_t *destlen, size_t destsize, - char c) + char c) { charcopy(dest, destlen, destsize, '~'); hexencode(dest, destlen, destsize, c); } -static Py_ssize_t _encodedir(char *dest, size_t destsize, - const char *src, Py_ssize_t len) +static Py_ssize_t _encodedir(char *dest, size_t destsize, const char *src, + Py_ssize_t len) { enum dir_state state = DDEFAULT; Py_ssize_t i = 0, destlen = 0; @@ -126,8 +126,8 @@ if (src[i] == 'g') { state = DHGDI; charcopy(dest, , destsize, src[i++]); - } - else state = DDEFAULT; + } else + state = DDEFAULT; break; case DHGDI: if (src[i] == '/') { @@ -173,17 +173,15 @@ if (newobj) { assert(PyBytes_Check(newobj)); Py_SIZE(newobj)--; - _encodedir(PyBytes_AS_STRING(newobj), newlen, path, - len + 1); + _encodedir(PyBytes_AS_STRING(newobj), newlen, path, len + 1); } return newobj; } static Py_ssize_t _encode(const uint32_t twobytes[8], const uint32_t onebyte[8], - char *dest, Py_ssize_t destlen, size_t destsize, - const char *src, Py_ssize_t len, - int encodedir) + char *dest, Py_ssize_t destlen, size_t destsize, + const char *src, Py_ssize_t len, int encodedir) { enum path_state state = START; Py_ssize_t i = 0; @@ -237,15 +235,15 @@ if (src[i] == 'u') { state = AU; charcopy(dest, , destsize, src[i++]); - } - else state = DEFAULT; + } else + state = DEFAULT; break; case AU: if (src[i] == 'x') { state = THIRD; i++; - } - else state = DEFAULT; + } else + state = DEFAULT; break; case THIRD: state = DEFAULT; @@ -264,24 +262,30 @@ if (src[i] == 'o') { state = CO;
D2179: diffhelpers: allow clang-format oversight
This revision was automatically updated to reflect the committed changes. Closed by commit rHG7f8338b87c88: diffhelpers: allow clang-format oversight (authored by durin42, committed by ). CHANGED PRIOR TO COMMIT https://phab.mercurial-scm.org/D2179?vs=5489=5496#toc REPOSITORY rHG Mercurial CHANGES SINCE LAST UPDATE https://phab.mercurial-scm.org/D2179?vs=5489=5496 REVISION DETAIL https://phab.mercurial-scm.org/D2179 AFFECTED FILES contrib/clang-format-blacklist mercurial/cext/diffhelpers.c CHANGE DETAILS diff --git a/mercurial/cext/diffhelpers.c b/mercurial/cext/diffhelpers.c --- a/mercurial/cext/diffhelpers.c +++ b/mercurial/cext/diffhelpers.c @@ -16,42 +16,40 @@ static char diffhelpers_doc[] = "Efficient diff parsing"; static PyObject *diffhelpers_Error; - /* fixup the last lines of a and b when the patch has no newline at eof */ static void _fix_newline(PyObject *hunk, PyObject *a, PyObject *b) { Py_ssize_t hunksz = PyList_Size(hunk); - PyObject *s = PyList_GET_ITEM(hunk, hunksz-1); + PyObject *s = PyList_GET_ITEM(hunk, hunksz - 1); char *l = PyBytes_AsString(s); Py_ssize_t alen = PyList_Size(a); Py_ssize_t blen = PyList_Size(b); char c = l[0]; PyObject *hline; Py_ssize_t sz = PyBytes_GET_SIZE(s); - if (sz > 1 && l[sz-2] == '\r') + if (sz > 1 && l[sz - 2] == '\r') /* tolerate CRLF in last line */ sz -= 1; - hline = PyBytes_FromStringAndSize(l, sz-1); + hline = PyBytes_FromStringAndSize(l, sz - 1); if (!hline) { return; } if (c == ' ' || c == '+') { PyObject *rline = PyBytes_FromStringAndSize(l + 1, sz - 2); - PyList_SetItem(b, blen-1, rline); + PyList_SetItem(b, blen - 1, rline); } if (c == ' ' || c == '-') { Py_INCREF(hline); - PyList_SetItem(a, alen-1, hline); + PyList_SetItem(a, alen - 1, hline); } - PyList_SetItem(hunk, hunksz-1, hline); + PyList_SetItem(hunk, hunksz - 1, hline); } /* python callable form of _fix_newline */ -static PyObject * -fix_newline(PyObject *self, PyObject *args) +static PyObject *fix_newline(PyObject *self, PyObject *args) { PyObject *hunk, *a, *b; if (!PyArg_ParseTuple(args, "OOO", , , )) @@ -72,8 +70,7 @@ * The control char from the hunk is saved when inserting into a, but not b * (for performance while deleting files) */ -static PyObject * -addlines(PyObject *self, PyObject *args) +static PyObject *addlines(PyObject *self, PyObject *args) { PyObject *fp, *hunk, *a, *b, *x; @@ -83,16 +80,16 @@ Py_ssize_t todoa, todob; char *s, c; PyObject *l; - if (!PyArg_ParseTuple(args, addlines_format, - , , , , , )) + if (!PyArg_ParseTuple(args, addlines_format, , , , , + , )) return NULL; while (1) { todoa = lena - PyList_Size(a); todob = lenb - PyList_Size(b); num = todoa > todob ? todoa : todob; if (num == 0) - break; + break; for (i = 0; i < num; i++) { x = PyFile_GetLine(fp, 0); s = PyBytes_AsString(x); @@ -131,8 +128,7 @@ * a control char at the start of each line, this char is ignored in the * compare */ -static PyObject * -testhunk(PyObject *self, PyObject *args) +static PyObject *testhunk(PyObject *self, PyObject *args) { PyObject *a, *b; @@ -158,21 +154,16 @@ } static PyMethodDef methods[] = { - {"addlines", addlines, METH_VARARGS, "add lines to a hunk\n"}, - {"fix_newline", fix_newline, METH_VARARGS, "fixup newline counters\n"}, - {"testhunk", testhunk, METH_VARARGS, "test lines in a hunk\n"}, - {NULL, NULL} -}; +{"addlines", addlines, METH_VARARGS, "add lines to a hunk\n"}, +{"fix_newline", fix_newline, METH_VARARGS, "fixup newline counters\n"}, +{"testhunk", testhunk, METH_VARARGS, "test lines in a hunk\n"}, +{NULL, NULL}}; static const int version = 1; #ifdef IS_PY3K static struct PyModuleDef diffhelpers_module = { - PyModuleDef_HEAD_INIT, - "diffhelpers", - diffhelpers_doc, - -1, - methods +PyModuleDef_HEAD_INIT, "diffhelpers", diffhelpers_doc, -1, methods, }; PyMODINIT_FUNC PyInit_diffhelpers(void) @@ -183,22 +174,21 @@ if (m == NULL) return NULL; - diffhelpers_Error = PyErr_NewException("diffhelpers.diffhelpersError", - NULL, NULL); + diffhelpers_Error = + PyErr_NewException("diffhelpers.diffhelpersError", NULL, NULL); Py_INCREF(diffhelpers_Error); PyModule_AddObject(m,
D1974: narrow: import experimental extension from narrowhg revision cb51d673e9c5
durin42 updated this revision to Diff 5498. durin42 marked 12 inline comments as done. REPOSITORY rHG Mercurial CHANGES SINCE LAST UPDATE https://phab.mercurial-scm.org/D1974?vs=5095=5498 REVISION DETAIL https://phab.mercurial-scm.org/D1974 AFFECTED FILES hgext/narrow/__init__.py hgext/narrow/narrowbundle2.py hgext/narrow/narrowchangegroup.py hgext/narrow/narrowcommands.py hgext/narrow/narrowcopies.py hgext/narrow/narrowdirstate.py hgext/narrow/narrowmerge.py hgext/narrow/narrowpatch.py hgext/narrow/narrowrepo.py hgext/narrow/narrowrevlog.py hgext/narrow/narrowspec.py hgext/narrow/narrowtemplates.py hgext/narrow/narrowwirepeer.py setup.py tests/narrow-library.sh tests/test-help.t tests/test-narrow-acl.t tests/test-narrow-archive.t tests/test-narrow-clone-no-ellipsis.t tests/test-narrow-clone-non-narrow-server.t tests/test-narrow-clone-nonlinear.t tests/test-narrow-clone.t tests/test-narrow-commit-tree.t tests/test-narrow-commit.t tests/test-narrow-copies.t tests/test-narrow-debugcommands.t tests/test-narrow-debugrebuilddirstate.t tests/test-narrow-exchange-merges.t tests/test-narrow-exchange.t tests/test-narrow-expanddirstate.t tests/test-narrow-merge-tree.t tests/test-narrow-merge.t tests/test-narrow-patch-tree.t tests/test-narrow-patch.t tests/test-narrow-patterns.t tests/test-narrow-pull.t tests/test-narrow-rebase.t tests/test-narrow-shallow-merges.t tests/test-narrow-shallow.t tests/test-narrow-strip-tree.t tests/test-narrow-strip.t tests/test-narrow-tree.t tests/test-narrow-update.t tests/test-narrow-widen-tree.t tests/test-narrow-widen.t tests/test-narrow.t To: durin42, #hg-reviewers Cc: idlsoft, martinvonz, indygreg, mercurial-devel ___ Mercurial-devel mailing list Mercurial-devel@mercurial-scm.org https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel
D2177: bdiff: add to clang-format oversight
This revision was automatically updated to reflect the committed changes. Closed by commit rHGb4fdc6177b29: bdiff: add to clang-format oversight (authored by durin42, committed by ). REPOSITORY rHG Mercurial CHANGES SINCE LAST UPDATE https://phab.mercurial-scm.org/D2177?vs=5486=5494 REVISION DETAIL https://phab.mercurial-scm.org/D2177 AFFECTED FILES contrib/clang-format-blacklist mercurial/cext/bdiff.c CHANGE DETAILS diff --git a/mercurial/cext/bdiff.c b/mercurial/cext/bdiff.c --- a/mercurial/cext/bdiff.c +++ b/mercurial/cext/bdiff.c @@ -19,7 +19,6 @@ #include "bitmanipulation.h" #include "util.h" - static PyObject *blocks(PyObject *self, PyObject *args) { PyObject *sa, *sb, *rl = NULL, *m; @@ -82,9 +81,7 @@ _save = PyEval_SaveThread(); lmax = la > lb ? lb : la; - for (ia = sa, ib = sb; -li < lmax && *ia == *ib; -++li, ++ia, ++ib) + for (ia = sa, ib = sb; li < lmax && *ia == *ib; ++li, ++ia, ++ib) if (*ia == '\n') lcommon = li + 1; /* we can almost add: if (li == lmax) lcommon = li; */ @@ -122,7 +119,8 @@ if (h->a1 != la || h->b1 != lb) { len = bl[h->b1].l - bl[lb].l; putbe32((uint32_t)(al[la].l + lcommon - al->l), rb); - putbe32((uint32_t)(al[h->a1].l + lcommon - al->l), rb + 4); + putbe32((uint32_t)(al[h->a1].l + lcommon - al->l), + rb + 4); putbe32((uint32_t)len, rb + 8); memcpy(rb + 12, bl[lb].l, len); rb += 12 + len; @@ -167,8 +165,8 @@ if (c == ' ' || c == '\t' || c == '\r') { if (!allws && (wlen == 0 || w[wlen - 1] != ' ')) w[wlen++] = ' '; - } else if (c == '\n' && !allws - && wlen > 0 && w[wlen - 1] == ' ') { + } else if (c == '\n' && !allws && wlen > 0 && + w[wlen - 1] == ' ') { w[wlen - 1] = '\n'; } else { w[wlen++] = c; @@ -182,25 +180,20 @@ return result ? result : PyErr_NoMemory(); } - static char mdiff_doc[] = "Efficient binary diff."; static PyMethodDef methods[] = { - {"bdiff", bdiff, METH_VARARGS, "calculate a binary diff\n"}, - {"blocks", blocks, METH_VARARGS, "find a list of matching lines\n"}, - {"fixws", fixws, METH_VARARGS, "normalize diff whitespaces\n"}, - {NULL, NULL} +{"bdiff", bdiff, METH_VARARGS, "calculate a binary diff\n"}, +{"blocks", blocks, METH_VARARGS, "find a list of matching lines\n"}, +{"fixws", fixws, METH_VARARGS, "normalize diff whitespaces\n"}, +{NULL, NULL}, }; static const int version = 1; #ifdef IS_PY3K static struct PyModuleDef bdiff_module = { - PyModuleDef_HEAD_INIT, - "bdiff", - mdiff_doc, - -1, - methods +PyModuleDef_HEAD_INIT, "bdiff", mdiff_doc, -1, methods, }; PyMODINIT_FUNC PyInit_bdiff(void) diff --git a/contrib/clang-format-blacklist b/contrib/clang-format-blacklist --- a/contrib/clang-format-blacklist +++ b/contrib/clang-format-blacklist @@ -1,7 +1,6 @@ # Files that just need to be migrated to the formatter. # Do not add new files here! mercurial/cext/base85.c -mercurial/cext/bdiff.c mercurial/cext/charencode.c mercurial/cext/charencode.h mercurial/cext/diffhelpers.c To: durin42, #hg-reviewers, indygreg Cc: mercurial-devel ___ Mercurial-devel mailing list Mercurial-devel@mercurial-scm.org https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel
D2181: charencode: allow clang-format oversight
indygreg requested changes to this revision. indygreg added a comment. This revision now requires changes to proceed. I want a second opinion about the `#include` order. INLINE COMMENTS > charencode.h:11-12 > > +#include "compat.h" > #include > Huh? Why is it putting a system include after a local include? This feels wrong to me. REPOSITORY rHG Mercurial REVISION DETAIL https://phab.mercurial-scm.org/D2181 To: durin42, #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
[PATCH 1 of 2 STABLE] label: enforce the lack of leading or trailing white space
# HG changeset patch # User Boris Feld# Date 1518448171 -3600 # Mon Feb 12 16:09:31 2018 +0100 # Branch stable # Node ID 23d835f2d32dfc2aac772a443d2061a57a8aa997 # Parent 7b2b82f891bf6355ed87c06ed9198bfcd033fe7d # EXP-Topic noname # Available At https://bitbucket.org/octobus/mercurial-devel/ # hg pull https://bitbucket.org/octobus/mercurial-devel/ -r 23d835f2d32d label: enforce the lack of leading or trailing white space In practice, all commands create label are currently striping external white space. Let us enforce this logic at a lower level before starting to rely on it elsewhere. diff --git a/mercurial/scmutil.py b/mercurial/scmutil.py --- a/mercurial/scmutil.py +++ b/mercurial/scmutil.py @@ -267,6 +267,8 @@ def checknewlabel(repo, lbl, kind): raise error.Abort(_("cannot use an integer as a name")) except ValueError: pass +if lbl.strip() != lbl: +raise error.Abort(_("leading or trailing whitespace in name %r") % lbl) def checkfilename(f): '''Check that the filename f is an acceptable filename for a tracked file''' ___ Mercurial-devel mailing list Mercurial-devel@mercurial-scm.org https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel
Re: [PATCH 2 of 2 STABLE] revset: skip old style lookup if external whitespace are detected
Just saw that the changesets are on stable somehow, sorry ignore this, I will send a V2. On 12/02/2018 17:19, Boris Feld wrote: # HG changeset patch # User Boris Feld# Date 1518448909 -3600 # Mon Feb 12 16:21:49 2018 +0100 # Branch stable # Node ID 475525edc7da195b7df93c980df322eacb0a41bb # Parent 23d835f2d32dfc2aac772a443d2061a57a8aa997 # EXP-Topic noname # Available At https://bitbucket.org/octobus/mercurial-devel/ # hg pull https://bitbucket.org/octobus/mercurial-devel/ -r 475525edc7da revset: skip old style lookup if external whitespace are detected Since label cannot contains leading or trailing whitespace we can skip looking for them. This is useful in repository 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 diff --git a/mercurial/revsetlang.py b/mercurial/revsetlang.py --- a/mercurial/revsetlang.py +++ b/mercurial/revsetlang.py @@ -96,7 +96,7 @@ def tokenize(program, lookup=None, symin # attempt to parse old-style ranges first to deal with # things like old-tag which contain query metacharacters parts = program.split(':', 1) -if all(lookup(sym) for sym in parts if sym): +if all((sym.strip() == sym and lookup(sym)) for sym in parts if sym): if parts[0]: yield ('symbol', parts[0], 0) if len(parts) > 1: ___ 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
[PATCH 2 of 2 STABLE] revset: skip old style lookup if external whitespace are detected
# HG changeset patch # User Boris Feld# Date 1518448909 -3600 # Mon Feb 12 16:21:49 2018 +0100 # Branch stable # Node ID 475525edc7da195b7df93c980df322eacb0a41bb # Parent 23d835f2d32dfc2aac772a443d2061a57a8aa997 # EXP-Topic noname # Available At https://bitbucket.org/octobus/mercurial-devel/ # hg pull https://bitbucket.org/octobus/mercurial-devel/ -r 475525edc7da revset: skip old style lookup if external whitespace are detected Since label cannot contains leading or trailing whitespace we can skip looking for them. This is useful in repository 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 diff --git a/mercurial/revsetlang.py b/mercurial/revsetlang.py --- a/mercurial/revsetlang.py +++ b/mercurial/revsetlang.py @@ -96,7 +96,7 @@ def tokenize(program, lookup=None, symin # attempt to parse old-style ranges first to deal with # things like old-tag which contain query metacharacters parts = program.split(':', 1) -if all(lookup(sym) for sym in parts if sym): +if all((sym.strip() == sym and lookup(sym)) for sym in parts if sym): if parts[0]: yield ('symbol', parts[0], 0) if len(parts) > 1: ___ Mercurial-devel mailing list Mercurial-devel@mercurial-scm.org https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel
Re: [PATCH 4 of 4] log: add TODO comments about --line-range processing
Yuya Nishihara a écrit : On Mon, 12 Feb 2018 13:42:54 +0100, Denis Laxalde wrote: Yuya Nishihara a écrit : On Mon, 12 Feb 2018 12:04:21 +0100, Denis Laxalde wrote: Yuya Nishihara a écrit : This is totally unrelated topic, but how would we do if we want to support non-contiguous range? -L file,a:b,c:d is ambiguous because file may contain ",". I guess we could iteratively rsplit(",", 1) the file pattern and try to parse "from:to" until it fails, meaning that the remaining would be the file name. Slightly more complicated than it is now, but still doable I think. That doesn't sound nice because only reason we've introduced -L was to reliably split linerange from file pattern. "1:2" looks odd, but is a valid filename on non-Windows. I'm afraid I don't follow, could you elaborate a bit? By the way, I worked on this a bit earlier, just after your first email today: https://hg.logilab.org/users/dlaxalde/hg/rev/6d8c75041b21 It seems to be working, but I may have missed something of course. I meant "1:2,3:4,5:6" could be parsed as either file="1:2,3:4" linerange="5:6" or file="1:2" linerange="3:4,5:6" because "1:2,3:4" is a valid filename. This would get more complicated if we want to support other types of linerange specifier seen in git. Ok, I see. Any separation character (apart from / maybe) would lead to such ambiguities I guess. Maybe we can live without this and specify -L multiple times? I have no better idea at the moment. ___ Mercurial-devel mailing list Mercurial-devel@mercurial-scm.org https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel
D2088: wireprototypes: move wire protocol response types to new module
durin42 added a comment. I wonder if these should move to being attrs-generated at some point. REPOSITORY rHG Mercurial REVISION DETAIL https://phab.mercurial-scm.org/D2088 To: indygreg, #hg-reviewers, durin42 Cc: mercurial-devel ___ Mercurial-devel mailing list Mercurial-devel@mercurial-scm.org https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel
D1974: narrow: import experimental extension from narrowhg revision cb51d673e9c5
indygreg accepted this revision. indygreg added a comment. This revision is now accepted and ready to land. I think I've seen enough follow-ups to feel comfortable taking this in core. There's still a ton of work that needs to get done. But it will be easier to iterate and for others to get involved when the code is committed than when it is sitting around in review. REPOSITORY rHG Mercurial REVISION DETAIL https://phab.mercurial-scm.org/D1974 To: durin42, #hg-reviewers, indygreg Cc: idlsoft, martinvonz, indygreg, mercurial-devel ___ Mercurial-devel mailing list Mercurial-devel@mercurial-scm.org https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel
mercurial@35957: 7 new changesets
7 new changesets in mercurial: https://www.mercurial-scm.org/repo/hg/rev/8b6dd3922f70 changeset: 35951:8b6dd3922f70 parent: 35949:80e5210df25c user:Yuya Nishiharadate:Sun Feb 04 10:28:03 2018 +0900 summary: patch: unify check_binary and binary flags https://www.mercurial-scm.org/repo/hg/rev/9e641c4525a2 changeset: 35952:9e641c4525a2 user:Yuya Nishihara date:Sun Feb 04 10:33:14 2018 +0900 summary: mdiff: use str.startswith/endswith() instead of slicing https://www.mercurial-scm.org/repo/hg/rev/64f4a6808704 changeset: 35953:64f4a6808704 user:Yuya Nishihara date:Sun Jan 21 13:47:06 2018 +0900 summary: logcmdutil: make default parameters of changesetprinters consistent https://www.mercurial-scm.org/repo/hg/rev/386c1e45e671 changeset: 35954:386c1e45e671 user:Yuya Nishihara date:Sun Jan 21 14:28:03 2018 +0900 summary: logcmdutil: drop default arguments from changesetdisplayer/templater() calls https://www.mercurial-scm.org/repo/hg/rev/218b77c4c87a changeset: 35955:218b77c4c87a user:Yuya Nishihara date:Sun Jan 21 14:00:56 2018 +0900 summary: logcmdutil: mark changesetprinter.showpatch() as private https://www.mercurial-scm.org/repo/hg/rev/fd54846e1f8e changeset: 35956:fd54846e1f8e user:Yuya Nishihara date:Mon Feb 05 20:40:49 2018 +0900 summary: ui: write prompt text in ui.prompt(), not in ui._readline() https://www.mercurial-scm.org/repo/hg/rev/b62c4154bb28 changeset: 35957:b62c4154bb28 bookmark:@ tag: tip user:Yuya Nishihara date:Mon Feb 05 20:48:51 2018 +0900 summary: ui: add explicit path to write prompt text bypassing buffers -- 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
RE: [PATCH hglib] [b] ignore close() on non-open clients (issue5751)
> -Original Message- > From: Yuya Nishihara [mailto:you...@gmail.com] On Behalf Of Yuya > Nishihara > Sent: Monday, February 12, 2018 3:50 PM > To: Gábor STEFANIK> Cc: mercurial-devel@mercurial-scm.org > Subject: Re: [PATCH hglib] [b] ignore close() on non-open clients (issue5751) > > On Mon, 12 Feb 2018 14:55:57 +0100, Gábor Stefanik wrote: > > # HG changeset patch > > # User Gábor Stefanik # Date 1518443649 -3600 > > # Mon Feb 12 14:54:09 2018 +0100 > > # Node ID fe38aeeb1586464769caa6e9bb819078028fc858 > > # Parent 1085c904d8c04d51c6897027fe9c7bae0964b64b > > [b] ignore close() on non-open clients (issue5751) > ^^^ > what's [b]? Ouch... our internal notation for a bugfix commit. > > Thanks, this looks good, except the patch is malformed because of a > corporate mail server? > > > diff -r 1085c904d8c0 -r fe38aeeb1586 hglib/client.py > > --- a/hglib/client.py Thu Feb 01 15:10:02 2018 -0500 > > +++ b/hglib/client.py Mon Feb 12 14:54:09 2018 +0100 > > @@ -294,6 +294,8 @@ > > return self._close()[0] > > > > def _close(self): > > +if not self.server: > > +return 0, '' > > I slight prefer moving this to close() so _close() stays as a low-level > helper, > but that doesn't matter in practice. > > > _sout, serr = self.server.communicate() > > ret = self.server.returncode > > self.server = None This message, including its attachments, is confidential and the property of NNG Llc. For more information please read NNG's email policy here: https://www.nng.com/email-policy/ By responding to this email you accept the email policy. ___ Mercurial-devel mailing list Mercurial-devel@mercurial-scm.org https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel
[PATCH 1 of 2] buildrpm: bump bundled python version to 2.7.14 when building for centos{5, 6}
# HG changeset patch # User Antonio Muci # Date 1518476376 -3600 # Mon Feb 12 23:59:36 2018 +0100 # Node ID ae4209858d434d88428c03d3b1be3ec662907ec2 # Parent b62c4154bb287fe0f4c15cdb0d2ef290069288df buildrpm: bump bundled python version to 2.7.14 when building for centos{5,6} when building rpm packages for centos 5 and 6, we bundle a mercurial-specific version of python 2.7 in /opt/python-hg Let's bump the embedded python version from 2.7.10 (released in 2015) to 2.7.14 (latest as of today) diff --git a/contrib/Makefile.python b/contrib/Makefile.python --- a/contrib/Makefile.python +++ b/contrib/Makefile.python @@ -1,4 +1,4 @@ -PYTHONVER=2.7.10 +PYTHONVER=2.7.14 PYTHONNAME=python- PREFIX=$(HOME)/bin/prefix-$(PYTHONNAME)$(PYTHONVER) SYMLINKDIR=$(HOME)/bin diff --git a/contrib/buildrpm b/contrib/buildrpm --- a/contrib/buildrpm +++ b/contrib/buildrpm @@ -20,8 +20,8 @@ while [ "$1" ]; do ;; --withpython | --with-python) shift -PYTHONVER=2.7.10 -PYTHONMD5=d7547558fd673bd9d38e2108c6b42521 +PYTHONVER=2.7.14 +PYTHONMD5=cee2e4b33ad3750da77b2e85f2f8b724 ;; --rpmbuilddir ) shift ___ Mercurial-devel mailing list Mercurial-devel@mercurial-scm.org https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel
D1974: narrow: import experimental extension from narrowhg revision cb51d673e9c5
This revision was automatically updated to reflect the committed changes. Closed by commit rHGa2a6e724d61a: narrow: import experimental extension from narrowhg revision cb51d673e9c5 (authored by durin42, committed by ). REPOSITORY rHG Mercurial CHANGES SINCE LAST UPDATE https://phab.mercurial-scm.org/D1974?vs=5498=5541 REVISION DETAIL https://phab.mercurial-scm.org/D1974 AFFECTED FILES hgext/narrow/__init__.py hgext/narrow/narrowbundle2.py hgext/narrow/narrowchangegroup.py hgext/narrow/narrowcommands.py hgext/narrow/narrowcopies.py hgext/narrow/narrowdirstate.py hgext/narrow/narrowmerge.py hgext/narrow/narrowpatch.py hgext/narrow/narrowrepo.py hgext/narrow/narrowrevlog.py hgext/narrow/narrowspec.py hgext/narrow/narrowtemplates.py hgext/narrow/narrowwirepeer.py setup.py tests/narrow-library.sh tests/test-help.t tests/test-narrow-acl.t tests/test-narrow-archive.t tests/test-narrow-clone-no-ellipsis.t tests/test-narrow-clone-non-narrow-server.t tests/test-narrow-clone-nonlinear.t tests/test-narrow-clone.t tests/test-narrow-commit-tree.t tests/test-narrow-commit.t tests/test-narrow-copies.t tests/test-narrow-debugcommands.t tests/test-narrow-debugrebuilddirstate.t tests/test-narrow-exchange-merges.t tests/test-narrow-exchange.t tests/test-narrow-expanddirstate.t tests/test-narrow-merge-tree.t tests/test-narrow-merge.t tests/test-narrow-patch-tree.t tests/test-narrow-patch.t tests/test-narrow-patterns.t tests/test-narrow-pull.t tests/test-narrow-rebase.t tests/test-narrow-shallow-merges.t tests/test-narrow-shallow.t tests/test-narrow-strip-tree.t tests/test-narrow-strip.t tests/test-narrow-tree.t tests/test-narrow-update.t tests/test-narrow-widen-tree.t tests/test-narrow-widen.t tests/test-narrow.t To: durin42, #hg-reviewers, indygreg Cc: idlsoft, martinvonz, indygreg, mercurial-devel ___ Mercurial-devel mailing list Mercurial-devel@mercurial-scm.org https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel
D1980: narrow: remove old version-checking logic and declare internal
This revision was automatically updated to reflect the committed changes. Closed by commit rHG4b843cb6eb8c: narrow: remove old version-checking logic and declare internal (authored by durin42, committed by ). REPOSITORY rHG Mercurial CHANGES SINCE LAST UPDATE https://phab.mercurial-scm.org/D1980?vs=5101=5547 REVISION DETAIL https://phab.mercurial-scm.org/D1980 AFFECTED FILES hgext/narrow/__init__.py CHANGE DETAILS diff --git a/hgext/narrow/__init__.py b/hgext/narrow/__init__.py --- a/hgext/narrow/__init__.py +++ b/hgext/narrow/__init__.py @@ -8,16 +8,11 @@ from __future__ import absolute_import -from mercurial import __version__ -if __version__.version < '3.7': -raise ImportError( -'narrowhg requires mercurial 3.7 or newer') - -try: -from .__versionnum__ import version -__version__ = version -except ImportError: -pass +# Note for extension authors: ONLY specify testedwith = 'ships-with-hg-core' for +# extensions which SHIP WITH MERCURIAL. Non-mainline extensions should +# be specifying the version(s) of Mercurial they are tested with, or +# leave the attribute unspecified. +testedwith = 'ships-with-hg-core' from mercurial import ( extensions, To: durin42, #hg-reviewers, indygreg Cc: mercurial-devel ___ Mercurial-devel mailing list Mercurial-devel@mercurial-scm.org https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel
D1977: narrow: this code should assume REVIDX_FLAGS_ORDER exists
This revision was automatically updated to reflect the committed changes. Closed by commit rHGadc8e1fe2f46: narrow: this code should assume REVIDX_FLAGS_ORDER exists (authored by durin42, committed by ). REPOSITORY rHG Mercurial CHANGES SINCE LAST UPDATE https://phab.mercurial-scm.org/D1977?vs=5098=5544 REVISION DETAIL https://phab.mercurial-scm.org/D1977 AFFECTED FILES hgext/narrow/narrowrevlog.py CHANGE DETAILS diff --git a/hgext/narrow/narrowrevlog.py b/hgext/narrow/narrowrevlog.py --- a/hgext/narrow/narrowrevlog.py +++ b/hgext/narrow/narrowrevlog.py @@ -15,9 +15,8 @@ ELLIPSIS_NODE_FLAG = 1 << 14 revlog.REVIDX_KNOWN_FLAGS |= ELLIPSIS_NODE_FLAG -if (util.safehasattr(revlog, 'REVIDX_FLAGS_ORDER') and -ELLIPSIS_NODE_FLAG not in revlog.REVIDX_FLAGS_ORDER): -revlog.REVIDX_FLAGS_ORDER.append(ELLIPSIS_NODE_FLAG) +if ELLIPSIS_NODE_FLAG not in revlog.REVIDX_FLAGS_ORDER: +revlog.REVIDX_FLAGS_ORDER.append(ELLIPSIS_NODE_FLAG) def readtransform(self, text): return text, False To: durin42, #hg-reviewers, martinvonz, indygreg Cc: martinvonz, mercurial-devel ___ Mercurial-devel mailing list Mercurial-devel@mercurial-scm.org https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel
D1976: narrow: drop legacy support for getsubsetraw
This revision was automatically updated to reflect the committed changes. Closed by commit rHG48c12b440b4a: narrow: drop legacy support for getsubsetraw (authored by durin42, committed by ). REPOSITORY rHG Mercurial CHANGES SINCE LAST UPDATE https://phab.mercurial-scm.org/D1976?vs=5097=5543 REVISION DETAIL https://phab.mercurial-scm.org/D1976 AFFECTED FILES hgext/narrow/narrowbundle2.py CHANGE DETAILS diff --git a/hgext/narrow/narrowbundle2.py b/hgext/narrow/narrowbundle2.py --- a/hgext/narrow/narrowbundle2.py +++ b/hgext/narrow/narrowbundle2.py @@ -237,20 +237,13 @@ outgoing = exchange._computeoutgoing(repo, heads, common) if not outgoing.missing: return -if util.safehasattr(changegroup, 'getsubsetraw'): -# getsubsetraw was replaced with makestream in hg in 92f1e2be8ab6 -# (2017/09/10). -packer = changegroup.getbundler(version, repo) -packer._narrow_matcher = lambda : newmatch -cg = changegroup.getsubsetraw(repo, outgoing, packer, source) -else: -def wrappedgetbundler(orig, *args, **kwargs): -bundler = orig(*args, **kwargs) -bundler._narrow_matcher = lambda : newmatch -return bundler -with extensions.wrappedfunction(changegroup, 'getbundler', -wrappedgetbundler): -cg = changegroup.makestream(repo, outgoing, version, source) +def wrappedgetbundler(orig, *args, **kwargs): +bundler = orig(*args, **kwargs) +bundler._narrow_matcher = lambda : newmatch +return bundler +with extensions.wrappedfunction(changegroup, 'getbundler', +wrappedgetbundler): +cg = changegroup.makestream(repo, outgoing, version, source) part = bundler.newpart('changegroup', data=cg) part.addparam('version', version) if 'treemanifest' in repo.requirements: To: durin42, #hg-reviewers, indygreg Cc: mercurial-devel ___ Mercurial-devel mailing list Mercurial-devel@mercurial-scm.org https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel
[PATCH 2 of 2] buildrpm: bump bundled docutils version to 0.14 when building for centos{5, 6}
# HG changeset patch # User Antonio Muci # Date 1518476745 -3600 # Tue Feb 13 00:05:45 2018 +0100 # Node ID ca93ec462371f185bd737f27fbae73fcca5ad5fa # Parent ae4209858d434d88428c03d3b1be3ec662907ec2 buildrpm: bump bundled docutils version to 0.14 when building for centos{5,6} when building rpm packages for centos 5 and 6, we bundle a mercurial-specific version of docutils in /opt/python-hg/lib/python2.7/site-packages/docutils Let's bump the embedded docutils version from 0.12 (released in 2014) to 0.14 (latest as of today) diff --git a/contrib/mercurial.spec b/contrib/mercurial.spec --- a/contrib/mercurial.spec +++ b/contrib/mercurial.spec @@ -6,8 +6,8 @@ %global pythonver %{withpython} %global pythonname Python-%{withpython} -%global docutilsname docutils-0.12 -%global docutilsmd5 4622263b62c5c771c03502afa3157768 +%global docutilsname docutils-0.14 +%global docutilsmd5 c53768d63db3873b7d452833553469de %global pythonhg python-hg %global hgpyprefix /opt/%{pythonhg} # byte compilation will fail on some some Python /test/ files ___ Mercurial-devel mailing list Mercurial-devel@mercurial-scm.org https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel
D1978: narrow: assume addflagprocessor will always exist on revlog module
This revision was automatically updated to reflect the committed changes. Closed by commit rHG9772ef9f6c04: narrow: assume addflagprocessor will always exist on revlog module (authored by durin42, committed by ). REPOSITORY rHG Mercurial CHANGES SINCE LAST UPDATE https://phab.mercurial-scm.org/D1978?vs=5099=5545 REVISION DETAIL https://phab.mercurial-scm.org/D1978 AFFECTED FILES hgext/narrow/narrowrevlog.py CHANGE DETAILS diff --git a/hgext/narrow/narrowrevlog.py b/hgext/narrow/narrowrevlog.py --- a/hgext/narrow/narrowrevlog.py +++ b/hgext/narrow/narrowrevlog.py @@ -27,9 +27,8 @@ def rawtransform(self, text): return False -if util.safehasattr(revlog, 'addflagprocessor'): -revlog.addflagprocessor(ELLIPSIS_NODE_FLAG, -(readtransform, writetransform, rawtransform)) +revlog.addflagprocessor(ELLIPSIS_NODE_FLAG, +(readtransform, writetransform, rawtransform)) def setup(): # We just wanted to add the flag processor, which is done at module To: durin42, #hg-reviewers, indygreg Cc: mercurial-devel ___ Mercurial-devel mailing list Mercurial-devel@mercurial-scm.org https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel
D1975: narrow: remove support for old match modules
This revision was automatically updated to reflect the committed changes. Closed by commit rHG9dc28d8ea61e: narrow: remove support for old match modules (authored by durin42, committed by ). REPOSITORY rHG Mercurial CHANGES SINCE LAST UPDATE https://phab.mercurial-scm.org/D1975?vs=5096=5542 REVISION DETAIL https://phab.mercurial-scm.org/D1975 AFFECTED FILES hgext/narrow/__init__.py CHANGE DETAILS diff --git a/hgext/narrow/__init__.py b/hgext/narrow/__init__.py --- a/hgext/narrow/__init__.py +++ b/hgext/narrow/__init__.py @@ -24,7 +24,6 @@ hg, localrepo, registrar, -util, verify as verifymod, ) @@ -85,15 +84,6 @@ narrowpatch.setup(repo) narrowwirepeer.reposetup(repo) -def _narrowvalidpath(orig, repo, path): -matcher = getattr(repo, 'narrowmatch', None) -if matcher is None: -return orig(repo, path) -matcher = matcher() -if matcher.visitdir(path) or matcher(path): -return orig(repo, path) -return False - def _verifierinit(orig, self, repo, matcher=None): # The verifier's matcher argument was desgined for narrowhg, so it should # be None from core. If another extension passes a matcher (unlikely), @@ -103,9 +93,6 @@ orig(self, repo, matcher) def extsetup(ui): -if util.safehasattr(verifymod, '_validpath'): -extensions.wrapfunction(verifymod, '_validpath', _narrowvalidpath) -else: -extensions.wrapfunction(verifymod.verifier, '__init__', _verifierinit) +extensions.wrapfunction(verifymod.verifier, '__init__', _verifierinit) extensions.wrapfunction(hg, 'postshare', narrowrepo.wrappostshare) extensions.wrapfunction(hg, 'copystore', narrowrepo.unsharenarrowspec) To: durin42, #hg-reviewers, indygreg Cc: mercurial-devel ___ Mercurial-devel mailing list Mercurial-devel@mercurial-scm.org https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel
D2005: narrowbundle2: mark most constants as module-private
This revision was automatically updated to reflect the committed changes. Closed by commit rHG844f253dad5e: narrowbundle2: mark most constants as module-private (authored by durin42, committed by ). REPOSITORY rHG Mercurial CHANGES SINCE LAST UPDATE https://phab.mercurial-scm.org/D2005?vs=5155=5549 REVISION DETAIL https://phab.mercurial-scm.org/D2005 AFFECTED FILES hgext/narrow/narrowbundle2.py CHANGE DETAILS diff --git a/hgext/narrow/narrowbundle2.py b/hgext/narrow/narrowbundle2.py --- a/hgext/narrow/narrowbundle2.py +++ b/hgext/narrow/narrowbundle2.py @@ -35,17 +35,17 @@ ) NARROWCAP = 'narrow' -NARROWACL_SECTION = 'narrowhgacl' -CHANGESPECPART = NARROWCAP + ':changespec' -SPECPART = NARROWCAP + ':spec' -SPECPART_INCLUDE = 'include' -SPECPART_EXCLUDE = 'exclude' -KILLNODESIGNAL = 'KILL' -DONESIGNAL = 'DONE' -ELIDEDCSHEADER = '>20s20s20sl' # cset id, p1, p2, len(text) -ELIDEDMFHEADER = '>20s20s20s20sl' # manifest id, p1, p2, link id, len(text) -CSHEADERSIZE = struct.calcsize(ELIDEDCSHEADER) -MFHEADERSIZE = struct.calcsize(ELIDEDMFHEADER) +_NARROWACL_SECTION = 'narrowhgacl' +_CHANGESPECPART = NARROWCAP + ':changespec' +_SPECPART = NARROWCAP + ':spec' +_SPECPART_INCLUDE = 'include' +_SPECPART_EXCLUDE = 'exclude' +_KILLNODESIGNAL = 'KILL' +_DONESIGNAL = 'DONE' +_ELIDEDCSHEADER = '>20s20s20sl' # cset id, p1, p2, len(text) +_ELIDEDMFHEADER = '>20s20s20s20sl' # manifest id, p1, p2, link id, len(text) +_CSHEADERSIZE = struct.calcsize(_ELIDEDCSHEADER) +_MFHEADERSIZE = struct.calcsize(_ELIDEDMFHEADER) # When advertising capabilities, always include narrow clone support. def getrepocaps_narrow(orig, repo, **kwargs): @@ -250,13 +250,13 @@ part.addparam('treemanifest', '1') if include or exclude: -narrowspecpart = bundler.newpart(SPECPART) +narrowspecpart = bundler.newpart(_SPECPART) if include: narrowspecpart.addparam( -SPECPART_INCLUDE, '\n'.join(include), mandatory=True) +_SPECPART_INCLUDE, '\n'.join(include), mandatory=True) if exclude: narrowspecpart.addparam( -SPECPART_EXCLUDE, '\n'.join(exclude), mandatory=True) +_SPECPART_EXCLUDE, '\n'.join(exclude), mandatory=True) return @@ -298,10 +298,10 @@ deadrevs = known def genkills(): for r in deadrevs: -yield KILLNODESIGNAL +yield _KILLNODESIGNAL yield repo.changelog.node(r) -yield DONESIGNAL -bundler.newpart(CHANGESPECPART, data=genkills()) +yield _DONESIGNAL +bundler.newpart(_CHANGESPECPART, data=genkills()) newvisit, newfull, newellipsis = _computeellipsis( repo, set(), common, known, newmatch) if newvisit: @@ -329,14 +329,14 @@ def applyacl_narrow(repo, kwargs): username = repo.ui.shortuser(repo.ui.username()) user_includes = repo.ui.configlist( -NARROWACL_SECTION, username + '.includes', -repo.ui.configlist(NARROWACL_SECTION, 'default.includes')) +_NARROWACL_SECTION, username + '.includes', +repo.ui.configlist(_NARROWACL_SECTION, 'default.includes')) user_excludes = repo.ui.configlist( -NARROWACL_SECTION, username + '.excludes', -repo.ui.configlist(NARROWACL_SECTION, 'default.excludes')) +_NARROWACL_SECTION, username + '.excludes', +repo.ui.configlist(_NARROWACL_SECTION, 'default.excludes')) if not user_includes: raise error.Abort(_("{} configuration for user {} is empty") - .format(NARROWACL_SECTION, username)) + .format(_NARROWACL_SECTION, username)) user_includes = [ 'path:.' if p == '*' else 'path:' + p for p in user_includes] @@ -363,17 +363,17 @@ new_args['excludepats'] = req_excludes return new_args -@bundle2.parthandler(SPECPART, (SPECPART_INCLUDE, SPECPART_EXCLUDE)) +@bundle2.parthandler(_SPECPART, (_SPECPART_INCLUDE, _SPECPART_EXCLUDE)) def _handlechangespec_2(op, inpart): -includepats = set(inpart.params.get(SPECPART_INCLUDE, '').splitlines()) -excludepats = set(inpart.params.get(SPECPART_EXCLUDE, '').splitlines()) +includepats = set(inpart.params.get(_SPECPART_INCLUDE, '').splitlines()) +excludepats = set(inpart.params.get(_SPECPART_EXCLUDE, '').splitlines()) narrowspec.save(op.repo, includepats, excludepats) if not narrowrepo.requirement in op.repo.requirements: op.repo.requirements.add(narrowrepo.requirement) op.repo._writerequirements() op.repo.invalidate(clearfilecache=True) -@bundle2.parthandler(CHANGESPECPART) +@bundle2.parthandler(_CHANGESPECPART) def _handlechangespec(op, inpart): repo = op.repo cl = repo.changelog @@ -388,8 +388,8 @@ # repo. All the changes that this block encounters are ellipsis # nodes or flags to kill an
D2004: narrowbundle2: make constants ALLCAPS to be a bit more readable
This revision was automatically updated to reflect the committed changes. Closed by commit rHGbc01f48c18cc: narrowbundle2: make constants ALLCAPS to be a bit more readable (authored by durin42, committed by ). REPOSITORY rHG Mercurial CHANGES SINCE LAST UPDATE https://phab.mercurial-scm.org/D2004?vs=5154=5548 REVISION DETAIL https://phab.mercurial-scm.org/D2004 AFFECTED FILES hgext/narrow/narrowbundle2.py hgext/narrow/narrowcommands.py CHANGE DETAILS diff --git a/hgext/narrow/narrowcommands.py b/hgext/narrow/narrowcommands.py --- a/hgext/narrow/narrowcommands.py +++ b/hgext/narrow/narrowcommands.py @@ -147,7 +147,7 @@ if narrowrepo.requirement not in repo.requirements: return orig(pullop, kwargs) -if narrowbundle2.narrowcap not in pullop.remotebundle2caps: +if narrowbundle2.NARROWCAP not in pullop.remotebundle2caps: raise error.Abort(_("server doesn't support narrow clones")) orig(pullop, kwargs) kwargs['narrow'] = True diff --git a/hgext/narrow/narrowbundle2.py b/hgext/narrow/narrowbundle2.py --- a/hgext/narrow/narrowbundle2.py +++ b/hgext/narrow/narrowbundle2.py @@ -34,23 +34,23 @@ narrowspec, ) -narrowcap = 'narrow' -narrowacl_section = 'narrowhgacl' -changespecpart = narrowcap + ':changespec' -specpart = narrowcap + ':spec' -specpart_include = 'include' -specpart_exclude = 'exclude' -killnodesignal = 'KILL' -donesignal = 'DONE' -elidedcsheader = '>20s20s20sl' # cset id, p1, p2, len(text) -elidedmfheader = '>20s20s20s20sl' # manifest id, p1, p2, link id, len(text) -csheadersize = struct.calcsize(elidedcsheader) -mfheadersize = struct.calcsize(elidedmfheader) +NARROWCAP = 'narrow' +NARROWACL_SECTION = 'narrowhgacl' +CHANGESPECPART = NARROWCAP + ':changespec' +SPECPART = NARROWCAP + ':spec' +SPECPART_INCLUDE = 'include' +SPECPART_EXCLUDE = 'exclude' +KILLNODESIGNAL = 'KILL' +DONESIGNAL = 'DONE' +ELIDEDCSHEADER = '>20s20s20sl' # cset id, p1, p2, len(text) +ELIDEDMFHEADER = '>20s20s20s20sl' # manifest id, p1, p2, link id, len(text) +CSHEADERSIZE = struct.calcsize(ELIDEDCSHEADER) +MFHEADERSIZE = struct.calcsize(ELIDEDMFHEADER) # When advertising capabilities, always include narrow clone support. def getrepocaps_narrow(orig, repo, **kwargs): caps = orig(repo, **kwargs) -caps[narrowcap] = ['v0'] +caps[NARROWCAP] = ['v0'] return caps def _computeellipsis(repo, common, heads, known, match, depth=None): @@ -250,13 +250,13 @@ part.addparam('treemanifest', '1') if include or exclude: -narrowspecpart = bundler.newpart(specpart) +narrowspecpart = bundler.newpart(SPECPART) if include: narrowspecpart.addparam( -specpart_include, '\n'.join(include), mandatory=True) +SPECPART_INCLUDE, '\n'.join(include), mandatory=True) if exclude: narrowspecpart.addparam( -specpart_exclude, '\n'.join(exclude), mandatory=True) +SPECPART_EXCLUDE, '\n'.join(exclude), mandatory=True) return @@ -298,10 +298,10 @@ deadrevs = known def genkills(): for r in deadrevs: -yield killnodesignal +yield KILLNODESIGNAL yield repo.changelog.node(r) -yield donesignal -bundler.newpart(changespecpart, data=genkills()) +yield DONESIGNAL +bundler.newpart(CHANGESPECPART, data=genkills()) newvisit, newfull, newellipsis = _computeellipsis( repo, set(), common, known, newmatch) if newvisit: @@ -329,14 +329,14 @@ def applyacl_narrow(repo, kwargs): username = repo.ui.shortuser(repo.ui.username()) user_includes = repo.ui.configlist( -narrowacl_section, username + '.includes', -repo.ui.configlist(narrowacl_section, 'default.includes')) +NARROWACL_SECTION, username + '.includes', +repo.ui.configlist(NARROWACL_SECTION, 'default.includes')) user_excludes = repo.ui.configlist( -narrowacl_section, username + '.excludes', -repo.ui.configlist(narrowacl_section, 'default.excludes')) +NARROWACL_SECTION, username + '.excludes', +repo.ui.configlist(NARROWACL_SECTION, 'default.excludes')) if not user_includes: raise error.Abort(_("{} configuration for user {} is empty") - .format(narrowacl_section, username)) + .format(NARROWACL_SECTION, username)) user_includes = [ 'path:.' if p == '*' else 'path:' + p for p in user_includes] @@ -363,17 +363,17 @@ new_args['excludepats'] = req_excludes return new_args -@bundle2.parthandler(specpart, (specpart_include, specpart_exclude)) +@bundle2.parthandler(SPECPART, (SPECPART_INCLUDE, SPECPART_EXCLUDE)) def _handlechangespec_2(op, inpart): -includepats = set(inpart.params.get(specpart_include, '').splitlines()) -excludepats
D2008: narrow: move from ELLIPSIS_NODE_FLAG to revlog.REVIDX_ELLIPSIS
This revision was automatically updated to reflect the committed changes. Closed by commit rHG9445a3141501: narrow: move from ELLIPSIS_NODE_FLAG to revlog.REVIDX_ELLIPSIS (authored by durin42, committed by ). REPOSITORY rHG Mercurial CHANGES SINCE LAST UPDATE https://phab.mercurial-scm.org/D2008?vs=5513=5552 REVISION DETAIL https://phab.mercurial-scm.org/D2008 AFFECTED FILES hgext/narrow/narrowchangegroup.py hgext/narrow/narrowrevlog.py hgext/narrow/narrowtemplates.py CHANGE DETAILS diff --git a/hgext/narrow/narrowtemplates.py b/hgext/narrow/narrowtemplates.py --- a/hgext/narrow/narrowtemplates.py +++ b/hgext/narrow/narrowtemplates.py @@ -8,15 +8,14 @@ from __future__ import absolute_import from mercurial import ( +revlog, revset, templatekw, util, ) -from . import narrowrevlog - def _isellipsis(repo, rev): -if repo.changelog.flags(rev) & narrowrevlog.ELLIPSIS_NODE_FLAG: +if repo.changelog.flags(rev) & revlog.REVIDX_ELLIPSIS: return True return False diff --git a/hgext/narrow/narrowrevlog.py b/hgext/narrow/narrowrevlog.py --- a/hgext/narrow/narrowrevlog.py +++ b/hgext/narrow/narrowrevlog.py @@ -13,11 +13,6 @@ util, ) -ELLIPSIS_NODE_FLAG = 1 << 14 -revlog.REVIDX_KNOWN_FLAGS |= ELLIPSIS_NODE_FLAG -if ELLIPSIS_NODE_FLAG not in revlog.REVIDX_FLAGS_ORDER: -revlog.REVIDX_FLAGS_ORDER.append(ELLIPSIS_NODE_FLAG) - def readtransform(self, text): return text, False @@ -27,7 +22,7 @@ def rawtransform(self, text): return False -revlog.addflagprocessor(ELLIPSIS_NODE_FLAG, +revlog.addflagprocessor(revlog.REVIDX_ELLIPSIS, (readtransform, writetransform, rawtransform)) def setup(): diff --git a/hgext/narrow/narrowchangegroup.py b/hgext/narrow/narrowchangegroup.py --- a/hgext/narrow/narrowchangegroup.py +++ b/hgext/narrow/narrowchangegroup.py @@ -15,12 +15,12 @@ manifest, mdiff, node, +revlog, util, ) from . import ( narrowrepo, -narrowrevlog, ) def setup(): @@ -83,11 +83,11 @@ extensions.wrapfunction( changegroup.cg1packer, 'generatefiles', generatefiles) -def ellipsisdata(packer, rev, revlog, p1, p2, data, linknode): -n = revlog.node(rev) -p1n, p2n = revlog.node(p1), revlog.node(p2) -flags = revlog.flags(rev) -flags |= narrowrevlog.ELLIPSIS_NODE_FLAG +def ellipsisdata(packer, rev, revlog_, p1, p2, data, linknode): +n = revlog_.node(rev) +p1n, p2n = revlog_.node(p1), revlog_.node(p2) +flags = revlog_.flags(rev) +flags |= revlog.REVIDX_ELLIPSIS meta = packer.builddeltaheader( n, p1n, p2n, node.nullid, linknode, flags) # TODO: try and actually send deltas for ellipsis data blocks To: durin42, indygreg, #hg-reviewers Cc: martinvonz, mercurial-devel ___ Mercurial-devel mailing list Mercurial-devel@mercurial-scm.org https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel
D2187: manifest: clean up dirlog() to take a d parameter to avoid shadowing dir()
This revision was automatically updated to reflect the committed changes. Closed by commit rHG59adb3051718: manifest: clean up dirlog() to take a d parameter to avoid shadowing dir() (authored by durin42, committed by ). REPOSITORY rHG Mercurial CHANGES SINCE LAST UPDATE https://phab.mercurial-scm.org/D2187?vs=5517=5557 REVISION DETAIL https://phab.mercurial-scm.org/D2187 AFFECTED FILES hgext/narrow/narrowrevlog.py mercurial/manifest.py CHANGE DETAILS diff --git a/mercurial/manifest.py b/mercurial/manifest.py --- a/mercurial/manifest.py +++ b/mercurial/manifest.py @@ -1245,15 +1245,15 @@ self._fulltextcache.clear() self._dirlogcache = {'': self} -def dirlog(self, dir): -if dir: +def dirlog(self, d): +if d: assert self._treeondisk -if dir not in self._dirlogcache: -mfrevlog = manifestrevlog(self.opener, dir, +if d not in self._dirlogcache: +mfrevlog = manifestrevlog(self.opener, d, self._dirlogcache, treemanifest=self._treeondisk) -self._dirlogcache[dir] = mfrevlog -return self._dirlogcache[dir] +self._dirlogcache[d] = mfrevlog +return self._dirlogcache[d] def add(self, m, transaction, link, p1, p2, added, removed, readtree=None): if (p1 in self.fulltextcache and util.safehasattr(m, 'fastdelta') diff --git a/hgext/narrow/narrowrevlog.py b/hgext/narrow/narrowrevlog.py --- a/hgext/narrow/narrowrevlog.py +++ b/hgext/narrow/narrowrevlog.py @@ -116,12 +116,12 @@ # This function is called via debug{revlog,index,data}, but also during # at least some push operations. This will be used to wrap/exclude the # child directories when using treemanifests. -def dirlog(self, dir): -if dir and not dir.endswith('/'): -dir = dir + '/' -if not repo.narrowmatch().visitdir(dir[:-1] or '.'): -return excludedmanifestrevlog(dir) -result = super(narrowmanifestrevlog, self).dirlog(dir) +def dirlog(self, d): +if d and not d.endswith('/'): +d = d + '/' +if not repo.narrowmatch().visitdir(d[:-1] or '.'): +return excludedmanifestrevlog(d) +result = super(narrowmanifestrevlog, self).dirlog(d) makenarrowmanifestrevlog(result, repo) return result To: durin42, #hg-reviewers, indygreg Cc: mercurial-devel ___ Mercurial-devel mailing list Mercurial-devel@mercurial-scm.org https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel
D2195: tests: use `hello` not `capabilities` over ssh
This revision was automatically updated to reflect the committed changes. Closed by commit rHG54e2abc73686: tests: use `hello` not `capabilities` over ssh (authored by durin42, committed by ). REPOSITORY rHG Mercurial CHANGES SINCE LAST UPDATE https://phab.mercurial-scm.org/D2195?vs=5511=5565 REVISION DETAIL https://phab.mercurial-scm.org/D2195 AFFECTED FILES tests/test-narrow-clone-non-narrow-server.t CHANGE DETAILS diff --git a/tests/test-narrow-clone-non-narrow-server.t b/tests/test-narrow-clone-non-narrow-server.t --- a/tests/test-narrow-clone-non-narrow-server.t +++ b/tests/test-narrow-clone-non-narrow-server.t @@ -18,7 +18,7 @@ $ cat hg.pid >> "$DAEMON_PIDS" Verify that narrow is advertised in the bundle2 capabilities: - $ echo capabilities | hg -R . serve --stdio | \ + $ echo hello | hg -R . serve --stdio | \ > python -c "import sys, urllib; print urllib.unquote_plus(list(sys.stdin)[1])" | grep narrow narrow=v0 To: durin42, #hg-reviewers, indygreg Cc: mercurial-devel ___ Mercurial-devel mailing list Mercurial-devel@mercurial-scm.org https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel
D2189: narrowrevlog: add a TODO around remotefilelog moving to core
This revision was automatically updated to reflect the committed changes. Closed by commit rHG66b4ffe90676: narrowrevlog: add a TODO around remotefilelog moving to core (authored by durin42, committed by ). REPOSITORY rHG Mercurial CHANGES SINCE LAST UPDATE https://phab.mercurial-scm.org/D2189?vs=5519=5559 REVISION DETAIL https://phab.mercurial-scm.org/D2189 AFFECTED FILES hgext/narrow/narrowrevlog.py CHANGE DETAILS diff --git a/hgext/narrow/narrowrevlog.py b/hgext/narrow/narrowrevlog.py --- a/hgext/narrow/narrowrevlog.py +++ b/hgext/narrow/narrowrevlog.py @@ -156,6 +156,10 @@ # rename-checking logic when on remotefilelog. This # might be incorrect on other non-revlog-based storage # engines, but for now this seems to be fine. +# +# TODO: when remotefilelog is in core, improve this to +# explicitly look for remotefilelog instead of cheating +# with a hasattr check. if util.safehasattr(self, 'node'): node = self.node(rev) # Because renamed() is overridden above to To: durin42, #hg-reviewers, indygreg Cc: mercurial-devel ___ Mercurial-devel mailing list Mercurial-devel@mercurial-scm.org https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel
D2191: narrowspec: consistently use set() to copy sets
This revision was automatically updated to reflect the committed changes. Closed by commit rHGb8bbe589fd47: narrowspec: consistently use set() to copy sets (authored by durin42, committed by ). REPOSITORY rHG Mercurial CHANGES SINCE LAST UPDATE https://phab.mercurial-scm.org/D2191?vs=5507=5561 REVISION DETAIL https://phab.mercurial-scm.org/D2191 AFFECTED FILES hgext/narrow/narrowspec.py CHANGE DETAILS diff --git a/hgext/narrow/narrowspec.py b/hgext/narrow/narrowspec.py --- a/hgext/narrow/narrowspec.py +++ b/hgext/narrow/narrowspec.py @@ -180,7 +180,7 @@ >>> restrictpatterns({'f1/$non_exitent_var'}, {}, ['f1','f2'], []) (set(['f1/$non_exitent_var']), {}) """ -res_excludes = req_excludes.copy() +res_excludes = set(req_excludes) res_excludes.update(repo_excludes) if not req_includes: res_includes = set(repo_includes) To: durin42, #hg-reviewers, indygreg Cc: mercurial-devel ___ Mercurial-devel mailing list Mercurial-devel@mercurial-scm.org https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel
D2193: narrowwirepeer: rename expandnarrow capability to exp-expandnarrow
This revision was automatically updated to reflect the committed changes. Closed by commit rHG22ed16caa596: narrowwirepeer: rename expandnarrow capability to exp-expandnarrow (authored by durin42, committed by ). REPOSITORY rHG Mercurial CHANGES SINCE LAST UPDATE https://phab.mercurial-scm.org/D2193?vs=5509=5563 REVISION DETAIL https://phab.mercurial-scm.org/D2193 AFFECTED FILES hgext/narrow/narrowwirepeer.py CHANGE DETAILS diff --git a/hgext/narrow/narrowwirepeer.py b/hgext/narrow/narrowwirepeer.py --- a/hgext/narrow/narrowwirepeer.py +++ b/hgext/narrow/narrowwirepeer.py @@ -24,7 +24,7 @@ class expandingpeer(peer.__class__): def expandnarrow(self, narrow_include, narrow_exclude, nodes): ui.status(_("expanding narrowspec\n")) -if not self.capable('expandnarrow'): +if not self.capable('exp-expandnarrow'): raise error.Abort( 'peer does not support expanding narrowspecs') To: durin42, #hg-reviewers, indygreg Cc: mercurial-devel ___ Mercurial-devel mailing list Mercurial-devel@mercurial-scm.org https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel
D1979: tests: fold narrow treemanifest tests into main test file using testcases
This revision was automatically updated to reflect the committed changes. Closed by commit rHGdc01484606da: tests: fold narrow treemanifest tests into main test file using testcases (authored by durin42, committed by ). REPOSITORY rHG Mercurial CHANGES SINCE LAST UPDATE https://phab.mercurial-scm.org/D1979?vs=5100=5546 REVISION DETAIL https://phab.mercurial-scm.org/D1979 AFFECTED FILES tests/test-narrow-commit-tree.t tests/test-narrow-commit.t tests/test-narrow-merge-tree.t tests/test-narrow-merge.t tests/test-narrow-patch-tree.t tests/test-narrow-patch.t tests/test-narrow-strip-tree.t tests/test-narrow-strip.t tests/test-narrow-tree.t tests/test-narrow-widen-tree.t tests/test-narrow-widen.t tests/test-narrow.t CHANGE DETAILS diff --git a/tests/test-narrow.t b/tests/test-narrow.t --- a/tests/test-narrow.t +++ b/tests/test-narrow.t @@ -1,5 +1,14 @@ +#testcases flat tree + $ . "$TESTDIR/narrow-library.sh" +#if tree + $ cat << EOF >> $HGRCPATH + > [experimental] + > treemanifest = 1 + > EOF +#endif + $ hg init master $ cd master $ cat >> .hg/hgrc <> d6/f @@ -159,6 +170,7 @@ 2 files updated, 0 files merged, 0 files removed, 0 files unresolved saved backup bundle to $TESTTMP/narrow-local-changes/.hg/strip-backup/*-narrow.hg (glob) deleting data/d3/f.i + deleting meta/d3/00manifest.i (tree !) $ hg log -T '{desc}\n' -r . add d10/f Updates to nullid if necessary @@ -178,6 +190,7 @@ 0 files updated, 0 files merged, 1 files removed, 0 files unresolved saved backup bundle to $TESTTMP/narrow-local-changes/.hg/strip-backup/*-narrow.hg (glob) deleting data/d3/f.i + deleting meta/d3/00manifest.i (tree !) $ hg id $ cd .. @@ -197,6 +210,7 @@ searching for changes looking for local changes to affected paths deleting data/d0/f.i + deleting meta/d0/00manifest.i (tree !) $ hg tracked $ hg files [1] @@ -252,6 +266,7 @@ searching for changes looking for local changes to affected paths deleting data/d6/f.i + deleting meta/d6/00manifest.i (tree !) $ hg tracked I path:d0 I path:d3 @@ -289,6 +304,7 @@ searching for changes looking for local changes to affected paths deleting data/d0/f.i + deleting meta/d0/00manifest.i (tree !) $ hg tracked I path:d3 I path:d9 diff --git a/tests/test-narrow-widen.t b/tests/test-narrow-widen.t --- a/tests/test-narrow-widen.t +++ b/tests/test-narrow-widen.t @@ -1,5 +1,13 @@ +#testcases flat tree $ . "$TESTDIR/narrow-library.sh" +#if tree + $ cat << EOF >> $HGRCPATH + > [experimental] + > treemanifest = 1 + > EOF +#endif + $ hg init master $ cd master $ cat >> .hg/hgrc < --extra-config-opt experimental.treemanifest=1 test-narrow-widen.t 2>&1 | \ - > grep -v 'unexpected mercurial lib' | egrep -v '\(expected' - - --- */test-narrow-widen.t (glob) - +++ */test-narrow-widen.t.err (glob) - @@ -\d+,\d+ \+\d+,\d+ @@ (re) - $ hg verify - checking changesets - checking manifests - + checking directory manifests - crosschecking files in changesets and manifests - checking files - 4 files, 8 changesets, 4 total revisions - @@ -\d+,\d+ \+\d+,\d+ @@ (re) - $ hg verify - checking changesets - checking manifests - + checking directory manifests - crosschecking files in changesets and manifests - checking files - 5 files, 9 changesets, 5 total revisions - - ERROR: test-narrow-widen.t output changed - ! - Failed test-narrow-widen.t: output changed - # Ran 1 tests, 0 skipped, 1 failed. - python hash seed: * (glob) diff --git a/tests/test-narrow-tree.t b/tests/test-narrow-tree.t deleted file mode 100644 --- a/tests/test-narrow-tree.t +++ /dev/null @@ -1,68 +0,0 @@ - $ cd $TESTDIR && python $RUNTESTDIR/run-tests.py \ - > --extra-config-opt experimental.treemanifest=1 test-narrow-narrow.t 2>&1 | \ - > grep -v 'unexpected mercurial lib' | egrep -v '\(expected' - - --- /*/tests/test-narrow-narrow.t (glob) - +++ /*/tests/test-narrow-narrow.t.err (glob) - @@ -\d+,\d+ \+\d+,\d+ @@ (re) - * (glob) - * (glob) - deleting data/d0/f.i - + deleting meta/d0/00manifest.i - $ hg log -T "{node|short}: {desc} {outsidenarrow}\n" - *: local change to d3 (glob) - *: add d10/f outsidenarrow (glob) - @@ -\d+,\d+ \+\d+,\d+ @@ (re) - looking for local changes to affected paths - saved backup bundle to $TESTTMP/narrow-local-changes/.hg/strip-backup/*-narrow.hg (glob) - deleting data/d0/f.i - + deleting meta/d0/00manifest.i - Updates off of stripped commit if necessary - $ hg co -r 'desc("local change to d3")' -q - $ echo local change >> d6/f - @@ -\d+,\d+ \+\d+,\d+ @@ (re) - 2 files updated, 0 files merged, 0 files removed, 0 files unresolved - saved backup bundle to $TESTTMP/narrow-local-changes/.hg/strip-backup/*-narrow.hg (glob) - deleting data/d3/f.i - + deleting meta/d3/00manifest.i - $ hg log -T '{desc}\n' -r . -
D2185: narrowrevlog: document excludeddir class and friends
This revision was automatically updated to reflect the committed changes. Closed by commit rHGed4e68efebfe: narrowrevlog: document excludeddir class and friends (authored by durin42, committed by ). REPOSITORY rHG Mercurial CHANGES SINCE LAST UPDATE https://phab.mercurial-scm.org/D2185?vs=5515=5556 REVISION DETAIL https://phab.mercurial-scm.org/D2185 AFFECTED FILES hgext/narrow/narrowrevlog.py CHANGE DETAILS diff --git a/hgext/narrow/narrowrevlog.py b/hgext/narrow/narrowrevlog.py --- a/hgext/narrow/narrowrevlog.py +++ b/hgext/narrow/narrowrevlog.py @@ -31,6 +31,16 @@ pass class excludeddir(manifest.treemanifest): +"""Stand-in for a directory that is excluded from the repository. + +With narrowing active on a repository that uses treemanifests, +some of the directory revlogs will be excluded from the resulting +clone. This is a huge storage win for clients, but means we need +some sort of pseudo-manifest to surface to internals so we can +detect a merge conflict outside the narrowspec. That's what this +class is: it stands in for a directory whose node is known, but +whose contents are unknown. +""" def __init__(self, dir, node): super(excludeddir, self).__init__(dir) self._node = node @@ -48,6 +58,7 @@ return self class excludeddirmanifestctx(manifest.treemanifestctx): +"""context wrapper for excludeddir - see that docstring for rationale""" def __init__(self, dir, node): self._dir = dir self._node = node @@ -60,6 +71,15 @@ self._dir) class excludedmanifestrevlog(manifest.manifestrevlog): +"""Stand-in for excluded treemanifest revlogs. + +When narrowing is active on a treemanifest repository, we'll have +references to directories we can't see due to the revlog being +skipped. This class exists to conform to the manifestrevlog +interface for those directories and proactively prevent writes to +outside the narrowspec. +""" + def __init__(self, dir): self._dir = dir To: durin42, #hg-reviewers, indygreg Cc: mercurial-devel ___ Mercurial-devel mailing list Mercurial-devel@mercurial-scm.org https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel
D2192: narrow: make restrictpatterns a little more idiomatic
This revision was automatically updated to reflect the committed changes. Closed by commit rHG8fd0a9e2d7e9: narrow: make restrictpatterns a little more idiomatic (authored by durin42, committed by ). REPOSITORY rHG Mercurial CHANGES SINCE LAST UPDATE https://phab.mercurial-scm.org/D2192?vs=5508=5562 REVISION DETAIL https://phab.mercurial-scm.org/D2192 AFFECTED FILES hgext/narrow/narrowbundle2.py hgext/narrow/narrowcommands.py hgext/narrow/narrowspec.py CHANGE DETAILS diff --git a/hgext/narrow/narrowspec.py b/hgext/narrow/narrowspec.py --- a/hgext/narrow/narrowspec.py +++ b/hgext/narrow/narrowspec.py @@ -153,35 +153,34 @@ repo = share._getsrcrepo(repo) repo.vfs.write(FILENAME, spec) -def restrictpatterns(req_includes, req_excludes, repo_includes, repo_excludes, - invalid_includes=None): +def restrictpatterns(req_includes, req_excludes, repo_includes, repo_excludes): r""" Restricts the patterns according to repo settings, results in a logical AND operation :param req_includes: requested includes :param req_excludes: requested excludes :param repo_includes: repo includes :param repo_excludes: repo excludes -:param invalid_includes: an array to collect invalid includes -:return: include and exclude patterns +:return: include patterns, exclude patterns, and invalid include patterns. >>> restrictpatterns({'f1','f2'}, {}, ['f1'], []) -(set(['f1']), {}) +(set(['f1']), {}, []) >>> restrictpatterns({'f1'}, {}, ['f1','f2'], []) -(set(['f1']), {}) +(set(['f1']), {}, []) >>> restrictpatterns({'f1/fc1', 'f3/fc3'}, {}, ['f1','f2'], []) -(set(['f1/fc1']), {}) +(set(['f1/fc1']), {}, []) >>> restrictpatterns({'f1_fc1'}, {}, ['f1','f2'], []) -([], set(['path:.'])) +([], set(['path:.']), []) >>> restrictpatterns({'f1/../f2/fc2'}, {}, ['f1','f2'], []) -(set(['f2/fc2']), {}) +(set(['f2/fc2']), {}, []) >>> restrictpatterns({'f1/../f3/fc3'}, {}, ['f1','f2'], []) -([], set(['path:.'])) +([], set(['path:.']), []) >>> restrictpatterns({'f1/$non_exitent_var'}, {}, ['f1','f2'], []) -(set(['f1/$non_exitent_var']), {}) +(set(['f1/$non_exitent_var']), {}, []) """ res_excludes = set(req_excludes) res_excludes.update(repo_excludes) +invalid_includes = [] if not req_includes: res_includes = set(repo_includes) elif 'path:.' not in repo_includes: @@ -197,12 +196,12 @@ valid = True res_includes.append(req_include) break -if not valid and invalid_includes is not None: +if not valid: invalid_includes.append(req_include) if len(res_includes) == 0: res_excludes = {'path:.'} else: res_includes = set(res_includes) else: res_includes = set(req_includes) -return res_includes, res_excludes +return res_includes, res_excludes, invalid_includes diff --git a/hgext/narrow/narrowcommands.py b/hgext/narrow/narrowcommands.py --- a/hgext/narrow/narrowcommands.py +++ b/hgext/narrow/narrowcommands.py @@ -134,7 +134,7 @@ repo_includes, repo_excludes = repo.narrowpats includes = set(opts.get('include', [])) excludes = set(opts.get('exclude', [])) -includes, excludes = narrowspec.restrictpatterns( +includes, excludes, unused_invalid = narrowspec.restrictpatterns( includes, excludes, repo_includes, repo_excludes) if includes: opts['include'] = includes diff --git a/hgext/narrow/narrowbundle2.py b/hgext/narrow/narrowbundle2.py --- a/hgext/narrow/narrowbundle2.py +++ b/hgext/narrow/narrowbundle2.py @@ -346,10 +346,8 @@ req_includes = set(kwargs.get('includepats', [])) req_excludes = set(kwargs.get('excludepats', [])) -invalid_includes = [] -req_includes, req_excludes = narrowspec.restrictpatterns( -req_includes, req_excludes, -user_includes, user_excludes, invalid_includes) +req_includes, req_excludes, invalid_includes = narrowspec.restrictpatterns( +req_includes, req_excludes, user_includes, user_excludes) if invalid_includes: raise error.Abort( To: durin42, #hg-reviewers, indygreg Cc: mercurial-devel ___ Mercurial-devel mailing list Mercurial-devel@mercurial-scm.org https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel
D2196: narrow: add a TODO document
This revision was automatically updated to reflect the committed changes. Closed by commit rHG9b5df6e19a4f: narrow: add a TODO document (authored by durin42, committed by ). REPOSITORY rHG Mercurial CHANGES SINCE LAST UPDATE https://phab.mercurial-scm.org/D2196?vs=5512=5566 REVISION DETAIL https://phab.mercurial-scm.org/D2196 AFFECTED FILES hgext/narrow/TODO.rst CHANGE DETAILS diff --git a/hgext/narrow/TODO.rst b/hgext/narrow/TODO.rst new file mode 100644 --- /dev/null +++ b/hgext/narrow/TODO.rst @@ -0,0 +1,37 @@ +Integration with the share extension needs improvement. Right now +we've seen some odd bugs, and the way we modify the contents of the +.hg/shared file is unfortunate. See wrappostshare() and unsharenarrowspec(). + +Resolve commentary on narrowrepo.wraprepo.narrowrepository.status +about the filtering of status being done at an awkward layer. This +came up the import to hgext, but nobody's got concrete improvement +ideas as of then. + +Fold most (or preferably all) of narrowrevlog.py into core. + +Address commentary in narrowrevlog.excludedmanifestrevlog.add - +specifically we should improve the collaboration with core so that +add() never gets called on an excluded directory and we can improve +the stand-in to raise a ProgrammingError. + +Figure out how to correctly produce narrowmanifestrevlog and +narrowfilelog instances instead of monkeypatching regular revlogs at +runtime to our subclass. Even better, merge the narrowing logic +directly into core. + +Reason more completely about rename-filtering logic in +narrowfilelog. There could be some surprises lurking there. + +Formally document the narrowspec format. Unify with sparse, if at all +possible. For bonus points, unify with the server-specified narrowspec +format. + +narrowrepo.setnarrowpats() or narrowspec.save() need to make sure +they're holding the wlock. + +Implement a simple version of the expandnarrow wireproto command for +core. Having configurable shorthands for narrowspecs has been useful +at Google (and sparse has a similar feature from Facebook), so it +probably makes sense to implement the feature in core. (Google's +handler is entirely custom to Google, with a custom format related to +bazel's build language, so it's not in the narrowhg distribution.) To: durin42, #hg-reviewers, indygreg Cc: mercurial-devel ___ Mercurial-devel mailing list Mercurial-devel@mercurial-scm.org https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel
D2190: narrowspec: document constraints when validating patterns
This revision was automatically updated to reflect the committed changes. Closed by commit rHG9c55bbc29dcf: narrowspec: document constraints when validating patterns (authored by durin42, committed by ). REPOSITORY rHG Mercurial CHANGES SINCE LAST UPDATE https://phab.mercurial-scm.org/D2190?vs=5506=5560 REVISION DETAIL https://phab.mercurial-scm.org/D2190 AFFECTED FILES hgext/narrow/narrowspec.py CHANGE DETAILS diff --git a/hgext/narrow/narrowspec.py b/hgext/narrow/narrowspec.py --- a/hgext/narrow/narrowspec.py +++ b/hgext/narrow/narrowspec.py @@ -83,7 +83,11 @@ return len((s + 'x').splitlines()) def _validatepattern(pat): -"""Validates the pattern and aborts if it is invalid.""" +"""Validates the pattern and aborts if it is invalid. + +Patterns are stored in the narrowspec as newline-separated +POSIX-style bytestring paths. There's no escaping. +""" # We use newlines as separators in the narrowspec file, so don't allow them # in patterns. To: durin42, #hg-reviewers, indygreg Cc: mercurial-devel ___ Mercurial-devel mailing list Mercurial-devel@mercurial-scm.org https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel
D2009: narrowtemplates: update to use registrar mechanism
This revision was automatically updated to reflect the committed changes. Closed by commit rHGea02be8665ef: narrowtemplates: update to use registrar mechanism (authored by durin42, committed by ). REPOSITORY rHG Mercurial CHANGES SINCE LAST UPDATE https://phab.mercurial-scm.org/D2009?vs=5514=5553 REVISION DETAIL https://phab.mercurial-scm.org/D2009 AFFECTED FILES hgext/narrow/__init__.py hgext/narrow/narrowtemplates.py CHANGE DETAILS diff --git a/hgext/narrow/narrowtemplates.py b/hgext/narrow/narrowtemplates.py --- a/hgext/narrow/narrowtemplates.py +++ b/hgext/narrow/narrowtemplates.py @@ -8,24 +8,29 @@ from __future__ import absolute_import from mercurial import ( +registrar, revlog, -revset, -templatekw, util, ) +keywords = {} +templatekeyword = registrar.templatekeyword(keywords) +revsetpredicate = registrar.revsetpredicate() + def _isellipsis(repo, rev): if repo.changelog.flags(rev) & revlog.REVIDX_ELLIPSIS: return True return False +@templatekeyword('ellipsis') def ellipsis(repo, ctx, templ, **args): """:ellipsis: String. 'ellipsis' if the change is an ellipsis node, else ''.""" if _isellipsis(repo, ctx.rev()): return 'ellipsis' return '' +@templatekeyword('outsidenarrow') def outsidenarrow(repo, ctx, templ, **args): """:outsidenarrow: String. 'outsidenarrow' if the change affects no tracked files, else ''.""" @@ -35,15 +40,9 @@ return 'outsidenarrow' return '' +@revsetpredicate('ellipsis') def ellipsisrevset(repo, subset, x): """``ellipsis()`` Changesets that are ellipsis nodes. """ return subset.filter(lambda r: _isellipsis(repo, r)) - -def setup(): -templatekw.keywords['ellipsis'] = ellipsis -templatekw.keywords['outsidenarrow'] = outsidenarrow - -revset.symbols['ellipsis'] = ellipsisrevset -revset.safesymbols.add('ellipsis') diff --git a/hgext/narrow/__init__.py b/hgext/narrow/__init__.py --- a/hgext/narrow/__init__.py +++ b/hgext/narrow/__init__.py @@ -62,7 +62,6 @@ narrowrevlog.setup() narrowbundle2.setup() narrowmerge.setup() -narrowtemplates.setup() narrowcommands.setup() narrowchangegroup.setup() narrowwirepeer.uisetup() @@ -91,3 +90,6 @@ extensions.wrapfunction(verifymod.verifier, '__init__', _verifierinit) extensions.wrapfunction(hg, 'postshare', narrowrepo.wrappostshare) extensions.wrapfunction(hg, 'copystore', narrowrepo.unsharenarrowspec) + +templatekeyword = narrowtemplates.templatekeyword +revsetpredicate = narrowtemplates.revsetpredicate To: durin42, #hg-reviewers, indygreg Cc: mercurial-devel ___ Mercurial-devel mailing list Mercurial-devel@mercurial-scm.org https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel
D2006: narrow: mark requirement as a constant
This revision was automatically updated to reflect the committed changes. Closed by commit rHG8c31187b6717: narrow: mark requirement as a constant (authored by durin42, committed by ). REPOSITORY rHG Mercurial CHANGES SINCE LAST UPDATE https://phab.mercurial-scm.org/D2006?vs=5156=5550 REVISION DETAIL https://phab.mercurial-scm.org/D2006 AFFECTED FILES hgext/narrow/__init__.py hgext/narrow/narrowbundle2.py hgext/narrow/narrowchangegroup.py hgext/narrow/narrowcommands.py hgext/narrow/narrowrepo.py CHANGE DETAILS diff --git a/hgext/narrow/narrowrepo.py b/hgext/narrow/narrowrepo.py --- a/hgext/narrow/narrowrepo.py +++ b/hgext/narrow/narrowrepo.py @@ -23,17 +23,17 @@ narrowspec, ) -requirement = 'narrowhg' +REQUIREMENT = 'narrowhg' def wrappostshare(orig, sourcerepo, destrepo, **kwargs): orig(sourcerepo, destrepo, **kwargs) -if requirement in sourcerepo.requirements: +if REQUIREMENT in sourcerepo.requirements: with destrepo.wlock(): with destrepo.vfs('shared', 'a') as fp: fp.write(narrowspec.FILENAME + '\n') def unsharenarrowspec(orig, ui, repo, repopath): -if (requirement in repo.requirements +if (REQUIREMENT in repo.requirements and repo.path == repopath and repo.shared()): srcrepo = share._getsrcrepo(repo) with srcrepo.vfs(narrowspec.FILENAME) as f: diff --git a/hgext/narrow/narrowcommands.py b/hgext/narrow/narrowcommands.py --- a/hgext/narrow/narrowcommands.py +++ b/hgext/narrow/narrowcommands.py @@ -103,7 +103,7 @@ repo.__class__.__bases__ = (repo.__class__.__bases__[0], repo.unfiltered().__class__) if opts_narrow: -repo.requirements.add(narrowrepo.requirement) +repo.requirements.add(narrowrepo.REQUIREMENT) repo._writerequirements() return orig(repo, *args, **kwargs) @@ -116,7 +116,7 @@ def pullnarrowcmd(orig, ui, repo, *args, **opts): """Wraps pull command to allow modifying narrow spec.""" wrappedextraprepare = util.nullcontextmanager() -if narrowrepo.requirement in repo.requirements: +if narrowrepo.REQUIREMENT in repo.requirements: def pullbundle2extraprepare_widen(orig, pullop, kwargs): orig(pullop, kwargs) @@ -130,7 +130,7 @@ def archivenarrowcmd(orig, ui, repo, *args, **opts): """Wraps archive command to narrow the default includes.""" -if narrowrepo.requirement in repo.requirements: +if narrowrepo.REQUIREMENT in repo.requirements: repo_includes, repo_excludes = repo.narrowpats includes = set(opts.get('include', [])) excludes = set(opts.get('exclude', [])) @@ -144,7 +144,7 @@ def pullbundle2extraprepare(orig, pullop, kwargs): repo = pullop.repo -if narrowrepo.requirement not in repo.requirements: +if narrowrepo.REQUIREMENT not in repo.requirements: return orig(pullop, kwargs) if narrowbundle2.NARROWCAP not in pullop.remotebundle2caps: @@ -330,7 +330,7 @@ If --clear is specified without any further options, the narrowspec will be empty and will not match any files. """ -if narrowrepo.requirement not in repo.requirements: +if narrowrepo.REQUIREMENT not in repo.requirements: ui.warn(_('The narrow command is only supported on respositories cloned' ' with --narrow.\n')) return 1 diff --git a/hgext/narrow/narrowchangegroup.py b/hgext/narrow/narrowchangegroup.py --- a/hgext/narrow/narrowchangegroup.py +++ b/hgext/narrow/narrowchangegroup.py @@ -27,7 +27,7 @@ def supportedoutgoingversions(orig, repo): versions = orig(repo) -if narrowrepo.requirement in repo.requirements: +if narrowrepo.REQUIREMENT in repo.requirements: versions.discard('01') versions.discard('02') return versions diff --git a/hgext/narrow/narrowbundle2.py b/hgext/narrow/narrowbundle2.py --- a/hgext/narrow/narrowbundle2.py +++ b/hgext/narrow/narrowbundle2.py @@ -368,8 +368,8 @@ includepats = set(inpart.params.get(_SPECPART_INCLUDE, '').splitlines()) excludepats = set(inpart.params.get(_SPECPART_EXCLUDE, '').splitlines()) narrowspec.save(op.repo, includepats, excludepats) -if not narrowrepo.requirement in op.repo.requirements: -op.repo.requirements.add(narrowrepo.requirement) +if not narrowrepo.REQUIREMENT in op.repo.requirements: +op.repo.requirements.add(narrowrepo.REQUIREMENT) op.repo._writerequirements() op.repo.invalidate(clearfilecache=True) diff --git a/hgext/narrow/__init__.py b/hgext/narrow/__init__.py --- a/hgext/narrow/__init__.py +++ b/hgext/narrow/__init__.py @@ -55,7 +55,7 @@ # Export the commands table for Mercurial to see. cmdtable = narrowcommands.table -localrepo.localrepository._basesupported.add(narrowrepo.requirement) +localrepo.localrepository._basesupported.add(narrowrepo.REQUIREMENT)
D2007: narrowrepo: make repo requirement include the string 'experimental'
This revision was automatically updated to reflect the committed changes. Closed by commit rHGe14821b290eb: narrowrepo: make repo requirement include the string experimental (authored by durin42, committed by ). REPOSITORY rHG Mercurial CHANGES SINCE LAST UPDATE https://phab.mercurial-scm.org/D2007?vs=5157=5551 REVISION DETAIL https://phab.mercurial-scm.org/D2007 AFFECTED FILES hgext/narrow/narrowrepo.py tests/test-narrow-acl.t tests/test-narrow-clone-no-ellipsis.t tests/test-narrow-clone.t tests/test-narrow-debugcommands.t tests/test-narrow-pull.t CHANGE DETAILS diff --git a/tests/test-narrow-pull.t b/tests/test-narrow-pull.t --- a/tests/test-narrow-pull.t +++ b/tests/test-narrow-pull.t @@ -166,7 +166,7 @@ We should also be able to unshare without breaking everything: $ hg unshare - devel-warn: write with no wlock: "narrowspec" at: */hgext/narrow/narrowrepo.py:41 (unsharenarrowspec) (glob) + devel-warn: write with no wlock: "narrowspec" at: */hgext/narrow/narrowrepo.py:43 (unsharenarrowspec) (glob) $ hg verify checking changesets checking manifests diff --git a/tests/test-narrow-debugcommands.t b/tests/test-narrow-debugcommands.t --- a/tests/test-narrow-debugcommands.t +++ b/tests/test-narrow-debugcommands.t @@ -7,7 +7,7 @@ > [excludes] > EOF $ echo treemanifest >> .hg/requires - $ echo narrowhg >> .hg/requires + $ echo narrowhg-experimental >> .hg/requires $ mkdir -p foo/bar $ echo b > foo/f $ echo c > foo/bar/f diff --git a/tests/test-narrow-clone.t b/tests/test-narrow-clone.t --- a/tests/test-narrow-clone.t +++ b/tests/test-narrow-clone.t @@ -29,7 +29,7 @@ $ cat .hg/requires | grep -v generaldelta dotencode fncache - narrowhg + narrowhg-experimental revlogv1 store diff --git a/tests/test-narrow-clone-no-ellipsis.t b/tests/test-narrow-clone-no-ellipsis.t --- a/tests/test-narrow-clone-no-ellipsis.t +++ b/tests/test-narrow-clone-no-ellipsis.t @@ -25,7 +25,7 @@ $ cat .hg/requires | grep -v generaldelta dotencode fncache - narrowhg + narrowhg-experimental revlogv1 store diff --git a/tests/test-narrow-acl.t b/tests/test-narrow-acl.t --- a/tests/test-narrow-acl.t +++ b/tests/test-narrow-acl.t @@ -34,7 +34,7 @@ Requirements should contain narrowhg $ cat narrowclone1/.hg/requires | grep narrowhg - narrowhg + narrowhg-experimental NarrowHG should track f1 and f2 $ hg -R narrowclone1 tracked diff --git a/hgext/narrow/narrowrepo.py b/hgext/narrow/narrowrepo.py --- a/hgext/narrow/narrowrepo.py +++ b/hgext/narrow/narrowrepo.py @@ -23,7 +23,9 @@ narrowspec, ) -REQUIREMENT = 'narrowhg' +# When narrowing is finalized and no longer subject to format changes, +# we should move this to just "narrow" or similar. +REQUIREMENT = 'narrowhg-experimental' def wrappostshare(orig, sourcerepo, destrepo, **kwargs): orig(sourcerepo, destrepo, **kwargs) To: durin42, #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
D2194: narrowwirepeer: add TODO about how we add wireproto args to unbundle :(
This revision was automatically updated to reflect the committed changes. Closed by commit rHGb60c577b6e03: narrowwirepeer: add TODO about how we add wireproto args to unbundle :( (authored by durin42, committed by ). REPOSITORY rHG Mercurial CHANGES SINCE LAST UPDATE https://phab.mercurial-scm.org/D2194?vs=5510=5564 REVISION DETAIL https://phab.mercurial-scm.org/D2194 AFFECTED FILES hgext/narrow/narrowwirepeer.py CHANGE DETAILS diff --git a/hgext/narrow/narrowwirepeer.py b/hgext/narrow/narrowwirepeer.py --- a/hgext/narrow/narrowwirepeer.py +++ b/hgext/narrow/narrowwirepeer.py @@ -43,6 +43,8 @@ def wirereposetup(ui, peer): def wrapped(orig, cmd, *args, **kwargs): if cmd == 'unbundle': +# TODO: don't blindly add include/exclude wireproto +# arguments to unbundle. include, exclude = repo.narrowpats kwargs["includepats"] = ','.join(include) kwargs["excludepats"] = ','.join(exclude) To: durin42, #hg-reviewers, indygreg Cc: mercurial-devel ___ Mercurial-devel mailing list Mercurial-devel@mercurial-scm.org https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel
D2184: narrowrepo: add docstring for narrowpats
This revision was automatically updated to reflect the committed changes. Closed by commit rHG879da36e7644: narrowrepo: add docstring for narrowpats (authored by durin42, committed by ). REPOSITORY rHG Mercurial CHANGES SINCE LAST UPDATE https://phab.mercurial-scm.org/D2184?vs=5500=5554 REVISION DETAIL https://phab.mercurial-scm.org/D2184 AFFECTED FILES hgext/narrow/narrowrepo.py CHANGE DETAILS diff --git a/hgext/narrow/narrowrepo.py b/hgext/narrow/narrowrepo.py --- a/hgext/narrow/narrowrepo.py +++ b/hgext/narrow/narrowrepo.py @@ -75,6 +75,10 @@ @localrepo.repofilecache(narrowspec.FILENAME) def narrowpats(self): +"""matcher patterns for this repository's narrowspec + +A tuple of (includes, excludes). +""" return narrowspec.load(self) @localrepo.repofilecache(narrowspec.FILENAME) To: durin42, #hg-reviewers, indygreg Cc: mercurial-devel ___ Mercurial-devel mailing list Mercurial-devel@mercurial-scm.org https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel
D2188: narrowrevlog: add what little I can remember about rename filtering
This revision was automatically updated to reflect the committed changes. Closed by commit rHG48b592d986e7: narrowrevlog: add what little I can remember about rename filtering (authored by durin42, committed by ). REPOSITORY rHG Mercurial CHANGES SINCE LAST UPDATE https://phab.mercurial-scm.org/D2188?vs=5518=5558 REVISION DETAIL https://phab.mercurial-scm.org/D2188 AFFECTED FILES hgext/narrow/narrowrevlog.py CHANGE DETAILS diff --git a/hgext/narrow/narrowrevlog.py b/hgext/narrow/narrowrevlog.py --- a/hgext/narrow/narrowrevlog.py +++ b/hgext/narrow/narrowrevlog.py @@ -139,6 +139,12 @@ def makenarrowfilelog(fl, narrowmatch): class narrowfilelog(fl.__class__): def renamed(self, node): +# Renames that come from outside the narrowspec are +# problematic at least for git-diffs, because we lack the +# base text for the rename. This logic was introduced in +# 3cd72b1 of narrowhg (authored by martinvonz, reviewed by +# adgar), but that revision doesn't have any additional +# commentary on what problems we can encounter. m = super(narrowfilelog, self).renamed(node) if m and not narrowmatch(m[0]): return None To: durin42, #hg-reviewers, indygreg Cc: mercurial-devel ___ Mercurial-devel mailing list Mercurial-devel@mercurial-scm.org https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel
D2181: charencode: allow clang-format oversight
durin42 added inline comments. INLINE COMMENTS > indygreg wrote in charencode.h:11-12 > Huh? Why is it putting a system include after a local include? This feels > wrong to me. Per a colleague, https://clang.llvm.org/docs/ClangFormatStyleOptions.html - look for IncludeCategories. Basically, it looks like we need to configure that. :/ REPOSITORY rHG Mercurial REVISION DETAIL https://phab.mercurial-scm.org/D2181 To: durin42, #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
D2186: narrowrevlog: replace AssertionError with ProgrammingError
durin42 updated this revision to Diff 5516. REPOSITORY rHG Mercurial CHANGES SINCE LAST UPDATE https://phab.mercurial-scm.org/D2186?vs=5502=5516 REVISION DETAIL https://phab.mercurial-scm.org/D2186 AFFECTED FILES hgext/narrow/narrowrevlog.py CHANGE DETAILS diff --git a/hgext/narrow/narrowrevlog.py b/hgext/narrow/narrowrevlog.py --- a/hgext/narrow/narrowrevlog.py +++ b/hgext/narrow/narrowrevlog.py @@ -8,6 +8,7 @@ from __future__ import absolute_import from mercurial import ( + error, manifest, revlog, util, @@ -67,8 +68,8 @@ return excludeddir(self._dir, self._node) def write(self, *args): -raise AssertionError('Attempt to write manifest from excluded dir %s' % - self._dir) +raise error.ProgrammingError( +'attempt to write manifest from excluded dir %s' % self._dir) class excludedmanifestrevlog(manifest.manifestrevlog): """Stand-in for excluded treemanifest revlogs. @@ -84,20 +85,20 @@ self._dir = dir def __len__(self): -raise AssertionError('Attempt to get length of excluded dir %s' % - self._dir) +raise error.ProgrammingError( +'attempt to get length of excluded dir %s' % self._dir) def rev(self, node): -raise AssertionError('Attempt to get rev from excluded dir %s' % - self._dir) +raise error.ProgrammingError( +'attempt to get rev from excluded dir %s' % self._dir) def linkrev(self, node): -raise AssertionError('Attempt to get linkrev from excluded dir %s' % - self._dir) +raise error.ProgrammingError( +'attempt to get linkrev from excluded dir %s' % self._dir) def node(self, rev): -raise AssertionError('Attempt to get node from excluded dir %s' % - self._dir) +raise error.ProgrammingError( +'attempt to get node from excluded dir %s' % self._dir) def add(self, *args, **kwargs): # We should never write entries in dirlogs outside the narrow clone. To: durin42, #hg-reviewers Cc: mercurial-devel ___ Mercurial-devel mailing list Mercurial-devel@mercurial-scm.org https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel
D2187: manifest: clean up dirlog() to take a d parameter to avoid shadowing dir()
durin42 updated this revision to Diff 5517. REPOSITORY rHG Mercurial CHANGES SINCE LAST UPDATE https://phab.mercurial-scm.org/D2187?vs=5503=5517 REVISION DETAIL https://phab.mercurial-scm.org/D2187 AFFECTED FILES hgext/narrow/narrowrevlog.py mercurial/manifest.py CHANGE DETAILS diff --git a/mercurial/manifest.py b/mercurial/manifest.py --- a/mercurial/manifest.py +++ b/mercurial/manifest.py @@ -1245,15 +1245,15 @@ self._fulltextcache.clear() self._dirlogcache = {'': self} -def dirlog(self, dir): -if dir: +def dirlog(self, d): +if d: assert self._treeondisk -if dir not in self._dirlogcache: -mfrevlog = manifestrevlog(self.opener, dir, +if d not in self._dirlogcache: +mfrevlog = manifestrevlog(self.opener, d, self._dirlogcache, treemanifest=self._treeondisk) -self._dirlogcache[dir] = mfrevlog -return self._dirlogcache[dir] +self._dirlogcache[d] = mfrevlog +return self._dirlogcache[d] def add(self, m, transaction, link, p1, p2, added, removed, readtree=None): if (p1 in self.fulltextcache and util.safehasattr(m, 'fastdelta') diff --git a/hgext/narrow/narrowrevlog.py b/hgext/narrow/narrowrevlog.py --- a/hgext/narrow/narrowrevlog.py +++ b/hgext/narrow/narrowrevlog.py @@ -116,12 +116,12 @@ # This function is called via debug{revlog,index,data}, but also during # at least some push operations. This will be used to wrap/exclude the # child directories when using treemanifests. -def dirlog(self, dir): -if dir and not dir.endswith('/'): -dir = dir + '/' -if not repo.narrowmatch().visitdir(dir[:-1] or '.'): -return excludedmanifestrevlog(dir) -result = super(narrowmanifestrevlog, self).dirlog(dir) +def dirlog(self, d): +if d and not d.endswith('/'): +d = d + '/' +if not repo.narrowmatch().visitdir(d[:-1] or '.'): +return excludedmanifestrevlog(d) +result = super(narrowmanifestrevlog, self).dirlog(d) makenarrowmanifestrevlog(result, repo) return result To: durin42, #hg-reviewers Cc: mercurial-devel ___ Mercurial-devel mailing list Mercurial-devel@mercurial-scm.org https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel
D2185: narrowrevlog: document excludeddir class and friends
durin42 updated this revision to Diff 5515. REPOSITORY rHG Mercurial CHANGES SINCE LAST UPDATE https://phab.mercurial-scm.org/D2185?vs=5501=5515 REVISION DETAIL https://phab.mercurial-scm.org/D2185 AFFECTED FILES hgext/narrow/narrowrevlog.py CHANGE DETAILS diff --git a/hgext/narrow/narrowrevlog.py b/hgext/narrow/narrowrevlog.py --- a/hgext/narrow/narrowrevlog.py +++ b/hgext/narrow/narrowrevlog.py @@ -31,6 +31,16 @@ pass class excludeddir(manifest.treemanifest): +"""Stand-in for a directory that is excluded from the repository. + +With narrowing active on a repository that uses treemanifests, +some of the directory revlogs will be excluded from the resulting +clone. This is a huge storage win for clients, but means we need +some sort of pseudo-manifest to surface to internals so we can +detect a merge conflict outside the narrowspec. That's what this +class is: it stands in for a directory whose node is known, but +whose contents are unknown. +""" def __init__(self, dir, node): super(excludeddir, self).__init__(dir) self._node = node @@ -48,6 +58,7 @@ return self class excludeddirmanifestctx(manifest.treemanifestctx): +"""context wrapper for excludeddir - see that docstring for rationale""" def __init__(self, dir, node): self._dir = dir self._node = node @@ -60,6 +71,15 @@ self._dir) class excludedmanifestrevlog(manifest.manifestrevlog): +"""Stand-in for excluded treemanifest revlogs. + +When narrowing is active on a treemanifest repository, we'll have +references to directories we can't see due to the revlog being +skipped. This class exists to conform to the manifestrevlog +interface for those directories and proactively prevent writes to +outside the narrowspec. +""" + def __init__(self, dir): self._dir = dir To: durin42, #hg-reviewers Cc: mercurial-devel ___ Mercurial-devel mailing list Mercurial-devel@mercurial-scm.org https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel
D2009: narrowtemplates: update to use registrar mechanism
durin42 updated this revision to Diff 5514. REPOSITORY rHG Mercurial CHANGES SINCE LAST UPDATE https://phab.mercurial-scm.org/D2009?vs=5159=5514 REVISION DETAIL https://phab.mercurial-scm.org/D2009 AFFECTED FILES hgext/narrow/__init__.py hgext/narrow/narrowtemplates.py CHANGE DETAILS diff --git a/hgext/narrow/narrowtemplates.py b/hgext/narrow/narrowtemplates.py --- a/hgext/narrow/narrowtemplates.py +++ b/hgext/narrow/narrowtemplates.py @@ -8,24 +8,29 @@ from __future__ import absolute_import from mercurial import ( +registrar, revlog, -revset, -templatekw, util, ) +keywords = {} +templatekeyword = registrar.templatekeyword(keywords) +revsetpredicate = registrar.revsetpredicate() + def _isellipsis(repo, rev): if repo.changelog.flags(rev) & revlog.REVIDX_ELLIPSIS: return True return False +@templatekeyword('ellipsis') def ellipsis(repo, ctx, templ, **args): """:ellipsis: String. 'ellipsis' if the change is an ellipsis node, else ''.""" if _isellipsis(repo, ctx.rev()): return 'ellipsis' return '' +@templatekeyword('outsidenarrow') def outsidenarrow(repo, ctx, templ, **args): """:outsidenarrow: String. 'outsidenarrow' if the change affects no tracked files, else ''.""" @@ -35,15 +40,9 @@ return 'outsidenarrow' return '' +@revsetpredicate('ellipsis') def ellipsisrevset(repo, subset, x): """``ellipsis()`` Changesets that are ellipsis nodes. """ return subset.filter(lambda r: _isellipsis(repo, r)) - -def setup(): -templatekw.keywords['ellipsis'] = ellipsis -templatekw.keywords['outsidenarrow'] = outsidenarrow - -revset.symbols['ellipsis'] = ellipsisrevset -revset.safesymbols.add('ellipsis') diff --git a/hgext/narrow/__init__.py b/hgext/narrow/__init__.py --- a/hgext/narrow/__init__.py +++ b/hgext/narrow/__init__.py @@ -62,7 +62,6 @@ narrowrevlog.setup() narrowbundle2.setup() narrowmerge.setup() -narrowtemplates.setup() narrowcommands.setup() narrowchangegroup.setup() narrowwirepeer.uisetup() @@ -91,3 +90,6 @@ extensions.wrapfunction(verifymod.verifier, '__init__', _verifierinit) extensions.wrapfunction(hg, 'postshare', narrowrepo.wrappostshare) extensions.wrapfunction(hg, 'copystore', narrowrepo.unsharenarrowspec) + +templatekeyword = narrowtemplates.templatekeyword +revsetpredicate = narrowtemplates.revsetpredicate To: durin42, #hg-reviewers, indygreg Cc: mercurial-devel ___ Mercurial-devel mailing list Mercurial-devel@mercurial-scm.org https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel
D2008: narrow: move from ELLIPSIS_NODE_FLAG to revlog.REVIDX_ELLIPSIS
durin42 updated this revision to Diff 5513. durin42 edited the summary of this revision. durin42 retitled this revision from "revlog: move ELLIPSIS_NODE_FLAG to core from narrowrevlog" to "narrow: move from ELLIPSIS_NODE_FLAG to revlog.REVIDX_ELLIPSIS". REPOSITORY rHG Mercurial CHANGES SINCE LAST UPDATE https://phab.mercurial-scm.org/D2008?vs=5499=5513 REVISION DETAIL https://phab.mercurial-scm.org/D2008 AFFECTED FILES hgext/narrow/narrowchangegroup.py hgext/narrow/narrowrevlog.py hgext/narrow/narrowtemplates.py CHANGE DETAILS diff --git a/hgext/narrow/narrowtemplates.py b/hgext/narrow/narrowtemplates.py --- a/hgext/narrow/narrowtemplates.py +++ b/hgext/narrow/narrowtemplates.py @@ -8,15 +8,14 @@ from __future__ import absolute_import from mercurial import ( +revlog, revset, templatekw, util, ) -from . import narrowrevlog - def _isellipsis(repo, rev): -if repo.changelog.flags(rev) & narrowrevlog.ELLIPSIS_NODE_FLAG: +if repo.changelog.flags(rev) & revlog.REVIDX_ELLIPSIS: return True return False diff --git a/hgext/narrow/narrowrevlog.py b/hgext/narrow/narrowrevlog.py --- a/hgext/narrow/narrowrevlog.py +++ b/hgext/narrow/narrowrevlog.py @@ -13,11 +13,6 @@ util, ) -ELLIPSIS_NODE_FLAG = 1 << 14 -revlog.REVIDX_KNOWN_FLAGS |= ELLIPSIS_NODE_FLAG -if ELLIPSIS_NODE_FLAG not in revlog.REVIDX_FLAGS_ORDER: -revlog.REVIDX_FLAGS_ORDER.append(ELLIPSIS_NODE_FLAG) - def readtransform(self, text): return text, False @@ -27,7 +22,7 @@ def rawtransform(self, text): return False -revlog.addflagprocessor(ELLIPSIS_NODE_FLAG, +revlog.addflagprocessor(revlog.REVIDX_ELLIPSIS, (readtransform, writetransform, rawtransform)) def setup(): diff --git a/hgext/narrow/narrowchangegroup.py b/hgext/narrow/narrowchangegroup.py --- a/hgext/narrow/narrowchangegroup.py +++ b/hgext/narrow/narrowchangegroup.py @@ -15,12 +15,12 @@ manifest, mdiff, node, +revlog, util, ) from . import ( narrowrepo, -narrowrevlog, ) def setup(): @@ -83,11 +83,11 @@ extensions.wrapfunction( changegroup.cg1packer, 'generatefiles', generatefiles) -def ellipsisdata(packer, rev, revlog, p1, p2, data, linknode): -n = revlog.node(rev) -p1n, p2n = revlog.node(p1), revlog.node(p2) -flags = revlog.flags(rev) -flags |= narrowrevlog.ELLIPSIS_NODE_FLAG +def ellipsisdata(packer, rev, revlog_, p1, p2, data, linknode): +n = revlog_.node(rev) +p1n, p2n = revlog_.node(p1), revlog_.node(p2) +flags = revlog_.flags(rev) +flags |= revlog.REVIDX_ELLIPSIS meta = packer.builddeltaheader( n, p1n, p2n, node.nullid, linknode, flags) # TODO: try and actually send deltas for ellipsis data blocks To: durin42, indygreg, #hg-reviewers Cc: martinvonz, mercurial-devel ___ Mercurial-devel mailing list Mercurial-devel@mercurial-scm.org https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel
D2188: narrowrevlog: add what little I can remember about rename filtering
durin42 updated this revision to Diff 5518. REPOSITORY rHG Mercurial CHANGES SINCE LAST UPDATE https://phab.mercurial-scm.org/D2188?vs=5504=5518 REVISION DETAIL https://phab.mercurial-scm.org/D2188 AFFECTED FILES hgext/narrow/narrowrevlog.py CHANGE DETAILS diff --git a/hgext/narrow/narrowrevlog.py b/hgext/narrow/narrowrevlog.py --- a/hgext/narrow/narrowrevlog.py +++ b/hgext/narrow/narrowrevlog.py @@ -139,6 +139,12 @@ def makenarrowfilelog(fl, narrowmatch): class narrowfilelog(fl.__class__): def renamed(self, node): +# Renames that come from outside the narrowspec are +# problematic at least for git-diffs, because we lack the +# base text for the rename. This logic was introduced in +# 3cd72b1 of narrowhg (authored by martinvonz, reviewed by +# adgar), but that revision doesn't have any additional +# commentary on what problems we can encounter. m = super(narrowfilelog, self).renamed(node) if m and not narrowmatch(m[0]): return None To: durin42, #hg-reviewers Cc: mercurial-devel ___ Mercurial-devel mailing list Mercurial-devel@mercurial-scm.org https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel
D2189: narrowrevlog: add a TODO around remotefilelog moving to core
durin42 updated this revision to Diff 5519. REPOSITORY rHG Mercurial CHANGES SINCE LAST UPDATE https://phab.mercurial-scm.org/D2189?vs=5505=5519 REVISION DETAIL https://phab.mercurial-scm.org/D2189 AFFECTED FILES hgext/narrow/narrowrevlog.py CHANGE DETAILS diff --git a/hgext/narrow/narrowrevlog.py b/hgext/narrow/narrowrevlog.py --- a/hgext/narrow/narrowrevlog.py +++ b/hgext/narrow/narrowrevlog.py @@ -156,6 +156,10 @@ # rename-checking logic when on remotefilelog. This # might be incorrect on other non-revlog-based storage # engines, but for now this seems to be fine. +# +# TODO: when remotefilelog is in core, improve this to +# explicitly look for remotefilelog instead of cheating +# with a hasattr check. if util.safehasattr(self, 'node'): node = self.node(rev) # Because renamed() is overridden above to To: durin42, #hg-reviewers Cc: mercurial-devel ___ Mercurial-devel mailing list Mercurial-devel@mercurial-scm.org https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel
D2197: python3: whitelist another four passing tests
This revision was automatically updated to reflect the committed changes. Closed by commit rHG7f68235f23ff: python3: whitelist another four passing tests (authored by durin42, committed by ). REPOSITORY rHG Mercurial CHANGES SINCE LAST UPDATE https://phab.mercurial-scm.org/D2197?vs=5539=5540 REVISION DETAIL https://phab.mercurial-scm.org/D2197 AFFECTED FILES contrib/python3-whitelist CHANGE DETAILS diff --git a/contrib/python3-whitelist b/contrib/python3-whitelist --- a/contrib/python3-whitelist +++ b/contrib/python3-whitelist @@ -43,6 +43,7 @@ test-diff-subdir.t test-diffdir.t test-directaccess.t +test-dirstate-backup.t test-dirstate-nonnormalset.t test-doctest.py test-double-merge.t @@ -89,6 +90,7 @@ test-issue1089.t test-issue1175.t test-issue1306.t +test-issue1438.t test-issue1502.t test-issue1802.t test-issue1877.t @@ -176,7 +178,9 @@ test-revset-dirstate-parents.t test-revset-outgoing.t test-run-tests.py +test-serve.t test-show-stack.t +test-show.t test-simple-update.t test-single-head.t test-sparse-clear.t To: durin42, pulkit, #hg-reviewers, indygreg Cc: mercurial-devel ___ Mercurial-devel mailing list Mercurial-devel@mercurial-scm.org https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel
D2196: narrow: add a TODO document
durin42 created this revision. Herald added a subscriber: mercurial-devel. Herald added a reviewer: hg-reviewers. REVISION SUMMARY These are things that are bigger than we want to handle right now, but are pretty important to get narrowing to be non-experimental. REPOSITORY rHG Mercurial REVISION DETAIL https://phab.mercurial-scm.org/D2196 AFFECTED FILES hgext/narrow/TODO.rst CHANGE DETAILS diff --git a/hgext/narrow/TODO.rst b/hgext/narrow/TODO.rst new file mode 100644 --- /dev/null +++ b/hgext/narrow/TODO.rst @@ -0,0 +1,37 @@ +Integration with the share extension needs improvement. Right now +we've seen some odd bugs, and the way we modify the contents of the +.hg/shared file is unfortunate. See wrappostshare() and unsharenarrowspec(). + +Resolve commentary on narrowrepo.wraprepo.narrowrepository.status +about the filtering of status being done at an awkward layer. This +came up the import to hgext, but nobody's got concrete improvement +ideas as of then. + +Fold most (or preferably all) of narrowrevlog.py into core. + +Address commentary in narrowrevlog.excludedmanifestrevlog.add - +specifically we should improve the collaboration with core so that +add() never gets called on an excluded directory and we can improve +the stand-in to raise a ProgrammingError. + +Figure out how to correctly produce narrowmanifestrevlog and +narrowfilelog instances instead of monkeypatching regular revlogs at +runtime to our subclass. Even better, merge the narrowing logic +directly into core. + +Reason more completely about rename-filtering logic in +narrowfilelog. There could be some surprises lurking there. + +Formally document the narrowspec format. Unify with sparse, if at all +possible. For bonus points, unify with the server-specified narrowspec +format. + +narrowrepo.setnarrowpats() or narrowspec.save() need to make sure +they're holding the wlock. + +Implement a simple version of the expandnarrow wireproto command for +core. Having configurable shorthands for narrowspecs has been useful +at Google (and sparse has a similar feature from Facebook), so it +probably makes sense to implement the feature in core. (Google's +handler is entirely custom to Google, with a custom format related to +bazel's build language, so it's not in the narrowhg distribution.) To: durin42, #hg-reviewers Cc: mercurial-devel ___ Mercurial-devel mailing list Mercurial-devel@mercurial-scm.org https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel
D1977: narrow: this code should assume REVIDX_FLAGS_ORDER exists
durin42 added inline comments. INLINE COMMENTS > martinvonz wrote in narrowrevlog.py:16-20 > looks like you can instead drop all of this since we have now (since > https://phab.mercurial-scm.org/rHG08b34c3a6f74800b5b357f371568177827963e2b) > defined the flag in revlog.py (and just use revlog.REVIDX_ELLIPSIS instead > below) I'll do that in https://phab.mercurial-scm.org/D2008. REPOSITORY rHG Mercurial REVISION DETAIL https://phab.mercurial-scm.org/D1977 To: durin42, #hg-reviewers, martinvonz Cc: martinvonz, mercurial-devel ___ Mercurial-devel mailing list Mercurial-devel@mercurial-scm.org https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel
D2093: tests: add tests for sending recognized command before handshake
This revision was automatically updated to reflect the committed changes. Closed by commit rHG465858451347: tests: add tests for sending recognized command before handshake (authored by indygreg, committed by ). REPOSITORY rHG Mercurial CHANGES SINCE LAST UPDATE https://phab.mercurial-scm.org/D2093?vs=5354=5537 REVISION DETAIL https://phab.mercurial-scm.org/D2093 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 @@ -394,6 +394,33 @@ 0 0 +Send a valid command before the handshake + + $ hg -R server serve --stdio << EOF + > heads + > hello + > between + > pairs 81 + > - + > EOF + 41 + 68986213bd4485ea51533535e3fc9e78007a711f + 384 + capabilities: lookup changegroupsubset branchmap pushkey known getbundle unbundlehash batch streamreqs=generaldelta,revlogv1 $USUAL_BUNDLE2_CAPS_SERVER$ unbundle=HG10GZ,HG10BZ,HG10UN + 1 + + +And a variation that doesn't send the between command + + $ hg -R server serve --stdio << EOF + > heads + > hello + > EOF + 41 + 68986213bd4485ea51533535e3fc9e78007a711f + 384 + capabilities: lookup changegroupsubset branchmap pushkey known getbundle unbundlehash batch streamreqs=generaldelta,revlogv1 $USUAL_BUNDLE2_CAPS_SERVER$ unbundle=HG10GZ,HG10BZ,HG10UN + Send an upgrade request to a server that doesn't support that command $ hg -R server serve --stdio << EOF To: indygreg, #hg-reviewers, durin42 Cc: mercurial-devel ___ Mercurial-devel mailing list Mercurial-devel@mercurial-scm.org https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel
D2094: wireprotoserver: define and use parse_qs from urllib
This revision was automatically updated to reflect the committed changes. Closed by commit rHGa3d42d1865f1: wireprotoserver: define and use parse_qs from urllib (authored by indygreg, committed by ). REPOSITORY rHG Mercurial CHANGES SINCE LAST UPDATE https://phab.mercurial-scm.org/D2094?vs=5355=5538 REVISION DETAIL https://phab.mercurial-scm.org/D2094 AFFECTED FILES mercurial/urllibcompat.py mercurial/wireprotoserver.py CHANGE DETAILS diff --git a/mercurial/wireprotoserver.py b/mercurial/wireprotoserver.py --- a/mercurial/wireprotoserver.py +++ b/mercurial/wireprotoserver.py @@ -7,7 +7,6 @@ from __future__ import absolute_import import abc -import cgi import contextlib import struct import sys @@ -134,12 +133,12 @@ args = util.rapply(pycompat.bytesurl, self._req.form.copy()) postlen = int(self._req.env.get(r'HTTP_X_HGARGS_POST', 0)) if postlen: -args.update(cgi.parse_qs( +args.update(urlreq.parseqs( self._req.read(postlen), keep_blank_values=True)) return args argvalue = decodevaluefromheaders(self._req, r'X-HgArg') -args.update(cgi.parse_qs(argvalue, keep_blank_values=True)) +args.update(urlreq.parseqs(argvalue, keep_blank_values=True)) return args def forwardpayload(self, fp): diff --git a/mercurial/urllibcompat.py b/mercurial/urllibcompat.py --- a/mercurial/urllibcompat.py +++ b/mercurial/urllibcompat.py @@ -47,6 +47,7 @@ "urlparse", "urlunparse", )) +urlreq._registeralias(urllib.parse, "parse_qs", "parseqs") urlreq._registeralias(urllib.parse, "unquote_to_bytes", "unquote") import urllib.request urlreq._registeraliases(urllib.request, ( @@ -157,6 +158,7 @@ "urlparse", "urlunparse", )) +urlreq._registeralias(urlparse, "parse_qs", "parseqs") urlerr._registeraliases(urllib2, ( "HTTPError", "URLError", To: indygreg, #hg-reviewers, durin42 Cc: mercurial-devel ___ Mercurial-devel mailing list Mercurial-devel@mercurial-scm.org https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel
D2108: infinitepush: drop the `--to` flag to push and use `-B` instead
durham added a comment. > There are things which I am not sure whether to keep or not: > > - the --bundle-store flag to push command This is useful for scripts or tools that want to upload a commit to the cloud without having to give it a name. For instance, you can use it to push a commit then send that commit hash to some build service which can checkout the commit without having to worry about a bookmark name. But this could always be added back later, so it's probably fine to drop it if there's not an immediate need in Mozilla's use case. > - functionality to pull from bundlestore using hg pull Similar to the points above and below, this is useful for automation that already passes hashes around. Not having to pass around bookmark names as well means it's easier for that automation to migrate to infinitepush. > - functionality to pull changesets from bundlestore if a changeset is not found locally on hg update This is a bit of magic that user's really like. When combined with automatic backup pushes, it makes it feel like everyone is using the same repository. I'd highly recommend keeping this just for the eventual PR of saying "I can just hg commit, and my friend can do hg checkout HASH" > - logic around sql store Without this, would the server always store data in the filesystem? The sql store seems like an important bit of making this robust in enterprise usage. > - interaction with the hoisting functionality of remotenames extension which is also being moved to core I'm not familiar with how infinitepush plays into hoisting, but I just wanted to make sure users never have to type 'remote/' or 'default/'. REPOSITORY rHG Mercurial REVISION DETAIL https://phab.mercurial-scm.org/D2108 To: pulkit, #hg-reviewers, indygreg Cc: indygreg, durham, mercurial-devel ___ Mercurial-devel mailing list Mercurial-devel@mercurial-scm.org https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel
D2108: infinitepush: drop the `--to` flag to push and use `-B` instead
indygreg added a comment. In https://phab.mercurial-scm.org/D2108#36335, @durham wrote: > > There are things which I am not sure whether to keep or not: > > > > - the --bundle-store flag to push command > > This is useful for scripts or tools that want to upload a commit to the cloud without having to give it a name. For instance, you can use it to push a commit then send that commit hash to some build service which can checkout the commit without having to worry about a bookmark name. But this could always be added back later, so it's probably fine to drop it if there's not an immediate need in Mozilla's use case. To be clear, Mozilla has 2 use cases where infinitepush could be useful: 1. For our Try repository. Upload a nameless bundle somewhere and CI consumes it. 2. For user repositories (basically forks of the main repos). REPOSITORY rHG Mercurial REVISION DETAIL https://phab.mercurial-scm.org/D2108 To: pulkit, #hg-reviewers, indygreg Cc: indygreg, durham, mercurial-devel ___ Mercurial-devel mailing list Mercurial-devel@mercurial-scm.org https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel
D1974: narrow: import experimental extension from narrowhg revision cb51d673e9c5
durin42 added a comment. Okay, I've pushed more followups. The bulk of the TODOs are recorded in a file introduced in https://phab.mercurial-scm.org/D2196, but there are also some added inline in the code. Let me know how I can help - I'll make time to video conference this week if it'd facilitate getting this landed with minimal additional lost sanity. Thanks! INLINE COMMENTS > indygreg wrote in narrowbundle2.py:138-151 > I'm not an expert on the manifest APIs. There //may// be a more optimal way > to implement this... I wrote lazymanifest, and this was the best adgar and I could come up with... > indygreg wrote in narrowrepo.py:85-87 > I agree with the inline todo :) Okay if we come back to that, since it's already logged as a TODO? > indygreg wrote in narrowrevlog.py:1 > I'd like to see this file's content moved into core sooner rather than later. > There are a lot of implications for storage that need to be in people's minds > when they are touching code in core. Yes, noted this in a TODO.rst. > indygreg wrote in narrowrevlog.py:90-94 > Consider doing that and changing this to raise if called. Added to a TODO file. > indygreg wrote in narrowrevlog.py:105 > Nit: `dir` is a builtin. If this matches core, fine. But I'd prefer avoiding > the name collision. Ouch, good catch. This does match core, so I fixed both in my followup. > indygreg wrote in narrowrevlog.py:114-115 > In-place mutation of low-level types. Yummy. > > Please add a todo for the post-landing list to construct the proper type from > the beginning. This likely requires some API changes in core. I'm thinking > some function should return the type to use for new revlogs. Or we should > spawn this type and call super.__init__ from its __init__. Yeah, this is one of several places where I want to just hoist internals changes to core, with the only customer being narrow (for now, at least). It's super gross the way it currently is. > indygreg wrote in narrowrevlog.py:128-131 > I think this wants a comment explaining why we lie about rename metadata when > the destination is outside of the narrow spec. Also, we'll want to flag this > for further review, since there could be some interesting implications to > lying here. Yeah, all I remember about this (https://bitbucket.org/Google/narrowhg/commits/3cd72b1a1b41c9e46f12eba78c253da169277374) is that git-diffs break in the case of a rename from outside->inside. There are almost certainly other problems lurking in the weeds here, but to my knowledge we've not seen them at Google... > indygreg wrote in narrowrevlog.py:134-139 > This is making assumptions about code that hasn't landed yet. Not sure if we > should replace this with a TODO or what. Added an explicit TODO. We can make this a TON cleaner when narrowhg can be formally aware of remotefilelog, this was mostly a kludge to work around them being in disjoint repos and not wanting to assume we could find remotefilelog cleanly. > indygreg wrote in narrowspec.py:31-42 > Oh, hey, this looks just like sparse profiles! I sense some code conversion > in our future... Yes, the goal is that the two extensions will share a fair amount of logic. :) > indygreg wrote in narrowspec.py:49-54 > Playing devil's advocate, do we really need two formats doing the same thing? That's a great question. I don't really know the answer offhand. Added a TODO... > indygreg wrote in narrowspec.py:83 > Can we use `str.count()` to avoid creating objects for each line? Gave it a shot, and things broke all over the place. :( > indygreg wrote in narrowspec.py:93-95 > What about `\` as a path separator? Should we also ban that? I assume we're > interpreting the value here and paths as bytes, so `\` will never be used as > an escape character? @martinvonz please correct me if this is wrong. The paths are stored in the narrowspec with canonical (that is /) path separators, just like the rest of the internals. We're reading things as bytes, so yes, \ should never occur. > indygreg wrote in narrowspec.py:110-115 > It is better to build a list of lines and `'\n'.join()` them. It shouldn't be: this particular "str with refcount of 1" behavior was optimized a long time ago in cpython to not be a horrendous stack of copies. If it shows up in a profile, we can obviously fix it. > indygreg wrote in narrowspec.py:133-138 > This reinvents `repo.vfs.tryread()`. Yep, but it also does some extra cache invalidation, so I don't think I can fuse them. > indygreg wrote in narrowspec.py:146-150 > This is called from `narrowrepo.setnarrowparts()` and neither of them cares > about locking. Somewhere we should ensure we hold the wlock. Added to my TODO doc because I don't want reasoning about locking to block getting out of this pile-of-comments hell. > indygreg wrote in narrowwirepeer.py:45-48 > This will blindly add `includepats` and `excludepats` as wire protocol > arguments to the `unbundle` command. In the Python