D6142: automation: perform tasks on remote machines
mharbison72 added a comment. I don't know anything about PowerShell or AWS, but this series looks nice for making Windows easier to deal with. What was the problem with python3 tests? I've been able to run them locally (though a bunch fail with py3 issues). I've been hacking on and off with running tests under WSL. I'm not sure if that will help any of this. It's tantalizingly close, but there are path style issues that `WSLENV` and `wslpath` can't fix. (e.g., sometimes $TESTTMP is written to an hgrc file in Linux format, and hg.exe can't understand that.) Any plans to port this to the TortoiseHg codebase? I don't have the bandwidth to try anything in the near term, but don't want to duplicate effort. INLINE COMMENTS > windows.py:97 > +RUN_TESTS = r''' > +C:\hgdev\MinGW\msys\1.0\bin\sh.exe --login -c "cd /c/hgdev/src/tests && > /c/hgdev/{python_path}/python.exe run-tests.py {test_flags}" > +if ($LASTEXITCODE -ne 0) {{ There's an annoying issue with MSYS where it will convert the username part of %TEMP% and %TMP% to 8.3 format with a `~` if it is long-ish. That throws a few tests into disarray. Given how MSYS is bootstrapped here, I wonder if those variables can be set to `C:\hgdev\tmp` or similar first. REPOSITORY rHG Mercurial REVISION DETAIL https://phab.mercurial-scm.org/D6142 To: indygreg, #hg-reviewers Cc: mharbison72, mercurial-devel ___ Mercurial-devel mailing list Mercurial-devel@mercurial-scm.org https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel
D6139: wix: autogenerate wxs file for library files
This revision was automatically updated to reflect the committed changes. Closed by commit rHG131d0b7c3940: wix: autogenerate wxs file for library files (authored by indygreg, committed by ). REPOSITORY rHG Mercurial CHANGES SINCE LAST UPDATE https://phab.mercurial-scm.org/D6139?vs=14502=14518 REVISION DETAIL https://phab.mercurial-scm.org/D6139 AFFECTED FILES contrib/packaging/hgpackaging/wix.py contrib/packaging/wix/dist.wxs CHANGE DETAILS diff --git a/contrib/packaging/wix/dist.wxs b/contrib/packaging/wix/dist.wxs --- a/contrib/packaging/wix/dist.wxs +++ b/contrib/packaging/wix/dist.wxs @@ -9,35 +9,6 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/contrib/packaging/hgpackaging/wix.py b/contrib/packaging/hgpackaging/wix.py --- a/contrib/packaging/hgpackaging/wix.py +++ b/contrib/packaging/hgpackaging/wix.py @@ -11,6 +11,8 @@ import pathlib import re import subprocess +import tempfile +import xml.dom.minidom from .downloads import ( download_entry, @@ -128,6 +130,52 @@ return post_build_sign +LIBRARIES_XML = ''' + +http://schemas.microsoft.com/wix/2006/wi;> + + + + + + + + + + + + + +'''.lstrip() + + +def make_libraries_xml(wix_dir: pathlib.Path, dist_dir: pathlib.Path): +"""Make XML data for library components WXS.""" +# We can't use ElementTree because it doesn't handle the +# directives. +doc = xml.dom.minidom.parseString( +LIBRARIES_XML.format(wix_dir=str(wix_dir))) + +component = doc.getElementsByTagName('Component')[0] + +f = doc.createElement('File') +f.setAttribute('Name', 'library.zip') +f.setAttribute('KeyPath', 'yes') +component.appendChild(f) + +lib_dir = dist_dir / 'lib' + +for p in sorted(lib_dir.iterdir()): +if not p.name.endswith(('.dll', '.pyd')): +continue + +f = doc.createElement('File') +f.setAttribute('Name', p.name) +component.appendChild(f) + +return doc.toprettyxml() + + def build_installer(source_dir: pathlib.Path, python_exe: pathlib.Path, msi_name='mercurial', version=None, post_build_fn=None): """Build a WiX MSI installer. @@ -181,6 +229,17 @@ wxs_source_dir = source_dir / rel_path run_candle(wix_path, build_dir, wxs, wxs_source_dir, defines=defines) +# candle.exe doesn't like when we have an open handle on the file. +# So use TemporaryDirectory() instead of NamedTemporaryFile(). +with tempfile.TemporaryDirectory() as td: +td = pathlib.Path(td) + +tf = td / 'library.wxs' +with tf.open('w') as fh: +fh.write(make_libraries_xml(wix_dir, dist_dir)) + +run_candle(wix_path, build_dir, tf, dist_dir, defines=defines) + source = wix_dir / 'mercurial.wxs' defines['Version'] = version defines['Comments'] = 'Installs Mercurial version %s' % version @@ -204,7 +263,10 @@ assert source.endswith('.wxs') args.append(str(build_dir / ('%s.wixobj' % source[:-4]))) -args.append(str(build_dir / 'mercurial.wixobj')) +args.extend([ +str(build_dir / 'library.wixobj'), +str(build_dir / 'mercurial.wixobj'), +]) subprocess.run(args, cwd=str(source_dir), check=True) To: indygreg, #hg-reviewers Cc: mjpieters, mercurial-devel ___ Mercurial-devel mailing list Mercurial-devel@mercurial-scm.org https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel
D6135: packaging: don't bundle DLLs in py2exe library.zip for x86 builds
This revision was automatically updated to reflect the committed changes. Closed by commit rHGd6e3c16d48ab: packaging: dont bundle DLLs in py2exe library.zip for x86 builds (authored by indygreg, committed by ). REPOSITORY rHG Mercurial CHANGES SINCE LAST UPDATE https://phab.mercurial-scm.org/D6135?vs=14498=14515 REVISION DETAIL https://phab.mercurial-scm.org/D6135 AFFECTED FILES contrib/packaging/hgpackaging/py2exe.py contrib/packaging/inno/mercurial.iss setup.py CHANGE DETAILS diff --git a/setup.py b/setup.py --- a/setup.py +++ b/setup.py @@ -1364,6 +1364,7 @@ distclass=hgdist, options={ 'py2exe': { + 'bundle_files': 3, 'dll_excludes': py2exedllexcludes, 'excludes': py2exeexcludes, 'packages': py2exepackages, diff --git a/contrib/packaging/inno/mercurial.iss b/contrib/packaging/inno/mercurial.iss --- a/contrib/packaging/inno/mercurial.iss +++ b/contrib/packaging/inno/mercurial.iss @@ -71,10 +71,8 @@ Source: contrib\win32\ReadMe.html; DestDir: {app}; Flags: isreadme Source: contrib\win32\postinstall.txt; DestDir: {app}; DestName: ReleaseNotes.txt Source: dist\hg.exe; DestDir: {app}; AfterInstall: Touch('{app}\hg.exe.local') -#if ARCH == "x64" Source: dist\lib\*.dll; Destdir: {app}\lib Source: dist\lib\*.pyd; Destdir: {app}\lib -#endif Source: dist\python*.dll; Destdir: {app}; Flags: skipifsourcedoesntexist Source: dist\msvc*.dll; DestDir: {app}; Flags: skipifsourcedoesntexist Source: dist\Microsoft.VC*.CRT.manifest; DestDir: {app}; Flags: skipifsourcedoesntexist diff --git a/contrib/packaging/hgpackaging/py2exe.py b/contrib/packaging/hgpackaging/py2exe.py --- a/contrib/packaging/hgpackaging/py2exe.py +++ b/contrib/packaging/hgpackaging/py2exe.py @@ -128,7 +128,7 @@ print('building Mercurial') subprocess.run( [str(venv_python), 'setup.py', - 'py2exe', '-b', '3' if vc_x64 else '2', + 'py2exe', 'build_doc', '--html'], cwd=str(source_dir), env=env, To: indygreg, #hg-reviewers Cc: mercurial-devel ___ Mercurial-devel mailing list Mercurial-devel@mercurial-scm.org https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel
D6136: setup: exclude crypt32.dll in py2exe builds
This revision was automatically updated to reflect the committed changes. Closed by commit rHGe5ac701e5b7c: setup: exclude crypt32.dll in py2exe builds (authored by indygreg, committed by ). REPOSITORY rHG Mercurial CHANGES SINCE LAST UPDATE https://phab.mercurial-scm.org/D6136?vs=14499=14514 REVISION DETAIL https://phab.mercurial-scm.org/D6136 AFFECTED FILES setup.py CHANGE DETAILS diff --git a/setup.py b/setup.py --- a/setup.py +++ b/setup.py @@ -1253,7 +1253,7 @@ ] py2exeexcludes = [] -py2exedllexcludes = [] +py2exedllexcludes = ['crypt32.dll'] if issetuptools: extra['python_requires'] = supportedpy To: indygreg, #hg-reviewers Cc: mercurial-devel ___ Mercurial-devel mailing list Mercurial-devel@mercurial-scm.org https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel
D6138: wix: introduce variable to hold path to wix packaging directory
This revision was automatically updated to reflect the committed changes. Closed by commit rHG39f65c506899: wix: introduce variable to hold path to wix packaging directory (authored by indygreg, committed by ). REPOSITORY rHG Mercurial CHANGES SINCE LAST UPDATE https://phab.mercurial-scm.org/D6138?vs=14501=14517 REVISION DETAIL https://phab.mercurial-scm.org/D6138 AFFECTED FILES contrib/packaging/hgpackaging/wix.py CHANGE DETAILS diff --git a/contrib/packaging/hgpackaging/wix.py b/contrib/packaging/hgpackaging/wix.py --- a/contrib/packaging/hgpackaging/wix.py +++ b/contrib/packaging/hgpackaging/wix.py @@ -146,9 +146,9 @@ hg_build_dir = source_dir / 'build' dist_dir = source_dir / 'dist' +wix_dir = source_dir / 'contrib' / 'packaging' / 'wix' -requirements_txt = (source_dir / 'contrib' / 'packaging' / -'wix' / 'requirements.txt') +requirements_txt = wix_dir / 'requirements.txt' build_py2exe(source_dir, hg_build_dir, python_exe, 'wix', requirements_txt, @@ -177,11 +177,11 @@ defines = {'Platform': arch} for wxs, rel_path in SUPPORT_WXS: -wxs = source_dir / 'contrib' / 'packaging' / 'wix' / wxs +wxs = wix_dir / wxs wxs_source_dir = source_dir / rel_path run_candle(wix_path, build_dir, wxs, wxs_source_dir, defines=defines) -source = source_dir / 'contrib' / 'packaging' / 'wix' / 'mercurial.wxs' +source = wix_dir / 'mercurial.wxs' defines['Version'] = version defines['Comments'] = 'Installs Mercurial version %s' % version defines['VCRedistSrcDir'] = str(hg_build_dir) To: indygreg, #hg-reviewers Cc: mercurial-devel ___ Mercurial-devel mailing list Mercurial-devel@mercurial-scm.org https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel
D6137: wix: package missing .dll and .pyd files
This revision was automatically updated to reflect the committed changes. Closed by commit rHG9661a9c0695e: wix: package missing .dll and .pyd files (authored by indygreg, committed by ). REPOSITORY rHG Mercurial CHANGES SINCE LAST UPDATE https://phab.mercurial-scm.org/D6137?vs=14500=14516 REVISION DETAIL https://phab.mercurial-scm.org/D6137 AFFECTED FILES contrib/packaging/wix/dist.wxs CHANGE DETAILS diff --git a/contrib/packaging/wix/dist.wxs b/contrib/packaging/wix/dist.wxs --- a/contrib/packaging/wix/dist.wxs +++ b/contrib/packaging/wix/dist.wxs @@ -17,18 +17,25 @@ + + + + + + + To: indygreg, #hg-reviewers Cc: mercurial-devel ___ Mercurial-devel mailing list Mercurial-devel@mercurial-scm.org https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel
D6126: dirstate: remove obsolete reference to dirstate.beginparentchange
This revision was automatically updated to reflect the committed changes. Closed by commit rHG42dd69985778: dirstate: remove obsolete reference to dirstate.beginparentchange (authored by martinvonz, committed by ). REPOSITORY rHG Mercurial CHANGES SINCE LAST UPDATE https://phab.mercurial-scm.org/D6126?vs=14483=14512 REVISION DETAIL https://phab.mercurial-scm.org/D6126 AFFECTED FILES mercurial/dirstate.py CHANGE DETAILS diff --git a/mercurial/dirstate.py b/mercurial/dirstate.py --- a/mercurial/dirstate.py +++ b/mercurial/dirstate.py @@ -289,8 +289,8 @@ See localrepo.setparents() """ if self._parentwriters == 0: -raise ValueError("cannot set dirstate parent without " - "calling dirstate.beginparentchange") +raise ValueError("cannot set dirstate parent outside of " + "dirstate.parentchange context manager") self._dirty = True oldp2 = self._pl[1] 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
D6134: packaging: convert files to LF
This revision was automatically updated to reflect the committed changes. Closed by commit rHGb83de9150c1c: packaging: convert files to LF (authored by indygreg, committed by ). REPOSITORY rHG Mercurial CHANGES SINCE LAST UPDATE https://phab.mercurial-scm.org/D6134?vs=14497=14513 REVISION DETAIL https://phab.mercurial-scm.org/D6134 AFFECTED FILES contrib/packaging/hgpackaging/downloads.py contrib/packaging/hgpackaging/util.py contrib/packaging/hgpackaging/wix.py CHANGE DETAILS diff --git a/contrib/packaging/hgpackaging/wix.py b/contrib/packaging/hgpackaging/wix.py --- a/contrib/packaging/hgpackaging/wix.py +++ b/contrib/packaging/hgpackaging/wix.py @@ -1,239 +1,239 @@ -# wix.py - WiX installer functionality -# -# Copyright 2019 Gregory Szorc -# -# This software may be used and distributed according to the terms of the -# GNU General Public License version 2 or any later version. - -# no-check-code because Python 3 native. - -import os -import pathlib -import re -import subprocess - -from .downloads import ( -download_entry, -) -from .py2exe import ( -build_py2exe, -) -from .util import ( -extract_zip_to_directory, -sign_with_signtool, -) - - -SUPPORT_WXS = [ -('contrib.wxs', r'contrib'), -('dist.wxs', r'dist'), -('doc.wxs', r'doc'), -('help.wxs', r'mercurial\help'), -('i18n.wxs', r'i18n'), -('locale.wxs', r'mercurial\locale'), -('templates.wxs', r'mercurial\templates'), -] - - -EXTRA_PACKAGES = { -'distutils', -'pygments', -} - - -def find_version(source_dir: pathlib.Path): -version_py = source_dir / 'mercurial' / '__version__.py' - -with version_py.open('r', encoding='utf-8') as fh: -source = fh.read().strip() - -m = re.search('version = b"(.*)"', source) -return m.group(1) - - -def normalize_version(version): -"""Normalize Mercurial version string so WiX accepts it. - -Version strings have to be numeric X.Y.Z. -""" - -if '+' in version: -version, extra = version.split('+', 1) -else: -extra = None - -# 4.9rc0 -if version[:-1].endswith('rc'): -version = version[:-3] - -versions = [int(v) for v in version.split('.')] -while len(versions) < 3: -versions.append(0) - -major, minor, build = versions[:3] - -if extra: -# -+ -build = int(extra.split('-')[0]) - -return '.'.join('%d' % x for x in (major, minor, build)) - - -def ensure_vc90_merge_modules(build_dir): -x86 = ( -download_entry('vc9-crt-x86-msm', build_dir, - local_name='microsoft.vcxx.crt.x86_msm.msm')[0], -download_entry('vc9-crt-x86-msm-policy', build_dir, - local_name='policy.x.xx.microsoft.vcxx.crt.x86_msm.msm')[0] -) - -x64 = ( -download_entry('vc9-crt-x64-msm', build_dir, - local_name='microsoft.vcxx.crt.x64_msm.msm')[0], -download_entry('vc9-crt-x64-msm-policy', build_dir, - local_name='policy.x.xx.microsoft.vcxx.crt.x64_msm.msm')[0] -) -return { -'x86': x86, -'x64': x64, -} - - -def run_candle(wix, cwd, wxs, source_dir, defines=None): -args = [ -str(wix / 'candle.exe'), -'-nologo', -str(wxs), -'-dSourceDir=%s' % source_dir, -] - -if defines: -args.extend('-d%s=%s' % define for define in sorted(defines.items())) - -subprocess.run(args, cwd=str(cwd), check=True) - - -def make_post_build_signing_fn(name, subject_name=None, cert_path=None, - cert_password=None, timestamp_url=None): -"""Create a callable that will use signtool to sign hg.exe.""" - -def post_build_sign(source_dir, build_dir, dist_dir, version): -description = '%s %s' % (name, version) - -sign_with_signtool(dist_dir / 'hg.exe', description, - subject_name=subject_name, cert_path=cert_path, - cert_password=cert_password, - timestamp_url=timestamp_url) - -return post_build_sign - - -def build_installer(source_dir: pathlib.Path, python_exe: pathlib.Path, -msi_name='mercurial', version=None, post_build_fn=None): -"""Build a WiX MSI installer. - -``source_dir`` is the path to the Mercurial source tree to use. -``arch`` is the target architecture. either ``x86`` or ``x64``. -``python_exe`` is the path to the Python executable to use/bundle. -``version`` is the Mercurial version string. If not defined, -``mercurial/__version__.py`` will be consulted. -``post_build_fn`` is a callable that will be called after building -Mercurial but before invoking WiX. It can be used to e.g. facilitate -signing. It is passed the paths to the Mercurial source, build, and -dist directories and the resolved Mercurial version. -""" -arch = 'x64' if r'\x64' in os.environ.get('LIB', '') else 'x86' - -
D6107: py3: use r'' instead of b'' in opts.get() in phabricator.py
yuja added a comment. > I was under the impression that that was more of a hack, mainly useful for when there are lots of existing `opts.get(b'')` uses in a file, and when there are a few it was better to change to `r''`. Correct. And I feel there are lots of `s/b''/r''/`s in this patch. REPOSITORY rHG Mercurial REVISION DETAIL https://phab.mercurial-scm.org/D6107 To: Kwan, #hg-reviewers Cc: yuja, mercurial-devel ___ Mercurial-devel mailing list Mercurial-devel@mercurial-scm.org https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel
Re: D6107: py3: use r'' instead of b'' in opts.get() in phabricator.py
> I was under the impression that that was more of a hack, mainly useful for > when there are lots of existing `opts.get(b'')` uses in a file, and when > there are a few it was better to change to `r''`. Correct. And I feel there are lots of `s/b''/r''/`s in this patch. ___ Mercurial-devel mailing list Mercurial-devel@mercurial-scm.org https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel
D6113: py3: convert to/from bytes/unicode for json.(dump|load)s in debugcallconduit
yuja added a comment. > Ah, we can indeed (thanks for the pointer), with one caveat: the formatting. > The existing output is nicely formatted for human readability, with each entry on a new line and indented appropriately. `templatefilters.json()` isn't capable of that. > Do we mind losing that? It's also tested for in test-phabricator.t. Compare before: Good point. Let's not change the formatting as it is a debug command and we'll probably want to read the output. REPOSITORY rHG Mercurial REVISION DETAIL https://phab.mercurial-scm.org/D6113 To: Kwan, #hg-reviewers Cc: yuja, mercurial-devel ___ Mercurial-devel mailing list Mercurial-devel@mercurial-scm.org https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel
Re: D6113: py3: convert to/from bytes/unicode for json.(dump|load)s in debugcallconduit
> Ah, we can indeed (thanks for the pointer), with one caveat: the > formatting. > The existing output is nicely formatted for human readability, with each > entry on a new line and indented appropriately. `templatefilters.json()` > isn't capable of that. > Do we mind losing that? It's also tested for in test-phabricator.t. > Compare before: Good point. Let's not change the formatting as it is a debug command and we'll probably want to read the output. ___ Mercurial-devel mailing list Mercurial-devel@mercurial-scm.org https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel
D6140: revset: add new contiguous(x) function for "x::x"
yuja added a comment. I think "contiguous" is good as it stands for the main use case. "closure" seems confusing unless we have stronger math background than computer science. The other candidates would require more knowledge about the theory. REPOSITORY rHG Mercurial REVISION DETAIL https://phab.mercurial-scm.org/D6140 To: martinvonz, #hg-reviewers Cc: yuja, av6, spectral, gracinet, marmoute, mercurial-devel ___ Mercurial-devel mailing list Mercurial-devel@mercurial-scm.org https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel
Re: D6140: revset: add new contiguous(x) function for "x::x"
I think "contiguous" is good as it stands for the main use case. "closure" seems confusing unless we have stronger math background than computer science. The other candidates would require more knowledge about the theory. ___ Mercurial-devel mailing list Mercurial-devel@mercurial-scm.org https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel
D6103: py3: use pycompat.iterbytestr to convert memoryview slice to bytestring before passing to itertools.takewhile
This revision was automatically updated to reflect the committed changes. Closed by commit rHGe7b84ffb06d9: py3: use pycompat.iterbytestr to convert memoryview slice to bytestring (authored by Kwan, committed by ). CHANGED PRIOR TO COMMIT https://phab.mercurial-scm.org/D6103?vs=14494=14511#toc REPOSITORY rHG Mercurial CHANGES SINCE LAST UPDATE https://phab.mercurial-scm.org/D6103?vs=14494=14511 REVISION DETAIL https://phab.mercurial-scm.org/D6103 AFFECTED FILES hgext/phabricator.py CHANGE DETAILS diff --git a/hgext/phabricator.py b/hgext/phabricator.py --- a/hgext/phabricator.py +++ b/hgext/phabricator.py @@ -675,7 +675,7 @@ length = len(text) while pos < length: symbol = b''.join(itertools.takewhile(lambda ch: ch not in special, - view[pos:])) + pycompat.iterbytestr(view[pos:]))) if symbol: yield (b'symbol', symbol, pos) pos += len(symbol) To: Kwan, #hg-reviewers Cc: yuja, mercurial-devel ___ Mercurial-devel mailing list Mercurial-devel@mercurial-scm.org https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel
D6140: revset: add new contiguous(x) function for "x::x"
martinvonz added a subscriber: av6. martinvonz added a comment. In https://phab.mercurial-scm.org/D6140#89469, @gracinet wrote: > I thought of "closure" as well, but I fear it has too many possible meanings, "transitive closure" being one of them in that context (certainly related, but not the same thing), and of course the closures in functional programming. > > I think "hull" could be appropriate, if not too pedantic. > > I couldn't find out quickly if people dealing with partial ordered sets theory (another way to think of DAGs) actually use "hull", but here's the analogy: > for the convex hull, you add [a, b] (line segment) to the set whenever a and b belong to it, for this "poset hull" you do the same with a::b (which in poset theory would be called the interval [a, b]) Wouldn't the hull pretty much be `heads(contiguous(x)) or roots(contiguous(x))`? Regardless, most users are not math nerds. I still think `contiguous()` is pretty clear. Sure, it won't join separate branches by adding ancestors or descendants, but I'm not sure there is a name that conveys that meaning too while not being too academic. @av6 also prefers `contiguous`, so we have two votes for that. I'm not sure how many votes for `closure` we have. If we still want to find a better name, maybe it helps to remember that the function returns nodes that are *both* ancestors and descendants of some nodes in the input. Maybe something family-related (like "ancestors" and "descendants" are)? But I can't think of any term like that. > This S::S operation seems to be a special case of Closure Operators in the sense of https://en.wikipedia.org/wiki/Closure_operator, which tells us that "hull" can indeed be used as alternative terminology in some cases where "closure" can be confusing (they quote topology). In that same article, there's inded yet another meaning in the context of partially ordered sets, as a generalisation of the very first definition (generalising the power set to any partially ordered set). > > /taking rusty mathematical hat off now REPOSITORY rHG Mercurial REVISION DETAIL https://phab.mercurial-scm.org/D6140 To: martinvonz, #hg-reviewers Cc: av6, spectral, gracinet, marmoute, mercurial-devel ___ Mercurial-devel mailing list Mercurial-devel@mercurial-scm.org https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel
D6140: revset: add new contiguous(x) function for "x::x"
gracinet added a comment. I thought of "closure" as well, but I fear it has too many possible meanings, "transitive closure" being one of them in that context (certainly related, but not the same thing), and of course the closures in functional programming. I think "hull" could be appropriate, if not too pedantic. I couldn't find out quickly if people dealing with partial ordered sets theory (another way to think of DAGs) actually use "hull", but here's the analogy: for the convex hull, you add [a, b] (line segment) to the set whenever a and b belong to it, for this "poset hull" you do the same with a::b (which in poset theory would be called the interval [a, b]) This S::S operation seems to be a special case of Closure Operators in the sense of https://en.wikipedia.org/wiki/Closure_operator, which tells us that "hull" can indeed be used as alternative terminology in some cases where "closure" can be confusing (they quote topology). In that same article, there's inded yet another meaning in the context of partially ordered sets, as a generalisation of the very first definition (generalising the power set to any partially ordered set). /taking rusty mathematical hat off now REPOSITORY rHG Mercurial REVISION DETAIL https://phab.mercurial-scm.org/D6140 To: martinvonz, #hg-reviewers Cc: spectral, gracinet, marmoute, mercurial-devel ___ Mercurial-devel mailing list Mercurial-devel@mercurial-scm.org https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel
[Bug 6103] New: mailmap() does not support remapping improper author without email address
https://bz.mercurial-scm.org/show_bug.cgi?id=6103 Bug ID: 6103 Summary: mailmap() does not support remapping improper author without email address Product: Mercurial Version: 4.8 Hardware: PC OS: Linux Status: UNCONFIRMED Severity: feature Priority: wish Component: templater Assignee: bugzi...@mercurial-scm.org Reporter: patrickdepinguin+mercur...@gmail.com CC: mercurial-devel@mercurial-scm.org The mailmap() function in templates expects the author-to-be-mapped to have an email address. This is not always the case: many first-time users assume that the 'ui.username' field is effectively a username, like 'jdoe'. Neither is there a check to prevent such improper names. Therefore, I think that mailmap should also allow correcting such bad names, e.g. with a format: Proper Name Bad Name -- 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
D6005: uncommit: added interactive mode -i(issue6062)
martinvonz added a comment. Can you wrap the commit message to 80 columns? I didn't find anything on https://www.mercurial-scm.org/wiki/ContributingChanges about it, but that's how almost everyone else does it. INLINE COMMENTS > uncommit.py:185-190 > keepcommit = pats > if not keepcommit: > if opts.get('keep') is not None: > keepcommit = opts.get('keep') > else: > keepcommit = ui.configbool('experimental', > 'uncommit.keep') It looks like this is only useful in the non-interactive case. It's generally preferred to avoid unnecessary work, both because it's wasting computer resources (not really an issue here) and because it makes it clearer how the code works. In this case, it will make it clear that the `--keep` option does not matter with `--interactive`. However, it seems reasonable for `--keep` (and the corresponding config option) to be respected with `--interactive`. Maybe you should pass `keep` it into `_interactiveuncommit()` and use it there? I'd be fine with just leaving a TODO about that (and leave the `keepcommit` code here). > uncommit.py:216 > +def _interactiveuncommit(ui, repo, old, match): > +""" Makes a temporary commit with the chunks which user > +selected to uncommit. After that the diff of the parent and that commit > is nit: remove the leading space here and in other docstrings for consistency (we seem to have about 60 instances with a leading space and 2900 without) > uncommit.py:241 > + > +def _createtempcommit(ui, repo, old, match): > +""" Creates a temporary commit for `uncommit --interative` which contains Do we need to create the temporary commit? I found it hard to reason about (the temporary commit contains the changes that should be removed, which confused me) and we should ideally not leave that commit in the repo. I tried to rewrite it to not write the temporary commit. You can see my patch at http://paste.debian.net/1073278/. As you can see in the changed test case there, it doesn't work with added files. I don't know if that's because of the crecord bug that you mention on line 254 of this version or something else. Hopefully the patch is still a good start and maybe you can fix that bug. It would be great if you can even fix it in crecord (if that's where it is), so all users of crecord can benefit. > uncommit.py:265 > +fp.seek(0) > +oldnode = node.hex(old.node())[:12] > +message = 'temporary commit for uncommiting %s' % oldnode `amend_source` includes the full hash. I think it's better to do the same here. > uncommit.py:270 > + > +def _patchtocommit(ui, repo, old, fp, message=None, extras=None): > +""" Applies the patch to the working directory and `extras` is a confusing name for a node (it sounds too much like it's a changeset extras dict). I suggest renaming it to `oldnode`. > martinvonz wrote in uncommit.py:235 > Should probably use `scmutil.cleanupnodes()` here too? I didn't mean "use `cleanupnodes()` too", I meant "here too" :) I.e., use `cleanupnodes()` here just like we do elsewhere in this file, not in addition to using `createmarkers()`. So just delete the `createmarkers()` call. > martinvonz wrote in uncommit.py:253-254 > I think it's fine to do it directly there, without wrapping. We're shipping > this extension with core, so it shouldn't be a problem. It will have no > effect unless you've enabled the extension, as far as I can tell. It doesn't look done to me... > taapas1128 wrote in test-uncommit-interactive.t:110 > Can I work on this as a part as a follow up ? or should i make amends in this > patch . I think it's still unclear if we even want to make that change (I think I would prefer it, but I'd like to hear from others), so let's leave it as is for now. REPOSITORY rHG Mercurial REVISION DETAIL https://phab.mercurial-scm.org/D6005 To: taapas1128, #hg-reviewers Cc: ryanmce, spectral, pulkit, martinvonz, mercurial-devel ___ Mercurial-devel mailing list Mercurial-devel@mercurial-scm.org https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel
D6142: automation: perform tasks on remote machines
indygreg created this revision. Herald added a subscriber: mercurial-devel. Herald added a reviewer: hg-reviewers. REVISION SUMMARY Sometimes you don't have access to a machine in order to do something. For example, you may not have access to a Windows machine required to build Windows binaries or run tests on that platform. This commit introduces a pile of code intended to help "automate" common tasks, like building release artifacts. In its current form, the automation code provides functionality for performing tasks on Windows EC2 instances. The hgautomation.aws module provides functionality for integrating with AWS. It manages EC2 resources such as IAM roles, EC2 security groups, AMIs, and instances. The hgautomation.windows module provides a higher-level interface for performing tasks on remote Windows machines. The hgautomation.cli module provides a command-line interface to these higher-level primitives. I attempted to structure Windows remote machine interaction around Windows Remoting / PowerShell. This is kinda/sorta like SSH + shell, but for Windows. In theory, most of the functionality is cloud provider agnostic, as we should be able to use any established WinRM connection to interact with a remote. In reality, we're tightly coupled to AWS at the moment because I didn't want to prematurely add abstractions for a 2nd cloud provider. (1 was hard enough to implement.) In the aws module is code for creating an image with a fully functional Mercurial development environment. It contains VC9, VC2017, msys, and other dependencies. The image is fully capable of building all the existing Mercurial release artifacts and running tests. There are a few things that don't work. For example, running Windows tests with Python 3. But building the Windows release artifacts does work. And that was an impetus for this work. (Although we don't yet support code signing.) Getting this functionality to work was extremely time consuming. It took hours debugging permissions failures and other wonky behavior due to PowerShell Remoting. (The permissions model for PowerShell is crazy and you brush up against all kinds of issues because of the user/privileges of the user running the PowerShell and the permissions of the PowerShell session itself.) The functionality around AWS resource management could use some improving. In theory we support shared tenancy via resource name prefixing. In reality, we don't offer a way to configure this. Speaking of AWS resource management, I thought about using a tool like Terraform to manage resources. But at our scale, writing a few dozen lines of code to manage resources seemed acceptable. Maybe we should reconsider this if things grow out of control. Time will tell. Currently, emphasis is placed on Windows. But I only started there because it was likely to be the most difficult to implement. It should be relatively trivial to automate tasks on remote Linux machines. In fact, I have a ~1 year old script to run tests on a remote EC2 instance. I will likely be porting that to this new "framework" in the near future. 1. no-check-commit because foo_bar functions REPOSITORY rHG Mercurial REVISION DETAIL https://phab.mercurial-scm.org/D6142 AFFECTED FILES contrib/automation/README.rst contrib/automation/automation.py contrib/automation/hgautomation/__init__.py contrib/automation/hgautomation/aws.py contrib/automation/hgautomation/cli.py contrib/automation/hgautomation/windows.py contrib/automation/hgautomation/winrm.py contrib/automation/requirements.txt contrib/automation/requirements.txt.in tests/test-check-code.t tests/test-check-module-imports.t tests/test-check-py3-compat.t CHANGE DETAILS diff --git a/tests/test-check-py3-compat.t b/tests/test-check-py3-compat.t --- a/tests/test-check-py3-compat.t +++ b/tests/test-check-py3-compat.t @@ -5,6 +5,7 @@ #if no-py3 $ testrepohg files 'set:(**.py)' \ + > -X contrib/automation/ \ > -X contrib/packaging/hgpackaging/ \ > -X contrib/packaging/inno/ \ > -X contrib/packaging/wix/ \ diff --git a/tests/test-check-module-imports.t b/tests/test-check-module-imports.t --- a/tests/test-check-module-imports.t +++ b/tests/test-check-module-imports.t @@ -18,6 +18,7 @@ > 'tests/**.t' \ > -X hgweb.cgi \ > -X setup.py \ + > -X contrib/automation/ \ > -X contrib/debugshell.py \ > -X contrib/hgweb.fcgi \ > -X contrib/packaging/hg-docker \ diff --git a/tests/test-check-code.t b/tests/test-check-code.t --- a/tests/test-check-code.t +++ b/tests/test-check-code.t @@ -12,6 +12,11 @@ > -X hgext/fsmonitor/pywatchman \ > -X mercurial/thirdparty \ > | sed 's-\\-/-g' | "$check_code" --warnings --per-file=0 - || false + Skipping contrib/automation/hgautomation/__init__.py it has no-che?k-code (glob) + Skipping contrib/automation/hgautomation/aws.py
D6141: contrib: PowerShell script to install development dependencies
indygreg created this revision. Herald added a subscriber: mercurial-devel. Herald added a reviewer: hg-reviewers. REVISION SUMMARY Configuring a Windows machine to hack on Mercurial is a bit of work and it isn't documented very well. This commit introduces a PowerShell script to automate going from a fresh Windows install to an environment suitable for building Mercurial, its installers, and running tests. REPOSITORY rHG Mercurial REVISION DETAIL https://phab.mercurial-scm.org/D6141 AFFECTED FILES contrib/install-windows-dependencies.ps1 CHANGE DETAILS diff --git a/contrib/install-windows-dependencies.ps1 b/contrib/install-windows-dependencies.ps1 new file mode 100644 --- /dev/null +++ b/contrib/install-windows-dependencies.ps1 @@ -0,0 +1,200 @@ +# install-dependencies.ps1 - Install Windows dependencies for building Mercurial +# +# Copyright 2019 Gregory Szorc +# +# This software may be used and distributed according to the terms of the +# GNU General Public License version 2 or any later version. + +# This script can be used to bootstrap a Mercurial build environment on +# Windows. +# +# The script makes a lot of assumptions about how things should work. +# For example, the install location of Python is hardcoded to c:\hgdev\*. +# +# The script should be executed from a PowerShell with elevated privileges +# if you don't want to see a UAC prompt for various installers. +# +# The script is tested on Windows 10 and Windows Server 2019 (in EC2). + +$VS_BUILD_TOOLS_URL = "https://download.visualstudio.microsoft.com/download/pr/a1603c02-8a66-4b83-b821-811e3610a7c4/aa2db8bb39e0cbd23e9940d8951e0bc3/vs_buildtools.exe; +$VS_BUILD_TOOLS_SHA256 = "911E292B8E6E5F46CBC17003BDCD2D27A70E616E8D5E6E69D5D489A605CAA139" + +$VC9_PYTHON_URL = "https://download.microsoft.com/download/7/9/6/796EF2E4-801B-4FC4-AB28-B59FBF6D907B/VCForPython27.msi; +$VC9_PYTHON_SHA256 = "070474db76a2e625513a5835df4595df9324d820f9cc97eab2a596dcbc2f5cbf" + +$PYTHON27_x64_URL = "https://www.python.org/ftp/python/2.7.16/python-2.7.16.amd64.msi; +$PYTHON27_x64_SHA256 = "7c0f45993019152d46041a7db4b947b919558fdb7a8f67bcd0535bc98d42b603" +$PYTHON27_X86_URL = "https://www.python.org/ftp/python/2.7.16/python-2.7.16.msi; +$PYTHON27_X86_SHA256 = "d57dc3e1ba490aee856c28b4915d09e3f49442461e46e481bc6b2d18207831d7" + +$PYTHON35_x86_URL = "https://www.python.org/ftp/python/3.5.4/python-3.5.4.exe; +$PYTHON35_x86_SHA256 = "F27C2D67FD9688E4970F3BFF799BB9D722A0D6C2C13B04848E1F7D620B524B0E" +$PYTHON35_x64_URL = "https://www.python.org/ftp/python/3.5.4/python-3.5.4-amd64.exe; +$PYTHON35_x64_SHA256 = "9B7741CC32357573A77D2EE64987717E527628C38FD7EAF3E2AACA853D45A1EE" + +$PYTHON36_x86_URL = "https://www.python.org/ftp/python/3.6.8/python-3.6.8.exe; +$PYTHON36_x86_SHA256 = "89871D432BC06E4630D7B64CB1A8451E53C80E68DE29029976B12AAD7DBFA5A0" +$PYTHON36_x64_URL = "https://www.python.org/ftp/python/3.6.8/python-3.6.8-amd64.exe; +$PYTHON36_x64_SHA256 = "96088A58B7C43BC83B84E6B67F15E8706C614023DD64F9A5A14E81FF824ADADC" + +$PYTHON37_x86_URL = "https://www.python.org/ftp/python/3.7.2/python-3.7.2.exe; +$PYTHON37_x86_SHA256 = "8BACE330FB409E428B04083DD9CA7F6C754366D07E23B3853891D8F8C3D0" +$PYTHON37_x64_URL = "https://www.python.org/ftp/python/3.7.2/python-3.7.2-amd64.exe; +$PYTHON37_x64_SHA256 = "0FE2A696F5A3E481FED795EF6896ED99157BCEF273EF3C4A96F2905CBDB3AA13" + +$PYTHON38_x86_URL = "https://www.python.org/ftp/python/3.8.0/python-3.8.0a2.exe; +$PYTHON38_x86_SHA256 = "013A7DDD317679FE51223DE627688CFCB2F0F1128FD25A987F846AEB476D3FEF" +$PYTHON38_x64_URL = "https://www.python.org/ftp/python/3.8.0/python-3.8.0a2-amd64.exe; +$PYTHON38_X64_SHA256 = "560BC6D1A76BCD6D544AC650709F3892956890753CDCF9CE67E3D7302D76FB41" + +# PIP 19.0.3. +$PIP_URL = "https://github.com/pypa/get-pip/raw/fee32c376da1ff6496a798986d7939cd51e1644f/get-pip.py; +$PIP_SHA256 = "efe99298f3fbb1f56201ce6b81d2658067d2f7d7dfc2d412e0d3cacc9a397c61" + +$VIRTUALENV_URL = "https://files.pythonhosted.org/packages/37/db/89d6b043b22052109da35416abc3c397655e4bd3cff031446ba02b9654fa/virtualenv-16.4.3.tar.gz; +$VIRTUALENV_SHA256 = "984d7e607b0a5d1329425dd8845bd971b957424b5ba664729fab51ab8c11bc39" + +$INNO_SETUP_URL = "http://files.jrsoftware.org/is/5/innosetup-5.6.1-unicode.exe; +$INNO_SETUP_SHA256 = "27D49E9BC769E9D1B214C153011978DB90DC01C2ACD1DDCD9ED7B3FE3B96B538" + +$MINGW_BIN_URL = "https://osdn.net/frs/redir.php?m=constant=mingw%2F68260%2Fmingw-get-0.6.3-mingw32-pre-20170905-1-bin.zip; +$MINGW_BIN_SHA256 = "2AB8EFD7C7D1FC8EAF8B2FA4DA4EEF8F3E47768284C021599BC7435839A046DF" + +$MERCURIAL_WHEEL_FILENAME = "mercurial-4.9-cp27-cp27m-win_amd64.whl" +$MERCURIAL_WHEEL_URL = "https://files.pythonhosted.org/packages/fe/e8/b872d53dfbbf986bdc46af0b30f580b227fb59bddd2587152a55e205b0cc/$MERCURIAL_WHEEL_FILENAME; +$MERCURIAL_WHEEL_SHA256 = "218cc2e7c3f1d535007febbb03351663897edf27df0e57d6842e3b686492b429" + +# Writing progress slows down downloads substantially. So disable it.
D6140: revset: add new contiguous(x) function for "x::x"
martinvonz added a subscriber: spectral. martinvonz added a comment. In https://phab.mercurial-scm.org/D6140#89440, @marmoute wrote: > I chatted a bit with Georges about this. He suggested something along > the line of `fill` or `complete`. `fill` also came up in IRC yesterday. @spectral found it slightly confusing that it there's a template function with the same name. I don't think we talked about `complete`. Other examples were `connect`, `fillgaps`, `gapfill`. Oh, and apparently nbjoerg also suggested `closure` (before I did) :) Funny how three of us came up with the same name. I still like `contiguous` the best, but let's see if we got other suggestions or votes for existing suggestions. REPOSITORY rHG Mercurial REVISION DETAIL https://phab.mercurial-scm.org/D6140 To: martinvonz, #hg-reviewers Cc: spectral, gracinet, marmoute, mercurial-devel ___ Mercurial-devel mailing list Mercurial-devel@mercurial-scm.org https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel
mercurial@41949: 10 new changesets
10 new changesets in mercurial: https://www.mercurial-scm.org/repo/hg/rev/70d2d47314e5 changeset: 41940:70d2d47314e5 user:Pierre-Yves David date:Thu Mar 14 09:11:18 2019 + summary: manifestcache: test and fix some output of the debug command https://www.mercurial-scm.org/repo/hg/rev/08fad2ca4eb6 changeset: 41941:08fad2ca4eb6 user:Pierre-Yves David date:Thu Mar 14 10:24:51 2019 + summary: manifestcache: further fix to debug command output https://www.mercurial-scm.org/repo/hg/rev/fbee66c90cef changeset: 41942:fbee66c90cef user:Pierre-Yves David date:Thu Mar 14 10:43:01 2019 + summary: manifestcache: only lock the repository if the debug command touch the cache https://www.mercurial-scm.org/repo/hg/rev/1e75311d78f7 changeset: 41943:1e75311d78f7 user:Pierre-Yves David date:Thu Mar 14 09:11:41 2019 + summary: manifestcache: do not display data when using --add https://www.mercurial-scm.org/repo/hg/rev/99eb9f269a5a changeset: 41944:99eb9f269a5a user:Pierre-Yves David date:Thu Mar 14 10:53:28 2019 + summary: manifestcache: test that adding the same entry twice do not duplicates it https://www.mercurial-scm.org/repo/hg/rev/7436653d8542 changeset: 41945:7436653d8542 user:Pierre-Yves David date:Thu Mar 14 09:12:27 2019 + summary: manifestcache: adding a second distinct entry https://www.mercurial-scm.org/repo/hg/rev/5b77847bdf09 changeset: 41946:5b77847bdf09 user:Pierre-Yves David date:Thu Mar 14 10:58:53 2019 + summary: manifestcache: make sure the entry are ordered by access time https://www.mercurial-scm.org/repo/hg/rev/b74ef67573e5 changeset: 41947:b74ef67573e5 user:Pierre-Yves David date:Thu Mar 14 09:12:46 2019 + summary: manifestcache: actually honor --clear https://www.mercurial-scm.org/repo/hg/rev/dd1ab72be983 changeset: 41948:dd1ab72be983 user:Martin von Zweigbergk date:Thu Mar 14 13:53:20 2019 -0700 summary: test: demonstrate crash with in-memory rebase and copies https://www.mercurial-scm.org/repo/hg/rev/e1ceefab9bca changeset: 41949:e1ceefab9bca bookmark:@ tag: tip user:Martin von Zweigbergk date:Thu Mar 14 14:46:29 2019 -0700 summary: rebase: fix crash with in-memory rebase and copies -- 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
D6140: revset: add new contiguous(x) function for "x::x"
marmoute added a subscriber: gracinet. marmoute added a comment. I chatted a bit with Georges about this. He suggested something along the line of `fill` or `complete`. REPOSITORY rHG Mercurial REVISION DETAIL https://phab.mercurial-scm.org/D6140 To: martinvonz, #hg-reviewers Cc: gracinet, marmoute, mercurial-devel ___ Mercurial-devel mailing list Mercurial-devel@mercurial-scm.org https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel
Re: D6140: revset: add new contiguous(x) function for "x::x"
I chatted a bit with Georges about this. He suggested something along the line of `fill` or `complete`. On 3/15/19 4:28 PM, martinvonz (Martin von Zweigbergk) wrote: martinvonz added a comment. In https://phab.mercurial-scm.org/D6140#89400, @marmoute wrote: > I am a fan of this function, I need this on a regular basis. Having an > explicit function for this also open the way to various optimization. > For example we know that a set already has this property we could skip > all computation. > > I am ambivalent about the naming however. It feels a bit odd. There are > case where it could be misleading. > > Lets look at the following case: > > c e > | | > b d > |/ > a > > > the revset `(b+c+d+e)::(b+c+d+e)` returns the same `b+c+d+e`, however > the set is not "contiguous" as `b+c` and `d+e` as not connected. Right, that's what I tried to express with "without adding new common ancestors or common descendants" in the documentation. > This feels a bit more like a "closure" operation to me. That's what I suggested on IRC because the operation somehow made me think of a closure, but when I looked up what a closure is, it seems like `ancestors()` is the actual closure function (if we consider the direction to point from child to parents as we normally do). REPOSITORY rHG Mercurial REVISION DETAIL https://phab.mercurial-scm.org/D6140 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 -- Pierre-Yves David ___ Mercurial-devel mailing list Mercurial-devel@mercurial-scm.org https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel
D2010: check-commit: allow foo_bar naming in functions
martinvonz added a comment. In https://phab.mercurial-scm.org/D2010#89436, @indygreg wrote: > If we loosen the naming requirement, I think a good convention would be to have new files use the *modern* convention and for existing code/files to generally stick to the old convention. > > That being said, if someone were to introduce a new function into an existing file and wanted to use the modern names, I wouldn't mind. > > I would not like to see global, API breaking rewrites for the sake of rewrites. If we wanted to do a global search and replace on variables inside functions, I'd be OK with that (that won't break API compat). But I'm in no rush to do it. > > I would also not like to see patches introducing mixed naming conventions within functions. I think we should try to keep things consistent at definitely the function level and possibly the file level. Sounds good to me. As I said before, we don't seem to have that many functions that have many words in their name, so I don't think the inconsistency would be very noticeable anyway. REPOSITORY rHG Mercurial REVISION DETAIL https://phab.mercurial-scm.org/D2010 To: indygreg, #hg-reviewers, pulkit, durin42 Cc: martinvonz, av6, yuja, durin42, pulkit, mercurial-devel ___ Mercurial-devel mailing list Mercurial-devel@mercurial-scm.org https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel
D6125: revert: option to choose what to keep, not what to discard
martinvonz added a comment. I understand that it's not at all clear if we want to make this change by default, but I'd appreciate if we can queue this patch as is so I and others can easily start testing it (it's pretty deep inside `_performrevert()`, so it's hard to do it cleanly in an extension). I don't believe I'm changing the behavior for anyone who has not set the new config. REPOSITORY rHG Mercurial REVISION DETAIL https://phab.mercurial-scm.org/D6125 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
D6098: wix: restore COPYING.rtf
indygreg added a comment. In https://phab.mercurial-scm.org/D6098#89413, @pulkit wrote: > I applied this locally and did `hg diff -c . --git --binary` locally and the output is empty. Not sure what's broken here. Maybe it is a Phabricator/integration bug? Try this: # HG changeset patch # User Gregory Szorc # Date 1552069233 28800 # Fri Mar 08 10:20:33 2019 -0800 # Node ID 577eab065a686f838bf13def7810d8d6f5f7f7ec # Parent 7e95ade0f369d7509d04d6c0eefc06ca3d26c6e7 wix: restore COPYING.rtf 8427fea04017 accidentally blew away the content of this file. As part of restoring the content, I updated the copyright year to 2019. Differential Revision: https://phab.mercurial-scm.org/D6098 diff --git a/contrib/packaging/wix/COPYING.rtf b/contrib/packaging/wix/COPYING.rtf index e69de29bb2d1d6434b8b29ae775ad8c2e48c5391..320dd93cce160f2950b9e47d0144efecfe40a1d6 GIT binary patch literal 1687 zc$|$@-*4MC5Z-fu{11n|tSvG}Qsalr!vL>H8l#D0*bWK5L84x+Rsgtev*i6{+f zQRbC@xwS&2>r5PQMmlp?-TWuZffRS*jNW{h|WfHO0t;(a` zgLUxa%b*GjFdW>ZgN*)$$?fPUwy1XB(G)kL%~R1xR|t*6G!rhaUS~H6t#zwIDqjB- z9pz7-B2k|u@T6ScI+Pm3&+-{qr2gFdNU8lg}@Y<2lS;=CkL;UC(`Dz}VQF zP1nkM8qRBru5(c~1eVLSR-}B#eI=*2fM8kK~a>Ey6Ixo!3iH_&;PKoLPFsMrn*B2$nNcQhgz7xl!~MO|IL5X)sWCjL1^os2uqN zy~l#|QD$gcZfU-+Ej@EY`zACs^xT1+?xR4X;d(T3jT(tIVe@zA)ZqOaIFHcSKul{4 zokQCC7+p%8gh-kGuN7B2#R-r3kU5>py(_lw z&^y`3YN6DB9oRA+cs?zPwCdB&6{+=T?2ppd(VZgcvQOJ+qu*tJ x@A?k)>Ao9yrIo>aklXs*@p#}p*axtrmHi!oO`e9*?JMy2GYlg`X}j{sP5+QltO? REPOSITORY rHG Mercurial REVISION DETAIL https://phab.mercurial-scm.org/D6098 To: indygreg, #hg-reviewers Cc: pulkit, mercurial-devel ___ Mercurial-devel mailing list Mercurial-devel@mercurial-scm.org https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel
D2010: check-commit: allow foo_bar naming in functions
indygreg added a comment. If we loosen the naming requirement, I think a good convention would be to have new files use the *modern* convention and for existing code/files to generally stick to the old convention. That being said, if someone were to introduce a new function into an existing file and wanted to use the modern names, I wouldn't mind. I would not like to see global, API breaking rewrites for the sake of rewrites. If we wanted to do a global search and replace on variables inside functions, I'd be OK with that (that won't break API compat). But I'm in no rush to do it. I would also not like to see patches introducing mixed naming conventions within functions. I think we should try to keep things consistent at definitely the function level and possibly the file level. REPOSITORY rHG Mercurial REVISION DETAIL https://phab.mercurial-scm.org/D2010 To: indygreg, #hg-reviewers, pulkit, durin42 Cc: martinvonz, av6, yuja, durin42, pulkit, mercurial-devel ___ Mercurial-devel mailing list Mercurial-devel@mercurial-scm.org https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel
D6140: revset: add new contiguous(x) function for "x::x"
martinvonz added a comment. In https://phab.mercurial-scm.org/D6140#89400, @marmoute wrote: > I am a fan of this function, I need this on a regular basis. Having an > explicit function for this also open the way to various optimization. > For example we know that a set already has this property we could skip > all computation. > > I am ambivalent about the naming however. It feels a bit odd. There are > case where it could be misleading. > > Lets look at the following case: > > c e > | | > b d > |/ > a > > > the revset `(b+c+d+e)::(b+c+d+e)` returns the same `b+c+d+e`, however > the set is not "contiguous" as `b+c` and `d+e` as not connected. Right, that's what I tried to express with "without adding new common ancestors or common descendants" in the documentation. > This feels a bit more like a "closure" operation to me. That's what I suggested on IRC because the operation somehow made me think of a closure, but when I looked up what a closure is, it seems like `ancestors()` is the actual closure function (if we consider the direction to point from child to parents as we normally do). REPOSITORY rHG Mercurial REVISION DETAIL https://phab.mercurial-scm.org/D6140 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
D2010: check-commit: allow foo_bar naming in functions
martinvonz added a comment. In https://phab.mercurial-scm.org/D2010#89337, @indygreg wrote: > Should we queue this patch or abandon it? I'm for it, even though it leads to inconsistency. However, we may want to discuss ahead of time what our long-term plan for existing symbols is. Do we eventually want to remove that inconsistency? I took a quick look for examples where it seemed obviously not worth it to rename and it was harder to find good examples than I had expected. Perhaps `bail_if_changed` and `extensions.wrap_function` are some of the more frequently used. But most very commonly used functions seem to have short names already. So maybe even if we wanted to eventually make it consistent, it won't be as bad as people have feared? I still don't feel very strongly, but I wanted to highlight what it would mean in practice. REPOSITORY rHG Mercurial REVISION DETAIL https://phab.mercurial-scm.org/D2010 To: indygreg, #hg-reviewers, pulkit, durin42 Cc: martinvonz, av6, yuja, durin42, pulkit, mercurial-devel ___ Mercurial-devel mailing list Mercurial-devel@mercurial-scm.org https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel
[Bug 6102] New: Interactive commit bypasses the dirty subrepo check without -S
https://bz.mercurial-scm.org/show_bug.cgi?id=6102 Bug ID: 6102 Summary: Interactive commit bypasses the dirty subrepo check without -S Product: Mercurial Version: 4.6.1 Hardware: All OS: All Status: UNCONFIRMED Severity: bug Priority: normal Component: Mercurial Assignee: bugzi...@mercurial-scm.org Reporter: matt_harbi...@yahoo.com CC: mercurial-devel@mercurial-scm.org A commit with a dirty subrepo without -S normally aborts with a message about the dirty subrepo. The --interactive switch doesn't check this, and doesn't recurse either if -S is given. So the net effect is that the subrepos are "silently" left uncommitted in either case. Silent in scare quotes because each file to be committed is cycled through, but that's a lot to keep track of and notice what *wasn't* offered if there are a lot of diffs. -- 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
D6123: similar: add condition to avoid Zerodivisonerror in function _score() (issue6099)
akshjain.jain74 updated this revision to Diff 14508. akshjain.jain74 marked 2 inline comments as done. REPOSITORY rHG Mercurial CHANGES SINCE LAST UPDATE https://phab.mercurial-scm.org/D6123?vs=14487=14508 REVISION DETAIL https://phab.mercurial-scm.org/D6123 AFFECTED FILES mercurial/similar.py CHANGE DETAILS diff --git a/mercurial/similar.py b/mercurial/similar.py --- a/mercurial/similar.py +++ b/mercurial/similar.py @@ -63,7 +63,9 @@ equal += len(line) lengths = len(text) + len(orig) -return equal * 2.0 / lengths +if lengths: +return equal * 2.0 / lengths +return 0 def score(fctx1, fctx2): return _score(fctx1, _ctxdata(fctx2)) To: akshjain.jain74, durin42, #hg-reviewers Cc: av6, pulkit, mercurial-devel ___ Mercurial-devel mailing list Mercurial-devel@mercurial-scm.org https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel
D6123: similar: add condition to avoid Zerodivisonerror in function _score() (issue6099)
akshjain.jain74 added inline comments. INLINE COMMENTS > pulkit wrote in similar.py:68 > no need for this else. you can `return 0` without else. yes actually  i did'nt noticed that REPOSITORY rHG Mercurial REVISION DETAIL https://phab.mercurial-scm.org/D6123 To: akshjain.jain74, durin42, #hg-reviewers Cc: av6, pulkit, mercurial-devel ___ Mercurial-devel mailing list Mercurial-devel@mercurial-scm.org https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel
D6127: split: use the new movedirstate() we now have in scmutil
martinvonz marked an inline comment as done. martinvonz added inline comments. INLINE COMMENTS > pulkit wrote in test-removeemptydirs.t:269 > Do we have other tests covering such cases? > > This test might be helpful in future for someone changing some behavior > around the dirstate handling code. Not for split. It just doesn't happen anymore, because split no longer touches the working directory. We have other tests for removed directories in this file. REPOSITORY rHG Mercurial REVISION DETAIL https://phab.mercurial-scm.org/D6127 To: martinvonz, #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] repoview: introduce "served-obsolete" filter for serving obsolete changesets
On Tue, Mar 5, 2019 at 9:00 AM Anton Shestakov wrote: > # HG changeset patch > # User Anton Shestakov > # Date 1551763152 -28800 > # Tue Mar 05 13:19:12 2019 +0800 > # Node ID b6636687c713bf3c4b4c246b0e8759061d6e6742 > # Parent 82d9728ace9535057d77df6c920385861ec00072 > repoview: introduce "served-obsolete" filter for serving obsolete > changesets > > This filter allows viewing and pulling obsolete changesets (e.g. through > hgweb), but still doesn't allow secret commits to be seen. In other words, > this > is "served" plus obsolete commits, hence the name. > Is this also equivalent to (unfiltered-secret) commits? ___ Mercurial-devel mailing list Mercurial-devel@mercurial-scm.org https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel
D6038: push: added clear warning message when pushing closed branches(issue6080)
taapas1128 updated this revision to Diff 14507. taapas1128 retitled this revision from "push: added clear warning message when pushing a closed branch(issue6080)" to "push: added clear warning message when pushing closed branches(issue6080)". REPOSITORY rHG Mercurial CHANGES SINCE LAST UPDATE https://phab.mercurial-scm.org/D6038?vs=14506=14507 REVISION DETAIL https://phab.mercurial-scm.org/D6038 AFFECTED FILES mercurial/discovery.py tests/test-push-warn.t CHANGE DETAILS diff --git a/tests/test-push-warn.t b/tests/test-push-warn.t --- a/tests/test-push-warn.t +++ b/tests/test-push-warn.t @@ -791,3 +791,39 @@ [255] $ cd .. + +Test regarding pushing of closed branch/branches(Issue6080) + + $ hg init x + $ cd x + $ hg -q branch a + $ echo 0 > foo + $ hg -q ci -Am 0 + $ hg -q up 0 + $ cd .. + + $ hg -q clone x z + $ cd z + + $ hg -q branch foo + $ echo 0 > foo + $ hg -q ci -Am 0 + $ hg ci --close-branch -m 'closing branch foo' + $ hg -q up 0 + $ hg push ../x + pushing to ../x + searching for changes + abort: push creates new remote branches: foo (1 closed)! + (use 'hg push --new-branch' to create new remote branches) + [255] + $ hg -q branch bar + $ echo 0 > bar + $ hg -q ci -Am 0 + $ hg ci --close-branch -m 'closing branch bar' + $ hg -q up 0 + $ hg push ../x + pushing to ../x + searching for changes + abort: push creates new remote branches: bar, foo (2 closed)! + (use 'hg push --new-branch' to create new remote branches) + [255] diff --git a/mercurial/discovery.py b/mercurial/discovery.py --- a/mercurial/discovery.py +++ b/mercurial/discovery.py @@ -344,13 +344,22 @@ pushop.pushbranchmap = headssum newbranches = [branch for branch, heads in headssum.iteritems() if heads[0] is None] +# Makes a list of closed branches +closedbranches = [] +for tag, heads, tip, isclosed in repo.branchmap().iterbranches(): +if isclosed == True: +closedbranches.append((tag)) +closedbranches = list(set(closedbranches) & set(newbranches)) # 1. Check for new branches on the remote. if newbranches and not newbranch: # new branch requires --new-branch branchnames = ', '.join(sorted(newbranches)) -raise error.Abort(_("push creates new remote branches: %s!") - % branchnames, - hint=_("use 'hg push --new-branch' to create" -" new remote branches")) +if len(closedbranches) > 0: +errmsg = (_("push creates new remote branches: %s (%d closed)!") +% (branchnames, len(closedbranches))) +else: +errmsg = (_("push creates new remote branches: %s!")% branchnames) +hint=_("use 'hg push --new-branch' to create new remote branches") +raise error.Abort(errmsg, hint=hint) # 2. Find heads that we need not warn about nowarnheads = _nowarnheads(pushop) To: taapas1128, #hg-reviewers Cc: pulkit, mharbison72, mercurial-devel ___ Mercurial-devel mailing list Mercurial-devel@mercurial-scm.org https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel
D6038: push: added clear warning message when pushing a closed branch(issue6080)
taapas1128 marked 3 inline comments as done. taapas1128 added a comment. @pulkit done. REPOSITORY rHG Mercurial REVISION DETAIL https://phab.mercurial-scm.org/D6038 To: taapas1128, #hg-reviewers Cc: pulkit, mharbison72, mercurial-devel ___ Mercurial-devel mailing list Mercurial-devel@mercurial-scm.org https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel
D6038: push: added clear warning message when pushing a closed branch(issue6080)
taapas1128 updated this revision to Diff 14506. REPOSITORY rHG Mercurial CHANGES SINCE LAST UPDATE https://phab.mercurial-scm.org/D6038?vs=14412=14506 REVISION DETAIL https://phab.mercurial-scm.org/D6038 AFFECTED FILES mercurial/discovery.py tests/test-push-warn.t CHANGE DETAILS diff --git a/tests/test-push-warn.t b/tests/test-push-warn.t --- a/tests/test-push-warn.t +++ b/tests/test-push-warn.t @@ -791,3 +791,39 @@ [255] $ cd .. + +Test regarding pushing of a closed branch(Issue6080) + + $ hg init x + $ cd x + $ hg -q branch a + $ echo 0 > foo + $ hg -q ci -Am 0 + $ hg -q up 0 + $ cd .. + + $ hg -q clone x z + $ cd z + + $ hg -q branch foo + $ echo 0 > foo + $ hg -q ci -Am 0 + $ hg ci --close-branch -m 'closing branch foo' + $ hg -q up 0 + $ hg push ../x + pushing to ../x + searching for changes + abort: push creates new remote branches: foo (1 closed)! + (use 'hg push --new-branch' to create new remote branches) + [255] + $ hg -q branch bar + $ echo 0 > bar + $ hg -q ci -Am 0 + $ hg ci --close-branch -m 'closing branch bar' + $ hg -q up 0 + $ hg push ../x + pushing to ../x + searching for changes + abort: push creates new remote branches: bar, foo (2 closed)! + (use 'hg push --new-branch' to create new remote branches) + [255] diff --git a/mercurial/discovery.py b/mercurial/discovery.py --- a/mercurial/discovery.py +++ b/mercurial/discovery.py @@ -344,13 +344,22 @@ pushop.pushbranchmap = headssum newbranches = [branch for branch, heads in headssum.iteritems() if heads[0] is None] +# Makes a list of closed branches +closedbranches = [] +for tag, heads, tip, isclosed in repo.branchmap().iterbranches(): +if isclosed == True: +closedbranches.append((tag)) +closedbranches = list(set(closedbranches) & set(newbranches)) # 1. Check for new branches on the remote. if newbranches and not newbranch: # new branch requires --new-branch branchnames = ', '.join(sorted(newbranches)) -raise error.Abort(_("push creates new remote branches: %s!") - % branchnames, - hint=_("use 'hg push --new-branch' to create" -" new remote branches")) +if len(closedbranches) > 0: +errmsg = (_("push creates new remote branches: %s (%d closed)!") +% (branchnames, len(closedbranches))) +else: +errmsg = (_("push creates new remote branches: %s!")% branchnames) +hint=_("use 'hg push --new-branch' to create new remote branches") +raise error.Abort(errmsg, hint=hint) # 2. Find heads that we need not warn about nowarnheads = _nowarnheads(pushop) To: taapas1128, #hg-reviewers Cc: pulkit, mharbison72, mercurial-devel ___ Mercurial-devel mailing list Mercurial-devel@mercurial-scm.org https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel
D6123: similar: add condition to avoid Zerodivisonerror in function _score() (issue6099)
akshjain.jain74 added a comment. thanks for the review REPOSITORY rHG Mercurial REVISION DETAIL https://phab.mercurial-scm.org/D6123 To: akshjain.jain74, durin42, #hg-reviewers Cc: av6, pulkit, mercurial-devel ___ Mercurial-devel mailing list Mercurial-devel@mercurial-scm.org https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel
D6123: similar: add condition to avoid Zerodivisonerror in function _score() (issue6099)
akshjain.jain74 added a comment. In https://phab.mercurial-scm.org/D6123#89410, @pulkit wrote: > Can you try to add a test for this? yes i can definitely try to add test for this REPOSITORY rHG Mercurial REVISION DETAIL https://phab.mercurial-scm.org/D6123 To: akshjain.jain74, durin42, #hg-reviewers Cc: av6, pulkit, mercurial-devel ___ Mercurial-devel mailing list Mercurial-devel@mercurial-scm.org https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel
D6127: split: use the new movedirstate() we now have in scmutil
pulkit added inline comments. INLINE COMMENTS > test-removeemptydirs.t:269 > - > -Testing `hg split` being run from inside of a directory that was created in > the > -commit being split: Do we have other tests covering such cases? This test might be helpful in future for someone changing some behavior around the dirstate handling code. REPOSITORY rHG Mercurial REVISION DETAIL https://phab.mercurial-scm.org/D6127 To: martinvonz, #hg-reviewers Cc: pulkit, mercurial-devel ___ Mercurial-devel mailing list Mercurial-devel@mercurial-scm.org https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel
D6133: rebase: fix crash with in-memory rebase and copies
This revision was automatically updated to reflect the committed changes. Closed by commit rHGe1ceefab9bca: rebase: fix crash with in-memory rebase and copies (authored by martinvonz, committed by ). REPOSITORY rHG Mercurial CHANGES SINCE LAST UPDATE https://phab.mercurial-scm.org/D6133?vs=14496=14505 REVISION DETAIL https://phab.mercurial-scm.org/D6133 AFFECTED FILES mercurial/context.py tests/test-rebase-inmemory.t CHANGE DETAILS diff --git a/tests/test-rebase-inmemory.t b/tests/test-rebase-inmemory.t --- a/tests/test-rebase-inmemory.t +++ b/tests/test-rebase-inmemory.t @@ -756,5 +756,7 @@ | o 0: b173517d0057 'a' - $ hg rebase -b 5 -d tip 2>&1 | grep '** ProgrammingError' - ** ProgrammingError: markcopied() called on clean context + $ hg rebase -b 5 -d tip + rebasing 3:ca58782ad1e4 "b" + rebasing 5:71cb43376053 "merge" + note: not rebasing 5:71cb43376053 "merge", its destination already has all its changes diff --git a/mercurial/context.py b/mercurial/context.py --- a/mercurial/context.py +++ b/mercurial/context.py @@ -1891,10 +1891,8 @@ return self._wrappedctx[path].date() def markcopied(self, path, origin): -if self.isdirty(path): -self._cache[path]['copied'] = origin -else: -raise error.ProgrammingError('markcopied() called on clean context') +self._markdirty(path, exists=True, date=self.filedate(path), +flags=self.flags(path), copied=origin) def copydata(self, path): if self.isdirty(path): @@ -2098,7 +2096,8 @@ del self._cache[path] return keys -def _markdirty(self, path, exists, data=None, date=None, flags=''): +def _markdirty(self, path, exists, data=None, date=None, flags='', +copied=None): # data not provided, let's see if we already have some; if not, let's # grab it from our underlying context, so that we always have data if # the file is marked as existing. @@ -2111,7 +2110,7 @@ 'data': data, 'date': date, 'flags': flags, -'copied': None, +'copied': copied, } def filectx(self, path, filelog=None): To: martinvonz, #hg-reviewers, pulkit Cc: mercurial-devel ___ Mercurial-devel mailing list Mercurial-devel@mercurial-scm.org https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel
D6132: test: demonstrate crash with in-memory rebase and copies
This revision was automatically updated to reflect the committed changes. Closed by commit rHGdd1ab72be983: test: demonstrate crash with in-memory rebase and copies (authored by martinvonz, committed by ). REPOSITORY rHG Mercurial CHANGES SINCE LAST UPDATE https://phab.mercurial-scm.org/D6132?vs=14495=14504 REVISION DETAIL https://phab.mercurial-scm.org/D6132 AFFECTED FILES tests/test-rebase-inmemory.t CHANGE DETAILS diff --git a/tests/test-rebase-inmemory.t b/tests/test-rebase-inmemory.t --- a/tests/test-rebase-inmemory.t +++ b/tests/test-rebase-inmemory.t @@ -718,3 +718,43 @@ diff --git a/foo.txt b/foo.txt old mode 100644 new mode 100755 + +Test rebasing a commit with copy information, but no content changes + + $ cd .. + $ hg clone -q repo1 merge-and-rename + $ cd merge-and-rename + $ cat << EOF >> .hg/hgrc + > [experimental] + > evolution.createmarkers=True + > evolution.allowunstable=True + > EOF + $ hg co -q 1 + $ hg mv d e + $ hg ci -qm 'rename d to e' + $ hg co -q 3 + $ hg merge -q 4 + $ hg ci -m 'merge' + $ hg co -q 2 + $ mv d e + $ hg addremove -qs 0 + $ hg ci -qm 'untracked rename of d to e' + $ hg debugobsolete -q `hg log -T '{node}' -r 4` `hg log -T '{node}' -r .` + 1 new orphan changesets + $ hg tglog + @ 6: 676538af172d 'untracked rename of d to e' + | + | *5: 71cb43376053 'merge' + | |\ + | | x 4: 2c8b5dad7956 'rename d to e' + | | | + | o | 3: ca58782ad1e4 'b' + |/ / + o / 2: 814f6bd05178 'c' + |/ + o 1: 02952614a83d 'd' + | + o 0: b173517d0057 'a' + + $ hg rebase -b 5 -d tip 2>&1 | grep '** ProgrammingError' + ** ProgrammingError: markcopied() called on clean context To: martinvonz, #hg-reviewers, pulkit Cc: mercurial-devel ___ Mercurial-devel mailing list Mercurial-devel@mercurial-scm.org https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel
D6098: wix: restore COPYING.rtf
pulkit added a comment. I applied this locally and did `hg diff -c . --git --binary` locally and the output is empty. Not sure what's broken here. REPOSITORY rHG Mercurial REVISION DETAIL https://phab.mercurial-scm.org/D6098 To: indygreg, #hg-reviewers Cc: pulkit, mercurial-devel ___ Mercurial-devel mailing list Mercurial-devel@mercurial-scm.org https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel
D6123: similar: add condition to avoid Zerodivisonerror in function _score() (issue6099)
pulkit added a comment. Can you try to add a test for this? INLINE COMMENTS > similar.py:66 > lengths = len(text) + len(orig) > -return equal * 2.0 / lengths > +if lengths != 0: > +return equal * 2.0 / lengths we can do `if lengths:` here. > similar.py:68 > +return equal * 2.0 / lengths > +else: > +return 0 no need for this else. you can `return 0` without else. REPOSITORY rHG Mercurial REVISION DETAIL https://phab.mercurial-scm.org/D6123 To: akshjain.jain74, durin42, #hg-reviewers Cc: av6, pulkit, mercurial-devel ___ Mercurial-devel mailing list Mercurial-devel@mercurial-scm.org https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel
D6038: push: added clear warning message when pushing a closed branch(issue6080)
taapas1128 added inline comments. INLINE COMMENTS > pulkit wrote in discovery.py:358 > > But maybe "(%d closed)" % len(closedbranches) will make it less ambiguous > > This is a nice idea. Let's do it this way. What do you think? okay i will update the patch . REPOSITORY rHG Mercurial REVISION DETAIL https://phab.mercurial-scm.org/D6038 To: taapas1128, #hg-reviewers Cc: pulkit, mharbison72, mercurial-devel ___ Mercurial-devel mailing list Mercurial-devel@mercurial-scm.org https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel
D2010: check-commit: allow foo_bar naming in functions
pulkit added a comment. In https://phab.mercurial-scm.org/D2010#89337, @indygreg wrote: > Should we queue this patch or abandon it? I wanted to have underscores in names but reading @yuja and @av6 comments about inconsistency, I feel maybe it's not a good idea. REPOSITORY rHG Mercurial REVISION DETAIL https://phab.mercurial-scm.org/D2010 To: indygreg, #hg-reviewers, pulkit, durin42 Cc: av6, yuja, durin42, pulkit, mercurial-devel ___ Mercurial-devel mailing list Mercurial-devel@mercurial-scm.org https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel
D6056: patch: stop aborting when add/rename/copy files on --interactive (issue5727)
pulkit added inline comments. INLINE COMMENTS > test-mq-qrefresh.t:570 > + new file mode 100644 > + examine changes to 'foo.h'? [Ynesfdaq?] y > + does this prompt ended here? it didn't show changes in 'foo.h'? REPOSITORY rHG Mercurial REVISION DETAIL https://phab.mercurial-scm.org/D6056 To: navaneeth.suresh, #hg-reviewers Cc: pulkit, mercurial-devel ___ Mercurial-devel mailing list Mercurial-devel@mercurial-scm.org https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel
D6038: push: added clear warning message when pushing a closed branch(issue6080)
pulkit added inline comments. INLINE COMMENTS > discovery.py:351 > +if isclosed == True: > +closedbranches.append((tag)) > + This is calculating all the closed branches in a repo. We need to find the closed branches which are in the newbranches list. > mharbison72 wrote in discovery.py:358 > I had assumed from the bug report that the request was to annotate each > closed branch as closed, so I interpreted the output incorrectly. It might > be too much output to put `(closed)` after each closed branch in the list if > it is long. But maybe `"(%d closed)" % len(closedbranches)` will make it > less ambiguous? See what others think. > But maybe "(%d closed)" % len(closedbranches) will make it less ambiguous This is a nice idea. Let's do it this way. What do you think? REPOSITORY rHG Mercurial REVISION DETAIL https://phab.mercurial-scm.org/D6038 To: taapas1128, #hg-reviewers Cc: pulkit, mharbison72, mercurial-devel ___ Mercurial-devel mailing list Mercurial-devel@mercurial-scm.org https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel
Re: [PATCH 1 of 8 "] manifestcache: test and fix some output of the debug command
On Fri, Mar 15, 2019 at 2:49 PM Pierre-Yves David < pierre-yves.da...@ens-lyon.org> wrote: > # HG changeset patch > # User Pierre-Yves David > # Date 1552554678 0 > # Thu Mar 14 09:11:18 2019 + > # Node ID 9cad39da136fbe2e4c2023e6407847bd67b96041 > # Parent 2b21c7fbb3a109dab329df8f6e79987cebbcb4de > # EXP-Topic manifestcache > # Available At https://bitbucket.org/octobus/mercurial-devel/ > # hg pull https://bitbucket.org/octobus/mercurial-devel/ -r > 9cad39da136f > manifestcache: test and fix some output of the debug command > > The message was lacking an end of line. In addition we do not capitalize > output > in Mercurial. > Queued the series. Many thanks! ___ Mercurial-devel mailing list Mercurial-devel@mercurial-scm.org https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel
[PATCH 6 of 8 "] manifestcache: adding a second distinct entry
# HG changeset patch # User Pierre-Yves David # Date 1552554747 0 # Thu Mar 14 09:12:27 2019 + # Node ID 87c06c6f7e62897a14bd4e2291d0ff805f689848 # Parent 9ff234990740cd884689f1252dc6e7ec487b4c10 # EXP-Topic manifestcache # Available At https://bitbucket.org/octobus/mercurial-devel/ # hg pull https://bitbucket.org/octobus/mercurial-devel/ -r 87c06c6f7e62 manifestcache: adding a second distinct entry Let makes sure the cache can hold multiple value. diff --git a/tests/test-manifest.t b/tests/test-manifest.t --- a/tests/test-manifest.t +++ b/tests/test-manifest.t @@ -124,3 +124,12 @@ Check we don't duplicated entry (added f cache contains 1 manifest entries, in order of most to least recent: id: 1e01206b1d2f72bd55f2a33fa8ccad74144825b7, size 133 bytes total cache data size 157 bytes, on-disk 157 bytes + +Adding a second entry + + $ hg debugmanifestfulltextcache --add fce2a30dedad1eef4da95ca1dc0004157aa527cf + $ hg debugmanifestfulltextcache + cache contains 2 manifest entries, in order of most to least recent: + id: fce2a30dedad1eef4da95ca1dc0004157aa527cf, size 87 bytes + id: 1e01206b1d2f72bd55f2a33fa8ccad74144825b7, size 133 bytes + total cache data size 268 bytes, on-disk 268 bytes ___ Mercurial-devel mailing list Mercurial-devel@mercurial-scm.org https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel
[PATCH 8 of 8 "] manifestcache: actually honor --clear
# HG changeset patch # User Pierre-Yves David # Date 1552554766 0 # Thu Mar 14 09:12:46 2019 + # Node ID 8af71b30c498ab0cdd3f5553e9a9dba2de68861d # Parent 01b0e1930dd902040648343e0908ee6be75552d3 # EXP-Topic manifestcache # Available At https://bitbucket.org/octobus/mercurial-devel/ # hg pull https://bitbucket.org/octobus/mercurial-devel/ -r 8af71b30c498 manifestcache: actually honor --clear Before this change, the --clear flag was not clearing the on disk cache. (We also remove the extra verbosity when using --clear. Same as what we did for --add) diff --git a/mercurial/debugcommands.py b/mercurial/debugcommands.py --- a/mercurial/debugcommands.py +++ b/mercurial/debugcommands.py @@ -1478,7 +1478,8 @@ def debugmanifestfulltextcache(ui, repo, if opts.get(r'clear'): with repo.lock(): cache = getcache() -cache.clear() +cache.clear(clear_persisted_data=True) +return if add: with repo.lock(): diff --git a/tests/test-manifest.t b/tests/test-manifest.t --- a/tests/test-manifest.t +++ b/tests/test-manifest.t @@ -142,3 +142,9 @@ Accessing the initial entry again, refre id: 1e01206b1d2f72bd55f2a33fa8ccad74144825b7, size 133 bytes id: fce2a30dedad1eef4da95ca1dc0004157aa527cf, size 87 bytes total cache data size 268 bytes, on-disk 268 bytes + +Check cache clearing + + $ hg debugmanifestfulltextcache --clear + $ hg debugmanifestfulltextcache + cache empty ___ Mercurial-devel mailing list Mercurial-devel@mercurial-scm.org https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel
[PATCH 3 of 8 "] manifestcache: only lock the repository if the debug command touch the cache
# HG changeset patch # User Pierre-Yves David # Date 1552560181 0 # Thu Mar 14 10:43:01 2019 + # Node ID 6c6d0a2d336f2da651863b981bfc071adaa19c46 # Parent c6026351ed8758dc931f5caf04dfe2b77d31cd7a # EXP-Topic manifestcache # Available At https://bitbucket.org/octobus/mercurial-devel/ # hg pull https://bitbucket.org/octobus/mercurial-devel/ -r 6c6d0a2d336f manifestcache: only lock the repository if the debug command touch the cache Not doing so had two consequences: 1) the command cannot be run on read only repositories, 2) when using --add on an empty cache, the command crash prematurely trying to read the cache file on disk. diff --git a/mercurial/debugcommands.py b/mercurial/debugcommands.py --- a/mercurial/debugcommands.py +++ b/mercurial/debugcommands.py @@ -1465,45 +1465,50 @@ def debuglocks(ui, repo, **opts): ], '') def debugmanifestfulltextcache(ui, repo, add=None, **opts): """show, clear or amend the contents of the manifest fulltext cache""" -with repo.lock(): + +def getcache(): r = repo.manifestlog.getstorage(b'') try: -cache = r._fulltextcache +return r._fulltextcache except AttributeError: -ui.warn(_( -"Current revlog implementation doesn't appear to have a " -'manifest fulltext cache\n')) -return - -if opts.get(r'clear'): +msg = _("Current revlog implementation doesn't appear to have a " +"manifest fulltext cache\n") +raise error.Abort(msg) + +if opts.get(r'clear'): +with repo.lock(): +cache = getcache() cache.clear() -if add: +if add: +with repo.lock(): try: -manifest = repo.manifestlog[r.lookup(add)] +m = repo.manifestlog +manifest = m[m.getstorage(b'').lookup(add)] except error.LookupError as e: raise error.Abort(e, hint="Check your manifest node id") manifest.read() # stores revisision in cache too -if not len(cache): -ui.write(_('cache empty\n')) -else: -ui.write( -_('cache contains %d manifest entries, in order of most to ' - 'least recent:\n') % (len(cache),)) -totalsize = 0 -for nodeid in cache: -# Use cache.get to not update the LRU order -data = cache.get(nodeid) -size = len(data) -totalsize += size + 24 # 20 bytes nodeid, 4 bytes size -ui.write(_('id: %s, size %s\n') % ( -hex(nodeid), util.bytecount(size))) -ondisk = cache._opener.stat('manifestfulltextcache').st_size -ui.write( -_('total cache data size %s, on-disk %s\n') % ( -util.bytecount(totalsize), util.bytecount(ondisk)) -) +cache = getcache() +if not len(cache): +ui.write(_('cache empty\n')) +else: +ui.write( +_('cache contains %d manifest entries, in order of most to ' + 'least recent:\n') % (len(cache),)) +totalsize = 0 +for nodeid in cache: +# Use cache.get to not update the LRU order +data = cache.get(nodeid) +size = len(data) +totalsize += size + 24 # 20 bytes nodeid, 4 bytes size +ui.write(_('id: %s, size %s\n') % ( +hex(nodeid), util.bytecount(size))) +ondisk = cache._opener.stat('manifestfulltextcache').st_size +ui.write( +_('total cache data size %s, on-disk %s\n') % ( +util.bytecount(totalsize), util.bytecount(ondisk)) +) @command('debugmergestate', [], '') def debugmergestate(ui, repo, *args): diff --git a/tests/test-manifest.t b/tests/test-manifest.t --- a/tests/test-manifest.t +++ b/tests/test-manifest.t @@ -107,3 +107,15 @@ Showing the content of the caches after $ hg debugmanifestfulltextcache cache empty + +Adding a new persistent entry in the cache + + $ hg debugmanifestfulltextcache --add 1e01206b1d2f72bd55f2a33fa8ccad74144825b7 + cache contains 1 manifest entries, in order of most to least recent: + id: 1e01206b1d2f72bd55f2a33fa8ccad74144825b7, size 133 bytes + total cache data size 157 bytes, on-disk 157 bytes + + $ hg debugmanifestfulltextcache + cache contains 1 manifest entries, in order of most to least recent: + id: 1e01206b1d2f72bd55f2a33fa8ccad74144825b7, size 133 bytes + total cache data size 157 bytes, on-disk 157 bytes ___ Mercurial-devel mailing list Mercurial-devel@mercurial-scm.org https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel
[PATCH 7 of 8 "] manifestcache: make sure the entry are ordered by access time
# HG changeset patch # User Pierre-Yves David # Date 1552561133 0 # Thu Mar 14 10:58:53 2019 + # Node ID 01b0e1930dd902040648343e0908ee6be75552d3 # Parent 87c06c6f7e62897a14bd4e2291d0ff805f689848 # EXP-Topic manifestcache # Available At https://bitbucket.org/octobus/mercurial-devel/ # hg pull https://bitbucket.org/octobus/mercurial-devel/ -r 01b0e1930dd9 manifestcache: make sure the entry are ordered by access time This is an LRU cache, let us make sure of that. diff --git a/tests/test-manifest.t b/tests/test-manifest.t --- a/tests/test-manifest.t +++ b/tests/test-manifest.t @@ -133,3 +133,12 @@ Adding a second entry id: fce2a30dedad1eef4da95ca1dc0004157aa527cf, size 87 bytes id: 1e01206b1d2f72bd55f2a33fa8ccad74144825b7, size 133 bytes total cache data size 268 bytes, on-disk 268 bytes + +Accessing the initial entry again, refresh their order + + $ hg debugmanifestfulltextcache --add 1e01206b1d2f72bd55f2a33fa8ccad74144825b7 + $ hg debugmanifestfulltextcache + cache contains 2 manifest entries, in order of most to least recent: + id: 1e01206b1d2f72bd55f2a33fa8ccad74144825b7, size 133 bytes + id: fce2a30dedad1eef4da95ca1dc0004157aa527cf, size 87 bytes + total cache data size 268 bytes, on-disk 268 bytes ___ Mercurial-devel mailing list Mercurial-devel@mercurial-scm.org https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel
[PATCH 5 of 8 "] manifestcache: test that adding the same entry twice do not duplicates it
# HG changeset patch # User Pierre-Yves David # Date 1552560808 0 # Thu Mar 14 10:53:28 2019 + # Node ID 9ff234990740cd884689f1252dc6e7ec487b4c10 # Parent fb4ea9c2a37dc63b0093cbd9a512b5921128f812 # EXP-Topic manifestcache # Available At https://bitbucket.org/octobus/mercurial-devel/ # hg pull https://bitbucket.org/octobus/mercurial-devel/ -r 9ff234990740 manifestcache: test that adding the same entry twice do not duplicates it Simple sanity check. diff --git a/tests/test-manifest.t b/tests/test-manifest.t --- a/tests/test-manifest.t +++ b/tests/test-manifest.t @@ -116,3 +116,11 @@ Adding a new persistent entry in the cac cache contains 1 manifest entries, in order of most to least recent: id: 1e01206b1d2f72bd55f2a33fa8ccad74144825b7, size 133 bytes total cache data size 157 bytes, on-disk 157 bytes + +Check we don't duplicated entry (added from the debug command) + + $ hg debugmanifestfulltextcache --add 1e01206b1d2f72bd55f2a33fa8ccad74144825b7 + $ hg debugmanifestfulltextcache + cache contains 1 manifest entries, in order of most to least recent: + id: 1e01206b1d2f72bd55f2a33fa8ccad74144825b7, size 133 bytes + total cache data size 157 bytes, on-disk 157 bytes ___ Mercurial-devel mailing list Mercurial-devel@mercurial-scm.org https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel
[PATCH 4 of 8 "] manifestcache: do not display data when using --add
# HG changeset patch # User Pierre-Yves David # Date 1552554701 0 # Thu Mar 14 09:11:41 2019 + # Node ID fb4ea9c2a37dc63b0093cbd9a512b5921128f812 # Parent 6c6d0a2d336f2da651863b981bfc071adaa19c46 # EXP-Topic manifestcache # Available At https://bitbucket.org/octobus/mercurial-devel/ # hg pull https://bitbucket.org/octobus/mercurial-devel/ -r fb4ea9c2a37d manifestcache: do not display data when using --add If the command invocation is about adding a new entry, we should remain terse (the same as we do for many commands). diff --git a/mercurial/debugcommands.py b/mercurial/debugcommands.py --- a/mercurial/debugcommands.py +++ b/mercurial/debugcommands.py @@ -1488,6 +1488,7 @@ def debugmanifestfulltextcache(ui, repo, except error.LookupError as e: raise error.Abort(e, hint="Check your manifest node id") manifest.read() # stores revisision in cache too +return cache = getcache() if not len(cache): diff --git a/tests/test-manifest.t b/tests/test-manifest.t --- a/tests/test-manifest.t +++ b/tests/test-manifest.t @@ -111,9 +111,6 @@ Showing the content of the caches after Adding a new persistent entry in the cache $ hg debugmanifestfulltextcache --add 1e01206b1d2f72bd55f2a33fa8ccad74144825b7 - cache contains 1 manifest entries, in order of most to least recent: - id: 1e01206b1d2f72bd55f2a33fa8ccad74144825b7, size 133 bytes - total cache data size 157 bytes, on-disk 157 bytes $ hg debugmanifestfulltextcache cache contains 1 manifest entries, in order of most to least recent: ___ Mercurial-devel mailing list Mercurial-devel@mercurial-scm.org https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel
[PATCH 1 of 8 "] manifestcache: test and fix some output of the debug command
# HG changeset patch # User Pierre-Yves David # Date 1552554678 0 # Thu Mar 14 09:11:18 2019 + # Node ID 9cad39da136fbe2e4c2023e6407847bd67b96041 # Parent 2b21c7fbb3a109dab329df8f6e79987cebbcb4de # EXP-Topic manifestcache # Available At https://bitbucket.org/octobus/mercurial-devel/ # hg pull https://bitbucket.org/octobus/mercurial-devel/ -r 9cad39da136f manifestcache: test and fix some output of the debug command The message was lacking an end of line. In addition we do not capitalize output in Mercurial. diff --git a/mercurial/debugcommands.py b/mercurial/debugcommands.py --- a/mercurial/debugcommands.py +++ b/mercurial/debugcommands.py @@ -1486,7 +1486,7 @@ def debugmanifestfulltextcache(ui, repo, manifest.read() # stores revisision in cache too if not len(cache): -ui.write(_('Cache empty')) +ui.write(_('cache empty\n')) else: ui.write( _('Cache contains %d manifest entries, in order of most to ' diff --git a/tests/test-manifest.t b/tests/test-manifest.t --- a/tests/test-manifest.t +++ b/tests/test-manifest.t @@ -93,3 +93,17 @@ The next two calls are expected to abort $ hg manifest -r tip tip abort: please specify just one revision [255] + +Testing the manifest full text cache utility + + +Reminder of the manifest log content + + $ hg log --debug | grep 'manifest:' + manifest:1:1e01206b1d2f72bd55f2a33fa8ccad74144825b7 + manifest:0:fce2a30dedad1eef4da95ca1dc0004157aa527cf + +Showing the content of the caches after the above operations + + $ hg debugmanifestfulltextcache + cache empty ___ Mercurial-devel mailing list Mercurial-devel@mercurial-scm.org https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel
[PATCH 2 of 8 "] manifestcache: further fix to debug command output
# HG changeset patch # User Pierre-Yves David # Date 1552559091 0 # Thu Mar 14 10:24:51 2019 + # Node ID c6026351ed8758dc931f5caf04dfe2b77d31cd7a # Parent 9cad39da136fbe2e4c2023e6407847bd67b96041 # EXP-Topic manifestcache # Available At https://bitbucket.org/octobus/mercurial-devel/ # hg pull https://bitbucket.org/octobus/mercurial-devel/ -r c6026351ed87 manifestcache: further fix to debug command output Removing more capital letters. The output will get a test once other issues get fixed. diff --git a/mercurial/debugcommands.py b/mercurial/debugcommands.py --- a/mercurial/debugcommands.py +++ b/mercurial/debugcommands.py @@ -1489,7 +1489,7 @@ def debugmanifestfulltextcache(ui, repo, ui.write(_('cache empty\n')) else: ui.write( -_('Cache contains %d manifest entries, in order of most to ' +_('cache contains %d manifest entries, in order of most to ' 'least recent:\n') % (len(cache),)) totalsize = 0 for nodeid in cache: @@ -1501,7 +1501,7 @@ def debugmanifestfulltextcache(ui, repo, hex(nodeid), util.bytecount(size))) ondisk = cache._opener.stat('manifestfulltextcache').st_size ui.write( -_('Total cache data size %s, on-disk %s\n') % ( +_('total cache data size %s, on-disk %s\n') % ( util.bytecount(totalsize), util.bytecount(ondisk)) ) ___ Mercurial-devel mailing list Mercurial-devel@mercurial-scm.org https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel
D6140: revset: add new contiguous(x) function for "x::x"
marmoute added a comment. I am a fan of this function, I need this on a regular basis. Having an explicit function for this also open the way to various optimization. For example we know that a set already has this property we could skip all computation. I am ambivalent about the naming however. It feels a bit odd. There are case where it could be misleading. Lets look at the following case: c e | | b d |/ a the revset `(b+c+d+e)::(b+c+d+e)` returns the same `b+c+d+e`, however the set is not "contiguous" as `b+c` and `d+e` as not connected. This feels a bit more like a "closure" operation to me. Cheers, REPOSITORY rHG Mercurial REVISION DETAIL https://phab.mercurial-scm.org/D6140 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
Re: D6140: revset: add new contiguous(x) function for "x::x"
I am a fan of this function, I need this on a regular basis. Having an explicit function for this also open the way to various optimization. For example we know that a set already has this property we could skip all computation. I am ambivalent about the naming however. It feels a bit odd. There are case where it could be misleading. Lets look at the following case: c e | | b d |/ a the revset `(b+c+d+e)::(b+c+d+e)` returns the same `b+c+d+e`, however the set is not "contiguous" as `b+c` and `d+e` as not connected. This feels a bit more like a "closure" operation to me. Cheers, On 3/15/19 6:27 AM, martinvonz (Martin von Zweigbergk) wrote: martinvonz created this revision. Herald added a subscriber: mercurial-devel. Herald added a reviewer: hg-reviewers. REVISION SUMMARY "x::x" is a useful trick for making a range contiguous, but it gets annoying if "x" is a long expression. Let's provide a simple function that helps with that. It also makes it the trick more discoverable. REPOSITORY rHG Mercurial REVISION DETAIL https://phab.mercurial-scm.org/D6140 AFFECTED FILES mercurial/revset.py tests/test-revset.t CHANGE DETAILS diff --git a/tests/test-revset.t b/tests/test-revset.t --- a/tests/test-revset.t +++ b/tests/test-revset.t @@ -1314,6 +1314,47 @@ 2 3 +test contiguous + + $ hg log -G -T '{rev}\n' --config experimental.graphshorten=True + @ 9 + o 8 + | o 7 + | o 6 + |/| + | o 5 + o | 4 + | o 3 + o | 2 + |/ + o 1 + o 0 + + $ log 'contiguous(0+2)' + 0 + 1 + 2 + $ log 'contiguous(2+0)' + 0 + 1 + 2 + $ log 'contiguous(2+3)' + 2 + 3 + $ log 'contiguous(3+2)' + 2 + 3 + $ log 'contiguous(3+7)' + 3 + 5 + 6 + 7 + $ log 'contiguous(9+3+4)' + 3 + 4 + 8 + 9 + test author $ log 'author(bob)' diff --git a/mercurial/revset.py b/mercurial/revset.py --- a/mercurial/revset.py +++ b/mercurial/revset.py @@ -714,6 +714,16 @@ return subset.filter(matches, condrepr=('', pat)) +@predicate('contiguous(set)', safe=True, takeorder=True) +def contiguous(repo, subset, x, order): +"""Changesets that have both ancestors and descendants in the set. This +effectively fills in gaps in the set to make it contiguous, without adding +new common ancestors or common descendants. + + "contiguous(x)" is identical to "x::x". +""" +return dagrange(repo, subset, x, x, order) + @predicate('converted([id])', safe=True) def converted(repo, subset, x): """Changesets converted from the given identifier in the old repository if 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 -- Pierre-Yves David ___ Mercurial-devel mailing list Mercurial-devel@mercurial-scm.org https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel
Re: D6140: revset: add new contiguous(x) function for "x::x"
I am a fan of this function, I need this on a regular basis. Having an explicit function for this also open the way to various optimization. For example we know that a set already has this property we could skip all computation. I am ambivalent about the naming however. It feels a bit odd. There are case where it could be misleading. Lets look at the following case: c e | | b d |/ a the revset `(b+c+d+e)::(b+c+d+e)` returns the same `b+c+d+e`, however the set is not "contiguous" as `b+c` and `d+e` as not connected. This feels a bit more like a "closure" operation to me. Cheers, On 3/15/19 6:27 AM, martinvonz (Martin von Zweigbergk) wrote: martinvonz created this revision. Herald added a subscriber: mercurial-devel. Herald added a reviewer: hg-reviewers. REVISION SUMMARY "x::x" is a useful trick for making a range contiguous, but it gets annoying if "x" is a long expression. Let's provide a simple function that helps with that. It also makes it the trick more discoverable. REPOSITORY rHG Mercurial REVISION DETAIL https://phab.mercurial-scm.org/D6140 AFFECTED FILES mercurial/revset.py tests/test-revset.t CHANGE DETAILS diff --git a/tests/test-revset.t b/tests/test-revset.t --- a/tests/test-revset.t +++ b/tests/test-revset.t @@ -1314,6 +1314,47 @@ 2 3 +test contiguous + + $ hg log -G -T '{rev}\n' --config experimental.graphshorten=True + @ 9 + o 8 + | o 7 + | o 6 + |/| + | o 5 + o | 4 + | o 3 + o | 2 + |/ + o 1 + o 0 + + $ log 'contiguous(0+2)' + 0 + 1 + 2 + $ log 'contiguous(2+0)' + 0 + 1 + 2 + $ log 'contiguous(2+3)' + 2 + 3 + $ log 'contiguous(3+2)' + 2 + 3 + $ log 'contiguous(3+7)' + 3 + 5 + 6 + 7 + $ log 'contiguous(9+3+4)' + 3 + 4 + 8 + 9 + test author $ log 'author(bob)' diff --git a/mercurial/revset.py b/mercurial/revset.py --- a/mercurial/revset.py +++ b/mercurial/revset.py @@ -714,6 +714,16 @@ return subset.filter(matches, condrepr=('', pat)) +@predicate('contiguous(set)', safe=True, takeorder=True) +def contiguous(repo, subset, x, order): +"""Changesets that have both ancestors and descendants in the set. This +effectively fills in gaps in the set to make it contiguous, without adding +new common ancestors or common descendants. + + "contiguous(x)" is identical to "x::x". +""" +return dagrange(repo, subset, x, x, order) + @predicate('converted([id])', safe=True) def converted(repo, subset, x): """Changesets converted from the given identifier in the old repository if 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 -- Pierre-Yves David ___ Mercurial-devel mailing list Mercurial-devel@mercurial-scm.org https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel