Fossil SCM
Bug fix in the update command.
Commit
b5d82ebd7e25ee6f05012a5537ac83b2b7a39774
Parent
72b3b1ad47f479d…
1 file changed
+8
-1
+8
-1
| --- src/update.c | ||
| +++ src/update.c | ||
| @@ -25,10 +25,17 @@ | ||
| 25 | 25 | ** checkout into a different version and switch to that version. |
| 26 | 26 | */ |
| 27 | 27 | #include "config.h" |
| 28 | 28 | #include "update.h" |
| 29 | 29 | #include <assert.h> |
| 30 | + | |
| 31 | +/* | |
| 32 | +** Return true if artifact rid is a version | |
| 33 | +*/ | |
| 34 | +int is_a_version(int rid){ | |
| 35 | + return db_exists("SELECT 1 FROM plink WHERE cid=%d", rid); | |
| 36 | +} | |
| 30 | 37 | |
| 31 | 38 | /* |
| 32 | 39 | ** COMMAND: update |
| 33 | 40 | ** |
| 34 | 41 | ** Usage: %fossil update ?VERSION? |
| @@ -61,11 +68,11 @@ | ||
| 61 | 68 | if( g.argc==3 ){ |
| 62 | 69 | tid = name_to_rid(g.argv[2]); |
| 63 | 70 | if( tid==0 ){ |
| 64 | 71 | fossil_fatal("not a version: %s", g.argv[2]); |
| 65 | 72 | } |
| 66 | - if( !db_exists("SELECT 1 FROM mlink WHERE mid=%d", tid) ){ | |
| 73 | + if( !is_a_version(tid) ){ | |
| 67 | 74 | fossil_fatal("not a version: %s", g.argv[2]); |
| 68 | 75 | } |
| 69 | 76 | }else{ |
| 70 | 77 | compute_leaves(vid); |
| 71 | 78 | if( db_int(0, "SELECT count(*) FROM leaves")>1 ){ |
| 72 | 79 |
| --- src/update.c | |
| +++ src/update.c | |
| @@ -25,10 +25,17 @@ | |
| 25 | ** checkout into a different version and switch to that version. |
| 26 | */ |
| 27 | #include "config.h" |
| 28 | #include "update.h" |
| 29 | #include <assert.h> |
| 30 | |
| 31 | /* |
| 32 | ** COMMAND: update |
| 33 | ** |
| 34 | ** Usage: %fossil update ?VERSION? |
| @@ -61,11 +68,11 @@ | |
| 61 | if( g.argc==3 ){ |
| 62 | tid = name_to_rid(g.argv[2]); |
| 63 | if( tid==0 ){ |
| 64 | fossil_fatal("not a version: %s", g.argv[2]); |
| 65 | } |
| 66 | if( !db_exists("SELECT 1 FROM mlink WHERE mid=%d", tid) ){ |
| 67 | fossil_fatal("not a version: %s", g.argv[2]); |
| 68 | } |
| 69 | }else{ |
| 70 | compute_leaves(vid); |
| 71 | if( db_int(0, "SELECT count(*) FROM leaves")>1 ){ |
| 72 |
| --- src/update.c | |
| +++ src/update.c | |
| @@ -25,10 +25,17 @@ | |
| 25 | ** checkout into a different version and switch to that version. |
| 26 | */ |
| 27 | #include "config.h" |
| 28 | #include "update.h" |
| 29 | #include <assert.h> |
| 30 | |
| 31 | /* |
| 32 | ** Return true if artifact rid is a version |
| 33 | */ |
| 34 | int is_a_version(int rid){ |
| 35 | return db_exists("SELECT 1 FROM plink WHERE cid=%d", rid); |
| 36 | } |
| 37 | |
| 38 | /* |
| 39 | ** COMMAND: update |
| 40 | ** |
| 41 | ** Usage: %fossil update ?VERSION? |
| @@ -61,11 +68,11 @@ | |
| 68 | if( g.argc==3 ){ |
| 69 | tid = name_to_rid(g.argv[2]); |
| 70 | if( tid==0 ){ |
| 71 | fossil_fatal("not a version: %s", g.argv[2]); |
| 72 | } |
| 73 | if( !is_a_version(tid) ){ |
| 74 | fossil_fatal("not a version: %s", g.argv[2]); |
| 75 | } |
| 76 | }else{ |
| 77 | compute_leaves(vid); |
| 78 | if( db_int(0, "SELECT count(*) FROM leaves")>1 ){ |
| 79 |