Fossil SCM
Merge symlink fixes into trunk.
Commit
c97535c5d815b1d0be8197b74dea448f035c346d
Parent
56d624f6e20fe0d…
7 files changed
+1
-1
+35
-40
+24
-18
+4
-4
+3
-3
+3
-3
+23
-24
M
auto.def
+1
-1
| --- auto.def | ||
| +++ auto.def | ||
| @@ -135,11 +135,11 @@ | ||
| 135 | 135 | define-append EXTRA_CFLAGS $cflags |
| 136 | 136 | define-append EXTRA_LDFLAGS $ldflags |
| 137 | 137 | define-append LIBS -lssl -lcrypto |
| 138 | 138 | msg-result "HTTP support enabled" |
| 139 | 139 | |
| 140 | - # Maybe needed to silence warnings on Mac OS X 10.7 with openssl | |
| 140 | + # Silence OpenSSL deprecation warnings on Mac OS X 10.7. | |
| 141 | 141 | if {[string match *-darwin* [get-define host]]} { |
| 142 | 142 | if {[cctest -cflags {-Wdeprecated-declarations}]} { |
| 143 | 143 | define-append EXTRA_CFLAGS -Wdeprecated-declarations |
| 144 | 144 | } |
| 145 | 145 | } |
| 146 | 146 |
| --- auto.def | |
| +++ auto.def | |
| @@ -135,11 +135,11 @@ | |
| 135 | define-append EXTRA_CFLAGS $cflags |
| 136 | define-append EXTRA_LDFLAGS $ldflags |
| 137 | define-append LIBS -lssl -lcrypto |
| 138 | msg-result "HTTP support enabled" |
| 139 | |
| 140 | # Maybe needed to silence warnings on Mac OS X 10.7 with openssl |
| 141 | if {[string match *-darwin* [get-define host]]} { |
| 142 | if {[cctest -cflags {-Wdeprecated-declarations}]} { |
| 143 | define-append EXTRA_CFLAGS -Wdeprecated-declarations |
| 144 | } |
| 145 | } |
| 146 |
| --- auto.def | |
| +++ auto.def | |
| @@ -135,11 +135,11 @@ | |
| 135 | define-append EXTRA_CFLAGS $cflags |
| 136 | define-append EXTRA_LDFLAGS $ldflags |
| 137 | define-append LIBS -lssl -lcrypto |
| 138 | msg-result "HTTP support enabled" |
| 139 | |
| 140 | # Silence OpenSSL deprecation warnings on Mac OS X 10.7. |
| 141 | if {[string match *-darwin* [get-define host]]} { |
| 142 | if {[cctest -cflags {-Wdeprecated-declarations}]} { |
| 143 | define-append EXTRA_CFLAGS -Wdeprecated-declarations |
| 144 | } |
| 145 | } |
| 146 |
+35
-40
| --- src/file.c | ||
| +++ src/file.c | ||
| @@ -100,16 +100,13 @@ | ||
| 100 | 100 | */ |
| 101 | 101 | int file_isfile_or_link(const char *zFilename){ |
| 102 | 102 | #if !defined(_WIN32) |
| 103 | 103 | if ( g.allowSymlinks ){ |
| 104 | 104 | return getStat(zFilename) ? 0 : S_ISREG(fileStat.st_mode) || S_ISLNK(fileStat.st_mode); |
| 105 | - }else{ | |
| 106 | - return getStat(zFilename) ? 0 : S_ISREG(fileStat.st_mode); | |
| 107 | 105 | } |
| 108 | -#else | |
| 109 | - return getStat(zFilename) ? 0 : S_ISREG(fileStat.st_mode); | |
| 110 | 106 | #endif |
| 107 | + return getStat(zFilename) ? 0 : S_ISREG(fileStat.st_mode); | |
| 111 | 108 | } |
| 112 | 109 | |
| 113 | 110 | /* |
| 114 | 111 | ** Return TRUE if the named file is an ordinary file. Return false |
| 115 | 112 | ** for directories, devices, fifos, symlinks, etc. |
| @@ -116,28 +113,10 @@ | ||
| 116 | 113 | */ |
| 117 | 114 | int file_isfile(const char *zFilename){ |
| 118 | 115 | return getStat(zFilename) ? 0 : S_ISREG(fileStat.st_mode); |
| 119 | 116 | } |
| 120 | 117 | |
| 121 | -/* | |
| 122 | -** Return TRUE if the named file is a symlink and symlinks are allowed. | |
| 123 | -** Return false for all other cases. | |
| 124 | -** | |
| 125 | -** On Windows, always return False. | |
| 126 | -*/ | |
| 127 | -int file_islink(const char *zFilename){ | |
| 128 | -#if !defined(_WIN32) | |
| 129 | - if( g.allowSymlinks ){ | |
| 130 | - return getStat(zFilename) ? 0 : S_ISLNK(fileStat.st_mode); | |
| 131 | - }else{ | |
| 132 | - return 0; | |
| 133 | - } | |
| 134 | -#else | |
| 135 | - return 0; | |
| 136 | -#endif | |
| 137 | -} | |
| 138 | - | |
| 139 | 118 | /* |
| 140 | 119 | ** Create symlink to file on Unix, or plain-text file with |
| 141 | 120 | ** symlink target if "allow-symlinks" is off or we're on Windows. |
| 142 | 121 | ** |
| 143 | 122 | ** Arguments: target file (symlink will point to it), link file |
| @@ -180,36 +159,52 @@ | ||
| 180 | 159 | blob_reset(&content); |
| 181 | 160 | } |
| 182 | 161 | } |
| 183 | 162 | |
| 184 | 163 | /* |
| 185 | -** Return TRUE if the named file is an executable. Return false | |
| 186 | -** for directories, devices, fifos, symlinks, etc. | |
| 164 | +** Return file permissions (normal, executable, or symlink): | |
| 165 | +** - PERM_EXE if file is executable; | |
| 166 | +** - PERM_LNK on Unix if file is symlink and allow-symlinks option is on; | |
| 167 | +** - PERM_REG for all other cases (regular file, directory, fifo, etc). | |
| 187 | 168 | */ |
| 188 | -int file_isexe(const char *zFilename){ | |
| 189 | - if( getStat(zFilename) || !S_ISREG(fileStat.st_mode) ) return 0; | |
| 169 | +int file_perm(const char *zFilename){ | |
| 170 | + if( getStat(zFilename) ) return PERM_REG; | |
| 190 | 171 | #if defined(_WIN32) |
| 191 | 172 | # if defined(__DMC__) || defined(_MSC_VER) |
| 192 | 173 | # define S_IXUSR _S_IEXEC |
| 193 | 174 | # endif |
| 194 | - return ((S_IXUSR)&fileStat.st_mode)!=0; | |
| 175 | + if( S_ISREG(fileStat.st_mode) && ((S_IXUSR)&fileStat.st_mode)!=0 ) | |
| 176 | + return PERM_EXE; | |
| 177 | + else | |
| 178 | + return PERM_REG; | |
| 195 | 179 | #else |
| 196 | - return ((S_IXUSR|S_IXGRP|S_IXOTH)&fileStat.st_mode)!=0; | |
| 197 | -#endif | |
| 198 | -} | |
| 199 | - | |
| 200 | - | |
| 201 | -/* | |
| 202 | -** Return file "permissions" (normal, executable, or symlink). | |
| 203 | -*/ | |
| 204 | -int file_perm(const char *zFilename){ | |
| 205 | - /*TODO(dchest): optimize by calling stat once.*/ | |
| 206 | - if( file_isexe(zFilename) ) | |
| 180 | + if( S_ISREG(fileStat.st_mode) && | |
| 181 | + ((S_IXUSR|S_IXGRP|S_IXOTH)&fileStat.st_mode)!=0 ) | |
| 207 | 182 | return PERM_EXE; |
| 208 | - if( file_islink(zFilename) ) | |
| 183 | + else if( g.allowSymlinks && S_ISLNK(fileStat.st_mode) ) | |
| 209 | 184 | return PERM_LNK; |
| 210 | - return PERM_REG; | |
| 185 | + else | |
| 186 | + return PERM_REG; | |
| 187 | +#endif | |
| 188 | +} | |
| 189 | + | |
| 190 | +/* | |
| 191 | +** Return TRUE if the named file is an executable. Return false | |
| 192 | +** for directories, devices, fifos, symlinks, etc. | |
| 193 | +*/ | |
| 194 | +int file_isexe(const char *zFilename){ | |
| 195 | + return file_perm(zFilename)==PERM_EXE; | |
| 196 | +} | |
| 197 | + | |
| 198 | +/* | |
| 199 | +** Return TRUE if the named file is a symlink and symlinks are allowed. | |
| 200 | +** Return false for all other cases. | |
| 201 | +** | |
| 202 | +** On Windows, always return False. | |
| 203 | +*/ | |
| 204 | +int file_islink(const char *zFilename){ | |
| 205 | + return file_perm(zFilename)==PERM_LNK; | |
| 211 | 206 | } |
| 212 | 207 | |
| 213 | 208 | /* |
| 214 | 209 | ** Return 1 if zFilename is a directory. Return 0 if zFilename |
| 215 | 210 | ** does not exist. Return 2 if zFilename exists but is something |
| 216 | 211 |
| --- src/file.c | |
| +++ src/file.c | |
| @@ -100,16 +100,13 @@ | |
| 100 | */ |
| 101 | int file_isfile_or_link(const char *zFilename){ |
| 102 | #if !defined(_WIN32) |
| 103 | if ( g.allowSymlinks ){ |
| 104 | return getStat(zFilename) ? 0 : S_ISREG(fileStat.st_mode) || S_ISLNK(fileStat.st_mode); |
| 105 | }else{ |
| 106 | return getStat(zFilename) ? 0 : S_ISREG(fileStat.st_mode); |
| 107 | } |
| 108 | #else |
| 109 | return getStat(zFilename) ? 0 : S_ISREG(fileStat.st_mode); |
| 110 | #endif |
| 111 | } |
| 112 | |
| 113 | /* |
| 114 | ** Return TRUE if the named file is an ordinary file. Return false |
| 115 | ** for directories, devices, fifos, symlinks, etc. |
| @@ -116,28 +113,10 @@ | |
| 116 | */ |
| 117 | int file_isfile(const char *zFilename){ |
| 118 | return getStat(zFilename) ? 0 : S_ISREG(fileStat.st_mode); |
| 119 | } |
| 120 | |
| 121 | /* |
| 122 | ** Return TRUE if the named file is a symlink and symlinks are allowed. |
| 123 | ** Return false for all other cases. |
| 124 | ** |
| 125 | ** On Windows, always return False. |
| 126 | */ |
| 127 | int file_islink(const char *zFilename){ |
| 128 | #if !defined(_WIN32) |
| 129 | if( g.allowSymlinks ){ |
| 130 | return getStat(zFilename) ? 0 : S_ISLNK(fileStat.st_mode); |
| 131 | }else{ |
| 132 | return 0; |
| 133 | } |
| 134 | #else |
| 135 | return 0; |
| 136 | #endif |
| 137 | } |
| 138 | |
| 139 | /* |
| 140 | ** Create symlink to file on Unix, or plain-text file with |
| 141 | ** symlink target if "allow-symlinks" is off or we're on Windows. |
| 142 | ** |
| 143 | ** Arguments: target file (symlink will point to it), link file |
| @@ -180,36 +159,52 @@ | |
| 180 | blob_reset(&content); |
| 181 | } |
| 182 | } |
| 183 | |
| 184 | /* |
| 185 | ** Return TRUE if the named file is an executable. Return false |
| 186 | ** for directories, devices, fifos, symlinks, etc. |
| 187 | */ |
| 188 | int file_isexe(const char *zFilename){ |
| 189 | if( getStat(zFilename) || !S_ISREG(fileStat.st_mode) ) return 0; |
| 190 | #if defined(_WIN32) |
| 191 | # if defined(__DMC__) || defined(_MSC_VER) |
| 192 | # define S_IXUSR _S_IEXEC |
| 193 | # endif |
| 194 | return ((S_IXUSR)&fileStat.st_mode)!=0; |
| 195 | #else |
| 196 | return ((S_IXUSR|S_IXGRP|S_IXOTH)&fileStat.st_mode)!=0; |
| 197 | #endif |
| 198 | } |
| 199 | |
| 200 | |
| 201 | /* |
| 202 | ** Return file "permissions" (normal, executable, or symlink). |
| 203 | */ |
| 204 | int file_perm(const char *zFilename){ |
| 205 | /*TODO(dchest): optimize by calling stat once.*/ |
| 206 | if( file_isexe(zFilename) ) |
| 207 | return PERM_EXE; |
| 208 | if( file_islink(zFilename) ) |
| 209 | return PERM_LNK; |
| 210 | return PERM_REG; |
| 211 | } |
| 212 | |
| 213 | /* |
| 214 | ** Return 1 if zFilename is a directory. Return 0 if zFilename |
| 215 | ** does not exist. Return 2 if zFilename exists but is something |
| 216 |
| --- src/file.c | |
| +++ src/file.c | |
| @@ -100,16 +100,13 @@ | |
| 100 | */ |
| 101 | int file_isfile_or_link(const char *zFilename){ |
| 102 | #if !defined(_WIN32) |
| 103 | if ( g.allowSymlinks ){ |
| 104 | return getStat(zFilename) ? 0 : S_ISREG(fileStat.st_mode) || S_ISLNK(fileStat.st_mode); |
| 105 | } |
| 106 | #endif |
| 107 | return getStat(zFilename) ? 0 : S_ISREG(fileStat.st_mode); |
| 108 | } |
| 109 | |
| 110 | /* |
| 111 | ** Return TRUE if the named file is an ordinary file. Return false |
| 112 | ** for directories, devices, fifos, symlinks, etc. |
| @@ -116,28 +113,10 @@ | |
| 113 | */ |
| 114 | int file_isfile(const char *zFilename){ |
| 115 | return getStat(zFilename) ? 0 : S_ISREG(fileStat.st_mode); |
| 116 | } |
| 117 | |
| 118 | /* |
| 119 | ** Create symlink to file on Unix, or plain-text file with |
| 120 | ** symlink target if "allow-symlinks" is off or we're on Windows. |
| 121 | ** |
| 122 | ** Arguments: target file (symlink will point to it), link file |
| @@ -180,36 +159,52 @@ | |
| 159 | blob_reset(&content); |
| 160 | } |
| 161 | } |
| 162 | |
| 163 | /* |
| 164 | ** Return file permissions (normal, executable, or symlink): |
| 165 | ** - PERM_EXE if file is executable; |
| 166 | ** - PERM_LNK on Unix if file is symlink and allow-symlinks option is on; |
| 167 | ** - PERM_REG for all other cases (regular file, directory, fifo, etc). |
| 168 | */ |
| 169 | int file_perm(const char *zFilename){ |
| 170 | if( getStat(zFilename) ) return PERM_REG; |
| 171 | #if defined(_WIN32) |
| 172 | # if defined(__DMC__) || defined(_MSC_VER) |
| 173 | # define S_IXUSR _S_IEXEC |
| 174 | # endif |
| 175 | if( S_ISREG(fileStat.st_mode) && ((S_IXUSR)&fileStat.st_mode)!=0 ) |
| 176 | return PERM_EXE; |
| 177 | else |
| 178 | return PERM_REG; |
| 179 | #else |
| 180 | if( S_ISREG(fileStat.st_mode) && |
| 181 | ((S_IXUSR|S_IXGRP|S_IXOTH)&fileStat.st_mode)!=0 ) |
| 182 | return PERM_EXE; |
| 183 | else if( g.allowSymlinks && S_ISLNK(fileStat.st_mode) ) |
| 184 | return PERM_LNK; |
| 185 | else |
| 186 | return PERM_REG; |
| 187 | #endif |
| 188 | } |
| 189 | |
| 190 | /* |
| 191 | ** Return TRUE if the named file is an executable. Return false |
| 192 | ** for directories, devices, fifos, symlinks, etc. |
| 193 | */ |
| 194 | int file_isexe(const char *zFilename){ |
| 195 | return file_perm(zFilename)==PERM_EXE; |
| 196 | } |
| 197 | |
| 198 | /* |
| 199 | ** Return TRUE if the named file is a symlink and symlinks are allowed. |
| 200 | ** Return false for all other cases. |
| 201 | ** |
| 202 | ** On Windows, always return False. |
| 203 | */ |
| 204 | int file_islink(const char *zFilename){ |
| 205 | return file_perm(zFilename)==PERM_LNK; |
| 206 | } |
| 207 | |
| 208 | /* |
| 209 | ** Return 1 if zFilename is a directory. Return 0 if zFilename |
| 210 | ** does not exist. Return 2 if zFilename exists but is something |
| 211 |
+24
-18
| --- src/merge.c | ||
| +++ src/merge.c | ||
| @@ -253,23 +253,38 @@ | ||
| 253 | 253 | " ridp=coalesce((SELECT rid FROM vfile WHERE vid=%d AND pathname=fnp),0)," |
| 254 | 254 | " idm=coalesce((SELECT id FROM vfile WHERE vid=%d AND pathname=fnm),0)," |
| 255 | 255 | " ridm=coalesce((SELECT rid FROM vfile WHERE vid=%d AND pathname=fnm),0)", |
| 256 | 256 | pid, pid, mid, mid |
| 257 | 257 | ); |
| 258 | + | |
| 259 | + /* | |
| 260 | + ** Add islink information for files in V and M | |
| 261 | + ** | |
| 262 | + */ | |
| 263 | + db_multi_exec( | |
| 264 | + "UPDATE fv SET" | |
| 265 | + " islinkv=coalesce((SELECT islink FROM vfile WHERE vid=%d AND pathname=fnm),0)," | |
| 266 | + " islinkm=coalesce((SELECT islink FROM vfile WHERE vid=%d AND pathname=fnm),0)", | |
| 267 | + vid, mid | |
| 268 | + ); | |
| 258 | 269 | |
| 259 | 270 | if( debugFlag ){ |
| 260 | 271 | db_prepare(&q, |
| 261 | - "SELECT rowid, fn, fnp, fnm, chnged, ridv, ridp, ridm, isexe FROM fv" | |
| 272 | + "SELECT rowid, fn, fnp, fnm, chnged, ridv, ridp, ridm, " | |
| 273 | + " isexe, islinkv, islinkm FROM fv" | |
| 262 | 274 | ); |
| 263 | 275 | while( db_step(&q)==SQLITE_ROW ){ |
| 264 | - fossil_print("%3d: ridv=%-4d ridp=%-4d ridm=%-4d chnged=%d isexe=%d\n", | |
| 276 | + fossil_print("%3d: ridv=%-4d ridp=%-4d ridm=%-4d chnged=%d isexe=%d " | |
| 277 | + " islinkv=%d islinkm=%d", | |
| 265 | 278 | db_column_int(&q, 0), |
| 266 | 279 | db_column_int(&q, 5), |
| 267 | 280 | db_column_int(&q, 6), |
| 268 | 281 | db_column_int(&q, 7), |
| 269 | 282 | db_column_int(&q, 4), |
| 270 | - db_column_int(&q, 8)); | |
| 283 | + db_column_int(&q, 8), | |
| 284 | + db_column_int(&q, 9), | |
| 285 | + db_column_int(&q, 10)); | |
| 271 | 286 | fossil_print(" fn = [%s]\n", db_column_text(&q, 1)); |
| 272 | 287 | fossil_print(" fnp = [%s]\n", db_column_text(&q, 2)); |
| 273 | 288 | fossil_print(" fnm = [%s]\n", db_column_text(&q, 3)); |
| 274 | 289 | } |
| 275 | 290 | db_finalize(&q); |
| @@ -303,12 +318,12 @@ | ||
| 303 | 318 | int idm = db_column_int(&q, 0); |
| 304 | 319 | int rowid = db_column_int(&q, 1); |
| 305 | 320 | int idv; |
| 306 | 321 | const char *zName; |
| 307 | 322 | db_multi_exec( |
| 308 | - "INSERT INTO vfile(vid,chnged,deleted,rid,mrid,isexe,pathname)" | |
| 309 | - " SELECT %d,3,0,rid,mrid,isexe,pathname FROM vfile WHERE id=%d", | |
| 323 | + "INSERT INTO vfile(vid,chnged,deleted,rid,mrid,isexe,islink,pathname)" | |
| 324 | + " SELECT %d,3,0,rid,mrid,isexe,islink,pathname FROM vfile WHERE id=%d", | |
| 310 | 325 | vid, idm |
| 311 | 326 | ); |
| 312 | 327 | idv = db_last_insert_rowid(); |
| 313 | 328 | db_multi_exec("UPDATE fv SET idv=%d WHERE rowid=%d", idv, rowid); |
| 314 | 329 | zName = db_column_text(&q, 2); |
| @@ -317,41 +332,32 @@ | ||
| 317 | 332 | undo_save(zName); |
| 318 | 333 | vfile_to_disk(0, idm, 0, 0); |
| 319 | 334 | } |
| 320 | 335 | } |
| 321 | 336 | db_finalize(&q); |
| 322 | - | |
| 323 | - /* | |
| 324 | - ** Add islink information for files in V and M | |
| 325 | - ** | |
| 326 | - */ | |
| 327 | - db_multi_exec( | |
| 328 | - "UPDATE fv SET" | |
| 329 | - " islinkv=coalesce((SELECT islink FROM vfile WHERE vid=%d AND pathname=fnm),0)," | |
| 330 | - " islinkm=coalesce((SELECT islink FROM vfile WHERE vid=%d AND pathname=fnm),0)", | |
| 331 | - vid, mid | |
| 332 | - ); | |
| 333 | 337 | |
| 334 | 338 | /* |
| 335 | 339 | ** Find files that have changed from P->M but not P->V. |
| 336 | 340 | ** Copy the M content over into V. |
| 337 | 341 | */ |
| 338 | 342 | db_prepare(&q, |
| 339 | - "SELECT idv, ridm, fn FROM fv" | |
| 343 | + "SELECT idv, ridm, fn, islinkm FROM fv" | |
| 340 | 344 | " WHERE idp>0 AND idv>0 AND idm>0" |
| 341 | 345 | " AND ridm!=ridp AND ridv=ridp AND NOT chnged" |
| 342 | 346 | ); |
| 343 | 347 | while( db_step(&q)==SQLITE_ROW ){ |
| 344 | 348 | int idv = db_column_int(&q, 0); |
| 345 | 349 | int ridm = db_column_int(&q, 1); |
| 346 | 350 | const char *zName = db_column_text(&q, 2); |
| 351 | + int islinkm = db_column_int(&q, 3); | |
| 347 | 352 | /* Copy content from idm over into idv. Overwrite idv. */ |
| 348 | 353 | fossil_print("UPDATE %s\n", zName); |
| 349 | 354 | if( !nochangeFlag ){ |
| 350 | 355 | undo_save(zName); |
| 351 | 356 | db_multi_exec( |
| 352 | - "UPDATE vfile SET mtime=0, mrid=%d, chnged=2 WHERE id=%d", ridm, idv | |
| 357 | + "UPDATE vfile SET mtime=0, mrid=%d, chnged=2, islink=%d " | |
| 358 | + " WHERE id=%d", ridm, islinkm, idv | |
| 353 | 359 | ); |
| 354 | 360 | vfile_to_disk(0, idv, 0, 0); |
| 355 | 361 | } |
| 356 | 362 | } |
| 357 | 363 | db_finalize(&q); |
| 358 | 364 |
| --- src/merge.c | |
| +++ src/merge.c | |
| @@ -253,23 +253,38 @@ | |
| 253 | " ridp=coalesce((SELECT rid FROM vfile WHERE vid=%d AND pathname=fnp),0)," |
| 254 | " idm=coalesce((SELECT id FROM vfile WHERE vid=%d AND pathname=fnm),0)," |
| 255 | " ridm=coalesce((SELECT rid FROM vfile WHERE vid=%d AND pathname=fnm),0)", |
| 256 | pid, pid, mid, mid |
| 257 | ); |
| 258 | |
| 259 | if( debugFlag ){ |
| 260 | db_prepare(&q, |
| 261 | "SELECT rowid, fn, fnp, fnm, chnged, ridv, ridp, ridm, isexe FROM fv" |
| 262 | ); |
| 263 | while( db_step(&q)==SQLITE_ROW ){ |
| 264 | fossil_print("%3d: ridv=%-4d ridp=%-4d ridm=%-4d chnged=%d isexe=%d\n", |
| 265 | db_column_int(&q, 0), |
| 266 | db_column_int(&q, 5), |
| 267 | db_column_int(&q, 6), |
| 268 | db_column_int(&q, 7), |
| 269 | db_column_int(&q, 4), |
| 270 | db_column_int(&q, 8)); |
| 271 | fossil_print(" fn = [%s]\n", db_column_text(&q, 1)); |
| 272 | fossil_print(" fnp = [%s]\n", db_column_text(&q, 2)); |
| 273 | fossil_print(" fnm = [%s]\n", db_column_text(&q, 3)); |
| 274 | } |
| 275 | db_finalize(&q); |
| @@ -303,12 +318,12 @@ | |
| 303 | int idm = db_column_int(&q, 0); |
| 304 | int rowid = db_column_int(&q, 1); |
| 305 | int idv; |
| 306 | const char *zName; |
| 307 | db_multi_exec( |
| 308 | "INSERT INTO vfile(vid,chnged,deleted,rid,mrid,isexe,pathname)" |
| 309 | " SELECT %d,3,0,rid,mrid,isexe,pathname FROM vfile WHERE id=%d", |
| 310 | vid, idm |
| 311 | ); |
| 312 | idv = db_last_insert_rowid(); |
| 313 | db_multi_exec("UPDATE fv SET idv=%d WHERE rowid=%d", idv, rowid); |
| 314 | zName = db_column_text(&q, 2); |
| @@ -317,41 +332,32 @@ | |
| 317 | undo_save(zName); |
| 318 | vfile_to_disk(0, idm, 0, 0); |
| 319 | } |
| 320 | } |
| 321 | db_finalize(&q); |
| 322 | |
| 323 | /* |
| 324 | ** Add islink information for files in V and M |
| 325 | ** |
| 326 | */ |
| 327 | db_multi_exec( |
| 328 | "UPDATE fv SET" |
| 329 | " islinkv=coalesce((SELECT islink FROM vfile WHERE vid=%d AND pathname=fnm),0)," |
| 330 | " islinkm=coalesce((SELECT islink FROM vfile WHERE vid=%d AND pathname=fnm),0)", |
| 331 | vid, mid |
| 332 | ); |
| 333 | |
| 334 | /* |
| 335 | ** Find files that have changed from P->M but not P->V. |
| 336 | ** Copy the M content over into V. |
| 337 | */ |
| 338 | db_prepare(&q, |
| 339 | "SELECT idv, ridm, fn FROM fv" |
| 340 | " WHERE idp>0 AND idv>0 AND idm>0" |
| 341 | " AND ridm!=ridp AND ridv=ridp AND NOT chnged" |
| 342 | ); |
| 343 | while( db_step(&q)==SQLITE_ROW ){ |
| 344 | int idv = db_column_int(&q, 0); |
| 345 | int ridm = db_column_int(&q, 1); |
| 346 | const char *zName = db_column_text(&q, 2); |
| 347 | /* Copy content from idm over into idv. Overwrite idv. */ |
| 348 | fossil_print("UPDATE %s\n", zName); |
| 349 | if( !nochangeFlag ){ |
| 350 | undo_save(zName); |
| 351 | db_multi_exec( |
| 352 | "UPDATE vfile SET mtime=0, mrid=%d, chnged=2 WHERE id=%d", ridm, idv |
| 353 | ); |
| 354 | vfile_to_disk(0, idv, 0, 0); |
| 355 | } |
| 356 | } |
| 357 | db_finalize(&q); |
| 358 |
| --- src/merge.c | |
| +++ src/merge.c | |
| @@ -253,23 +253,38 @@ | |
| 253 | " ridp=coalesce((SELECT rid FROM vfile WHERE vid=%d AND pathname=fnp),0)," |
| 254 | " idm=coalesce((SELECT id FROM vfile WHERE vid=%d AND pathname=fnm),0)," |
| 255 | " ridm=coalesce((SELECT rid FROM vfile WHERE vid=%d AND pathname=fnm),0)", |
| 256 | pid, pid, mid, mid |
| 257 | ); |
| 258 | |
| 259 | /* |
| 260 | ** Add islink information for files in V and M |
| 261 | ** |
| 262 | */ |
| 263 | db_multi_exec( |
| 264 | "UPDATE fv SET" |
| 265 | " islinkv=coalesce((SELECT islink FROM vfile WHERE vid=%d AND pathname=fnm),0)," |
| 266 | " islinkm=coalesce((SELECT islink FROM vfile WHERE vid=%d AND pathname=fnm),0)", |
| 267 | vid, mid |
| 268 | ); |
| 269 | |
| 270 | if( debugFlag ){ |
| 271 | db_prepare(&q, |
| 272 | "SELECT rowid, fn, fnp, fnm, chnged, ridv, ridp, ridm, " |
| 273 | " isexe, islinkv, islinkm FROM fv" |
| 274 | ); |
| 275 | while( db_step(&q)==SQLITE_ROW ){ |
| 276 | fossil_print("%3d: ridv=%-4d ridp=%-4d ridm=%-4d chnged=%d isexe=%d " |
| 277 | " islinkv=%d islinkm=%d", |
| 278 | db_column_int(&q, 0), |
| 279 | db_column_int(&q, 5), |
| 280 | db_column_int(&q, 6), |
| 281 | db_column_int(&q, 7), |
| 282 | db_column_int(&q, 4), |
| 283 | db_column_int(&q, 8), |
| 284 | db_column_int(&q, 9), |
| 285 | db_column_int(&q, 10)); |
| 286 | fossil_print(" fn = [%s]\n", db_column_text(&q, 1)); |
| 287 | fossil_print(" fnp = [%s]\n", db_column_text(&q, 2)); |
| 288 | fossil_print(" fnm = [%s]\n", db_column_text(&q, 3)); |
| 289 | } |
| 290 | db_finalize(&q); |
| @@ -303,12 +318,12 @@ | |
| 318 | int idm = db_column_int(&q, 0); |
| 319 | int rowid = db_column_int(&q, 1); |
| 320 | int idv; |
| 321 | const char *zName; |
| 322 | db_multi_exec( |
| 323 | "INSERT INTO vfile(vid,chnged,deleted,rid,mrid,isexe,islink,pathname)" |
| 324 | " SELECT %d,3,0,rid,mrid,isexe,islink,pathname FROM vfile WHERE id=%d", |
| 325 | vid, idm |
| 326 | ); |
| 327 | idv = db_last_insert_rowid(); |
| 328 | db_multi_exec("UPDATE fv SET idv=%d WHERE rowid=%d", idv, rowid); |
| 329 | zName = db_column_text(&q, 2); |
| @@ -317,41 +332,32 @@ | |
| 332 | undo_save(zName); |
| 333 | vfile_to_disk(0, idm, 0, 0); |
| 334 | } |
| 335 | } |
| 336 | db_finalize(&q); |
| 337 | |
| 338 | /* |
| 339 | ** Find files that have changed from P->M but not P->V. |
| 340 | ** Copy the M content over into V. |
| 341 | */ |
| 342 | db_prepare(&q, |
| 343 | "SELECT idv, ridm, fn, islinkm FROM fv" |
| 344 | " WHERE idp>0 AND idv>0 AND idm>0" |
| 345 | " AND ridm!=ridp AND ridv=ridp AND NOT chnged" |
| 346 | ); |
| 347 | while( db_step(&q)==SQLITE_ROW ){ |
| 348 | int idv = db_column_int(&q, 0); |
| 349 | int ridm = db_column_int(&q, 1); |
| 350 | const char *zName = db_column_text(&q, 2); |
| 351 | int islinkm = db_column_int(&q, 3); |
| 352 | /* Copy content from idm over into idv. Overwrite idv. */ |
| 353 | fossil_print("UPDATE %s\n", zName); |
| 354 | if( !nochangeFlag ){ |
| 355 | undo_save(zName); |
| 356 | db_multi_exec( |
| 357 | "UPDATE vfile SET mtime=0, mrid=%d, chnged=2, islink=%d " |
| 358 | " WHERE id=%d", ridm, islinkm, idv |
| 359 | ); |
| 360 | vfile_to_disk(0, idv, 0, 0); |
| 361 | } |
| 362 | } |
| 363 | db_finalize(&q); |
| 364 |
+4
-4
| --- src/stash.c | ||
| +++ src/stash.c | ||
| @@ -218,11 +218,11 @@ | ||
| 218 | 218 | } |
| 219 | 219 | content_get(rid, &a); |
| 220 | 220 | blob_delta_apply(&a, &delta, &b); |
| 221 | 221 | if( blob_compare(&disk, &a)==0 && isLink == isNewLink ){ |
| 222 | 222 | if( isLink || isNewLink ){ |
| 223 | - unlink(zNPath); | |
| 223 | + file_delete(zNPath); | |
| 224 | 224 | } |
| 225 | 225 | if( isLink ){ |
| 226 | 226 | create_symlink(blob_str(&b), zNPath); |
| 227 | 227 | }else{ |
| 228 | 228 | blob_write_to_file(&b, zNPath); |
| @@ -232,17 +232,17 @@ | ||
| 232 | 232 | }else{ |
| 233 | 233 | int rc; |
| 234 | 234 | if( isLink || isNewLink ){ |
| 235 | 235 | rc = -1; |
| 236 | 236 | blob_zero(&b); /* because we reset it later */ |
| 237 | - //TODO(dchest): write something to disk? | |
| 237 | + fossil_print("***** Cannot merge symlink %s\n", zNew); | |
| 238 | 238 | }else{ |
| 239 | 239 | rc = merge_3way(&a, zOPath, &b, &out); |
| 240 | 240 | blob_write_to_file(&out, zNPath); |
| 241 | - //blob_reset(&out); //XXX(dchest): Need this? | |
| 241 | + blob_reset(&out); | |
| 242 | + file_setexe(zNPath, isExec); | |
| 242 | 243 | } |
| 243 | - file_setexe(zNPath, isExec); | |
| 244 | 244 | if( rc ){ |
| 245 | 245 | fossil_print("CONFLICT %s\n", zNew); |
| 246 | 246 | nConflict++; |
| 247 | 247 | }else{ |
| 248 | 248 | fossil_print("MERGE %s\n", zNew); |
| 249 | 249 |
| --- src/stash.c | |
| +++ src/stash.c | |
| @@ -218,11 +218,11 @@ | |
| 218 | } |
| 219 | content_get(rid, &a); |
| 220 | blob_delta_apply(&a, &delta, &b); |
| 221 | if( blob_compare(&disk, &a)==0 && isLink == isNewLink ){ |
| 222 | if( isLink || isNewLink ){ |
| 223 | unlink(zNPath); |
| 224 | } |
| 225 | if( isLink ){ |
| 226 | create_symlink(blob_str(&b), zNPath); |
| 227 | }else{ |
| 228 | blob_write_to_file(&b, zNPath); |
| @@ -232,17 +232,17 @@ | |
| 232 | }else{ |
| 233 | int rc; |
| 234 | if( isLink || isNewLink ){ |
| 235 | rc = -1; |
| 236 | blob_zero(&b); /* because we reset it later */ |
| 237 | //TODO(dchest): write something to disk? |
| 238 | }else{ |
| 239 | rc = merge_3way(&a, zOPath, &b, &out); |
| 240 | blob_write_to_file(&out, zNPath); |
| 241 | //blob_reset(&out); //XXX(dchest): Need this? |
| 242 | } |
| 243 | file_setexe(zNPath, isExec); |
| 244 | if( rc ){ |
| 245 | fossil_print("CONFLICT %s\n", zNew); |
| 246 | nConflict++; |
| 247 | }else{ |
| 248 | fossil_print("MERGE %s\n", zNew); |
| 249 |
| --- src/stash.c | |
| +++ src/stash.c | |
| @@ -218,11 +218,11 @@ | |
| 218 | } |
| 219 | content_get(rid, &a); |
| 220 | blob_delta_apply(&a, &delta, &b); |
| 221 | if( blob_compare(&disk, &a)==0 && isLink == isNewLink ){ |
| 222 | if( isLink || isNewLink ){ |
| 223 | file_delete(zNPath); |
| 224 | } |
| 225 | if( isLink ){ |
| 226 | create_symlink(blob_str(&b), zNPath); |
| 227 | }else{ |
| 228 | blob_write_to_file(&b, zNPath); |
| @@ -232,17 +232,17 @@ | |
| 232 | }else{ |
| 233 | int rc; |
| 234 | if( isLink || isNewLink ){ |
| 235 | rc = -1; |
| 236 | blob_zero(&b); /* because we reset it later */ |
| 237 | fossil_print("***** Cannot merge symlink %s\n", zNew); |
| 238 | }else{ |
| 239 | rc = merge_3way(&a, zOPath, &b, &out); |
| 240 | blob_write_to_file(&out, zNPath); |
| 241 | blob_reset(&out); |
| 242 | file_setexe(zNPath, isExec); |
| 243 | } |
| 244 | if( rc ){ |
| 245 | fossil_print("CONFLICT %s\n", zNew); |
| 246 | nConflict++; |
| 247 | }else{ |
| 248 | fossil_print("MERGE %s\n", zNew); |
| 249 |
+3
-3
| --- src/undo.c | ||
| +++ src/undo.c | ||
| @@ -71,13 +71,13 @@ | ||
| 71 | 71 | fossil_print("%s %s\n", redoFlag ? "REDO" : "UNDO", zPathname); |
| 72 | 72 | }else{ |
| 73 | 73 | fossil_print("NEW %s\n", zPathname); |
| 74 | 74 | } |
| 75 | 75 | if( new_exists && (new_link || old_link) ){ |
| 76 | - unlink(zFullname); | |
| 76 | + file_delete(zFullname); | |
| 77 | 77 | } |
| 78 | - if( new_link ){ | |
| 78 | + if( old_link ){ | |
| 79 | 79 | create_symlink(blob_str(&new), zFullname); |
| 80 | 80 | }else{ |
| 81 | 81 | blob_write_to_file(&new, zFullname); |
| 82 | 82 | } |
| 83 | 83 | file_setexe(zFullname, old_exe); |
| @@ -276,11 +276,11 @@ | ||
| 276 | 276 | isLink = file_islink(zFullname); |
| 277 | 277 | db_prepare(&q, |
| 278 | 278 | "INSERT OR IGNORE INTO" |
| 279 | 279 | " undo(pathname,redoflag,existsflag,isExe,isLink,content)" |
| 280 | 280 | " VALUES(%Q,0,%d,%d,%d,:c)", |
| 281 | - zPathname, existsFlag, file_isexe(zFullname), file_islink(zFullname) | |
| 281 | + zPathname, existsFlag, file_isexe(zFullname), isLink | |
| 282 | 282 | ); |
| 283 | 283 | if( existsFlag ){ |
| 284 | 284 | if( isLink ){ |
| 285 | 285 | blob_read_link(&content, zFullname); |
| 286 | 286 | }else{ |
| 287 | 287 |
| --- src/undo.c | |
| +++ src/undo.c | |
| @@ -71,13 +71,13 @@ | |
| 71 | fossil_print("%s %s\n", redoFlag ? "REDO" : "UNDO", zPathname); |
| 72 | }else{ |
| 73 | fossil_print("NEW %s\n", zPathname); |
| 74 | } |
| 75 | if( new_exists && (new_link || old_link) ){ |
| 76 | unlink(zFullname); |
| 77 | } |
| 78 | if( new_link ){ |
| 79 | create_symlink(blob_str(&new), zFullname); |
| 80 | }else{ |
| 81 | blob_write_to_file(&new, zFullname); |
| 82 | } |
| 83 | file_setexe(zFullname, old_exe); |
| @@ -276,11 +276,11 @@ | |
| 276 | isLink = file_islink(zFullname); |
| 277 | db_prepare(&q, |
| 278 | "INSERT OR IGNORE INTO" |
| 279 | " undo(pathname,redoflag,existsflag,isExe,isLink,content)" |
| 280 | " VALUES(%Q,0,%d,%d,%d,:c)", |
| 281 | zPathname, existsFlag, file_isexe(zFullname), file_islink(zFullname) |
| 282 | ); |
| 283 | if( existsFlag ){ |
| 284 | if( isLink ){ |
| 285 | blob_read_link(&content, zFullname); |
| 286 | }else{ |
| 287 |
| --- src/undo.c | |
| +++ src/undo.c | |
| @@ -71,13 +71,13 @@ | |
| 71 | fossil_print("%s %s\n", redoFlag ? "REDO" : "UNDO", zPathname); |
| 72 | }else{ |
| 73 | fossil_print("NEW %s\n", zPathname); |
| 74 | } |
| 75 | if( new_exists && (new_link || old_link) ){ |
| 76 | file_delete(zFullname); |
| 77 | } |
| 78 | if( old_link ){ |
| 79 | create_symlink(blob_str(&new), zFullname); |
| 80 | }else{ |
| 81 | blob_write_to_file(&new, zFullname); |
| 82 | } |
| 83 | file_setexe(zFullname, old_exe); |
| @@ -276,11 +276,11 @@ | |
| 276 | isLink = file_islink(zFullname); |
| 277 | db_prepare(&q, |
| 278 | "INSERT OR IGNORE INTO" |
| 279 | " undo(pathname,redoflag,existsflag,isExe,isLink,content)" |
| 280 | " VALUES(%Q,0,%d,%d,%d,:c)", |
| 281 | zPathname, existsFlag, file_isexe(zFullname), isLink |
| 282 | ); |
| 283 | if( existsFlag ){ |
| 284 | if( isLink ){ |
| 285 | blob_read_link(&content, zFullname); |
| 286 | }else{ |
| 287 |
+3
-3
| --- src/undo.c | ||
| +++ src/undo.c | ||
| @@ -71,13 +71,13 @@ | ||
| 71 | 71 | fossil_print("%s %s\n", redoFlag ? "REDO" : "UNDO", zPathname); |
| 72 | 72 | }else{ |
| 73 | 73 | fossil_print("NEW %s\n", zPathname); |
| 74 | 74 | } |
| 75 | 75 | if( new_exists && (new_link || old_link) ){ |
| 76 | - unlink(zFullname); | |
| 76 | + file_delete(zFullname); | |
| 77 | 77 | } |
| 78 | - if( new_link ){ | |
| 78 | + if( old_link ){ | |
| 79 | 79 | create_symlink(blob_str(&new), zFullname); |
| 80 | 80 | }else{ |
| 81 | 81 | blob_write_to_file(&new, zFullname); |
| 82 | 82 | } |
| 83 | 83 | file_setexe(zFullname, old_exe); |
| @@ -276,11 +276,11 @@ | ||
| 276 | 276 | isLink = file_islink(zFullname); |
| 277 | 277 | db_prepare(&q, |
| 278 | 278 | "INSERT OR IGNORE INTO" |
| 279 | 279 | " undo(pathname,redoflag,existsflag,isExe,isLink,content)" |
| 280 | 280 | " VALUES(%Q,0,%d,%d,%d,:c)", |
| 281 | - zPathname, existsFlag, file_isexe(zFullname), file_islink(zFullname) | |
| 281 | + zPathname, existsFlag, file_isexe(zFullname), isLink | |
| 282 | 282 | ); |
| 283 | 283 | if( existsFlag ){ |
| 284 | 284 | if( isLink ){ |
| 285 | 285 | blob_read_link(&content, zFullname); |
| 286 | 286 | }else{ |
| 287 | 287 |
| --- src/undo.c | |
| +++ src/undo.c | |
| @@ -71,13 +71,13 @@ | |
| 71 | fossil_print("%s %s\n", redoFlag ? "REDO" : "UNDO", zPathname); |
| 72 | }else{ |
| 73 | fossil_print("NEW %s\n", zPathname); |
| 74 | } |
| 75 | if( new_exists && (new_link || old_link) ){ |
| 76 | unlink(zFullname); |
| 77 | } |
| 78 | if( new_link ){ |
| 79 | create_symlink(blob_str(&new), zFullname); |
| 80 | }else{ |
| 81 | blob_write_to_file(&new, zFullname); |
| 82 | } |
| 83 | file_setexe(zFullname, old_exe); |
| @@ -276,11 +276,11 @@ | |
| 276 | isLink = file_islink(zFullname); |
| 277 | db_prepare(&q, |
| 278 | "INSERT OR IGNORE INTO" |
| 279 | " undo(pathname,redoflag,existsflag,isExe,isLink,content)" |
| 280 | " VALUES(%Q,0,%d,%d,%d,:c)", |
| 281 | zPathname, existsFlag, file_isexe(zFullname), file_islink(zFullname) |
| 282 | ); |
| 283 | if( existsFlag ){ |
| 284 | if( isLink ){ |
| 285 | blob_read_link(&content, zFullname); |
| 286 | }else{ |
| 287 |
| --- src/undo.c | |
| +++ src/undo.c | |
| @@ -71,13 +71,13 @@ | |
| 71 | fossil_print("%s %s\n", redoFlag ? "REDO" : "UNDO", zPathname); |
| 72 | }else{ |
| 73 | fossil_print("NEW %s\n", zPathname); |
| 74 | } |
| 75 | if( new_exists && (new_link || old_link) ){ |
| 76 | file_delete(zFullname); |
| 77 | } |
| 78 | if( old_link ){ |
| 79 | create_symlink(blob_str(&new), zFullname); |
| 80 | }else{ |
| 81 | blob_write_to_file(&new, zFullname); |
| 82 | } |
| 83 | file_setexe(zFullname, old_exe); |
| @@ -276,11 +276,11 @@ | |
| 276 | isLink = file_islink(zFullname); |
| 277 | db_prepare(&q, |
| 278 | "INSERT OR IGNORE INTO" |
| 279 | " undo(pathname,redoflag,existsflag,isExe,isLink,content)" |
| 280 | " VALUES(%Q,0,%d,%d,%d,:c)", |
| 281 | zPathname, existsFlag, file_isexe(zFullname), isLink |
| 282 | ); |
| 283 | if( existsFlag ){ |
| 284 | if( isLink ){ |
| 285 | blob_read_link(&content, zFullname); |
| 286 | }else{ |
| 287 |
+23
-24
| --- src/update.c | ||
| +++ src/update.c | ||
| @@ -303,11 +303,11 @@ | ||
| 303 | 303 | blob_append(&sql, "DELETE FROM fv WHERE ", -1); |
| 304 | 304 | zSep = ""; |
| 305 | 305 | for(i=3; i<g.argc; i++){ |
| 306 | 306 | file_tree_name(g.argv[i], &treename, 1); |
| 307 | 307 | if( file_isdir(g.argv[i])==1 ){ |
| 308 | - if( blob_size(&treename) != 1 || blob_str(&treename)[0] != '.' ){ | |
| 308 | + if( blob_size(&treename) != 1 || blob_str(&treename)[0] != '.' ){ | |
| 309 | 309 | blob_appendf(&sql, "%sfn NOT GLOB '%b/*' ", zSep, &treename); |
| 310 | 310 | }else{ |
| 311 | 311 | blob_reset(&sql); |
| 312 | 312 | break; |
| 313 | 313 | } |
| @@ -399,35 +399,34 @@ | ||
| 399 | 399 | fossil_print("MERGE %s -> %s\n", zName, zNewName); |
| 400 | 400 | }else{ |
| 401 | 401 | fossil_print("MERGE %s\n", zName); |
| 402 | 402 | } |
| 403 | 403 | if( islinkv || islinkt /* || file_islink(zFullPath) */ ){ |
| 404 | - //if( !nochangeFlag ) blob_write_to_file(&t, zFullNewPath); | |
| 405 | 404 | fossil_print("***** Cannot merge symlink %s\n", zNewName); |
| 406 | 405 | nConflict++; |
| 407 | 406 | }else{ |
| 408 | - undo_save(zName); | |
| 409 | - content_get(ridt, &t); | |
| 410 | - content_get(ridv, &v); | |
| 411 | - rc = merge_3way(&v, zFullPath, &t, &r); | |
| 412 | - if( rc>=0 ){ | |
| 413 | - if( !nochangeFlag ){ | |
| 414 | - blob_write_to_file(&r, zFullNewPath); | |
| 415 | - file_setexe(zFullNewPath, isexe); | |
| 416 | - } | |
| 417 | - if( rc>0 ){ | |
| 418 | - fossil_print("***** %d merge conflicts in %s\n", rc, zNewName); | |
| 419 | - nConflict++; | |
| 420 | - } | |
| 421 | - }else{ | |
| 422 | - if( !nochangeFlag ){ | |
| 423 | - blob_write_to_file(&t, zFullNewPath); | |
| 424 | - file_setexe(zFullNewPath, isexe); | |
| 425 | - } | |
| 426 | - fossil_print("***** Cannot merge binary file %s\n", zNewName); | |
| 427 | - nConflict++; | |
| 428 | - } | |
| 407 | + undo_save(zName); | |
| 408 | + content_get(ridt, &t); | |
| 409 | + content_get(ridv, &v); | |
| 410 | + rc = merge_3way(&v, zFullPath, &t, &r); | |
| 411 | + if( rc>=0 ){ | |
| 412 | + if( !nochangeFlag ){ | |
| 413 | + blob_write_to_file(&r, zFullNewPath); | |
| 414 | + file_setexe(zFullNewPath, isexe); | |
| 415 | + } | |
| 416 | + if( rc>0 ){ | |
| 417 | + fossil_print("***** %d merge conflicts in %s\n", rc, zNewName); | |
| 418 | + nConflict++; | |
| 419 | + } | |
| 420 | + }else{ | |
| 421 | + if( !nochangeFlag ){ | |
| 422 | + blob_write_to_file(&t, zFullNewPath); | |
| 423 | + file_setexe(zFullNewPath, isexe); | |
| 424 | + } | |
| 425 | + fossil_print("***** Cannot merge binary file %s\n", zNewName); | |
| 426 | + nConflict++; | |
| 427 | + } | |
| 429 | 428 | } |
| 430 | 429 | if( nameChng && !nochangeFlag ) file_delete(zFullPath); |
| 431 | 430 | blob_reset(&v); |
| 432 | 431 | blob_reset(&t); |
| 433 | 432 | blob_reset(&r); |
| @@ -670,11 +669,11 @@ | ||
| 670 | 669 | db_multi_exec("DELETE FROM vfile WHERE pathname=%Q", zFile); |
| 671 | 670 | }else{ |
| 672 | 671 | sqlite3_int64 mtime; |
| 673 | 672 | undo_save(zFile); |
| 674 | 673 | if( file_size(zFull)>=0 && (isLink || file_islink(zFull)) ){ |
| 675 | - unlink(zFull); | |
| 674 | + file_delete(zFull); | |
| 676 | 675 | } |
| 677 | 676 | if( isLink ){ |
| 678 | 677 | create_symlink(blob_str(&record), zFull); |
| 679 | 678 | }else{ |
| 680 | 679 | blob_write_to_file(&record, zFull); |
| 681 | 680 |
| --- src/update.c | |
| +++ src/update.c | |
| @@ -303,11 +303,11 @@ | |
| 303 | blob_append(&sql, "DELETE FROM fv WHERE ", -1); |
| 304 | zSep = ""; |
| 305 | for(i=3; i<g.argc; i++){ |
| 306 | file_tree_name(g.argv[i], &treename, 1); |
| 307 | if( file_isdir(g.argv[i])==1 ){ |
| 308 | if( blob_size(&treename) != 1 || blob_str(&treename)[0] != '.' ){ |
| 309 | blob_appendf(&sql, "%sfn NOT GLOB '%b/*' ", zSep, &treename); |
| 310 | }else{ |
| 311 | blob_reset(&sql); |
| 312 | break; |
| 313 | } |
| @@ -399,35 +399,34 @@ | |
| 399 | fossil_print("MERGE %s -> %s\n", zName, zNewName); |
| 400 | }else{ |
| 401 | fossil_print("MERGE %s\n", zName); |
| 402 | } |
| 403 | if( islinkv || islinkt /* || file_islink(zFullPath) */ ){ |
| 404 | //if( !nochangeFlag ) blob_write_to_file(&t, zFullNewPath); |
| 405 | fossil_print("***** Cannot merge symlink %s\n", zNewName); |
| 406 | nConflict++; |
| 407 | }else{ |
| 408 | undo_save(zName); |
| 409 | content_get(ridt, &t); |
| 410 | content_get(ridv, &v); |
| 411 | rc = merge_3way(&v, zFullPath, &t, &r); |
| 412 | if( rc>=0 ){ |
| 413 | if( !nochangeFlag ){ |
| 414 | blob_write_to_file(&r, zFullNewPath); |
| 415 | file_setexe(zFullNewPath, isexe); |
| 416 | } |
| 417 | if( rc>0 ){ |
| 418 | fossil_print("***** %d merge conflicts in %s\n", rc, zNewName); |
| 419 | nConflict++; |
| 420 | } |
| 421 | }else{ |
| 422 | if( !nochangeFlag ){ |
| 423 | blob_write_to_file(&t, zFullNewPath); |
| 424 | file_setexe(zFullNewPath, isexe); |
| 425 | } |
| 426 | fossil_print("***** Cannot merge binary file %s\n", zNewName); |
| 427 | nConflict++; |
| 428 | } |
| 429 | } |
| 430 | if( nameChng && !nochangeFlag ) file_delete(zFullPath); |
| 431 | blob_reset(&v); |
| 432 | blob_reset(&t); |
| 433 | blob_reset(&r); |
| @@ -670,11 +669,11 @@ | |
| 670 | db_multi_exec("DELETE FROM vfile WHERE pathname=%Q", zFile); |
| 671 | }else{ |
| 672 | sqlite3_int64 mtime; |
| 673 | undo_save(zFile); |
| 674 | if( file_size(zFull)>=0 && (isLink || file_islink(zFull)) ){ |
| 675 | unlink(zFull); |
| 676 | } |
| 677 | if( isLink ){ |
| 678 | create_symlink(blob_str(&record), zFull); |
| 679 | }else{ |
| 680 | blob_write_to_file(&record, zFull); |
| 681 |
| --- src/update.c | |
| +++ src/update.c | |
| @@ -303,11 +303,11 @@ | |
| 303 | blob_append(&sql, "DELETE FROM fv WHERE ", -1); |
| 304 | zSep = ""; |
| 305 | for(i=3; i<g.argc; i++){ |
| 306 | file_tree_name(g.argv[i], &treename, 1); |
| 307 | if( file_isdir(g.argv[i])==1 ){ |
| 308 | if( blob_size(&treename) != 1 || blob_str(&treename)[0] != '.' ){ |
| 309 | blob_appendf(&sql, "%sfn NOT GLOB '%b/*' ", zSep, &treename); |
| 310 | }else{ |
| 311 | blob_reset(&sql); |
| 312 | break; |
| 313 | } |
| @@ -399,35 +399,34 @@ | |
| 399 | fossil_print("MERGE %s -> %s\n", zName, zNewName); |
| 400 | }else{ |
| 401 | fossil_print("MERGE %s\n", zName); |
| 402 | } |
| 403 | if( islinkv || islinkt /* || file_islink(zFullPath) */ ){ |
| 404 | fossil_print("***** Cannot merge symlink %s\n", zNewName); |
| 405 | nConflict++; |
| 406 | }else{ |
| 407 | undo_save(zName); |
| 408 | content_get(ridt, &t); |
| 409 | content_get(ridv, &v); |
| 410 | rc = merge_3way(&v, zFullPath, &t, &r); |
| 411 | if( rc>=0 ){ |
| 412 | if( !nochangeFlag ){ |
| 413 | blob_write_to_file(&r, zFullNewPath); |
| 414 | file_setexe(zFullNewPath, isexe); |
| 415 | } |
| 416 | if( rc>0 ){ |
| 417 | fossil_print("***** %d merge conflicts in %s\n", rc, zNewName); |
| 418 | nConflict++; |
| 419 | } |
| 420 | }else{ |
| 421 | if( !nochangeFlag ){ |
| 422 | blob_write_to_file(&t, zFullNewPath); |
| 423 | file_setexe(zFullNewPath, isexe); |
| 424 | } |
| 425 | fossil_print("***** Cannot merge binary file %s\n", zNewName); |
| 426 | nConflict++; |
| 427 | } |
| 428 | } |
| 429 | if( nameChng && !nochangeFlag ) file_delete(zFullPath); |
| 430 | blob_reset(&v); |
| 431 | blob_reset(&t); |
| 432 | blob_reset(&r); |
| @@ -670,11 +669,11 @@ | |
| 669 | db_multi_exec("DELETE FROM vfile WHERE pathname=%Q", zFile); |
| 670 | }else{ |
| 671 | sqlite3_int64 mtime; |
| 672 | undo_save(zFile); |
| 673 | if( file_size(zFull)>=0 && (isLink || file_islink(zFull)) ){ |
| 674 | file_delete(zFull); |
| 675 | } |
| 676 | if( isLink ){ |
| 677 | create_symlink(blob_str(&record), zFull); |
| 678 | }else{ |
| 679 | blob_write_to_file(&record, zFull); |
| 680 |