Commit 2afcf22a authored by Bruce Dawson's avatar Bruce Dawson Committed by Commit Bot

Check for impossible date ranges

If you specify the wrong year to the -b flag then you may end up with an
inverted time range that is entirely in the future, and this causes odd
failures. Or at least that's what I've heard. This detects some of these
error cases and halts.

Also a one-line git cl format cleanup.

Change-Id: Iede80faed00d4857443b3a1d853fa2ba69f47023
Reviewed-on: https://chromium-review.googlesource.com/c/1487744
Commit-Queue: Bruce Dawson <brucedawson@chromium.org>
Auto-Submit: Bruce Dawson <brucedawson@chromium.org>
Reviewed-by: 's avatarDirk Pranke <dpranke@chromium.org>
parent d13a3a7a
......@@ -700,7 +700,7 @@ class MyActivity(object):
if self.changes:
self.print_heading('Changes')
for change in self.changes:
self.print_change(change)
self.print_change(change)
def print_access_errors(self):
if self.access_errors:
......@@ -1039,6 +1039,12 @@ def main():
else:
end = datetime.today()
options.begin, options.end = begin, end
if begin >= end:
# The queries fail in peculiar ways when the begin date is in the future.
# Give a descriptive error message instead.
logging.error('Start date (%s) is the same or later than end date (%s)' %
(begin, end))
return 1
if options.markdown:
options.output_format_heading = '### {heading}\n'
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment