Check-in [49b59bc559]
Not logged in
Overview

SHA1 Hash:49b59bc5593a0e2118604573a04b5f46496740fa
Date: 2008-02-09 00:11:04
User: drh
Comment:Issue a warning after a commit if the commit causes a fork.
Timelines: ancestors | descendants | both | trunk
Other Links: files | ZIP archive | manifest

Tags And Properties
Changes
[hide diffs]

Modified src/branch.c from [40033fd3ad] to [c6483e4ed6].

@@ -153,11 +153,11 @@
 
   /* Commit */
   db_end_transaction(0);
 
   /* Do an autosync push, if requested */
-  autosync(0);
+  autosync(AUTOSYNC_PUSH);
 }
 
 /*
 ** COMMAND: branch
 **

Modified src/checkin.c from [844a72c5ae] to [3db074a16d].

@@ -343,11 +343,11 @@
   verify_all_options();
 
   /*
   ** Autosync if requested.
   */
-  autosync(1);
+  autosync(AUTOSYNC_PULL);
 
   /* There are two ways this command may be executed. If there are
   ** no arguments following the word "commit", then all modified files
   ** in the checked out directory are committed. If one or more arguments
   ** follows "commit", then only those files are committed.
@@ -546,20 +546,13 @@
   undo_reset();
 
   /* Commit */
   db_end_transaction(0);
 
-  if( wouldFork==0 ){
-    /* Do an autosync push if requested. If wouldFork == 1, then they either
-    ** forced this commit or safe merge is on, and this commit did indeed
-    ** create a fork. In this case, we want the user to merge before sending
-    ** their new commit back to the rest of the world, so do not auto-push.
-    */
-    autosync(0);
-  }else{
-    printf("Warning: commit caused a fork to occur. Please merge and push\n");
-    printf("         your changes as soon as possible.\n");
+  autosync(AUTOSYNC_PUSH);
+  if( db_exists("SELECT 1 FROM plink WHERE pid=%d AND cid!=%d", vid, nvid) ){
+    printf("**** warning: a fork has occurred *****\n");
   }
 }
 
 /*
 ** COMMAND: test-import-manifest

Modified src/http.c from [1a73d6f088] to [19e3e65418].

@@ -371,11 +371,11 @@
   }
   for(cnt=0; cnt<2; cnt++){
     if( http_send_recv(&hdr, &payload, pRecv) ) break;
   }
   if( cnt>=2 ){
-    fossil_panic("connection to server failed");
+    fossil_fatal("connection to server failed");
   }
   blob_reset(&hdr);
   blob_reset(&payload);
   if( g.fHttpTrace ){
     printf("HTTP RECEIVE:\n%s\n=======================\n", blob_str(pRecv));

Modified src/sync.c from [39558ac818] to [6d1a08c4d7].

@@ -25,17 +25,26 @@
 */
 #include "config.h"
 #include "sync.h"
 #include <assert.h>
 
+#if INTERFACE
+/*
+** Flags used to determine which direction(s) an autosync goes in.
+*/
+#define AUTOSYNC_PUSH  1
+#define AUTOSYNC_PULL  2
+
+#endif /* INTERFACE */
+
 /*
 ** If the respository is configured for autosyncing, then do an
 ** autosync.  This will be a pull if the argument is true or a push
 ** if the argument is false.  Return true if the autosync is done
 ** and false if autosync is not requested for the current repository.
 */
-int autosync(int pullFlag){
+int autosync(int flags){
   const char *zUrl;
   if( db_get_boolean("autosync", 0)==0 ){
     return 0;
   }
   zUrl = db_get("last-sync-url", 0);
@@ -49,11 +58,11 @@
   if( g.urlPort!=80 ){
     printf("Autosync:  http://%s:%d%s\n", g.urlName, g.urlPort, g.urlPath);
   }else{
     printf("Autosync:  http://%s%s\n", g.urlName, g.urlPath);
   }
-  client_sync(!pullFlag, pullFlag, 0);
+  client_sync((flags & AUTOSYNC_PUSH)!=0, 1, 0);
   return 1;
 }
 
 /*
 ** This routine processes the command-line argument for push, pull,

Modified src/tag.c from [d36aa255e1] to [f79ecb95c0].

@@ -293,11 +293,11 @@
   nrid = content_put(&ctrl, 0, 0);
   manifest_crosslink(nrid, &ctrl);
   db_end_transaction(0);
 
   /* Do an autosync push if requested */
-  autosync(0);
+  autosync(AUTOSYNC_PUSH);
 }
 
 /*
 ** COMMAND: tag
 ** Usage: %fossil tag SUBCOMMAND ...

Modified src/update.c from [c02445cfca] to [69c9aea1a1].

@@ -92,11 +92,11 @@
     ** Do an autosync pull prior to the update, if autosync is on and they
     ** did not want a specific version (i.e. another branch, a past revision).
     ** By not giving a specific version, they are asking for the latest, thus
     ** pull to get the latest, then update.
     */
-    autosync(1);
+    autosync(AUTOSYNC_PULL);
   }
 
   if( tid==0 ){
     compute_leaves(vid);
     if( !latestFlag && db_int(0, "SELECT count(*) FROM leaves")>1 ){