Fossil SCM
The "ssh:"-style requests are eating the query parameters, somewhere. I don't know where yet. Don't use query parameter for the time being.
Commit
8028c868d3c0551d4b3ba766e354b22d12bd64aba38f045cc701a0c93078f55a
Parent
552eee775ac6ad7…
2 files changed
+22
-2
+8
-6
+22
-2
| --- src/checkout.c | ||
| +++ src/checkout.c | ||
| @@ -466,11 +466,13 @@ | ||
| 466 | 466 | ** -v|--verbose Show all files as they are extracted |
| 467 | 467 | */ |
| 468 | 468 | void get_cmd(void){ |
| 469 | 469 | int forceFlag = find_option("force","f",0)!=0; |
| 470 | 470 | int bVerbose = find_option("verbose","v",0)!=0; |
| 471 | + int bQuiet = find_option("quiet","q",0)!=0; | |
| 471 | 472 | int bDebug = find_option("debug",0,0)!=0; |
| 473 | + int bList = find_option("list",0,0)!=0; | |
| 472 | 474 | const char *zSqlArchive = find_option("sqlar",0,1); |
| 473 | 475 | const char *z; |
| 474 | 476 | char *zDest = 0; /* Where to store results */ |
| 475 | 477 | const char *zUrl; /* Url to get */ |
| 476 | 478 | const char *zVers; /* Version name to get */ |
| @@ -478,10 +480,13 @@ | ||
| 478 | 480 | Blob in, out; /* I/O for the HTTP request */ |
| 479 | 481 | Blob file; /* A file to extract */ |
| 480 | 482 | sqlite3 *db; /* Database containing downloaded sqlar */ |
| 481 | 483 | sqlite3_stmt *pStmt; /* Statement for querying the database */ |
| 482 | 484 | int rc; /* Result of subroutine calls */ |
| 485 | + int nFile = 0; /* Number of files written */ | |
| 486 | + int nDir = 0; /* Number of directories written */ | |
| 487 | + i64 nByte = 0; /* Number of bytes written */ | |
| 483 | 488 | |
| 484 | 489 | z = find_option("dest",0,1); |
| 485 | 490 | if( z ) zDest = fossil_strdup(z); |
| 486 | 491 | verify_all_options(); |
| 487 | 492 | if( g.argc<3 || g.argc>4 ){ |
| @@ -536,11 +541,11 @@ | ||
| 536 | 541 | } |
| 537 | 542 | } |
| 538 | 543 | |
| 539 | 544 | /* Construct a subpath on the URL if necessary */ |
| 540 | 545 | if( g.url.isSsh || g.url.isFile ){ |
| 541 | - g.url.subpath = mprintf("/sqlar?name=%t&r=%t", zDest, zVers); | |
| 546 | + g.url.subpath = mprintf("/sqlar/%t/%t.sqlar", zVers, zDest); | |
| 542 | 547 | } |
| 543 | 548 | |
| 544 | 549 | if( bDebug ){ |
| 545 | 550 | urlparse_print(0); |
| 546 | 551 | } |
| @@ -547,10 +552,11 @@ | ||
| 547 | 552 | |
| 548 | 553 | /* Fetch the ZIP archive for the requested check-in */ |
| 549 | 554 | blob_init(&in, 0, 0); |
| 550 | 555 | blob_init(&out, 0, 0); |
| 551 | 556 | if( bDebug ) mHttpFlags |= HTTP_VERBOSE; |
| 557 | + if( bQuiet ) mHttpFlags |= HTTP_QUIET; | |
| 552 | 558 | http_exchange(&in, &out, mHttpFlags, 4, 0); |
| 553 | 559 | |
| 554 | 560 | if( zSqlArchive ){ |
| 555 | 561 | blob_write_to_file(&out, zSqlArchive); |
| 556 | 562 | if( bVerbose ) fossil_print("%s\n", zSqlArchive); |
| @@ -576,18 +582,23 @@ | ||
| 576 | 582 | blob_init(&file, 0, 0); |
| 577 | 583 | while( sqlite3_step(pStmt)==SQLITE_ROW ){ |
| 578 | 584 | const char *zFilename = (const char*)sqlite3_column_text(pStmt, 0); |
| 579 | 585 | int mode = sqlite3_column_int(pStmt, 1); |
| 580 | 586 | int sz = sqlite3_column_int(pStmt, 2); |
| 581 | - if( mode & 0x4000 ){ | |
| 587 | + if( bList ){ | |
| 588 | + fossil_print("%s\n", zFilename); | |
| 589 | + }else if( mode & 0x4000 ){ | |
| 582 | 590 | /* A directory name */ |
| 591 | + nDir++; | |
| 583 | 592 | file_mkdir(zFilename, ExtFILE, 1); |
| 584 | 593 | }else{ |
| 585 | 594 | /* A file */ |
| 586 | 595 | unsigned char *inBuf = (unsigned char*)sqlite3_column_blob(pStmt,3); |
| 587 | 596 | unsigned int nIn = (unsigned int)sqlite3_column_bytes(pStmt,3); |
| 588 | 597 | unsigned long int nOut2 = (unsigned long int)sz; |
| 598 | + nFile++; | |
| 599 | + nByte += sz; | |
| 589 | 600 | blob_resize(&file, sz); |
| 590 | 601 | if( nIn<sz ){ |
| 591 | 602 | rc = uncompress((unsigned char*)blob_buffer(&file), &nOut2, |
| 592 | 603 | inBuf, nIn); |
| 593 | 604 | if( rc!=Z_OK ){ |
| @@ -607,6 +618,15 @@ | ||
| 607 | 618 | } |
| 608 | 619 | } |
| 609 | 620 | sqlite3_finalize(pStmt); |
| 610 | 621 | sqlite3_close(db); |
| 611 | 622 | blob_zero(&out); |
| 623 | + if( !bVerbose && !bQuiet && nFile>0 && zDest ){ | |
| 624 | + fossil_print("%d files (%,lld bytes) written into %s", | |
| 625 | + nFile, nByte, zDest); | |
| 626 | + if( nDir>1 ){ | |
| 627 | + fossil_print(" and %d subdirectories\n", nDir-1); | |
| 628 | + }else{ | |
| 629 | + fossil_print("\n"); | |
| 630 | + } | |
| 631 | + } | |
| 612 | 632 | } |
| 613 | 633 |
| --- src/checkout.c | |
| +++ src/checkout.c | |
| @@ -466,11 +466,13 @@ | |
| 466 | ** -v|--verbose Show all files as they are extracted |
| 467 | */ |
| 468 | void get_cmd(void){ |
| 469 | int forceFlag = find_option("force","f",0)!=0; |
| 470 | int bVerbose = find_option("verbose","v",0)!=0; |
| 471 | int bDebug = find_option("debug",0,0)!=0; |
| 472 | const char *zSqlArchive = find_option("sqlar",0,1); |
| 473 | const char *z; |
| 474 | char *zDest = 0; /* Where to store results */ |
| 475 | const char *zUrl; /* Url to get */ |
| 476 | const char *zVers; /* Version name to get */ |
| @@ -478,10 +480,13 @@ | |
| 478 | Blob in, out; /* I/O for the HTTP request */ |
| 479 | Blob file; /* A file to extract */ |
| 480 | sqlite3 *db; /* Database containing downloaded sqlar */ |
| 481 | sqlite3_stmt *pStmt; /* Statement for querying the database */ |
| 482 | int rc; /* Result of subroutine calls */ |
| 483 | |
| 484 | z = find_option("dest",0,1); |
| 485 | if( z ) zDest = fossil_strdup(z); |
| 486 | verify_all_options(); |
| 487 | if( g.argc<3 || g.argc>4 ){ |
| @@ -536,11 +541,11 @@ | |
| 536 | } |
| 537 | } |
| 538 | |
| 539 | /* Construct a subpath on the URL if necessary */ |
| 540 | if( g.url.isSsh || g.url.isFile ){ |
| 541 | g.url.subpath = mprintf("/sqlar?name=%t&r=%t", zDest, zVers); |
| 542 | } |
| 543 | |
| 544 | if( bDebug ){ |
| 545 | urlparse_print(0); |
| 546 | } |
| @@ -547,10 +552,11 @@ | |
| 547 | |
| 548 | /* Fetch the ZIP archive for the requested check-in */ |
| 549 | blob_init(&in, 0, 0); |
| 550 | blob_init(&out, 0, 0); |
| 551 | if( bDebug ) mHttpFlags |= HTTP_VERBOSE; |
| 552 | http_exchange(&in, &out, mHttpFlags, 4, 0); |
| 553 | |
| 554 | if( zSqlArchive ){ |
| 555 | blob_write_to_file(&out, zSqlArchive); |
| 556 | if( bVerbose ) fossil_print("%s\n", zSqlArchive); |
| @@ -576,18 +582,23 @@ | |
| 576 | blob_init(&file, 0, 0); |
| 577 | while( sqlite3_step(pStmt)==SQLITE_ROW ){ |
| 578 | const char *zFilename = (const char*)sqlite3_column_text(pStmt, 0); |
| 579 | int mode = sqlite3_column_int(pStmt, 1); |
| 580 | int sz = sqlite3_column_int(pStmt, 2); |
| 581 | if( mode & 0x4000 ){ |
| 582 | /* A directory name */ |
| 583 | file_mkdir(zFilename, ExtFILE, 1); |
| 584 | }else{ |
| 585 | /* A file */ |
| 586 | unsigned char *inBuf = (unsigned char*)sqlite3_column_blob(pStmt,3); |
| 587 | unsigned int nIn = (unsigned int)sqlite3_column_bytes(pStmt,3); |
| 588 | unsigned long int nOut2 = (unsigned long int)sz; |
| 589 | blob_resize(&file, sz); |
| 590 | if( nIn<sz ){ |
| 591 | rc = uncompress((unsigned char*)blob_buffer(&file), &nOut2, |
| 592 | inBuf, nIn); |
| 593 | if( rc!=Z_OK ){ |
| @@ -607,6 +618,15 @@ | |
| 607 | } |
| 608 | } |
| 609 | sqlite3_finalize(pStmt); |
| 610 | sqlite3_close(db); |
| 611 | blob_zero(&out); |
| 612 | } |
| 613 |
| --- src/checkout.c | |
| +++ src/checkout.c | |
| @@ -466,11 +466,13 @@ | |
| 466 | ** -v|--verbose Show all files as they are extracted |
| 467 | */ |
| 468 | void get_cmd(void){ |
| 469 | int forceFlag = find_option("force","f",0)!=0; |
| 470 | int bVerbose = find_option("verbose","v",0)!=0; |
| 471 | int bQuiet = find_option("quiet","q",0)!=0; |
| 472 | int bDebug = find_option("debug",0,0)!=0; |
| 473 | int bList = find_option("list",0,0)!=0; |
| 474 | const char *zSqlArchive = find_option("sqlar",0,1); |
| 475 | const char *z; |
| 476 | char *zDest = 0; /* Where to store results */ |
| 477 | const char *zUrl; /* Url to get */ |
| 478 | const char *zVers; /* Version name to get */ |
| @@ -478,10 +480,13 @@ | |
| 480 | Blob in, out; /* I/O for the HTTP request */ |
| 481 | Blob file; /* A file to extract */ |
| 482 | sqlite3 *db; /* Database containing downloaded sqlar */ |
| 483 | sqlite3_stmt *pStmt; /* Statement for querying the database */ |
| 484 | int rc; /* Result of subroutine calls */ |
| 485 | int nFile = 0; /* Number of files written */ |
| 486 | int nDir = 0; /* Number of directories written */ |
| 487 | i64 nByte = 0; /* Number of bytes written */ |
| 488 | |
| 489 | z = find_option("dest",0,1); |
| 490 | if( z ) zDest = fossil_strdup(z); |
| 491 | verify_all_options(); |
| 492 | if( g.argc<3 || g.argc>4 ){ |
| @@ -536,11 +541,11 @@ | |
| 541 | } |
| 542 | } |
| 543 | |
| 544 | /* Construct a subpath on the URL if necessary */ |
| 545 | if( g.url.isSsh || g.url.isFile ){ |
| 546 | g.url.subpath = mprintf("/sqlar/%t/%t.sqlar", zVers, zDest); |
| 547 | } |
| 548 | |
| 549 | if( bDebug ){ |
| 550 | urlparse_print(0); |
| 551 | } |
| @@ -547,10 +552,11 @@ | |
| 552 | |
| 553 | /* Fetch the ZIP archive for the requested check-in */ |
| 554 | blob_init(&in, 0, 0); |
| 555 | blob_init(&out, 0, 0); |
| 556 | if( bDebug ) mHttpFlags |= HTTP_VERBOSE; |
| 557 | if( bQuiet ) mHttpFlags |= HTTP_QUIET; |
| 558 | http_exchange(&in, &out, mHttpFlags, 4, 0); |
| 559 | |
| 560 | if( zSqlArchive ){ |
| 561 | blob_write_to_file(&out, zSqlArchive); |
| 562 | if( bVerbose ) fossil_print("%s\n", zSqlArchive); |
| @@ -576,18 +582,23 @@ | |
| 582 | blob_init(&file, 0, 0); |
| 583 | while( sqlite3_step(pStmt)==SQLITE_ROW ){ |
| 584 | const char *zFilename = (const char*)sqlite3_column_text(pStmt, 0); |
| 585 | int mode = sqlite3_column_int(pStmt, 1); |
| 586 | int sz = sqlite3_column_int(pStmt, 2); |
| 587 | if( bList ){ |
| 588 | fossil_print("%s\n", zFilename); |
| 589 | }else if( mode & 0x4000 ){ |
| 590 | /* A directory name */ |
| 591 | nDir++; |
| 592 | file_mkdir(zFilename, ExtFILE, 1); |
| 593 | }else{ |
| 594 | /* A file */ |
| 595 | unsigned char *inBuf = (unsigned char*)sqlite3_column_blob(pStmt,3); |
| 596 | unsigned int nIn = (unsigned int)sqlite3_column_bytes(pStmt,3); |
| 597 | unsigned long int nOut2 = (unsigned long int)sz; |
| 598 | nFile++; |
| 599 | nByte += sz; |
| 600 | blob_resize(&file, sz); |
| 601 | if( nIn<sz ){ |
| 602 | rc = uncompress((unsigned char*)blob_buffer(&file), &nOut2, |
| 603 | inBuf, nIn); |
| 604 | if( rc!=Z_OK ){ |
| @@ -607,6 +618,15 @@ | |
| 618 | } |
| 619 | } |
| 620 | sqlite3_finalize(pStmt); |
| 621 | sqlite3_close(db); |
| 622 | blob_zero(&out); |
| 623 | if( !bVerbose && !bQuiet && nFile>0 && zDest ){ |
| 624 | fossil_print("%d files (%,lld bytes) written into %s", |
| 625 | nFile, nByte, zDest); |
| 626 | if( nDir>1 ){ |
| 627 | fossil_print(" and %d subdirectories\n", nDir-1); |
| 628 | }else{ |
| 629 | fossil_print("\n"); |
| 630 | } |
| 631 | } |
| 632 | } |
| 633 |
+8
-6
| --- src/http.c | ||
| +++ src/http.c | ||
| @@ -686,16 +686,18 @@ | ||
| 686 | 686 | && (g.url.flags & URL_SSH_EXE)==0 /* Does not have ?fossil=.... */ |
| 687 | 687 | && (g.url.flags & URL_SSH_RETRY)==0 /* Not retried already */ |
| 688 | 688 | ){ |
| 689 | 689 | /* Retry after flipping the SSH_PATH setting */ |
| 690 | 690 | transport_close(&g.url); |
| 691 | - fossil_print( | |
| 692 | - "First attempt to run fossil on %s using SSH failed.\n" | |
| 693 | - "Retrying %s the PATH= argument.\n", | |
| 694 | - g.url.hostname, | |
| 695 | - (g.url.flags & URL_SSH_PATH)!=0 ? "without" : "with" | |
| 696 | - ); | |
| 691 | + if( (mHttpFlags & HTTP_QUIET)==0 ){ | |
| 692 | + fossil_print( | |
| 693 | + "First attempt to run fossil on %s using SSH failed.\n" | |
| 694 | + "Retrying %s the PATH= argument.\n", | |
| 695 | + g.url.hostname, | |
| 696 | + (g.url.flags & URL_SSH_PATH)!=0 ? "without" : "with" | |
| 697 | + ); | |
| 698 | + } | |
| 697 | 699 | g.url.flags ^= URL_SSH_PATH|URL_SSH_RETRY; |
| 698 | 700 | rc = http_exchange(pSend,pReply,mHttpFlags,0,zAltMimetype); |
| 699 | 701 | if( rc==0 && g.db!=0 ){ |
| 700 | 702 | (void)ssh_needs_path_argument(g.url.hostname, |
| 701 | 703 | (g.url.flags & URL_SSH_PATH)!=0); |
| 702 | 704 |
| --- src/http.c | |
| +++ src/http.c | |
| @@ -686,16 +686,18 @@ | |
| 686 | && (g.url.flags & URL_SSH_EXE)==0 /* Does not have ?fossil=.... */ |
| 687 | && (g.url.flags & URL_SSH_RETRY)==0 /* Not retried already */ |
| 688 | ){ |
| 689 | /* Retry after flipping the SSH_PATH setting */ |
| 690 | transport_close(&g.url); |
| 691 | fossil_print( |
| 692 | "First attempt to run fossil on %s using SSH failed.\n" |
| 693 | "Retrying %s the PATH= argument.\n", |
| 694 | g.url.hostname, |
| 695 | (g.url.flags & URL_SSH_PATH)!=0 ? "without" : "with" |
| 696 | ); |
| 697 | g.url.flags ^= URL_SSH_PATH|URL_SSH_RETRY; |
| 698 | rc = http_exchange(pSend,pReply,mHttpFlags,0,zAltMimetype); |
| 699 | if( rc==0 && g.db!=0 ){ |
| 700 | (void)ssh_needs_path_argument(g.url.hostname, |
| 701 | (g.url.flags & URL_SSH_PATH)!=0); |
| 702 |
| --- src/http.c | |
| +++ src/http.c | |
| @@ -686,16 +686,18 @@ | |
| 686 | && (g.url.flags & URL_SSH_EXE)==0 /* Does not have ?fossil=.... */ |
| 687 | && (g.url.flags & URL_SSH_RETRY)==0 /* Not retried already */ |
| 688 | ){ |
| 689 | /* Retry after flipping the SSH_PATH setting */ |
| 690 | transport_close(&g.url); |
| 691 | if( (mHttpFlags & HTTP_QUIET)==0 ){ |
| 692 | fossil_print( |
| 693 | "First attempt to run fossil on %s using SSH failed.\n" |
| 694 | "Retrying %s the PATH= argument.\n", |
| 695 | g.url.hostname, |
| 696 | (g.url.flags & URL_SSH_PATH)!=0 ? "without" : "with" |
| 697 | ); |
| 698 | } |
| 699 | g.url.flags ^= URL_SSH_PATH|URL_SSH_RETRY; |
| 700 | rc = http_exchange(pSend,pReply,mHttpFlags,0,zAltMimetype); |
| 701 | if( rc==0 && g.db!=0 ){ |
| 702 | (void)ssh_needs_path_argument(g.url.hostname, |
| 703 | (g.url.flags & URL_SSH_PATH)!=0); |
| 704 |