Re: rdiff

"Paul Edwards" <[email protected]>
Newsgroups gmane.comp.version-control.cvs.bugs
Organization BigPond Internet Services (http://www.bigpond.net.au)
Message-ID <[email protected]>
"Paul Edwards" <[email protected]> wrote in message news:[email protected]...
> "Derek Robert Price" <[email protected]> wrote in message news:[email protected]...
> > Once I apply your changes to diff.c, I do see the improvements you
> > mentioned, but I also start seeing failures in the death2 sanity tests.
> >  Specifically, death2-diff-3 starts reporting that it can't find a file
> > that exists in the repository with two revisions specified rather than
> > reporting that the file was removed.
>
> Ok, it sounds like more things are falling into that other bug that
> I mentioned (reproduced below).  In my opinion use_rev2 should
> be NULL for that removed file, and thus detected as removed,
> before hitting my code change.
>
> But I don't know how to get use_rev2 to be NULL.  Any ideas?

I'm going to test this patch out later.  I saw code elsewhere
that seemed to say things like if (use_rev2 or rev2-is-dead) so
maybe that is the way to go.

With a bit of luck this will fix both bugs I reported with diff.

patch against cvs1-11-6.

BFN.  Paul.


Index: diff.c
===================================================================
RCS file: /cvs/ccvs/src/diff.c,v
retrieving revision 1.94
diff -c -r1.94 diff.c
*** diff.c 23 Jan 2003 21:19:17 -0000 1.94
--- diff.c 31 May 2003 04:24:36 -0000
***************
*** 909,920 ****
       freevers_ts (&xvers);
   }

!  if (use_rev1 == NULL)
   {
       /* The first revision does not exist.  If EMPTY_FILES is
                 true, treat this as an added file.  Otherwise, warn
                 about the missing tag.  */
!      if (use_rev2 == NULL)
    /* At least in the case where DIFF_REV1 and DIFF_REV2
       are both numeric, we should be returning some kind
       of error (see basicb-8a0 in testsuite).  The symbolic
--- 909,920 ----
       freevers_ts (&xvers);
   }

!  if ((use_rev1 == NULL) || RCS_isdead (vers->srcfile, use_rev1))
   {
       /* The first revision does not exist.  If EMPTY_FILES is
                 true, treat this as an added file.  Otherwise, warn
                 about the missing tag.  */
!             if ((use_rev2 == NULL) || RCS_isdead (vers->srcfile, use_rev2))
    /* At least in the case where DIFF_REV1 and DIFF_REV2
       are both numeric, we should be returning some kind
       of error (see basicb-8a0 in testsuite).  The symbolic
***************
*** 931,937 ****
       return DIFF_ERROR;
   }

!  if (use_rev2 == NULL)
   {
       /* The second revision does not exist.  If EMPTY_FILES is
                 true, treat this as a removed file.  Otherwise warn
--- 931,937 ----
       return DIFF_ERROR;
   }

!         if ((use_rev2 == NULL) || RCS_isdead (vers->srcfile, use_rev2))
   {
       /* The second revision does not exist.  If EMPTY_FILES is
                 true, treat this as a removed file.  Otherwise warn
***************
*** 948,960 ****
   }

   /* now, see if we really need to do the diff */
   if (strcmp (use_rev1, use_rev2) == 0)
       return DIFF_SAME;
-  else
-      return DIFF_DIFFERENT;
      }

!     if ((diff_rev1 || diff_date1) && use_rev1 == NULL)
      {
   /* The first revision does not exist, and no second revision
             was given.  */
--- 948,966 ----
   }

   /* now, see if we really need to do the diff */
+         /* if the version numbers are identical, we know
+            they are definitely the same, but otherwise we
+            need to continue to the full check */
   if (strcmp (use_rev1, use_rev2) == 0)
       return DIFF_SAME;
      }

!     if ((diff_rev1 || diff_date1)
!          && ((use_rev1 == NULL)
!              || RCS_isdead (vers->srcfile, use_rev1)
!             )
!          && !(diff_rev2 || diff_date2)
!        )
      {
   /* The first revision does not exist, and no second revision
             was given.  */
***************
*** 995,1004 ****
      /* now, see if we really need to do the diff */
      if (use_rev1 && use_rev2)
      {
   if (strcmp (use_rev1, use_rev2) == 0)
       return DIFF_SAME;
-  else
-      return DIFF_DIFFERENT;
      }

      if (use_rev1 == NULL
--- 1001,1011 ----
      /* now, see if we really need to do the diff */
      if (use_rev1 && use_rev2)
      {
+         /* if the version numbers are identical, we know
+            they are definitely the same, but otherwise we
+            need to continue to the full check */
   if (strcmp (use_rev1, use_rev2) == 0)
       return DIFF_SAME;
      }

      if (use_rev1 == NULL
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.