cqlsh: Count only empty lines for a "Blank lines" warning. patch by Mikhail Stepura; reviewed by Tyler Hobbs for CASSANDRA-7325
Project: http://git-wip-us.apache.org/repos/asf/cassandra/repo Commit: http://git-wip-us.apache.org/repos/asf/cassandra/commit/e2c74d56 Tree: http://git-wip-us.apache.org/repos/asf/cassandra/tree/e2c74d56 Diff: http://git-wip-us.apache.org/repos/asf/cassandra/diff/e2c74d56 Branch: refs/heads/cassandra-2.1 Commit: e2c74d56551575c553927a9c0f31fe07f2614894 Parents: c2563db Author: Mikhail Stepura <mish...@apache.org> Authored: Fri May 23 00:15:30 2014 -0700 Committer: Mikhail Stepura <mish...@apache.org> Committed: Fri May 30 10:52:20 2014 -0700 ---------------------------------------------------------------------- CHANGES.txt | 1 + bin/cqlsh | 8 +++++--- 2 files changed, 6 insertions(+), 3 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/cassandra/blob/e2c74d56/CHANGES.txt ---------------------------------------------------------------------- diff --git a/CHANGES.txt b/CHANGES.txt index 75e6759..c3145eb 100644 --- a/CHANGES.txt +++ b/CHANGES.txt @@ -8,6 +8,7 @@ * Add option to do more aggressive tombstone compactions (CASSANDRA-6563) * Don't try to compact already-compacting files in HHOM (CASSANDRA-7288) * Add authentication support to shuffle (CASSANDRA-6484) + * Cqlsh counts non-empty lines for "Blank lines" warning (CASSANDRA-7325) Merged from 1.2: * Fix availability validation for LOCAL_ONE CL (CASSANDRA-7319) http://git-wip-us.apache.org/repos/asf/cassandra/blob/e2c74d56/bin/cqlsh ---------------------------------------------------------------------- diff --git a/bin/cqlsh b/bin/cqlsh index 75c4299..0b8327d 100755 --- a/bin/cqlsh +++ b/bin/cqlsh @@ -726,7 +726,7 @@ class Shell(cmd.Cmd): else: spaces = ' ' * len(str(self.current_keyspace)) self.set_prompt(self.keyspace_continue_prompt % spaces) - self.empty_lines += 1 + self.empty_lines = self.empty_lines + 1 if not self.lastcmd else 0 @contextmanager def prepare_loop(self): @@ -752,9 +752,11 @@ class Shell(cmd.Cmd): def get_input_line(self, prompt=''): if self.tty: - line = raw_input(prompt) + '\n' + self.lastcmd = raw_input(prompt) + line = self.lastcmd + '\n' else: - line = self.stdin.readline() + self.lastcmd = self.stdin.readline() + line = self.lastcmd if not len(line): raise EOFError self.lineno += 1