patch: date formats

Martin Renold <[email protected]>
Newsgroups gmane.comp.version-control.cvs.bugs
Message-ID <[email protected]>
Hi,

This patch makes cvs understand dates like "DD.MM.YYYY" (the one we learn
in school here), and additionally "two days ago" (instead of 
"2 days ago").

I could not figure out how to make "DD.MM. HH:MM"  working cleanly,
because the parser overlooks the space and thinks HH is the year. I tried
a new token tUNUMBER_DOT but it messed the whole thing up and I reversed
those changes.

By the way, "15.5.03" will not work as expected, it's a y2k issue. The
best way would be to interprete two digit years between CURRENTYEAR - 49
and CURRENTYEAR + 50, but, well...

Please CC me any comments, I am not subscribed.

bye,
Martin

Index: lib/getdate.y
===================================================================
RCS file: /cvs/ccvs/lib/getdate.y,v
retrieving revision 1.18
diff -u -r1.18 getdate.y
--- lib/getdate.y	23 Jan 2003 21:16:36 -0000	1.18
+++ lib/getdate.y	15 May 2003 16:28:08 -0000
@@ -305,6 +305,20 @@
 	    yyDay = $1;
 	    yyYear = $3;
 	}
+	| tUNUMBER '.' {
+	    yyDay = $1;
+	}
+	| tUNUMBER '.' tUNUMBER '.' {
+	    /* FIXME: "22:00 19.4." will work, but "19.4. 22:00" will not
+	     * because the parser eats the space */
+	    yyDay = $1;
+	    yyMonth = $3;
+	}
+	| tUNUMBER '.' tUNUMBER '.' tUNUMBER {
+	    yyDay = $1;
+	    yyMonth = $3;
+	    yyYear = $5;
+	}
 	;
 
 rel	: relunit tAGO {
@@ -433,6 +447,18 @@
     { "last",		tUNUMBER,	-1 },
     { "this",		tMINUTE_UNIT,	0 },
     { "next",		tUNUMBER,	2 },
+    { "one",		tUNUMBER,	1 },
+    { "two",		tUNUMBER,	2 },
+    { "three",		tUNUMBER,	3 },
+    { "four",		tUNUMBER,	4 },
+    { "five",		tUNUMBER,	5 },
+    { "six",		tUNUMBER,	6 },
+    { "seven",		tUNUMBER,	7 },
+    { "eight",		tUNUMBER,	8 },
+    { "nine",		tUNUMBER,	9 },
+    { "ten",		tUNUMBER,	10 },
+    { "eleven",		tUNUMBER,	11 },
+    { "twelve",		tUNUMBER,	12 },
     { "first",		tUNUMBER,	1 },
 /*  { "second",		tUNUMBER,	2 }, */
     { "third",		tUNUMBER,	3 },
Index: man/cvs.1
===================================================================
RCS file: /cvs/ccvs/man/cvs.1,v
retrieving revision 1.35
diff -u -r1.35 cvs.1
--- man/cvs.1	19 Mar 2003 21:13:30 -0000	1.35
+++ man/cvs.1	15 May 2003 16:28:12 -0000
@@ -486,6 +486,7 @@
 yesterday
 a fortnight ago
 3/31/92 10:00:07 PST
+16:40 15.5.
 January 23, 1987 10:05pm
 22:00 GMT
 .fi
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.