On Sat, May 07, 2005 at 11:05:11AM +0200, rghetta wrote: > The following patch adds two new selectors, e: and l: taking a date > expression and meaning respectively "earlier or equal than" and > "strictly later than". > They can be used togheter to form a range [earlier, later). The "later" > end of the range is open.
Cool. > +static void > +sqlite3_normdate_fn(sqlite3_context *f, int nargs, sqlite3_value ** args) What is this normdate stuff for? Sqlite allows <= on strings, and it compares as "strcmp", which seems it should work perfectly well for normalized ISO dates? > --- monotone.texi > +++ monotone.texi > @@ -2292,7 +2292,20 @@ > @code{branch} certs where the cert value begins with @code{net.venge}. > @item Date selection > Uses selector type @code{d}. For example, @code{d:2004-04} matches > [EMAIL PROTECTED] certs where the cert value begins with @code{2004-04}. > [EMAIL PROTECTED] certs where the cert value begins with > [EMAIL PROTECTED] This selector also accepts expanded date syntax (see below). > [EMAIL PROTECTED] "Earlier or equal than" selection > +Uses selector type @code{e}. For example, @code{e:2004-04-25} matches > [EMAIL PROTECTED] certs where the cert value is less or equal than > [EMAIL PROTECTED]:00:00}. If the time component is unspecified, > +monotone will assume 00:00:00. This selector also accepts expanded date > +syntax (see below) ^ missing period > [EMAIL PROTECTED] "Later than" selection > +Uses selector type @code{l}. For example, @code{l:2004-04-25} matches > [EMAIL PROTECTED] certs where the cert value is strictly less than > [EMAIL PROTECTED]:00:00}. If the time component is unspecified, > +monotone will assume 00:00:00. This selector also accepts expanded date > +syntax (see below) ^ likewise > @item Identifier selection > Uses selector type @code{i}. For example, @code{i:0f3a} matches > revision IDs which begin with @code{0f3a}. > @@ -2325,6 +2338,37 @@ > addresses, branch names, or date specifications. For the complete > source code of the hook, see @ref{Hook Reference}. > > [EMAIL PROTECTED] Expanding dates Thanks for documenting this! > - if (str.find_first_not_of(constants::legal_id_bytes) == std::string::npos > - && str.size() == constants::idlen) > + if (str.find_first_not_of (constants::legal_id_bytes) == > + std::string::npos && str.size () == > constants::idlen) ^^ these are literal tabs. Please do not submit patches containing tab characters? (Among the other reasons to not use tabs, there's a fair amount of noise in this patch from just this.) > --- testsuite.at > +++ testsuite.at > @@ -136,6 +136,54 @@ > io.write(string.format("test_attr:%s:%s\n", filename, value)) > end > > +function expand_date(str) If you want to test the behavior of the default hooks, I suggest using RAW_MONOTONE instead of MONOTONE (there are several tests that do this already). This is much better than copying the hook into the testsuite, because if the standard version in monotone changes, then we will be testing the version in the testsuite rather than the version in monotone. Which would make the test kind of pointless :-). -- Nathaniel -- Eternity is very long, especially towards the end. -- Woody Allen _______________________________________________ Monotone-devel mailing list Monotone-devel@nongnu.org http://lists.nongnu.org/mailman/listinfo/monotone-devel