Fossil

Check-in [7653ab6342]
Login

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

Overview
Comment:Introduce the autosync-tries setting to control how many attempts autosync will try if there is a failure. Defaults to 1 which is the current behavior. Disabling autosync is still managed with the autosync setting.
Downloads: Tarball | ZIP archive
Timelines: family | ancestors | descendants | both | autosync-tries
Files: files | file ages | folders
SHA1: 7653ab63420e4ab4ca6372a53de9314a18e1b946
User & Date: andybradford 2014-05-30 03:09:05.151
Context
2014-05-30
14:54
Allow multiple autosync attempts also for the branch and update commands. check-in: 87d323d307 user: andybradford tags: autosync-tries
03:09
Introduce the autosync-tries setting to control how many attempts autosync will try if there is a failure. Defaults to 1 which is the current behavior. Disabling autosync is still managed with the autosync setting. check-in: 7653ab6342 user: andybradford tags: autosync-tries
2014-05-22
05:14
Merge in latest features and fixes. check-in: fbc335d39f user: andybradford tags: autosync-tries
Changes
Unified Diff Ignore Whitespace Patch
Changes to src/checkin.c.
1554
1555
1556
1557
1558
1559
1560
1561
1562
1563
1564
1565
1566
1567
1568
    g.markPrivate = 1;
  }

  /*
  ** Autosync if autosync is enabled and this is not a private check-in.
  */
  if( !g.markPrivate ){
    if( autosync_loop(SYNC_PULL) ){
      prompt_user("continue in spite of sync failure (y/N)? ", &ans);
      cReply = blob_str(&ans)[0];
      if( cReply!='y' && cReply!='Y' ){
        fossil_exit(1);
      }
    }
  }







|







1554
1555
1556
1557
1558
1559
1560
1561
1562
1563
1564
1565
1566
1567
1568
    g.markPrivate = 1;
  }

  /*
  ** Autosync if autosync is enabled and this is not a private check-in.
  */
  if( !g.markPrivate ){
    if( autosync_loop(SYNC_PULL, db_get_int("autosync-tries", 1)) ){
      prompt_user("continue in spite of sync failure (y/N)? ", &ans);
      cReply = blob_str(&ans)[0];
      if( cReply!='y' && cReply!='Y' ){
        fossil_exit(1);
      }
    }
  }
1939
1940
1941
1942
1943
1944
1945
1946
1947
1948
1949
1950
1951
  if( dryRunFlag ){
    db_end_transaction(1);
    exit(1);
  }
  db_end_transaction(0);

  if( !g.markPrivate ){
    autosync_loop(SYNC_PUSH|SYNC_PULL);
  }
  if( count_nonbranch_children(vid)>1 ){
    fossil_print("**** warning: a fork has occurred *****\n");
  }
}







|





1939
1940
1941
1942
1943
1944
1945
1946
1947
1948
1949
1950
1951
  if( dryRunFlag ){
    db_end_transaction(1);
    exit(1);
  }
  db_end_transaction(0);

  if( !g.markPrivate ){
    autosync_loop(SYNC_PUSH|SYNC_PULL, db_get_int("autosync-tries", 1));
  }
  if( count_nonbranch_children(vid)>1 ){
    fossil_print("**** warning: a fork has occurred *****\n");
  }
}
Changes to src/db.c.
2121
2122
2123
2124
2125
2126
2127

2128
2129
2130
2131
2132
2133
2134
struct stControlSettings const ctrlSettings[] = {
  { "access-log",       0,              0, 0, 0, "off"                 },
  { "allow-symlinks",   0,              0, 1, 0, "off"                 },
  { "auto-captcha",     "autocaptcha",  0, 0, 0, "on"                  },
  { "auto-hyperlink",   0,              0, 0, 0, "on",                 },
  { "auto-shun",        0,              0, 0, 0, "on"                  },
  { "autosync",         0,              0, 0, 0, "on"                  },

  { "binary-glob",      0,             40, 1, 0, ""                    },
  { "clearsign",        0,              0, 0, 0, "off"                 },
#if defined(_WIN32) || defined(__CYGWIN__) || defined(__DARWIN__) || \
    defined(__APPLE__)
  { "case-sensitive",   0,              0, 0, 0, "off"                 },
#else
  { "case-sensitive",   0,              0, 0, 0, "on"                  },







>







2121
2122
2123
2124
2125
2126
2127
2128
2129
2130
2131
2132
2133
2134
2135
struct stControlSettings const ctrlSettings[] = {
  { "access-log",       0,              0, 0, 0, "off"                 },
  { "allow-symlinks",   0,              0, 1, 0, "off"                 },
  { "auto-captcha",     "autocaptcha",  0, 0, 0, "on"                  },
  { "auto-hyperlink",   0,              0, 0, 0, "on",                 },
  { "auto-shun",        0,              0, 0, 0, "on"                  },
  { "autosync",         0,              0, 0, 0, "on"                  },
  { "autosync-tries",   0,              0, 0, 0, ""                    },
  { "binary-glob",      0,             40, 1, 0, ""                    },
  { "clearsign",        0,              0, 0, 0, "off"                 },
#if defined(_WIN32) || defined(__CYGWIN__) || defined(__DARWIN__) || \
    defined(__APPLE__)
  { "case-sensitive",   0,              0, 0, 0, "off"                 },
#else
  { "case-sensitive",   0,              0, 0, 0, "on"                  },
2213
2214
2215
2216
2217
2218
2219





2220
2221
2222
2223
2224
2225
2226
**                     Default: on
**
**    autosync         If enabled, automatically pull prior to commit
**                     or update and automatically push after commit or
**                     tag or branch creation.  If the value is "pullonly"
**                     then only pull operations occur automatically.
**                     Default: on





**
**    binary-glob      The VALUE is a comma or newline-separated list of
**     (versionable)   GLOB patterns that should be treated as binary files
**                     for committing and merging purposes.  Example: *.jpg
**
**    case-sensitive   If TRUE, the files whose names differ only in case
**                     are considered distinct.  If FALSE files whose names







>
>
>
>
>







2214
2215
2216
2217
2218
2219
2220
2221
2222
2223
2224
2225
2226
2227
2228
2229
2230
2231
2232
**                     Default: on
**
**    autosync         If enabled, automatically pull prior to commit
**                     or update and automatically push after commit or
**                     tag or branch creation.  If the value is "pullonly"
**                     then only pull operations occur automatically.
**                     Default: on
**
**    autosync-tries   If autosync is enabled setting this to a value greater
**                     than zero will cause autosync to try no more than this
**                     number of attempts if there is a sync failure.
**                     Default: 1
**
**    binary-glob      The VALUE is a comma or newline-separated list of
**     (versionable)   GLOB patterns that should be treated as binary files
**                     for committing and merging purposes.  Example: *.jpg
**
**    case-sensitive   If TRUE, the files whose names differ only in case
**                     are considered distinct.  If FALSE files whose names
Changes to src/sync.c.
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
**
** This file contains code used to push, pull, and sync a repository
*/
#include "config.h"
#include "sync.h"
#include <assert.h>

#define AUTOSYNC_TRIES 3

/*
** If the repository 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 the number of errors.
*/







<
<







17
18
19
20
21
22
23


24
25
26
27
28
29
30
**
** This file contains code used to push, pull, and sync a repository
*/
#include "config.h"
#include "sync.h"
#include <assert.h>



/*
** If the repository 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 the number of errors.
*/
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
  return rc;
}

/*
** This routine will try a number of times to perform autosync with a
** .5 second sleep between attempts; returning the last autosync status.
*/
int autosync_loop(int flags){
  int n = 0;
  int rc = 0;
  while (n++ < AUTOSYNC_TRIES && (rc = autosync(flags))){
    if( rc ) fossil_warning("Autosync failed%s",
      n < AUTOSYNC_TRIES ? ", making another attempt." : ".");
    sqlite3_sleep(500);
  }
  return rc;
}

/*
** This routine processes the command-line argument for push, pull,







|


|

|







77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
  return rc;
}

/*
** This routine will try a number of times to perform autosync with a
** .5 second sleep between attempts; returning the last autosync status.
*/
int autosync_loop(int flags, int nTries){
  int n = 0;
  int rc = 0;
  while( (n==0 || n < nTries) && (rc = autosync(flags) )){
    if( rc ) fossil_warning("Autosync failed%s",
      ++n < nTries ? ", making another attempt." : ".");
    sqlite3_sleep(500);
  }
  return rc;
}

/*
** This routine processes the command-line argument for push, pull,