Date: Mon, 04 Apr 2005 16:51:20 -0500 From: Jon Noack <noackjr@alumni.rice.edu> To: Jerry Nairn <jpnairn@gmail.com> Cc: freebsd-cvsweb@freebsd.org Subject: Re: [BUG] unknown-left unknown-right on diff of identical revisions Message-ID: <4251B6D8.4090907@alumni.rice.edu> In-Reply-To: <3bccd73d050401103575526b2c@mail.gmail.com> References: <3bccd73d050401103575526b2c@mail.gmail.com>
next in thread | previous in thread | raw e-mail | index | archive | help
Jerry Nairn wrote: > Hi, > When you do a human readable colored or long colored diff of revisions > which happen to be identical, like you might get by merging two branches, > the revisions shown in the page are 'unknown-left' and 'unknown-right'. > Maybe this is because of a difference in the way rcsdiff works on > different platforms. I don't know. > In the human_readable_diff subroutine, rcsdiff output is parsed to get > revision numbers. (Seems kind of goofy when you already have the revision > numbers.) When there is no output from rcsdiff, this doesn't work, and > these lines set the revisions to 'unknown-left' and 'unknown-right': > > $rev1 = 'unknown-left' unless defined($rev1); > $rev2 = 'unknown-right' unless defined($rev2); > > I added these lines before those two lines above to fix this problem. I'm > sure there's a nicer way to do this. > > $rev1 = $input{tr1} unless defined($rev1); > $rev2 = $input{tr2} unless defined($rev2); > > Sorry if you get this twice. I sent this yesterday, but got no bounced > mail and did not see it on the list. > Cheers, > > Jerry Nairn Hi Jerry, Your change only works for revisions you type into the text field. Here's a more robust fix: Index: cvsweb.cgi =================================================================== RCS file: /home/ncvs/projects/cvsweb/cvsweb.cgi,v retrieving revision 1.291 diff -u -r1.291 cvsweb.cgi --- cvsweb.cgi 22 Jan 2005 12:43:55 -0000 1.291 +++ cvsweb.cgi 4 Apr 2005 20:32:03 -0000 @@ -3641,8 +3641,14 @@ $rev2 = $r2r; $date2 = $r2d; } - $rev1 = 'unknown-left' unless defined($rev1); - $rev2 = 'unknown-right' unless defined($rev2); + $rev1 = $input{r1} unless defined($rev1); + if ($rev1 eq 'text') { + $rev1 = $input{tr1}; + } + $rev2 = $input{r2} unless defined($rev2); + if ($rev2 eq 'text') { + $rev2 = $input{tr2}; + } $date1 = defined($date1) ? ', ' . htmlquote($date1) : ''; $date2 = defined($date2) ? ', ' . htmlquote($date2) : ''; Note that you can still enter arbitrary revisions as we are not validating them and rcsdiff seems to default to the latest revision on the branch for invalid revisions. For example, if the latest revision is 1.35 and you try for a diff between 1.34 and 1.45, it will give you the diff between 1.34 and 1.35 instead. Likewise, if the latest revision on a branch is 1.14.2.9 and you try for 1.14.2.10, it'll use 1.14.2.9 instead. Not also that rcsdiff doesn't produce any (normal) output for invalid branches, so you'll get "no viewable change" in that case. Ideally we should be parsing the STDERR output of rcsdiff. That will give us revision numbers even if the files are identical and will also provide a helpful error message when an invalid branch is specified. Either that or we should validate all revisions/branches ourselves... Ville, if this patch looks good to you please commit it. Jon
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?4251B6D8.4090907>