Diff
Not logged in

Differences From:

File src/update.c part of check-in [255bacf907] - Added revert command, currently only offering revert to current version. Organized todo.txt a bit, added new bug report by jnc on 2007-09-24 17:11:51. [view]

To:

File src/update.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]

@@ -50,9 +50,9 @@
 **
 */
 void update_cmd(void){
   int vid;              /* Current version */
-  int tid;              /* Target version - version we are changing to */
+  int tid=0;            /* Target version - version we are changing to */
   Stmt q;
   int latestFlag;       /* Pick the latest version if true */
 
   latestFlag = find_option("latest",0, 0)!=0;
@@ -66,8 +66,9 @@
   }
   if( db_exists("SELECT 1 FROM vmerge") ){
     fossil_fatal("cannot update an uncommitted merge");
   }
+
   if( g.argc==3 ){
     tid = name_to_rid(g.argv[2]);
     if( tid==0 ){
       fossil_fatal("not a version: %s", g.argv[2]);
@@ -74,9 +75,17 @@
     }
     if( !is_a_version(tid) ){
       fossil_fatal("not a version: %s", g.argv[2]);
     }
-  }else{
+  }
+
+  if( do_autosync() ){
+    g.argc=2;
+    g.argv[1]="pull";
+    pull_cmd();
+  }
+
+  if( tid==0 ){
     compute_leaves(vid);
     if( !latestFlag && db_int(0, "SELECT count(*) FROM leaves")>1 ){
       db_prepare(&q,
         "%s "