Fossil SCM
Minor edits to unify merge command warning messages, plus tests.
Commit
451f04f6fe631c3db2c8bbe8f25391419d586c46
Parent
13f6887bc3b7bd6…
2 files changed
+2
-2
+55
+2
-2
| --- src/merge.c | ||
| +++ src/merge.c | ||
| @@ -496,11 +496,11 @@ | ||
| 496 | 496 | "SELECT idm FROM fv WHERE idp=0 AND idv>0 AND idm>0" |
| 497 | 497 | ); |
| 498 | 498 | while( db_step(&q)==SQLITE_ROW ){ |
| 499 | 499 | int idm = db_column_int(&q, 0); |
| 500 | 500 | char *zName = db_text(0, "SELECT pathname FROM vfile WHERE id=%d", idm); |
| 501 | - fossil_warning("WARNING - no common ancestor: %s", zName); | |
| 501 | + fossil_warning("WARNING: no common ancestor for %s", zName); | |
| 502 | 502 | free(zName); |
| 503 | 503 | db_multi_exec("UPDATE fv SET idm=0 WHERE idm=%d", idm); |
| 504 | 504 | } |
| 505 | 505 | db_finalize(&q); |
| 506 | 506 | |
| @@ -646,11 +646,11 @@ | ||
| 646 | 646 | const char *zName = db_column_text(&q, 1); |
| 647 | 647 | int chnged = db_column_int(&q, 2); |
| 648 | 648 | /* Delete the file idv */ |
| 649 | 649 | fossil_print("DELETE %s\n", zName); |
| 650 | 650 | if( chnged ){ |
| 651 | - fossil_warning("WARNING: local edits lost for %s\n", zName); | |
| 651 | + fossil_warning("WARNING: local edits lost for %s", zName); | |
| 652 | 652 | nConflict++; |
| 653 | 653 | } |
| 654 | 654 | if( !dryRunFlag ) undo_save(zName); |
| 655 | 655 | db_multi_exec( |
| 656 | 656 | "UPDATE vfile SET deleted=1 WHERE id=%d", idv |
| 657 | 657 | |
| 658 | 658 | ADDED test/merge_warn.test |
| --- src/merge.c | |
| +++ src/merge.c | |
| @@ -496,11 +496,11 @@ | |
| 496 | "SELECT idm FROM fv WHERE idp=0 AND idv>0 AND idm>0" |
| 497 | ); |
| 498 | while( db_step(&q)==SQLITE_ROW ){ |
| 499 | int idm = db_column_int(&q, 0); |
| 500 | char *zName = db_text(0, "SELECT pathname FROM vfile WHERE id=%d", idm); |
| 501 | fossil_warning("WARNING - no common ancestor: %s", zName); |
| 502 | free(zName); |
| 503 | db_multi_exec("UPDATE fv SET idm=0 WHERE idm=%d", idm); |
| 504 | } |
| 505 | db_finalize(&q); |
| 506 | |
| @@ -646,11 +646,11 @@ | |
| 646 | const char *zName = db_column_text(&q, 1); |
| 647 | int chnged = db_column_int(&q, 2); |
| 648 | /* Delete the file idv */ |
| 649 | fossil_print("DELETE %s\n", zName); |
| 650 | if( chnged ){ |
| 651 | fossil_warning("WARNING: local edits lost for %s\n", zName); |
| 652 | nConflict++; |
| 653 | } |
| 654 | if( !dryRunFlag ) undo_save(zName); |
| 655 | db_multi_exec( |
| 656 | "UPDATE vfile SET deleted=1 WHERE id=%d", idv |
| 657 | |
| 658 | DDED test/merge_warn.test |
| --- src/merge.c | |
| +++ src/merge.c | |
| @@ -496,11 +496,11 @@ | |
| 496 | "SELECT idm FROM fv WHERE idp=0 AND idv>0 AND idm>0" |
| 497 | ); |
| 498 | while( db_step(&q)==SQLITE_ROW ){ |
| 499 | int idm = db_column_int(&q, 0); |
| 500 | char *zName = db_text(0, "SELECT pathname FROM vfile WHERE id=%d", idm); |
| 501 | fossil_warning("WARNING: no common ancestor for %s", zName); |
| 502 | free(zName); |
| 503 | db_multi_exec("UPDATE fv SET idm=0 WHERE idm=%d", idm); |
| 504 | } |
| 505 | db_finalize(&q); |
| 506 | |
| @@ -646,11 +646,11 @@ | |
| 646 | const char *zName = db_column_text(&q, 1); |
| 647 | int chnged = db_column_int(&q, 2); |
| 648 | /* Delete the file idv */ |
| 649 | fossil_print("DELETE %s\n", zName); |
| 650 | if( chnged ){ |
| 651 | fossil_warning("WARNING: local edits lost for %s", zName); |
| 652 | nConflict++; |
| 653 | } |
| 654 | if( !dryRunFlag ) undo_save(zName); |
| 655 | db_multi_exec( |
| 656 | "UPDATE vfile SET deleted=1 WHERE id=%d", idv |
| 657 | |
| 658 | DDED test/merge_warn.test |
+55
| --- a/test/merge_warn.test | ||
| +++ b/test/merge_warn.test | ||
| @@ -0,0 +1,55 @@ | ||
| 1 | +# | |
| 2 | +# Copyright (c) 2016 D. Richard Hipp | |
| 3 | +# | |
| 4 | +# This program is free software; you can redistribute it and/or | |
| 5 | +# modify it under the terms of the Simplified BSD License (also | |
| 6 | +# known as the "2-Clause License" or "FreeBSD License".) | |
| 7 | +# | |
| 8 | +# This program is distributed in the hope that it will be useful, | |
| 9 | +# but without any warranty; without even the implied warranty of | |
| 10 | +# merchantability or fitness for a particular purpose. | |
| 11 | +# | |
| 12 | +# Author contact information: | |
| 13 | +# [email protected] | |
| 14 | +# http://www.hwaci.com/drh/ | |
| 15 | +# | |
| 16 | +############################################################################ | |
| 17 | +# | |
| 18 | +# Testing "merge" command warnings | |
| 19 | +# | |
| 20 | + | |
| 21 | +test_setup | |
| 22 | + | |
| 23 | +write_file f1 "f1" | |
| 24 | +fossil add f1 | |
| 25 | +fossil commit -m "add f1" --tag pivot | |
| 26 | + | |
| 27 | +write_file f2 "f2" | |
| 28 | +fossil add f2 | |
| 29 | +fossil commit -m "add f2" | |
| 30 | + | |
| 31 | +fossil update pivot | |
| 32 | +fossil rm --hard f1 | |
| 33 | +write_file f2 "f2.1" | |
| 34 | +write_file f3 "f3" | |
| 35 | +fossil add f2 f3 | |
| 36 | +fossil commit -b b -m "delete f1, add f2 and f3" --tag mrg | |
| 37 | + | |
| 38 | +write_file f4 "f4" | |
| 39 | +fossil add f4 | |
| 40 | +fossil commit -m "add f4" | |
| 41 | + | |
| 42 | +fossil update trunk | |
| 43 | +write_file f1 "f1.1" | |
| 44 | +write_file f3 "f3.1" | |
| 45 | +f-integrate mrg -expectError | |
| 46 | +test_status_list merge_warn-1 $RESULT { | |
| 47 | + WARNING: no common cts | |
| 48 | + DELETE f | |
| 49 | + WARNING: 1 merge conflicts | |
| 50 | + WARNING: 1 unmana} | |
| 51 | +test merge_warn-2 { | |
| 52 | + [string first "ignoring --integrate: mrg is not a leaf" $RESULT]>=0 | |
| 53 | +} | |
| 54 | + | |
| 55 | +######################################## |
| --- a/test/merge_warn.test | |
| +++ b/test/merge_warn.test | |
| @@ -0,0 +1,55 @@ | |
| --- a/test/merge_warn.test | |
| +++ b/test/merge_warn.test | |
| @@ -0,0 +1,55 @@ | |
| 1 | # |
| 2 | # Copyright (c) 2016 D. Richard Hipp |
| 3 | # |
| 4 | # This program is free software; you can redistribute it and/or |
| 5 | # modify it under the terms of the Simplified BSD License (also |
| 6 | # known as the "2-Clause License" or "FreeBSD License".) |
| 7 | # |
| 8 | # This program is distributed in the hope that it will be useful, |
| 9 | # but without any warranty; without even the implied warranty of |
| 10 | # merchantability or fitness for a particular purpose. |
| 11 | # |
| 12 | # Author contact information: |
| 13 | # [email protected] |
| 14 | # http://www.hwaci.com/drh/ |
| 15 | # |
| 16 | ############################################################################ |
| 17 | # |
| 18 | # Testing "merge" command warnings |
| 19 | # |
| 20 | |
| 21 | test_setup |
| 22 | |
| 23 | write_file f1 "f1" |
| 24 | fossil add f1 |
| 25 | fossil commit -m "add f1" --tag pivot |
| 26 | |
| 27 | write_file f2 "f2" |
| 28 | fossil add f2 |
| 29 | fossil commit -m "add f2" |
| 30 | |
| 31 | fossil update pivot |
| 32 | fossil rm --hard f1 |
| 33 | write_file f2 "f2.1" |
| 34 | write_file f3 "f3" |
| 35 | fossil add f2 f3 |
| 36 | fossil commit -b b -m "delete f1, add f2 and f3" --tag mrg |
| 37 | |
| 38 | write_file f4 "f4" |
| 39 | fossil add f4 |
| 40 | fossil commit -m "add f4" |
| 41 | |
| 42 | fossil update trunk |
| 43 | write_file f1 "f1.1" |
| 44 | write_file f3 "f3.1" |
| 45 | f-integrate mrg -expectError |
| 46 | test_status_list merge_warn-1 $RESULT { |
| 47 | WARNING: no common cts |
| 48 | DELETE f |
| 49 | WARNING: 1 merge conflicts |
| 50 | WARNING: 1 unmana} |
| 51 | test merge_warn-2 { |
| 52 | [string first "ignoring --integrate: mrg is not a leaf" $RESULT]>=0 |
| 53 | } |
| 54 | |
| 55 | ######################################## |