Re: [PATCH 1 of 2] extdiff: support tools that can be run simultaneously
> > Oh right, that's another thing I wanted to ask -- how would I test that? > > The only idea I have is to log some verbose message ("tool %s has a > > graphical interface, launching processes simultaneously") and detect that > > in test. Is there any better way? > > Something like that. Maybe you can use 'sleep x; echo y' (x/y depending on > e.g. > filename) as a merge tool to check if the tool spawns asynchronously or not, > if that improves the test coverage. I opted for the verbose trace -- I figured I didn't want to contribute to making the test suite run noticeably longer, and the tricky code to test is figuring out if we should spawn processes asynchronously or not -- not the code that actually does the spawning. -- l u d o . . 8 0 17 80 ___ Mercurial-devel mailing list Mercurial-devel@mercurial-scm.org https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel
[PATCH V2] extdiff: support tools that can be run simultaneously
# HG changeset patch # User Ludovic Chabant # Date 1549173529 28800 # Sat Feb 02 21:58:49 2019 -0800 # Node ID b8e97fbea8490173387735e72cc424c21d7a1c04 # Parent 3a3b053d0882a33ba7ea667052e445b193ffa4df extdiff: support tools that can be run simultaneously diff --git a/hgext/extdiff.py b/hgext/extdiff.py --- a/hgext/extdiff.py +++ b/hgext/extdiff.py @@ -59,6 +59,22 @@ [diff-tools] kdiff3.diffargs=--L1 '$plabel1' --L2 '$clabel' $parent $child +If a program has a graphical interface, it might be interesting to tell +Mercurial about it. It will prevent the program from being mistakenly +used in a terminal-only environment (such as an SSH terminal session), +and will make :hg:`extdiff --per-file` open multiple file diffs at once +instead of one by one (if you still want to open file diffs one by one, +you can use the --confirm option). + +Declaring that a tool has a graphical interface can be done with the +``gui`` flag next to where ``diffargs`` are specified: + +:: + + [diff-tools] + kdiff3.diffargs=--L1 '$plabel1' --L2 '$clabel' $parent $child + kdiff3.gui = true + You can use -I/-X and list of file or directory names like normal :hg:`diff` command. The extdiff extension makes snapshots of only needed files, so running the external diff program will actually be @@ -71,6 +87,7 @@ import re import shutil import stat +import subprocess from mercurial.i18n import _ from mercurial.node import ( @@ -105,11 +122,19 @@ generic=True, ) +configitem('extdiff', br'gui\..*', +generic=True, +) + configitem('diff-tools', br'.*\.diffargs$', default=None, generic=True, ) +configitem('diff-tools', br'.*\.gui$', +generic=True, +) + # Note for extension authors: ONLY specify testedwith = 'ships-with-hg-core' for # extensions which SHIP WITH MERCURIAL. Non-mainline extensions should # be specifying the version(s) of Mercurial they are tested with, or @@ -176,13 +201,26 @@ cmdline += ' $parent1 $child' return re.sub(regex, quote, cmdline) -def _runperfilediff(cmdline, repo_root, ui, do3way, confirm, +def _systembackground(cmd, environ=None, cwd=None): +''' like 'procutil.system', but returns the Popen object directly +so we don't have to wait on it. +''' +cmd = procutil.quotecommand(cmd) +env = procutil.shellenviron(environ) +proc = subprocess.Popen(procutil.tonativestr(cmd), +shell=True, close_fds=procutil.closefds, +env=procutil.tonativeenv(env), +cwd=pycompat.rapply(procutil.tonativestr, cwd)) +return proc + +def _runperfilediff(cmdline, repo_root, ui, guitool, do3way, confirm, commonfiles, tmproot, dir1a, dir1b, dir2root, dir2, rev1a, rev1b, rev2): # Note that we need to sort the list of files because it was # built in an "unstable" way and it's annoying to get files in a # random order, especially when "confirm" mode is enabled. +waitprocs = [] totalfiles = len(commonfiles) for idx, commonfile in enumerate(sorted(commonfiles)): path1a = os.path.join(tmproot, dir1a, commonfile) @@ -228,14 +266,32 @@ parent1=path1a, plabel1=label1a, parent2=path1b, plabel2=label1b, child=path2, clabel=label2) -ui.debug('running %r in %s\n' % (pycompat.bytestr(curcmdline), - tmproot)) -# Run the comparison program and wait for it to exit -# before we show the next file. -ui.system(curcmdline, cwd=tmproot, blockedtag='extdiff') +if confirm or not guitool: +# Run the comparison program and wait for it to exit +# before we show the next file. +# This is because either we need to wait for confirmation +# from the user between each invocation, or because, as far +# as we know, the tool doesn't have a GUI, in which case +# we can't run multiple CLI programs at the same time. +ui.debug('running %r in %s\n' % + (pycompat.bytestr(curcmdline), tmproot)) +ui.system(curcmdline, cwd=tmproot, blockedtag='extdiff') +else: +# Run the comparison program but don't wait, as we're +# going to rapid-fire each file diff and then wait on +# the whole group. +ui.debug('running %r in %s (backgrounded)\n' % + (pycompat.bytestr(curcmdline), tmproot)) +proc = _systembackground(curcmdline, cwd=tmproot) +waitprocs.append(proc) -def dodiff(ui, repo, cmdline, pats, opts): +if waitprocs: +with ui.timeblockedsection('extdiff'): +for proc in waitprocs: +proc.wait() + +def dodiff(ui, repo, cmdline, pats, opts, guitool=False): '''Do the actual diff: - copy to a temp structure if diffing 2 internal
D5847: largefiles: drop "rel" prefix from filename variables
martinvonz created this revision. Herald added a subscriber: mercurial-devel. Herald added a reviewer: hg-reviewers. REVISION SUMMARY The prefixes were meant to indicate that these paths are repo-relative as opposed to absolute. However, that's what the majority of paths in our code base are, so "rel" made me think they were instead cwd-relative. Let's just drop the prefixes. REPOSITORY rHG Mercurial REVISION DETAIL https://phab.mercurial-scm.org/D5847 AFFECTED FILES hgext/largefiles/lfcommands.py CHANGE DETAILS diff --git a/hgext/largefiles/lfcommands.py b/hgext/largefiles/lfcommands.py --- a/hgext/largefiles/lfcommands.py +++ b/hgext/largefiles/lfcommands.py @@ -464,27 +464,26 @@ wvfs = repo.wvfs wctx = repo[None] for lfile in lfiles: -rellfile = lfile -rellfileorig = os.path.relpath( -scmutil.origpath(ui, repo, wvfs.join(rellfile)), +lfileorig = os.path.relpath( +scmutil.origpath(ui, repo, wvfs.join(lfile)), start=repo.root) -relstandin = lfutil.standin(lfile) -relstandinorig = os.path.relpath( -scmutil.origpath(ui, repo, wvfs.join(relstandin)), +standin = lfutil.standin(lfile) +standinorig = os.path.relpath( +scmutil.origpath(ui, repo, wvfs.join(standin)), start=repo.root) -if wvfs.exists(relstandin): -if (wvfs.exists(relstandinorig) and -wvfs.exists(rellfile)): -shutil.copyfile(wvfs.join(rellfile), -wvfs.join(rellfileorig)) -wvfs.unlinkpath(relstandinorig) -expecthash = lfutil.readasstandin(wctx[relstandin]) +if wvfs.exists(standin): +if (wvfs.exists(standinorig) and +wvfs.exists(lfile)): +shutil.copyfile(wvfs.join(lfile), +wvfs.join(lfileorig)) +wvfs.unlinkpath(standinorig) +expecthash = lfutil.readasstandin(wctx[standin]) if expecthash != '': if lfile not in wctx: # not switched to normal file -if repo.dirstate[relstandin] != '?': -wvfs.unlinkpath(rellfile, ignoremissing=True) +if repo.dirstate[standin] != '?': +wvfs.unlinkpath(lfile, ignoremissing=True) else: -dropped.add(rellfile) +dropped.add(lfile) # use normallookup() to allocate an entry in largefiles # dirstate to prevent lfilesrepo.status() from reporting @@ -496,9 +495,9 @@ # lfile is added to the repository again. This happens when a # largefile is converted back to a normal file: the standin # disappears, but a new (normal) file appears as the lfile. -if (wvfs.exists(rellfile) and +if (wvfs.exists(lfile) and repo.dirstate.normalize(lfile) not in wctx): -wvfs.unlinkpath(rellfile) +wvfs.unlinkpath(lfile) removed += 1 # largefile processing might be slow and be interrupted - be prepared @@ -532,19 +531,18 @@ # copy the exec mode of largefile standin from the repository's # dirstate to its state in the lfdirstate. -rellfile = lfile -relstandin = lfutil.standin(lfile) -if wvfs.exists(relstandin): +standin = lfutil.standin(lfile) +if wvfs.exists(standin): # exec is decided by the users permissions using mask 0o100 -standinexec = wvfs.stat(relstandin).st_mode & 0o100 -st = wvfs.stat(rellfile) +standinexec = wvfs.stat(standin).st_mode & 0o100 +st = wvfs.stat(lfile) mode = st.st_mode if standinexec != mode & 0o100: # first remove all X bits, then shift all R bits to X mode &= ~0o111 if standinexec: mode |= (mode >> 2) & 0o111 & ~util.umask -wvfs.chmod(rellfile, mode) +wvfs.chmod(lfile, mode) update1 = 1 updated += update1 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
D5846: tests: add syntax warnings on Python 3.8 in python-zstandard
This revision was automatically updated to reflect the committed changes. Closed by commit rHG9f69ddb807f7: tests: add syntax warnings on Python 3.8 in python-zstandard (authored by indygreg, committed by ). REPOSITORY rHG Mercurial CHANGES SINCE LAST UPDATE https://phab.mercurial-scm.org/D5846?vs=13773=13800 REVISION DETAIL https://phab.mercurial-scm.org/D5846 AFFECTED FILES 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 @@ -32,6 +32,14 @@ > -X mercurial/thirdparty \ > | sed 's|\\|/|g' | xargs "$PYTHON" contrib/check-py3-compat.py \ > | sed 's/[0-9][0-9]*)$/*)/' + contrib/python-zstandard/tests/test_compressor.py:324: SyntaxWarning: invalid escape sequence \( (py38 !) +with self.assertRaisesRegexp(zstd.ZstdError, 'cannot call compress\(\) after compressor'): (py38 !) + contrib/python-zstandard/tests/test_compressor.py:1329: SyntaxWarning: invalid escape sequence \( (py38 !) +'cannot call compress\(\) after compression finished'): (py38 !) + contrib/python-zstandard/tests/test_compressor.py:1341: SyntaxWarning: invalid escape sequence \( (py38 !) +'cannot call flush\(\) after compression finished'): (py38 !) + contrib/python-zstandard/tests/test_compressor.py:1353: SyntaxWarning: invalid escape sequence \( (py38 !) +'cannot call finish\(\) after compression finished'): (py38 !) hgext/convert/transport.py: error importing: <*Error> No module named 'svn.client' (error at transport.py:*) (glob) (?) hgext/infinitepush/sqlindexapi.py: error importing: <*Error> No module named 'mysql' (error at sqlindexapi.py:*) (glob) (?) mercurial/scmwindows.py: error importing: _type_ 'v' not supported (error at win32.py:*) (no-windows !) 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
D5845: check-py3-compat: manually format and print warnings
This revision was automatically updated to reflect the committed changes. Closed by commit rHGba7eaff26474: check-py3-compat: manually format and print warnings (authored by indygreg, committed by ). REPOSITORY rHG Mercurial CHANGES SINCE LAST UPDATE https://phab.mercurial-scm.org/D5845?vs=13772=13799 REVISION DETAIL https://phab.mercurial-scm.org/D5845 AFFECTED FILES contrib/check-py3-compat.py CHANGE DETAILS diff --git a/contrib/check-py3-compat.py b/contrib/check-py3-compat.py --- a/contrib/check-py3-compat.py +++ b/contrib/check-py3-compat.py @@ -14,6 +14,7 @@ import os import sys import traceback +import warnings def check_compat_py2(f): """Check Python 3 compatibility for a file with Python 2""" @@ -91,6 +92,11 @@ fn = check_compat_py3 for f in sys.argv[1:]: -fn(f) +with warnings.catch_warnings(record=True) as warns: +fn(f) + +for w in warns: +print(warnings.formatwarning(w.message, w.category, + w.filename, w.lineno).rstrip()) sys.exit(0) 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
D5843: doc: escape backslash
This revision was automatically updated to reflect the committed changes. Closed by commit rHGeb14ab7db33e: doc: escape backslash (authored by indygreg, committed by ). REPOSITORY rHG Mercurial CHANGES SINCE LAST UPDATE https://phab.mercurial-scm.org/D5843?vs=13770=13797 REVISION DETAIL https://phab.mercurial-scm.org/D5843 AFFECTED FILES doc/hgmanpage.py CHANGE DETAILS diff --git a/doc/hgmanpage.py b/doc/hgmanpage.py --- a/doc/hgmanpage.py +++ b/doc/hgmanpage.py @@ -376,7 +376,7 @@ tmpl = (".TH %(title_upper)s %(manual_section)s" " \"%(date)s\" \"%(version)s\" \"%(manual_group)s\"\n" ".SH NAME\n" -"%(title)s \- %(subtitle)s\n") +"%(title)s \\- %(subtitle)s\n") return tmpl % self._docinfo def append_header(self): 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
D5844: check-py3-compat: provide filename to ast.parse()
This revision was automatically updated to reflect the committed changes. Closed by commit rHG01417ca7f2e2: check-py3-compat: provide filename to ast.parse() (authored by indygreg, committed by ). REPOSITORY rHG Mercurial CHANGES SINCE LAST UPDATE https://phab.mercurial-scm.org/D5844?vs=13771=13798 REVISION DETAIL https://phab.mercurial-scm.org/D5844 AFFECTED FILES contrib/check-py3-compat.py CHANGE DETAILS diff --git a/contrib/check-py3-compat.py b/contrib/check-py3-compat.py --- a/contrib/check-py3-compat.py +++ b/contrib/check-py3-compat.py @@ -45,7 +45,7 @@ content = fh.read() try: -ast.parse(content) +ast.parse(content, filename=f) except SyntaxError as e: print('%s: invalid syntax: %s' % (f, e)) return 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
D5842: testparseutil: escape backslash in docstring
This revision was automatically updated to reflect the committed changes. Closed by commit rHG99b4c6d73a72: testparseutil: escape backslash in docstring (authored by indygreg, committed by ). REPOSITORY rHG Mercurial CHANGES SINCE LAST UPDATE https://phab.mercurial-scm.org/D5842?vs=13769=13796 REVISION DETAIL https://phab.mercurial-scm.org/D5842 AFFECTED FILES contrib/testparseutil.py CHANGE DETAILS diff --git a/contrib/testparseutil.py b/contrib/testparseutil.py --- a/contrib/testparseutil.py +++ b/contrib/testparseutil.py @@ -265,7 +265,7 @@ class fileheredocmatcher(embeddedmatcher): """Detect "cat > FILE << LIMIT" style embedded code ->>> matcher = fileheredocmatcher(b'heredoc .py file', br'[^<]+\.py') +>>> matcher = fileheredocmatcher(b'heredoc .py file', br'[^<]+\\.py') >>> b2s(matcher.startsat(b' $ cat > file.py << EOF\\n')) ('file.py', ' > EOF\\n') >>> b2s(matcher.startsat(b' $ cat >>file.py
D5841: tests: use raw strings in test-help.t
This revision was automatically updated to reflect the committed changes. Closed by commit rHG033a0f4b4a5f: tests: use raw strings in test-help.t (authored by indygreg, committed by ). REPOSITORY rHG Mercurial CHANGES SINCE LAST UPDATE https://phab.mercurial-scm.org/D5841?vs=13768=13795 REVISION DETAIL https://phab.mercurial-scm.org/D5841 AFFECTED FILES tests/test-help.t CHANGE DETAILS diff --git a/tests/test-help.t b/tests/test-help.t --- a/tests/test-help.t +++ b/tests/test-help.t @@ -1674,7 +1674,7 @@ Test omit indicating for help $ cat > addverboseitems.py < '''extension to test omit indicating. + > r'''extension to test omit indicating. > > This paragraph is never omitted (for extension) > @@ -1687,7 +1687,7 @@ > ''' > from __future__ import absolute_import > from mercurial import commands, help - > testtopic = b"""This paragraph is never omitted (for topic). + > testtopic = br"""This paragraph is never omitted (for topic). > > .. container:: verbose > 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
D5840: tests: escape backslash in makepatch.py inline file
This revision was automatically updated to reflect the committed changes. Closed by commit rHG7295279b9ea5: tests: escape backslash in makepatch.py inline file (authored by indygreg, committed by ). REPOSITORY rHG Mercurial CHANGES SINCE LAST UPDATE https://phab.mercurial-scm.org/D5840?vs=13767=13794 REVISION DETAIL https://phab.mercurial-scm.org/D5840 AFFECTED FILES tests/test-import-eol.t tests/test-mq-eol.t CHANGE DETAILS diff --git a/tests/test-mq-eol.t b/tests/test-mq-eol.t --- a/tests/test-mq-eol.t +++ b/tests/test-mq-eol.t @@ -23,9 +23,9 @@ > w(b' c\r\n') > w(b' d\n') > w(b'-e\n') - > w(b'\ No newline at end of file\n') + > w(b'\\ No newline at end of file\n') > w(b'+z\r\n') - > w(b'\ No newline at end of file\r\n') + > w(b'\\ No newline at end of file\r\n') > EOF $ cat > cateol.py <'empty:stripped-crlf': b'\r\n'}[sys.argv[1]]) > w(b' d\n') > w(b'-e\n') - > w(b'\ No newline at end of file\n') + > w(b'\\ No newline at end of file\n') > w(b'+z\r\n') - > w(b'\ No newline at end of file\r\n') + > w(b'\\ No newline at end of file\r\n') > EOF $ hg init repo 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
D5815: global: use raw strings for regular expressions with escapes
This revision was automatically updated to reflect the committed changes. Closed by commit rHGbd3f03d8cc9f: global: use raw strings for regular expressions with escapes (authored by indygreg, committed by ). REPOSITORY rHG Mercurial CHANGES SINCE LAST UPDATE https://phab.mercurial-scm.org/D5815?vs=13742=13777 REVISION DETAIL https://phab.mercurial-scm.org/D5815 AFFECTED FILES hgext/blackbox.py hgext/commitextras.py hgext/convert/cvsps.py hgext/mq.py hgext/phabricator.py hgext/releasenotes.py mercurial/color.py mercurial/patch.py CHANGE DETAILS diff --git a/mercurial/patch.py b/mercurial/patch.py --- a/mercurial/patch.py +++ b/mercurial/patch.py @@ -638,8 +638,8 @@ return self.changed | self.removed # @@ -start,len +start,len @@ or @@ -start +start @@ if len is 1 -unidesc = re.compile('@@ -(\d+)(?:,(\d+))? \+(\d+)(?:,(\d+))? @@') -contextdesc = re.compile('(?:---|\*\*\*) (\d+)(?:,(\d+))? (?:---|\*\*\*)') +unidesc = re.compile(br'@@ -(\d+)(?:,(\d+))? \+(\d+)(?:,(\d+))? @@') +contextdesc = re.compile(br'(?:---|\*\*\*) (\d+)(?:,(\d+))? (?:---|\*\*\*)') eolmodes = ['strict', 'crlf', 'lf', 'auto'] class patchfile(object): @@ -2762,7 +2762,7 @@ return maxfile, maxtotal, addtotal, removetotal, binary def diffstatdata(lines): -diffre = re.compile('^diff .*-r [a-z0-9]+\s(.*)$') +diffre = re.compile(br'^diff .*-r [a-z0-9]+\s(.*)$') results = [] filename, adds, removes, isbinary = None, 0, 0, False diff --git a/mercurial/color.py b/mercurial/color.py --- a/mercurial/color.py +++ b/mercurial/color.py @@ -484,7 +484,7 @@ w32effects = None else: origattr = csbi.wAttributes -ansire = re.compile(b'\033\[([^m]*)m([^\033]*)(.*)', +ansire = re.compile(br'\033\[([^m]*)m([^\033]*)(.*)', re.MULTILINE | re.DOTALL) def win32print(ui, writefunc, text, **opts): diff --git a/hgext/releasenotes.py b/hgext/releasenotes.py --- a/hgext/releasenotes.py +++ b/hgext/releasenotes.py @@ -55,7 +55,7 @@ ('api', _('API Changes')), ] -RE_DIRECTIVE = re.compile('^\.\. ([a-zA-Z0-9_]+)::\s*([^$]+)?$') +RE_DIRECTIVE = re.compile(br'^\.\. ([a-zA-Z0-9_]+)::\s*([^$]+)?$') RE_ISSUE = br'\bissue ?[0-9]{4,6}(?![0-9])\b' BULLET_SECTION = _('Other Changes') diff --git a/hgext/phabricator.py b/hgext/phabricator.py --- a/hgext/phabricator.py +++ b/hgext/phabricator.py @@ -255,9 +255,9 @@ repo.ui.setconfig(b'phabricator', b'repophid', repophid) return repophid -_differentialrevisiontagre = re.compile(b'\AD([1-9][0-9]*)\Z') +_differentialrevisiontagre = re.compile(br'\AD([1-9][0-9]*)\Z') _differentialrevisiondescre = re.compile( -b'^Differential Revision:\s*(?P(?:.*)D(?P[1-9][0-9]*))$', re.M) +br'^Differential Revision:\s*(?P(?:.*)D(?P[1-9][0-9]*))$', re.M) def getoldnodedrevmap(repo, nodelist): """find previous nodes that has been sent to Phabricator diff --git a/hgext/mq.py b/hgext/mq.py --- a/hgext/mq.py +++ b/hgext/mq.py @@ -1181,7 +1181,7 @@ def makepatchname(self, title, fallbackname): """Return a suitable filename for title, adding a suffix to make it unique in the existing list""" -namebase = re.sub('[\s\W_]+', '_', title.lower()).strip('_') +namebase = re.sub(br'[\s\W_]+', b'_', title.lower()).strip(b'_') namebase = namebase[:75] # avoid too long name (issue5117) if namebase: try: diff --git a/hgext/convert/cvsps.py b/hgext/convert/cvsps.py --- a/hgext/convert/cvsps.py +++ b/hgext/convert/cvsps.py @@ -122,7 +122,7 @@ re_31 = re.compile(b'$') re_32 = re.compile(b'===' b'==$') -re_50 = re.compile(b'revision ([\\d.]+)(\s+locked by:\s+.+;)?$') +re_50 = re.compile(br'revision ([\d.]+)(\s+locked by:\s+.+;)?$') re_60 = re.compile(br'date:\s+(.+);\s+author:\s+(.+);\s+state:\s+(.+?);' br'(\s+lines:\s+(\+\d+)?\s+(-\d+)?;)?' br'(\s+commitid:\s+([^;]+);)?' diff --git a/hgext/commitextras.py b/hgext/commitextras.py --- a/hgext/commitextras.py +++ b/hgext/commitextras.py @@ -58,7 +58,7 @@ if not k: msg = _("unable to parse '%s', keys can't be empty") raise error.Abort(msg % raw) -if re.search('[^\w-]', k): +if re.search(br'[^\w-]', k): msg = _("keys can only contain ascii letters, digits," " '_' and '-'") raise error.Abort(msg) diff --git a/hgext/blackbox.py b/hgext/blackbox.py --- a/hgext/blackbox.py +++ b/hgext/blackbox.py @@ -190,7 +190,7 @@ break # count the commands by matching lines like: 2013/01/23 19:13:36 root> -if re.match('^\d{4}/\d{2}/\d{2} \d{2}:\d{2}:\d{2} .*> .*', line): +if
D5831: run-tests: set attributes in sorted order
This revision was automatically updated to reflect the committed changes. Closed by commit rHG20e62312e016: run-tests: set attributes in sorted order (authored by indygreg, committed by ). REPOSITORY rHG Mercurial CHANGES SINCE LAST UPDATE https://phab.mercurial-scm.org/D5831?vs=13758=13789 REVISION DETAIL https://phab.mercurial-scm.org/D5831 AFFECTED FILES tests/run-tests.py CHANGE DETAILS diff --git a/tests/run-tests.py b/tests/run-tests.py --- a/tests/run-tests.py +++ b/tests/run-tests.py @@ -2378,12 +2378,12 @@ timesd = dict((t[0], t[3]) for t in result.times) doc = minidom.Document() s = doc.createElement('testsuite') -s.setAttribute('name', 'run-tests') -s.setAttribute('tests', str(result.testsRun)) s.setAttribute('errors', "0") # TODO s.setAttribute('failures', str(len(result.failures))) +s.setAttribute('name', 'run-tests') s.setAttribute('skipped', str(len(result.skipped) + len(result.ignored))) +s.setAttribute('tests', str(result.testsRun)) doc.appendChild(s) for tc in result.successes: t = doc.createElement('testcase') 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
D5829: check-code: use raw string
This revision was automatically updated to reflect the committed changes. Closed by commit rHG7d1798ec92a3: check-code: use raw string (authored by indygreg, committed by ). REPOSITORY rHG Mercurial CHANGES SINCE LAST UPDATE https://phab.mercurial-scm.org/D5829?vs=13756=13788 REVISION DETAIL https://phab.mercurial-scm.org/D5829 AFFECTED FILES contrib/check-code.py CHANGE DETAILS diff --git a/contrib/check-code.py b/contrib/check-code.py --- a/contrib/check-code.py +++ b/contrib/check-code.py @@ -414,7 +414,7 @@ txtpats = [ [ -('\s$', 'trailing whitespace'), +(r'\s$', 'trailing whitespace'), ('.. note::[ \n][^\n]', 'add two newlines after note::') ], [] 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
D5828: tests: use raw strings for regular expressions with escapes
This revision was automatically updated to reflect the committed changes. Closed by commit rHGdddf53473315: tests: use raw strings for regular expressions with escapes (authored by indygreg, committed by ). REPOSITORY rHG Mercurial CHANGES SINCE LAST UPDATE https://phab.mercurial-scm.org/D5828?vs=13755=13787 REVISION DETAIL https://phab.mercurial-scm.org/D5828 AFFECTED FILES tests/hghave.py CHANGE DETAILS diff --git a/tests/hghave.py b/tests/hghave.py --- a/tests/hghave.py +++ b/tests/hghave.py @@ -722,15 +722,15 @@ @check("clang-libfuzzer", "clang new enough to include libfuzzer") def has_clang_libfuzzer(): -mat = matchoutput('clang --version', b'clang version (\d)') +mat = matchoutput('clang --version', br'clang version (\d)') if mat: # libfuzzer is new in clang 6 return int(mat.group(1)) > 5 return False @check("clang-6.0", "clang 6.0 with version suffix (libfuzzer included)") def has_clang60(): -return matchoutput('clang-6.0 --version', b'clang version 6\.') +return matchoutput('clang-6.0 --version', br'clang version 6\.') @check("xdiff", "xdiff algorithm") def has_xdiff(): @@ -811,7 +811,7 @@ # WITH clause not supported return False -return matchoutput('sqlite3 -version', b'^3\.\d+') +return matchoutput('sqlite3 -version', br'^3\.\d+') @check('vcr', 'vcr http mocking library') def has_vcr(): 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
D5827: drawdag: use raw strings for docstrings
This revision was automatically updated to reflect the committed changes. Closed by commit rHG8d4ee2d9ffb8: drawdag: use raw strings for docstrings (authored by indygreg, committed by ). REPOSITORY rHG Mercurial CHANGES SINCE LAST UPDATE https://phab.mercurial-scm.org/D5827?vs=13754=13786 REVISION DETAIL https://phab.mercurial-scm.org/D5827 AFFECTED FILES tests/drawdag.py CHANGE DETAILS diff --git a/tests/drawdag.py b/tests/drawdag.py --- a/tests/drawdag.py +++ b/tests/drawdag.py @@ -322,7 +322,7 @@ v.remove(leaf) def _getcomments(text): -""" +r""" >>> [pycompat.sysstr(s) for s in _getcomments(br''' ...G ...| @@ -341,7 +341,7 @@ @command(b'debugdrawdag', []) def debugdrawdag(ui, repo, **opts): -"""read an ASCII graph from stdin and create changesets +r"""read an ASCII graph from stdin and create changesets The ASCII graph is like what :hg:`log -G` outputs, with each `o` replaced to the name of the node. The command will create dummy changesets and local 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
D5826: check-config: use raw strings for regular expressions
This revision was automatically updated to reflect the committed changes. Closed by commit rHG595a67a301ee: check-config: use raw strings for regular expressions (authored by indygreg, committed by ). REPOSITORY rHG Mercurial CHANGES SINCE LAST UPDATE https://phab.mercurial-scm.org/D5826?vs=13753=13785 REVISION DETAIL https://phab.mercurial-scm.org/D5826 AFFECTED FILES contrib/check-config.py CHANGE DETAILS diff --git a/contrib/check-config.py b/contrib/check-config.py --- a/contrib/check-config.py +++ b/contrib/check-config.py @@ -25,7 +25,7 @@ (?:default=)?(?P\S+?))? \)''', re.VERBOSE | re.MULTILINE) -configwithre = re.compile(b''' +configwithre = re.compile(br''' ui\.config(?Pwith)\( # First argument is callback function. This doesn't parse robustly # if it is e.g. a function call. @@ -61,10 +61,10 @@ linenum += 1 # check topic-like bits -m = re.match(b'\s*``(\S+)``', l) +m = re.match(br'\s*``(\S+)``', l) if m: prevname = m.group(1) -if re.match(b'^\s*-+$', l): +if re.match(br'^\s*-+$', l): sect = prevname prevname = b'' 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
D5824: check-commit: use raw string for regular expression
This revision was automatically updated to reflect the committed changes. Closed by commit rHG45a4789d3ff2: check-commit: use raw string for regular expression (authored by indygreg, committed by ). REPOSITORY rHG Mercurial CHANGES SINCE LAST UPDATE https://phab.mercurial-scm.org/D5824?vs=13751=13783 REVISION DETAIL https://phab.mercurial-scm.org/D5824 AFFECTED FILES contrib/check-commit CHANGE DETAILS diff --git a/contrib/check-commit b/contrib/check-commit --- a/contrib/check-commit +++ b/contrib/check-commit @@ -47,7 +47,7 @@ "adds a function with foo_bar naming"), ] -word = re.compile('\S') +word = re.compile(r'\S') def nonempty(first, second): if word.search(first): return first 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
D5821: convert: use raw string for regular expressions
This revision was automatically updated to reflect the committed changes. Closed by commit rHGfc09aafd3c36: convert: use raw string for regular expressions (authored by indygreg, committed by ). REPOSITORY rHG Mercurial CHANGES SINCE LAST UPDATE https://phab.mercurial-scm.org/D5821?vs=13748=13781 REVISION DETAIL https://phab.mercurial-scm.org/D5821 AFFECTED FILES hgext/convert/monotone.py hgext/convert/p4.py CHANGE DETAILS diff --git a/hgext/convert/p4.py b/hgext/convert/p4.py --- a/hgext/convert/p4.py +++ b/hgext/convert/p4.py @@ -64,12 +64,12 @@ self.encoding = self.ui.config('convert', 'p4.encoding', convcmd.orig_encoding) self.re_type = re.compile( -"([a-z]+)?(text|binary|symlink|apple|resource|unicode|utf\d+)" -"(\+\w+)?$") +br"([a-z]+)?(text|binary|symlink|apple|resource|unicode|utf\d+)" +br"(\+\w+)?$") self.re_keywords = re.compile( -r"\$(Id|Header|Date|DateTime|Change|File|Revision|Author)" -r":[^$\n]*\$") -self.re_keywords_old = re.compile("\$(Id|Header):[^$\n]*\$") +br"\$(Id|Header|Date|DateTime|Change|File|Revision|Author)" +br":[^$\n]*\$") +self.re_keywords_old = re.compile(br"\$(Id|Header):[^$\n]*\$") if revs and len(revs) > 1: raise error.Abort(_("p4 source does not support specifying " diff --git a/hgext/convert/monotone.py b/hgext/convert/monotone.py --- a/hgext/convert/monotone.py +++ b/hgext/convert/monotone.py @@ -214,7 +214,7 @@ # key "t...@selenic.com" # mtn >= 0.45: # key [ff58a7ffb771907c4ff68995eada1c4da068d328] -certlist = re.split('\n\n key ["\[]', certlist) +certlist = re.split(br'\n\n key ["\[]', certlist) for e in certlist: m = self.cert_re.match(e) if m: 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
D5818: patch: properly escape \ in string literals
This revision was automatically updated to reflect the committed changes. Closed by commit rHG47c92f8ed128: patch: properly escape \ in string literals (authored by indygreg, committed by ). REPOSITORY rHG Mercurial CHANGES SINCE LAST UPDATE https://phab.mercurial-scm.org/D5818?vs=13745=13778 REVISION DETAIL https://phab.mercurial-scm.org/D5818 AFFECTED FILES mercurial/patch.py CHANGE DETAILS diff --git a/mercurial/patch.py b/mercurial/patch.py --- a/mercurial/patch.py +++ b/mercurial/patch.py @@ -753,7 +753,7 @@ for l in x.hunk: lines.append(l) if l[-1:] != '\n': -lines.append("\n\ No newline at end of file\n") +lines.append("\n\\ No newline at end of file\n") self.backend.writerej(self.fname, len(self.rej), self.hunks, lines) def apply(self, h): @@ -1305,7 +1305,7 @@ self.hunk.append(u) l = lr.readline() -if l.startswith('\ '): +if l.startswith(br'\ '): s = self.a[-1][:-1] self.a[-1] = s self.hunk[-1] = s @@ -1323,7 +1323,7 @@ hunki = 1 for x in pycompat.xrange(self.lenb): l = lr.readline() -if l.startswith('\ '): +if l.startswith(br'\ '): # XXX: the only way to hit this is with an invalid line range. # The no-eol marker is not counted in the line range, but I # guess there are diff(1) out there which behave differently. @@ -1380,7 +1380,7 @@ def _fixnewline(self, lr): l = lr.readline() -if l.startswith('\ '): +if l.startswith(br'\ '): diffhelper.fixnewline(self.hunk, self.a, self.b) else: lr.push(l) 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
D5820: graphmod: use raw string
This revision was automatically updated to reflect the committed changes. Closed by commit rHGfb9e11fdcbba: graphmod: use raw string (authored by indygreg, committed by ). REPOSITORY rHG Mercurial CHANGES SINCE LAST UPDATE https://phab.mercurial-scm.org/D5820?vs=13747=13780 REVISION DETAIL https://phab.mercurial-scm.org/D5820 AFFECTED FILES mercurial/graphmod.py CHANGE DETAILS diff --git a/mercurial/graphmod.py b/mercurial/graphmod.py --- a/mercurial/graphmod.py +++ b/mercurial/graphmod.py @@ -451,7 +451,7 @@ # If 'graphshorten' config, only draw shift_interline # when there is any non vertical flow in graph. if state['graphshorten']: -if any(c in '\/' for c in shift_interline if c): +if any(c in br'\/' for c in shift_interline if c): lines.append(shift_interline) # Else, no 'graphshorten' config so draw shift_interline. else: 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
D5819: crecord: use raw string for regular expression
This revision was automatically updated to reflect the committed changes. Closed by commit rHG7a90ff8cd14c: crecord: use raw string for regular expression (authored by indygreg, committed by ). REPOSITORY rHG Mercurial CHANGES SINCE LAST UPDATE https://phab.mercurial-scm.org/D5819?vs=13746=13779 REVISION DETAIL https://phab.mercurial-scm.org/D5819 AFFECTED FILES mercurial/crecord.py CHANGE DETAILS diff --git a/mercurial/crecord.py b/mercurial/crecord.py --- a/mercurial/crecord.py +++ b/mercurial/crecord.py @@ -1799,6 +1799,7 @@ break if self.commenttext != "": -whitespaceremoved = re.sub("(?m)^\s.*(\n|$)", "", self.commenttext) +whitespaceremoved = re.sub(br"(?m)^\s.*(\n|$)", b"", + self.commenttext) if whitespaceremoved != "": self.opts['message'] = self.commenttext 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
D5835: tests: fix test-match.py on Python3
This revision was automatically updated to reflect the committed changes. Closed by commit rHG4dd07bf84608: tests: fix test-match.py on Python3 (authored by durin42, committed by ). REPOSITORY rHG Mercurial CHANGES SINCE LAST UPDATE https://phab.mercurial-scm.org/D5835?vs=13762=13774 REVISION DETAIL https://phab.mercurial-scm.org/D5835 AFFECTED FILES tests/test-match.py CHANGE DETAILS diff --git a/tests/test-match.py b/tests/test-match.py --- a/tests/test-match.py +++ b/tests/test-match.py @@ -261,13 +261,13 @@ # assertTrue does NOT verify that it's a bool, just that it's truthy. # While we may want to eventually make these return 'all', they should # not currently do so. -self.assertEqual(dm.visitdir(b'.'), 'all') -self.assertEqual(dm.visitdir(b'dir'), 'all') -self.assertEqual(dm.visitdir(b'dir/subdir'), 'all') -self.assertEqual(dm.visitdir(b'dir/subdir/z'), 'all') -self.assertEqual(dm.visitdir(b'dir/foo'), 'all') -self.assertEqual(dm.visitdir(b'dir/subdir/x'), 'all') -self.assertEqual(dm.visitdir(b'folder'), 'all') +self.assertEqual(dm.visitdir(b'.'), b'all') +self.assertEqual(dm.visitdir(b'dir'), b'all') +self.assertEqual(dm.visitdir(b'dir/subdir'), b'all') +self.assertEqual(dm.visitdir(b'dir/subdir/z'), b'all') +self.assertEqual(dm.visitdir(b'dir/foo'), b'all') +self.assertEqual(dm.visitdir(b'dir/subdir/x'), b'all') +self.assertEqual(dm.visitdir(b'folder'), b'all') def testVisitchildrensetM2never(self): m1 = matchmod.alwaysmatcher(b'', b'') @@ -294,8 +294,8 @@ # an 'all' pattern, just True. self.assertEqual(dm.visitdir(b'dir/subdir/z'), True) self.assertEqual(dm.visitdir(b'dir/subdir/x'), True) -self.assertEqual(dm.visitdir(b'dir/foo'), 'all') -self.assertEqual(dm.visitdir(b'folder'), 'all') +self.assertEqual(dm.visitdir(b'dir/foo'), b'all') +self.assertEqual(dm.visitdir(b'folder'), b'all') def testVisitchildrensetM2SubdirPrefix(self): m1 = matchmod.alwaysmatcher(b'', b'') @@ -320,7 +320,7 @@ dm = matchmod.differencematcher(m1, m2) self.assertEqual(dm.visitdir(b'.'), True) self.assertEqual(dm.visitdir(b'dir'), True) -self.assertEqual(dm.visitdir(b'dir/subdir'), 'all') +self.assertEqual(dm.visitdir(b'dir/subdir'), b'all') self.assertFalse(dm.visitdir(b'dir/foo')) self.assertFalse(dm.visitdir(b'folder')) # OPT: We should probably return False for these; we don't because To: durin42, #hg-reviewers, martinvonz Cc: mercurial-devel ___ Mercurial-devel mailing list Mercurial-devel@mercurial-scm.org https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel
D5823: tests: add optional Python 2.7 deprecation output
This revision was automatically updated to reflect the committed changes. Closed by commit rHG14983ac4a764: tests: add optional Python 2.7 deprecation output (authored by indygreg, committed by ). REPOSITORY rHG Mercurial CHANGES SINCE LAST UPDATE https://phab.mercurial-scm.org/D5823?vs=13750=13775 REVISION DETAIL https://phab.mercurial-scm.org/D5823 AFFECTED FILES tests/test-install.t CHANGE DETAILS diff --git a/tests/test-install.t b/tests/test-install.t --- a/tests/test-install.t +++ b/tests/test-install.t @@ -238,6 +238,7 @@ the default for them. $ unset PYTHONPATH $ "$PYTHON" -m virtualenv --no-site-packages --never-download installenv >> pip.log + DEPRECATION: Python 2.7 will reach the end of its life on January 1st, 2020. Please upgrade your Python as Python 2.7 won't be maintained after that date. A future version of pip will drop support for Python 2.7. (?) Note: we use this weird path to run pip and hg to avoid platform differences, since it's bin on most platforms but Scripts on Windows. $ ./installenv/*/pip install --no-index $TESTDIR/.. >> pip.log 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
D5817: attr: make some docstrings raw strings
durin42 added a comment. This is vendored code. Can you send it upstream? REPOSITORY rHG Mercurial REVISION DETAIL https://phab.mercurial-scm.org/D5817 To: indygreg, #hg-reviewers Cc: durin42, mercurial-devel ___ Mercurial-devel mailing list Mercurial-devel@mercurial-scm.org https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel
D5846: tests: add syntax warnings on Python 3.8 in python-zstandard
indygreg created this revision. Herald added subscribers: mercurial-devel, mjpieters. Herald added a reviewer: hg-reviewers. REVISION SUMMARY These are warnings from upstream test code. Let's just acknowledge them for now. These should go away in a future python-zstandard release :) REPOSITORY rHG Mercurial REVISION DETAIL https://phab.mercurial-scm.org/D5846 AFFECTED FILES 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 @@ -32,6 +32,14 @@ > -X mercurial/thirdparty \ > | sed 's|\\|/|g' | xargs "$PYTHON" contrib/check-py3-compat.py \ > | sed 's/[0-9][0-9]*)$/*)/' + contrib/python-zstandard/tests/test_compressor.py:324: SyntaxWarning: invalid escape sequence \( (py38 !) +with self.assertRaisesRegexp(zstd.ZstdError, 'cannot call compress\(\) after compressor'): (py38 !) + contrib/python-zstandard/tests/test_compressor.py:1329: SyntaxWarning: invalid escape sequence \( (py38 !) +'cannot call compress\(\) after compression finished'): (py38 !) + contrib/python-zstandard/tests/test_compressor.py:1341: SyntaxWarning: invalid escape sequence \( (py38 !) +'cannot call flush\(\) after compression finished'): (py38 !) + contrib/python-zstandard/tests/test_compressor.py:1353: SyntaxWarning: invalid escape sequence \( (py38 !) +'cannot call finish\(\) after compression finished'): (py38 !) hgext/convert/transport.py: error importing: <*Error> No module named 'svn.client' (error at transport.py:*) (glob) (?) hgext/infinitepush/sqlindexapi.py: error importing: <*Error> No module named 'mysql' (error at sqlindexapi.py:*) (glob) (?) mercurial/scmwindows.py: error importing: _type_ 'v' not supported (error at win32.py:*) (no-windows !) 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
D5843: doc: escape backslash
indygreg created this revision. Herald added a subscriber: mercurial-devel. Herald added a reviewer: hg-reviewers. REVISION SUMMARY This avoids a SyntaxWarning on Python 3.8 due to invalid \ escape. REPOSITORY rHG Mercurial REVISION DETAIL https://phab.mercurial-scm.org/D5843 AFFECTED FILES doc/hgmanpage.py CHANGE DETAILS diff --git a/doc/hgmanpage.py b/doc/hgmanpage.py --- a/doc/hgmanpage.py +++ b/doc/hgmanpage.py @@ -376,7 +376,7 @@ tmpl = (".TH %(title_upper)s %(manual_section)s" " \"%(date)s\" \"%(version)s\" \"%(manual_group)s\"\n" ".SH NAME\n" -"%(title)s \- %(subtitle)s\n") +"%(title)s \\- %(subtitle)s\n") return tmpl % self._docinfo def append_header(self): 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
D5841: tests: use raw strings in test-help.t
indygreg created this revision. Herald added a subscriber: mercurial-devel. Herald added a reviewer: hg-reviewers. REVISION SUMMARY This avoids SyntaxWarning on Python 3.8 due to invalid \ escapes. REPOSITORY rHG Mercurial REVISION DETAIL https://phab.mercurial-scm.org/D5841 AFFECTED FILES tests/test-help.t CHANGE DETAILS diff --git a/tests/test-help.t b/tests/test-help.t --- a/tests/test-help.t +++ b/tests/test-help.t @@ -1674,7 +1674,7 @@ Test omit indicating for help $ cat > addverboseitems.py < '''extension to test omit indicating. + > r'''extension to test omit indicating. > > This paragraph is never omitted (for extension) > @@ -1687,7 +1687,7 @@ > ''' > from __future__ import absolute_import > from mercurial import commands, help - > testtopic = b"""This paragraph is never omitted (for topic). + > testtopic = br"""This paragraph is never omitted (for topic). > > .. container:: verbose > 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
D5844: check-py3-compat: provide filename to ast.parse()
indygreg created this revision. Herald added a subscriber: mercurial-devel. Herald added a reviewer: hg-reviewers. REVISION SUMMARY This ensures any warning/error messages print a valid filename instead of potentially ''. REPOSITORY rHG Mercurial REVISION DETAIL https://phab.mercurial-scm.org/D5844 AFFECTED FILES contrib/check-py3-compat.py CHANGE DETAILS diff --git a/contrib/check-py3-compat.py b/contrib/check-py3-compat.py --- a/contrib/check-py3-compat.py +++ b/contrib/check-py3-compat.py @@ -45,7 +45,7 @@ content = fh.read() try: -ast.parse(content) +ast.parse(content, filename=f) except SyntaxError as e: print('%s: invalid syntax: %s' % (f, e)) return 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
D5840: tests: escape backslash in makepatch.py inline file
indygreg created this revision. Herald added a subscriber: mercurial-devel. Herald added a reviewer: hg-reviewers. REVISION SUMMARY This avoids some SyntaxWarning on Python 3.8 due to unescaped \. REPOSITORY rHG Mercurial REVISION DETAIL https://phab.mercurial-scm.org/D5840 AFFECTED FILES tests/test-import-eol.t tests/test-mq-eol.t CHANGE DETAILS diff --git a/tests/test-mq-eol.t b/tests/test-mq-eol.t --- a/tests/test-mq-eol.t +++ b/tests/test-mq-eol.t @@ -23,9 +23,9 @@ > w(b' c\r\n') > w(b' d\n') > w(b'-e\n') - > w(b'\ No newline at end of file\n') + > w(b'\\ No newline at end of file\n') > w(b'+z\r\n') - > w(b'\ No newline at end of file\r\n') + > w(b'\\ No newline at end of file\r\n') > EOF $ cat > cateol.py <'empty:stripped-crlf': b'\r\n'}[sys.argv[1]]) > w(b' d\n') > w(b'-e\n') - > w(b'\ No newline at end of file\n') + > w(b'\\ No newline at end of file\n') > w(b'+z\r\n') - > w(b'\ No newline at end of file\r\n') + > w(b'\\ No newline at end of file\r\n') > EOF $ hg init repo 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
D5842: testparseutil: escape backslash in docstring
indygreg created this revision. Herald added a subscriber: mercurial-devel. Herald added a reviewer: hg-reviewers. REVISION SUMMARY This is funky. This inline Python code is part of a docstring, which means the string is interpreted first. So any backslashes need double escaping. So even though this is already a br'', we still need to escape. REPOSITORY rHG Mercurial REVISION DETAIL https://phab.mercurial-scm.org/D5842 AFFECTED FILES contrib/testparseutil.py CHANGE DETAILS diff --git a/contrib/testparseutil.py b/contrib/testparseutil.py --- a/contrib/testparseutil.py +++ b/contrib/testparseutil.py @@ -265,7 +265,7 @@ class fileheredocmatcher(embeddedmatcher): """Detect "cat > FILE << LIMIT" style embedded code ->>> matcher = fileheredocmatcher(b'heredoc .py file', br'[^<]+\.py') +>>> matcher = fileheredocmatcher(b'heredoc .py file', br'[^<]+\\.py') >>> b2s(matcher.startsat(b' $ cat > file.py << EOF\\n')) ('file.py', ' > EOF\\n') >>> b2s(matcher.startsat(b' $ cat >>file.py
D5839: tests: use raw strings in test-cbor.py
indygreg created this revision. Herald added a subscriber: mercurial-devel. Herald added a reviewer: hg-reviewers. REVISION SUMMARY To avoid SyntaxWarning on Python 3.8 due to invalid \ escape. REPOSITORY rHG Mercurial REVISION DETAIL https://phab.mercurial-scm.org/D5839 AFFECTED FILES tests/test-cbor.py CHANGE DETAILS diff --git a/tests/test-cbor.py b/tests/test-cbor.py --- a/tests/test-cbor.py +++ b/tests/test-cbor.py @@ -926,7 +926,7 @@ (False, None, -1, cborutil.SPECIAL_NONE)) with self.assertRaisesRegex(cborutil.CBORDecodeError, -'semantic tag \d+ not allowed'): +r'semantic tag \d+ not allowed'): cborutil.decodeitem(encoded) class SpecialTypesTests(TestCase): @@ -942,7 +942,7 @@ encoded = cborutil.encodelength(cborutil.MAJOR_TYPE_SPECIAL, i) with self.assertRaisesRegex(cborutil.CBORDecodeError, -'special type \d+ not allowed'): +r'special type \d+ not allowed'): cborutil.decodeitem(encoded) class SansIODecoderTests(TestCase): 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
D5838: showstack: use raw docstring
indygreg created this revision. Herald added a subscriber: mercurial-devel. Herald added a reviewer: hg-reviewers. REVISION SUMMARY Avoids a SyntaxWarning on Python 3.8 due to invalid \ escape. REPOSITORY rHG Mercurial REVISION DETAIL https://phab.mercurial-scm.org/D5838 AFFECTED FILES contrib/showstack.py CHANGE DETAILS diff --git a/contrib/showstack.py b/contrib/showstack.py --- a/contrib/showstack.py +++ b/contrib/showstack.py @@ -1,7 +1,7 @@ # showstack.py - extension to dump a Python stack trace on signal # # binds to both SIGQUIT (Ctrl-\) and SIGINFO (Ctrl-T on BSDs) -"""dump stack trace when receiving SIGQUIT (Ctrl-\) and SIGINFO (Ctrl-T on BSDs) +r"""dump stack trace when receiving SIGQUIT (Ctrl-\) or SIGINFO (Ctrl-T on BSDs) """ from __future__ import absolute_import, print_function 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
D5837: tests: use raw string in test-check-code.t
indygreg created this revision. Herald added a subscriber: mercurial-devel. Herald added a reviewer: hg-reviewers. REVISION SUMMARY To avoid a SyntaxWarning on Python 3.8 due to invalid \ escape. REPOSITORY rHG Mercurial REVISION DETAIL https://phab.mercurial-scm.org/D5837 AFFECTED FILES tests/test-check-code.t CHANGE DETAILS 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 @@ -22,7 +22,7 @@ >>> commands = [] >>> with open('mercurial/debugcommands.py', 'rb') as fh: ... for line in fh: - ... m = re.match(b"^@command\('([a-z]+)", line) + ... m = re.match(br"^@command\('([a-z]+)", line) ... if m: ... commands.append(m.group(1)) >>> scommands = list(sorted(commands)) To: indygreg, #hg-reviewers Cc: mercurial-devel ___ Mercurial-devel mailing list Mercurial-devel@mercurial-scm.org https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel
mercurial@41529: 69 new changesets
69 new changesets in mercurial: https://www.mercurial-scm.org/repo/hg/rev/c67f55b02f02 changeset: 41461:c67f55b02f02 parent: 41454:d1d3094b54f9 user:Gregory Szorc date:Tue Jan 29 11:51:19 2019 -0800 summary: tests: write commit message using file I/O https://www.mercurial-scm.org/repo/hg/rev/9b2b8794f801 changeset: 41462:9b2b8794f801 user:Gregory Szorc date:Wed Jan 30 11:44:34 2019 -0800 summary: hgweb: log error before attempting I/O https://www.mercurial-scm.org/repo/hg/rev/ba7298160357 changeset: 41463:ba7298160357 user:Gregory Szorc date:Wed Jan 30 09:52:16 2019 -0800 summary: tests: add b'' prefixes to badserverext.py https://www.mercurial-scm.org/repo/hg/rev/d343d9ac173e changeset: 41464:d343d9ac173e user:Gregory Szorc date:Wed Jan 30 13:08:59 2019 -0800 summary: tests: change how sockets are closed https://www.mercurial-scm.org/repo/hg/rev/33560f3bbcd3 changeset: 41465:33560f3bbcd3 user:Gregory Szorc date:Tue Jan 29 14:06:46 2019 -0800 summary: tests: glob away readline(-1) https://www.mercurial-scm.org/repo/hg/rev/4d5aae86c9bd changeset: 41466:4d5aae86c9bd user:Gregory Szorc date:Wed Jan 30 12:12:25 2019 -0800 summary: tests: log sendall() operations and port test-http-bad-server.t https://www.mercurial-scm.org/repo/hg/rev/1016b81fa43e changeset: 41467:1016b81fa43e user:Gregory Szorc date:Wed Jan 30 12:55:44 2019 -0800 summary: tests: conditionalize test-http-bad-server.t for Python 3.5 https://www.mercurial-scm.org/repo/hg/rev/9cb51e74e9ad changeset: 41468:9cb51e74e9ad user:Gregory Szorc date:Wed Jan 30 13:07:20 2019 -0800 summary: wireprotov1server: use binascii.unhexlify https://www.mercurial-scm.org/repo/hg/rev/c9ff93889550 changeset: 41469:c9ff93889550 user:Boris Feld date:Fri Jan 25 18:55:45 2019 -0500 summary: perf: add a perfnodemap command https://www.mercurial-scm.org/repo/hg/rev/d1a273074f62 changeset: 41470:d1a273074f62 user:Boris Feld date:Mon Jan 28 03:41:33 2019 -0500 summary: perf: add a --[no-]clear-caches option to `perfnodemap` https://www.mercurial-scm.org/repo/hg/rev/268325697a47 changeset: 41471:268325697a47 user:Gregory Szorc date:Wed Jan 30 13:21:43 2019 -0800 summary: tests: use bytes and %d formatting in test-remotefilelog-datapack.py https://www.mercurial-scm.org/repo/hg/rev/6309ce86fa82 changeset: 41472:6309ce86fa82 user:Gregory Szorc date:Wed Jan 30 13:22:42 2019 -0800 summary: tests: use items() in test-remotefilelog-datapack.py https://www.mercurial-scm.org/repo/hg/rev/90b3898cf0db changeset: 41473:90b3898cf0db user:Gregory Szorc date:Wed Jan 30 13:30:01 2019 -0800 summary: tests: various Python 3 ports for test-remotefilelog-datapack.py https://www.mercurial-scm.org/repo/hg/rev/e971952db109 changeset: 41474:e971952db109 user:Gregory Szorc date:Wed Jan 30 13:34:47 2019 -0800 summary: tests: cast division result to int https://www.mercurial-scm.org/repo/hg/rev/30b762a330c8 changeset: 41475:30b762a330c8 user:Gregory Szorc date:Wed Jan 30 13:36:51 2019 -0800 summary: remotefilelog: cast division result to an int https://www.mercurial-scm.org/repo/hg/rev/fd2f1f0071b9 changeset: 41476:fd2f1f0071b9 user:Augie Fackler date:Wed Jan 30 16:43:52 2019 -0500 summary: py3: fix up test-remotefilelog-cacheprocess.t to not depend on a repr https://www.mercurial-scm.org/repo/hg/rev/4caf56c33009 changeset: 41477:4caf56c33009 user:Augie Fackler date:Thu Jan 24 16:07:32 2019 -0500 summary: py3: have test-revset2.t write test scripts in a more portable way https://www.mercurial-scm.org/repo/hg/rev/8e0dd36f7a97 changeset: 41478:8e0dd36f7a97 user:Augie Fackler date:Wed Jan 30 18:32:11 2019 -0500 summary: git: a little pycompat.bytestring() love to make this code work in py3 https://www.mercurial-scm.org/repo/hg/rev/6bbb12cba5a8 changeset: 41479:6bbb12cba5a8 user:Augie Fackler date:Wed Jan 30 17:24:57 2019 -0500 summary: server: skip logging of ECONNRESET https://www.mercurial-scm.org/repo/hg/rev/eb6700e6c5ea changeset: 41480:eb6700e6c5ea user:Augie Fackler date:Wed Jan 30 18:49:17 2019 -0500 summary: tests: make and use a new `svnurlof.py` helper for constructing svn urls https://www.mercurial-scm.org/repo/hg/rev/5880b4e762cd changeset: 41481:5880b4e762cd user:Gregory Szorc date:Wed Jan 30 16:53:12 2019 -0800 summary: tests: perform a shallow copy instead of a deep copy https://www.mercurial-scm.org/repo/hg/rev/b58d608ec6a0 changeset: 41482:b58d608ec6a0 user:Gregory Szorc date:Wed Jan 30 16:54:34 2019 -0800 summary: tests: compare against a bytes in test-lock.py
[Bug 6073] New: Select highlight stops following current location
https://bz.mercurial-scm.org/show_bug.cgi?id=6073 Bug ID: 6073 Summary: Select highlight stops following current location Product: Mercurial Version: 4.9 Hardware: PC OS: Linux Status: UNCONFIRMED Severity: feature Priority: wish Component: histedit Assignee: bugzi...@mercurial-scm.org Reporter: c.ozan...@gmail.com CC: mercurial-devel@mercurial-scm.org Selecting a changeset with the space bar highlights the current line. Moving the selected line up and down, the highlight follows. However if you moved it to the very top of the cursor screen, it get stuck there. It does show the change moving up / down but the highlight remains at the top. -- 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
[Bug 6072] New: histedit user information is not being shown correctly
https://bz.mercurial-scm.org/show_bug.cgi?id=6072 Bug ID: 6072 Summary: histedit user information is not being shown correctly Product: Mercurial Version: 4.9rc0 Hardware: PC OS: Linux Status: UNCONFIRMED Severity: bug Priority: wish Component: histedit Assignee: bugzi...@mercurial-scm.org Reporter: c.ozan...@gmail.com CC: mercurial-devel@mercurial-scm.org The new histedit curses interface shows information about each changeset as the cursor moves over each line. The user information is not being show correctly. For example, a full username is Craig Ozancin . User name is being deplayed as "c". -- 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
[Bug 6071] New: histedit curses interface is hard see selected line
https://bz.mercurial-scm.org/show_bug.cgi?id=6071 Bug ID: 6071 Summary: histedit curses interface is hard see selected line Product: Mercurial Version: 4.9rc0 Hardware: PC OS: Linux Status: UNCONFIRMED Severity: bug Priority: wish Component: histedit Assignee: bugzi...@mercurial-scm.org Reporter: c.ozan...@gmail.com CC: mercurial-devel@mercurial-scm.org With the new histedit curses interface, it is very difficult to see the current line. There is a very slight difference from other lines which makes it very difficult to see where we are at. On other curses interfaces (such as commit -i) the current line is shown as inverse magenta. Currently I am using to space (select) twice to see which line we are on. -- 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
D5785: blackbox: take regex patterns for blackbox.track
spectral planned changes to this revision. spectral added a comment. In https://phab.mercurial-scm.org/D5785#84935, @yuja wrote: > Can't we process the pattern as a glob? It's compatible with `*` and much > easier to write. Or do you need the power of the regexp? I generally prefer regex, but I might be an outlier. We do not need the power of regexp, especially if we get a negative filter (next commit), so I'll do that (eventually). Marking as "plan changes" for now... REPOSITORY rHG Mercurial REVISION DETAIL https://phab.mercurial-scm.org/D5785 To: spectral, #hg-reviewers Cc: yuja, mercurial-devel ___ Mercurial-devel mailing list Mercurial-devel@mercurial-scm.org https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel
D5744: commit: ignore diff whitespace settings when doing `commit -i` (issue5839)
spectral added a comment. In https://phab.mercurial-scm.org/D5744#85051, @yuja wrote: > I agree with that we would never set the `commands.commit.interactive.{...}` > in hgrc, but the feature itself is useful if you have to work on unclean > codebase unlike in Google. For example, I sometimes need to commit changes > ignoring unrelated whitespace cleanups made by editor or code formatter, > because I can't control the development workflow. > > That's why I thought there would be users relying on the current behavior. I think I understand what you're saying. I was under the impression that what we cared about was that `hg record -b` should continue working. Since there are no diffopts available on `hg commit -i`, you're thinking that this could be written as `hg commit -i --config commands.commit.interactive.ignorews=1`. While I'm sympathetic to that argument, it is so long and unwieldy that I think I'd recommend that users just do `hg --config extensions.record= record -b` (or, more likely, set `[extensions] record=` in their hgrc). I'll send the other patch series, we can discuss this on the relevant patches instead of keeping most of the discussion in a (somewhat unrelated) patch. I've sent https://phab.mercurial-scm.org/D5832-D5834 with the config option approach, and still have D5877-D5878 as the "only respect commandline args" approach. REPOSITORY rHG Mercurial REVISION DETAIL https://phab.mercurial-scm.org/D5744 To: spectral, #hg-reviewers Cc: durin42, yuja, navaneeth.suresh, mercurial-devel ___ Mercurial-devel mailing list Mercurial-devel@mercurial-scm.org https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel
D5834: commit/revert: if interactive, look elsewhere for whitespace settings (BC)
spectral created this revision. Herald added a subscriber: mercurial-devel. Herald added a reviewer: hg-reviewers. REVISION SUMMARY Previously, when doing `commit -i`, we respected `diff.ignorews` and other whitespace-related settings, which is probably unexpected. The primary reason for this is to support hgext.record's commandline options, it's probably accidental that the `[diff]` settings were also considered. See comments on issue6042 and https://phab.mercurial-scm.org/D5490. This can cause problems (issue5839, issue6042). It is assumed by the author that the `[diff]` section is primarily for *viewing* diffs, and that it is unlikely what people intend when attempting to commit or revert. With this change, if a user wants the behavior, they can clone their `[diff]` settings to `commands.commit.interactive.`. This is thus a mild BC change, but one I suspect is not going to be relied on by anyone. Note: while doing a partial commit/revert, we do not know what command the user is actually running. This means that the split extension, which ends up calling into this code, will respect the `commands.commit.interactive.` settings, and not a hypothetical `commands.split.interactive.`. This *also* means that setting `commands.commit.interactive.ignoreblanklines`, for example, will still cause issue5839. Considering the highly unlikely chance that a user actually sets `commands.commit.interactive.`, the author deems this risk acceptable. REPOSITORY rHG Mercurial REVISION DETAIL https://phab.mercurial-scm.org/D5834 AFFECTED FILES mercurial/cmdutil.py mercurial/configitems.py CHANGE DETAILS diff --git a/mercurial/configitems.py b/mercurial/configitems.py --- a/mercurial/configitems.py +++ b/mercurial/configitems.py @@ -201,6 +201,7 @@ coreconfigitem('color', 'pagermode', default=dynamicdefault, ) +_registerdiffopts(section='commands', configprefix='commit.interactive.') coreconfigitem('commands', 'grep.all-files', default=False, ) @@ -213,6 +214,7 @@ coreconfigitem('commands', 'resolve.mark-check', default='none', ) +_registerdiffopts(section='commands', configprefix='revert.interactive.') coreconfigitem('commands', 'show.aliasprefix', default=list, ) diff --git a/mercurial/cmdutil.py b/mercurial/cmdutil.py --- a/mercurial/cmdutil.py +++ b/mercurial/cmdutil.py @@ -282,7 +282,9 @@ status = repo.status(match=match) if not force: repo.checkcommitpatterns(wctx, vdirs, match, status, fail) -diffopts = patch.difffeatureopts(ui, opts=opts) +diffopts = patch.difffeatureopts(ui, opts=opts, whitespace=True, + section='commands', + configprefix='commit.interactive.') diffopts.nodates = True diffopts.git = True diffopts.showfunc = True @@ -3126,7 +3128,9 @@ # Prompt the user for changes to revert torevert = [f for f in actions['revert'][0] if f not in excluded_files] m = scmutil.matchfiles(repo, torevert) -diffopts = patch.difffeatureopts(repo.ui) +diffopts = patch.difffeatureopts(repo.ui, whitespace=True, + section='commands', + configprefix='revert.interactive.') diffopts.nodates = True diffopts.git = True operation = 'discard' To: spectral, #hg-reviewers Cc: mercurial-devel ___ Mercurial-devel mailing list Mercurial-devel@mercurial-scm.org https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel
D5832: config: extract diff-related coreconfigitem()s to a helper method
spectral created this revision. Herald added a subscriber: mercurial-devel. Herald added a reviewer: hg-reviewers. REVISION SUMMARY We already have 'annotate' and 'diff' that use the same set of options, and I want to add more in a followup commit, so I'm attempting to reduce maintenance burden and duplication by making it possible to register all of them at once. REPOSITORY rHG Mercurial REVISION DETAIL https://phab.mercurial-scm.org/D5832 AFFECTED FILES mercurial/configitems.py CHANGE DETAILS diff --git a/mercurial/configitems.py b/mercurial/configitems.py --- a/mercurial/configitems.py +++ b/mercurial/configitems.py @@ -113,46 +113,49 @@ coreconfigitem = getitemregister(coreitems) +def _registerdiffopts(section, configprefix=''): +coreconfigitem(section, configprefix + 'nodates', +default=False, +) +coreconfigitem(section, configprefix + 'showfunc', +default=False, +) +coreconfigitem(section, configprefix + 'unified', +default=None, +) +coreconfigitem(section, configprefix + 'git', +default=False, +) +coreconfigitem(section, configprefix + 'ignorews', +default=False, +) +coreconfigitem(section, configprefix + 'ignorewsamount', +default=False, +) +coreconfigitem(section, configprefix + 'ignoreblanklines', +default=False, +) +coreconfigitem(section, configprefix + 'ignorewseol', +default=False, +) +coreconfigitem(section, configprefix + 'nobinary', +default=False, +) +coreconfigitem(section, configprefix + 'noprefix', +default=False, +) +coreconfigitem(section, configprefix + 'word-diff', +default=False, +) + coreconfigitem('alias', '.*', default=dynamicdefault, generic=True, ) -coreconfigitem('annotate', 'nodates', -default=False, -) -coreconfigitem('annotate', 'showfunc', -default=False, -) -coreconfigitem('annotate', 'unified', -default=None, -) -coreconfigitem('annotate', 'git', -default=False, -) -coreconfigitem('annotate', 'ignorews', -default=False, -) -coreconfigitem('annotate', 'ignorewsamount', -default=False, -) -coreconfigitem('annotate', 'ignoreblanklines', -default=False, -) -coreconfigitem('annotate', 'ignorewseol', -default=False, -) -coreconfigitem('annotate', 'nobinary', -default=False, -) -coreconfigitem('annotate', 'noprefix', -default=False, -) -coreconfigitem('annotate', 'word-diff', -default=False, -) coreconfigitem('auth', 'cookiefile', default=None, ) +_registerdiffopts(section='annotate') # bookmarks.pushing: internal hack for discovery coreconfigitem('bookmarks', 'pushing', default=list, @@ -404,39 +407,7 @@ coreconfigitem('devel', 'debug.peer-request', default=False, ) -coreconfigitem('diff', 'nodates', -default=False, -) -coreconfigitem('diff', 'showfunc', -default=False, -) -coreconfigitem('diff', 'unified', -default=None, -) -coreconfigitem('diff', 'git', -default=False, -) -coreconfigitem('diff', 'ignorews', -default=False, -) -coreconfigitem('diff', 'ignorewsamount', -default=False, -) -coreconfigitem('diff', 'ignoreblanklines', -default=False, -) -coreconfigitem('diff', 'ignorewseol', -default=False, -) -coreconfigitem('diff', 'nobinary', -default=False, -) -coreconfigitem('diff', 'noprefix', -default=False, -) -coreconfigitem('diff', 'word-diff', -default=False, -) +_registerdiffopts(section='diff') coreconfigitem('email', 'bcc', default=None, ) To: spectral, #hg-reviewers Cc: mercurial-devel ___ Mercurial-devel mailing list Mercurial-devel@mercurial-scm.org https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel
D5833: diff: when looking for diff configs, support a configurable prefix
spectral created this revision. Herald added a subscriber: mercurial-devel. Herald added a reviewer: hg-reviewers. REVISION SUMMARY In a future commit, I want to make it possible to have the diff options pulled from (as an example) `commands.commit.interactive.ignorews`; previously we only supported this for customizable sections (so this would have needed a `commit-interactive` section and been named `commit-interactive.ignorews`, which felt a bit weird. REPOSITORY rHG Mercurial REVISION DETAIL https://phab.mercurial-scm.org/D5833 AFFECTED FILES mercurial/diffutil.py CHANGE DETAILS diff --git a/mercurial/diffutil.py b/mercurial/diffutil.py --- a/mercurial/diffutil.py +++ b/mercurial/diffutil.py @@ -16,13 +16,15 @@ pycompat, ) -def diffallopts(ui, opts=None, untrusted=False, section='diff'): +def diffallopts(ui, opts=None, untrusted=False, section='diff', +configprefix=''): '''return diffopts with all features supported and parsed''' return difffeatureopts(ui, opts=opts, untrusted=untrusted, section=section, - git=True, whitespace=True, formatchanging=True) + git=True, whitespace=True, formatchanging=True, + configprefix=configprefix) def difffeatureopts(ui, opts=None, untrusted=False, section='diff', git=False, -whitespace=False, formatchanging=False): +whitespace=False, formatchanging=False, configprefix=''): '''return diffopts with only opted-in features parsed Features: @@ -45,7 +47,8 @@ return v if forceplain is not None and ui.plain(): return forceplain -return getter(section, name or key, untrusted=untrusted) +return getter(section, configprefix + (name or key), + untrusted=untrusted) # core options, expected to be understood by every diff parser buildopts = { To: spectral, #hg-reviewers Cc: mercurial-devel ___ Mercurial-devel mailing list Mercurial-devel@mercurial-scm.org https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel
[Bug 6070] New: ui.prompt() prompt disappears on window resize
https://bz.mercurial-scm.org/show_bug.cgi?id=6070 Bug ID: 6070 Summary: ui.prompt() prompt disappears on window resize Product: Mercurial Version: unspecified Hardware: PC OS: Linux Status: UNCONFIRMED Severity: feature Priority: wish Component: Mercurial Assignee: bugzi...@mercurial-scm.org Reporter: h...@pewpew.net CC: mercurial-devel@mercurial-scm.org I can't really write a test for this, but it's easy enough to reproduce: $ hg debuguiprompt -p 'are kittens cute?' This will ask you whether kittens are cute. Despite knowing the obvious correct answer, *don't* answer it, and instead resize your terminal. On Linux, at least (no idea on windows), we use readline by default, which replaces the prompt we wrote with the prompt we told readline about (which is a single space: ' '). Since almost all uses of `ui._prompt` are via `ui.promptchoice` (only one non-debugcommand use of `ui.prompt` in `mercurial/*.py`), and I suspect it doesn't make sense to use readline there, I'm going to send a change to stop using readline for ui.promptchoice prompts. I'm tempted to remove it entirely, but that feels like a bigger change. -- 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
Re: D5744: commit: ignore diff whitespace settings when doing `commit -i` (issue5839)
> On Feb 1, 2019, at 23:04, yuja (Yuya Nishihara) > wrote: > > I agree with that we would never set the `commands.commit.interactive.{...}` > in hgrc, but the feature itself is useful if you have to work on unclean > codebase unlike in Google. For example, I sometimes need to commit changes > ignoring unrelated whitespace cleanups made by editor or code formatter, > because I can't control the development workflow. > > That's why I thought there would be users relying on the current behavior. ...this use case never occurred to me, and it's *awesome*. Very clever! ___ Mercurial-devel mailing list Mercurial-devel@mercurial-scm.org https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel
D5831: run-tests: set attributes in sorted order
indygreg created this revision. Herald added a subscriber: mercurial-devel. Herald added a reviewer: hg-reviewers. REVISION SUMMARY Python 3.8 preserves insertion order in serialized output (https://bugs.python.org/issue34160). Older Pythons serialized in sorted order. Let's make insertion order sorted so behavior is consistent across Python versions. REPOSITORY rHG Mercurial REVISION DETAIL https://phab.mercurial-scm.org/D5831 AFFECTED FILES tests/run-tests.py CHANGE DETAILS diff --git a/tests/run-tests.py b/tests/run-tests.py --- a/tests/run-tests.py +++ b/tests/run-tests.py @@ -2378,12 +2378,12 @@ timesd = dict((t[0], t[3]) for t in result.times) doc = minidom.Document() s = doc.createElement('testsuite') -s.setAttribute('name', 'run-tests') -s.setAttribute('tests', str(result.testsRun)) s.setAttribute('errors', "0") # TODO s.setAttribute('failures', str(len(result.failures))) +s.setAttribute('name', 'run-tests') s.setAttribute('skipped', str(len(result.skipped) + len(result.ignored))) +s.setAttribute('tests', str(result.testsRun)) doc.appendChild(s) for tc in result.successes: t = doc.createElement('testcase') 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
D5825: run-tests: use raw strings for regular expressions
indygreg created this revision. Herald added a subscriber: mercurial-devel. Herald added a reviewer: hg-reviewers. REVISION SUMMARY Avoids SyntaxWarning due to invalid \ escape on Python 3.8. REPOSITORY rHG Mercurial REVISION DETAIL https://phab.mercurial-scm.org/D5825 AFFECTED FILES tests/run-tests.py CHANGE DETAILS diff --git a/tests/run-tests.py b/tests/run-tests.py --- a/tests/run-tests.py +++ b/tests/run-tests.py @@ -634,7 +634,7 @@ # list in group 2, and the preceeding line output in group 1: # # output..output (feature !)\n -optline = re.compile(b'(.*) \((.+?) !\)\n$') +optline = re.compile(br'(.*) \((.+?) !\)\n$') def cdatasafe(data): """Make a string safe to include in a CDATA block. @@ -3112,8 +3112,8 @@ # installation layout put it in bin/ directly. Fix it with open(hgbat, 'rb') as f: data = f.read() -if b'"%~dp0..\python" "%~dp0hg" %*' in data: -data = data.replace(b'"%~dp0..\python" "%~dp0hg" %*', +if br'"%~dp0..\python" "%~dp0hg" %*' in data: +data = data.replace(br'"%~dp0..\python" "%~dp0hg" %*', b'"%~dp0python" "%~dp0hg" %*') with open(hgbat, 'wb') as f: f.write(data) To: indygreg, #hg-reviewers Cc: mercurial-devel ___ Mercurial-devel mailing list Mercurial-devel@mercurial-scm.org https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel
D5829: check-code: use raw string
indygreg created this revision. Herald added a subscriber: mercurial-devel. Herald added a reviewer: hg-reviewers. REVISION SUMMARY This avoids a SyntaxWarning in Python 3.8. REPOSITORY rHG Mercurial REVISION DETAIL https://phab.mercurial-scm.org/D5829 AFFECTED FILES contrib/check-code.py CHANGE DETAILS diff --git a/contrib/check-code.py b/contrib/check-code.py --- a/contrib/check-code.py +++ b/contrib/check-code.py @@ -414,7 +414,7 @@ txtpats = [ [ -('\s$', 'trailing whitespace'), +(r'\s$', 'trailing whitespace'), ('.. note::[ \n][^\n]', 'add two newlines after note::') ], [] 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
D5830: revetbenchmarks: use raw string for regular expression with escapes
indygreg created this revision. Herald added a subscriber: mercurial-devel. Herald added a reviewer: hg-reviewers. REVISION SUMMARY This avoids a SyntaxWarning on Python 3.8. REPOSITORY rHG Mercurial REVISION DETAIL https://phab.mercurial-scm.org/D5830 AFFECTED FILES contrib/revsetbenchmarks.py CHANGE DETAILS diff --git a/contrib/revsetbenchmarks.py b/contrib/revsetbenchmarks.py --- a/contrib/revsetbenchmarks.py +++ b/contrib/revsetbenchmarks.py @@ -71,8 +71,8 @@ print(exc.output, file=sys.stderr) return None -outputre = re.compile(r'! wall (\d+.\d+) comb (\d+.\d+) user (\d+.\d+) ' - 'sys (\d+.\d+) \(best of (\d+)\)') +outputre = re.compile(br'! wall (\d+.\d+) comb (\d+.\d+) user (\d+.\d+) ' + br'sys (\d+.\d+) \(best of (\d+)\)') def parseoutput(output): """parse a textual output into a dict 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
D5828: tests: use raw strings for regular expressions with escapes
indygreg created this revision. Herald added a subscriber: mercurial-devel. Herald added a reviewer: hg-reviewers. REVISION SUMMARY Avoids SyntaxWarning on Python 3.8. REPOSITORY rHG Mercurial REVISION DETAIL https://phab.mercurial-scm.org/D5828 AFFECTED FILES tests/hghave.py CHANGE DETAILS diff --git a/tests/hghave.py b/tests/hghave.py --- a/tests/hghave.py +++ b/tests/hghave.py @@ -722,15 +722,15 @@ @check("clang-libfuzzer", "clang new enough to include libfuzzer") def has_clang_libfuzzer(): -mat = matchoutput('clang --version', b'clang version (\d)') +mat = matchoutput('clang --version', br'clang version (\d)') if mat: # libfuzzer is new in clang 6 return int(mat.group(1)) > 5 return False @check("clang-6.0", "clang 6.0 with version suffix (libfuzzer included)") def has_clang60(): -return matchoutput('clang-6.0 --version', b'clang version 6\.') +return matchoutput('clang-6.0 --version', br'clang version 6\.') @check("xdiff", "xdiff algorithm") def has_xdiff(): @@ -811,7 +811,7 @@ # WITH clause not supported return False -return matchoutput('sqlite3 -version', b'^3\.\d+') +return matchoutput('sqlite3 -version', br'^3\.\d+') @check('vcr', 'vcr http mocking library') def has_vcr(): 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
D5827: drawdag: use raw strings for docstrings
indygreg created this revision. Herald added a subscriber: mercurial-devel. Herald added a reviewer: hg-reviewers. REVISION SUMMARY Avoids SyntaxWarning for invalid \ escape on Python 3.8. REPOSITORY rHG Mercurial REVISION DETAIL https://phab.mercurial-scm.org/D5827 AFFECTED FILES tests/drawdag.py CHANGE DETAILS diff --git a/tests/drawdag.py b/tests/drawdag.py --- a/tests/drawdag.py +++ b/tests/drawdag.py @@ -322,7 +322,7 @@ v.remove(leaf) def _getcomments(text): -""" +r""" >>> [pycompat.sysstr(s) for s in _getcomments(br''' ...G ...| @@ -341,7 +341,7 @@ @command(b'debugdrawdag', []) def debugdrawdag(ui, repo, **opts): -"""read an ASCII graph from stdin and create changesets +r"""read an ASCII graph from stdin and create changesets The ASCII graph is like what :hg:`log -G` outputs, with each `o` replaced to the name of the node. The command will create dummy changesets and local 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
D5826: check-config: use raw strings for regular expressions
indygreg created this revision. Herald added a subscriber: mercurial-devel. Herald added a reviewer: hg-reviewers. REVISION SUMMARY This avoids SyntaxWarning on Python 3.8 for invalid \ escapes. REPOSITORY rHG Mercurial REVISION DETAIL https://phab.mercurial-scm.org/D5826 AFFECTED FILES contrib/check-config.py CHANGE DETAILS diff --git a/contrib/check-config.py b/contrib/check-config.py --- a/contrib/check-config.py +++ b/contrib/check-config.py @@ -25,7 +25,7 @@ (?:default=)?(?P\S+?))? \)''', re.VERBOSE | re.MULTILINE) -configwithre = re.compile(b''' +configwithre = re.compile(br''' ui\.config(?Pwith)\( # First argument is callback function. This doesn't parse robustly # if it is e.g. a function call. @@ -61,10 +61,10 @@ linenum += 1 # check topic-like bits -m = re.match(b'\s*``(\S+)``', l) +m = re.match(br'\s*``(\S+)``', l) if m: prevname = m.group(1) -if re.match(b'^\s*-+$', l): +if re.match(br'^\s*-+$', l): sect = prevname prevname = b'' 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
D5824: check-commit: use raw string for regular expression
indygreg created this revision. Herald added a subscriber: mercurial-devel. Herald added a reviewer: hg-reviewers. REVISION SUMMARY Avoids SyntaxWarning on Python 3.8. REPOSITORY rHG Mercurial REVISION DETAIL https://phab.mercurial-scm.org/D5824 AFFECTED FILES contrib/check-commit CHANGE DETAILS diff --git a/contrib/check-commit b/contrib/check-commit --- a/contrib/check-commit +++ b/contrib/check-commit @@ -47,7 +47,7 @@ "adds a function with foo_bar naming"), ] -word = re.compile('\S') +word = re.compile(r'\S') def nonempty(first, second): if word.search(first): return first 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
D5823: tests: add optional Python 2.7 deprecation output
indygreg created this revision. Herald added a subscriber: mercurial-devel. Herald added a reviewer: hg-reviewers. REVISION SUMMARY pip 19 will emit a Python 2.7 deprecation warning when used with Python 2.7. Let's add that as optional output to our pip test. REPOSITORY rHG Mercurial REVISION DETAIL https://phab.mercurial-scm.org/D5823 AFFECTED FILES tests/test-install.t CHANGE DETAILS diff --git a/tests/test-install.t b/tests/test-install.t --- a/tests/test-install.t +++ b/tests/test-install.t @@ -238,6 +238,7 @@ the default for them. $ unset PYTHONPATH $ "$PYTHON" -m virtualenv --no-site-packages --never-download installenv >> pip.log + DEPRECATION: Python 2.7 will reach the end of its life on January 1st, 2020. Please upgrade your Python as Python 2.7 won't be maintained after that date. A future version of pip will drop support for Python 2.7. (?) Note: we use this weird path to run pip and hg to avoid platform differences, since it's bin on most platforms but Scripts on Windows. $ ./installenv/*/pip install --no-index $TESTDIR/.. >> pip.log 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
D5815: global: use raw strings for regular expressions with escapes
indygreg created this revision. Herald added a subscriber: mercurial-devel. Herald added a reviewer: hg-reviewers. REVISION SUMMARY Escape sequences like \w, \s, and \d are technically invalid in str/bytes. This became a deprecation warning in Python 3.6 (https://bugs.python.org/issue27364). Python 3.8 bumps it to a SyntaxWarning (https://bugs.python.org/issue32912), which is non-silent by default. This commit changes a number of regular expressions to use br'' so regular expression special sequences don't need \\ literals. This fixes roughly half of the SyntaxWarning we see in the code base with Python 3.8. REPOSITORY rHG Mercurial REVISION DETAIL https://phab.mercurial-scm.org/D5815 AFFECTED FILES hgext/blackbox.py hgext/commitextras.py hgext/convert/cvsps.py hgext/mq.py hgext/phabricator.py hgext/releasenotes.py mercurial/color.py mercurial/patch.py CHANGE DETAILS diff --git a/mercurial/patch.py b/mercurial/patch.py --- a/mercurial/patch.py +++ b/mercurial/patch.py @@ -638,8 +638,8 @@ return self.changed | self.removed # @@ -start,len +start,len @@ or @@ -start +start @@ if len is 1 -unidesc = re.compile('@@ -(\d+)(?:,(\d+))? \+(\d+)(?:,(\d+))? @@') -contextdesc = re.compile('(?:---|\*\*\*) (\d+)(?:,(\d+))? (?:---|\*\*\*)') +unidesc = re.compile(br'@@ -(\d+)(?:,(\d+))? \+(\d+)(?:,(\d+))? @@') +contextdesc = re.compile(br'(?:---|\*\*\*) (\d+)(?:,(\d+))? (?:---|\*\*\*)') eolmodes = ['strict', 'crlf', 'lf', 'auto'] class patchfile(object): @@ -2762,7 +2762,7 @@ return maxfile, maxtotal, addtotal, removetotal, binary def diffstatdata(lines): -diffre = re.compile('^diff .*-r [a-z0-9]+\s(.*)$') +diffre = re.compile(br'^diff .*-r [a-z0-9]+\s(.*)$') results = [] filename, adds, removes, isbinary = None, 0, 0, False diff --git a/mercurial/color.py b/mercurial/color.py --- a/mercurial/color.py +++ b/mercurial/color.py @@ -484,7 +484,7 @@ w32effects = None else: origattr = csbi.wAttributes -ansire = re.compile(b'\033\[([^m]*)m([^\033]*)(.*)', +ansire = re.compile(br'\033\[([^m]*)m([^\033]*)(.*)', re.MULTILINE | re.DOTALL) def win32print(ui, writefunc, text, **opts): diff --git a/hgext/releasenotes.py b/hgext/releasenotes.py --- a/hgext/releasenotes.py +++ b/hgext/releasenotes.py @@ -55,7 +55,7 @@ ('api', _('API Changes')), ] -RE_DIRECTIVE = re.compile('^\.\. ([a-zA-Z0-9_]+)::\s*([^$]+)?$') +RE_DIRECTIVE = re.compile(br'^\.\. ([a-zA-Z0-9_]+)::\s*([^$]+)?$') RE_ISSUE = br'\bissue ?[0-9]{4,6}(?![0-9])\b' BULLET_SECTION = _('Other Changes') diff --git a/hgext/phabricator.py b/hgext/phabricator.py --- a/hgext/phabricator.py +++ b/hgext/phabricator.py @@ -255,9 +255,9 @@ repo.ui.setconfig(b'phabricator', b'repophid', repophid) return repophid -_differentialrevisiontagre = re.compile(b'\AD([1-9][0-9]*)\Z') +_differentialrevisiontagre = re.compile(br'\AD([1-9][0-9]*)\Z') _differentialrevisiondescre = re.compile( -b'^Differential Revision:\s*(?P(?:.*)D(?P[1-9][0-9]*))$', re.M) +br'^Differential Revision:\s*(?P(?:.*)D(?P[1-9][0-9]*))$', re.M) def getoldnodedrevmap(repo, nodelist): """find previous nodes that has been sent to Phabricator diff --git a/hgext/mq.py b/hgext/mq.py --- a/hgext/mq.py +++ b/hgext/mq.py @@ -1181,7 +1181,7 @@ def makepatchname(self, title, fallbackname): """Return a suitable filename for title, adding a suffix to make it unique in the existing list""" -namebase = re.sub('[\s\W_]+', '_', title.lower()).strip('_') +namebase = re.sub(br'[\s\W_]+', b'_', title.lower()).strip(b'_') namebase = namebase[:75] # avoid too long name (issue5117) if namebase: try: diff --git a/hgext/convert/cvsps.py b/hgext/convert/cvsps.py --- a/hgext/convert/cvsps.py +++ b/hgext/convert/cvsps.py @@ -122,7 +122,7 @@ re_31 = re.compile(b'$') re_32 = re.compile(b'===' b'==$') -re_50 = re.compile(b'revision ([\\d.]+)(\s+locked by:\s+.+;)?$') +re_50 = re.compile(br'revision ([\d.]+)(\s+locked by:\s+.+;)?$') re_60 = re.compile(br'date:\s+(.+);\s+author:\s+(.+);\s+state:\s+(.+?);' br'(\s+lines:\s+(\+\d+)?\s+(-\d+)?;)?' br'(\s+commitid:\s+([^;]+);)?' diff --git a/hgext/commitextras.py b/hgext/commitextras.py --- a/hgext/commitextras.py +++ b/hgext/commitextras.py @@ -58,7 +58,7 @@ if not k: msg = _("unable to parse '%s', keys can't be empty") raise error.Abort(msg % raw) -if re.search('[^\w-]', k): +if re.search(br'[^\w-]', k): msg = _("keys can only contain ascii letters, digits," " '_' and '-'")
D5816: global: make some docstrings raw strings
indygreg created this revision. Herald added a reviewer: martinvonz. Herald added a subscriber: mercurial-devel. Herald added a reviewer: hg-reviewers. REVISION SUMMARY Python 3.8 emits a SyntaxWarning when a str/bytes contains invalid \ escapes. Various docstrings in our code base contain invalid \ escapes. This commit turns those docstrings into raw strings. REPOSITORY rHG Mercurial REVISION DETAIL https://phab.mercurial-scm.org/D5816 AFFECTED FILES hgext/rebase.py mercurial/bookmarks.py mercurial/dagop.py setup.py CHANGE DETAILS diff --git a/setup.py b/setup.py --- a/setup.py +++ b/setup.py @@ -666,7 +666,7 @@ self.addlongpathsmanifest() def addlongpathsmanifest(self): -"""Add manifest pieces so that hg.exe understands long paths +r"""Add manifest pieces so that hg.exe understands long paths This is an EXPERIMENTAL feature, use with care. To enable long paths support, one needs to do two things: diff --git a/mercurial/dagop.py b/mercurial/dagop.py --- a/mercurial/dagop.py +++ b/mercurial/dagop.py @@ -142,7 +142,7 @@ def revancestors(repo, revs, followfirst=False, startdepth=None, stopdepth=None, cutfunc=None): -"""Like revlog.ancestors(), but supports additional options, includes +r"""Like revlog.ancestors(), but supports additional options, includes the given revs themselves, and returns a smartset Scan ends at the stopdepth (exlusive) if specified. Revisions found diff --git a/mercurial/bookmarks.py b/mercurial/bookmarks.py --- a/mercurial/bookmarks.py +++ b/mercurial/bookmarks.py @@ -44,7 +44,7 @@ return fp class bmstore(object): -"""Storage for bookmarks. +r"""Storage for bookmarks. This object should do all bookmark-related reads and writes, so that it's fairly simple to replace the storage underlying diff --git a/hgext/rebase.py b/hgext/rebase.py --- a/hgext/rebase.py +++ b/hgext/rebase.py @@ -1278,7 +1278,7 @@ return stats def adjustdest(repo, rev, destmap, state, skipped): -"""adjust rebase destination given the current rebase state +r"""adjust rebase destination given the current rebase state rev is what is being rebased. Return a list of two revs, which are the adjusted destinations for rev's p1 and p2, respectively. If a parent is To: indygreg, martinvonz, #hg-reviewers Cc: mercurial-devel ___ Mercurial-devel mailing list Mercurial-devel@mercurial-scm.org https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel
D5822: configitems: use raw strings for hidden-{command,topic} items
indygreg created this revision. Herald added a subscriber: mercurial-devel. Herald added a reviewer: hg-reviewers. REVISION SUMMARY These strings are regular expressions. The "\." needs to be string escaped. We use raw strings to avoid doing that and the SyntaxWarning we'd receive otherwise on Python 3.8. REPOSITORY rHG Mercurial REVISION DETAIL https://phab.mercurial-scm.org/D5822 AFFECTED FILES mercurial/configitems.py CHANGE DETAILS diff --git a/mercurial/configitems.py b/mercurial/configitems.py --- a/mercurial/configitems.py +++ b/mercurial/configitems.py @@ -720,11 +720,11 @@ coreconfigitem('fsmonitor', 'warn_update_file_count', default=5, ) -coreconfigitem('help', 'hidden-command\..*', +coreconfigitem('help', br'hidden-command\..*', default=False, generic=True, ) -coreconfigitem('help', 'hidden-topic\..*', +coreconfigitem('help', br'hidden-topic\..*', default=False, generic=True, ) 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
D5818: patch: properly escape \ in string literals
indygreg created this revision. Herald added a subscriber: mercurial-devel. Herald added a reviewer: hg-reviewers. REVISION SUMMARY Python 3.8 will emit a SyntaxWarning for str/bytes with invalid escapes. This commit addresses 4 occurrences where we had a bare \ in a str/bytes. REPOSITORY rHG Mercurial REVISION DETAIL https://phab.mercurial-scm.org/D5818 AFFECTED FILES mercurial/patch.py CHANGE DETAILS diff --git a/mercurial/patch.py b/mercurial/patch.py --- a/mercurial/patch.py +++ b/mercurial/patch.py @@ -753,7 +753,7 @@ for l in x.hunk: lines.append(l) if l[-1:] != '\n': -lines.append("\n\ No newline at end of file\n") +lines.append("\n\\ No newline at end of file\n") self.backend.writerej(self.fname, len(self.rej), self.hunks, lines) def apply(self, h): @@ -1305,7 +1305,7 @@ self.hunk.append(u) l = lr.readline() -if l.startswith('\ '): +if l.startswith(br'\ '): s = self.a[-1][:-1] self.a[-1] = s self.hunk[-1] = s @@ -1323,7 +1323,7 @@ hunki = 1 for x in pycompat.xrange(self.lenb): l = lr.readline() -if l.startswith('\ '): +if l.startswith(br'\ '): # XXX: the only way to hit this is with an invalid line range. # The no-eol marker is not counted in the line range, but I # guess there are diff(1) out there which behave differently. @@ -1380,7 +1380,7 @@ def _fixnewline(self, lr): l = lr.readline() -if l.startswith('\ '): +if l.startswith(br'\ '): diffhelper.fixnewline(self.hunk, self.a, self.b) else: lr.push(l) 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
D5821: convert: use raw string for regular expressions
indygreg created this revision. Herald added a subscriber: mercurial-devel. Herald added a reviewer: hg-reviewers. REVISION SUMMARY This avoids a SyntaxWarning on Python 3.8. REPOSITORY rHG Mercurial REVISION DETAIL https://phab.mercurial-scm.org/D5821 AFFECTED FILES hgext/convert/monotone.py hgext/convert/p4.py CHANGE DETAILS diff --git a/hgext/convert/p4.py b/hgext/convert/p4.py --- a/hgext/convert/p4.py +++ b/hgext/convert/p4.py @@ -64,12 +64,12 @@ self.encoding = self.ui.config('convert', 'p4.encoding', convcmd.orig_encoding) self.re_type = re.compile( -"([a-z]+)?(text|binary|symlink|apple|resource|unicode|utf\d+)" -"(\+\w+)?$") +br"([a-z]+)?(text|binary|symlink|apple|resource|unicode|utf\d+)" +br"(\+\w+)?$") self.re_keywords = re.compile( -r"\$(Id|Header|Date|DateTime|Change|File|Revision|Author)" -r":[^$\n]*\$") -self.re_keywords_old = re.compile("\$(Id|Header):[^$\n]*\$") +br"\$(Id|Header|Date|DateTime|Change|File|Revision|Author)" +br":[^$\n]*\$") +self.re_keywords_old = re.compile(br"\$(Id|Header):[^$\n]*\$") if revs and len(revs) > 1: raise error.Abort(_("p4 source does not support specifying " diff --git a/hgext/convert/monotone.py b/hgext/convert/monotone.py --- a/hgext/convert/monotone.py +++ b/hgext/convert/monotone.py @@ -214,7 +214,7 @@ # key "t...@selenic.com" # mtn >= 0.45: # key [ff58a7ffb771907c4ff68995eada1c4da068d328] -certlist = re.split('\n\n key ["\[]', certlist) +certlist = re.split(br'\n\n key ["\[]', certlist) for e in certlist: m = self.cert_re.match(e) if m: 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
D5820: graphmod: use raw string
indygreg created this revision. Herald added a subscriber: mercurial-devel. Herald added a reviewer: hg-reviewers. REVISION SUMMARY Needed to avoid a SyntaxWarning due to unescaped \ in Python 3.8. REPOSITORY rHG Mercurial REVISION DETAIL https://phab.mercurial-scm.org/D5820 AFFECTED FILES mercurial/graphmod.py CHANGE DETAILS diff --git a/mercurial/graphmod.py b/mercurial/graphmod.py --- a/mercurial/graphmod.py +++ b/mercurial/graphmod.py @@ -451,7 +451,7 @@ # If 'graphshorten' config, only draw shift_interline # when there is any non vertical flow in graph. if state['graphshorten']: -if any(c in '\/' for c in shift_interline if c): +if any(c in br'\/' for c in shift_interline if c): lines.append(shift_interline) # Else, no 'graphshorten' config so draw shift_interline. else: 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
D5819: crecord: use raw string for regular expression
indygreg created this revision. Herald added a subscriber: mercurial-devel. Herald added a reviewer: hg-reviewers. REVISION SUMMARY \s emits a SyntaxWarning in Python 3.8. Use a raw string to avoid escaping the \. REPOSITORY rHG Mercurial REVISION DETAIL https://phab.mercurial-scm.org/D5819 AFFECTED FILES mercurial/crecord.py CHANGE DETAILS diff --git a/mercurial/crecord.py b/mercurial/crecord.py --- a/mercurial/crecord.py +++ b/mercurial/crecord.py @@ -1799,6 +1799,7 @@ break if self.commenttext != "": -whitespaceremoved = re.sub("(?m)^\s.*(\n|$)", "", self.commenttext) +whitespaceremoved = re.sub(br"(?m)^\s.*(\n|$)", b"", + self.commenttext) if whitespaceremoved != "": self.opts['message'] = self.commenttext 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
D5817: attr: make some docstrings raw strings
indygreg created this revision. Herald added a subscriber: mercurial-devel. Herald added a reviewer: hg-reviewers. REVISION SUMMARY This avoids a SyntaxWarning in Python 3.8 due to invalid \ escapes. REPOSITORY rHG Mercurial REVISION DETAIL https://phab.mercurial-scm.org/D5817 AFFECTED FILES mercurial/thirdparty/attr/_make.py mercurial/thirdparty/attr/filters.py CHANGE DETAILS diff --git a/mercurial/thirdparty/attr/filters.py b/mercurial/thirdparty/attr/filters.py --- a/mercurial/thirdparty/attr/filters.py +++ b/mercurial/thirdparty/attr/filters.py @@ -19,7 +19,7 @@ def include(*what): -""" +r""" Whitelist *what*. :param what: What to whitelist. @@ -36,7 +36,7 @@ def exclude(*what): -""" +r""" Blacklist *what*. :param what: What to blacklist. diff --git a/mercurial/thirdparty/attr/_make.py b/mercurial/thirdparty/attr/_make.py --- a/mercurial/thirdparty/attr/_make.py +++ b/mercurial/thirdparty/attr/_make.py @@ -56,7 +56,7 @@ def attr(default=NOTHING, validator=None, repr=True, cmp=True, hash=None, init=True, convert=None, metadata={}): -""" +r""" Create a new attribute on a class. .. warning:: 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
D5814: match: teach diffmatcher.visitdir() to return 'all' if possible
This revision was automatically updated to reflect the committed changes. Closed by commit rHG990aa150fd02: match: teach diffmatcher.visitdir() to return all if possible (authored by pulkit, committed by ). REPOSITORY rHG Mercurial CHANGES SINCE LAST UPDATE https://phab.mercurial-scm.org/D5814?vs=13740=13741 REVISION DETAIL https://phab.mercurial-scm.org/D5814 AFFECTED FILES mercurial/match.py tests/test-match.py CHANGE DETAILS diff --git a/tests/test-match.py b/tests/test-match.py --- a/tests/test-match.py +++ b/tests/test-match.py @@ -255,20 +255,19 @@ m1 = matchmod.alwaysmatcher(b'', b'') m2 = matchmod.nevermatcher(b'', b'') dm = matchmod.differencematcher(m1, m2) -# dm should be equivalent to a alwaysmatcher. OPT: if m2 is a -# nevermatcher, we could return 'all' for these. +# dm should be equivalent to a alwaysmatcher. # # We're testing Equal-to-True instead of just 'assertTrue' since # assertTrue does NOT verify that it's a bool, just that it's truthy. # While we may want to eventually make these return 'all', they should # not currently do so. -self.assertEqual(dm.visitdir(b'.'), True) -self.assertEqual(dm.visitdir(b'dir'), True) -self.assertEqual(dm.visitdir(b'dir/subdir'), True) -self.assertEqual(dm.visitdir(b'dir/subdir/z'), True) -self.assertEqual(dm.visitdir(b'dir/foo'), True) -self.assertEqual(dm.visitdir(b'dir/subdir/x'), True) -self.assertEqual(dm.visitdir(b'folder'), True) +self.assertEqual(dm.visitdir(b'.'), 'all') +self.assertEqual(dm.visitdir(b'dir'), 'all') +self.assertEqual(dm.visitdir(b'dir/subdir'), 'all') +self.assertEqual(dm.visitdir(b'dir/subdir/z'), 'all') +self.assertEqual(dm.visitdir(b'dir/foo'), 'all') +self.assertEqual(dm.visitdir(b'dir/subdir/x'), 'all') +self.assertEqual(dm.visitdir(b'folder'), 'all') def testVisitchildrensetM2never(self): m1 = matchmod.alwaysmatcher(b'', b'') @@ -295,9 +294,8 @@ # an 'all' pattern, just True. self.assertEqual(dm.visitdir(b'dir/subdir/z'), True) self.assertEqual(dm.visitdir(b'dir/subdir/x'), True) -# OPT: We could return 'all' for these. -self.assertEqual(dm.visitdir(b'dir/foo'), True) -self.assertEqual(dm.visitdir(b'folder'), True) +self.assertEqual(dm.visitdir(b'dir/foo'), 'all') +self.assertEqual(dm.visitdir(b'folder'), 'all') def testVisitchildrensetM2SubdirPrefix(self): m1 = matchmod.alwaysmatcher(b'', b'') @@ -322,7 +320,7 @@ dm = matchmod.differencematcher(m1, m2) self.assertEqual(dm.visitdir(b'.'), True) self.assertEqual(dm.visitdir(b'dir'), True) -self.assertEqual(dm.visitdir(b'dir/subdir'), True) +self.assertEqual(dm.visitdir(b'dir/subdir'), 'all') self.assertFalse(dm.visitdir(b'dir/foo')) self.assertFalse(dm.visitdir(b'folder')) # OPT: We should probably return False for these; we don't because diff --git a/mercurial/match.py b/mercurial/match.py --- a/mercurial/match.py +++ b/mercurial/match.py @@ -677,6 +677,9 @@ def visitdir(self, dir): if self._m2.visitdir(dir) == 'all': return False +elif not self._m2.visitdir(dir): +# m2 does not match dir, we can return 'all' here if possible +return self._m1.visitdir(dir) return bool(self._m1.visitdir(dir)) def visitchildrenset(self, dir): To: pulkit, #hg-reviewers, martinvonz Cc: martinvonz, mercurial-devel ___ Mercurial-devel mailing list Mercurial-devel@mercurial-scm.org https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel
D5800: config: introduce a new value for ui.relative-paths getting old behavior
martinvonz added a comment. In https://phab.mercurial-scm.org/D5800#85228, @yuja wrote: > > > What I thought confusing is `scmutil.getuipathfn(ctx.repo(), legacyvalue=True)` > > > in https://phab.mercurial-scm.org/D5801. "What does the `True` mean? relative, absolute, or a complete > > > different stuff?" > > > > Same reason it's confusing, I believe: it's unclear if "legacyvalue=True" means "use the legacy value" (incorrect) or "for the legacy value, use the value True" (correct). I was hoping the "value" part would clarify that, but I agree that it's still not clear. I think you're also saying that the fact that the function deals with producing a cwd-relative or absolute (well, repo-relative) is also not clear and I agree with that too. > > Yes. `force/legacyvalue` doesn't provide what the `value` means, which is my > point. I also get your point. Naming is hard. > > > Maybe "usedtoberelative=True"? > > As a non-native speaker, a single word "legacy" is easier to parse than a > phrase "used to be". So do we prefer `legacyrelativevalue` then? Or `legacywasrelative`? Or `legacyrelative`? (I think the last one is least clear.) REPOSITORY rHG Mercurial REVISION DETAIL https://phab.mercurial-scm.org/D5800 To: martinvonz, #hg-reviewers Cc: yuja, mercurial-devel ___ Mercurial-devel mailing list Mercurial-devel@mercurial-scm.org https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel
D5410: merge: allow to merge non-conflicting changes outside narrowspec
martinvonz added a comment. In https://phab.mercurial-scm.org/D5410#85232, @pulkit wrote: > In https://phab.mercurial-scm.org/D5410#80207, @martinvonz wrote: > > > I'm pretty sure this doesn't actually perform the merge, it just drops the changes outside the narrowspec. On commit, we need to record that outside/ has the new nodeid that we got from the side we merged in. To do that, we need to remember what that nodeid is, from the time of `hg merge` to the time of `hg commit`. That probably means storing the nodeid in the dirstate (like git does), or maybe in the merge state. > > > IIUC, dirstate does not contains files outside narrowspec. Maybe we need to do this in merge state? I think neither of them currently contains files outside narrows, so we'd need to extend whichever we decide. It's probably easier to extend the merge state. I'm not sure which I think is cleaner to extend. There's precedent for populating the commit based on the dirstate (index) in git. REPOSITORY rHG Mercurial REVISION DETAIL https://phab.mercurial-scm.org/D5410 To: pulkit, durin42, #hg-reviewers, martinvonz Cc: martinvonz, mercurial-devel ___ Mercurial-devel mailing list Mercurial-devel@mercurial-scm.org https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel
D5814: match: teach diffmatcher.visitdir() to return 'all' if possible
martinvonz accepted this revision. martinvonz added a comment. This revision is now accepted and ready to land. Thanks for fixing! I don't know why I didn't think of writing it this way from the beginning :P REPOSITORY rHG Mercurial REVISION DETAIL https://phab.mercurial-scm.org/D5814 To: pulkit, #hg-reviewers, martinvonz Cc: martinvonz, mercurial-devel ___ Mercurial-devel mailing list Mercurial-devel@mercurial-scm.org https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel
D5814: match: teach diffmatcher.visitdir() to return 'all' if possible
pulkit updated this revision to Diff 13740. REPOSITORY rHG Mercurial CHANGES SINCE LAST UPDATE https://phab.mercurial-scm.org/D5814?vs=13739=13740 REVISION DETAIL https://phab.mercurial-scm.org/D5814 AFFECTED FILES mercurial/match.py tests/test-match.py CHANGE DETAILS diff --git a/tests/test-match.py b/tests/test-match.py --- a/tests/test-match.py +++ b/tests/test-match.py @@ -255,20 +255,19 @@ m1 = matchmod.alwaysmatcher(b'', b'') m2 = matchmod.nevermatcher(b'', b'') dm = matchmod.differencematcher(m1, m2) -# dm should be equivalent to a alwaysmatcher. OPT: if m2 is a -# nevermatcher, we could return 'all' for these. +# dm should be equivalent to a alwaysmatcher. # # We're testing Equal-to-True instead of just 'assertTrue' since # assertTrue does NOT verify that it's a bool, just that it's truthy. # While we may want to eventually make these return 'all', they should # not currently do so. -self.assertEqual(dm.visitdir(b'.'), True) -self.assertEqual(dm.visitdir(b'dir'), True) -self.assertEqual(dm.visitdir(b'dir/subdir'), True) -self.assertEqual(dm.visitdir(b'dir/subdir/z'), True) -self.assertEqual(dm.visitdir(b'dir/foo'), True) -self.assertEqual(dm.visitdir(b'dir/subdir/x'), True) -self.assertEqual(dm.visitdir(b'folder'), True) +self.assertEqual(dm.visitdir(b'.'), 'all') +self.assertEqual(dm.visitdir(b'dir'), 'all') +self.assertEqual(dm.visitdir(b'dir/subdir'), 'all') +self.assertEqual(dm.visitdir(b'dir/subdir/z'), 'all') +self.assertEqual(dm.visitdir(b'dir/foo'), 'all') +self.assertEqual(dm.visitdir(b'dir/subdir/x'), 'all') +self.assertEqual(dm.visitdir(b'folder'), 'all') def testVisitchildrensetM2never(self): m1 = matchmod.alwaysmatcher(b'', b'') @@ -295,9 +294,8 @@ # an 'all' pattern, just True. self.assertEqual(dm.visitdir(b'dir/subdir/z'), True) self.assertEqual(dm.visitdir(b'dir/subdir/x'), True) -# OPT: We could return 'all' for these. -self.assertEqual(dm.visitdir(b'dir/foo'), True) -self.assertEqual(dm.visitdir(b'folder'), True) +self.assertEqual(dm.visitdir(b'dir/foo'), 'all') +self.assertEqual(dm.visitdir(b'folder'), 'all') def testVisitchildrensetM2SubdirPrefix(self): m1 = matchmod.alwaysmatcher(b'', b'') @@ -322,7 +320,7 @@ dm = matchmod.differencematcher(m1, m2) self.assertEqual(dm.visitdir(b'.'), True) self.assertEqual(dm.visitdir(b'dir'), True) -self.assertEqual(dm.visitdir(b'dir/subdir'), True) +self.assertEqual(dm.visitdir(b'dir/subdir'), 'all') self.assertFalse(dm.visitdir(b'dir/foo')) self.assertFalse(dm.visitdir(b'folder')) # OPT: We should probably return False for these; we don't because diff --git a/mercurial/match.py b/mercurial/match.py --- a/mercurial/match.py +++ b/mercurial/match.py @@ -677,6 +677,9 @@ def visitdir(self, dir): if self._m2.visitdir(dir) == 'all': return False +elif not self._m2.visitdir(dir): +# m2 does not match dir, we can return 'all' here if possible +return self._m1.visitdir(dir) return bool(self._m1.visitdir(dir)) def visitchildrenset(self, dir): To: pulkit, #hg-reviewers Cc: mercurial-devel ___ Mercurial-devel mailing list Mercurial-devel@mercurial-scm.org https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel
D5814: match: teach diffmatcher.visitdir() to return 'all' if possible
pulkit created this revision. Herald added a subscriber: mercurial-devel. Herald added a reviewer: hg-reviewers. REVISION SUMMARY This patch teaches differencematcher.visitdir() to return 'all' when m1.visitdir() returns 'all' and m2 does not matches. Before this patch, from a differencematcher.visitdir(), we always returned either True or False. We never returned 'all' even when we can. This causes problem when m1 and m2 of a differencematcher are themselves differencematcher. In that case, we try to check: `if self._m2_.visitdir(dir) == 'all'` which will never be 'all' even though it can be. This leads to iterating over a lot of sub-directory manifest, even though we don't want to while extending a narrow clone. I am yet to measure the impact of this but calculating manifest was taking ~50-60 seconds, so this should definitely save some of time there. REPOSITORY rHG Mercurial REVISION DETAIL https://phab.mercurial-scm.org/D5814 AFFECTED FILES mercurial/match.py tests/test-match.py CHANGE DETAILS diff --git a/tests/test-match.py b/tests/test-match.py --- a/tests/test-match.py +++ b/tests/test-match.py @@ -255,20 +255,19 @@ m1 = matchmod.alwaysmatcher(b'', b'') m2 = matchmod.nevermatcher(b'', b'') dm = matchmod.differencematcher(m1, m2) -# dm should be equivalent to a alwaysmatcher. OPT: if m2 is a -# nevermatcher, we could return 'all' for these. +# dm should be equivalent to a alwaysmatcher. # # We're testing Equal-to-True instead of just 'assertTrue' since # assertTrue does NOT verify that it's a bool, just that it's truthy. # While we may want to eventually make these return 'all', they should # not currently do so. -self.assertEqual(dm.visitdir(b'.'), True) -self.assertEqual(dm.visitdir(b'dir'), True) -self.assertEqual(dm.visitdir(b'dir/subdir'), True) -self.assertEqual(dm.visitdir(b'dir/subdir/z'), True) -self.assertEqual(dm.visitdir(b'dir/foo'), True) -self.assertEqual(dm.visitdir(b'dir/subdir/x'), True) -self.assertEqual(dm.visitdir(b'folder'), True) +self.assertEqual(dm.visitdir(b'.'), 'all') +self.assertEqual(dm.visitdir(b'dir'), 'all') +self.assertEqual(dm.visitdir(b'dir/subdir'), 'all') +self.assertEqual(dm.visitdir(b'dir/subdir/z'), 'all') +self.assertEqual(dm.visitdir(b'dir/foo'), 'all') +self.assertEqual(dm.visitdir(b'dir/subdir/x'), 'all') +self.assertEqual(dm.visitdir(b'folder'), 'all') def testVisitchildrensetM2never(self): m1 = matchmod.alwaysmatcher(b'', b'') @@ -296,8 +295,8 @@ self.assertEqual(dm.visitdir(b'dir/subdir/z'), True) self.assertEqual(dm.visitdir(b'dir/subdir/x'), True) # OPT: We could return 'all' for these. -self.assertEqual(dm.visitdir(b'dir/foo'), True) -self.assertEqual(dm.visitdir(b'folder'), True) +self.assertEqual(dm.visitdir(b'dir/foo'), 'all') +self.assertEqual(dm.visitdir(b'folder'), 'all') def testVisitchildrensetM2SubdirPrefix(self): m1 = matchmod.alwaysmatcher(b'', b'') @@ -322,7 +321,7 @@ dm = matchmod.differencematcher(m1, m2) self.assertEqual(dm.visitdir(b'.'), True) self.assertEqual(dm.visitdir(b'dir'), True) -self.assertEqual(dm.visitdir(b'dir/subdir'), True) +self.assertEqual(dm.visitdir(b'dir/subdir'), 'all') self.assertFalse(dm.visitdir(b'dir/foo')) self.assertFalse(dm.visitdir(b'folder')) # OPT: We should probably return False for these; we don't because diff --git a/mercurial/match.py b/mercurial/match.py --- a/mercurial/match.py +++ b/mercurial/match.py @@ -677,6 +677,9 @@ def visitdir(self, dir): if self._m2.visitdir(dir) == 'all': return False +elif not self._m2.visitdir(dir): +# m2 does not match dir, we can return 'all' here if possible +return self._m1.visitdir(dir) return bool(self._m1.visitdir(dir)) def visitchildrenset(self, dir): To: pulkit, #hg-reviewers Cc: mercurial-devel ___ Mercurial-devel mailing list Mercurial-devel@mercurial-scm.org https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel
D5792: uncommit: added interactive mode(issue6062)
taapas1128 added a comment. @pulkit I was able to import the tests and make them compatible with `hg-stable` . Some tests which include commands like `hg obslog` , `hg amend --extract` , and `hg uncommit -n` which are not part of `hg-stable` but `evolve` are not running else all tests are now running smoothly . REPOSITORY rHG Mercurial REVISION DETAIL https://phab.mercurial-scm.org/D5792 To: taapas1128, #hg-reviewers Cc: pulkit, lothiraldan, mercurial-devel ___ Mercurial-devel mailing list Mercurial-devel@mercurial-scm.org https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel
D5792: uncommit: added interactive mode(issue6062)
taapas1128 updated this revision to Diff 13738. REPOSITORY rHG Mercurial CHANGES SINCE LAST UPDATE https://phab.mercurial-scm.org/D5792?vs=13737=13738 REVISION DETAIL https://phab.mercurial-scm.org/D5792 AFFECTED FILES hgext/uncommit.py tests/test-uncommit-interactive.t tests/test-uncommit.t CHANGE DETAILS diff --git a/tests/test-uncommit.t b/tests/test-uncommit.t --- a/tests/test-uncommit.t +++ b/tests/test-uncommit.t @@ -34,6 +34,7 @@ options ([+] can be repeated): + -i --interactive interactive mode to uncommit --keepallow an empty commit after uncommiting -I --include PATTERN [+] include names matching the given patterns -X --exclude PATTERN [+] exclude names matching the given patterns diff --git a/tests/test-uncommit-interactive.t b/tests/test-uncommit-interactive.t new file mode 100644 --- /dev/null +++ b/tests/test-uncommit-interactive.t @@ -0,0 +1,873 @@ + +|| The test for `hg uncommit --interactive` || + + +Repo Setup + + + $ cat >> $HGRCPATH < [ui] + > interactive = true + > [experimental] + > evolution.createmarkers=True + > evolution.allowunstable=True + > uncommitondirtywdir = true + > [extensions] + > uncommit = + > amend = + > drawdag=$TESTDIR/drawdag.py + > EOF + $ glog() { + > hg log -G --template '{rev}:{node|short}@{branch}({separate("/", obsolete, phase)}) {desc|firstline}\n' "$@" + > } + + $ hg init repo + $ cd repo + + $ touch a + $ cat >> a << EOF + > 1 + > 2 + > 3 + > 4 + > 5 + > EOF + + $ hg add a + $ hg ci -m "The base commit" + +Make sure aborting the interactive selection does no magic +-- + + $ hg status + $ hg uncommit -i< q + > EOF + diff --git a/a b/a + new file mode 100644 + examine changes to 'a'? [Ynesfdaq?] q + + abort: user quit + [255] + $ hg status + +Make a commit with multiple hunks +- + + $ cat > a << EOF + > -2 + > -1 + > 0 + > 1 + > 2 + > 3 + > foo + > bar + > 4 + > 5 + > babar + > EOF + + $ hg diff + diff -r 7733902a8d94 a + --- a/a Thu Jan 01 00:00:00 1970 + + +++ b/a Thu Jan 01 00:00:00 1970 + + @@ -1,5 +1,11 @@ + +-2 + +-1 + +0 + 1 + 2 + 3 + +foo + +bar + 4 + 5 + +babar + + $ hg ci -m "another one" + +Not selecting anything to uncommit +== + + $ hg uncommit -i< y + > n + > n + > n + > EOF + diff --git a/a b/a + 3 hunks, 6 lines changed + examine changes to 'a'? [Ynesfdaq?] y + + @@ -1,3 +1,6 @@ + +-2 + +-1 + +0 + 1 + 2 + 3 + discard change 1/3 to 'a'? [Ynesfdaq?] n + + @@ -1,5 +4,7 @@ + 1 + 2 + 3 + +foo + +bar + 4 + 5 + discard change 2/3 to 'a'? [Ynesfdaq?] n + + @@ -4,2 +9,3 @@ + 4 + 5 + +babar + discard change 3/3 to 'a'? [Ynesfdaq?] n + + abort: nothing selected to uncommit + [255] + $ hg status + +Uncommit a chunk + + + $ hg amend --extract -n "note on amend --extract" -i< y + > y + > n + > n + > EOF + hg amend: option --extract not recognized + hg amend [OPTION]... [FILE]... + + amend the working copy parent with all or specified outstanding changes + + (use 'hg help -e amend' to show help for the amend extension) + + options ([+] can be repeated): + + -A --addremove mark new/missing files as added/removed before +committing + -e --editinvoke editor on commit messages + -i --interactive use interactive mode + -n --note VALUE store a note on the amend + -I --include PATTERN [+] include names matching the given patterns + -X --exclude PATTERN [+] exclude names matching the given patterns + -m --message TEXTuse text as commit message + -l --logfile FILEread commit message from file + -d --date DATE record the specified date as commit date + -u --user USER record the specified user as committer + + (use 'hg amend -h' to show more help) + [255] + + $ hg obslog + hg: unknown command 'obslog' + (did you mean log?) + [255] +The unselected part should be in the diff +- + + $ hg diff + +The commit should contain the rest of part +-- + + $ hg exp + # HG changeset patch + # User test + # Date 0 0 + # Thu Jan 01 00:00:00 1970 + + # Node ID f70fb463d5bf9f0ffd38f105521d96e9f2591bc1 + # Parent 7733902a8d94c789ca81d866bea1893d79442db6 + another one + + diff -r 7733902a8d94 -r f70fb463d5bf a + --- a/a Thu Jan 01 00:00:00 1970 + + +++ b/a Thu Jan 01 00:00:00 1970 + + @@ -1,5 +1,11 @@ + +-2 + +-1 + +0 + 1 + 2 + 3 + +foo + +bar + 4 + 5 + +babar + +Uncommiting on dirty working directory +== + + $
D5792: uncommit: added interactive mode(issue6062)
taapas1128 updated this revision to Diff 13737. taapas1128 edited the summary of this revision. REPOSITORY rHG Mercurial CHANGES SINCE LAST UPDATE https://phab.mercurial-scm.org/D5792?vs=13701=13737 REVISION DETAIL https://phab.mercurial-scm.org/D5792 AFFECTED FILES hgext/uncommit.py tests/test-uncommit-interactive.t tests/test-uncommit.t CHANGE DETAILS diff --git a/tests/test-uncommit.t b/tests/test-uncommit.t --- a/tests/test-uncommit.t +++ b/tests/test-uncommit.t @@ -1,6 +1,8 @@ Test uncommit - set up the config $ cat >> $HGRCPATH < [ui] + > interactive = true > [experimental] > evolution.createmarkers=True > evolution.allowunstable=True @@ -34,6 +36,7 @@ options ([+] can be repeated): + -i --interactive interactive mode to uncommit --keepallow an empty commit after uncommiting -I --include PATTERN [+] include names matching the given patterns -X --exclude PATTERN [+] exclude names matching the given patterns @@ -398,3 +401,15 @@ |/ o 0:ea4e33293d4d274a2ba73150733c2612231f398c a 1 +Test for interactive mode + $ hg init repo3 + $ touch x + $ hg add x + $ hg commit -m "added x" + $ hg uncommit -i< y + > EOF + diff --git a/x b/x + new file mode 100644 + examine changes to 'x'? [Ynesfdaq?] y + diff --git a/tests/test-uncommit-interactive.t b/tests/test-uncommit-interactive.t new file mode 100644 --- /dev/null +++ b/tests/test-uncommit-interactive.t @@ -0,0 +1,873 @@ + +|| The test for `hg uncommit --interactive` || + + +Repo Setup + + + $ cat >> $HGRCPATH < [ui] + > interactive = true + > [experimental] + > evolution.createmarkers=True + > evolution.allowunstable=True + > uncommitondirtywdir = true + > [extensions] + > uncommit = + > amend = + > drawdag=$TESTDIR/drawdag.py + > EOF + $ glog() { + > hg log -G --template '{rev}:{node|short}@{branch}({separate("/", obsolete, phase)}) {desc|firstline}\n' "$@" + > } + + $ hg init repo + $ cd repo + + $ touch a + $ cat >> a << EOF + > 1 + > 2 + > 3 + > 4 + > 5 + > EOF + + $ hg add a + $ hg ci -m "The base commit" + +Make sure aborting the interactive selection does no magic +-- + + $ hg status + $ hg uncommit -i< q + > EOF + diff --git a/a b/a + new file mode 100644 + examine changes to 'a'? [Ynesfdaq?] q + + abort: user quit + [255] + $ hg status + +Make a commit with multiple hunks +- + + $ cat > a << EOF + > -2 + > -1 + > 0 + > 1 + > 2 + > 3 + > foo + > bar + > 4 + > 5 + > babar + > EOF + + $ hg diff + diff -r 7733902a8d94 a + --- a/a Thu Jan 01 00:00:00 1970 + + +++ b/a Thu Jan 01 00:00:00 1970 + + @@ -1,5 +1,11 @@ + +-2 + +-1 + +0 + 1 + 2 + 3 + +foo + +bar + 4 + 5 + +babar + + $ hg ci -m "another one" + +Not selecting anything to uncommit +== + + $ hg uncommit -i< y + > n + > n + > n + > EOF + diff --git a/a b/a + 3 hunks, 6 lines changed + examine changes to 'a'? [Ynesfdaq?] y + + @@ -1,3 +1,6 @@ + +-2 + +-1 + +0 + 1 + 2 + 3 + discard change 1/3 to 'a'? [Ynesfdaq?] n + + @@ -1,5 +4,7 @@ + 1 + 2 + 3 + +foo + +bar + 4 + 5 + discard change 2/3 to 'a'? [Ynesfdaq?] n + + @@ -4,2 +9,3 @@ + 4 + 5 + +babar + discard change 3/3 to 'a'? [Ynesfdaq?] n + + abort: nothing selected to uncommit + [255] + $ hg status + +Uncommit a chunk + + + $ hg amend --extract -n "note on amend --extract" -i< y + > y + > n + > n + > EOF + hg amend: option --extract not recognized + hg amend [OPTION]... [FILE]... + + amend the working copy parent with all or specified outstanding changes + + (use 'hg help -e amend' to show help for the amend extension) + + options ([+] can be repeated): + + -A --addremove mark new/missing files as added/removed before +committing + -e --editinvoke editor on commit messages + -i --interactive use interactive mode + -n --note VALUE store a note on the amend + -I --include PATTERN [+] include names matching the given patterns + -X --exclude PATTERN [+] exclude names matching the given patterns + -m --message TEXTuse text as commit message + -l --logfile FILEread commit message from file + -d --date DATE record the specified date as commit date + -u --user USER record the specified user as committer + + (use 'hg amend -h' to show more help) + [255] + + $ hg obslog + hg: unknown command 'obslog' + (did you mean log?) + [255] +The unselected part should be in the diff +- + + $ hg diff + +The commit should contain the rest of part +-- + + $
D5410: merge: allow to merge non-conflicting changes outside narrowspec
pulkit added a comment. In https://phab.mercurial-scm.org/D5410#80207, @martinvonz wrote: > I'm pretty sure this doesn't actually perform the merge, it just drops the changes outside the narrowspec. On commit, we need to record that outside/ has the new nodeid that we got from the side we merged in. To do that, we need to remember what that nodeid is, from the time of `hg merge` to the time of `hg commit`. That probably means storing the nodeid in the dirstate (like git does), or maybe in the merge state. IIUC, dirstate does not contains files outside narrowspec. Maybe we need to do this in merge state? REPOSITORY rHG Mercurial REVISION DETAIL https://phab.mercurial-scm.org/D5410 To: pulkit, durin42, #hg-reviewers, martinvonz Cc: martinvonz, mercurial-devel ___ Mercurial-devel mailing list Mercurial-devel@mercurial-scm.org https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel
D5417: rust: translated random test of missingancestors
gracinet added a comment. @yuja now that 4.9 is out, I'm getting back to this. This test is useful for me, because it's the only one that really tests the corectness of MissingAncestor, and it's not a bench either. I agree it feels out of place in with the unit tests, so my proposal is to make an integration test out of it. If we don't want to run it, we can do `cargo test --lib`, and in any case `cargo test` does not run integration tests (nor doctests) if the unit tests fail. REPOSITORY rHG Mercurial REVISION DETAIL https://phab.mercurial-scm.org/D5417 To: gracinet, #hg-reviewers Cc: yuja, durin42, kevincox, mercurial-devel ___ Mercurial-devel mailing list Mercurial-devel@mercurial-scm.org https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel
D5813: revset: add expect to check the size of a set
yuja added a comment. > +@predicate('expect(set[, size[, min, max]])', safe=True, takeorder=True) First, I think the word `expect` is too general. Perhaps, this should be called `expectsize()` or `expectlen()`. It's also unclear what's the difference between `size` and `min`/`max`. Instead of these parameters, maybe we can add a `size` parameter that takes a number or a range `min:max`. See also the following patch. https://www.mercurial-scm.org/pipermail/mercurial-devel/2019-February/127916.html > +if len(rev) != n: > +raise error.Abort(_('revset is not of expected size')) Better to raise RepoLookupError so the error can be caught by `present(...)`. > +return rev You need to filter rev by subset. Since we'll probably want to get an ordered result from `expect(set)`, we'll have to conditionalize the filtering direction: if order == followorder: return subset & rev else: return rev & subset You can try out some combinations of `expect(5:0) & 1:10` and `10:1 & expect(0:5)`. REPOSITORY rHG Mercurial REVISION DETAIL https://phab.mercurial-scm.org/D5813 To: navaneeth.suresh, #hg-reviewers Cc: yuja, pulkit, durin42, mjpieters, mercurial-devel ___ Mercurial-devel mailing list Mercurial-devel@mercurial-scm.org https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel
Re: D5813: revset: add expect to check the size of a set
> +@predicate('expect(set[, size[, min, max]])', safe=True, takeorder=True) First, I think the word `expect` is too general. Perhaps, this should be called `expectsize()` or `expectlen()`. It's also unclear what's the difference between `size` and `min`/`max`. Instead of these parameters, maybe we can add a `size` parameter that takes a number or a range `min:max`. See also the following patch. https://www.mercurial-scm.org/pipermail/mercurial-devel/2019-February/127916.html > +if len(rev) != n: > +raise error.Abort(_('revset is not of expected size')) Better to raise RepoLookupError so the error can be caught by `present(...)`. > +return rev You need to filter rev by subset. Since we'll probably want to get an ordered result from `expect(set)`, we'll have to conditionalize the filtering direction: ``` if order == followorder: return subset & rev else: return rev & subset ``` You can try out some combinations of `expect(5:0) & 1:10` and `10:1 & expect(0:5)`. ___ Mercurial-devel mailing list Mercurial-devel@mercurial-scm.org https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel
D5800: config: introduce a new value for ui.relative-paths getting old behavior
yuja added a comment. > > What I thought confusing is `scmutil.getuipathfn(ctx.repo(), legacyvalue=True)` > > in https://phab.mercurial-scm.org/D5801. "What does the `True` mean? relative, absolute, or a complete > > different stuff?" > > Same reason it's confusing, I believe: it's unclear if "legacyvalue=True" means "use the legacy value" (incorrect) or "for the legacy value, use the value True" (correct). I was hoping the "value" part would clarify that, but I agree that it's still not clear. I think you're also saying that the fact that the function deals with producing a cwd-relative or absolute (well, repo-relative) is also not clear and I agree with that too. Yes. `force/legacyvalue` doesn't provide what the `value` means, which is my point. I also get your point. Naming is hard. > Maybe "usedtoberelative=True"? As a non-native speaker, a single word "legacy" is easier to parse than a phrase "used to be". REPOSITORY rHG Mercurial REVISION DETAIL https://phab.mercurial-scm.org/D5800 To: martinvonz, #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: D5800: config: introduce a new value for ui.relative-paths getting old behavior
> > What I thought confusing is `scmutil.getuipathfn(ctx.repo(), > legacyvalue=True)` > > in https://phab.mercurial-scm.org/D5801. "What does the `True` mean? > relative, absolute, or a complete > > different stuff?" > > Same reason it's confusing, I believe: it's unclear if "legacyvalue=True" > means "use the legacy value" (incorrect) or "for the legacy value, use the > value True" (correct). I was hoping the "value" part would clarify that, but > I agree that it's still not clear. I think you're also saying that the fact > that the function deals with producing a cwd-relative or absolute (well, > repo-relative) is also not clear and I agree with that too. Yes. `force/legacyvalue` doesn't provide what the `value` means, which is my point. I also get your point. Naming is hard. > Maybe "usedtoberelative=True"? As a non-native speaker, a single word "legacy" is easier to parse than a phrase "used to be". ___ Mercurial-devel mailing list Mercurial-devel@mercurial-scm.org https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel
Re: [PATCH 1 of 2] extdiff: support tools that can be run simultaneously
On Sun, 03 Feb 2019 08:52:47 -0800, Ludovic Chabant wrote: > > Generally looks good. Can you add some tests? > > Oh right, that's another thing I wanted to ask -- how would I test that? The > only idea I have is to log some verbose message ("tool %s has a graphical > interface, launching processes simultaneously") and detect that in test. Is > there any better way? Something like that. Maybe you can use 'sleep x; echo y' (x/y depending on e.g. filename) as a merge tool to check if the tool spawns asynchronously or not, if that improves the test coverage. ___ Mercurial-devel mailing list Mercurial-devel@mercurial-scm.org https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel
Re: [PATCH] py3: use integer division instead of `int(...)` call
On Mon, 04 Feb 2019 12:17:02 +0100, Boris Feld wrote: > # HG changeset patch > # User Boris Feld > # Date 1549184503 -3600 > # Sun Feb 03 10:01:43 2019 +0100 > # Node ID 23e2af1929c66ab34e9f09bb2caec298e9a8e71c > # Parent 9955776e2adf36c5baabad8f73840a0cdfa19589 > # EXP-Topic div-cleanup > # Available At https://bitbucket.org/octobus/mercurial-devel/ > # hg pull https://bitbucket.org/octobus/mercurial-devel/ -r > 23e2af1929c6 > py3: use integer division instead of `int(...)` call Queued, thanks. ___ Mercurial-devel mailing list Mercurial-devel@mercurial-scm.org https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel
[PATCH] py3: use integer division instead of `int(...)` call
# HG changeset patch # User Boris Feld # Date 1549184503 -3600 # Sun Feb 03 10:01:43 2019 +0100 # Node ID 23e2af1929c66ab34e9f09bb2caec298e9a8e71c # Parent 9955776e2adf36c5baabad8f73840a0cdfa19589 # EXP-Topic div-cleanup # Available At https://bitbucket.org/octobus/mercurial-devel/ # hg pull https://bitbucket.org/octobus/mercurial-devel/ -r 23e2af1929c6 py3: use integer division instead of `int(...)` call Changeset 38a82e0333c9 and 7f853549823b introduced explicit conversion to integer to work around the division behavior change from python2 to python3. Using the integer division operator is a simpler and clearer way to achieve this. diff --git a/hgext/remotefilelog/datapack.py b/hgext/remotefilelog/datapack.py --- a/hgext/remotefilelog/datapack.py +++ b/hgext/remotefilelog/datapack.py @@ -242,8 +242,8 @@ class datapack(basepack.basepack): entry = index[end:end + entrylen] else: while start < end - entrylen: -mid = start + (end - start) / 2 -mid = int(mid - ((mid - params.indexstart) % entrylen)) +mid = start + (end - start) // 2 +mid = mid - ((mid - params.indexstart) % entrylen) midnode = index[mid:mid + NODELENGTH] if midnode == node: entry = index[mid:mid + entrylen] diff --git a/tests/test-remotefilelog-datapack.py b/tests/test-remotefilelog-datapack.py --- a/tests/test-remotefilelog-datapack.py +++ b/tests/test-remotefilelog-datapack.py @@ -292,7 +292,7 @@ class datapacktestsbase(object): class testdatapackstore(datapack.datapackstore): # Ensures that we are not keeping everything in the cache. -DEFAULTCACHESIZE = int(numpacks / 2) +DEFAULTCACHESIZE = numpacks // 2 store = testdatapackstore(uimod.ui(), packdir) ___ Mercurial-devel mailing list Mercurial-devel@mercurial-scm.org https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel