Fossil SCM

(1) Show cherrypick and backout merges in the status command (2) Allow partial commits of cherrypick and backout merges (3) Prompt user to continue if a check-in comment is unedited (4) Fixing a jump on uninitialized data on web sbs diff - cherrypick of [92b2a5c390467a] (5) Updates against an uncommitted merge are now a warning, not a fatal error.

drh 2012-04-06 17:24 trunk
Commit 195517a9c9a4781b915eb960d16398686a399646
+17 -7
--- src/checkin.c
+++ src/checkin.c
@@ -95,15 +95,20 @@
9595
}
9696
free(zFullName);
9797
}
9898
blob_reset(&rewrittenPathname);
9999
db_finalize(&q);
100
- db_prepare(&q, "SELECT uuid FROM vmerge JOIN blob ON merge=rid"
101
- " WHERE id=0");
100
+ db_prepare(&q, "SELECT uuid, id FROM vmerge JOIN blob ON merge=rid"
101
+ " WHERE id<=0");
102102
while( db_step(&q)==SQLITE_ROW ){
103
+ const char *zLabel = "MERGED_WITH";
104
+ switch( db_column_int(&q, 1) ){
105
+ case -1: zLabel = "CHERRYPICK "; break;
106
+ case -2: zLabel = "BACKOUT "; break;
107
+ }
103108
blob_append(report, zPrefix, nPrefix);
104
- blob_appendf(report, "MERGED_WITH %s\n", db_column_text(&q, 0));
109
+ blob_appendf(report, "%s %s\n", zLabel, db_column_text(&q, 0));
105110
}
106111
db_finalize(&q);
107112
if( nErr ){
108113
fossil_fatal("aborting due to prior errors");
109114
}
@@ -738,12 +743,11 @@
738743
nFBcard++;
739744
}
740745
blob_appendf(pOut, "P %s", zParentUuid);
741746
if( verifyDate ) checkin_verify_younger(vid, zParentUuid, zDate);
742747
free(zParentUuid);
743
- db_prepare(&q2, "SELECT merge FROM vmerge WHERE id=:id");
744
- db_bind_int(&q2, ":id", 0);
748
+ db_prepare(&q2, "SELECT merge FROM vmerge WHERE id=0");
745749
while( db_step(&q2)==SQLITE_ROW ){
746750
char *zMergeUuid;
747751
int mid = db_column_int(&q2, 0);
748752
if( !g.markPrivate && content_is_private(mid) ) continue;
749753
zMergeUuid = db_text(0, "SELECT uuid FROM blob WHERE rid=%d", mid);
@@ -1046,11 +1050,11 @@
10461050
** array is allocated to contain the "id" field from the vfile table
10471051
** for each file to be committed. Or, if aCommitFile is NULL, all files
10481052
** should be committed.
10491053
*/
10501054
select_commit_files();
1051
- isAMerge = db_exists("SELECT 1 FROM vmerge");
1055
+ isAMerge = db_exists("SELECT 1 FROM vmerge WHERE id=0");
10521056
if( g.aCommitFile && isAMerge ){
10531057
fossil_fatal("cannot do a partial commit of a merge");
10541058
}
10551059
10561060
user_select();
@@ -1109,10 +1113,16 @@
11091113
blob_zero(&comment);
11101114
blob_read_from_file(&comment, zComFile);
11111115
}else{
11121116
char *zInit = db_text(0, "SELECT value FROM vvar WHERE name='ci-comment'");
11131117
prepare_commit_comment(&comment, zInit, zBranch, vid, zUserOvrd);
1118
+ if( zInit && zInit[0] && fossil_strcmp(zInit, blob_str(&comment))==0 ){
1119
+ Blob ans;
1120
+ blob_zero(&ans);
1121
+ prompt_user("unchanged check-in comment. continue (y/N)? ", &ans);
1122
+ if( blob_str(&ans)[0]!='y' ) fossil_exit(1);;
1123
+ }
11141124
free(zInit);
11151125
}
11161126
if( blob_size(&comment)==0 ){
11171127
Blob ans;
11181128
blob_zero(&ans);
@@ -1269,11 +1279,11 @@
12691279
12701280
12711281
/* Update the vfile and vmerge tables */
12721282
db_multi_exec(
12731283
"DELETE FROM vfile WHERE (vid!=%d OR deleted) AND file_is_selected(id);"
1274
- "DELETE FROM vmerge WHERE file_is_selected(id) OR id=0;"
1284
+ "DELETE FROM vmerge;"
12751285
"UPDATE vfile SET vid=%d;"
12761286
"UPDATE vfile SET rid=mrid, chnged=0, deleted=0, origname=NULL"
12771287
" WHERE file_is_selected(id);"
12781288
, vid, nvid
12791289
);
12801290
--- src/checkin.c
+++ src/checkin.c
@@ -95,15 +95,20 @@
95 }
96 free(zFullName);
97 }
98 blob_reset(&rewrittenPathname);
99 db_finalize(&q);
100 db_prepare(&q, "SELECT uuid FROM vmerge JOIN blob ON merge=rid"
101 " WHERE id=0");
102 while( db_step(&q)==SQLITE_ROW ){
 
 
 
 
 
103 blob_append(report, zPrefix, nPrefix);
104 blob_appendf(report, "MERGED_WITH %s\n", db_column_text(&q, 0));
105 }
106 db_finalize(&q);
107 if( nErr ){
108 fossil_fatal("aborting due to prior errors");
109 }
@@ -738,12 +743,11 @@
738 nFBcard++;
739 }
740 blob_appendf(pOut, "P %s", zParentUuid);
741 if( verifyDate ) checkin_verify_younger(vid, zParentUuid, zDate);
742 free(zParentUuid);
743 db_prepare(&q2, "SELECT merge FROM vmerge WHERE id=:id");
744 db_bind_int(&q2, ":id", 0);
745 while( db_step(&q2)==SQLITE_ROW ){
746 char *zMergeUuid;
747 int mid = db_column_int(&q2, 0);
748 if( !g.markPrivate && content_is_private(mid) ) continue;
749 zMergeUuid = db_text(0, "SELECT uuid FROM blob WHERE rid=%d", mid);
@@ -1046,11 +1050,11 @@
1046 ** array is allocated to contain the "id" field from the vfile table
1047 ** for each file to be committed. Or, if aCommitFile is NULL, all files
1048 ** should be committed.
1049 */
1050 select_commit_files();
1051 isAMerge = db_exists("SELECT 1 FROM vmerge");
1052 if( g.aCommitFile && isAMerge ){
1053 fossil_fatal("cannot do a partial commit of a merge");
1054 }
1055
1056 user_select();
@@ -1109,10 +1113,16 @@
1109 blob_zero(&comment);
1110 blob_read_from_file(&comment, zComFile);
1111 }else{
1112 char *zInit = db_text(0, "SELECT value FROM vvar WHERE name='ci-comment'");
1113 prepare_commit_comment(&comment, zInit, zBranch, vid, zUserOvrd);
 
 
 
 
 
 
1114 free(zInit);
1115 }
1116 if( blob_size(&comment)==0 ){
1117 Blob ans;
1118 blob_zero(&ans);
@@ -1269,11 +1279,11 @@
1269
1270
1271 /* Update the vfile and vmerge tables */
1272 db_multi_exec(
1273 "DELETE FROM vfile WHERE (vid!=%d OR deleted) AND file_is_selected(id);"
1274 "DELETE FROM vmerge WHERE file_is_selected(id) OR id=0;"
1275 "UPDATE vfile SET vid=%d;"
1276 "UPDATE vfile SET rid=mrid, chnged=0, deleted=0, origname=NULL"
1277 " WHERE file_is_selected(id);"
1278 , vid, nvid
1279 );
1280
--- src/checkin.c
+++ src/checkin.c
@@ -95,15 +95,20 @@
95 }
96 free(zFullName);
97 }
98 blob_reset(&rewrittenPathname);
99 db_finalize(&q);
100 db_prepare(&q, "SELECT uuid, id FROM vmerge JOIN blob ON merge=rid"
101 " WHERE id<=0");
102 while( db_step(&q)==SQLITE_ROW ){
103 const char *zLabel = "MERGED_WITH";
104 switch( db_column_int(&q, 1) ){
105 case -1: zLabel = "CHERRYPICK "; break;
106 case -2: zLabel = "BACKOUT "; break;
107 }
108 blob_append(report, zPrefix, nPrefix);
109 blob_appendf(report, "%s %s\n", zLabel, db_column_text(&q, 0));
110 }
111 db_finalize(&q);
112 if( nErr ){
113 fossil_fatal("aborting due to prior errors");
114 }
@@ -738,12 +743,11 @@
743 nFBcard++;
744 }
745 blob_appendf(pOut, "P %s", zParentUuid);
746 if( verifyDate ) checkin_verify_younger(vid, zParentUuid, zDate);
747 free(zParentUuid);
748 db_prepare(&q2, "SELECT merge FROM vmerge WHERE id=0");
 
749 while( db_step(&q2)==SQLITE_ROW ){
750 char *zMergeUuid;
751 int mid = db_column_int(&q2, 0);
752 if( !g.markPrivate && content_is_private(mid) ) continue;
753 zMergeUuid = db_text(0, "SELECT uuid FROM blob WHERE rid=%d", mid);
@@ -1046,11 +1050,11 @@
1050 ** array is allocated to contain the "id" field from the vfile table
1051 ** for each file to be committed. Or, if aCommitFile is NULL, all files
1052 ** should be committed.
1053 */
1054 select_commit_files();
1055 isAMerge = db_exists("SELECT 1 FROM vmerge WHERE id=0");
1056 if( g.aCommitFile && isAMerge ){
1057 fossil_fatal("cannot do a partial commit of a merge");
1058 }
1059
1060 user_select();
@@ -1109,10 +1113,16 @@
1113 blob_zero(&comment);
1114 blob_read_from_file(&comment, zComFile);
1115 }else{
1116 char *zInit = db_text(0, "SELECT value FROM vvar WHERE name='ci-comment'");
1117 prepare_commit_comment(&comment, zInit, zBranch, vid, zUserOvrd);
1118 if( zInit && zInit[0] && fossil_strcmp(zInit, blob_str(&comment))==0 ){
1119 Blob ans;
1120 blob_zero(&ans);
1121 prompt_user("unchanged check-in comment. continue (y/N)? ", &ans);
1122 if( blob_str(&ans)[0]!='y' ) fossil_exit(1);;
1123 }
1124 free(zInit);
1125 }
1126 if( blob_size(&comment)==0 ){
1127 Blob ans;
1128 blob_zero(&ans);
@@ -1269,11 +1279,11 @@
1279
1280
1281 /* Update the vfile and vmerge tables */
1282 db_multi_exec(
1283 "DELETE FROM vfile WHERE (vid!=%d OR deleted) AND file_is_selected(id);"
1284 "DELETE FROM vmerge;"
1285 "UPDATE vfile SET vid=%d;"
1286 "UPDATE vfile SET rid=mrid, chnged=0, deleted=0, origname=NULL"
1287 " WHERE file_is_selected(id);"
1288 , vid, nvid
1289 );
1290
+1
--- src/diff.c
+++ src/diff.c
@@ -887,10 +887,11 @@
887887
s.zLine = fossil_malloc( 10*width + 200 );
888888
if( s.zLine==0 ) return;
889889
s.width = width;
890890
s.escHtml = escHtml;
891891
s.iStart = -1;
892
+ s.iStart2 = 0;
892893
s.iEnd = -1;
893894
A = p->aFrom;
894895
B = p->aTo;
895896
R = p->aEdit;
896897
mxr = p->nEdit;
897898
--- src/diff.c
+++ src/diff.c
@@ -887,10 +887,11 @@
887 s.zLine = fossil_malloc( 10*width + 200 );
888 if( s.zLine==0 ) return;
889 s.width = width;
890 s.escHtml = escHtml;
891 s.iStart = -1;
 
892 s.iEnd = -1;
893 A = p->aFrom;
894 B = p->aTo;
895 R = p->aEdit;
896 mxr = p->nEdit;
897
--- src/diff.c
+++ src/diff.c
@@ -887,10 +887,11 @@
887 s.zLine = fossil_malloc( 10*width + 200 );
888 if( s.zLine==0 ) return;
889 s.width = width;
890 s.escHtml = escHtml;
891 s.iStart = -1;
892 s.iStart2 = 0;
893 s.iEnd = -1;
894 A = p->aFrom;
895 B = p->aTo;
896 R = p->aEdit;
897 mxr = p->nEdit;
898
+22 -5
--- src/update.c
+++ src/update.c
@@ -120,17 +120,15 @@
120120
db_must_be_within_tree();
121121
vid = db_lget_int("checkout", 0);
122122
if( vid==0 ){
123123
fossil_fatal("cannot find current version");
124124
}
125
- if( !nochangeFlag && db_exists("SELECT 1 FROM vmerge") ){
126
- fossil_fatal("cannot update an uncommitted merge");
127
- }
128125
if( !nochangeFlag && !internalUpdate ) autosync(AUTOSYNC_PULL);
129126
130
- /* Create any empty directories now, as well as after the update, so changes in settings are reflected now */
131
- ensure_empty_dirs_created();
127
+ /* Create any empty directories now, as well as after the update,
128
+ ** so changes in settings are reflected now */
129
+ if( !nochangeFlag ) ensure_empty_dirs_created();
132130
133131
if( internalUpdate ){
134132
tid = internalUpdate;
135133
}else if( g.argc>=3 ){
136134
if( fossil_strcmp(g.argv[2], "current")==0 ){
@@ -469,10 +467,26 @@
469467
show_common_info(tid, "updated-to:", 1, 0);
470468
471469
/* Report on conflicts
472470
*/
473471
if( !nochangeFlag ){
472
+ Stmt q;
473
+ int nMerge = 0;
474
+ db_prepare(&q, "SELECT uuid, id FROM vmerge JOIN blob ON merge=rid"
475
+ " WHERE id<=0");
476
+ while( db_step(&q)==SQLITE_ROW ){
477
+ const char *zLabel = "merge";
478
+ switch( db_column_int(&q, 1) ){
479
+ case -1: zLabel = "cherrypick merge"; break;
480
+ case -2: zLabel = "backout merge"; break;
481
+ }
482
+ fossil_warning("uncommitted %s against %S.",
483
+ zLabel, db_column_text(&q, 0));
484
+ nMerge++;
485
+ }
486
+ db_finalize(&q);
487
+
474488
if( nConflict ){
475489
if( internalUpdate ){
476490
internalConflictCnt = nConflict;
477491
nConflict = 0;
478492
}else{
@@ -481,10 +495,13 @@
481495
}
482496
if( nOverwrite ){
483497
fossil_warning("WARNING: %d unmanaged files were overwritten",
484498
nOverwrite);
485499
}
500
+ if( nMerge ){
501
+ fossil_warning("WARNING: %d uncommitted prior merges", nMerge);
502
+ }
486503
}
487504
488505
/*
489506
** Clean up the mid and pid VFILE entries. Then commit the changes.
490507
*/
491508
--- src/update.c
+++ src/update.c
@@ -120,17 +120,15 @@
120 db_must_be_within_tree();
121 vid = db_lget_int("checkout", 0);
122 if( vid==0 ){
123 fossil_fatal("cannot find current version");
124 }
125 if( !nochangeFlag && db_exists("SELECT 1 FROM vmerge") ){
126 fossil_fatal("cannot update an uncommitted merge");
127 }
128 if( !nochangeFlag && !internalUpdate ) autosync(AUTOSYNC_PULL);
129
130 /* Create any empty directories now, as well as after the update, so changes in settings are reflected now */
131 ensure_empty_dirs_created();
 
132
133 if( internalUpdate ){
134 tid = internalUpdate;
135 }else if( g.argc>=3 ){
136 if( fossil_strcmp(g.argv[2], "current")==0 ){
@@ -469,10 +467,26 @@
469 show_common_info(tid, "updated-to:", 1, 0);
470
471 /* Report on conflicts
472 */
473 if( !nochangeFlag ){
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
474 if( nConflict ){
475 if( internalUpdate ){
476 internalConflictCnt = nConflict;
477 nConflict = 0;
478 }else{
@@ -481,10 +495,13 @@
481 }
482 if( nOverwrite ){
483 fossil_warning("WARNING: %d unmanaged files were overwritten",
484 nOverwrite);
485 }
 
 
 
486 }
487
488 /*
489 ** Clean up the mid and pid VFILE entries. Then commit the changes.
490 */
491
--- src/update.c
+++ src/update.c
@@ -120,17 +120,15 @@
120 db_must_be_within_tree();
121 vid = db_lget_int("checkout", 0);
122 if( vid==0 ){
123 fossil_fatal("cannot find current version");
124 }
 
 
 
125 if( !nochangeFlag && !internalUpdate ) autosync(AUTOSYNC_PULL);
126
127 /* Create any empty directories now, as well as after the update,
128 ** so changes in settings are reflected now */
129 if( !nochangeFlag ) ensure_empty_dirs_created();
130
131 if( internalUpdate ){
132 tid = internalUpdate;
133 }else if( g.argc>=3 ){
134 if( fossil_strcmp(g.argv[2], "current")==0 ){
@@ -469,10 +467,26 @@
467 show_common_info(tid, "updated-to:", 1, 0);
468
469 /* Report on conflicts
470 */
471 if( !nochangeFlag ){
472 Stmt q;
473 int nMerge = 0;
474 db_prepare(&q, "SELECT uuid, id FROM vmerge JOIN blob ON merge=rid"
475 " WHERE id<=0");
476 while( db_step(&q)==SQLITE_ROW ){
477 const char *zLabel = "merge";
478 switch( db_column_int(&q, 1) ){
479 case -1: zLabel = "cherrypick merge"; break;
480 case -2: zLabel = "backout merge"; break;
481 }
482 fossil_warning("uncommitted %s against %S.",
483 zLabel, db_column_text(&q, 0));
484 nMerge++;
485 }
486 db_finalize(&q);
487
488 if( nConflict ){
489 if( internalUpdate ){
490 internalConflictCnt = nConflict;
491 nConflict = 0;
492 }else{
@@ -481,10 +495,13 @@
495 }
496 if( nOverwrite ){
497 fossil_warning("WARNING: %d unmanaged files were overwritten",
498 nOverwrite);
499 }
500 if( nMerge ){
501 fossil_warning("WARNING: %d uncommitted prior merges", nMerge);
502 }
503 }
504
505 /*
506 ** Clean up the mid and pid VFILE entries. Then commit the changes.
507 */
508

Keyboard Shortcuts

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