Fossil SCM

Use "win32-longpath" as default (when available, overridable with FOSSIL_VFS environment variable) when accessing peer repositories.

jan.nijtmans 2013-12-03 13:49 UTC trunk
Commit f8eefabe6a9d3dbf867504bd00dfc398a86ac230
1 file changed +20 -2
+20 -2
--- src/login.c
+++ src/login.c
@@ -688,18 +688,27 @@
688688
sqlite3_stmt *pStmt; /* Query against the other repository */
689689
char *zSQL; /* SQL of the query against other repo */
690690
char *zOtherRepo; /* Filename of the other repository */
691691
int rc; /* Result code from SQLite library functions */
692692
int nXfer = 0; /* Number of credentials transferred */
693
+ const char *zVfs;
693694
694695
zOtherRepo = db_text(0,
695696
"SELECT value FROM config WHERE name='peer-repo-%q'",
696697
zCode
697698
);
698699
if( zOtherRepo==0 ) return 0; /* No such peer repository */
699700
700
- rc = sqlite3_open(zOtherRepo, &pOther);
701
+ zVfs = fossil_getenv("FOSSIL_VFS");
702
+#if defined(_WIN32) || defined(__CYGWIN__)
703
+ if( zVfs==0 && sqlite3_libversion_number()>=3008001 ){
704
+ zVfs = "win32-longpath";
705
+ }
706
+#endif
707
+ rc = sqlite3_open_v2(zOtherRepo, &pOther,
708
+ SQLITE_OPEN_READWRITE | SQLITE_OPEN_CREATE,
709
+ zVfs);
701710
if( rc==SQLITE_OK ){
702711
sqlite3_create_function(pOther,"now",0,SQLITE_ANY,0,db_now_function,0,0);
703712
sqlite3_create_function(pOther, "constant_time_cmp", 2, SQLITE_UTF8, 0,
704713
constant_time_cmp_function, 0, 0);
705714
sqlite3_busy_timeout(pOther, 5000);
@@ -1428,10 +1437,11 @@
14281437
char *zSelfRepo; /* Name of our repository */
14291438
char *zSelfLabel; /* Project-name for our repository */
14301439
char *zSelfProjCode; /* Our project-code */
14311440
char *zSql; /* SQL to run on all peers */
14321441
const char *zSelf; /* The ATTACH name of our repository */
1442
+ const char *zVfs;
14331443
14341444
*pzErrMsg = 0; /* Default to no errors */
14351445
zSelf = db_name("repository");
14361446
14371447
/* Get the full pathname of the other repository */
@@ -1459,11 +1469,19 @@
14591469
/* Make sure the other repository is a valid Fossil database */
14601470
if( file_size(zRepo)<0 ){
14611471
*pzErrMsg = mprintf("repository file \"%s\" does not exist", zRepo);
14621472
return;
14631473
}
1464
- rc = sqlite3_open(zRepo, &pOther);
1474
+ zVfs = fossil_getenv("FOSSIL_VFS");
1475
+#if defined(_WIN32) || defined(__CYGWIN__)
1476
+ if( zVfs==0 && sqlite3_libversion_number()>=3008001 ){
1477
+ zVfs = "win32-longpath";
1478
+ }
1479
+#endif
1480
+ rc = sqlite3_open_v2(zRepo, &pOther,
1481
+ SQLITE_OPEN_READWRITE | SQLITE_OPEN_CREATE,
1482
+ zVfs);
14651483
if( rc!=SQLITE_OK ){
14661484
*pzErrMsg = mprintf(sqlite3_errmsg(pOther));
14671485
}else{
14681486
rc = sqlite3_exec(pOther, "SELECT count(*) FROM user", 0, 0, pzErrMsg);
14691487
}
14701488
--- src/login.c
+++ src/login.c
@@ -688,18 +688,27 @@
688 sqlite3_stmt *pStmt; /* Query against the other repository */
689 char *zSQL; /* SQL of the query against other repo */
690 char *zOtherRepo; /* Filename of the other repository */
691 int rc; /* Result code from SQLite library functions */
692 int nXfer = 0; /* Number of credentials transferred */
 
693
694 zOtherRepo = db_text(0,
695 "SELECT value FROM config WHERE name='peer-repo-%q'",
696 zCode
697 );
698 if( zOtherRepo==0 ) return 0; /* No such peer repository */
699
700 rc = sqlite3_open(zOtherRepo, &pOther);
 
 
 
 
 
 
 
 
701 if( rc==SQLITE_OK ){
702 sqlite3_create_function(pOther,"now",0,SQLITE_ANY,0,db_now_function,0,0);
703 sqlite3_create_function(pOther, "constant_time_cmp", 2, SQLITE_UTF8, 0,
704 constant_time_cmp_function, 0, 0);
705 sqlite3_busy_timeout(pOther, 5000);
@@ -1428,10 +1437,11 @@
1428 char *zSelfRepo; /* Name of our repository */
1429 char *zSelfLabel; /* Project-name for our repository */
1430 char *zSelfProjCode; /* Our project-code */
1431 char *zSql; /* SQL to run on all peers */
1432 const char *zSelf; /* The ATTACH name of our repository */
 
1433
1434 *pzErrMsg = 0; /* Default to no errors */
1435 zSelf = db_name("repository");
1436
1437 /* Get the full pathname of the other repository */
@@ -1459,11 +1469,19 @@
1459 /* Make sure the other repository is a valid Fossil database */
1460 if( file_size(zRepo)<0 ){
1461 *pzErrMsg = mprintf("repository file \"%s\" does not exist", zRepo);
1462 return;
1463 }
1464 rc = sqlite3_open(zRepo, &pOther);
 
 
 
 
 
 
 
 
1465 if( rc!=SQLITE_OK ){
1466 *pzErrMsg = mprintf(sqlite3_errmsg(pOther));
1467 }else{
1468 rc = sqlite3_exec(pOther, "SELECT count(*) FROM user", 0, 0, pzErrMsg);
1469 }
1470
--- src/login.c
+++ src/login.c
@@ -688,18 +688,27 @@
688 sqlite3_stmt *pStmt; /* Query against the other repository */
689 char *zSQL; /* SQL of the query against other repo */
690 char *zOtherRepo; /* Filename of the other repository */
691 int rc; /* Result code from SQLite library functions */
692 int nXfer = 0; /* Number of credentials transferred */
693 const char *zVfs;
694
695 zOtherRepo = db_text(0,
696 "SELECT value FROM config WHERE name='peer-repo-%q'",
697 zCode
698 );
699 if( zOtherRepo==0 ) return 0; /* No such peer repository */
700
701 zVfs = fossil_getenv("FOSSIL_VFS");
702 #if defined(_WIN32) || defined(__CYGWIN__)
703 if( zVfs==0 && sqlite3_libversion_number()>=3008001 ){
704 zVfs = "win32-longpath";
705 }
706 #endif
707 rc = sqlite3_open_v2(zOtherRepo, &pOther,
708 SQLITE_OPEN_READWRITE | SQLITE_OPEN_CREATE,
709 zVfs);
710 if( rc==SQLITE_OK ){
711 sqlite3_create_function(pOther,"now",0,SQLITE_ANY,0,db_now_function,0,0);
712 sqlite3_create_function(pOther, "constant_time_cmp", 2, SQLITE_UTF8, 0,
713 constant_time_cmp_function, 0, 0);
714 sqlite3_busy_timeout(pOther, 5000);
@@ -1428,10 +1437,11 @@
1437 char *zSelfRepo; /* Name of our repository */
1438 char *zSelfLabel; /* Project-name for our repository */
1439 char *zSelfProjCode; /* Our project-code */
1440 char *zSql; /* SQL to run on all peers */
1441 const char *zSelf; /* The ATTACH name of our repository */
1442 const char *zVfs;
1443
1444 *pzErrMsg = 0; /* Default to no errors */
1445 zSelf = db_name("repository");
1446
1447 /* Get the full pathname of the other repository */
@@ -1459,11 +1469,19 @@
1469 /* Make sure the other repository is a valid Fossil database */
1470 if( file_size(zRepo)<0 ){
1471 *pzErrMsg = mprintf("repository file \"%s\" does not exist", zRepo);
1472 return;
1473 }
1474 zVfs = fossil_getenv("FOSSIL_VFS");
1475 #if defined(_WIN32) || defined(__CYGWIN__)
1476 if( zVfs==0 && sqlite3_libversion_number()>=3008001 ){
1477 zVfs = "win32-longpath";
1478 }
1479 #endif
1480 rc = sqlite3_open_v2(zRepo, &pOther,
1481 SQLITE_OPEN_READWRITE | SQLITE_OPEN_CREATE,
1482 zVfs);
1483 if( rc!=SQLITE_OK ){
1484 *pzErrMsg = mprintf(sqlite3_errmsg(pOther));
1485 }else{
1486 rc = sqlite3_exec(pOther, "SELECT count(*) FROM user", 0, 0, pzErrMsg);
1487 }
1488

Keyboard Shortcuts

Open search /
Next entry (timeline) j
Previous entry (timeline) k
Open focused entry Enter
Show this help ?
Toggle theme Top nav button