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.
*/
|
>
>
>
>
>
>
>
>
>
|
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
|
**
** This file contains code used to push, pull, and sync a repository
*/
#include "config.h"
#include "sync.h"
#include <assert.h>
#if defined(_WIN32)
# include <windows.h> /* for Sleep */
# if defined(__MINGW32__) || defined(_MSC_VER)
# define sleep Sleep /* windows does not have sleep, but Sleep */
# endif
#endif
#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.
*/
|
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
|
configSync = CONFIGSET_SHUN;
}
#endif
if( find_option("verbose","v",0)!=0 ) flags |= SYNC_VERBOSE;
fossil_print("Autosync: %s\n", g.url.canonical);
url_enable_proxy("via proxy: ");
rc = client_sync(flags, configSync, 0);
if( rc ) fossil_warning("Autosync failed");
return rc;
}
/*
** 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
|
>
>
>
>
>
>
>
>
>
>
>
|
>
>
>
|
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
|
configSync = CONFIGSET_SHUN;
}
#endif
if( find_option("verbose","v",0)!=0 ) flags |= SYNC_VERBOSE;
fossil_print("Autosync: %s\n", g.url.canonical);
url_enable_proxy("via proxy: ");
rc = client_sync(flags, configSync, 0);
return rc;
}
/*
** This routine will try a number of times to perform autosync with a
** 1 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." : ".");
sleep(1);
}
return rc;
}
/*
** 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
|