Add a test for matching 'date "after year"' working for future patches. ----------------------------------------------------------------------- > Petr Rockai <[EMAIL PROTECTED]>**20081109203045] hunk ./tests/match-date.sh > 193 > # so this test will not work everywhere > # match_date "$year/$mm/$dd $hhmmss $tz" > > +reset_repo > +create_entry '2038-01-01' > +match_date 'after 2037'
:-) Make --match 'date "after year"' work into the future. ------------------------------------------------------ If I understand correctly, this patch fixes the situation where you try to match against patches from the future. For example, say it's 1970 (either because you've generalised patch theory and solved time travel or you've misset your system clock) and you've got some patches from 2008. What happens if you say --match "after 1992"? Well, what darcs did is that is to convert this matcher into 1992 < d < now but if now is too far in the past, we get 1992 < d < 1970 and no patches. Whoops. Petr's solution is to change it so that the matcher is translated into 1992 < d < infinity > -dateRange :: MCalendarTime -> MCalendarTime -> CalendarTime -> Bool > -dateRange a b c = cDateRange (unsafeToCalendarTime a) (unsafeToCalendarTime > b) c > +dateRange :: Maybe MCalendarTime -> Maybe MCalendarTime -> CalendarTime -> > Bool > +dateRange a b c = cDateRange (fmap unsafeToCalendarTime a) > + (fmap unsafeToCalendarTime b) c So MCalendarTime already has Maybe in it (Nothing represents unset fields, for example if you ask for "2007", we set the month to Nothing, which helps us know that we should match on the whole year) I wonder if there is a nice way to avoid unsafeToCalendarTime altogether or if the two Maybes just mean inherently different things? > - (\(a,_) -> cDateRange a rightNow) > + (\(a,_) -> cDateRange (Just a) Nothing) This is the heart of Petr's fix Looks good. Thanks! -- Eric Kow <http://www.nltg.brighton.ac.uk/home/Eric.Kow> PGP Key ID: 08AC04F9
signature.asc
Description: Digital signature
_______________________________________________ darcs-users mailing list [email protected] http://lists.osuosl.org/mailman/listinfo/darcs-users
