Many hyperlinks are disabled.
Use anonymous login
to enable hyperlinks.
Overview
| Comment: | Make "fossil mv src/FOO.c src/bar.c" work as expected on case-insensitive filesystems. Add --case-sensitive option to "fossil mv". |
|---|---|
| Downloads: | Tarball | ZIP archive |
| Timelines: | family | ancestors | descendants | both | trunk |
| Files: | files | file ages | folders |
| SHA1: |
93f370a80c5f4cc98d23140fee290cfe |
| User & Date: | jan.nijtmans 2013-05-31 12:50:17.674 |
Context
|
2013-05-31
| ||
| 17:41 | Avoid SQL errors when the "fossil ticket" command is misused to try to append icomment text. Ticket [d4378c258d9fc6b] ... (check-in: 878f7008ab user: drh tags: trunk) | |
| 12:50 | Make "fossil mv src/FOO.c src/bar.c" work as expected on case-insensitive filesystems. Add --case-sensitive option to "fossil mv". ... (check-in: 93f370a80c user: jan.nijtmans tags: trunk) | |
| 07:12 | Add option --case-sensitive to "fossil delete". On case-insensitive filesystems now you can "fossil delete src/FOO.c", which results in src/foo.c being prepared from removal. This doesn't work yet for directories. ... (check-in: 7ae19e56ba user: jan.nijtmans tags: trunk) | |
Changes
Changes to src/add.c.
| ︙ | ︙ | |||
560 561 562 563 564 565 566 |
/*
** Rename a single file.
**
** The original name of the file is zOrig. The new filename is zNew.
*/
static void mv_one_file(int vid, const char *zOrig, const char *zNew){
| | > | | > > > > | 560 561 562 563 564 565 566 567 568 569 570 571 572 573 574 575 576 577 578 579 580 581 582 583 584 585 586 587 588 589 590 591 592 593 594 595 596 597 598 599 600 601 602 603 604 605 606 607 608 609 610 611 612 613 614 615 616 617 618 |
/*
** Rename a single file.
**
** The original name of the file is zOrig. The new filename is zNew.
*/
static void mv_one_file(int vid, const char *zOrig, const char *zNew){
int x = db_int(-1, "SELECT deleted FROM vfile WHERE pathname=%Q %s",
zNew, filename_collation());
if( x>=0 ){
if( x==0 ){
fossil_fatal("cannot rename '%s' to '%s' since another file named '%s'"
" is currently under management", zOrig, zNew, zNew);
}else{
fossil_fatal("cannot rename '%s' to '%s' since the delete of '%s' has "
"not yet been committed", zOrig, zNew, zNew);
}
}
fossil_print("RENAME %s %s\n", zOrig, zNew);
db_multi_exec(
"UPDATE vfile SET pathname='%q' WHERE pathname='%q' %s AND vid=%d",
zNew, zOrig, filename_collation(), vid
);
}
/*
** COMMAND: mv
** COMMAND: rename*
**
** Usage: %fossil mv|rename OLDNAME NEWNAME
** or: %fossil mv|rename OLDNAME... DIR
**
** Move or rename one or more files or directories within the repository tree.
** You can either rename a file or directory or move it to another subdirectory.
**
** This command does NOT rename or move the files on disk. This command merely
** records the fact that filenames have changed so that appropriate notations
** can be made at the next commit/checkin.
**
** Options:
** --case-sensitive <BOOL> override case-sensitive setting
**
** See also: changes, status
*/
void mv_cmd(void){
int i;
int vid;
char *zDest;
Blob dest;
Stmt q;
capture_case_sensitive_option();
db_must_be_within_tree();
vid = db_lget_int("checkout", 0);
if( vid==0 ){
fossil_panic("no checkout rename files in");
}
if( g.argc<4 ){
usage("OLDNAME NEWNAME");
|
| ︙ | ︙ | |||
642 643 644 645 646 647 648 |
int nOrig;
file_tree_name(g.argv[i], &orig, 1);
zOrig = blob_str(&orig);
nOrig = blob_size(&orig);
db_prepare(&q,
"SELECT pathname FROM vfile"
" WHERE vid=%d"
| | | | 647 648 649 650 651 652 653 654 655 656 657 658 659 660 661 662 663 |
int nOrig;
file_tree_name(g.argv[i], &orig, 1);
zOrig = blob_str(&orig);
nOrig = blob_size(&orig);
db_prepare(&q,
"SELECT pathname FROM vfile"
" WHERE vid=%d"
" AND (pathname='%q' %s OR (pathname>'%q/' AND pathname<'%q0'))"
" ORDER BY 1",
vid, zOrig, filename_collation(), zOrig, zOrig
);
while( db_step(&q)==SQLITE_ROW ){
const char *zPath = db_column_text(&q, 0);
int nPath = db_column_bytes(&q, 0);
const char *zTail;
if( nPath==nOrig ){
zTail = file_tail(zPath);
|
| ︙ | ︙ |