Fossil SCM

Improved error message handling on the server side of "sync" requests.

drh 2014-10-22 12:52 trunk merge
Commit bf3db3d16e15ee98f5c72ebdc4ff2f2ed1609ff5
2 files changed +6 -3 +1 -1
+6 -3
--- src/manifest.c
+++ src/manifest.c
@@ -47,10 +47,11 @@
4747
/*
4848
** Flags for use with manifest_crosslink().
4949
*/
5050
#define MC_NONE 0 /* default handling */
5151
#define MC_PERMIT_HOOKS 1 /* permit hooks to execute */
52
+#define MC_NO_ERRORS 2 /* do not issue errors for a bad parse */
5253
5354
/*
5455
** A single F-card within a manifest
5556
*/
5657
struct ManifestFile {
@@ -1733,23 +1734,25 @@
17331734
17341735
if( (p = manifest_cache_find(rid))!=0 ){
17351736
blob_reset(pContent);
17361737
}else if( (p = manifest_parse(pContent, rid, 0))==0 ){
17371738
assert( blob_is_reset(pContent) || pContent==0 );
1738
- fossil_error(1, "syntax error in manifest");
1739
+ if( (flags & MC_NO_ERRORS)==0 ) fossil_error(1, "syntax error in manifest");
17391740
return 0;
17401741
}
17411742
if( g.xlinkClusterOnly && p->type!=CFTYPE_CLUSTER ){
17421743
manifest_destroy(p);
17431744
assert( blob_is_reset(pContent) );
1744
- fossil_error(1, "no manifest");
1745
+ if( (flags & MC_NO_ERRORS)==0 ) fossil_error(1, "no manifest");
17451746
return 0;
17461747
}
17471748
if( p->type==CFTYPE_MANIFEST && fetch_baseline(p, 0) ){
17481749
manifest_destroy(p);
17491750
assert( blob_is_reset(pContent) );
1750
- fossil_error(1, "cannot fetch baseline manifest");
1751
+ if( (flags & MC_NO_ERRORS)==0 ){
1752
+ fossil_error(1, "cannot fetch baseline manifest");
1753
+ }
17511754
return 0;
17521755
}
17531756
db_begin_transaction();
17541757
if( p->type==CFTYPE_MANIFEST ){
17551758
if( permitHooks ){
17561759
--- src/manifest.c
+++ src/manifest.c
@@ -47,10 +47,11 @@
47 /*
48 ** Flags for use with manifest_crosslink().
49 */
50 #define MC_NONE 0 /* default handling */
51 #define MC_PERMIT_HOOKS 1 /* permit hooks to execute */
 
52
53 /*
54 ** A single F-card within a manifest
55 */
56 struct ManifestFile {
@@ -1733,23 +1734,25 @@
1733
1734 if( (p = manifest_cache_find(rid))!=0 ){
1735 blob_reset(pContent);
1736 }else if( (p = manifest_parse(pContent, rid, 0))==0 ){
1737 assert( blob_is_reset(pContent) || pContent==0 );
1738 fossil_error(1, "syntax error in manifest");
1739 return 0;
1740 }
1741 if( g.xlinkClusterOnly && p->type!=CFTYPE_CLUSTER ){
1742 manifest_destroy(p);
1743 assert( blob_is_reset(pContent) );
1744 fossil_error(1, "no manifest");
1745 return 0;
1746 }
1747 if( p->type==CFTYPE_MANIFEST && fetch_baseline(p, 0) ){
1748 manifest_destroy(p);
1749 assert( blob_is_reset(pContent) );
1750 fossil_error(1, "cannot fetch baseline manifest");
 
 
1751 return 0;
1752 }
1753 db_begin_transaction();
1754 if( p->type==CFTYPE_MANIFEST ){
1755 if( permitHooks ){
1756
--- src/manifest.c
+++ src/manifest.c
@@ -47,10 +47,11 @@
47 /*
48 ** Flags for use with manifest_crosslink().
49 */
50 #define MC_NONE 0 /* default handling */
51 #define MC_PERMIT_HOOKS 1 /* permit hooks to execute */
52 #define MC_NO_ERRORS 2 /* do not issue errors for a bad parse */
53
54 /*
55 ** A single F-card within a manifest
56 */
57 struct ManifestFile {
@@ -1733,23 +1734,25 @@
1734
1735 if( (p = manifest_cache_find(rid))!=0 ){
1736 blob_reset(pContent);
1737 }else if( (p = manifest_parse(pContent, rid, 0))==0 ){
1738 assert( blob_is_reset(pContent) || pContent==0 );
1739 if( (flags & MC_NO_ERRORS)==0 ) fossil_error(1, "syntax error in manifest");
1740 return 0;
1741 }
1742 if( g.xlinkClusterOnly && p->type!=CFTYPE_CLUSTER ){
1743 manifest_destroy(p);
1744 assert( blob_is_reset(pContent) );
1745 if( (flags & MC_NO_ERRORS)==0 ) fossil_error(1, "no manifest");
1746 return 0;
1747 }
1748 if( p->type==CFTYPE_MANIFEST && fetch_baseline(p, 0) ){
1749 manifest_destroy(p);
1750 assert( blob_is_reset(pContent) );
1751 if( (flags & MC_NO_ERRORS)==0 ){
1752 fossil_error(1, "cannot fetch baseline manifest");
1753 }
1754 return 0;
1755 }
1756 db_begin_transaction();
1757 if( p->type==CFTYPE_MANIFEST ){
1758 if( permitHooks ){
1759
+1 -1
--- src/xfer.c
+++ src/xfer.c
@@ -201,11 +201,11 @@
201201
if( rid==0 ){
202202
blob_appendf(&pXfer->err, "%s", g.zErrMsg);
203203
blob_reset(&content);
204204
}else{
205205
if( !isPriv ) content_make_public(rid);
206
- manifest_crosslink(rid, &content, MC_NONE);
206
+ manifest_crosslink(rid, &content, MC_NONE|MC_NO_ERRORS);
207207
}
208208
assert( blob_is_reset(&content) );
209209
remote_has(rid);
210210
}
211211
212212
--- src/xfer.c
+++ src/xfer.c
@@ -201,11 +201,11 @@
201 if( rid==0 ){
202 blob_appendf(&pXfer->err, "%s", g.zErrMsg);
203 blob_reset(&content);
204 }else{
205 if( !isPriv ) content_make_public(rid);
206 manifest_crosslink(rid, &content, MC_NONE);
207 }
208 assert( blob_is_reset(&content) );
209 remote_has(rid);
210 }
211
212
--- src/xfer.c
+++ src/xfer.c
@@ -201,11 +201,11 @@
201 if( rid==0 ){
202 blob_appendf(&pXfer->err, "%s", g.zErrMsg);
203 blob_reset(&content);
204 }else{
205 if( !isPriv ) content_make_public(rid);
206 manifest_crosslink(rid, &content, MC_NONE|MC_NO_ERRORS);
207 }
208 assert( blob_is_reset(&content) );
209 remote_has(rid);
210 }
211
212

Keyboard Shortcuts

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