Fossil SCM

Report an error if the "artifact" command does not find an artifact.

drh 2012-02-10 13:13 trunk
Commit 4e47bdc4a316c3d00e9ca07773a4a2e6cfed5547
1 file changed +5 -2
+5 -2
--- src/content.c
+++ src/content.c
@@ -322,12 +322,15 @@
322322
const char *zFile;
323323
db_find_and_open_repository(OPEN_ANY_SCHEMA, 0);
324324
if( g.argc!=4 && g.argc!=3 ) usage("ARTIFACT-ID ?FILENAME? ?OPTIONS?");
325325
zFile = g.argc==4 ? g.argv[3] : "-";
326326
rid = name_to_rid(g.argv[2]);
327
- content_get(rid, &content);
328
- blob_write_to_file(&content, zFile);
327
+ if( content_get(rid, &content) ){
328
+ blob_write_to_file(&content, zFile);
329
+ }else{
330
+ fossil_fatal("no such artifact: %s", g.argv[2]);
331
+ }
329332
}
330333
331334
/*
332335
** COMMAND: test-content-rawget
333336
**
334337
--- src/content.c
+++ src/content.c
@@ -322,12 +322,15 @@
322 const char *zFile;
323 db_find_and_open_repository(OPEN_ANY_SCHEMA, 0);
324 if( g.argc!=4 && g.argc!=3 ) usage("ARTIFACT-ID ?FILENAME? ?OPTIONS?");
325 zFile = g.argc==4 ? g.argv[3] : "-";
326 rid = name_to_rid(g.argv[2]);
327 content_get(rid, &content);
328 blob_write_to_file(&content, zFile);
 
 
 
329 }
330
331 /*
332 ** COMMAND: test-content-rawget
333 **
334
--- src/content.c
+++ src/content.c
@@ -322,12 +322,15 @@
322 const char *zFile;
323 db_find_and_open_repository(OPEN_ANY_SCHEMA, 0);
324 if( g.argc!=4 && g.argc!=3 ) usage("ARTIFACT-ID ?FILENAME? ?OPTIONS?");
325 zFile = g.argc==4 ? g.argv[3] : "-";
326 rid = name_to_rid(g.argv[2]);
327 if( content_get(rid, &content) ){
328 blob_write_to_file(&content, zFile);
329 }else{
330 fossil_fatal("no such artifact: %s", g.argv[2]);
331 }
332 }
333
334 /*
335 ** COMMAND: test-content-rawget
336 **
337

Keyboard Shortcuts

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