Fossil SCM

merge with trunk

venkat 2010-11-08 04:52 venks-emacs merge
Commit c18bbf69eb7730fb038d3edddb5777cbabbe3009
+7 -7
--- src/file.c
+++ src/file.c
@@ -309,16 +309,19 @@
309309
void cmd_test_canonical_name(void){
310310
int i;
311311
Blob x;
312312
blob_zero(&x);
313313
for(i=2; i<g.argc; i++){
314
+ char zBuf[100];
314315
const char *zName = g.argv[i];
315316
file_canonical_name(zName, &x);
316317
printf("%s\n", blob_buffer(&x));
317318
blob_reset(&x);
318
- printf(" file_size = %lld\n", file_size(zName));
319
- printf(" file_mtime = %lld\n", file_mtime(zName));
319
+ sqlite3_snprintf(sizeof(zBuf), zBuf, "%lld", file_size(zName));
320
+ printf(" file_size = %s\n", zBuf);
321
+ sqlite3_snprintf(sizeof(zBuf), zBuf, "%lld", file_mtime(zName));
322
+ printf(" file_mtime = %s\n", zBuf);
320323
printf(" file_isfile = %d\n", file_isfile(zName));
321324
printf(" file_isexe = %d\n", file_isexe(zName));
322325
printf(" file_isdir = %d\n", file_isdir(zName));
323326
}
324327
}
@@ -424,26 +427,23 @@
424427
** false, then simply return 0.
425428
**
426429
** The root of the tree is defined by the g.zLocalRoot variable.
427430
*/
428431
int file_tree_name(const char *zOrigName, Blob *pOut, int errFatal){
429
- int m,n;
432
+ int n;
430433
Blob full;
431434
db_must_be_within_tree();
432435
file_canonical_name(zOrigName, &full);
433436
n = strlen(g.zLocalRoot);
434
- m = blob_size(&full);
435
- if( m<n-1 || memcmp(g.zLocalRoot, blob_buffer(&full), n-1) ){
437
+ if( blob_size(&full)<=n || memcmp(g.zLocalRoot, blob_buffer(&full), n) ){
436438
blob_reset(&full);
437439
if( errFatal ){
438440
fossil_fatal("file outside of checkout tree: %s", zOrigName);
439441
}
440442
return 0;
441443
}
442444
blob_zero(pOut);
443
- if (m == n - 1)
444
- return 1;
445445
blob_append(pOut, blob_buffer(&full)+n, blob_size(&full)-n);
446446
return 1;
447447
}
448448
449449
/*
450450
--- src/file.c
+++ src/file.c
@@ -309,16 +309,19 @@
309 void cmd_test_canonical_name(void){
310 int i;
311 Blob x;
312 blob_zero(&x);
313 for(i=2; i<g.argc; i++){
 
314 const char *zName = g.argv[i];
315 file_canonical_name(zName, &x);
316 printf("%s\n", blob_buffer(&x));
317 blob_reset(&x);
318 printf(" file_size = %lld\n", file_size(zName));
319 printf(" file_mtime = %lld\n", file_mtime(zName));
 
 
320 printf(" file_isfile = %d\n", file_isfile(zName));
321 printf(" file_isexe = %d\n", file_isexe(zName));
322 printf(" file_isdir = %d\n", file_isdir(zName));
323 }
324 }
@@ -424,26 +427,23 @@
424 ** false, then simply return 0.
425 **
426 ** The root of the tree is defined by the g.zLocalRoot variable.
427 */
428 int file_tree_name(const char *zOrigName, Blob *pOut, int errFatal){
429 int m,n;
430 Blob full;
431 db_must_be_within_tree();
432 file_canonical_name(zOrigName, &full);
433 n = strlen(g.zLocalRoot);
434 m = blob_size(&full);
435 if( m<n-1 || memcmp(g.zLocalRoot, blob_buffer(&full), n-1) ){
436 blob_reset(&full);
437 if( errFatal ){
438 fossil_fatal("file outside of checkout tree: %s", zOrigName);
439 }
440 return 0;
441 }
442 blob_zero(pOut);
443 if (m == n - 1)
444 return 1;
445 blob_append(pOut, blob_buffer(&full)+n, blob_size(&full)-n);
446 return 1;
447 }
448
449 /*
450
--- src/file.c
+++ src/file.c
@@ -309,16 +309,19 @@
309 void cmd_test_canonical_name(void){
310 int i;
311 Blob x;
312 blob_zero(&x);
313 for(i=2; i<g.argc; i++){
314 char zBuf[100];
315 const char *zName = g.argv[i];
316 file_canonical_name(zName, &x);
317 printf("%s\n", blob_buffer(&x));
318 blob_reset(&x);
319 sqlite3_snprintf(sizeof(zBuf), zBuf, "%lld", file_size(zName));
320 printf(" file_size = %s\n", zBuf);
321 sqlite3_snprintf(sizeof(zBuf), zBuf, "%lld", file_mtime(zName));
322 printf(" file_mtime = %s\n", zBuf);
323 printf(" file_isfile = %d\n", file_isfile(zName));
324 printf(" file_isexe = %d\n", file_isexe(zName));
325 printf(" file_isdir = %d\n", file_isdir(zName));
326 }
327 }
@@ -424,26 +427,23 @@
427 ** false, then simply return 0.
428 **
429 ** The root of the tree is defined by the g.zLocalRoot variable.
430 */
431 int file_tree_name(const char *zOrigName, Blob *pOut, int errFatal){
432 int n;
433 Blob full;
434 db_must_be_within_tree();
435 file_canonical_name(zOrigName, &full);
436 n = strlen(g.zLocalRoot);
437 if( blob_size(&full)<=n || memcmp(g.zLocalRoot, blob_buffer(&full), n) ){
 
438 blob_reset(&full);
439 if( errFatal ){
440 fossil_fatal("file outside of checkout tree: %s", zOrigName);
441 }
442 return 0;
443 }
444 blob_zero(pOut);
 
 
445 blob_append(pOut, blob_buffer(&full)+n, blob_size(&full)-n);
446 return 1;
447 }
448
449 /*
450
+130 -133
--- src/finfo.c
+++ src/finfo.c
@@ -37,15 +37,10 @@
3737
** a quick status and does not check for up-to-date-ness of the file.
3838
**
3939
** The -p form, there's an optional flag "-r|--revision REVISION". The
4040
** specified version (or the latest checked out version) is printed to
4141
** stdout.
42
-**
43
-** Print the change history for a single file.
44
-**
45
-** The "--limit N" and "--offset P" options limit the output to the first
46
-** N changes after skipping P changes.
4742
*/
4843
void finfo_cmd(void){
4944
int vid;
5045
5146
db_must_be_within_tree();
@@ -53,138 +48,140 @@
5348
if( vid==0 ){
5449
fossil_panic("no checkout to finfo files in");
5550
}
5651
vfile_check_signature(vid, 1);
5752
if (find_option("status","s",0)) {
58
- Stmt q;
59
- Blob line;
60
- Blob fname;
61
-
62
- if (g.argc != 3) {
63
- usage("-s|--status FILENAME");
64
- }
65
- file_tree_name(g.argv[2], &fname, 1);
66
- db_prepare(&q,
67
- "SELECT pathname, deleted, rid, chnged, coalesce(origname!=pathname,0)"
68
- " FROM vfile WHERE vfile.pathname=%B", &fname);
69
- blob_zero(&line);
70
- if ( db_step(&q)==SQLITE_ROW ) {
71
- Blob uuid;
72
- int isDeleted = db_column_int(&q, 1);
73
- int isNew = db_column_int(&q,2) == 0;
74
- int chnged = db_column_int(&q,3);
75
- int renamed = db_column_int(&q,4);
76
-
77
- blob_zero(&uuid);
78
- db_blob(&uuid,"SELECT uuid FROM blob, mlink, vfile WHERE "
79
- "blob.rid = mlink.mid AND mlink.fid = vfile.rid AND "
80
- "vfile.pathname=%B",&fname);
81
- if (isNew) {
82
- blob_appendf(&line, "new");
83
- } else if (isDeleted) {
84
- blob_appendf(&line, "deleted");
85
- } else if (renamed) {
86
- blob_appendf(&line, "renamed");
87
- } else if (chnged) {
88
- blob_appendf(&line, "edited");
89
- } else {
90
- blob_appendf(&line, "unchanged");
91
- }
92
- blob_appendf(&line, " ");
93
- blob_appendf(&line, " %10.10s", blob_str(&uuid));
94
- blob_reset(&uuid);
95
- } else {
96
- blob_appendf(&line, "unknown 0000000000");
97
- }
98
- db_finalize(&q);
99
- printf("%s\n", blob_str(&line));
100
- blob_reset(&fname);
101
- blob_reset(&line);
102
- } else if (find_option("print","p",0)) {
103
- Blob record;
104
- Blob fname;
105
- const char *zRevision = find_option("revision", "r", 1);
106
-
107
- file_tree_name(g.argv[2], &fname, 1);
108
- if (zRevision) {
109
- historical_version_of_file(zRevision, blob_str(&fname), &record, 0);
110
- } else {
111
- int rid = db_int(0, "SELECT rid FROM vfile WHERE pathname=%B", &fname);
112
- if( rid==0 ){
113
- fossil_fatal("no history for file: %b", &fname);
114
- }
115
- content_get(rid, &record);
116
- }
117
- blob_write_to_file(&record, "-");
118
- blob_reset(&record);
119
- blob_reset(&fname);
120
- } else {
121
- Blob line;
122
- Stmt q;
123
- Blob fname;
124
- int rid;
125
- const char *zFilename;
126
- const char *zLimit;
127
- const char *zOffset;
128
- int iLimit, iOffset, iBrief;
129
-
130
- if (find_option("log","l",0)) { /* this is the default, no-op */
131
- }
132
- zLimit = find_option("limit",0,1);
133
- iLimit = zLimit ? atoi(zLimit) : -1;
134
- zOffset = find_option("offset",0,1);
135
- iOffset = zOffset ? atoi(zOffset) : 0;
136
- iBrief = (find_option("brief","b",0) == 0);
137
- if (g.argc != 3) {
138
- usage("?-l|--log? ?-b|--brief? FILENAME");
139
- }
140
- file_tree_name(g.argv[2], &fname, 1);
141
- rid = db_int(0, "SELECT rid FROM vfile WHERE pathname=%B", &fname);
142
- if( rid==0 ){
143
- fossil_fatal("no history for file: %b", &fname);
144
- }
145
- zFilename = blob_str(&fname);
146
- db_prepare(&q,
147
- "SELECT b.uuid, ci.uuid, date(event.mtime,'localtime'),"
148
- " coalesce(event.ecomment, event.comment),"
149
- " coalesce(event.euser, event.user)"
150
- " FROM mlink, blob b, event, blob ci"
151
- " WHERE mlink.fnid=(SELECT fnid FROM filename WHERE name=%Q)"
152
- " AND b.rid=mlink.fid"
153
- " AND event.objid=mlink.mid"
154
- " AND event.objid=ci.rid"
155
- " ORDER BY event.mtime DESC LIMIT %d OFFSET %d",
156
- zFilename, iLimit, iOffset
157
- );
158
- blob_zero(&line);
159
- if (iBrief) {
160
- printf("History of %s\n", blob_str(&fname));
161
- }
162
- while( db_step(&q)==SQLITE_ROW ){
163
- const char *zFileUuid = db_column_text(&q, 0);
164
- const char *zCiUuid = db_column_text(&q,1);
165
- const char *zDate = db_column_text(&q, 2);
166
- const char *zCom = db_column_text(&q, 3);
167
- const char *zUser = db_column_text(&q, 4);
168
- char *zOut;
169
- if (iBrief) {
170
- printf("%s ", zDate);
171
- zOut = sqlite3_mprintf("[%.10s] %s (user: %s, artifact: [%.10s])",
172
- zCiUuid, zCom, zUser, zFileUuid);
173
- comment_print(zOut, 11, 79);
174
- sqlite3_free(zOut);
175
- } else {
176
- blob_reset(&line);
177
- blob_appendf(&line, "%.10s ", zCiUuid);
178
- blob_appendf(&line, "%.10s ", zDate);
179
- blob_appendf(&line, "%8.8s ", zUser);
180
- blob_appendf(&line,"%-40.40s\n", zCom );
181
- comment_print(blob_str(&line), 0, 79);
182
- }
183
- }
184
- db_finalize(&q);
185
- blob_reset(&fname);
53
+ Stmt q;
54
+ Blob line;
55
+ Blob fname;
56
+
57
+ if( g.argc!=3 ) usage("-s|--status FILENAME");
58
+ file_tree_name(g.argv[2], &fname, 1);
59
+ db_prepare(&q,
60
+ "SELECT pathname, deleted, rid, chnged, coalesce(origname!=pathname,0)"
61
+ " FROM vfile WHERE vfile.pathname=%B", &fname);
62
+ blob_zero(&line);
63
+ if ( db_step(&q)==SQLITE_ROW ) {
64
+ Blob uuid;
65
+ int isDeleted = db_column_int(&q, 1);
66
+ int isNew = db_column_int(&q,2) == 0;
67
+ int chnged = db_column_int(&q,3);
68
+ int renamed = db_column_int(&q,4);
69
+
70
+ blob_zero(&uuid);
71
+ db_blob(&uuid,
72
+ "SELECT uuid FROM blob, mlink, vfile WHERE "
73
+ "blob.rid = mlink.mid AND mlink.fid = vfile.rid AND "
74
+ "vfile.pathname=%B",
75
+ &fname
76
+ );
77
+ if( isNew ){
78
+ blob_appendf(&line, "new");
79
+ }else if( isDeleted ){
80
+ blob_appendf(&line, "deleted");
81
+ }else if( renamed ){
82
+ blob_appendf(&line, "renamed");
83
+ }else if( chnged ){
84
+ blob_appendf(&line, "edited");
85
+ }else{
86
+ blob_appendf(&line, "unchanged");
87
+ }
88
+ blob_appendf(&line, " ");
89
+ blob_appendf(&line, " %10.10s", blob_str(&uuid));
90
+ blob_reset(&uuid);
91
+ }else{
92
+ blob_appendf(&line, "unknown 0000000000");
93
+ }
94
+ db_finalize(&q);
95
+ printf("%s\n", blob_str(&line));
96
+ blob_reset(&fname);
97
+ blob_reset(&line);
98
+ }else if( find_option("print","p",0) ){
99
+ Blob record;
100
+ Blob fname;
101
+ const char *zRevision = find_option("revision", "r", 1);
102
+
103
+ file_tree_name(g.argv[2], &fname, 1);
104
+ if( zRevision ){
105
+ historical_version_of_file(zRevision, blob_str(&fname), &record, 0);
106
+ }else{
107
+ int rid = db_int(0, "SELECT rid FROM vfile WHERE pathname=%B", &fname);
108
+ if( rid==0 ){
109
+ fossil_fatal("no history for file: %b", &fname);
110
+ }
111
+ content_get(rid, &record);
112
+ }
113
+ blob_write_to_file(&record, "-");
114
+ blob_reset(&record);
115
+ blob_reset(&fname);
116
+ }else{
117
+ Blob line;
118
+ Stmt q;
119
+ Blob fname;
120
+ int rid;
121
+ const char *zFilename;
122
+ const char *zLimit;
123
+ const char *zOffset;
124
+ int iLimit, iOffset, iBrief;
125
+
126
+ if( find_option("log","l",0) ){
127
+ /* this is the default, no-op */
128
+ }
129
+ zLimit = find_option("limit",0,1);
130
+ iLimit = zLimit ? atoi(zLimit) : -1;
131
+ zOffset = find_option("offset",0,1);
132
+ iOffset = zOffset ? atoi(zOffset) : 0;
133
+ iBrief = (find_option("brief","b",0) == 0);
134
+ if( g.argc!=3 ){
135
+ usage("?-l|--log? ?-b|--brief? FILENAME");
136
+ }
137
+ file_tree_name(g.argv[2], &fname, 1);
138
+ rid = db_int(0, "SELECT rid FROM vfile WHERE pathname=%B", &fname);
139
+ if( rid==0 ){
140
+ fossil_fatal("no history for file: %b", &fname);
141
+ }
142
+ zFilename = blob_str(&fname);
143
+ db_prepare(&q,
144
+ "SELECT b.uuid, ci.uuid, date(event.mtime,'localtime'),"
145
+ " coalesce(event.ecomment, event.comment),"
146
+ " coalesce(event.euser, event.user)"
147
+ " FROM mlink, blob b, event, blob ci"
148
+ " WHERE mlink.fnid=(SELECT fnid FROM filename WHERE name=%Q)"
149
+ " AND b.rid=mlink.fid"
150
+ " AND event.objid=mlink.mid"
151
+ " AND event.objid=ci.rid"
152
+ " ORDER BY event.mtime DESC LIMIT %d OFFSET %d",
153
+ zFilename, iLimit, iOffset
154
+ );
155
+ blob_zero(&line);
156
+ if( iBrief ){
157
+ printf("History of %s\n", blob_str(&fname));
158
+ }
159
+ while( db_step(&q)==SQLITE_ROW ){
160
+ const char *zFileUuid = db_column_text(&q, 0);
161
+ const char *zCiUuid = db_column_text(&q,1);
162
+ const char *zDate = db_column_text(&q, 2);
163
+ const char *zCom = db_column_text(&q, 3);
164
+ const char *zUser = db_column_text(&q, 4);
165
+ char *zOut;
166
+ if( iBrief ){
167
+ printf("%s ", zDate);
168
+ zOut = sqlite3_mprintf("[%.10s] %s (user: %s, artifact: [%.10s])",
169
+ zCiUuid, zCom, zUser, zFileUuid);
170
+ comment_print(zOut, 11, 79);
171
+ sqlite3_free(zOut);
172
+ }else{
173
+ blob_reset(&line);
174
+ blob_appendf(&line, "%.10s ", zCiUuid);
175
+ blob_appendf(&line, "%.10s ", zDate);
176
+ blob_appendf(&line, "%8.8s ", zUser);
177
+ blob_appendf(&line,"%-40.40s\n", zCom );
178
+ comment_print(blob_str(&line), 0, 79);
179
+ }
180
+ }
181
+ db_finalize(&q);
182
+ blob_reset(&fname);
186183
}
187184
}
188185
189186
190187
/*
191188
--- src/finfo.c
+++ src/finfo.c
@@ -37,15 +37,10 @@
37 ** a quick status and does not check for up-to-date-ness of the file.
38 **
39 ** The -p form, there's an optional flag "-r|--revision REVISION". The
40 ** specified version (or the latest checked out version) is printed to
41 ** stdout.
42 **
43 ** Print the change history for a single file.
44 **
45 ** The "--limit N" and "--offset P" options limit the output to the first
46 ** N changes after skipping P changes.
47 */
48 void finfo_cmd(void){
49 int vid;
50
51 db_must_be_within_tree();
@@ -53,138 +48,140 @@
53 if( vid==0 ){
54 fossil_panic("no checkout to finfo files in");
55 }
56 vfile_check_signature(vid, 1);
57 if (find_option("status","s",0)) {
58 Stmt q;
59 Blob line;
60 Blob fname;
61
62 if (g.argc != 3) {
63 usage("-s|--status FILENAME");
64 }
65 file_tree_name(g.argv[2], &fname, 1);
66 db_prepare(&q,
67 "SELECT pathname, deleted, rid, chnged, coalesce(origname!=pathname,0)"
68 " FROM vfile WHERE vfile.pathname=%B", &fname);
69 blob_zero(&line);
70 if ( db_step(&q)==SQLITE_ROW ) {
71 Blob uuid;
72 int isDeleted = db_column_int(&q, 1);
73 int isNew = db_column_int(&q,2) == 0;
74 int chnged = db_column_int(&q,3);
75 int renamed = db_column_int(&q,4);
76
77 blob_zero(&uuid);
78 db_blob(&uuid,"SELECT uuid FROM blob, mlink, vfile WHERE "
79 "blob.rid = mlink.mid AND mlink.fid = vfile.rid AND "
80 "vfile.pathname=%B",&fname);
81 if (isNew) {
82 blob_appendf(&line, "new");
83 } else if (isDeleted) {
84 blob_appendf(&line, "deleted");
85 } else if (renamed) {
86 blob_appendf(&line, "renamed");
87 } else if (chnged) {
88 blob_appendf(&line, "edited");
89 } else {
90 blob_appendf(&line, "unchanged");
91 }
92 blob_appendf(&line, " ");
93 blob_appendf(&line, " %10.10s", blob_str(&uuid));
94 blob_reset(&uuid);
95 } else {
96 blob_appendf(&line, "unknown 0000000000");
97 }
98 db_finalize(&q);
99 printf("%s\n", blob_str(&line));
100 blob_reset(&fname);
101 blob_reset(&line);
102 } else if (find_option("print","p",0)) {
103 Blob record;
104 Blob fname;
105 const char *zRevision = find_option("revision", "r", 1);
106
107 file_tree_name(g.argv[2], &fname, 1);
108 if (zRevision) {
109 historical_version_of_file(zRevision, blob_str(&fname), &record, 0);
110 } else {
111 int rid = db_int(0, "SELECT rid FROM vfile WHERE pathname=%B", &fname);
112 if( rid==0 ){
113 fossil_fatal("no history for file: %b", &fname);
114 }
115 content_get(rid, &record);
116 }
117 blob_write_to_file(&record, "-");
118 blob_reset(&record);
119 blob_reset(&fname);
120 } else {
121 Blob line;
122 Stmt q;
123 Blob fname;
124 int rid;
125 const char *zFilename;
126 const char *zLimit;
127 const char *zOffset;
128 int iLimit, iOffset, iBrief;
129
130 if (find_option("log","l",0)) { /* this is the default, no-op */
131 }
132 zLimit = find_option("limit",0,1);
133 iLimit = zLimit ? atoi(zLimit) : -1;
134 zOffset = find_option("offset",0,1);
135 iOffset = zOffset ? atoi(zOffset) : 0;
136 iBrief = (find_option("brief","b",0) == 0);
137 if (g.argc != 3) {
138 usage("?-l|--log? ?-b|--brief? FILENAME");
139 }
140 file_tree_name(g.argv[2], &fname, 1);
141 rid = db_int(0, "SELECT rid FROM vfile WHERE pathname=%B", &fname);
142 if( rid==0 ){
143 fossil_fatal("no history for file: %b", &fname);
144 }
145 zFilename = blob_str(&fname);
146 db_prepare(&q,
147 "SELECT b.uuid, ci.uuid, date(event.mtime,'localtime'),"
148 " coalesce(event.ecomment, event.comment),"
149 " coalesce(event.euser, event.user)"
150 " FROM mlink, blob b, event, blob ci"
151 " WHERE mlink.fnid=(SELECT fnid FROM filename WHERE name=%Q)"
152 " AND b.rid=mlink.fid"
153 " AND event.objid=mlink.mid"
154 " AND event.objid=ci.rid"
155 " ORDER BY event.mtime DESC LIMIT %d OFFSET %d",
156 zFilename, iLimit, iOffset
157 );
158 blob_zero(&line);
159 if (iBrief) {
160 printf("History of %s\n", blob_str(&fname));
161 }
162 while( db_step(&q)==SQLITE_ROW ){
163 const char *zFileUuid = db_column_text(&q, 0);
164 const char *zCiUuid = db_column_text(&q,1);
165 const char *zDate = db_column_text(&q, 2);
166 const char *zCom = db_column_text(&q, 3);
167 const char *zUser = db_column_text(&q, 4);
168 char *zOut;
169 if (iBrief) {
170 printf("%s ", zDate);
171 zOut = sqlite3_mprintf("[%.10s] %s (user: %s, artifact: [%.10s])",
172 zCiUuid, zCom, zUser, zFileUuid);
173 comment_print(zOut, 11, 79);
174 sqlite3_free(zOut);
175 } else {
176 blob_reset(&line);
177 blob_appendf(&line, "%.10s ", zCiUuid);
178 blob_appendf(&line, "%.10s ", zDate);
179 blob_appendf(&line, "%8.8s ", zUser);
180 blob_appendf(&line,"%-40.40s\n", zCom );
181 comment_print(blob_str(&line), 0, 79);
182 }
183 }
184 db_finalize(&q);
185 blob_reset(&fname);
 
 
186 }
187 }
188
189
190 /*
191
--- src/finfo.c
+++ src/finfo.c
@@ -37,15 +37,10 @@
37 ** a quick status and does not check for up-to-date-ness of the file.
38 **
39 ** The -p form, there's an optional flag "-r|--revision REVISION". The
40 ** specified version (or the latest checked out version) is printed to
41 ** stdout.
 
 
 
 
 
42 */
43 void finfo_cmd(void){
44 int vid;
45
46 db_must_be_within_tree();
@@ -53,138 +48,140 @@
48 if( vid==0 ){
49 fossil_panic("no checkout to finfo files in");
50 }
51 vfile_check_signature(vid, 1);
52 if (find_option("status","s",0)) {
53 Stmt q;
54 Blob line;
55 Blob fname;
56
57 if( g.argc!=3 ) usage("-s|--status FILENAME");
58 file_tree_name(g.argv[2], &fname, 1);
59 db_prepare(&q,
60 "SELECT pathname, deleted, rid, chnged, coalesce(origname!=pathname,0)"
61 " FROM vfile WHERE vfile.pathname=%B", &fname);
62 blob_zero(&line);
63 if ( db_step(&q)==SQLITE_ROW ) {
64 Blob uuid;
65 int isDeleted = db_column_int(&q, 1);
66 int isNew = db_column_int(&q,2) == 0;
67 int chnged = db_column_int(&q,3);
68 int renamed = db_column_int(&q,4);
69
70 blob_zero(&uuid);
71 db_blob(&uuid,
72 "SELECT uuid FROM blob, mlink, vfile WHERE "
73 "blob.rid = mlink.mid AND mlink.fid = vfile.rid AND "
74 "vfile.pathname=%B",
75 &fname
76 );
77 if( isNew ){
78 blob_appendf(&line, "new");
79 }else if( isDeleted ){
80 blob_appendf(&line, "deleted");
81 }else if( renamed ){
82 blob_appendf(&line, "renamed");
83 }else if( chnged ){
84 blob_appendf(&line, "edited");
85 }else{
86 blob_appendf(&line, "unchanged");
87 }
88 blob_appendf(&line, " ");
89 blob_appendf(&line, " %10.10s", blob_str(&uuid));
90 blob_reset(&uuid);
91 }else{
92 blob_appendf(&line, "unknown 0000000000");
93 }
94 db_finalize(&q);
95 printf("%s\n", blob_str(&line));
96 blob_reset(&fname);
97 blob_reset(&line);
98 }else if( find_option("print","p",0) ){
99 Blob record;
100 Blob fname;
101 const char *zRevision = find_option("revision", "r", 1);
102
103 file_tree_name(g.argv[2], &fname, 1);
104 if( zRevision ){
105 historical_version_of_file(zRevision, blob_str(&fname), &record, 0);
106 }else{
107 int rid = db_int(0, "SELECT rid FROM vfile WHERE pathname=%B", &fname);
108 if( rid==0 ){
109 fossil_fatal("no history for file: %b", &fname);
110 }
111 content_get(rid, &record);
112 }
113 blob_write_to_file(&record, "-");
114 blob_reset(&record);
115 blob_reset(&fname);
116 }else{
117 Blob line;
118 Stmt q;
119 Blob fname;
120 int rid;
121 const char *zFilename;
122 const char *zLimit;
123 const char *zOffset;
124 int iLimit, iOffset, iBrief;
125
126 if( find_option("log","l",0) ){
127 /* this is the default, no-op */
128 }
129 zLimit = find_option("limit",0,1);
130 iLimit = zLimit ? atoi(zLimit) : -1;
131 zOffset = find_option("offset",0,1);
132 iOffset = zOffset ? atoi(zOffset) : 0;
133 iBrief = (find_option("brief","b",0) == 0);
134 if( g.argc!=3 ){
135 usage("?-l|--log? ?-b|--brief? FILENAME");
136 }
137 file_tree_name(g.argv[2], &fname, 1);
138 rid = db_int(0, "SELECT rid FROM vfile WHERE pathname=%B", &fname);
139 if( rid==0 ){
140 fossil_fatal("no history for file: %b", &fname);
141 }
142 zFilename = blob_str(&fname);
143 db_prepare(&q,
144 "SELECT b.uuid, ci.uuid, date(event.mtime,'localtime'),"
145 " coalesce(event.ecomment, event.comment),"
146 " coalesce(event.euser, event.user)"
147 " FROM mlink, blob b, event, blob ci"
148 " WHERE mlink.fnid=(SELECT fnid FROM filename WHERE name=%Q)"
149 " AND b.rid=mlink.fid"
150 " AND event.objid=mlink.mid"
151 " AND event.objid=ci.rid"
152 " ORDER BY event.mtime DESC LIMIT %d OFFSET %d",
153 zFilename, iLimit, iOffset
154 );
155 blob_zero(&line);
156 if( iBrief ){
157 printf("History of %s\n", blob_str(&fname));
158 }
159 while( db_step(&q)==SQLITE_ROW ){
160 const char *zFileUuid = db_column_text(&q, 0);
161 const char *zCiUuid = db_column_text(&q,1);
162 const char *zDate = db_column_text(&q, 2);
163 const char *zCom = db_column_text(&q, 3);
164 const char *zUser = db_column_text(&q, 4);
165 char *zOut;
166 if( iBrief ){
167 printf("%s ", zDate);
168 zOut = sqlite3_mprintf("[%.10s] %s (user: %s, artifact: [%.10s])",
169 zCiUuid, zCom, zUser, zFileUuid);
170 comment_print(zOut, 11, 79);
171 sqlite3_free(zOut);
172 }else{
173 blob_reset(&line);
174 blob_appendf(&line, "%.10s ", zCiUuid);
175 blob_appendf(&line, "%.10s ", zDate);
176 blob_appendf(&line, "%8.8s ", zUser);
177 blob_appendf(&line,"%-40.40s\n", zCom );
178 comment_print(blob_str(&line), 0, 79);
179 }
180 }
181 db_finalize(&q);
182 blob_reset(&fname);
183 }
184 }
185
186
187 /*
188
+1 -1
--- src/setup.c
+++ src/setup.c
@@ -1087,11 +1087,11 @@
10871087
10881088
/*
10891089
** WEBPAGE: setup_logo
10901090
*/
10911091
void setup_logo(void){
1092
- const char *zMime = "image/gif";
1092
+ const char *zMime = db_get("logo-mimetype","image/gif");
10931093
const char *aImg = P("im");
10941094
int szImg = atoi(PD("im:bytes","0"));
10951095
if( szImg>0 ){
10961096
zMime = PD("im:mimetype","image/gif");
10971097
}
10981098
--- src/setup.c
+++ src/setup.c
@@ -1087,11 +1087,11 @@
1087
1088 /*
1089 ** WEBPAGE: setup_logo
1090 */
1091 void setup_logo(void){
1092 const char *zMime = "image/gif";
1093 const char *aImg = P("im");
1094 int szImg = atoi(PD("im:bytes","0"));
1095 if( szImg>0 ){
1096 zMime = PD("im:mimetype","image/gif");
1097 }
1098
--- src/setup.c
+++ src/setup.c
@@ -1087,11 +1087,11 @@
1087
1088 /*
1089 ** WEBPAGE: setup_logo
1090 */
1091 void setup_logo(void){
1092 const char *zMime = db_get("logo-mimetype","image/gif");
1093 const char *aImg = P("im");
1094 int szImg = atoi(PD("im:bytes","0"));
1095 if( szImg>0 ){
1096 zMime = PD("im:mimetype","image/gif");
1097 }
1098
+1 -1
--- src/style.c
+++ src/style.c
@@ -89,11 +89,11 @@
8989
va_end(ap);
9090
9191
cgi_destination(CGI_HEADER);
9292
cgi_printf("%s",
9393
"<!DOCTYPE html PUBLIC \"-//W3C//DTD XHTML 1.0 Strict//EN\""
94
- " \"http://www.x3.org/TR/xhtml1/DTD/xhtml1-strict.dtd\">");
94
+ " \"http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd\">");
9595
9696
if( g.thTrace ) Th_Trace("BEGIN_HEADER<br />\n", -1);
9797
9898
/* Generate the header up through the main menu */
9999
Th_Store("project_name", db_get("project-name","Unnamed Fossil Project"));
100100
--- src/style.c
+++ src/style.c
@@ -89,11 +89,11 @@
89 va_end(ap);
90
91 cgi_destination(CGI_HEADER);
92 cgi_printf("%s",
93 "<!DOCTYPE html PUBLIC \"-//W3C//DTD XHTML 1.0 Strict//EN\""
94 " \"http://www.x3.org/TR/xhtml1/DTD/xhtml1-strict.dtd\">");
95
96 if( g.thTrace ) Th_Trace("BEGIN_HEADER<br />\n", -1);
97
98 /* Generate the header up through the main menu */
99 Th_Store("project_name", db_get("project-name","Unnamed Fossil Project"));
100
--- src/style.c
+++ src/style.c
@@ -89,11 +89,11 @@
89 va_end(ap);
90
91 cgi_destination(CGI_HEADER);
92 cgi_printf("%s",
93 "<!DOCTYPE html PUBLIC \"-//W3C//DTD XHTML 1.0 Strict//EN\""
94 " \"http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd\">");
95
96 if( g.thTrace ) Th_Trace("BEGIN_HEADER<br />\n", -1);
97
98 /* Generate the header up through the main menu */
99 Th_Store("project_name", db_get("project-name","Unnamed Fossil Project"));
100
+25 -20
--- src/update.c
+++ src/update.c
@@ -43,11 +43,13 @@
4343
** leaf. VERSION can also be "current" to select the leaf of the current
4444
** version or "latest" to select the most recent check-in.
4545
**
4646
** If one or more FILES are listed after the VERSION then only the
4747
** named files are candidates to be updated. If FILES is omitted, all
48
-** files in the current checkout are subject to be updated.
48
+** files in the current checkout are subject to be updated. Using
49
+** a directory name for one of the FILES arguments is the same as
50
+** using every subdirectory and file beneath that directory.
4951
**
5052
** The -n or --nochange option causes this command to do a "dry run". It
5153
** prints out what would have happened but does not actually make any
5254
** changes to the current checkout or the repository.
5355
**
@@ -166,36 +168,39 @@
166168
);
167169
}
168170
db_finalize(&q);
169171
170172
/* If FILES appear on the command-line, remove from the "fv" table
171
- ** every entry that is not named on the command-line.
173
+ ** every entry that is not named on the command-line or which is not
174
+ ** in a directory named on the command-line.
172175
*/
173176
if( g.argc>=4 ){
174177
Blob sql; /* SQL statement to purge unwanted entries */
175178
Blob treename; /* Normalized filename */
176179
int i; /* Loop counter */
180
+ const char *zSep; /* Term separator */
177181
178182
blob_zero(&sql);
179183
blob_append(&sql, "DELETE FROM fv WHERE ", -1);
184
+ zSep = "";
180185
for(i=3; i<g.argc; i++){
181186
file_tree_name(g.argv[i], &treename, 1);
182
- if (file_isdir(g.argv[i]) == 1) {
183
- if (blob_size(&treename) > 0) {
184
- blob_appendf(&sql, "fn NOT GLOB '%b/*' ", &treename);
185
- } else {
186
- blob_appendf(&sql, "fn NOT GLOB '*' ");
187
- }
188
- } else {
189
- blob_appendf(&sql, "fn <> %B ", &treename);
190
- }
191
- if (i < g.argc - 1) {
192
- blob_append(&sql, "AND ", -1);
193
- }
187
+ if( file_isdir(g.argv[i])==1 ){
188
+ if( blob_size(&treename)>0 ){
189
+ blob_appendf(&sql, "%sfn NOT GLOB '%b/*' ", zSep, &treename);
190
+ }else{
191
+ blob_reset(&sql);
192
+ blob_append(&sql, "DELETE FROM fv", -1);
193
+ break;
194
+ }
195
+ }else{
196
+ blob_appendf(&sql, "%sfn<>%B ", zSep, &treename);
197
+ }
198
+ zSep = "AND ";
194199
blob_reset(&treename);
195200
}
196
- fprintf(stderr, "%s\n", blob_str(&sql));
201
+ /* fprintf(stderr, "%s\n", blob_str(&sql)); */
197202
db_multi_exec(blob_str(&sql));
198203
blob_reset(&sql);
199204
}
200205
201206
db_prepare(&q,
@@ -273,15 +278,15 @@
273278
blob_reset(&v);
274279
blob_reset(&e);
275280
blob_reset(&t);
276281
blob_reset(&r);
277282
}else if( verboseFlag ){
278
- if (chnged) {
279
- printf("EDITED %s\n", zName);
280
- } else {
281
- printf("UNCHANGED %s\n", zName);
282
- }
283
+ if( chnged ){
284
+ printf("EDITED %s\n", zName);
285
+ }else{
286
+ printf("UNCHANGED %s\n", zName);
287
+ }
283288
}
284289
free(zFullPath);
285290
}
286291
db_finalize(&q);
287292
288293
--- src/update.c
+++ src/update.c
@@ -43,11 +43,13 @@
43 ** leaf. VERSION can also be "current" to select the leaf of the current
44 ** version or "latest" to select the most recent check-in.
45 **
46 ** If one or more FILES are listed after the VERSION then only the
47 ** named files are candidates to be updated. If FILES is omitted, all
48 ** files in the current checkout are subject to be updated.
 
 
49 **
50 ** The -n or --nochange option causes this command to do a "dry run". It
51 ** prints out what would have happened but does not actually make any
52 ** changes to the current checkout or the repository.
53 **
@@ -166,36 +168,39 @@
166 );
167 }
168 db_finalize(&q);
169
170 /* If FILES appear on the command-line, remove from the "fv" table
171 ** every entry that is not named on the command-line.
 
172 */
173 if( g.argc>=4 ){
174 Blob sql; /* SQL statement to purge unwanted entries */
175 Blob treename; /* Normalized filename */
176 int i; /* Loop counter */
 
177
178 blob_zero(&sql);
179 blob_append(&sql, "DELETE FROM fv WHERE ", -1);
 
180 for(i=3; i<g.argc; i++){
181 file_tree_name(g.argv[i], &treename, 1);
182 if (file_isdir(g.argv[i]) == 1) {
183 if (blob_size(&treename) > 0) {
184 blob_appendf(&sql, "fn NOT GLOB '%b/*' ", &treename);
185 } else {
186 blob_appendf(&sql, "fn NOT GLOB '*' ");
187 }
188 } else {
189 blob_appendf(&sql, "fn <> %B ", &treename);
190 }
191 if (i < g.argc - 1) {
192 blob_append(&sql, "AND ", -1);
193 }
194 blob_reset(&treename);
195 }
196 fprintf(stderr, "%s\n", blob_str(&sql));
197 db_multi_exec(blob_str(&sql));
198 blob_reset(&sql);
199 }
200
201 db_prepare(&q,
@@ -273,15 +278,15 @@
273 blob_reset(&v);
274 blob_reset(&e);
275 blob_reset(&t);
276 blob_reset(&r);
277 }else if( verboseFlag ){
278 if (chnged) {
279 printf("EDITED %s\n", zName);
280 } else {
281 printf("UNCHANGED %s\n", zName);
282 }
283 }
284 free(zFullPath);
285 }
286 db_finalize(&q);
287
288
--- src/update.c
+++ src/update.c
@@ -43,11 +43,13 @@
43 ** leaf. VERSION can also be "current" to select the leaf of the current
44 ** version or "latest" to select the most recent check-in.
45 **
46 ** If one or more FILES are listed after the VERSION then only the
47 ** named files are candidates to be updated. If FILES is omitted, all
48 ** files in the current checkout are subject to be updated. Using
49 ** a directory name for one of the FILES arguments is the same as
50 ** using every subdirectory and file beneath that directory.
51 **
52 ** The -n or --nochange option causes this command to do a "dry run". It
53 ** prints out what would have happened but does not actually make any
54 ** changes to the current checkout or the repository.
55 **
@@ -166,36 +168,39 @@
168 );
169 }
170 db_finalize(&q);
171
172 /* If FILES appear on the command-line, remove from the "fv" table
173 ** every entry that is not named on the command-line or which is not
174 ** in a directory named on the command-line.
175 */
176 if( g.argc>=4 ){
177 Blob sql; /* SQL statement to purge unwanted entries */
178 Blob treename; /* Normalized filename */
179 int i; /* Loop counter */
180 const char *zSep; /* Term separator */
181
182 blob_zero(&sql);
183 blob_append(&sql, "DELETE FROM fv WHERE ", -1);
184 zSep = "";
185 for(i=3; i<g.argc; i++){
186 file_tree_name(g.argv[i], &treename, 1);
187 if( file_isdir(g.argv[i])==1 ){
188 if( blob_size(&treename)>0 ){
189 blob_appendf(&sql, "%sfn NOT GLOB '%b/*' ", zSep, &treename);
190 }else{
191 blob_reset(&sql);
192 blob_append(&sql, "DELETE FROM fv", -1);
193 break;
194 }
195 }else{
196 blob_appendf(&sql, "%sfn<>%B ", zSep, &treename);
197 }
198 zSep = "AND ";
199 blob_reset(&treename);
200 }
201 /* fprintf(stderr, "%s\n", blob_str(&sql)); */
202 db_multi_exec(blob_str(&sql));
203 blob_reset(&sql);
204 }
205
206 db_prepare(&q,
@@ -273,15 +278,15 @@
278 blob_reset(&v);
279 blob_reset(&e);
280 blob_reset(&t);
281 blob_reset(&r);
282 }else if( verboseFlag ){
283 if( chnged ){
284 printf("EDITED %s\n", zName);
285 }else{
286 printf("UNCHANGED %s\n", zName);
287 }
288 }
289 free(zFullPath);
290 }
291 db_finalize(&q);
292
293

Keyboard Shortcuts

Open search /
Next entry (timeline) j
Previous entry (timeline) k
Open focused entry Enter
Show this help ?
Toggle theme Top nav button