Fossil

Check-in [b773dda2]
Login

Many hyperlinks are disabled.
Use anonymous login to enable hyperlinks.

Overview
Comment: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).
Downloads: Tarball | ZIP archive | SQL archive
Timelines: family | ancestors | descendants | both | trunk
Files: files | file ages | folders
SHA1:b773dda29bce549a7b66d1a89aea43ad8e87bfc2
User & Date: jnc 2007-09-25 06:56:54
Context
2007-09-25
07:11
Once a successful commit is made, if autosync is on, a push is now done. This commit will be the first test of that new functionality :-) check-in: 0431f14e user: jnc tags: trunk
06:56
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). check-in: b773dda2 user: jnc tags: trunk
03:14
Fix some problems with tag propagation. More problems remain. check-in: 913608a5 user: drh tags: trunk
Changes
Hide Diffs Unified Diffs Ignore Whitespace Patch

Changes to src/sync.c.

22
23
24
25
26
27
28
















29
30
31
32
33
34
35
*******************************************************************************
**
** This file contains code used to push, pull, and sync a repository
*/
#include "config.h"
#include "sync.h"
#include <assert.h>

















/*
** This routine processes the command-line argument for push, pull,
** and sync.  If a command-line argument is given, that is the URL
** of a server to sync against.  If no argument is given, use the
** most recently synced URL.  Remember the current URL for next time.
*/







>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>







22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
*******************************************************************************
**
** This file contains code used to push, pull, and sync a repository
*/
#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
** of a server to sync against.  If no argument is given, use the
** most recently synced URL.  Remember the current URL for next time.
*/

Changes to src/update.c.

47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
..
63
64
65
66
67
68
69

70
71
72
73
74
75
76
77
78









79
80
81
82
83
84
85
**
** This command is different from the "checkout" in that edits are
** not overwritten.  Edits are merged into the new version.
**
*/
void update_cmd(void){
  int vid;              /* Current version */
  int tid;              /* Target version - version we are changing to */
  Stmt q;
  int latestFlag;       /* Pick the latest version if true */

  latestFlag = find_option("latest",0, 0)!=0;
  if( g.argc!=3 && g.argc!=2 ){
    usage("?VERSION?");
  }
................................................................................
  vid = db_lget_int("checkout", 0);
  if( vid==0 ){
    fossil_fatal("cannot find current version");
  }
  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]);
    }
    if( !is_a_version(tid) ){
      fossil_fatal("not a version: %s", g.argv[2]);
    }
  }else{









    compute_leaves(vid);
    if( !latestFlag && db_int(0, "SELECT count(*) FROM leaves")>1 ){
      db_prepare(&q, 
        "%s "
        "   AND event.objid IN leaves"
        " ORDER BY event.mtime DESC",
        timeline_query_for_tty()







|







 







>








<
>
>
>
>
>
>
>
>
>







47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
..
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78

79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
**
** This command is different from the "checkout" in that edits are
** not overwritten.  Edits are merged into the new version.
**
*/
void update_cmd(void){
  int vid;              /* Current version */
  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;
  if( g.argc!=3 && g.argc!=2 ){
    usage("?VERSION?");
  }
................................................................................
  vid = db_lget_int("checkout", 0);
  if( vid==0 ){
    fossil_fatal("cannot find current version");
  }
  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]);
    }
    if( !is_a_version(tid) ){
      fossil_fatal("not a version: %s", g.argv[2]);
    }

  }

  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 "
        "   AND event.objid IN leaves"
        " ORDER BY event.mtime DESC",
        timeline_query_for_tty()