| ︙ | | | ︙ | |
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
|
blob_reset(&sql);
db_prepare(&ins,
"INSERT INTO stashfile(stashid, rid, isAdded, isRemoved, isExec, isLink,"
"origname, newname, delta)"
"VALUES(%d,:rid,:isadd,:isrm,:isexe,:islink,:orig,:new,:content)",
stashid
);
while( db_step(&q)==SQLITE_ROW ){
int deleted = db_column_int(&q, 0);
int rid = db_column_int(&q, 3);
const char *zName = db_column_text(&q, 4);
const char *zOrig = db_column_text(&q, 5);
char *zPath = mprintf("%s%s", g.zLocalRoot, zName);
Blob content;
int isNewLink = file_wd_islink(zPath);
|
|
|
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
|
blob_reset(&sql);
db_prepare(&ins,
"INSERT INTO stashfile(stashid, rid, isAdded, isRemoved, isExec, isLink,"
"origname, newname, delta)"
"VALUES(%d,:rid,:isadd,:isrm,:isexe,:islink,:orig,:new,:content)",
stashid
);
while( db_step(&q)==SQLITE4_ROW ){
int deleted = db_column_int(&q, 0);
int rid = db_column_int(&q, 3);
const char *zName = db_column_text(&q, 4);
const char *zOrig = db_column_text(&q, 5);
char *zPath = mprintf("%s%s", g.zLocalRoot, zName);
Blob content;
int isNewLink = file_wd_islink(zPath);
|
| ︙ | | | ︙ | |
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
|
static void stash_apply(int stashid, int nConflict){
Stmt q;
db_prepare(&q,
"SELECT rid, isRemoved, isExec, isLink, origname, newname, delta"
" FROM stashfile WHERE stashid=%d",
stashid
);
while( db_step(&q)==SQLITE_ROW ){
int rid = db_column_int(&q, 0);
int isRemoved = db_column_int(&q, 1);
int isExec = db_column_int(&q, 2);
int isLink = db_column_int(&q, 3);
const char *zOrig = db_column_text(&q, 4);
const char *zNew = db_column_text(&q, 5);
char *zOPath = mprintf("%s%s", g.zLocalRoot, zOrig);
|
|
|
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
|
static void stash_apply(int stashid, int nConflict){
Stmt q;
db_prepare(&q,
"SELECT rid, isRemoved, isExec, isLink, origname, newname, delta"
" FROM stashfile WHERE stashid=%d",
stashid
);
while( db_step(&q)==SQLITE4_ROW ){
int rid = db_column_int(&q, 0);
int isRemoved = db_column_int(&q, 1);
int isExec = db_column_int(&q, 2);
int isLink = db_column_int(&q, 3);
const char *zOrig = db_column_text(&q, 4);
const char *zNew = db_column_text(&q, 5);
char *zOPath = mprintf("%s%s", g.zLocalRoot, zOrig);
|
| ︙ | | | ︙ | |
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
|
Blob empty;
blob_zero(&empty);
db_prepare(&q,
"SELECT rid, isRemoved, isExec, isLink, origname, newname, delta"
" FROM stashfile WHERE stashid=%d",
stashid
);
while( db_step(&q)==SQLITE_ROW ){
int rid = db_column_int(&q, 0);
int isRemoved = db_column_int(&q, 1);
int isLink = db_column_int(&q, 3);
const char *zOrig = db_column_text(&q, 4);
const char *zNew = db_column_text(&q, 5);
char *zOPath = mprintf("%s%s", g.zLocalRoot, zOrig);
Blob delta;
|
|
|
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
|
Blob empty;
blob_zero(&empty);
db_prepare(&q,
"SELECT rid, isRemoved, isExec, isLink, origname, newname, delta"
" FROM stashfile WHERE stashid=%d",
stashid
);
while( db_step(&q)==SQLITE4_ROW ){
int rid = db_column_int(&q, 0);
int isRemoved = db_column_int(&q, 1);
int isLink = db_column_int(&q, 3);
const char *zOrig = db_column_text(&q, 4);
const char *zNew = db_column_text(&q, 5);
char *zOPath = mprintf("%s%s", g.zLocalRoot, zOrig);
Blob delta;
|
| ︙ | | | ︙ | |
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
|
if( g.argc>=2 ){
int nFile = db_int(0, "SELECT count(*) FROM stashfile WHERE stashid=%d",
stashid);
char **newArgv = fossil_malloc( sizeof(char*)*(nFile+2) );
int i = 2;
Stmt q;
db_prepare(&q,"SELECT origname FROM stashfile WHERE stashid=%d", stashid);
while( db_step(&q)==SQLITE_ROW ){
newArgv[i++] = mprintf("%s%s", g.zLocalRoot, db_column_text(&q, 0));
}
db_finalize(&q);
newArgv[0] = g.argv[0];
g.argv = newArgv;
g.argc = nFile+2;
if( nFile==0 ) return;
|
|
|
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
|
if( g.argc>=2 ){
int nFile = db_int(0, "SELECT count(*) FROM stashfile WHERE stashid=%d",
stashid);
char **newArgv = fossil_malloc( sizeof(char*)*(nFile+2) );
int i = 2;
Stmt q;
db_prepare(&q,"SELECT origname FROM stashfile WHERE stashid=%d", stashid);
while( db_step(&q)==SQLITE4_ROW ){
newArgv[i++] = mprintf("%s%s", g.zLocalRoot, db_column_text(&q, 0));
}
db_finalize(&q);
newArgv[0] = g.argv[0];
g.argv = newArgv;
g.argc = nFile+2;
if( nFile==0 ) return;
|
| ︙ | | | ︙ | |
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
|
" comment, datetime(ctime) FROM stash"
" ORDER BY ctime DESC"
);
if( fDetail ){
db_prepare(&q2, "SELECT isAdded, isRemoved, origname, newname"
" FROM stashfile WHERE stashid=$id");
}
while( db_step(&q)==SQLITE_ROW ){
int stashid = db_column_int(&q, 0);
const char *zCom;
n++;
fossil_print("%5d: [%.14s] on %s\n",
stashid,
db_column_text(&q, 1),
db_column_text(&q, 3)
);
zCom = db_column_text(&q, 2);
if( zCom && zCom[0] ){
fossil_print(" ");
comment_print(zCom, 7, 79);
}
if( fDetail ){
db_bind_int(&q2, "$id", stashid);
while( db_step(&q2)==SQLITE_ROW ){
int isAdded = db_column_int(&q2, 0);
int isRemoved = db_column_int(&q2, 1);
const char *zOrig = db_column_text(&q2, 2);
const char *zNew = db_column_text(&q2, 3);
if( isAdded ){
fossil_print(" ADD %s\n", zNew);
}else if( isRemoved ){
|
|
|
|
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
|
" comment, datetime(ctime) FROM stash"
" ORDER BY ctime DESC"
);
if( fDetail ){
db_prepare(&q2, "SELECT isAdded, isRemoved, origname, newname"
" FROM stashfile WHERE stashid=$id");
}
while( db_step(&q)==SQLITE4_ROW ){
int stashid = db_column_int(&q, 0);
const char *zCom;
n++;
fossil_print("%5d: [%.14s] on %s\n",
stashid,
db_column_text(&q, 1),
db_column_text(&q, 3)
);
zCom = db_column_text(&q, 2);
if( zCom && zCom[0] ){
fossil_print(" ");
comment_print(zCom, 7, 79);
}
if( fDetail ){
db_bind_int(&q2, "$id", stashid);
while( db_step(&q2)==SQLITE4_ROW ){
int isAdded = db_column_int(&q2, 0);
int isRemoved = db_column_int(&q2, 1);
const char *zOrig = db_column_text(&q2, 2);
const char *zNew = db_column_text(&q2, 3);
if( isAdded ){
fossil_print(" ADD %s\n", zNew);
}else if( isRemoved ){
|
| ︙ | | | ︙ | |