D6183: copies: add config option for writing copy metadata to file and/or changset
marmoute added a comment. I am quite enthousiastic for a non-filelog based copy tracing using commit level information. However, I am very unenthousiastic at the idea of storing more copy data in the changeset itself. The "files" field in the changelog is already quite problematic (about 95% for changelog.d file, taking possibily hundred of megabytes). In addition, stoing copy in the changeset is kind of a "schema breakage" making its adoption slower. Instead I would advertise for keeping the copy data inside the filelog, using a changeset centric cache summing up the information. The entries from this changeset centric cache can be exchanged over the wire alongside their associated changesets, solving your remote-filelog usecase. REPOSITORY rHG Mercurial REVISION DETAIL https://phab.mercurial-scm.org/D6183 To: martinvonz, #hg-reviewers Cc: marmoute, mercurial-devel ___ Mercurial-devel mailing list Mercurial-devel@mercurial-scm.org https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel
[PATCH] interactive: do not prompt about files given in command line
# HG changeset patch # User Denis Laxalde # Date 1554370518 -7200 # Thu Apr 04 11:35:18 2019 +0200 # Node ID 74a00c7446609592ccb6a3dc5ac98769ac36bfe8 # Parent 4ee906aa7b60fb6b113e4dc187fbb5a8f42e557c interactive: do not prompt about files given in command line For commit and revert commands with --interactive and explicit files given in the command line, we now skip the invite to "examine changes to ? [Ynesfdaq?]". The reason for this is that, if is specified by the user, asking for confirmation is redundant. In patch.filterpatch(), we now use an optional "match" argument to conditionally call the prompt() function when entering a new "header" item. We use .exact() method to compare with files from the "header" in order to only consider (rel)path patterns. Add tests with glob patterns for commit and revert, to make sure we still ask to examine files in these cases. diff --git a/mercurial/cmdutil.py b/mercurial/cmdutil.py --- a/mercurial/cmdutil.py +++ b/mercurial/cmdutil.py @@ -201,7 +201,8 @@ def setupwrapcolorwrite(ui): setattr(ui, 'write', wrap) return oldwrite -def filterchunks(ui, originalhunks, usecurses, testfile, operation=None): +def filterchunks(ui, originalhunks, usecurses, testfile, match, + operation=None): try: if usecurses: if testfile: @@ -216,9 +217,9 @@ def filterchunks(ui, originalhunks, usec ui.warn('%s\n' % e.message) ui.warn(_('falling back to text mode\n')) -return patch.filterpatch(ui, originalhunks, operation) - -def recordfilter(ui, originalhunks, operation=None): +return patch.filterpatch(ui, originalhunks, match, operation) + +def recordfilter(ui, originalhunks, match, operation=None): """ Prompts the user to filter the originalhunks and return a list of selected hunks. *operation* is used for to build ui messages to indicate the user what @@ -230,7 +231,7 @@ def recordfilter(ui, originalhunks, oper oldwrite = setupwrapcolorwrite(ui) try: newchunks, newopts = filterchunks(ui, originalhunks, usecurses, - testfile, operation) + testfile, match, operation) finally: ui.write = oldwrite return newchunks, newopts @@ -312,10 +313,11 @@ def dorecord(ui, repo, commitfunc, cmdsu diffopts.showfunc = True originaldiff = patch.diff(repo, changes=status, opts=diffopts) originalchunks = patch.parsepatch(originaldiff) +match = scmutil.match(repo[None], pats) # 1. filter patch, since we are intending to apply subset of it try: -chunks, newopts = filterfn(ui, originalchunks) +chunks, newopts = filterfn(ui, originalchunks, match) except error.PatchError as err: raise error.Abort(_('error parsing patch: %s') % err) opts.update(newopts) @@ -3082,8 +3084,9 @@ def revert(ui, repo, ctx, parents, *pats prefetch(repo, [ctx.rev()], matchfiles(repo, [f for sublist in oplist for f in sublist])) +match = scmutil.match(repo[None], pats) _performrevert(repo, parents, ctx, names, uipathfn, actions, - interactive, tobackup) + match, interactive, tobackup) if targetsubs: # Revert the subrepos on the revert list @@ -3096,7 +3099,7 @@ def revert(ui, repo, ctx, parents, *pats % (sub, short(ctx.node( def _performrevert(repo, parents, ctx, names, uipathfn, actions, - interactive=False, tobackup=None): + match, interactive=False, tobackup=None): """function that actually perform all the actions computed for revert This is an independent function to let extension to plug in and react to @@ -3192,7 +3195,7 @@ def _performrevert(repo, parents, ctx, n try: -chunks, opts = recordfilter(repo.ui, originalchunks, +chunks, opts = recordfilter(repo.ui, originalchunks, match, operation=operation) if operation == 'discard': chunks = patch.reversehunks(chunks) diff --git a/mercurial/patch.py b/mercurial/patch.py --- a/mercurial/patch.py +++ b/mercurial/patch.py @@ -1065,7 +1065,7 @@ def getmessages(): } } -def filterpatch(ui, headers, operation=None): +def filterpatch(ui, headers, match, operation=None): """Interactively filter patch chunks into applied-only chunks""" messages = getmessages() @@ -1182,9 +1182,13 @@ the hunk is left unchanged. seen.add(hdr) if skipall is None: h.pretty(ui) +files = h.files() msg = (_('examine changes to %s?') % - _(' and ').join("'%s'" % f for f in h.files())) -r, skipfile, skipall, np = prompt(skipfile,
Re: [PATCH] interactive: do not prompt about files given in command line
On Fri, Apr 5, 2019 at 12:47 PM Denis Laxalde wrote: > # HG changeset patch > # User Denis Laxalde > # Date 1554370518 -7200 > # Thu Apr 04 11:35:18 2019 +0200 > # Node ID 74a00c7446609592ccb6a3dc5ac98769ac36bfe8 > # Parent 4ee906aa7b60fb6b113e4dc187fbb5a8f42e557c > interactive: do not prompt about files given in command line > > For commit and revert commands with --interactive and explicit files > given in the command line, we now skip the invite to "examine changes to > ? [Ynesfdaq?]". The reason for this is that, if is > specified by the user, asking for confirmation is redundant. > > In patch.filterpatch(), we now use an optional "match" argument to > conditionally call the prompt() function when entering a new "header" > item. We use .exact() method to compare with files from the "header" in > order to only consider (rel)path patterns. > > Add tests with glob patterns for commit and revert, to make sure we > still ask to examine files in these cases. > Queued, many many thanks! I recently had an user complaining about this on twitter. ___ Mercurial-devel mailing list Mercurial-devel@mercurial-scm.org https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel
D6188: test/test-revset2.t: Unset environment variable P
pulkit added a comment. In https://phab.mercurial-scm.org/D6188#90212, @jerry.montfort wrote: > Hi, Used hg phasbsend which created https://phab.mercurial-scm.org/D6195. I've no clue how to merge/handle these two, so feel free to intervene. > Also added issueNNN to the commit description as suggested. Thanks for the updated patch, I pushed it yesterday. This can be marked as Abandoned from the phabricator UI. REPOSITORY rHG Mercurial REVISION DETAIL https://phab.mercurial-scm.org/D6188 To: jerry.montfort, #hg-reviewers Cc: pulkit, mercurial-devel ___ Mercurial-devel mailing list Mercurial-devel@mercurial-scm.org https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel
D6201: automation: use raw strings when there are backslashes
This revision was automatically updated to reflect the committed changes. Closed by commit rHG0e9066db5e44: automation: use raw strings when there are backslashes (authored by indygreg, committed by ). REPOSITORY rHG Mercurial CHANGES SINCE LAST UPDATE https://phab.mercurial-scm.org/D6201?vs=14660&id=14666 REVISION DETAIL https://phab.mercurial-scm.org/D6201 AFFECTED FILES contrib/automation/hgautomation/aws.py contrib/automation/hgautomation/windows.py CHANGE DETAILS diff --git a/contrib/automation/hgautomation/windows.py b/contrib/automation/hgautomation/windows.py --- a/contrib/automation/hgautomation/windows.py +++ b/contrib/automation/hgautomation/windows.py @@ -114,7 +114,7 @@ commands = [ '$ErrorActionPreference = "Stop"', 'Repair-AuthorizedKeyPermission -FilePath %s -Confirm:$false' % path, -'icacls %s /remove:g "NT Service\sshd"' % path, +r'icacls %s /remove:g "NT Service\sshd"' % path, ] run_powershell(winrm_client, '\n'.join(commands)) @@ -192,7 +192,7 @@ """Find path to newest file in dist/ directory matching a pattern.""" res = winrm_client.execute_ps( -'$v = Get-ChildItem -Path C:\hgdev\src\dist -Filter "%s" ' +r'$v = Get-ChildItem -Path C:\hgdev\src\dist -Filter "%s" ' '| Sort-Object LastWriteTime -Descending ' '| Select-Object -First 1\n' '$v.name' % pattern @@ -270,8 +270,8 @@ ``test_flags`` is a str representing extra arguments to pass to ``run-tests.py``. """ -if not re.match('\d\.\d', python_version): -raise ValueError('python_version must be \d.\d; got %s' % +if not re.match(r'\d\.\d', python_version): +raise ValueError(r'python_version must be \d.\d; got %s' % python_version) if arch not in ('x86', 'x64'): diff --git a/contrib/automation/hgautomation/aws.py b/contrib/automation/hgautomation/aws.py --- a/contrib/automation/hgautomation/aws.py +++ b/contrib/automation/hgautomation/aws.py @@ -118,7 +118,7 @@ # and configure WinRM. # Inspired by the User Data script used by Packer # (from https://www.packer.io/intro/getting-started/build-image.html). -WINDOWS_USER_DATA = ''' +WINDOWS_USER_DATA = r''' # TODO enable this once we figure out what is failing. To: indygreg, #hg-reviewers, pulkit Cc: mercurial-devel ___ Mercurial-devel mailing list Mercurial-devel@mercurial-scm.org https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel
D6203: tests: add optional output for Python 2.7 deprecation
This revision was automatically updated to reflect the committed changes. Closed by commit rHG65ed223619ec: tests: add optional output for Python 2.7 deprecation (authored by indygreg, committed by ). REPOSITORY rHG Mercurial CHANGES SINCE LAST UPDATE https://phab.mercurial-scm.org/D6203?vs=14662&id=14668 REVISION DETAIL https://phab.mercurial-scm.org/D6203 AFFECTED FILES tests/test-install.t CHANGE DETAILS diff --git a/tests/test-install.t b/tests/test-install.t --- a/tests/test-install.t +++ b/tests/test-install.t @@ -242,6 +242,7 @@ Note: we use this weird path to run pip and hg to avoid platform differences, since it's bin on most platforms but Scripts on Windows. $ ./installenv/*/pip install --no-index $TESTDIR/.. >> pip.log + DEPRECATION: Python 2.7 will reach the end of its life on January 1st, 2020. Please upgrade your Python as Python 2.7 won't be maintained after that date. A future version of pip will drop support for Python 2.7. (?) $ ./installenv/*/hg debuginstall || cat pip.log checking encoding (ascii)... checking Python executable (*) (glob) To: indygreg, #hg-reviewers, pulkit Cc: mercurial-devel ___ Mercurial-devel mailing list Mercurial-devel@mercurial-scm.org https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel
D6202: setup: use raw string for regular expression
This revision was automatically updated to reflect the committed changes. Closed by commit rHGfecbd93a5f08: setup: use raw string for regular expression (authored by indygreg, committed by ). REPOSITORY rHG Mercurial CHANGES SINCE LAST UPDATE https://phab.mercurial-scm.org/D6202?vs=14661&id=14667 REVISION DETAIL https://phab.mercurial-scm.org/D6202 AFFECTED FILES setup.py CHANGE DETAILS diff --git a/setup.py b/setup.py --- a/setup.py +++ b/setup.py @@ -796,7 +796,7 @@ # This logic is duplicated in doc/Makefile. sources = {f for f in os.listdir('mercurial/help') - if re.search('[0-9]\.txt$', f)} + if re.search(r'[0-9]\.txt$', f)} # common.txt is a one-off. gentxt('common') To: indygreg, #hg-reviewers, pulkit Cc: mercurial-devel ___ Mercurial-devel mailing list Mercurial-devel@mercurial-scm.org https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel
D6196: cext: make revlog.c PY_SSIZE_T_CLEAN
This revision was automatically updated to reflect the committed changes. Closed by commit rHGb01bbb8ff1f2: cext: make revlog.c PY_SSIZE_T_CLEAN (authored by indygreg, committed by ). REPOSITORY rHG Mercurial CHANGES SINCE LAST UPDATE https://phab.mercurial-scm.org/D6196?vs=14652&id=14669 REVISION DETAIL https://phab.mercurial-scm.org/D6196 AFFECTED FILES mercurial/cext/revlog.c CHANGE DETAILS diff --git a/mercurial/cext/revlog.c b/mercurial/cext/revlog.c --- a/mercurial/cext/revlog.c +++ b/mercurial/cext/revlog.c @@ -7,6 +7,7 @@ the GNU General Public License, incorporated herein by reference. */ +#define PY_SSIZE_T_CLEAN #include #include #include @@ -1947,7 +1948,7 @@ static PyObject *index_partialmatch(indexObject *self, PyObject *args) { const char *fullnode; - int nodelen; + Py_ssize_t nodelen; char *node; int rev, i; To: indygreg, #hg-reviewers, pulkit Cc: mercurial-devel ___ Mercurial-devel mailing list Mercurial-devel@mercurial-scm.org https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel
D6197: cext: make parsers.c PY_SSIZE_T_CLEAN
This revision was automatically updated to reflect the committed changes. Closed by commit rHG896b19d12c08: cext: make parsers.c PY_SSIZE_T_CLEAN (authored by indygreg, committed by ). REPOSITORY rHG Mercurial CHANGES SINCE LAST UPDATE https://phab.mercurial-scm.org/D6197?vs=14653&id=14670 REVISION DETAIL https://phab.mercurial-scm.org/D6197 AFFECTED FILES mercurial/cext/parsers.c CHANGE DETAILS diff --git a/mercurial/cext/parsers.c b/mercurial/cext/parsers.c --- a/mercurial/cext/parsers.c +++ b/mercurial/cext/parsers.c @@ -7,6 +7,7 @@ the GNU General Public License, incorporated herein by reference. */ +#define PY_SSIZE_T_CLEAN #include #include #include @@ -164,8 +165,9 @@ PyObject *fname = NULL, *cname = NULL, *entry = NULL; char state, *cur, *str, *cpos; int mode, size, mtime; - unsigned int flen, len, pos = 40; - int readlen; + unsigned int flen, pos = 40; + Py_ssize_t len = 40; + Py_ssize_t readlen; if (!PyArg_ParseTuple( args, PY23("O!O!s#:parse_dirstate", "O!O!y#:parse_dirstate"), @@ -585,8 +587,7 @@ static PyObject *fm1readmarkers(PyObject *self, PyObject *args) { const char *data, *dataend; - int datalen; - Py_ssize_t offset, stop; + Py_ssize_t datalen, offset, stop; PyObject *markers = NULL; if (!PyArg_ParseTuple(args, PY23("s#nn", "y#nn"), &data, &datalen, To: indygreg, #hg-reviewers, pulkit Cc: mercurial-devel ___ Mercurial-devel mailing list Mercurial-devel@mercurial-scm.org https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel
D6198: cext: make osutil.c PY_SSIZE_T_CLEAN
This revision was automatically updated to reflect the committed changes. Closed by commit rHG668eff08387f: cext: make osutil.c PY_SSIZE_T_CLEAN (authored by indygreg, committed by ). REPOSITORY rHG Mercurial CHANGES SINCE LAST UPDATE https://phab.mercurial-scm.org/D6198?vs=14654&id=14671 REVISION DETAIL https://phab.mercurial-scm.org/D6198 AFFECTED FILES mercurial/cext/osutil.c CHANGE DETAILS diff --git a/mercurial/cext/osutil.c b/mercurial/cext/osutil.c --- a/mercurial/cext/osutil.c +++ b/mercurial/cext/osutil.c @@ -8,6 +8,7 @@ */ #define _ATFILE_SOURCE +#define PY_SSIZE_T_CLEAN #include #include #include @@ -227,7 +228,7 @@ kind, py_st); } -static PyObject *_listdir(char *path, int plen, int wantstat, char *skip) +static PyObject *_listdir(char *path, Py_ssize_t plen, int wantstat, char *skip) { PyObject *rval = NULL; /* initialize - return value */ PyObject *list; @@ -1181,7 +1182,8 @@ PyObject *statobj = NULL; /* initialize - optional arg */ PyObject *skipobj = NULL; /* initialize - optional arg */ char *path, *skip = NULL; - int wantstat, plen; + Py_ssize_t plen; + int wantstat; static char *kwlist[] = {"path", "stat", "skip", NULL}; To: indygreg, #hg-reviewers, pulkit Cc: mercurial-devel ___ Mercurial-devel mailing list Mercurial-devel@mercurial-scm.org https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel
D6199: zstandard: vendor python-zstandard 0.11
This revision was automatically updated to reflect the committed changes. Closed by commit rHG675775c33ab6: zstandard: vendor python-zstandard 0.11 (authored by indygreg, committed by ). REPOSITORY rHG Mercurial CHANGES SINCE LAST UPDATE https://phab.mercurial-scm.org/D6199?vs=14658&id=14672 REVISION DETAIL https://phab.mercurial-scm.org/D6199 AFFECTED FILES contrib/clang-format-ignorelist contrib/python-zstandard/MANIFEST.in contrib/python-zstandard/NEWS.rst contrib/python-zstandard/README.rst contrib/python-zstandard/c-ext/compressionchunker.c contrib/python-zstandard/c-ext/compressiondict.c contrib/python-zstandard/c-ext/compressionparams.c contrib/python-zstandard/c-ext/compressionreader.c contrib/python-zstandard/c-ext/compressionwriter.c contrib/python-zstandard/c-ext/compressobj.c contrib/python-zstandard/c-ext/compressor.c contrib/python-zstandard/c-ext/compressoriterator.c contrib/python-zstandard/c-ext/constants.c contrib/python-zstandard/c-ext/decompressionreader.c contrib/python-zstandard/c-ext/decompressionwriter.c contrib/python-zstandard/c-ext/decompressobj.c contrib/python-zstandard/c-ext/decompressor.c contrib/python-zstandard/c-ext/decompressoriterator.c contrib/python-zstandard/c-ext/python-zstandard.h contrib/python-zstandard/make_cffi.py contrib/python-zstandard/setup.py contrib/python-zstandard/setup_zstd.py contrib/python-zstandard/tests/common.py contrib/python-zstandard/tests/test_buffer_util.py contrib/python-zstandard/tests/test_compressor.py contrib/python-zstandard/tests/test_compressor_fuzzing.py contrib/python-zstandard/tests/test_data_structures.py contrib/python-zstandard/tests/test_data_structures_fuzzing.py contrib/python-zstandard/tests/test_decompressor.py contrib/python-zstandard/tests/test_decompressor_fuzzing.py contrib/python-zstandard/tests/test_module_attributes.py contrib/python-zstandard/zstandard/__init__.py contrib/python-zstandard/zstandard/cffi.py contrib/python-zstandard/zstd.c contrib/python-zstandard/zstd/common/bitstream.h contrib/python-zstandard/zstd/common/compiler.h contrib/python-zstandard/zstd/common/cpu.h contrib/python-zstandard/zstd/common/debug.h contrib/python-zstandard/zstd/common/error_private.c contrib/python-zstandard/zstd/common/fse.h contrib/python-zstandard/zstd/common/huf.h contrib/python-zstandard/zstd/common/mem.h contrib/python-zstandard/zstd/common/pool.c contrib/python-zstandard/zstd/common/zstd_common.c contrib/python-zstandard/zstd/common/zstd_errors.h contrib/python-zstandard/zstd/common/zstd_internal.h contrib/python-zstandard/zstd/compress/fse_compress.c contrib/python-zstandard/zstd/compress/hist.c contrib/python-zstandard/zstd/compress/hist.h contrib/python-zstandard/zstd/compress/huf_compress.c contrib/python-zstandard/zstd/compress/zstd_compress.c contrib/python-zstandard/zstd/compress/zstd_compress_internal.h contrib/python-zstandard/zstd/compress/zstd_double_fast.c contrib/python-zstandard/zstd/compress/zstd_fast.c contrib/python-zstandard/zstd/compress/zstd_lazy.c contrib/python-zstandard/zstd/compress/zstd_ldm.c contrib/python-zstandard/zstd/compress/zstd_ldm.h contrib/python-zstandard/zstd/compress/zstd_opt.c contrib/python-zstandard/zstd/compress/zstd_opt.h contrib/python-zstandard/zstd/compress/zstdmt_compress.c contrib/python-zstandard/zstd/compress/zstdmt_compress.h contrib/python-zstandard/zstd/decompress/huf_decompress.c contrib/python-zstandard/zstd/decompress/zstd_ddict.c contrib/python-zstandard/zstd/decompress/zstd_ddict.h contrib/python-zstandard/zstd/decompress/zstd_decompress.c contrib/python-zstandard/zstd/decompress/zstd_decompress_block.c contrib/python-zstandard/zstd/decompress/zstd_decompress_block.h contrib/python-zstandard/zstd/decompress/zstd_decompress_internal.h contrib/python-zstandard/zstd/dictBuilder/cover.c contrib/python-zstandard/zstd/dictBuilder/fastcover.c contrib/python-zstandard/zstd/dictBuilder/zdict.c contrib/python-zstandard/zstd/zstd.h contrib/python-zstandard/zstd_cffi.py tests/test-check-py3-compat.t tests/test-http-api-httpv2.t tests/test-http-protocol.t To: indygreg, #hg-reviewers, pulkit Cc: mjpieters, mercurial-devel ___ Mercurial-devel mailing list Mercurial-devel@mercurial-scm.org https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel
D6200: perf: make perf.run-limits code work with Python 3
This revision was automatically updated to reflect the committed changes. Closed by commit rHG912d82daeda3: perf: make perf.run-limits code work with Python 3 (authored by indygreg, committed by ). REPOSITORY rHG Mercurial CHANGES SINCE LAST UPDATE https://phab.mercurial-scm.org/D6200?vs=14659&id=14665 REVISION DETAIL https://phab.mercurial-scm.org/D6200 AFFECTED FILES contrib/perf.py tests/test-contrib-perf.t CHANGE DETAILS diff --git a/tests/test-contrib-perf.t b/tests/test-contrib-perf.t --- a/tests/test-contrib-perf.t +++ b/tests/test-contrib-perf.t @@ -260,7 +260,8 @@ malformatted run limit entry, missing "-": 500 ! wall * comb * user * sys * (best of 5) (glob) $ hg perfparents --config perf.stub=no --config perf.run-limits='aaa-12, 0.1-5' - malformatted run limit entry, could not convert string to float: aaa: aaa-12 + malformatted run limit entry, could not convert string to float: aaa: aaa-12 (no-py3 !) + malformatted run limit entry, could not convert string to float: 'aaa': aaa-12 (py3 !) ! wall * comb * user * sys * (best of 5) (glob) $ hg perfparents --config perf.stub=no --config perf.run-limits='12-aa, 0.1-5' malformatted run limit entry, invalid literal for int() with base 10: 'aa': 12-aa diff --git a/contrib/perf.py b/contrib/perf.py --- a/contrib/perf.py +++ b/contrib/perf.py @@ -316,22 +316,22 @@ limitspec = ui.configlist(b"perf", b"run-limits", []) limits = [] for item in limitspec: -parts = item.split('-', 1) +parts = item.split(b'-', 1) if len(parts) < 2: -ui.warn(('malformatted run limit entry, missing "-": %s\n' +ui.warn((b'malformatted run limit entry, missing "-": %s\n' % item)) continue try: -time_limit = float(parts[0]) +time_limit = float(pycompat.sysstr(parts[0])) except ValueError as e: -ui.warn(('malformatted run limit entry, %s: %s\n' - % (e, item))) +ui.warn((b'malformatted run limit entry, %s: %s\n' + % (pycompat.bytestr(e), item))) continue try: -run_limit = int(parts[1]) +run_limit = int(pycompat.sysstr(parts[1])) except ValueError as e: -ui.warn(('malformatted run limit entry, %s: %s\n' - % (e, item))) +ui.warn((b'malformatted run limit entry, %s: %s\n' + % (pycompat.bytestr(e), item))) continue limits.append((time_limit, run_limit)) if not limits: To: indygreg, #hg-reviewers, pulkit Cc: mjpieters, mercurial-devel ___ Mercurial-devel mailing list Mercurial-devel@mercurial-scm.org https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel
D6183: copies: add config option for writing copy metadata to file and/or changset
martinvonz added a comment. In https://phab.mercurial-scm.org/D6183#90300, @marmoute wrote: > I am quite enthousiastic for a non-filelog based copy tracing using commit level information. However, I am very unenthousiastic at the idea of storing more copy data in the changeset itself. The "files" field in the changelog is already quite problematic (about 95% for changelog.d file, taking possibily hundred of megabytes). It seems like it should save a similar amount of data from the filelog, so what's your concern? That things that need to scan the changelog will need to read more data from disk? Most commits don't have copy information, so I'm not too worried about this. Feel free to experiment on a large repo and insert copy information in changesets there and see how much larger changelog.d becomes. (I was planning to do that later for performance testing.) > In addition, stoing copy in the changeset is kind of a "schema breakage" making its adoption slower. > > Instead I would advertise for keeping the copy data inside the filelog, using a changeset centric cache summing up the information. The entries from this changeset centric cache can be exchanged over the wire alongside their associated changesets, solving your remote-filelog usecase. That sounds more complicated for unclear benefit. REPOSITORY rHG Mercurial REVISION DETAIL https://phab.mercurial-scm.org/D6183 To: martinvonz, #hg-reviewers Cc: marmoute, mercurial-devel ___ Mercurial-devel mailing list Mercurial-devel@mercurial-scm.org https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel
D6204: branchmap: dynamically resolve type of branchcache class
pulkit created this revision. Herald added a subscriber: mercurial-devel. Herald added a reviewer: hg-reviewers. REVISION SUMMARY This is required to support subclassing. Thanks to Yuya for suggesting this in https://phab.mercurial-scm.org/D6151. REPOSITORY rHG Mercurial REVISION DETAIL https://phab.mercurial-scm.org/D6204 AFFECTED FILES mercurial/branchmap.py CHANGE DETAILS diff --git a/mercurial/branchmap.py b/mercurial/branchmap.py --- a/mercurial/branchmap.py +++ b/mercurial/branchmap.py @@ -305,7 +305,7 @@ def copy(self): """return an deep copy of the branchcache object""" -return branchcache( +return type(self)( self._entries, self.tipnode, self.tiprev, self.filteredhash, self._closednodes) To: pulkit, #hg-reviewers Cc: mercurial-devel ___ Mercurial-devel mailing list Mercurial-devel@mercurial-scm.org https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel
D6205: branchmap: prevent using __getitem__() in branchheads()
pulkit created this revision. Herald added a subscriber: mercurial-devel. Herald added a reviewer: hg-reviewers. REVISION SUMMARY branchheads() can directly use self._entries instead. REPOSITORY rHG Mercurial REVISION DETAIL https://phab.mercurial-scm.org/D6205 AFFECTED FILES mercurial/branchmap.py CHANGE DETAILS diff --git a/mercurial/branchmap.py b/mercurial/branchmap.py --- a/mercurial/branchmap.py +++ b/mercurial/branchmap.py @@ -290,7 +290,7 @@ return (n for n in nodes if n not in self._closednodes) def branchheads(self, branch, closed=False): -heads = self[branch] +heads = self._entries[branch] if not closed: heads = list(self.iteropen(heads)) return heads To: pulkit, #hg-reviewers Cc: mercurial-devel ___ Mercurial-devel mailing list Mercurial-devel@mercurial-scm.org https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel
D6206: branchmap: implement __contains__()
pulkit created this revision. Herald added a subscriber: mercurial-devel. Herald added a reviewer: hg-reviewers. REVISION SUMMARY We have good occurences of `if branch in branchmap()` in our code. If __contains__() is not implemented then it will use __iter__() to find whether the element exists or not which is not good. I am bit confused that whether I should move existing callers to hasbranch() or this patch is a good way. REPOSITORY rHG Mercurial REVISION DETAIL https://phab.mercurial-scm.org/D6206 AFFECTED FILES mercurial/branchmap.py CHANGE DETAILS diff --git a/mercurial/branchmap.py b/mercurial/branchmap.py --- a/mercurial/branchmap.py +++ b/mercurial/branchmap.py @@ -182,6 +182,9 @@ def __getitem__(self, key): return self._entries[key] +def __contains__(self, key): +return key in self._entries + def iteritems(self): return self._entries.iteritems() To: pulkit, #hg-reviewers Cc: mercurial-devel ___ Mercurial-devel mailing list Mercurial-devel@mercurial-scm.org https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel
D6207: branchcache: add functions to validate changelog nodes
pulkit created this revision. Herald added a subscriber: mercurial-devel. Herald added a reviewer: hg-reviewers. REVISION SUMMARY This patch adds functions to validate closed nodes, validate nodes for a certain branch and for all the branches. These functions will be used in upcoming patches. REPOSITORY rHG Mercurial REVISION DETAIL https://phab.mercurial-scm.org/D6207 AFFECTED FILES mercurial/branchmap.py CHANGE DETAILS diff --git a/mercurial/branchmap.py b/mercurial/branchmap.py --- a/mercurial/branchmap.py +++ b/mercurial/branchmap.py @@ -126,6 +126,10 @@ def clear(self): self._per_filter.clear() +def _unknownnode(node): +""" raises ValueError when branchcache found a node which does not exists +""" +raise ValueError(r'node %s does not exist' % pycompat.sysstr(hex(node))) class branchcache(object): """A dict like object that hold branches heads cache. @@ -173,6 +177,32 @@ if self._hasnode is None: self._hasnode = lambda x: True +def _verifyclosed(self): +""" verify the closed nodes we have """ +if self._closedverified: +return +for node in self._closednodes: +if not self._hasnode(node): +_unknownnode(node) + +self._closedverified = True + +def _verifybranch(self, branch): +""" verify head nodes for the given branch. If branch is None, verify +for all the branches """ +if branch not in self._entries or branch in self._verifiedbranches: +return +for n in self._entries[branch]: +if not self._hasnode(n): +_unknownnode(n) + +self._verifiedbranches.add(branch) + +def _verifyall(self): +""" verifies nodes of all the branches """ +for b in self._entries: +self._verifybranch(b) + def __iter__(self): return iter(self._entries) To: pulkit, #hg-reviewers Cc: mercurial-devel ___ Mercurial-devel mailing list Mercurial-devel@mercurial-scm.org https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel
D6208: [RFC] branchmap: lazily validate nodes from the branchmap
pulkit created this revision. Herald added a subscriber: mercurial-devel. Herald added a reviewer: hg-reviewers. REVISION SUMMARY On my personal hg-repository with 365 entries in .hg/cache/branch2, following are the numbers for perfbranchmapload. Before this patch: ! wall 0.000866 comb 0.00 user 0.00 sys 0.00 (best of 2680) ! wall 0.001525 comb 0.00 user 0.00 sys 0.00 (max of 2680) ! wall 0.001107 comb 0.001097 user 0.001086 sys 0.11 (avg of 2680) ! wall 0.001104 comb 0.00 user 0.00 sys 0.00 (median of 2680) With this patch: ! wall 0.000530 comb 0.00 user 0.00 sys 0.00 (best of 4240) ! wall 0.001078 comb 0.00 user 0.00 sys 0.00 (max of 4240) ! wall 0.000696 comb 0.000693 user 0.000677 sys 0.17 (avg of 4240) ! wall 0.000690 comb 0.00 user 0.00 sys 0.00 (median of 4240) On our internal repository with ~20k entries in branchcache, I see improvement from 0.125 sec to 0.066 sec which is 47% speed up. The above are the numbers of perfbranchmapload which shows how much time we saved by not validating the nodes. But we need to validate some nodes. Following are timings of some mercurial operations which have speed up because of this lazy validation of nodes: No-op `hg update` on our internal repository (Avg on 4 runs): Before: 0.540 secs After: 0.430 secs Setting a branch name which already exists without --force (Avg of 4 runs): Before: 0.510 secs After: 0.250 secs I ran the ASV performance suite and was unable to see any improvements except there was improvement of perfdirstatewrite() on netbeans which I think was not related. I looked into the commit code, the command which I am trying to speedup, it looks like it uses revbranchcache to update the branchcache. REPOSITORY rHG Mercurial REVISION DETAIL https://phab.mercurial-scm.org/D6208 AFFECTED FILES mercurial/branchmap.py CHANGE DETAILS diff --git a/mercurial/branchmap.py b/mercurial/branchmap.py --- a/mercurial/branchmap.py +++ b/mercurial/branchmap.py @@ -210,16 +210,20 @@ self._entries[key] = value def __getitem__(self, key): +self._verifybranch(key) return self._entries[key] def __contains__(self, key): +self._verifybranch(key) return key in self._entries def iteritems(self): +self._verifyall() return self._entries.iteritems() def hasbranch(self, label): """ checks whether a branch of this name exists or not """ +self._verifybranch(label) return label in self._entries @classmethod @@ -262,7 +266,6 @@ def load(self, repo, lineiter): """ fully loads the branchcache by reading from the file using the line iterator passed""" -cl = repo.changelog for line in lineiter: line = line.rstrip('\n') if not line: @@ -272,14 +275,9 @@ raise ValueError(r'invalid branch state') label = encoding.tolocal(label.strip()) node = bin(node) -if not cl.hasnode(node): -raise ValueError( -r'node %s does not exist' % pycompat.sysstr(hex(node))) self._entries.setdefault(label, []).append(node) -self._verifiedbranches.add(label) if state == 'c': self._closednodes.add(node) -self._closedverified = True @staticmethod def _filename(repo): @@ -306,6 +304,7 @@ otherwise return last closed head and true.''' tip = heads[-1] closed = True +self._verifyclosed() for h in reversed(heads): if h not in self._closednodes: tip = h @@ -320,9 +319,11 @@ return self._branchtip(self[branch])[0] def iteropen(self, nodes): +self._verifyclosed() return (n for n in nodes if n not in self._closednodes) def branchheads(self, branch, closed=False): +self._verifybranch(branch) heads = self._entries[branch] if not closed: heads = list(self.iteropen(heads)) @@ -334,10 +335,12 @@ def iterheads(self): """ returns all the heads """ +self._verifyall() return self._entries.itervalues() def copy(self): """return an deep copy of the branchcache object""" +self._verifyall() return type(self)( self._entries, self.tipnode, self.tiprev, self.filteredhash, self._closednodes) To: pulkit, #hg-reviewers Cc: mercurial-devel ___ Mercurial-devel mailing list Mercurial-devel@mercurial-scm.org https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel
D6209: branchcache: don't verify closed nodes in iteropen()
pulkit created this revision. Herald added a subscriber: mercurial-devel. Herald added a reviewer: hg-reviewers. REVISION SUMMARY We expect that the nodes passed to iteropen() will be verified. We are only testing for membership in closed nodes set, so we don't need to verify the whole closed nodes set. This will speed up calculating branchheads() when there are lot of closed nodes related to other branches. REPOSITORY rHG Mercurial REVISION DETAIL https://phab.mercurial-scm.org/D6209 AFFECTED FILES mercurial/branchmap.py CHANGE DETAILS diff --git a/mercurial/branchmap.py b/mercurial/branchmap.py --- a/mercurial/branchmap.py +++ b/mercurial/branchmap.py @@ -319,7 +319,6 @@ return self._branchtip(self[branch])[0] def iteropen(self, nodes): -self._verifyclosed() return (n for n in nodes if n not in self._closednodes) def branchheads(self, branch, closed=False): To: pulkit, #hg-reviewers Cc: mercurial-devel ___ Mercurial-devel mailing list Mercurial-devel@mercurial-scm.org https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel
D6210: branchcache: don't verify closed nodes in _branchtip()
pulkit created this revision. Herald added a subscriber: mercurial-devel. Herald added a reviewer: hg-reviewers. REVISION SUMMARY We only do membership testing there. REPOSITORY rHG Mercurial REVISION DETAIL https://phab.mercurial-scm.org/D6210 AFFECTED FILES mercurial/branchmap.py CHANGE DETAILS diff --git a/mercurial/branchmap.py b/mercurial/branchmap.py --- a/mercurial/branchmap.py +++ b/mercurial/branchmap.py @@ -304,7 +304,6 @@ otherwise return last closed head and true.''' tip = heads[-1] closed = True -self._verifyclosed() for h in reversed(heads): if h not in self._closednodes: tip = h To: pulkit, #hg-reviewers Cc: mercurial-devel ___ Mercurial-devel mailing list Mercurial-devel@mercurial-scm.org https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel
D6211: branch: return early if we find an open named branch apart from default
pulkit created this revision. Herald added a subscriber: mercurial-devel. Herald added a reviewer: hg-reviewers. REVISION SUMMARY The current code builds a list of all the open named branches except default and then bool that. This is mostly fine until you get a repo which has thousands of named branches. REPOSITORY rHG Mercurial REVISION DETAIL https://phab.mercurial-scm.org/D6211 AFFECTED FILES mercurial/commands.py CHANGE DETAILS diff --git a/mercurial/commands.py b/mercurial/commands.py --- a/mercurial/commands.py +++ b/mercurial/commands.py @@ -1125,11 +1125,11 @@ ui.status(_('marked working directory as branch %s\n') % label) # find any open named branches aside from default -others = [n for n, h, t, c in repo.branchmap().iterbranches() - if n != "default" and not c] -if not others: -ui.status(_('(branches are permanent and global, ' -'did you want a bookmark?)\n')) +for n, h, t, c in repo.branchmap().iterbranches(): +if n != "default" and not c: +return 0 +ui.status(_('(branches are permanent and global, ' +'did you want a bookmark?)\n')) @command('branches', [('a', 'active', False, To: pulkit, #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] chistedit: use default curses colours
On Thu, Apr 4, 2019 at 6:15 AM Jordi Gutiérrez Hermoso wrote: > # HG changeset patch > # User Jordi Gutiérrez Hermoso > # Date 1554347266 14400 > # Wed Apr 03 23:07:46 2019 -0400 > # Node ID 263cec9c08fc1b517847fe53f27b47978be127f4 > # Parent 4ee906aa7b60fb6b113e4dc187fbb5a8f42e557c > chistedit: use default curses colours > > Terminals will define default colours (for example, white text on > black background), but curses doesn't obey those default colours > unless told to do so. > > Calling `curses.use_default_colors` makes curses obey the default > terminal colours. One of the most obvious effects is that this allows > transparency on terminals that support it. > > This also brings chistedit closer in appearance to crecord, which also > uses default colours. > > diff --git a/hgext/histedit.py b/hgext/histedit.py > --- a/hgext/histedit.py > +++ b/hgext/histedit.py > @@ -1238,6 +1238,8 @@ def patchcontents(state): > return displayer.hunk[rule.ctx.rev()].splitlines() > > def _chisteditmain(repo, rules, stdscr): > +curses.use_default_colors() > This can raise curses.error. We need to catch that. Related: https://www.mercurial-scm.org/repo/hg-committed/rev/fb2e59e92651c33918987b9bbf84cedb37ac2557 ___ Mercurial-devel mailing list Mercurial-devel@mercurial-scm.org https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel
Re: [PATCH] chistedit: properly show verbose diffs
On Thu, Apr 4, 2019 at 5:50 PM Jordi Gutiérrez Hermoso wrote: > # HG changeset patch > # User Jordi Gutiérrez Hermoso > # Date 1554388915 14400 > # Thu Apr 04 10:41:55 2019 -0400 > # Node ID 704f79617827ab0c19a788715b797fcfe8557cea > # Parent 4ee906aa7b60fb6b113e4dc187fbb5a8f42e557c > chistedit: properly show verbose diffs > > I'm not sure if that ever worked and it's an internal API breakage, > but `"verbose": True` is not correctly parsed, as most of these > options are parsed by diffopts, whereas verbose is a global option. > > Setting the UI to verbose instead does work and does show a verbose > patch, with full commit message. > > It also shows all files, which unfortunately are a bit hard to read on > a single line in the default verbose template. Thus, we also change > the default template to use the status template, which shows one file > per line as well as its modification state. > Showing full commit message looks good addition. Queued this, many thanks! ___ Mercurial-devel mailing list Mercurial-devel@mercurial-scm.org https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel
D6178: crecord: new keys g & G to navigate to the top and bottom respectively
pulkit added a comment. Amending this diff to make test-check-code.t happy which complains about lines longer than 80. diff --git a/mercurial/crecord.py b/mercurial/crecord.py --- a/mercurial/crecord.py +++ b/mercurial/crecord.py @@ -1528,10 +1528,10 @@ the following are valid keystrokes: Handle 'G' to navigate to the bottom most file/hunk/line depending on the whether the fold is active or not. -If the bottom most file is folded, it navigates to that file and stops there. -If the bottom most file is unfolded, it navigates to the bottom most hunk in -that file and stops there. If the bottom most hunk is unfolded, it navigates to -the bottom most line in that hunk. +If the bottom most file is folded, it navigates to that file and +stops there. If the bottom most file is unfolded, it navigates to +the bottom most hunk in that file and stops there. If the bottom most +hunk is unfolded, it navigates to the bottom most line in that hunk. """ currentitem = self.currentselecteditem nextitem = currentitem.nextitem() REPOSITORY rHG Mercurial REVISION DETAIL https://phab.mercurial-scm.org/D6178 To: arun, #hg-reviewers, JordiGH, pulkit Cc: JordiGH, mercurial-devel ___ Mercurial-devel mailing list Mercurial-devel@mercurial-scm.org https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel
D6178: crecord: new keys g & G to navigate to the top and bottom respectively
This revision was automatically updated to reflect the committed changes. Closed by commit rHG80103ed2e8ee: crecord: new keys g & G to navigate to the top and bottom respectively (authored by carun, committed by ). CHANGED PRIOR TO COMMIT https://phab.mercurial-scm.org/D6178?vs=14623&id=14681#toc REPOSITORY rHG Mercurial CHANGES SINCE LAST UPDATE https://phab.mercurial-scm.org/D6178?vs=14623&id=14681 REVISION DETAIL https://phab.mercurial-scm.org/D6178 AFFECTED FILES mercurial/crecord.py CHANGE DETAILS diff --git a/mercurial/crecord.py b/mercurial/crecord.py --- a/mercurial/crecord.py +++ b/mercurial/crecord.py @@ -1467,6 +1467,8 @@ pgup/pgdn [K/J] : go to previous/next item of same type right/left-arrow [l/h] : go to child item / parent item shift-left-arrow [H] : go to parent header / fold selected header + g : go to the top + G : go to the bottom f : fold / unfold item, hiding/revealing its children F : fold / unfold parent item and all of its ancestors ctrl-l : scroll the selected line to the top of the screen @@ -1505,6 +1507,45 @@ self.stdscr.refresh() self.stdscr.keypad(1) # allow arrow-keys to continue to function +def handlefirstlineevent(self): +""" +Handle 'g' to navigate to the top most file in the ncurses window. +""" +self.currentselecteditem = self.headerlist[0] +currentitem = self.currentselecteditem +# select the parent item recursively until we're at a header +while True: +nextitem = currentitem.parentitem() +if nextitem is None: +break +else: +currentitem = nextitem + +self.currentselecteditem = currentitem + +def handlelastlineevent(self): +""" +Handle 'G' to navigate to the bottom most file/hunk/line depending +on the whether the fold is active or not. + +If the bottom most file is folded, it navigates to that file and +stops there. If the bottom most file is unfolded, it navigates to +the bottom most hunk in that file and stops there. If the bottom most +hunk is unfolded, it navigates to the bottom most line in that hunk. +""" +currentitem = self.currentselecteditem +nextitem = currentitem.nextitem() +# select the child item recursively until we're at a footer +while nextitem is not None: +nextitem = currentitem.nextitem() +if nextitem is None: +break +else: +currentitem = nextitem + +self.currentselecteditem = currentitem +self.recenterdisplayedarea() + def confirmationwindow(self, windowtext): "display an informational window, then wait for and return a keypress." @@ -1725,6 +1766,10 @@ self.togglefolded(foldparent=True) elif keypressed in ["m"]: self.commitMessageWindow() +elif keypressed in ["g", "KEY_HOME"]: +self.handlefirstlineevent() +elif keypressed in ["G", "KEY_END"]: +self.handlelastlineevent() elif keypressed in ["?"]: self.helpwindow() self.stdscr.clear() To: arun, #hg-reviewers, JordiGH, pulkit Cc: JordiGH, mercurial-devel ___ Mercurial-devel mailing list Mercurial-devel@mercurial-scm.org https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel
D6188: test/test-revset2.t: Unset environment variable P
jerry.montfort abandoned this revision. jerry.montfort added a comment. Thanks @pulkit! Abandoning revision as you suggested. REPOSITORY rHG Mercurial REVISION DETAIL https://phab.mercurial-scm.org/D6188 To: jerry.montfort, #hg-reviewers Cc: pulkit, mercurial-devel ___ Mercurial-devel mailing list Mercurial-devel@mercurial-scm.org https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel
Re: [PATCH] setup: fix a possible NameError on rust build
queued, thanks > On Apr 4, 2019, at 10:24, Georges Racinet wrote: > > > On 4/4/19 3:43 PM, Philippe Pepiot wrote: >> # HG changeset patch >> # User Philippe Pepiot >> # Date 1554385248 -7200 >> # Thu Apr 04 15:40:48 2019 +0200 >> # Node ID f7c8453060138de8ab1f56b760d84157d3f0a064 >> # Parent 4ee906aa7b60fb6b113e4dc187fbb5a8f42e557c >> setup: fix a possible NameError on rust build >> >> File "setup.py", line 975, in rustbuild >>"command: %r, environment: %r" % (self.rustsrcdir, cmd, env)) >> NameError: global name 'cmd' is not defined >> >> diff --git a/setup.py b/setup.py >> --- a/setup.py >> +++ b/setup.py >> @@ -1084,7 +1084,7 @@ class RustExtension(Extension): >> except subprocess.CalledProcessError: >> raise RustCompilationError( >> "Cargo failed. Working directory: %r, " >> -"command: %r, environment: %r" % (self.rustsrcdir, cmd, >> env)) >> +"command: %r, environment: %r" % (self.rustsrcdir, >> cargocmd, env)) > > Ah yes, indeed that seems right, thanks. > > As a side note, I can't get pyflakes (flake8) not pylint to catch this, > even if running explicitely on setup.py; this is a bit puzzling. > > -- > Georges Racinet > https://octobus.net > GPG: BF5456F4DC625443849B6E58EE20CA44EF691D39, sur serveurs publics > > > ___ > 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
D6212: tests: add test of for hash reference translation by `hg convert`
martinvonz created this revision. Herald added a subscriber: mercurial-devel. Herald added a reviewer: hg-reviewers. REVISION SUMMARY The convert extension translates commit references in the commit message. We didn't have any explicit testing of this before, so let's add a test. REPOSITORY rHG Mercurial REVISION DETAIL https://phab.mercurial-scm.org/D6212 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 @@ -206,3 +206,22 @@ a c d + $ cd .. + + $ hg init commit-references + $ cd commit-references +Create a commit we'll drop while converting so we get different hashes + $ echo a > unwanted + $ hg ci -Aqm 'unwanted' + $ echo a > a + $ hg ci -Aqm initial + $ echo b > b + $ hg ci -Aqm 'the previous commit was 3ccbd4cbba95' + + $ cd .. + $ hg convert commit-references new-commit-references -q \ + > --config convert.hg.startrev=1 + $ cd new-commit-references + $ hg log -T '{node|short} {desc}\n' + 38a97fe212e7 the previous commit was 3cf70f7c1f3b + 3cf70f7c1f3b initial To: martinvonz, #hg-reviewers Cc: mercurial-devel ___ Mercurial-devel mailing list Mercurial-devel@mercurial-scm.org https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel
D6213: tests: demonstrate broken `hg convert` if "ffffffffffff" is in description
martinvonz 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/D6213 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 @@ -217,10 +217,14 @@ $ hg ci -Aqm initial $ echo b > b $ hg ci -Aqm 'the previous commit was 3ccbd4cbba95' + $ echo c > c + $ hg ci -Aqm 'the working copy is called ' $ cd .. +BROKEN: crashes when the "" is encountered $ hg convert commit-references new-commit-references -q \ - > --config convert.hg.startrev=1 + > --config convert.hg.startrev=1 2>&1 | grep TypeError + TypeError: b2a_hex() argument 1 must be string or buffer, not None $ cd new-commit-references $ hg log -T '{node|short} {desc}\n' 38a97fe212e7 the previous commit was 3cf70f7c1f3b To: martinvonz, #hg-reviewers Cc: mercurial-devel ___ Mercurial-devel mailing list Mercurial-devel@mercurial-scm.org https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel
D6214: tests: demonstrate broken pull of "ffffffffffff" revision
martinvonz 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/D6214 AFFECTED FILES tests/test-pull.t CHANGE DETAILS diff --git a/tests/test-pull.t b/tests/test-pull.t --- a/tests/test-pull.t +++ b/tests/test-pull.t @@ -75,6 +75,13 @@ abort: unknown revision 'xx y'! [255] +Test pull of working copy revision +BROKEN: should give a better error message + $ hg pull -r '' + pulling from http://foo@localhost:$HGPORT/ + abort: b2a_hex() argument 1 must be string or buffer, not None! + [255] + Issue622: hg init && hg pull -u URL doesn't checkout default branch $ cd .. To: martinvonz, #hg-reviewers Cc: mercurial-devel ___ Mercurial-devel mailing list Mercurial-devel@mercurial-scm.org https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel
D6215: localrepo: don't allow lookup of working directory revision
martinvonz created this revision. Herald added a subscriber: mercurial-devel. Herald added a reviewer: hg-reviewers. REVISION SUMMARY It seems that repo.lookup(), which is what supports the "lookup" wire protocol command, should not allow the working copy revision input. This fixes both the pull test and the convert test I just added. REPOSITORY rHG Mercurial REVISION DETAIL https://phab.mercurial-scm.org/D6215 AFFECTED FILES mercurial/localrepo.py tests/test-convert-hg-source.t tests/test-pull.t CHANGE DETAILS diff --git a/tests/test-pull.t b/tests/test-pull.t --- a/tests/test-pull.t +++ b/tests/test-pull.t @@ -76,10 +76,9 @@ [255] Test pull of working copy revision -BROKEN: should give a better error message $ hg pull -r '' pulling from http://foo@localhost:$HGPORT/ - abort: b2a_hex() argument 1 must be string or buffer, not None! + abort: unknown revision ''! [255] Issue622: hg init && hg pull -u URL doesn't checkout default branch 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 @@ -221,11 +221,10 @@ $ hg ci -Aqm 'the working copy is called ' $ cd .. -BROKEN: crashes when the "" is encountered $ hg convert commit-references new-commit-references -q \ - > --config convert.hg.startrev=1 2>&1 | grep TypeError - TypeError: b2a_hex() argument 1 must be string or buffer, not None + > --config convert.hg.startrev=1 2>&1 $ cd new-commit-references $ hg log -T '{node|short} {desc}\n' + 0becf8e61603 the working copy is called 38a97fe212e7 the previous commit was 3cf70f7c1f3b 3cf70f7c1f3b initial diff --git a/mercurial/localrepo.py b/mercurial/localrepo.py --- a/mercurial/localrepo.py +++ b/mercurial/localrepo.py @@ -1564,7 +1564,10 @@ pass def lookup(self, key): -return scmutil.revsymbol(self, key).node() +node = scmutil.revsymbol(self, key).node() +if node is None: +raise error.RepoLookupError(_("unknown revision '%s'") % key) +return node def lookupbranch(self, key): if self.branchmap().hasbranch(key): To: martinvonz, #hg-reviewers Cc: mercurial-devel ___ Mercurial-devel mailing list Mercurial-devel@mercurial-scm.org https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel
D6212: tests: add test of for hash reference translation by `hg convert`
martinvonz added a comment. I created this stack on the default branch, but it's probably small enough to be put on stable. REPOSITORY rHG Mercurial REVISION DETAIL https://phab.mercurial-scm.org/D6212 To: martinvonz, #hg-reviewers Cc: mercurial-devel ___ Mercurial-devel mailing list Mercurial-devel@mercurial-scm.org https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel
[PATCH 3 of 3] revset: two new revsets, copies and renames
# HG changeset patch # User Jordi Gutiérrez Hermoso # Date 1554489566 14400 # Fri Apr 05 14:39:26 2019 -0400 # Node ID cf6a3da4082569df7b5dd83ab61fcbedc70839f1 # Parent 4baa10f1f44a8e427f49fa4f4d8d29552c2a1a65 revset: two new revsets, copies and renames diff --git a/mercurial/revset.py b/mercurial/revset.py --- a/mercurial/revset.py +++ b/mercurial/revset.py @@ -757,6 +757,21 @@ def converted(repo, subset, x): return subset.filter(lambda r: _matchvalue(r), condrepr=('', rev)) +@predicate('copies(pattern)', safe=True, weight=30) +def copies(repo, subset, x): +"""Changesets which added files matching pattern via copying. This +excludes renames, which are copies where the original file was +removed. + +The pattern without explicit kind like ``glob:`` is expected to be +relative to the current directory and match against a file or a +directory. + +""" +# i18n: "removes" is a keyword +pat = getstring(x, _("copies requires a pattern")) +return checkstatus(repo, subset, pat, 3) + @predicate('date(interval)', safe=True, weight=10) def date(repo, subset, x): """Changesets within the interval, see :hg:`help dates`. @@ -1802,6 +1817,18 @@ def public(repo, subset, x): getargs(x, 0, 0, _("public takes no arguments")) return _phase(repo, subset, phases.public) +@predicate('renames(pattern)', safe=True, weight=30) +def renames(repo, subset, x): +"""Changesets which added files matching pattern via a rename. + +The pattern without explicit kind like ``glob:`` is expected to be +relative to the current directory and match against a file or a +directory. +""" +# i18n: "removes" is a keyword +pat = getstring(x, _("renames requires a pattern")) +return checkstatus(repo, subset, pat, 4) + @predicate('remote([id [,path]])', safe=False) def remote(repo, subset, x): """Local revision that corresponds to the given identifier in a diff --git a/tests/test-revset.t b/tests/test-revset.t --- a/tests/test-revset.t +++ b/tests/test-revset.t @@ -3038,3 +3038,15 @@ abort if the revset doesn't expect given $ log 'expectsize(0:2, :2)' abort: revset size mismatch. expected between 0 and 2, got 3! [255] + +test copies and renames + + $ hg cp b c + $ hg ci -m copy + $ hg mv c d + $ hg ci -m rename + $ hg log -r 'copies("**")' -T '{rev}:{desc}\n' + 10:copy + $ hg log -r 'renames("**")' -T '{rev}:{desc}\n' + 11:rename + ___ Mercurial-devel mailing list Mercurial-devel@mercurial-scm.org https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel
[PATCH 2 of 3] revset: implement copies and renames for checkstatus
# HG changeset patch # User Jordi Gutiérrez Hermoso # Date 1554489104 14400 # Fri Apr 05 14:31:44 2019 -0400 # Node ID 4baa10f1f44a8e427f49fa4f4d8d29552c2a1a65 # Parent 9fcb915a73b83547921aaa13584c88cb99c6aee7 revset: implement copies and renames for checkstatus Determining when a file is a copy is tricky and isn't handled by the normal status functions, so thankfully we can offload that work to the copies module, just like the status command itself does. diff --git a/mercurial/revset.py b/mercurial/revset.py --- a/mercurial/revset.py +++ b/mercurial/revset.py @@ -11,6 +11,7 @@ import re from .i18n import _ from . import ( +copies as copiesmod, dagop, destutil, diffutil, @@ -603,6 +604,8 @@ def checkstatus(repo, subset, pat, field 0: modified 1: added 2: removed +3: copied (not renamed, i.e. source not removed) +4: renamed (not copied, i..e source removed) """ hasset = matchmod.patkind(pat) == 'set' @@ -624,7 +627,18 @@ def checkstatus(repo, subset, pat, field break else: return False -files = repo.status(c.p1().node(), c.node())[field] +p1 = c.p1() +status = repo.status(p1.node(), c.node()) +if field == 3: +copymap = copiesmod.pathcopies(p1, c, m) +removed = status[2] +files = [dest for (dest, src) in copymap.items() if src not in removed] +elif field == 4: +copymap = copiesmod.pathcopies(p1, c, m) +removed = status[2] +files = [dest for (dest, src) in copymap.items() if src in removed] +else: +files = status[field] if fname is not None: if fname in files: return True ___ Mercurial-devel mailing list Mercurial-devel@mercurial-scm.org https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel
[PATCH 1 of 3] revset: short docstring for checkstatus
# HG changeset patch # User Jordi Gutiérrez Hermoso # Date 1554489052 14400 # Fri Apr 05 14:30:52 2019 -0400 # Node ID 9fcb915a73b83547921aaa13584c88cb99c6aee7 # Parent a975821d0938615b8cb235f12cc6461a42dcfbd8 revset: short docstring for checkstatus This is where all the action happens for the status-related revsets, and a little documentation doesn't hurt. diff --git a/mercurial/revset.py b/mercurial/revset.py --- a/mercurial/revset.py +++ b/mercurial/revset.py @@ -598,6 +598,12 @@ def bundle(repo, subset, x): return subset & bundlerevs def checkstatus(repo, subset, pat, field): +"""Helper for status-related revsets (adds, removes, modifies, +renames, copies). The field parameter says which kind is desired: +0: modified +1: added +2: removed +""" hasset = matchmod.patkind(pat) == 'set' mcache = [None] ___ Mercurial-devel mailing list Mercurial-devel@mercurial-scm.org https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel
[PATCH 1 of 2 V2] chistedit: use default curses colours
# HG changeset patch # User Jordi Gutiérrez Hermoso # Date 1554490485 14400 # Fri Apr 05 14:54:45 2019 -0400 # Node ID ede500c898adaab1d78f5e048fe84774c9f01fea # Parent a975821d0938615b8cb235f12cc6461a42dcfbd8 chistedit: use default curses colours Terminals will define default colours (for example, white text on black background), but curses doesn't obey those default colours unless told to do so. Calling `curses.use_default_colors` makes curses obey the default terminal colours. One of the most obvious effects is that this allows transparency on terminals that support it. This also brings chistedit closer in appearance to crecord, which also uses default colours. The call may error out if the terminal doesn't support colors, but as far as I can tell, everything still works. If we need a more careful handling of lack of colours, blame me for not doing it now. diff --git a/hgext/histedit.py b/hgext/histedit.py --- a/hgext/histedit.py +++ b/hgext/histedit.py @@ -1238,6 +1238,11 @@ def patchcontents(state): return displayer.hunk[rule.ctx.rev()].splitlines() def _chisteditmain(repo, rules, stdscr): +try: +curses.use_default_colors() +except curses.error: +pass + # initialize color pattern curses.init_pair(COLOR_HELP, curses.COLOR_WHITE, curses.COLOR_BLUE) curses.init_pair(COLOR_SELECTED, curses.COLOR_BLACK, curses.COLOR_WHITE) ___ Mercurial-devel mailing list Mercurial-devel@mercurial-scm.org https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel
[PATCH 2 of 2 V2] chistedit: add basic colours to diff view
# HG changeset patch # User Jordi Gutiérrez Hermoso # Date 1554350103 14400 # Wed Apr 03 23:55:03 2019 -0400 # Node ID 93b81d9461e703176801fc425d9e9f75275abc02 # Parent ede500c898adaab1d78f5e048fe84774c9f01fea chistedit: add basic colours to diff view This isn't complete, and it would be nice to show the exact same colours that `hg diff` would show. That goal is too lofty, so this just shows some basic colours, on the premise that a little is better than nothing. diff --git a/hgext/histedit.py b/hgext/histedit.py --- a/hgext/histedit.py +++ b/hgext/histedit.py @@ -963,6 +963,7 @@ ACTION_LABELS = { } COLOR_HELP, COLOR_SELECTED, COLOR_OK, COLOR_WARN, COLOR_CURRENT = 1, 2, 3, 4, 5 +COLOR_DIFF_ADD_LINE, COLOR_DIFF_DEL_LINE, COLOR_DIFF_OFFSET = 6, 7, 8 E_QUIT, E_HISTEDIT = 1, 2 E_PAGEDOWN, E_PAGEUP, E_LINEUP, E_LINEDOWN, E_RESIZE = 3, 4, 5, 6, 7 @@ -1249,6 +1250,9 @@ def _chisteditmain(repo, rules, stdscr): curses.init_pair(COLOR_WARN, curses.COLOR_BLACK, curses.COLOR_YELLOW) curses.init_pair(COLOR_OK, curses.COLOR_BLACK, curses.COLOR_GREEN) curses.init_pair(COLOR_CURRENT, curses.COLOR_WHITE, curses.COLOR_MAGENTA) +curses.init_pair(COLOR_DIFF_ADD_LINE, curses.COLOR_GREEN, -1) +curses.init_pair(COLOR_DIFF_DEL_LINE, curses.COLOR_RED, -1) +curses.init_pair(COLOR_DIFF_OFFSET, curses.COLOR_MAGENTA, -1) # don't display the cursor try: @@ -1345,16 +1349,27 @@ pgup/K: move patch up, pgdn/J: move patc addln(rulesscr, y, 2, rule) rulesscr.noutrefresh() -def renderstring(win, state, output): +def renderstring(win, state, output, diffcolors=False): maxy, maxx = win.getmaxyx() length = min(maxy - 1, len(output)) for y in range(0, length): -win.addstr(y, 0, output[y]) +line = output[y] +if diffcolors: +if line and line[0] == '+': +win.addstr(y, 0, line, curses.color_pair(COLOR_DIFF_ADD_LINE)) +elif line and line[0] == '-': +win.addstr(y, 0, line, curses.color_pair(COLOR_DIFF_DEL_LINE)) +elif line.startswith('@@ '): +win.addstr(y, 0, line, curses.color_pair(COLOR_DIFF_OFFSET)) +else: +win.addstr(y, 0, line) +else: +win.addstr(y, 0, line) win.noutrefresh() def renderpatch(win, state): start = state['modes'][MODE_PATCH]['line_offset'] -renderstring(win, state, patchcontents(state)[start:]) +renderstring(win, state, patchcontents(state)[start:], diffcolors=True) def layout(mode): maxy, maxx = stdscr.getmaxyx() ___ Mercurial-devel mailing list Mercurial-devel@mercurial-scm.org https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel
D6212: tests: add test of for hash reference translation by `hg convert`
martinvonz added inline comments. INLINE COMMENTS > test-convert-hg-source.t:213-215 > +Create a commit we'll drop while converting so we get different hashes > + $ echo a > unwanted > + $ hg ci -Aqm 'unwanted' I just remembered that there is a `convert.hg.sourcename` that can be used for this purpose. I'll update the stack in a few minutes REPOSITORY rHG Mercurial REVISION DETAIL https://phab.mercurial-scm.org/D6212 To: martinvonz, #hg-reviewers Cc: mercurial-devel ___ Mercurial-devel mailing list Mercurial-devel@mercurial-scm.org https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel
D6212: tests: add test of for hash reference translation by `hg convert`
martinvonz updated this revision to Diff 14686. REPOSITORY rHG Mercurial CHANGES SINCE LAST UPDATE https://phab.mercurial-scm.org/D6212?vs=14682&id=14686 REVISION DETAIL https://phab.mercurial-scm.org/D6212 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 @@ -206,3 +206,19 @@ a c d + $ cd .. + + $ hg init commit-references + $ cd commit-references + $ echo a > a + $ hg ci -Aqm initial + $ echo b > b + $ hg ci -Aqm 'the previous commit was 1451231c8757' + + $ cd .. + $ hg convert commit-references new-commit-references -q \ + > --config convert.hg.sourcename=yes + $ cd new-commit-references + $ hg log -T '{node|short} {desc}\n' + 642508659503 the previous commit was c2491f685436 + c2491f685436 initial To: martinvonz, #hg-reviewers Cc: mercurial-devel ___ Mercurial-devel mailing list Mercurial-devel@mercurial-scm.org https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel
D6213: tests: demonstrate broken `hg convert` if "ffffffffffff" is in description
martinvonz updated this revision to Diff 14687. REPOSITORY rHG Mercurial CHANGES SINCE LAST UPDATE https://phab.mercurial-scm.org/D6213?vs=14683&id=14687 REVISION DETAIL https://phab.mercurial-scm.org/D6213 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 @@ -214,10 +214,14 @@ $ hg ci -Aqm initial $ echo b > b $ hg ci -Aqm 'the previous commit was 1451231c8757' + $ echo c > c + $ hg ci -Aqm 'the working copy is called ' $ cd .. +BROKEN: crashes when the "" is encountered $ hg convert commit-references new-commit-references -q \ - > --config convert.hg.sourcename=yes + > --config convert.hg.sourcename=yes 2>&1 | grep TypeError + TypeError: b2a_hex() argument 1 must be string or buffer, not None $ cd new-commit-references $ hg log -T '{node|short} {desc}\n' 642508659503 the previous commit was c2491f685436 To: martinvonz, #hg-reviewers Cc: mercurial-devel ___ Mercurial-devel mailing list Mercurial-devel@mercurial-scm.org https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel
D6215: localrepo: don't allow lookup of working directory revision
martinvonz updated this revision to Diff 14688. REPOSITORY rHG Mercurial CHANGES SINCE LAST UPDATE https://phab.mercurial-scm.org/D6215?vs=14685&id=14688 REVISION DETAIL https://phab.mercurial-scm.org/D6215 AFFECTED FILES mercurial/localrepo.py tests/test-convert-hg-source.t tests/test-pull.t CHANGE DETAILS diff --git a/tests/test-pull.t b/tests/test-pull.t --- a/tests/test-pull.t +++ b/tests/test-pull.t @@ -76,10 +76,9 @@ [255] Test pull of working copy revision -BROKEN: should give a better error message $ hg pull -r '' pulling from http://foo@localhost:$HGPORT/ - abort: b2a_hex() argument 1 must be string or buffer, not None! + abort: unknown revision ''! [255] Issue622: hg init && hg pull -u URL doesn't checkout default branch 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 @@ -218,11 +218,10 @@ $ hg ci -Aqm 'the working copy is called ' $ cd .. -BROKEN: crashes when the "" is encountered $ hg convert commit-references new-commit-references -q \ - > --config convert.hg.sourcename=yes 2>&1 | grep TypeError - TypeError: b2a_hex() argument 1 must be string or buffer, not None + > --config convert.hg.sourcename=yes $ cd new-commit-references $ hg log -T '{node|short} {desc}\n' + fe295c9e6bc6 the working copy is called 642508659503 the previous commit was c2491f685436 c2491f685436 initial diff --git a/mercurial/localrepo.py b/mercurial/localrepo.py --- a/mercurial/localrepo.py +++ b/mercurial/localrepo.py @@ -1564,7 +1564,10 @@ pass def lookup(self, key): -return scmutil.revsymbol(self, key).node() +node = scmutil.revsymbol(self, key).node() +if node is None: +raise error.RepoLookupError(_("unknown revision '%s'") % key) +return node def lookupbranch(self, key): if self.branchmap().hasbranch(key): To: martinvonz, #hg-reviewers Cc: mercurial-devel ___ Mercurial-devel mailing list Mercurial-devel@mercurial-scm.org https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel
[Bug 6113] New: content-divergent resolution seems to reset author.
https://bz.mercurial-scm.org/show_bug.cgi?id=6113 Bug ID: 6113 Summary: content-divergent resolution seems to reset author. Product: Mercurial Version: unspecified Hardware: All OS: All Status: UNCONFIRMED Severity: bug Priority: wish Component: evolution Assignee: bugzi...@mercurial-scm.org Reporter: pierre-yves.da...@ens-lyon.org CC: mercurial-devel@mercurial-scm.org, pierre-yves.da...@ens-lyon.org Givent the current evolution history: o3caa4a459439 (13207) tests: use current instability names everywhere |\ x | 9258f4b20225 (13206) tests: use current instability names everywhere | |rewritten(user, date) as 3caa4a459439 using evolve by Pierre-Yves David (Fri Apr 05 16:31:45 2019 +0200) | | | x 98183abd35b0 (13204) tests: use current instability names everywhere | |rewritten(user, date, content) as 3caa4a459439 using evolve by Pierre-Yves David (Fri Apr 05 16:31:45 2019 +0200) | | x | 417abd3c4f87 (13205) tests: use current instability names everywhere |/ rewritten(parent) as 9258f4b20225 using evolve by Pierre-Yves David (Fri Apr 05 16:31:45 2019 +0200) | x a7cb6c5f5191 (13202) tests: use current instability names everywhere | … And the corresponding commit content: $ hg log -r 3caa4a459439+9258f4b20225+98183abd35b0 --hidden ☿ (phase-cache) changeset: 13207:3caa4a459439 parent: 13200:046dd7718845 user:Pierre-Yves David date:Fri Apr 05 16:31:45 2019 +0200 summary: tests: use current instability names everywhere changeset: 13206:9258f4b20225 parent: 13200:046dd7718845 user:Anton Shestakov date:Thu Apr 04 20:59:50 2019 +0800 obsolete:rewritten using evolve as 13207:3caa4a459439 summary: tests: use current instability names everywhere changeset: 13204:98183abd35b0 parent: 13200:046dd7718845 user:Anton Shestakov date:Thu Apr 04 20:59:50 2019 +0800 obsolete:rewritten using evolve as 13207:3caa4a459439 summary: tests: use current instability names everywhere It seems like the automatic content-divergence resolution dropped the initial author in favor of the user running the content-divergence resolution command. Writing a proper test for that should not be too hard. -- You are receiving this mail because: You are on the CC list for the bug. ___ Mercurial-devel mailing list Mercurial-devel@mercurial-scm.org https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel
D5628: diffstat: make --git work properly on renames (issue6025)
pulkit added inline comments. INLINE COMMENTS > patch.py:2811 > +elif line.startswith('rename to'): > +filename += ' => %s' % line.split()[-1] > addresult() This is unfortunately not working with hglib. hglib seems to be splitting data on '>' or only reading data after that. @yuja do you have any idea what can cause that? REPOSITORY rHG Mercurial REVISION DETAIL https://phab.mercurial-scm.org/D5628 To: navaneeth.suresh, #hg-reviewers Cc: pulkit, yuja, mercurial-devel ___ Mercurial-devel mailing list Mercurial-devel@mercurial-scm.org https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel
[PATCH] py3: write out hgextindex as bytes in setup.py
# HG changeset patch # User Matt Harbison # Date 1554503803 14400 # Fri Apr 05 18:36:43 2019 -0400 # Node ID d8aef987cc88a5abead0c9cecf5e14066f161968 # Parent a975821d0938615b8cb235f12cc6461a42dcfbd8 py3: write out hgextindex as bytes in setup.py I hit this trying to build the py2exe target using python3, just to see what would happen. After commenting out `py2exe.Distribution` in setup.py and pointing to a local copy of py2exe that supports python3[1], it complained that `out` was bytes, not str. [1] https://github.com/albertosottile/py2exe/releases/tag/v0.9.3.0 diff --git a/setup.py b/setup.py --- a/setup.py +++ b/setup.py @@ -583,9 +583,9 @@ class buildhgextindex(Command): if err or returncode != 0: raise DistutilsExecError(err) -with open(self._indexfilename, 'w') as f: -f.write('# this file is autogenerated by setup.py\n') -f.write('docs = ') +with open(self._indexfilename, 'wb') as f: +f.write(b'# this file is autogenerated by setup.py\n') +f.write(b'docs = ') f.write(out) class buildhgexe(build_ext): ___ Mercurial-devel mailing list Mercurial-devel@mercurial-scm.org https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel
Re: [PATCH] py3: write out hgextindex as bytes in setup.py
On Fri, 05 Apr 2019 18:38:54 -0400, Matt Harbison wrote: # HG changeset patch # User Matt Harbison # Date 1554503803 14400 # Fri Apr 05 18:36:43 2019 -0400 # Node ID d8aef987cc88a5abead0c9cecf5e14066f161968 # Parent a975821d0938615b8cb235f12cc6461a42dcfbd8 py3: write out hgextindex as bytes in setup.py There are subsequent problems that need to be resolved with py2exe. First, it's complaining about py2 syntax in the vendored `concurrent` package. Obviously we don't want that picked up in py3, and there's logic in setup.py to only add it under py2. But if added explicitly to the exclude list, the build fails complaining there's no such package. Commenting that py2 syntax out, it then dies inside the custom module loader at `spec = finder.find_spec(..)`, complaining: 'VendorImporter' object has no attribute 'find_spec' Wrapping that in an exception handler that does nothing allows the build to complete, but hg.exe can't load dispatch.py from the zip file. There's a TODO in the custom loader to support loading from zip files, but it seems to bail out before that point because `finder.find_spec()` returns None. The loader can't be removed, because there's still something very early that needs to be treated as bytes. Presumably there's already a loader that knows how to read zip files that we could just delegate to somehow, but I really don't have a good understanding of how all these pieces fit together. `sys.meta_path` at this point is: [mercurial.hgpathentryfinder, _frozen_importlib.BuiltinImporter, _frozen_importlib.FrozenImporter, _frozen_importlib_external.PathFinder] ___ Mercurial-devel mailing list Mercurial-devel@mercurial-scm.org https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel
Re: [PATCH] py3: write out hgextindex as bytes in setup.py
> On Apr 5, 2019, at 15:44, Matt Harbison wrote: > >> On Fri, 05 Apr 2019 18:38:54 -0400, Matt Harbison >> wrote: >> >> # HG changeset patch >> # User Matt Harbison >> # Date 1554503803 14400 >> # Fri Apr 05 18:36:43 2019 -0400 >> # Node ID d8aef987cc88a5abead0c9cecf5e14066f161968 >> # Parent a975821d0938615b8cb235f12cc6461a42dcfbd8 >> py3: write out hgextindex as bytes in setup.py > > There are subsequent problems that need to be resolved with py2exe. First, > it's > complaining about py2 syntax in the vendored `concurrent` package. Obviously > we > don't want that picked up in py3, and there's logic in setup.py to only add it > under py2. But if added explicitly to the exclude list, the build fails > complaining there's no such package. > > Commenting that py2 syntax out, it then dies inside the custom module loader > at > `spec = finder.find_spec(..)`, complaining: > >'VendorImporter' object has no attribute 'find_spec' > > Wrapping that in an exception handler that does nothing allows the build to > complete, but hg.exe can't load dispatch.py from the zip file. There's > a TODO in the custom loader to support loading from zip files, but it seems > to bail out before that point because `finder.find_spec()` returns None. The > loader can't be removed, because there's still something very early that needs > to be treated as bytes. > > Presumably there's already a loader that knows how to read zip files that we > could just delegate to somehow, but I really don't have a good understanding > of > how all these pieces fit together. `sys.meta_path` at this point is: > >[mercurial.hgpathentryfinder, _frozen_importlib.BuiltinImporter, > _frozen_importlib.FrozenImporter, _frozen_importlib_external.PathFinder] The source transforming module importer is going to be “fun” to get working for py2exe. That’s because I believe py2exe is performing its own pyc compilation so the zip has only pyc files. I have doubts that the module compilation includes our custom source transformer. But I could be wrong. We have a few paths forward... a) coerce py2exe to work with our custom module importer. This entails either compiling transformed source into bytecode and teaching our importer to load it from the zip file. Or putting .py files in the zip and making our module importer work with that. b) get rid of the source transforming module importer. (I was kinda hoping we’d be going down this path already. But doing so entails b’’ everywhere and we were ratholing in mass rewriting the repo.) c) give up on py2exe and use PyOxidizer. (I’m still hacking on this, albeit slowly.) PyOxidizer is superior because it is faster and will be a self-contained binary. Mercurial is very much my main test case for PyOxidizer and I’ll add features to PyOxidizer to make it work with Mercurial. ___ Mercurial-devel mailing list Mercurial-devel@mercurial-scm.org https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel
Re: [PATCH] chistedit: properly show verbose diffs
On Thu, 04 Apr 2019 10:47:49 -0400, Jordi Gutiérrez Hermoso wrote: > # HG changeset patch > # User Jordi Gutiérrez Hermoso > # Date 1554388915 14400 > # Thu Apr 04 10:41:55 2019 -0400 > # Node ID 704f79617827ab0c19a788715b797fcfe8557cea > # Parent 4ee906aa7b60fb6b113e4dc187fbb5a8f42e557c > chistedit: properly show verbose diffs > > I'm not sure if that ever worked and it's an internal API breakage, > but `"verbose": True` is not correctly parsed, as most of these > options are parsed by diffopts, whereas verbose is a global option. > > Setting the UI to verbose instead does work and does show a verbose > patch, with full commit message. > > It also shows all files, which unfortunately are a bit hard to read on > a single line in the default verbose template. Thus, we also change > the default template to use the status template, which shows one file > per line as well as its modification state. > > diff --git a/hgext/histedit.py b/hgext/histedit.py > --- a/hgext/histedit.py > +++ b/hgext/histedit.py > @@ -1230,8 +1230,9 @@ def addln(win, y, x, line, color=None): > def patchcontents(state): > repo = state['repo'] > rule = state['rules'][state['pos']] > +repo.ui.verbose = True Perhaps, this has to be ui.configoverride() so the original value can be restored. ___ Mercurial-devel mailing list Mercurial-devel@mercurial-scm.org https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel
Re: [PATCH 1 of 3] [py3] packaging: allow to run make with python3
On Thu, 04 Apr 2019 19:09:51 +0200, Philippe Pepiot wrote: > # HG changeset patch > # User Philippe Pepiot > # Date 1554397608 -7200 > # Thu Apr 04 19:06:48 2019 +0200 > # Node ID c9030c811fdff71908344bb17f05bb71d314acc7 > # Parent 4ee906aa7b60fb6b113e4dc187fbb5a8f42e557c > [py3] packaging: allow to run make with python3 > > Use "?=", otherwise the variable cannot be set from environment. > > diff --git a/Makefile b/Makefile > --- a/Makefile > +++ b/Makefile > @@ -5,7 +5,7 @@ > # % make PREFIX=/opt/ install > > export PREFIX=/usr/local > -PYTHON=python > +PYTHON?=python For the record, make variables can be explicitly overridden by command line in 'make FOO=bar' form. ___ Mercurial-devel mailing list Mercurial-devel@mercurial-scm.org https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel
Re: [PATCH] py3: write out hgextindex as bytes in setup.py
On Fri, 05 Apr 2019 18:38:54 -0400, Matt Harbison wrote: > # HG changeset patch > # User Matt Harbison > # Date 1554503803 14400 > # Fri Apr 05 18:36:43 2019 -0400 > # Node ID d8aef987cc88a5abead0c9cecf5e14066f161968 > # Parent a975821d0938615b8cb235f12cc6461a42dcfbd8 > py3: write out hgextindex as bytes in setup.py Queued, thanks. ___ Mercurial-devel mailing list Mercurial-devel@mercurial-scm.org https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel
Re: D5628: diffstat: make --git work properly on renames (issue6025)
On Fri, 5 Apr 2019 20:47:21 +, pulkit (Pulkit Goyal) wrote: > pulkit added inline comments. > > INLINE COMMENTS > > > patch.py:2811 > > +elif line.startswith('rename to'): > > +filename += ' => %s' % line.split()[-1] > > addresult() > > This is unfortunately not working with hglib. hglib seems to be splitting > data on '>' or only reading data after that. > > @yuja do you have any idea what can cause that? Which hglib function? I never thought hglib would parse diffstat output. I don't think it's parsable (i.e. BC-guaranteed) format. ___ Mercurial-devel mailing list Mercurial-devel@mercurial-scm.org https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel
Re: [PATCH 2 of 3] revset: implement copies and renames for checkstatus
On Fri, Apr 5, 2019, 12:30 Jordi Gutiérrez Hermoso wrote: > # HG changeset patch > # User Jordi Gutiérrez Hermoso > # Date 1554489104 14400 > # Fri Apr 05 14:31:44 2019 -0400 > # Node ID 4baa10f1f44a8e427f49fa4f4d8d29552c2a1a65 > # Parent 9fcb915a73b83547921aaa13584c88cb99c6aee7 > revset: implement copies and renames for checkstatus > > Determining when a file is a copy is tricky and isn't handled by the > normal status functions, so thankfully we can offload that work to > the copies module, just like the status command itself does. > > diff --git a/mercurial/revset.py b/mercurial/revset.py > --- a/mercurial/revset.py > +++ b/mercurial/revset.py > @@ -11,6 +11,7 @@ import re > > from .i18n import _ > from . import ( > +copies as copiesmod, > dagop, > destutil, > diffutil, > @@ -603,6 +604,8 @@ def checkstatus(repo, subset, pat, field > 0: modified > 1: added > 2: removed > +3: copied (not renamed, i.e. source not removed) > +4: renamed (not copied, i..e source removed) > Misplaced '.' (and/or 'e' :) ) in "i.e." """ > hasset = matchmod.patkind(pat) == 'set' > > @@ -624,7 +627,18 @@ def checkstatus(repo, subset, pat, field > break > else: > return False > -files = repo.status(c.p1().node(), c.node())[field] > +p1 = c.p1() > +status = repo.status(p1.node(), c.node()) > +if field == 3: > +copymap = copiesmod.pathcopies(p1, c, m) > +removed = status[2] > "status.removed" is easier to read +files = [dest for (dest, src) in copymap.items() if src not in > removed] > +elif field == 4: > +copymap = copiesmod.pathcopies(p1, c, m) > +removed = status[2] > +files = [dest for (dest, src) in copymap.items() if src in > removed] > +else: > +files = status[field] > if fname is not None: > if fname in files: > return True > ___ > 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 1 of 2] packaging: don't crash building wix with python3.6 and earlier
# HG changeset patch # User Matt Harbison # Date 1554518865 14400 # Fri Apr 05 22:47:45 2019 -0400 # Node ID 385b6be9f587e3ec2bc04de98d5ffe025a375e8f # Parent 7cfd20bc07215ce8d18642dfe67f316405208c06 packaging: don't crash building wix with python3.6 and earlier `capture_output` was added in 3.7. I was tempted to just check and abort in build.py, since Windows doesn't have the Linux problem where some distros only ship an older python. But this is in a library that could be used elsewhere in the future. diff --git a/contrib/packaging/hgpackaging/util.py b/contrib/packaging/hgpackaging/util.py --- a/contrib/packaging/hgpackaging/util.py +++ b/contrib/packaging/hgpackaging/util.py @@ -142,11 +142,9 @@ import platform; print("%s:%s" % (platfo def python_exe_info(python_exe: pathlib.Path): """Obtain information about a Python executable.""" -res = subprocess.run( -[str(python_exe), '-c', PRINT_PYTHON_INFO], -capture_output=True, check=True) +res = subprocess.check_output([str(python_exe), '-c', PRINT_PYTHON_INFO]) -arch, version = res.stdout.decode('utf-8').split(':') +arch, version = res.decode('utf-8').split(':') version = distutils.version.LooseVersion(version) ___ Mercurial-devel mailing list Mercurial-devel@mercurial-scm.org https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel
[PATCH 2 of 2] packaging: ensure that --python is an absolute path when building on Windows
# HG changeset patch # User Matt Harbison # Date 1554520031 14400 # Fri Apr 05 23:07:11 2019 -0400 # Node ID 33e7b98103511da6b5bb7fd54ba7ada62e80813c # Parent 385b6be9f587e3ec2bc04de98d5ffe025a375e8f packaging: ensure that --python is an absolute path when building on Windows For whatever reason, even though only python2 is on PATH, passing `python.exe` causes the later check that it's not py3 to bail out. diff --git a/contrib/packaging/inno/build.py b/contrib/packaging/inno/build.py --- a/contrib/packaging/inno/build.py +++ b/contrib/packaging/inno/build.py @@ -30,6 +30,9 @@ if __name__ == '__main__': args = parser.parse_args() +if not os.path.isabs(args.python): +raise Exception('--python arg must be an absolute path') + if args.iscc: iscc = pathlib.Path(args.iscc) else: diff --git a/contrib/packaging/wix/build.py b/contrib/packaging/wix/build.py --- a/contrib/packaging/wix/build.py +++ b/contrib/packaging/wix/build.py @@ -62,6 +62,9 @@ if __name__ == '__main__': 'version': args.version, } +if not os.path.isabs(args.python): +raise Exception('--python arg must be an absolute path') + if args.extra_packages_script: kwargs['extra_packages_script'] = args.extra_packages_script if args.extra_wxs: ___ Mercurial-devel mailing list Mercurial-devel@mercurial-scm.org https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel
Re: [PATCH] py3: write out hgextindex as bytes in setup.py
On Fri, 05 Apr 2019 18:59:42 -0400, Gregory Szorc wrote: The source transforming module importer is going to be “fun” to get working for py2exe. That’s because I believe py2exe is performing its own pyc compilation so the zip has only pyc files. I have doubts that the module compilation includes our custom source transformer. But I could be wrong. We have a few paths forward... a) coerce py2exe to work with our custom module importer. This entails either compiling transformed source into bytecode and teaching our importer to load it from the zip file. Or putting .py files in the zip and making our module importer work with that. b) get rid of the source transforming module importer. (I was kinda hoping we’d be going down this path already. But doing so entails b’’ everywhere and we were ratholing in mass rewriting the repo.) c) give up on py2exe and use PyOxidizer. (I’m still hacking on this, albeit slowly.) PyOxidizer is superior because it is faster and will be a self-contained binary. Mercurial is very much my main test case for PyOxidizer and I’ll add features to PyOxidizer to make it work with Mercurial. OK, thanks. I didn't know anything about PyOxidizer- it sounds promising! I'll probably leave py2exe alone then, as that's well beyond my level of knowledge and it sounds like it's more hassle than it's worth. I was kind of interested in how easily it would integrate into the TortoiseHG build- I don't have the custom PyQt build that works with py2, so I thought maybe working through the py3 issues would provide a platform to test packaging changes. Additionally, it errors out on my laptop when installing the wheel: C:\Program Files (x86)\Microsoft Visual Studio\2017\Professional\VC\Tools\MSVC\14.16.27023\binHostX64\x64\cl.exe /c /nologo /Ox /MD /W3 /GS- /DNDEBUG -DPYTHONDLL=\"PYTHON27.DLL\" -DPYTHONCOM=\"pythoncom27.dll\" -IC:\Python27\include -IC:\Users\Matt\hg\build\venv-inno-x64\PC /Tcsource/start.c /Fobuild\temp.win-amd64-2.7\Release\source/start.obj start.c C:\Program Files (x86)\Windows Kits\10\include\10.0.17763.0\ucrt\stdio.h(1933): warning C4005: 'snprintf': macro redefinition c:\users\matt\hg\build\py2exe-0.6.9\source\Python-dynload.h(30): note: see previous definition of 'snprintf' C:\Program Files (x86)\Windows Kits\10\include\10.0.17763.0\ucrt\stdio.h(1935): fatal error C1189: #error: Macro definition of snprintf conflicts with Standard Library function declaration error: command 'C:\\Program Files (x86)\\Microsoft Visual Studio\\2017\\Professional\\VC\\Tools\\MSVC\\14.16.27023\\bin\\HostX64\\x64\\cl.exe' failed with exit status 2 It built successfully at work earlier today, so I'm not sure what the difference is here- possibly the SDK version? ___ Mercurial-devel mailing list Mercurial-devel@mercurial-scm.org https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel