Many hyperlinks are disabled.
Use anonymous login
to enable hyperlinks.
Overview
Comment: | Coding style and compiler warning fixes. |
---|---|
Downloads: | Tarball | ZIP archive |
Timelines: | family | ancestors | descendants | both | ckol-th1-dir-cmd |
Files: | files | file ages | folders |
SHA1: |
4b17cb66e852d2992ba175f21965ca03 |
User & Date: | mistachkin 2015-08-15 18:37:44.831 |
Context
2015-08-15
| ||
18:47 | Restore read-only TH1 tests to their original file. Coding style fixes in tests. Add 'dir' command to the expected command list test. ... (check-in: 25e9c00b user: mistachkin tags: ckol-th1-dir-cmd) | |
18:37 | Coding style and compiler warning fixes. ... (check-in: 4b17cb66 user: mistachkin tags: ckol-th1-dir-cmd) | |
13:37 | added copyright header to test file ... (check-in: a0d01050 user: ckolumbus tags: ckol-th1-dir-cmd) | |
Changes
Changes to src/th_main.c.
︙ | ︙ | |||
141 142 143 144 145 146 147 | if( g.thTrace ){ fossil_print("\n------------------ BEGIN TRACE LOG ------------------\n"); fossil_print("%s", blob_str(&g.thLog)); fossil_print("\n------------------- END TRACE LOG -------------------\n"); } } | < | | | | | < < < < < | < < < | | < < < | < | < > > < < < | | 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 | if( g.thTrace ){ fossil_print("\n------------------ BEGIN TRACE LOG ------------------\n"); fossil_print("%s", blob_str(&g.thLog)); fossil_print("\n------------------- END TRACE LOG -------------------\n"); } } /* ** - adopted from ls_cmd_rev in checkin.c ** - adopted commands/error handling for usage within th1 ** - interface adopted to allow result creation as TH1 List ** ** Takes a checkin identifier in zRev and an optiona glob pattern in zGLOB ** as parameter returns a TH list in pzList,pnList with filenames matching ** glob pattern with the checking */ static void dir_cmd_rev( Th_Interp *interp, char **pzList, int *pnList, const char *zRev, /* Revision string given */ const char *zGlob /* Glob pattern given */ ){ Stmt q; char *zOrderBy = "pathname COLLATE nocase"; int rid; rid = th1_name_to_typed_rid(interp, zRev, "ci"); compute_fileage(rid, zGlob); db_prepare(&q, "SELECT datetime(fileage.mtime, 'localtime'), fileage.pathname,\n" " blob.size\n" " FROM fileage, blob\n" " WHERE blob.rid=fileage.fid \n" " ORDER BY %s;", zOrderBy /*safe-for-%s*/ ); while( db_step(&q)==SQLITE_ROW ){ const char *zFile = db_column_text(&q, 1); Th_ListAppend(interp, pzList, pnList, zFile, -1); } db_finalize(&q); } /* ** TH1 command: dir CHECKIN ?GLOB? ** ** Returns a list containing all files in CHECKIN. If GLOB is given only ** the files matching the pattern GLOB within CHECKIN will be returned. */ static int dirCmd( Th_Interp *interp, void *ctx, int argc, const char **argv, int *argl ){ const char *zGlob = 0; if( argc!=2 && argc!=3 ){ return Th_WrongNumArgs(interp, "dir CHECKIN ?GLOB?"); } if( argc==3 ){ zGlob = argv[2]; } if( Th_IsRepositoryOpen() ){ char *zList = 0; int nList = 0; dir_cmd_rev(interp, &zList, &nList, argv[1], zGlob); Th_SetResult(interp, zList, nList); Th_Free(interp, zList); return TH_OK; }else{ Th_SetResult(interp, "repository unavailable", -1); return TH_ERROR; } } /* ** TH1 command: httpize STRING |
︙ | ︙ |