Fossil SCM

Print a warning and require confirmation prior to continuing with a commit after detection of time skew.

drh 2010-09-29 15:49 trunk
Commit c6a65cbd8176ab1fba402708064bc70222a509ff
--- src/checkin.c
+++ src/checkin.c
@@ -644,10 +644,22 @@
644644
** Autosync if autosync is enabled and this is not a private check-in.
645645
*/
646646
if( !g.markPrivate ){
647647
autosync(AUTOSYNC_PULL);
648648
}
649
+
650
+ /* Require confirmation to continue with the check-in if there is
651
+ ** clock skew
652
+ */
653
+ if( g.clockSkewSeen ){
654
+ Blob ans;
655
+ blob_zero(&ans);
656
+ prompt_user("continue in spite of time skew (y/N)? ", &ans);
657
+ if( blob_str(&ans)[0]!='y' ){
658
+ fossil_exit(1);
659
+ }
660
+ }
649661
650662
/* There are two ways this command may be executed. If there are
651663
** no arguments following the word "commit", then all modified files
652664
** in the checked out directory are committed. If one or more arguments
653665
** follows "commit", then only those files are committed.
654666
--- src/checkin.c
+++ src/checkin.c
@@ -644,10 +644,22 @@
644 ** Autosync if autosync is enabled and this is not a private check-in.
645 */
646 if( !g.markPrivate ){
647 autosync(AUTOSYNC_PULL);
648 }
 
 
 
 
 
 
 
 
 
 
 
 
649
650 /* There are two ways this command may be executed. If there are
651 ** no arguments following the word "commit", then all modified files
652 ** in the checked out directory are committed. If one or more arguments
653 ** follows "commit", then only those files are committed.
654
--- src/checkin.c
+++ src/checkin.c
@@ -644,10 +644,22 @@
644 ** Autosync if autosync is enabled and this is not a private check-in.
645 */
646 if( !g.markPrivate ){
647 autosync(AUTOSYNC_PULL);
648 }
649
650 /* Require confirmation to continue with the check-in if there is
651 ** clock skew
652 */
653 if( g.clockSkewSeen ){
654 Blob ans;
655 blob_zero(&ans);
656 prompt_user("continue in spite of time skew (y/N)? ", &ans);
657 if( blob_str(&ans)[0]!='y' ){
658 fossil_exit(1);
659 }
660 }
661
662 /* There are two ways this command may be executed. If there are
663 ** no arguments following the word "commit", then all modified files
664 ** in the checked out directory are committed. If one or more arguments
665 ** follows "commit", then only those files are committed.
666
+1
--- src/main.c
+++ src/main.c
@@ -83,10 +83,11 @@
8383
FILE *httpOut; /* Send HTTP output here */
8484
int xlinkClusterOnly; /* Set when cloning. Only process clusters */
8585
int fTimeFormat; /* 1 for UTC. 2 for localtime. 0 not yet selected */
8686
int *aCommitFile; /* Array of files to be committed */
8787
int markPrivate; /* All new artifacts are private if true */
88
+ int clockSkewSeen; /* True if clocks on client and server out of sync */
8889
8990
int urlIsFile; /* True if a "file:" url */
9091
int urlIsHttps; /* True if a "https:" url */
9192
int urlIsSsh; /* True if an "ssh:" url */
9293
char *urlName; /* Hostname for http: or filename for file: */
9394
--- src/main.c
+++ src/main.c
@@ -83,10 +83,11 @@
83 FILE *httpOut; /* Send HTTP output here */
84 int xlinkClusterOnly; /* Set when cloning. Only process clusters */
85 int fTimeFormat; /* 1 for UTC. 2 for localtime. 0 not yet selected */
86 int *aCommitFile; /* Array of files to be committed */
87 int markPrivate; /* All new artifacts are private if true */
 
88
89 int urlIsFile; /* True if a "file:" url */
90 int urlIsHttps; /* True if a "https:" url */
91 int urlIsSsh; /* True if an "ssh:" url */
92 char *urlName; /* Hostname for http: or filename for file: */
93
--- src/main.c
+++ src/main.c
@@ -83,10 +83,11 @@
83 FILE *httpOut; /* Send HTTP output here */
84 int xlinkClusterOnly; /* Set when cloning. Only process clusters */
85 int fTimeFormat; /* 1 for UTC. 2 for localtime. 0 not yet selected */
86 int *aCommitFile; /* Array of files to be committed */
87 int markPrivate; /* All new artifacts are private if true */
88 int clockSkewSeen; /* True if clocks on client and server out of sync */
89
90 int urlIsFile; /* True if a "file:" url */
91 int urlIsHttps; /* True if a "https:" url */
92 int urlIsSsh; /* True if an "ssh:" url */
93 char *urlName; /* Hostname for http: or filename for file: */
94
+1
--- src/xfer.c
+++ src/xfer.c
@@ -1097,10 +1097,11 @@
10971097
if( rDiff<0.0 ) rDiff = -rDiff;
10981098
if( rDiff>9e98 ) rDiff = 0.0;
10991099
if( (rDiff*24.0*3600.0)>=60.0 ){
11001100
fossil_warning("*** time skew *** server time differs by %s",
11011101
db_timespan_name(rDiff));
1102
+ g.clockSkewSeen = 1;
11021103
}
11031104
}
11041105
continue;
11051106
}
11061107
xfer.nToken = blob_tokenize(&xfer.line, xfer.aToken, count(xfer.aToken));
11071108
--- src/xfer.c
+++ src/xfer.c
@@ -1097,10 +1097,11 @@
1097 if( rDiff<0.0 ) rDiff = -rDiff;
1098 if( rDiff>9e98 ) rDiff = 0.0;
1099 if( (rDiff*24.0*3600.0)>=60.0 ){
1100 fossil_warning("*** time skew *** server time differs by %s",
1101 db_timespan_name(rDiff));
 
1102 }
1103 }
1104 continue;
1105 }
1106 xfer.nToken = blob_tokenize(&xfer.line, xfer.aToken, count(xfer.aToken));
1107
--- src/xfer.c
+++ src/xfer.c
@@ -1097,10 +1097,11 @@
1097 if( rDiff<0.0 ) rDiff = -rDiff;
1098 if( rDiff>9e98 ) rDiff = 0.0;
1099 if( (rDiff*24.0*3600.0)>=60.0 ){
1100 fossil_warning("*** time skew *** server time differs by %s",
1101 db_timespan_name(rDiff));
1102 g.clockSkewSeen = 1;
1103 }
1104 }
1105 continue;
1106 }
1107 xfer.nToken = blob_tokenize(&xfer.line, xfer.aToken, count(xfer.aToken));
1108

Keyboard Shortcuts

Open search /
Next entry (timeline) j
Previous entry (timeline) k
Open focused entry Enter
Show this help ?
Toggle theme Top nav button