cvs-cvs
[Top][All Lists]
Advanced

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

[Cvs-cvs] Changes to ccvs/src/update.c


From: Derek Robert Price
Subject: [Cvs-cvs] Changes to ccvs/src/update.c
Date: Thu, 22 Sep 2005 23:19:36 -0400

Index: ccvs/src/update.c
diff -u ccvs/src/update.c:1.255 ccvs/src/update.c:1.256
--- ccvs/src/update.c:1.255     Fri Sep  2 21:51:09 2005
+++ ccvs/src/update.c   Fri Sep 23 03:19:24 2005
@@ -699,8 +699,7 @@
                 {
                     if (vers->ts_conflict)
                     {
-                       if (file_has_conflict (finfo, vers->ts_conflict)
-                           || file_has_markers (finfo))
+                       if (file_has_markers (finfo))
                         {
                             write_letter (finfo, 'C');
                             retval = 1;
@@ -1861,6 +1860,41 @@
 
 
 
+/* Reregister a file after a merge.  */
+static void
+RegisterMerge (struct file_info *finfo, Vers_TS *vers,
+              const char *backup, int has_conflicts)
+{
+    /* This file is the result of a merge, which means that it has
+       been modified.  We use a special timestamp string which will
+       not compare equal to any actual timestamp.  */
+    char *cp = NULL;
+
+    if (has_conflicts)
+    {
+       time (&last_register_time);
+       cp = time_stamp (finfo->file);
+    }
+    Register (finfo->entries, finfo->file, vers->vn_rcs ? vers->vn_rcs : "0",
+             "Result of merge", vers->options, vers->tag, vers->date, cp);
+    if (cp)
+       free (cp);
+
+#ifdef SERVER_SUPPORT
+    /* Send the new contents of the file before the message.  If we
+       wanted to be totally correct, we would have the client write
+       the message only after the file has safely been written.  */
+    if (server_active)
+    {
+        server_copy_file (finfo->file, finfo->update_dir, finfo->repository,
+                         backup);
+       server_updated (finfo, vers, SERVER_MERGED, (mode_t) -1, NULL, NULL);
+    }
+#endif
+}
+
+
+
 /*
  * Do all the magic associated with a file which needs to be merged
  */
@@ -1906,13 +1940,21 @@
           thought needs to go into this, and in the meantime it is safe
           to treat any such mismatch as an automatic conflict. -twp */
 
-#ifdef SERVER_SUPPORT
-       if (server_active)
-           server_copy_file (finfo->file, finfo->update_dir,
-                             finfo->repository, backup);
-#endif
+       status = RCS_checkout (finfo->rcs, finfo->file, vers->vn_rcs,
+                              vers->tag, vers->options, NULL, NULL, NULL);
+       if (status)
+       {
+           error (0, 0, "failed to check out `%s' file", finfo->fullname);
+           error (0, 0, "restoring `%s' from backup file `%s'",
+                  finfo->fullname, backup);
+           rename_file (backup, finfo->file);
+           retval = 1;
+           goto out;
+       }
+
+       xchmod (finfo->file, 1);
 
-       status = checkout_file (finfo, vers, 0, 1, 1);
+       RegisterMerge (finfo, vers, backup, 1);
 
        /* Is there a better term than "nonmergeable file"?  What we
           really mean is, not something that CVS cannot or does not
@@ -1946,24 +1988,6 @@
     if (strcmp (vers->options, "-V4") == 0)
        vers->options[0] = '\0';
 
-    /* This file is the result of a merge, which means that it has
-       been modified.  We use a special timestamp string which will
-       not compare equal to any actual timestamp.  */
-    {
-       char *cp = 0;
-
-       if (status)
-       {
-           (void) time (&last_register_time);
-           cp = time_stamp (finfo->file);
-       }
-       Register (finfo->entries, finfo->file, vers->vn_rcs,
-                 "Result of merge", vers->options, vers->tag,
-                 vers->date, cp);
-       if (cp)
-           free (cp);
-    }
-
     /* fix up the vers structure, in case it is used by join */
     if (join_rev1)
     {
@@ -1974,17 +1998,7 @@
        vers->vn_user = xstrdup (vers->vn_rcs);
     }
 
-#ifdef SERVER_SUPPORT
-    /* Send the new contents of the file before the message.  If we
-       wanted to be totally correct, we would have the client write
-       the message only after the file has safely been written.  */
-    if (server_active)
-    {
-        server_copy_file (finfo->file, finfo->update_dir, finfo->repository,
-                         backup);
-       server_updated (finfo, vers, SERVER_MERGED, (mode_t) -1, NULL, NULL);
-    }
-#endif
+    RegisterMerge (finfo, vers, backup, status);
 
     if (status == 1)
     {
@@ -2562,29 +2576,7 @@
        RCS_checkout above, and we aren't running as the server.
        However, that is not the normal case, and calling Register
        again won't cost much in that case.  */
-    {
-       char *cp = 0;
-
-       if (status)
-       {
-           (void) time (&last_register_time);
-           cp = time_stamp (finfo->file);
-       }
-       Register (finfo->entries, finfo->file,
-                 vers->vn_rcs ? vers->vn_rcs : "0", "Result of merge",
-                 vers->options, vers->tag, vers->date, cp);
-       if (cp)
-           free(cp);
-    }
-
-#ifdef SERVER_SUPPORT
-    if (server_active)
-    {
-       server_copy_file (finfo->file, finfo->update_dir, finfo->repository,
-                         backup);
-       server_updated (finfo, vers, SERVER_MERGED, (mode_t) -1, NULL, NULL);
-    }
-#endif
+    RegisterMerge (finfo, vers, backup, status);
 
 out:
     free (rev1);




reply via email to

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