Fossil SCM

The --force flag change should have been on trunk. DRH should follow his own checklists!

drh 2012-08-29 23:34 trunk merge
Commit 5c420b169076f5f1e9245d600cea2905f4d795f1
1 file changed +7 -2
+7 -2
--- src/merge.c
+++ src/merge.c
@@ -90,19 +90,22 @@
9090
** show what would have happened.
9191
**
9292
** --case-sensitive BOOL Overwrite the case-sensitive setting. If false,
9393
** files whose names differ only in case are taken
9494
** to be the same file.
95
+**
96
+** --force | -f Force the merge even if it would be a no-op.
9597
*/
9698
void merge_cmd(void){
9799
int vid; /* Current version "V" */
98100
int mid; /* Version we are merging from "M" */
99101
int pid; /* The pivot version - most recent common ancestor P */
100102
int detailFlag; /* True if the --detail option is present */
101103
int pickFlag; /* True if the --cherrypick option is present */
102104
int backoutFlag; /* True if the --backout option is present */
103105
int nochangeFlag; /* True if the --nochange or -n option is present */
106
+ int forceFlag; /* True if the --force or -f option is present */
104107
const char *zBinGlob; /* The value of --binary */
105108
const char *zPivot; /* The value of --baseline */
106109
int debugFlag; /* True if --debug is present */
107110
int nChng; /* Number of file name changes */
108111
int *aChng; /* An array of file name changes */
@@ -125,10 +128,11 @@
125128
pickFlag = find_option("cherrypick",0,0)!=0;
126129
backoutFlag = find_option("backout",0,0)!=0;
127130
debugFlag = find_option("debug",0,0)!=0;
128131
zBinGlob = find_option("binary",0,1);
129132
nochangeFlag = find_option("nochange","n",0)!=0;
133
+ forceFlag = find_option("force","f",0)!=0;
130134
zPivot = find_option("baseline",0,1);
131135
capture_case_sensitive_option();
132136
if( g.argc!=3 ){
133137
usage("VERSION");
134138
}
@@ -176,12 +180,13 @@
176180
mid = t;
177181
}
178182
if( !is_a_version(pid) ){
179183
fossil_fatal("not a version: record #%d", pid);
180184
}
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");
183188
return;
184189
}
185190
if( detailFlag ){
186191
print_checkin_description(mid, 12, "merge-from:");
187192
print_checkin_description(pid, 12, "baseline:");
188193
--- 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

Keyboard Shortcuts

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