mirror of
https://github.com/facebook/sapling.git
synced 2024-12-28 07:33:10 +03:00
hgtime: fix corner case of date range parsing
Summary: The docs promise that both `<` and `>` bounds are inclusive, so let's fix that. Reviewed By: markbt Differential Revision: D19580840 fbshipit-source-id: 13770a8e9351fe62f58e9a701b526a167752543a
This commit is contained in:
parent
c000642937
commit
6bf47a9f5a
@ -181,9 +181,9 @@ impl HgTime {
|
||||
date if date.starts_with("since ") => {
|
||||
Self::parse(&date[6..]).map(|start| start..Self::max_value())
|
||||
}
|
||||
date if date.starts_with("<") => {
|
||||
Self::parse(&date[1..]).map(|end| Self::min_value()..end)
|
||||
}
|
||||
date if date.starts_with("<") => Self::parse(&date[1..])
|
||||
.and_then(|end| end + 1)
|
||||
.map(|end| Self::min_value()..end),
|
||||
date if date.starts_with("-") => {
|
||||
// This does not really make much sense. But is supported by hg
|
||||
// (see 'hg help dates').
|
||||
|
@ -246,6 +246,11 @@ Test date formats with '>' or '<' accompanied by space characters
|
||||
Wed Feb 01 13:00:30 2006 -0500
|
||||
Wed Feb 01 13:00:30 2006 +0000
|
||||
|
||||
Test that '<' and '>' are inclusive
|
||||
$ THISCOMMIT=$(hg log -r . -T "{date|hgdate}")
|
||||
$ hg log -r "date(\"<$THISCOMMIT\") & date(\">$THISCOMMIT\")" -T "{node}"
|
||||
cefbcc8b3dc9345a744a11713abfe40a53d4fc9d (no-eol)
|
||||
|
||||
Test issue 3764 (interpreting 'today' and 'yesterday')
|
||||
$ echo "hello" >> a
|
||||
>>> import datetime
|
||||
|
Loading…
Reference in New Issue
Block a user