Fossil SCM
The --force flag change should have been on trunk. DRH should follow his own checklists!
Commit
5c420b169076f5f1e9245d600cea2905f4d795f1
Parent
5f22bc09e1334fd…
1 file changed
+7
-2
+7
-2
| --- src/merge.c | ||
| +++ src/merge.c | ||
| @@ -90,19 +90,22 @@ | ||
| 90 | 90 | ** show what would have happened. |
| 91 | 91 | ** |
| 92 | 92 | ** --case-sensitive BOOL Overwrite the case-sensitive setting. If false, |
| 93 | 93 | ** files whose names differ only in case are taken |
| 94 | 94 | ** to be the same file. |
| 95 | +** | |
| 96 | +** --force | -f Force the merge even if it would be a no-op. | |
| 95 | 97 | */ |
| 96 | 98 | void merge_cmd(void){ |
| 97 | 99 | int vid; /* Current version "V" */ |
| 98 | 100 | int mid; /* Version we are merging from "M" */ |
| 99 | 101 | int pid; /* The pivot version - most recent common ancestor P */ |
| 100 | 102 | int detailFlag; /* True if the --detail option is present */ |
| 101 | 103 | int pickFlag; /* True if the --cherrypick option is present */ |
| 102 | 104 | int backoutFlag; /* True if the --backout option is present */ |
| 103 | 105 | int nochangeFlag; /* True if the --nochange or -n option is present */ |
| 106 | + int forceFlag; /* True if the --force or -f option is present */ | |
| 104 | 107 | const char *zBinGlob; /* The value of --binary */ |
| 105 | 108 | const char *zPivot; /* The value of --baseline */ |
| 106 | 109 | int debugFlag; /* True if --debug is present */ |
| 107 | 110 | int nChng; /* Number of file name changes */ |
| 108 | 111 | int *aChng; /* An array of file name changes */ |
| @@ -125,10 +128,11 @@ | ||
| 125 | 128 | pickFlag = find_option("cherrypick",0,0)!=0; |
| 126 | 129 | backoutFlag = find_option("backout",0,0)!=0; |
| 127 | 130 | debugFlag = find_option("debug",0,0)!=0; |
| 128 | 131 | zBinGlob = find_option("binary",0,1); |
| 129 | 132 | nochangeFlag = find_option("nochange","n",0)!=0; |
| 133 | + forceFlag = find_option("force","f",0)!=0; | |
| 130 | 134 | zPivot = find_option("baseline",0,1); |
| 131 | 135 | capture_case_sensitive_option(); |
| 132 | 136 | if( g.argc!=3 ){ |
| 133 | 137 | usage("VERSION"); |
| 134 | 138 | } |
| @@ -176,12 +180,13 @@ | ||
| 176 | 180 | mid = t; |
| 177 | 181 | } |
| 178 | 182 | if( !is_a_version(pid) ){ |
| 179 | 183 | fossil_fatal("not a version: record #%d", pid); |
| 180 | 184 | } |
| 181 | - if( mid==pid ){ | |
| 182 | - fossil_print("This merge is a no-op.\n"); | |
| 185 | + if( !forceFlag && (mid==pid || vid==pid || mid==vid) ){ | |
| 186 | + fossil_print("Merge skipped because it is a no-op. " | |
| 187 | + " Use --force to override.\n"); | |
| 183 | 188 | return; |
| 184 | 189 | } |
| 185 | 190 | if( detailFlag ){ |
| 186 | 191 | print_checkin_description(mid, 12, "merge-from:"); |
| 187 | 192 | print_checkin_description(pid, 12, "baseline:"); |
| 188 | 193 |
| --- src/merge.c | |
| +++ src/merge.c | |
| @@ -90,19 +90,22 @@ | |
| 90 | ** show what would have happened. |
| 91 | ** |
| 92 | ** --case-sensitive BOOL Overwrite the case-sensitive setting. If false, |
| 93 | ** files whose names differ only in case are taken |
| 94 | ** to be the same file. |
| 95 | */ |
| 96 | void merge_cmd(void){ |
| 97 | int vid; /* Current version "V" */ |
| 98 | int mid; /* Version we are merging from "M" */ |
| 99 | int pid; /* The pivot version - most recent common ancestor P */ |
| 100 | int detailFlag; /* True if the --detail option is present */ |
| 101 | int pickFlag; /* True if the --cherrypick option is present */ |
| 102 | int backoutFlag; /* True if the --backout option is present */ |
| 103 | int nochangeFlag; /* True if the --nochange or -n option is present */ |
| 104 | const char *zBinGlob; /* The value of --binary */ |
| 105 | const char *zPivot; /* The value of --baseline */ |
| 106 | int debugFlag; /* True if --debug is present */ |
| 107 | int nChng; /* Number of file name changes */ |
| 108 | int *aChng; /* An array of file name changes */ |
| @@ -125,10 +128,11 @@ | |
| 125 | pickFlag = find_option("cherrypick",0,0)!=0; |
| 126 | backoutFlag = find_option("backout",0,0)!=0; |
| 127 | debugFlag = find_option("debug",0,0)!=0; |
| 128 | zBinGlob = find_option("binary",0,1); |
| 129 | nochangeFlag = find_option("nochange","n",0)!=0; |
| 130 | zPivot = find_option("baseline",0,1); |
| 131 | capture_case_sensitive_option(); |
| 132 | if( g.argc!=3 ){ |
| 133 | usage("VERSION"); |
| 134 | } |
| @@ -176,12 +180,13 @@ | |
| 176 | mid = t; |
| 177 | } |
| 178 | if( !is_a_version(pid) ){ |
| 179 | fossil_fatal("not a version: record #%d", pid); |
| 180 | } |
| 181 | if( mid==pid ){ |
| 182 | fossil_print("This merge is a no-op.\n"); |
| 183 | return; |
| 184 | } |
| 185 | if( detailFlag ){ |
| 186 | print_checkin_description(mid, 12, "merge-from:"); |
| 187 | print_checkin_description(pid, 12, "baseline:"); |
| 188 |
| --- src/merge.c | |
| +++ src/merge.c | |
| @@ -90,19 +90,22 @@ | |
| 90 | ** show what would have happened. |
| 91 | ** |
| 92 | ** --case-sensitive BOOL Overwrite the case-sensitive setting. If false, |
| 93 | ** files whose names differ only in case are taken |
| 94 | ** to be the same file. |
| 95 | ** |
| 96 | ** --force | -f Force the merge even if it would be a no-op. |
| 97 | */ |
| 98 | void merge_cmd(void){ |
| 99 | int vid; /* Current version "V" */ |
| 100 | int mid; /* Version we are merging from "M" */ |
| 101 | int pid; /* The pivot version - most recent common ancestor P */ |
| 102 | int detailFlag; /* True if the --detail option is present */ |
| 103 | int pickFlag; /* True if the --cherrypick option is present */ |
| 104 | int backoutFlag; /* True if the --backout option is present */ |
| 105 | int nochangeFlag; /* True if the --nochange or -n option is present */ |
| 106 | int forceFlag; /* True if the --force or -f option is present */ |
| 107 | const char *zBinGlob; /* The value of --binary */ |
| 108 | const char *zPivot; /* The value of --baseline */ |
| 109 | int debugFlag; /* True if --debug is present */ |
| 110 | int nChng; /* Number of file name changes */ |
| 111 | int *aChng; /* An array of file name changes */ |
| @@ -125,10 +128,11 @@ | |
| 128 | pickFlag = find_option("cherrypick",0,0)!=0; |
| 129 | backoutFlag = find_option("backout",0,0)!=0; |
| 130 | debugFlag = find_option("debug",0,0)!=0; |
| 131 | zBinGlob = find_option("binary",0,1); |
| 132 | nochangeFlag = find_option("nochange","n",0)!=0; |
| 133 | forceFlag = find_option("force","f",0)!=0; |
| 134 | zPivot = find_option("baseline",0,1); |
| 135 | capture_case_sensitive_option(); |
| 136 | if( g.argc!=3 ){ |
| 137 | usage("VERSION"); |
| 138 | } |
| @@ -176,12 +180,13 @@ | |
| 180 | mid = t; |
| 181 | } |
| 182 | if( !is_a_version(pid) ){ |
| 183 | fossil_fatal("not a version: record #%d", pid); |
| 184 | } |
| 185 | if( !forceFlag && (mid==pid || vid==pid || mid==vid) ){ |
| 186 | fossil_print("Merge skipped because it is a no-op. " |
| 187 | " Use --force to override.\n"); |
| 188 | return; |
| 189 | } |
| 190 | if( detailFlag ){ |
| 191 | print_checkin_description(mid, 12, "merge-from:"); |
| 192 | print_checkin_description(pid, 12, "baseline:"); |
| 193 |