Check-in [b5d82ebd7e]
Not logged in
Overview

SHA1 Hash:b5d82ebd7e25ee6f05012a5537ac83b2b7a39774
Date: 2007-09-22 19:03:22
User: drh
Comment:Bug fix in the update command.
Timelines: ancestors | descendants | both | trunk
Other Links: files | ZIP archive | manifest

Tags And Properties
Changes
[hide diffs]

Modified src/update.c from [07dea7ee93] to [7b1df8d7e1].

@@ -27,10 +27,17 @@
 #include "config.h"
 #include "update.h"
 #include <assert.h>
 
 /*
+** Return true if artifact rid is a version
+*/
+int is_a_version(int rid){
+  return db_exists("SELECT 1 FROM plink WHERE cid=%d", rid);
+}
+
+/*
 ** COMMAND: update
 **
 ** Usage: %fossil update ?VERSION?
 **
 ** The optional argument is a version that should become the current
@@ -61,11 +68,11 @@
   if( g.argc==3 ){
     tid = name_to_rid(g.argv[2]);
     if( tid==0 ){
       fossil_fatal("not a version: %s", g.argv[2]);
     }
-    if( !db_exists("SELECT 1 FROM mlink WHERE mid=%d", tid) ){
+    if( !is_a_version(tid) ){
       fossil_fatal("not a version: %s", g.argv[2]);
     }
   }else{
     compute_leaves(vid);
     if( db_int(0, "SELECT count(*) FROM leaves")>1 ){