419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
|
** This routine really has nothing to do with path. It is located
** in this path.c module in order to leverage some of the path
** infrastructure.
*/
void find_filename_changes(
int iFrom, /* Ancestor check-in */
int iTo, /* Recent check-in */
int revOk, /* Ok to move backwards (child->parent) if true */
int *pnChng, /* Number of name changes along the path */
int **aiChng, /* Name changes */
const char *zDebug /* Generate trace output if no NULL */
){
PathNode *p; /* For looping over path from iFrom to iTo */
NameChange *pAll = 0; /* List of all name changes seen so far */
NameChange *pChng; /* For looping through the name change list */
|
|
|
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
|
** This routine really has nothing to do with path. It is located
** in this path.c module in order to leverage some of the path
** infrastructure.
*/
void find_filename_changes(
int iFrom, /* Ancestor check-in */
int iTo, /* Recent check-in */
int revOK, /* OK to move backwards (child->parent) if true */
int *pnChng, /* Number of name changes along the path */
int **aiChng, /* Name changes */
const char *zDebug /* Generate trace output if no NULL */
){
PathNode *p; /* For looping over path from iFrom to iTo */
NameChange *pAll = 0; /* List of all name changes seen so far */
NameChange *pChng; /* For looping through the name change list */
|
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
|
if(0==iFrom){
fossil_fatal("Invalid 'from' RID: 0");
}else if(0==iTo){
fossil_fatal("Invalid 'to' RID: 0");
}
if( iFrom==iTo ) return;
path_reset();
p = path_shortest(iFrom, iTo, 1, revOk==0, 0);
if( p==0 ) return;
path_reverse_path();
db_prepare(&q1,
"SELECT pfnid, fnid FROM mlink"
" WHERE mid=:mid AND (pfnid>0 OR fid==0)"
" ORDER BY pfnid"
);
|
|
|
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
|
if(0==iFrom){
fossil_fatal("Invalid 'from' RID: 0");
}else if(0==iTo){
fossil_fatal("Invalid 'to' RID: 0");
}
if( iFrom==iTo ) return;
path_reset();
p = path_shortest(iFrom, iTo, 1, revOK==0, 0);
if( p==0 ) return;
path_reverse_path();
db_prepare(&q1,
"SELECT pfnid, fnid FROM mlink"
" WHERE mid=:mid AND (pfnid>0 OR fid==0)"
" ORDER BY pfnid"
);
|
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
|
void test_name_change(void){
int iFrom;
int iTo;
int *aChng;
int nChng;
int i;
const char *zDebug = 0;
int revOk = 0;
db_find_and_open_repository(0,0);
zDebug = find_option("debug",0,0)!=0 ? "debug" : 0;
revOk = find_option("bidirectional",0,0)!=0;
if( g.argc<4 ) usage("VERSION1 VERSION2");
while( g.argc>=4 ){
iFrom = name_to_rid(g.argv[2]);
iTo = name_to_rid(g.argv[3]);
find_filename_changes(iFrom, iTo, revOk, &nChng, &aChng, zDebug);
fossil_print("------ Changes for (%d) %s -> (%d) %s\n",
iFrom, g.argv[2], iTo, g.argv[3]);
for(i=0; i<nChng; i++){
char *zFrom, *zTo;
zFrom = db_text(0, "SELECT name FROM filename WHERE fnid=%d", aChng[i*2]);
zTo = db_text(0, "SELECT name FROM filename WHERE fnid=%d", aChng[i*2+1]);
|
|
|
|
|
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
|
void test_name_change(void){
int iFrom;
int iTo;
int *aChng;
int nChng;
int i;
const char *zDebug = 0;
int revOK = 0;
db_find_and_open_repository(0,0);
zDebug = find_option("debug",0,0)!=0 ? "debug" : 0;
revOK = find_option("bidirectional",0,0)!=0;
if( g.argc<4 ) usage("VERSION1 VERSION2");
while( g.argc>=4 ){
iFrom = name_to_rid(g.argv[2]);
iTo = name_to_rid(g.argv[3]);
find_filename_changes(iFrom, iTo, revOK, &nChng, &aChng, zDebug);
fossil_print("------ Changes for (%d) %s -> (%d) %s\n",
iFrom, g.argv[2], iTo, g.argv[3]);
for(i=0; i<nChng; i++){
char *zFrom, *zTo;
zFrom = db_text(0, "SELECT name FROM filename WHERE fnid=%d", aChng[i*2]);
zTo = db_text(0, "SELECT name FROM filename WHERE fnid=%d", aChng[i*2+1]);
|