Many hyperlinks are disabled.
Use anonymous login
to enable hyperlinks.
Changes In Branch fix artifact checkout Excluding Merge-Ins
This is equivalent to a diff from 879e8c5f32 to 5d49162a31
2009-04-29
| ||
03:59 | checkpoints for the is_ticket() function Leaf check-in: 5d49162a31 user: bch tags: fix artifact checkout | |
03:51 | test recycling "is_ticket()" from wikiformat.c as a way to avoid trying to checkout a ticket check-in: 695b1c7563 user: bch tags: fix artifact checkout | |
2009-04-24
| ||
18:40 | There is some bug in the new HTTP transport layer. The easiest solution is to close the TCP connection after each round trip, which is what this check-in does. check-in: 767ae79c3d user: drh tags: trunk | |
2009-04-19
| ||
05:48 | branch, start committing hacking that will hopefully yield fix to this problem: one is allowed to checkout "artifacts" that should not be checkout-able (ie: changes to tickets); trying to check this out is permitted, but results in a segfault check-in: 4fff366109 user: bch tags: fix artifact checkout | |
2009-04-13
| ||
09:50 | Update to version SQLite 3.6.13 check-in: 879e8c5f32 user: drh tags: trunk | |
2009-04-11
| ||
13:07 | Actually get the "file:" transport working this time. check-in: a742cfa292 user: drh tags: trunk | |
Changes to src/checkout.c.
41
42
43
44
45
46
47
48
49
50
51
52
53
54
...
155
156
157
158
159
160
161
162
163
164
165
166
167
168
|
db_must_be_within_tree();
vid = db_lget_int("checkout",0);
if( vid==0 ) return 2;
vfile_check_signature(vid);
return db_exists("SELECT 1 FROM vfile WHERE chnged"
" OR coalesce(origname!=pathname,0)");
}
/*
** Undo the current check-out. Unlink all files from the disk.
** Clear the VFILE table.
*/
void uncheckout(int vid){
if( vid==0 ) return;
................................................................................
db_begin_transaction();
forceFlag = find_option("force","f",0)!=0;
noWrite = find_option("dontwrite",0,0)!=0;
if( g.argc!=3 ) usage("?--force? VERSION");
if( !forceFlag && unsaved_changes()==1 ){
fossil_fatal("there are unsaved changes in the current checkout");
}
if( forceFlag ){
db_multi_exec("DELETE FROM vfile");
prior = 0;
}else{
prior = db_lget_int("checkout",0);
}
vid = load_vfile(g.argv[2]);
|
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
|
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
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
130
131
132
133
134
135
...
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
|
db_must_be_within_tree(); vid = db_lget_int("checkout",0); if( vid==0 ) return 2; vfile_check_signature(vid); return db_exists("SELECT 1 FROM vfile WHERE chnged" " OR coalesce(origname!=pathname,0)"); } /* ** zTarget is guaranteed to be a UUID. It might be the UUID of a ticket. ** If it is, store in *pClosed a true or false depending on whether or not ** the ticket is closed and return true. If zTarget ** is not the UUID of a ticket, return false. */ static int is_ticket( const char *zTarget, /* Ticket UUID */ int *pClosed /* True if the ticket is closed */ ){ fprintf(stderr,"I'm in is_ticket\n"); static Stmt q; static int once = 1; int n; int rc; char zLower[UUID_SIZE+1]; char zUpper[UUID_SIZE+1]; n = strlen(zTarget); memcpy(zLower, zTarget, n+1); canonical16(zLower, n+1); memcpy(zUpper, zLower, n+1); zUpper[n-1]++; if( once ){ const char *zClosedExpr = db_get("ticket-closed-expr", "status='Closed'"); db_static_prepare(&q, "SELECT %s FROM ticket " " WHERE tkt_uuid>=:lwr AND tkt_uuid<:upr", zClosedExpr ); once = 0; } db_bind_text(&q, ":lwr", zLower); db_bind_text(&q, ":upr", zUpper); if( db_step(&q)==SQLITE_ROW ){ rc = 1; *pClosed = db_column_int(&q, 0); }else{ rc = 0; } db_reset(&q); return rc; } /* ** Check to see if the requested co is in fact "checkout-able" ** Return values: ** 0: Not checkout-able (does not exist, or is not an on-disk artifact) ** 1: Is checkout-able. */ int checkoutable(const char *zName){ int rc; /* return code */ int throwaway; rc = !is_ticket(zName, &throwaway); fprintf(stderr,"rc is: %d\n", rc); return(rc); Blob uuid; const char *rid=(char *)NULL; Stmt q; // db query char *zSQL; //build-up sql // zSQL = mprintf(); // [create sql statement] // db_prepare(&q,sqlstmt); blob_init(&uuid, zName, -1); if( name_to_uuid(&uuid, 1) ){ fossil_panic(g.zErrMsg); } /* nParent=db_text(0,"select rid from blob where uuid=%s",uuid.nameofobj); */ /* int nParent = db_column_int(q, somenum); */ return rc; } /* ** Undo the current check-out. Unlink all files from the disk. ** Clear the VFILE table. */ void uncheckout(int vid){ if( vid==0 ) return; ................................................................................ db_begin_transaction(); forceFlag = find_option("force","f",0)!=0; noWrite = find_option("dontwrite",0,0)!=0; if( g.argc!=3 ) usage("?--force? VERSION"); if( !forceFlag && unsaved_changes()==1 ){ fossil_fatal("there are unsaved changes in the current checkout"); } if(!checkoutable(g.argv[2])){ fossil_fatal("the VERSION you requested is not a checkout-able artifact"); } if( forceFlag ){ db_multi_exec("DELETE FROM vfile"); prior = 0; }else{ prior = db_lget_int("checkout",0); } vid = load_vfile(g.argv[2]); |