Fossil SCM

Bug fix in the update command.

drh 2007-09-22 19:03 trunk
Commit b5d82ebd7e25ee6f05012a5537ac83b2b7a39774
1 file changed +8 -1
+8 -1
--- src/update.c
+++ src/update.c
@@ -25,10 +25,17 @@
2525
** checkout into a different version and switch to that version.
2626
*/
2727
#include "config.h"
2828
#include "update.h"
2929
#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
+}
3037
3138
/*
3239
** COMMAND: update
3340
**
3441
** Usage: %fossil update ?VERSION?
@@ -61,11 +68,11 @@
6168
if( g.argc==3 ){
6269
tid = name_to_rid(g.argv[2]);
6370
if( tid==0 ){
6471
fossil_fatal("not a version: %s", g.argv[2]);
6572
}
66
- if( !db_exists("SELECT 1 FROM mlink WHERE mid=%d", tid) ){
73
+ if( !is_a_version(tid) ){
6774
fossil_fatal("not a version: %s", g.argv[2]);
6875
}
6976
}else{
7077
compute_leaves(vid);
7178
if( db_int(0, "SELECT count(*) FROM leaves")>1 ){
7279
--- 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

Keyboard Shortcuts

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