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.

drh 2010-03-05 23:12 trunk
Commit c9e9fd7572632d00d68d5a39e4c2bcd3ac0e4af5
1 file changed +5 -2
+5 -2
--- src/update.c
+++ src/update.c
@@ -195,21 +195,24 @@
195195
}
196196
197197
db_prepare(&q,
198198
"SELECT fn, idv, ridv, idt, ridt, chnged FROM fv ORDER BY 1"
199199
);
200
+ assert( g.zLocalRoot!=0 );
201
+ assert( strlen(g.zLocalRoot)>1 );
202
+ assert( g.zLocalRoot[strlen(g.zLocalRoot)-1]=='/' );
200203
while( db_step(&q)==SQLITE_ROW ){
201204
const char *zName = db_column_text(&q, 0); /* The filename from root */
202205
int idv = db_column_int(&q, 1); /* VFILE entry for current */
203206
int ridv = db_column_int(&q, 2); /* RecordID for current */
204207
int idt = db_column_int(&q, 3); /* VFILE entry for target */
205208
int ridt = db_column_int(&q, 4); /* RecordID for target */
206209
int chnged = db_column_int(&q, 5); /* Current is edited */
207210
char *zFullPath; /* Full pathname of the file */
208211
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 ){
211214
/* Conflict. This file has been added to the current checkout
212215
** but also exists in the target checkout. Use the current version.
213216
*/
214217
printf("CONFLICT %s\n", zName);
215218
}else if( idt>0 && idv==0 ){
216219
--- 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

Keyboard Shortcuts

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