Fossil

Check-in [432d4391b9]
Login

Many hyperlinks are disabled.
Use anonymous login to enable hyperlinks.

Overview
Comment:Fix a bug in the "leaves" page when the repository is empty. Begin adding support for the ability to erase tags.
Downloads: Tarball | ZIP archive
Timelines: family | ancestors | descendants | both | trunk
Files: files | file ages | folders
SHA1: 432d4391b9b64e3cc556832db60d5c51fc24e98b
User & Date: drh 2009-01-21 13:50:11.000
Context
2009-01-21
17:52
New color choices on the background color editor. check-in: 9c256a46b7 user: drh tags: trunk
13:50
Fix a bug in the "leaves" page when the repository is empty. Begin adding support for the ability to erase tags. check-in: 432d4391b9 user: drh tags: trunk
03:34
After each item of the branch list, give a hyperlink to the timeline that shows all check-ins with the branch tag. check-in: bdcac62937 user: drh tags: trunk
Changes
Unified Diff Ignore Whitespace Patch
Changes to src/descendants.c.
74
75
76
77
78
79
80

81
82
83
84
85
86
87
    "DELETE FROM leaves;"
  );
  bag_init(&seen);
  bag_init(&pending);
  if( iBase<=0 ){
    iBase = db_int(0, "SELECT objid FROM event WHERE type='ci'"
                      " ORDER BY mtime LIMIT 1");

  }
  bag_insert(&pending, iBase);
  db_prepare(&q, "SELECT cid FROM plink WHERE pid=:rid");
  db_prepare(&isBr, 
     "SELECT 1 FROM tagxref WHERE rid=:rid AND tagid=%d AND tagtype=1",
     TAG_NEWBRANCH
  );







>







74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
    "DELETE FROM leaves;"
  );
  bag_init(&seen);
  bag_init(&pending);
  if( iBase<=0 ){
    iBase = db_int(0, "SELECT objid FROM event WHERE type='ci'"
                      " ORDER BY mtime LIMIT 1");
    if( iBase==0 ) return;
  }
  bag_insert(&pending, iBase);
  db_prepare(&q, "SELECT cid FROM plink WHERE pid=:rid");
  db_prepare(&isBr, 
     "SELECT 1 FROM tagxref WHERE rid=:rid AND tagid=%d AND tagtype=1",
     TAG_NEWBRANCH
  );
Changes to src/manifest.c.
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
          /* A valid uuid */
        }else if( blob_size(&a2)==1 && zUuid[0]=='*' ){
          zUuid = 0;
        }else{
          goto manifest_syntax_error;
        }
        defossilize(zName);
        if( zName[0]!='-' && zName[0]!='+' && zName[0]!='*' ){
          goto manifest_syntax_error;
        }
        if( validate16(&zName[1], strlen(&zName[1])) ){
          /* Do not allow tags whose names look like UUIDs */
          goto manifest_syntax_error;
        }
        if( p->nTag>=p->nTagAlloc ){







|







499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
          /* A valid uuid */
        }else if( blob_size(&a2)==1 && zUuid[0]=='*' ){
          zUuid = 0;
        }else{
          goto manifest_syntax_error;
        }
        defossilize(zName);
        if( zName[0]!='-' && zName[0]!='+' && zName[0]!='*' && zName[0]!='0' ){
          goto manifest_syntax_error;
        }
        if( validate16(&zName[1], strlen(&zName[1])) ){
          /* Do not allow tags whose names look like UUIDs */
          goto manifest_syntax_error;
        }
        if( p->nTag>=p->nTagAlloc ){
946
947
948
949
950
951
952
953
954
955

956
957
958
959
960
961
962
      if( m.aTag[i].zUuid ){
        tid = uuid_to_rid(m.aTag[i].zUuid, 1);
      }else{
        tid = rid;
      }
      if( tid ){
        switch( m.aTag[i].zName[0] ){
          case '+':  type = 1; break;
          case '*':  type = 2; break;
          case '-':  type = 0; break;

          default:
            fossil_fatal("unknown tag type in manifest: %s", m.aTag);
            return 0;
        }
        tag_insert(&m.aTag[i].zName[1], type, m.aTag[i].zValue, 
                   rid, m.rDate, tid);
      }







|
|
|
>







946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
      if( m.aTag[i].zUuid ){
        tid = uuid_to_rid(m.aTag[i].zUuid, 1);
      }else{
        tid = rid;
      }
      if( tid ){
        switch( m.aTag[i].zName[0] ){
          case '+':  type = 1;  break;
          case '*':  type = 2;  break;
          case '-':  type = 0;  break;
          case '0':  type = -1; break;
          default:
            fossil_fatal("unknown tag type in manifest: %s", m.aTag);
            return 0;
        }
        tag_insert(&m.aTag[i].zName[1], type, m.aTag[i].zValue, 
                   rid, m.rDate, tid);
      }
Changes to src/tag.c.
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
}

/*
** Insert a tag into the database.
*/
void tag_insert(
  const char *zTag,        /* Name of the tag (w/o the "+" or "-" prefix */
  int tagtype,             /* 0:cancel  1:singleton  2:propagated */
  const char *zValue,      /* Value if the tag is really a property */
  int srcId,               /* Artifact that contains this tag */
  double mtime,            /* Timestamp.  Use default if <=0.0 */
  int rid                  /* Artifact to which the tag is to attached */
){
  Stmt s;
  const char *zCol;







|







140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
}

/*
** Insert a tag into the database.
*/
void tag_insert(
  const char *zTag,        /* Name of the tag (w/o the "+" or "-" prefix */
  int tagtype,             /* 0:cancel  1:singleton  2:propagated -1:erase */
  const char *zValue,      /* Value if the tag is really a property */
  int srcId,               /* Artifact that contains this tag */
  double mtime,            /* Timestamp.  Use default if <=0.0 */
  int rid                  /* Artifact to which the tag is to attached */
){
  Stmt s;
  const char *zCol;
165
166
167
168
169
170
171
172
173




174
175
176
177
178
179
180
    "   AND mtime>=:mtime",
    tagid, rid
  );
  db_bind_double(&s, ":mtime", mtime);
  rc = db_step(&s);
  db_finalize(&s);
  if( rc==SQLITE_ROW ){
    /* Another entry this is more recent already exists.  Do nothing */
    return;




  }
  db_prepare(&s, 
    "REPLACE INTO tagxref(tagid,tagtype,srcId,value,mtime,rid)"
    " VALUES(%d,%d,%d,%Q,:mtime,%d)",
    tagid, tagtype, srcId, zValue, rid
  );
  db_bind_double(&s, ":mtime", mtime);







|

>
>
>
>







165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
    "   AND mtime>=:mtime",
    tagid, rid
  );
  db_bind_double(&s, ":mtime", mtime);
  rc = db_step(&s);
  db_finalize(&s);
  if( rc==SQLITE_ROW ){
    /* Another entry that is more recent already exists.  Do nothing */
    return;
  }
  if( tagtype<0 ){
    return;
    /* TBD: erase tags */
  }
  db_prepare(&s, 
    "REPLACE INTO tagxref(tagid,tagtype,srcId,value,mtime,rid)"
    " VALUES(%d,%d,%d,%Q,:mtime,%d)",
    tagid, tagtype, srcId, zValue, rid
  );
  db_bind_double(&s, ":mtime", mtime);