Diff
Not logged in

Differences From:

File src/sync.c part of check-in [6607844a01] - Added options to the "timeline" CLI command. Additional help comments. by drh on 2007-08-18 11:42:24. [view]

To:

File src/sync.c part of check-in [b773dda29b] - Autosync config parameter added (autosync). Setting this to 1, y or Y (or yes, Yes, yes, YES, etc...) will cause autosync's to happen during certian operations. Right now, the only operation paying attention to this is update. If autosync and you do fossil update, a pull takes place first, then an update. Others will follow (commit for one). by jnc on 2007-09-25 06:56:54. [view]

@@ -25,8 +25,24 @@
 */
 #include "config.h"
 #include "sync.h"
 #include <assert.h>
+
+/*
+** Determine if an autosync should be done or not. The config setting,
+** autosync must start with 1, y or Y. The last-sync-url must also be
+** defined.
+*/
+int do_autosync(void){
+  const char *zAutoSync = db_global_get("autosync", 0);
+  if( zAutoSync != 0
+      && (zAutoSync[0]=='1' || zAutoSync[0]=='y' || zAutoSync=='Y')
+      && db_get("last-sync-url", 0)!=0 ){
+    return 1;
+  }else{
+    return 0;
+  }
+}
 
 /*
 ** This routine processes the command-line argument for push, pull,
 ** and sync.  If a command-line argument is given, that is the URL