Fossil SCM
On the "update" command, do not report a conflict if a new file has been added that does not exist in the version we are updating to. Also some cleanup to the "update" command implementation.
Commit
c9e9fd7572632d00d68d5a39e4c2bcd3ac0e4af5
Parent
18449fa6e6acafe…
1 file changed
+5
-2
+5
-2
| --- src/update.c | ||
| +++ src/update.c | ||
| @@ -195,21 +195,24 @@ | ||
| 195 | 195 | } |
| 196 | 196 | |
| 197 | 197 | db_prepare(&q, |
| 198 | 198 | "SELECT fn, idv, ridv, idt, ridt, chnged FROM fv ORDER BY 1" |
| 199 | 199 | ); |
| 200 | + assert( g.zLocalRoot!=0 ); | |
| 201 | + assert( strlen(g.zLocalRoot)>1 ); | |
| 202 | + assert( g.zLocalRoot[strlen(g.zLocalRoot)-1]=='/' ); | |
| 200 | 203 | while( db_step(&q)==SQLITE_ROW ){ |
| 201 | 204 | const char *zName = db_column_text(&q, 0); /* The filename from root */ |
| 202 | 205 | int idv = db_column_int(&q, 1); /* VFILE entry for current */ |
| 203 | 206 | int ridv = db_column_int(&q, 2); /* RecordID for current */ |
| 204 | 207 | int idt = db_column_int(&q, 3); /* VFILE entry for target */ |
| 205 | 208 | int ridt = db_column_int(&q, 4); /* RecordID for target */ |
| 206 | 209 | int chnged = db_column_int(&q, 5); /* Current is edited */ |
| 207 | 210 | char *zFullPath; /* Full pathname of the file */ |
| 208 | 211 | |
| 209 | - zFullPath = mprintf("%s/%s", g.zLocalRoot, zName); | |
| 210 | - if( idv>0 && ridv==0 && idt>0 ){ | |
| 212 | + zFullPath = mprintf("%s%s", g.zLocalRoot, zName); | |
| 213 | + if( idv>0 && ridv==0 && idt>0 && ridt>0 ){ | |
| 211 | 214 | /* Conflict. This file has been added to the current checkout |
| 212 | 215 | ** but also exists in the target checkout. Use the current version. |
| 213 | 216 | */ |
| 214 | 217 | printf("CONFLICT %s\n", zName); |
| 215 | 218 | }else if( idt>0 && idv==0 ){ |
| 216 | 219 |
| --- src/update.c | |
| +++ src/update.c | |
| @@ -195,21 +195,24 @@ | |
| 195 | } |
| 196 | |
| 197 | db_prepare(&q, |
| 198 | "SELECT fn, idv, ridv, idt, ridt, chnged FROM fv ORDER BY 1" |
| 199 | ); |
| 200 | while( db_step(&q)==SQLITE_ROW ){ |
| 201 | const char *zName = db_column_text(&q, 0); /* The filename from root */ |
| 202 | int idv = db_column_int(&q, 1); /* VFILE entry for current */ |
| 203 | int ridv = db_column_int(&q, 2); /* RecordID for current */ |
| 204 | int idt = db_column_int(&q, 3); /* VFILE entry for target */ |
| 205 | int ridt = db_column_int(&q, 4); /* RecordID for target */ |
| 206 | int chnged = db_column_int(&q, 5); /* Current is edited */ |
| 207 | char *zFullPath; /* Full pathname of the file */ |
| 208 | |
| 209 | zFullPath = mprintf("%s/%s", g.zLocalRoot, zName); |
| 210 | if( idv>0 && ridv==0 && idt>0 ){ |
| 211 | /* Conflict. This file has been added to the current checkout |
| 212 | ** but also exists in the target checkout. Use the current version. |
| 213 | */ |
| 214 | printf("CONFLICT %s\n", zName); |
| 215 | }else if( idt>0 && idv==0 ){ |
| 216 |
| --- src/update.c | |
| +++ src/update.c | |
| @@ -195,21 +195,24 @@ | |
| 195 | } |
| 196 | |
| 197 | db_prepare(&q, |
| 198 | "SELECT fn, idv, ridv, idt, ridt, chnged FROM fv ORDER BY 1" |
| 199 | ); |
| 200 | assert( g.zLocalRoot!=0 ); |
| 201 | assert( strlen(g.zLocalRoot)>1 ); |
| 202 | assert( g.zLocalRoot[strlen(g.zLocalRoot)-1]=='/' ); |
| 203 | while( db_step(&q)==SQLITE_ROW ){ |
| 204 | const char *zName = db_column_text(&q, 0); /* The filename from root */ |
| 205 | int idv = db_column_int(&q, 1); /* VFILE entry for current */ |
| 206 | int ridv = db_column_int(&q, 2); /* RecordID for current */ |
| 207 | int idt = db_column_int(&q, 3); /* VFILE entry for target */ |
| 208 | int ridt = db_column_int(&q, 4); /* RecordID for target */ |
| 209 | int chnged = db_column_int(&q, 5); /* Current is edited */ |
| 210 | char *zFullPath; /* Full pathname of the file */ |
| 211 | |
| 212 | zFullPath = mprintf("%s%s", g.zLocalRoot, zName); |
| 213 | if( idv>0 && ridv==0 && idt>0 && ridt>0 ){ |
| 214 | /* Conflict. This file has been added to the current checkout |
| 215 | ** but also exists in the target checkout. Use the current version. |
| 216 | */ |
| 217 | printf("CONFLICT %s\n", zName); |
| 218 | }else if( idt>0 && idv==0 ){ |
| 219 |