bug-cvs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: CVS update: MODIFIED: src ... (was: join not producing conflict)


From: Derek Robert Price
Subject: Re: CVS update: MODIFIED: src ... (was: join not producing conflict)
Date: Fri, 24 Oct 2003 19:01:46 -0400
User-agent: Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.4) Gecko/20030624 Netscape/7.1

-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

Hey Mark,

I found two cases you hadn't checked for and got irked at the way the
code was behaving.  Let me know what you think.

dprice@cvshome.org wrote:

| User: dprice | Date: 03/10/24 15:49:58
|
|  Modified:    src      Tag: cvs1-11-x-branch ChangeLog sanity.sh update.c
|  Log:
|  * update.c (join_file): Restore the optimization Mark recently removed,
|  but fix it.  Move one other optimization up since it needs to be
|  checked for first.  Add bew status messages like merge_file produces
|  when the requested diff has already been applied to the destination.
|  Expand header comment.
|  * sanity.sh (join6): Add tests for the new error messages.
|  (import-113, join-admin-2, diffmerge1): Fix collateral damage.
| | Revision Changes Path
|  No                   revision
| | http://ccvs.cvshome.org/source/browse/ccvs/src/Tag:
|  No                   revision
| | http://ccvs.cvshome.org/source/browse/ccvs/src/cvs1-11-x-branch
|  1.2336.2.120 +10 -0     ccvs/src/ChangeLog
| |
http://ccvs.cvshome.org/source/browse/ccvs/src/ChangeLog.diff?r1=1.2336.2.119&r2=1.2336.2.120
| | (In the diff below, changes in quantity of whitespace are not shown.) | | Index: ChangeLog
|  ===================================================================
|  RCS file: /cvsroot/ccvs/src/ChangeLog,v
|  retrieving revision 1.2336.2.119
|  retrieving revision 1.2336.2.120
|  diff -u -b -r1.2336.2.119 -r1.2336.2.120
|  --- ChangeLog    24 Oct 2003 00:04:08 -0000    1.2336.2.119
|  +++ ChangeLog    24 Oct 2003 22:49:53 -0000    1.2336.2.120
|  @@ -1,3 +1,13 @@
|  +2003-10-24  Derek Price  <derek@ximbiot.com>
|  +
|  +    * update.c (join_file): Restore the optimization Mark recently
removed,
|  +    but fix it.  Move one other optimization up since it needs to be
|  +    checked for first.  Add bew status messages like merge_file produces
|  +    when the requested diff has already been applied to the destination.
|  +    Expand header comment.
|  +    * sanity.sh (join6): Add tests for the new error messages.
|  +    (import-113, join-admin-2, diffmerge1): Fix collateral damage.
|  +
|   2003-10-23  Mark D. Baushke  <mdb@cvshome.org>
| | * update.c (join_file): Do the -jrev1 -jrev2 merge even when | | | | 1.752.2.49 +37 -9 ccvs/src/sanity.sh | |
http://ccvs.cvshome.org/source/browse/ccvs/src/sanity.sh.diff?r1=1.752.2.48&r2=1.752.2.49
| | (In the diff below, changes in quantity of whitespace are not shown.) | | Index: sanity.sh
|  ===================================================================
|  RCS file: /cvsroot/ccvs/src/sanity.sh,v
|  retrieving revision 1.752.2.48
|  retrieving revision 1.752.2.49
|  diff -u -b -r1.752.2.48 -r1.752.2.49
|  --- sanity.sh    24 Oct 2003 00:04:08 -0000    1.752.2.48
|  +++ sanity.sh    24 Oct 2003 22:49:53 -0000    1.752.2.49
|  @@ -7186,14 +7186,8 @@
|   retrieving revision 1\.1\.1\.2
|   Merging differences between 1\.1\.1\.1 and 1\.1\.1\.2 into imported-f2
|   rcsmerge: warning: conflicts during merge
|  -RCS file: ${CVSROOT_DIRNAME}/first-dir/imported-f3,v
|  -retrieving revision 1\.1\.1\.1
|  -retrieving revision 1\.1\.1\.2
|  -Merging differences between 1\.1\.1\.1 and 1\.1\.1\.2 into imported-f3
|  -RCS file: ${CVSROOT_DIRNAME}/first-dir/imported-f4,v
|  -retrieving revision 1\.1\.1\.1
|  -retrieving revision 1\.1\.1\.3
|  -Merging differences between 1\.1\.1\.1 and 1\.1\.1\.3 into imported-f4"
|  +first-dir/imported-f3 already contains the differences between
1\.1\.1\.1 and 1\.1\.1\.2
|  +first-dir/imported-f4 already contains the differences between
1\.1\.1\.1 and 1\.1\.1\.3"
| | cd first-dir | | @@ -8682,6 +8676,37 @@
|   ${CVSROOT_DIRNAME}/join6/temp.txt,v  <--  temp\.txt
|   new revision: 1\.2; previous revision: 1\.1
|   done"
|  +
|  +      # The case where the merge target is up-to-date and its base
revision
|  +      # matches the second argument to -j: CVS doesn't bother attempting
|  +      # the merge since it already knows that the target contains the
|  +      # change.
|  +      dotest join6-3.2 "${testcvs} diff temp\.txt" ""
|  +      dotest join6-3.3 "${testcvs} update -j1.1 -j1.2 temp\.txt" \
|  +"temp\.txt already contains the differences between 1\.1 and 1\.2"
|  +      dotest join6-3.4 "${testcvs} diff temp\.txt" ""
|  +
|  +      # The case where the merge target is modified but already contains
|  +      # the change.
|  +      echo bbb >temp.txt
|  +      echo ccc >>temp.txt
|  +      echo ddd >>temp.txt
|  +      dotest join6-3.5 "${testcvs} update -j1.1 -j1.2 temp.txt" \
|  +"M temp\.txt
|  +RCS file: ${CVSROOT_DIRNAME}/join6/temp\.txt,v
|  +retrieving revision 1\.1
|  +retrieving revision 1\.2
|  +Merging differences between 1\.1 and 1\.2 into temp\.txt
|  +temp\.txt already contains the differences between 1\.1 and 1\.2"
|  +      dotest_fail join6-3.6 "${testcvs} diff temp.txt" \
|  +"Index: temp\.txt
|  +===================================================================
|  +RCS file: ${CVSROOT_DIRNAME}/join6/temp\.txt,v
|  +retrieving revision 1\.2
|  +diff -r1\.2 temp.txt
|  +1d0
|  +< aaa"
|  +
|         cp temp2.txt temp.txt
|         dotest_fail join6-4 "${testcvs} diff temp.txt" \
|   "Index: temp.txt
|  @@ -8944,6 +8969,7 @@
|   retrieving revision 1\.1
|   retrieving revision 1\.2
|   Merging differences between 1\.1 and 1\.2 into e
|  +e already contains the differences between 1\.1 and 1\.2
|   ${QUESTION} e0" \
|   "${QUESTION} e0
|   ${PROG} update: Updating .
|  @@ -8952,7 +8978,8 @@
|   RCS file: ${CVSROOT_DIRNAME}/x/e,v
|   retrieving revision 1\.1
|   retrieving revision 1\.2
|  -Merging differences between 1\.1 and 1\.2 into e"
|  +Merging differences between 1\.1 and 1\.2 into e
|  +e already contains the differences between 1\.1 and 1\.2"
| | # Verify that the $Id.$ string is not expanded.
|         dotest join-admin-2-15 "cat e" '$''Id$'
|  @@ -22251,6 +22278,7 @@
|   retrieving revision 1\.1\.1\.1
|   retrieving revision 1\.1\.1\.1\.2\.1
|   Merging differences between 1\.1\.1\.1 and 1\.1\.1\.1\.2\.1 into
testcase07
|  +testcase07 already contains the differences between 1\.1\.1\.1 and
1\.1\.1\.1\.2\.1
|   M testcase08
|   RCS file: ${CVSROOT_DIRNAME}/diffmerge1/testcase08,v
|   retrieving revision 1\.1\.1\.1
| | | | 1.202.4.9 +85 -26 ccvs/src/update.c | |
http://ccvs.cvshome.org/source/browse/ccvs/src/update.c.diff?r1=1.202.4.8&r2=1.202.4.9
| | (In the diff below, changes in quantity of whitespace are not shown.) | | Index: update.c
|  ===================================================================
|  RCS file: /cvsroot/ccvs/src/update.c,v
|  retrieving revision 1.202.4.8
|  retrieving revision 1.202.4.9
|  diff -u -b -r1.202.4.8 -r1.202.4.9
|  --- update.c    24 Oct 2003 00:04:10 -0000    1.202.4.8
|  +++ update.c    24 Oct 2003 22:49:56 -0000    1.202.4.9
|  @@ -2081,7 +2081,19 @@
| | /*
|    * Do all the magic associated with a file which needs to be joined
|  - * (-j option)
|  + * (reached via the -j option to checkout or update).
|  + *
|  + * INPUTS
|  + *   finfo        File information about the destination file.
|  + *   vers        The Vers_TS structure for finfo.
|  + *
|  + * GLOBALS
|  + *   join_rev1        From the command line.
|  + *   join_rev2        From the command line.
|  + *   server_active    Natch.
|  + *
|  + * ASSUMPTIONS
|  + *   1.  Is not called in client mode.
|    */
|   static void
|   join_file (finfo, vers)
|  @@ -2316,14 +2328,43 @@
|       return;
|       }
| | - /* At one time, there was a test here to see if the file to be
|  -       merged was already at rev2. If so, this function returned after
|  -       freeing rev1 and rev2. The assumption that there was nothing
|  -       useful to do appears to have been a bad one. However, not
|  -       having that block of code means that text that was
|  -       intentionally added, removed or modified in the area of the
|  -       merge requested will either be silently re-introduced,
|  -       re-removed, or result in conflict markers. */
|  +    /* If the two merge revisions are the same, then there is nothing
|  +     * to do.  This needs to be checked before the rev2 ==
up-to-date base
|  +     * revision check tha comes next.  Otherwise, rev1 can == rev2
and get an
|  +     * "already contains the changes between <rev1> and <rev1>" message.
|  +     */
|  +    if (rev1 && strcmp (rev1, rev2) == 0)
|  +    {
|  +    free (rev1);
|  +    free (rev2);
|  +    return;
|  +    }
|  +
|  +    /* If we know that the user file is up-to-date, then it becomes an
|  +     * optimization to skip the merge when rev2 is the same as the base
|  +     * revision.  i.e. we know that diff3(file2,file1,file2) will
produce
|  +     * file2.
|  +     */
|  +    if (vers->ts_user
|  +        && strcmp (vers->ts_user, vers->ts_rcs) == 0
|  +        && strcmp (rev2, vers->vn_user) == 0)
|  +    {
|  +    if (!really_quiet)
|  +    {
|  +        cvs_output (finfo->fullname, 0);
|  +        cvs_output (" already contains the differences between ", 0);
|  +        cvs_output (rev1, 0);
|  +        cvs_output (" and ", 0);
|  +        cvs_output (rev2, 0);
|  +        cvs_output ("\n", 1);
|  +    }
|  +
|  +    if (rev1 != NULL)
|  +        free (rev1);
|  +    free (rev2);
|  +
|  +    return;
|  +    }
| | /* If rev1 is dead or does not exist, then the file was added
|          between rev1 and rev2.  */
|  @@ -2376,15 +2417,6 @@
|       return;
|       }
| | - /* If the two merge revisions are the same, then there is nothing
|  -       to do.  */
|  -    if (strcmp (rev1, rev2) == 0)
|  -    {
|  -    free (rev1);
|  -    free (rev2);
|  -    return;
|  -    }
|  -
|       /* If there is no working file, then we can't do the merge.  */
|       if (vers->vn_user == NULL || vers->vn_user[0] == '-')
|       {
|  @@ -2549,7 +2581,9 @@
|       status = RCS_merge (finfo->rcs, vers->srcfile->path, finfo->file,
|                   t_options, rev1, rev2);
| | - if (status != 0 && status != 1)
|  +    if (status != 0)
|  +    {
|  +    if (status != 1)
|       {
|       error (0, status == -1 ? errno : 0,
|              "could not merge revision %s of %s", rev2, finfo->fullname);
|  @@ -2557,8 +2591,29 @@
|              finfo->fullname, backup);
|       rename_file (backup, finfo->file);
|       }
|  -    free (rev1);
|  -    free (rev2);
|  +    }
|  +    else /* status == 0 */
|  +    {
|  +    /* FIXME: the noexec case is broken.  RCS_merge could be doing the
|  +       xcmp on the temporary files without much hassle, I think.  */
|  +    if (!noexec && !xcmp (backup, finfo->file))
|  +    {
|  +        if (!really_quiet)
|  +        {
|  +        cvs_output (finfo->fullname, 0);
|  +        cvs_output (" already contains the differences between ", 0);
|  +        cvs_output (rev1, 0);
|  +        cvs_output (" and ", 0);
|  +        cvs_output (rev2, 0);
|  +        cvs_output ("\n", 1);
|  +        }
|  +
|  +        /* and skip the registering and sending the new file since it
|  +         * hasn't been updated.
|  +         */
|  +        goto out;
|  +    }
|  +    }
| | /* The file has changed, but if we just checked it out it may
|          still have the same timestamp it did when it was first
|  @@ -2595,6 +2650,10 @@
|               (struct buffer *) NULL);
|       }
|   #endif
|  +
|  +out:
|  +    free (rev1);
|  +    free (rev2);
|       free (backup);
|   }
| | | | |
|---------------------------------------------------------------------
|To unsubscribe, e-mail: cvs-unsubscribe@ccvs.cvshome.org
|For additional commands, e-mail: cvs-help@ccvs.cvshome.org


Derek

- --
~                *8^)

Email: derek@ximbiot.com

Get CVS support at <http://ximbiot.com>!
- --
Of all the gin joints in all the towns in all the world, she walks into
mine.

       - Humphrey Bogart as Rick, _Casablanca_
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.0.7 (GNU/Linux)
Comment: Using GnuPG with Netscape - http://enigmail.mozdev.org

iD8DBQE/ma9YLD1OTBfyMaQRAuPLAJ9i7UKT0zzemFEn6Q9bZz3kamXDXgCgkQG8
SUHktgJ2OcBLLbRLLZ5BXMc=
=Q16S
-----END PGP SIGNATURE-----






reply via email to

[Prev in Thread] Current Thread [Next in Thread]