Fossil

Check-in [f7cff4ad]
Login

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

Overview
Comment:Make phantom records a warning, not a fatal error, when trying to checkout or examine a check-in.
Downloads: Tarball | ZIP archive | SQL archive
Timelines: family | ancestors | descendants | both | trunk
Files: files | file ages | folders
SHA1:f7cff4ad13d06ec008119347f65972b6aa406e59
User & Date: drh 2011-01-07 17:17:06
Original Comment: Make phantom records are warning, not a fatal error, when trying to checkout or examine a check-in.
References
2011-01-12
09:35 New ticket [bde9513f] The delta manifest has more files than modified in the checkin. artifact: 29896288 user: anonymous
Context
2011-01-11
23:47
For the "import --git" command, if a new commit omits the "from" field, then make it a child of the previous commit if the two are on the same branch. check-in: 25201dd8 user: drh tags: trunk
2011-01-07
17:17
Make phantom records a warning, not a fatal error, when trying to checkout or examine a check-in. check-in: f7cff4ad user: drh tags: trunk
17:08
Do not complain about unfinalized SQL statements when exiting on a fatal error. Fix comments and indentation on the vfile_verify_not_phantom() function. check-in: c2f5dbe6 user: drh tags: trunk
Changes
Hide Diffs Unified Diffs Ignore Whitespace Patch

Changes to src/vfile.c.

68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122



123
124
125
126
127
128
129
  rid = fast_uuid_to_rid(z);
  if( rid==0 && phantomize ){
    rid = content_new(zUuid);
  }
  return rid;
}

/*
** Verify that an object is not a phantom.  If the object is
** a phantom, output an error message and quit.
*/
static void vfile_verify_not_phantom(
  int rid,                  /* The RID to verify */
  const char *zFilename,    /* Filename.  Might be NULL */
  const char *zUuid         /* UUID.  Might be NULL */
){
  if( db_int(-1, "SELECT size FROM blob WHERE rid=%d", rid)<0
   && (zUuid==0 || !db_exists("SELECT 1 FROM shun WHERE uuid='%s'",zUuid))
  ){
    if( zFilename ){
      fossil_fatal("content missing for %s", zFilename);
    }else{
      char *zUuid = db_text(0, "SELECT uuid FROM blob WHERE rid=%d", rid);
      if( zUuid ){
        fossil_fatal("content missing for [%.10s]", zUuid);
      }else{
        fossil_panic("bad object id: %d", rid);
      }
    }
  }
}

/*
** Build a catalog of all files in a checkin.
*/
void vfile_build(int vid){
  int rid;
  Stmt ins;
  Manifest *p;
  ManifestFile *pFile;

  db_begin_transaction();
  vfile_verify_not_phantom(vid, 0, 0);
  p = manifest_get(vid, CFTYPE_MANIFEST);
  if( p==0 ) return;
  db_multi_exec("DELETE FROM vfile WHERE vid=%d", vid);
  db_prepare(&ins,
    "INSERT INTO vfile(vid,rid,mrid,pathname) "
    " VALUES(:vid,:id,:id,:name)");
  db_bind_int(&ins, ":vid", vid);
  manifest_file_rewind(p);
  while( (pFile = manifest_file_next(p,0))!=0 ){
    if( pFile->zUuid==0 ) continue;
    rid = uuid_to_rid(pFile->zUuid, 0);
    vfile_verify_not_phantom(rid, pFile->zName, pFile->zUuid);



    db_bind_int(&ins, ":id", rid);
    db_bind_text(&ins, ":name", pFile->zName);
    db_step(&ins);
    db_reset(&ins);
  }
  db_finalize(&ins);
  manifest_destroy(p);







<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<










<









|

|
>
>
>







68
69
70
71
72
73
74

























75
76
77
78
79
80
81
82
83
84

85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
  rid = fast_uuid_to_rid(z);
  if( rid==0 && phantomize ){
    rid = content_new(zUuid);
  }
  return rid;
}


























/*
** Build a catalog of all files in a checkin.
*/
void vfile_build(int vid){
  int rid;
  Stmt ins;
  Manifest *p;
  ManifestFile *pFile;

  db_begin_transaction();

  p = manifest_get(vid, CFTYPE_MANIFEST);
  if( p==0 ) return;
  db_multi_exec("DELETE FROM vfile WHERE vid=%d", vid);
  db_prepare(&ins,
    "INSERT INTO vfile(vid,rid,mrid,pathname) "
    " VALUES(:vid,:id,:id,:name)");
  db_bind_int(&ins, ":vid", vid);
  manifest_file_rewind(p);
  while( (pFile = manifest_file_next(p,0))!=0 ){
    if( pFile->zUuid==0 || uuid_is_shunned(pFile->zUuid) ) continue;
    rid = uuid_to_rid(pFile->zUuid, 0);
    if( rid==0 || db_int(-1, "SELECT size FROM blob WHERE rid=%d", rid)<0 ){
      fossil_warning("content missing for %s", pFile->zName);
      continue;
    }
    db_bind_int(&ins, ":id", rid);
    db_bind_text(&ins, ":name", pFile->zName);
    db_step(&ins);
    db_reset(&ins);
  }
  db_finalize(&ins);
  manifest_destroy(p);