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: Dirk Pranke <dpranke@chromium.org>
changes/44/1487744/3
Bruce Dawson 6 years ago committed by Commit Bot
parent d13a3a7aff
commit 2afcf22ad1

@ -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'

Loading…
Cancel
Save