51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
|
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
|
-
+
-
+
+
+
+
|
Blob pathname;
int isDir;
zName = mprintf("%s", g.argv[i]);
isDir = file_isdir(zName);
if( isDir==1 ) continue;
if( isDir==0 ){
fossil_panic("not found: %s\n", zName);
fossil_fatal("not found: %s", zName);
}
if( isDir==2 && access(zName, R_OK) ){
fossil_panic("cannot open %s\n", zName);
fossil_fatal("cannot open %s", zName);
}
file_tree_name(zName, &pathname);
zPath = blob_str(&pathname);
if( strcmp(zPath, "manifest")==0 || strcmp(zPath, "_FOSSIL_")==0 ){
fossil_fatal("cannot add %s", zPath);
}
if( db_exists("SELECT 1 FROM vfile WHERE pathname=%Q", zPath) ){
db_multi_exec("UPDATE vfile SET deleted=0 WHERE pathname=%Q", zPath);
}else{
db_multi_exec(
"INSERT INTO vfile(vid,deleted,rid,mrid,pathname)"
"VALUES(%d,0,0,0,%Q)", vid, zPath);
}
|
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
|
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
|
-
+
|
Blob pathname;
zName = mprintf("%s", g.argv[i]);
file_tree_name(zName, &pathname);
zPath = blob_str(&pathname);
if( !db_exists(
"SELECT 1 FROM vfile WHERE pathname=%Q AND NOT deleted", zPath) ){
fossil_panic("not in the repository: %s\n", zName);
fossil_fatal("not in the repository: %s", zName);
}else{
db_multi_exec("UPDATE vfile SET deleted=1 WHERE pathname=%Q", zPath);
}
blob_reset(&pathname);
free(zName);
}
db_multi_exec("DELETE FROM vfile WHERE deleted AND rid=0");
db_end_transaction(0);
}
|