Fossil SCM

Addendum to previous commit: Allow the user to decide whether the "fossil knows nothing about" warning should abort the commit or not.

jan.nijtmans 2013-02-08 08:55 trunk
Commit c31bbd40846e3ca8b1cf589bf5ade7f50e9790c5
1 file changed +12 -2
+12 -2
--- src/checkin.c
+++ src/checkin.c
@@ -616,12 +616,15 @@
616616
** of the array.
617617
**
618618
** If there were no arguments passed to [commit], aCommitFile is not
619619
** allocated and remains NULL. Other parts of the code interpret this
620620
** to mean "all files".
621
+**
622
+** Returns 1 if there was a warning, 0 otherwise.
621623
*/
622
-void select_commit_files(void){
624
+int select_commit_files(void){
625
+ int result = 0;
623626
if( g.argc>2 ){
624627
int ii, jj=0;
625628
Blob b;
626629
blob_zero(&b);
627630
g.aCommitFile = fossil_malloc(sizeof(int)*(g.argc-1));
@@ -630,17 +633,19 @@
630633
int iId;
631634
file_tree_name(g.argv[ii], &b, 1);
632635
iId = db_int(-1, "SELECT id FROM vfile WHERE pathname=%Q", blob_str(&b));
633636
if( iId<0 ){
634637
fossil_warning("fossil knows nothing about: %s", g.argv[ii]);
638
+ result = 1;
635639
} else {
636640
g.aCommitFile[jj++] = iId;
637641
}
638642
blob_reset(&b);
639643
}
640644
g.aCommitFile[jj] = 0;
641645
}
646
+ return result;
642647
}
643648
644649
/*
645650
** Make sure the current check-in with timestamp zDate is younger than its
646651
** ancestor identified rid and zUuid. Throw a fatal error if not.
@@ -1200,11 +1205,16 @@
12001205
** After the following function call has returned, the Global.aCommitFile[]
12011206
** array is allocated to contain the "id" field from the vfile table
12021207
** for each file to be committed. Or, if aCommitFile is NULL, all files
12031208
** should be committed.
12041209
*/
1205
- select_commit_files();
1210
+ if ( select_commit_files() ){
1211
+ blob_zero(&ans);
1212
+ prompt_user("continue (y/N)? ", &ans);
1213
+ cReply = blob_str(&ans)[0];
1214
+ if( cReply!='y' && cReply!='Y' ) fossil_exit(1);;
1215
+ }
12061216
isAMerge = db_exists("SELECT 1 FROM vmerge WHERE id=0");
12071217
if( g.aCommitFile && isAMerge ){
12081218
fossil_fatal("cannot do a partial commit of a merge");
12091219
}
12101220
12111221
--- src/checkin.c
+++ src/checkin.c
@@ -616,12 +616,15 @@
616 ** of the array.
617 **
618 ** If there were no arguments passed to [commit], aCommitFile is not
619 ** allocated and remains NULL. Other parts of the code interpret this
620 ** to mean "all files".
 
 
621 */
622 void select_commit_files(void){
 
623 if( g.argc>2 ){
624 int ii, jj=0;
625 Blob b;
626 blob_zero(&b);
627 g.aCommitFile = fossil_malloc(sizeof(int)*(g.argc-1));
@@ -630,17 +633,19 @@
630 int iId;
631 file_tree_name(g.argv[ii], &b, 1);
632 iId = db_int(-1, "SELECT id FROM vfile WHERE pathname=%Q", blob_str(&b));
633 if( iId<0 ){
634 fossil_warning("fossil knows nothing about: %s", g.argv[ii]);
 
635 } else {
636 g.aCommitFile[jj++] = iId;
637 }
638 blob_reset(&b);
639 }
640 g.aCommitFile[jj] = 0;
641 }
 
642 }
643
644 /*
645 ** Make sure the current check-in with timestamp zDate is younger than its
646 ** ancestor identified rid and zUuid. Throw a fatal error if not.
@@ -1200,11 +1205,16 @@
1200 ** After the following function call has returned, the Global.aCommitFile[]
1201 ** array is allocated to contain the "id" field from the vfile table
1202 ** for each file to be committed. Or, if aCommitFile is NULL, all files
1203 ** should be committed.
1204 */
1205 select_commit_files();
 
 
 
 
 
1206 isAMerge = db_exists("SELECT 1 FROM vmerge WHERE id=0");
1207 if( g.aCommitFile && isAMerge ){
1208 fossil_fatal("cannot do a partial commit of a merge");
1209 }
1210
1211
--- src/checkin.c
+++ src/checkin.c
@@ -616,12 +616,15 @@
616 ** of the array.
617 **
618 ** If there were no arguments passed to [commit], aCommitFile is not
619 ** allocated and remains NULL. Other parts of the code interpret this
620 ** to mean "all files".
621 **
622 ** Returns 1 if there was a warning, 0 otherwise.
623 */
624 int select_commit_files(void){
625 int result = 0;
626 if( g.argc>2 ){
627 int ii, jj=0;
628 Blob b;
629 blob_zero(&b);
630 g.aCommitFile = fossil_malloc(sizeof(int)*(g.argc-1));
@@ -630,17 +633,19 @@
633 int iId;
634 file_tree_name(g.argv[ii], &b, 1);
635 iId = db_int(-1, "SELECT id FROM vfile WHERE pathname=%Q", blob_str(&b));
636 if( iId<0 ){
637 fossil_warning("fossil knows nothing about: %s", g.argv[ii]);
638 result = 1;
639 } else {
640 g.aCommitFile[jj++] = iId;
641 }
642 blob_reset(&b);
643 }
644 g.aCommitFile[jj] = 0;
645 }
646 return result;
647 }
648
649 /*
650 ** Make sure the current check-in with timestamp zDate is younger than its
651 ** ancestor identified rid and zUuid. Throw a fatal error if not.
@@ -1200,11 +1205,16 @@
1205 ** After the following function call has returned, the Global.aCommitFile[]
1206 ** array is allocated to contain the "id" field from the vfile table
1207 ** for each file to be committed. Or, if aCommitFile is NULL, all files
1208 ** should be committed.
1209 */
1210 if ( select_commit_files() ){
1211 blob_zero(&ans);
1212 prompt_user("continue (y/N)? ", &ans);
1213 cReply = blob_str(&ans)[0];
1214 if( cReply!='y' && cReply!='Y' ) fossil_exit(1);;
1215 }
1216 isAMerge = db_exists("SELECT 1 FROM vmerge WHERE id=0");
1217 if( g.aCommitFile && isAMerge ){
1218 fossil_fatal("cannot do a partial commit of a merge");
1219 }
1220
1221

Keyboard Shortcuts

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