This is an automated email from the ASF dual-hosted git repository. brandonwilliams pushed a commit to branch cassandra-4.1 in repository https://gitbox.apache.org/repos/asf/cassandra.git
commit f4ee77ceba8042b71e48c830380899f21b096d71 Merge: cd3e564fb2 ba50ec9cd9 Author: Brandon Williams <brandonwilli...@apache.org> AuthorDate: Fri Aug 18 10:11:12 2023 -0500 Merge branch 'cassandra-4.0' into cassandra-4.1 .build/build-cqlsh.xml | 24 ++++++++++++++++++++++++ CHANGES.txt | 1 + bin/cqlsh.py | 11 +++++++++++ build.xml | 3 ++- 4 files changed, 38 insertions(+), 1 deletion(-) diff --cc CHANGES.txt index e7b058cfa2,a96137164e..ecb58c25ca --- a/CHANGES.txt +++ b/CHANGES.txt @@@ -5,7 -3,10 +5,8 @@@ Merged from 4.0 * Fix BulkLoader ignoring cipher suites options (CASSANDRA-18582) * Migrate Python optparse to argparse (CASSANDRA-17914) Merged from 3.11: - * Moved jflex from runtime to build dependencies (CASSANDRA-18664) Merged from 3.0: -3.0.30 + * CQLSH emits a warning when the server version doesn't match (CASSANDRA-18745) * Fix missing speculative retries in tablestats (CASSANDRA-18767) * Fix Requires for Java for RPM package (CASSANDRA-18751) * Fix CQLSH online help topic link (CASSANDRA-17534) diff --cc bin/cqlsh.py index 0a656c2d32,4ca4469604..ca381a904f --- a/bin/cqlsh.py +++ b/bin/cqlsh.py @@@ -151,12 -162,11 +151,13 @@@ from cqlshlib.displaying import (ANSI_R RED, WHITE, FormattedValue, colorme) from cqlshlib.formatting import (DEFAULT_DATE_FORMAT, DEFAULT_NANOTIME_FORMAT, DEFAULT_TIMESTAMP_FORMAT, CqlType, DateTimeFormat, - format_by_type, formatter_for) + format_by_type) from cqlshlib.tracing import print_trace, print_trace_session -from cqlshlib.util import get_file_encoding_bomsize, trim_if_present +from cqlshlib.util import get_file_encoding_bomsize +from cqlshlib.util import is_file_secure + from cqlshlib.serverversion import version as build_version + DEFAULT_HOST = '127.0.0.1' DEFAULT_PORT = 9042 DEFAULT_SSL = False @@@ -521,8 -512,11 +522,10 @@@ class Shell(cmd.Cmd) if stdin is None: stdin = sys.stdin + self.check_build_versions() + if tty: self.reset_prompt() - self.maybe_warn_py2() self.report_connection() print('Use HELP for help.') else: @@@ -537,9 -531,30 +540,17 @@@ self.single_statement = single_statement self.is_subshell = is_subshell - @property - def batch_mode(self): - return not self.tty - + def check_build_versions(self): + baseversion = self.connection_versions['build'] + extra = baseversion.rfind('-') + if extra: + baseversion = baseversion[0:extra] + if baseversion != build_version: + print("WARNING: cqlsh was built against {}, but this server is {}. All features may not work!".format(baseversion, build_version)) + @property - def is_using_utf8(self): - # utf8 encodings from https://docs.python.org/{2,3}/library/codecs.html - return self.encoding.replace('-', '_').lower() in ['utf', 'utf_8', 'u8', 'utf8', CP65001] - - def check_windows_encoding(self): - if is_win and os.name == 'nt' and self.tty and \ - self.is_using_utf8 and sys.stdout.encoding != CP65001: - self.printerr("\nWARNING: console codepage must be set to cp65001 " - "to support {} encoding on Windows platforms.\n" - "If you experience encoding problems, change your console" - " codepage with 'chcp 65001' before starting cqlsh.\n".format(self.encoding)) + def batch_mode(self): + return not self.tty def set_expanded_cql_version(self, ver): ver, vertuple = full_cql_version(ver) diff --cc build.xml index f99fe469f4,0b914175bb..3593d4bd70 --- a/build.xml +++ b/build.xml @@@ -2403,7 -2220,8 +2403,8 @@@ </target> - <import file="${basedir}/.build/build-resolver.xml"/> - <import file="${basedir}/.build/build-rat.xml"/> - <import file="${basedir}/.build/build-owasp.xml"/> - <import file="${basedir}/.build/build-cqlsh.xml"/> + <import file="${build.helpers.dir}/build-resolver.xml"/> + <import file="${build.helpers.dir}/build-rat.xml"/> + <import file="${build.helpers.dir}/build-owasp.xml"/> ++ <import file="${build.helpers.dir}/build-cqlsh.xml"/> </project> --------------------------------------------------------------------- To unsubscribe, e-mail: commits-unsubscr...@cassandra.apache.org For additional commands, e-mail: commits-h...@cassandra.apache.org