Fossil SCM
Improved error message handling on the server side of "sync" requests.
Commit
bf3db3d16e15ee98f5c72ebdc4ff2f2ed1609ff5
Parent
6d4e5d801e5958a…
2 files changed
+6
-3
+1
-1
+6
-3
| --- src/manifest.c | ||
| +++ src/manifest.c | ||
| @@ -47,10 +47,11 @@ | ||
| 47 | 47 | /* |
| 48 | 48 | ** Flags for use with manifest_crosslink(). |
| 49 | 49 | */ |
| 50 | 50 | #define MC_NONE 0 /* default handling */ |
| 51 | 51 | #define MC_PERMIT_HOOKS 1 /* permit hooks to execute */ |
| 52 | +#define MC_NO_ERRORS 2 /* do not issue errors for a bad parse */ | |
| 52 | 53 | |
| 53 | 54 | /* |
| 54 | 55 | ** A single F-card within a manifest |
| 55 | 56 | */ |
| 56 | 57 | struct ManifestFile { |
| @@ -1733,23 +1734,25 @@ | ||
| 1733 | 1734 | |
| 1734 | 1735 | if( (p = manifest_cache_find(rid))!=0 ){ |
| 1735 | 1736 | blob_reset(pContent); |
| 1736 | 1737 | }else if( (p = manifest_parse(pContent, rid, 0))==0 ){ |
| 1737 | 1738 | 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"); | |
| 1739 | 1740 | return 0; |
| 1740 | 1741 | } |
| 1741 | 1742 | if( g.xlinkClusterOnly && p->type!=CFTYPE_CLUSTER ){ |
| 1742 | 1743 | manifest_destroy(p); |
| 1743 | 1744 | assert( blob_is_reset(pContent) ); |
| 1744 | - fossil_error(1, "no manifest"); | |
| 1745 | + if( (flags & MC_NO_ERRORS)==0 ) fossil_error(1, "no manifest"); | |
| 1745 | 1746 | return 0; |
| 1746 | 1747 | } |
| 1747 | 1748 | if( p->type==CFTYPE_MANIFEST && fetch_baseline(p, 0) ){ |
| 1748 | 1749 | manifest_destroy(p); |
| 1749 | 1750 | 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 | + } | |
| 1751 | 1754 | return 0; |
| 1752 | 1755 | } |
| 1753 | 1756 | db_begin_transaction(); |
| 1754 | 1757 | if( p->type==CFTYPE_MANIFEST ){ |
| 1755 | 1758 | if( permitHooks ){ |
| 1756 | 1759 |
| --- 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 @@ | ||
| 201 | 201 | if( rid==0 ){ |
| 202 | 202 | blob_appendf(&pXfer->err, "%s", g.zErrMsg); |
| 203 | 203 | blob_reset(&content); |
| 204 | 204 | }else{ |
| 205 | 205 | if( !isPriv ) content_make_public(rid); |
| 206 | - manifest_crosslink(rid, &content, MC_NONE); | |
| 206 | + manifest_crosslink(rid, &content, MC_NONE|MC_NO_ERRORS); | |
| 207 | 207 | } |
| 208 | 208 | assert( blob_is_reset(&content) ); |
| 209 | 209 | remote_has(rid); |
| 210 | 210 | } |
| 211 | 211 | |
| 212 | 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); |
| 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 |