Fossil SCM

Code reordering and formatting.

stephan 2020-04-28 16:10 checkin-without-checkout
Commit 2af794163c3ba5539aac792710a50beeef67bb76271084709307b07324a58536
1 file changed +25 -26
+25 -26
--- src/checkin.c
+++ src/checkin.c
@@ -3044,23 +3044,21 @@
30443044
** %fossil test-ci-one -R REPO -m ... -r foo --as src/myfile.c myfile.c
30453045
**
30463046
*/
30473047
void test_ci_one_cmd(){
30483048
CheckinOneFileInfo cinf; /* checkin state */
3049
- int parentVid = 0, newRid = 0; /* RID of parent version and new
3050
- version */
3049
+ int newRid = 0; /* RID of new version */
30513050
const char * zFilename; /* argv[2] */
30523051
const char * zComment; /* -m comment */
30533052
const char * zCommentFile; /* -M FILE */
30543053
const char * zAsFilename; /* --as filename */
30553054
const char * zRevision; /* --revision|-r [=trunk|checkout] */
30563055
const char * zUser; /* --user-override */
30573056
const char * zDate; /* --date-override */
30583057
int ckin1Flags = 0; /* flags for checkin_one_file(). */
3059
- if(g.argc<3){
3060
- usage("INFILE");
3061
- }
3058
+
3059
+ CheckinOneFileInfo_init(&cinf);
30623060
zComment = find_option("comment","m",1);
30633061
zCommentFile = find_option("comment-file","M",1);
30643062
zAsFilename = find_option("as",0,1);
30653063
zRevision = find_option("revision","r",1);
30663064
zUser = find_option("user-override",0,1);
@@ -3076,12 +3074,29 @@
30763074
}
30773075
if(find_option("allow-merge-conflict",0,0)!=0){
30783076
ckin1Flags |= CKIN1_ALLOW_MERGE_MARKER;
30793077
}
30803078
3081
- CheckinOneFileInfo_init(&cinf);
3082
-
3079
+ db_find_and_open_repository(0, 0);
3080
+ verify_all_options();
3081
+ user_select();
3082
+
3083
+ if(g.argc!=3){
3084
+ usage("INFILE");
3085
+ }
3086
+
3087
+ if(1){
3088
+ char * zProjCode = db_get("project-code",0);
3089
+ assert(zProjCode);
3090
+ if(0==fossil_stricmp("CE59BB9F186226D80E49D1FA2DB29F935CCA0333",
3091
+ zProjCode)){
3092
+ fossil_fatal("Never, ever run this in/on the core fossil repo "
3093
+ "until it's been well-vetted. Use a temp/test "
3094
+ "repo.");
3095
+ }
3096
+ }
3097
+
30833098
if(zComment && zCommentFile){
30843099
fossil_fatal("Only one of -m or -M, not both, may be used.");
30853100
}else{
30863101
if(zCommentFile && *zCommentFile){
30873102
blob_read_from_file(&cinf.comment, zCommentFile, ExtFILE);
@@ -3090,28 +3105,12 @@
30903105
}
30913106
if(!blob_size(&cinf.comment)){
30923107
fossil_fatal("Non-empty checkin comment is required.");
30933108
}
30943109
}
3095
-
3096
- db_find_and_open_repository(0, 0);
3097
- verify_all_options();
3098
- user_select();
3099
-
3100
- if(1){
3101
- char * zProjCode = db_get("project-code",0);
3102
- assert(zProjCode);
3103
- if(0==fossil_stricmp("CE59BB9F186226D80E49D1FA2DB29F935CCA0333",
3104
- zProjCode)){
3105
- fossil_fatal("Never, ever run this in/on the core fossil repo "
3106
- "until it's been well-vetted. Use a temp/test "
3107
- "repo.");
3108
- }
3109
- }
31103110
31113111
zFilename = g.argv[2];
3112
- blob_append(&cinf.comment, zComment, -1);
31133112
cinf.zFilename = mprintf("%s", zAsFilename ? zAsFilename : zFilename);
31143113
cinf.zUser = mprintf("%s", zUser ? zUser : login_name());
31153114
if(zDate){
31163115
cinf.zDate = mprintf("%s", zDate);
31173116
}
@@ -3124,18 +3123,18 @@
31243123
}
31253124
name_to_uuid2(zRevision, "ci", &cinf.zParentUuid);
31263125
if(cinf.zParentUuid==0){
31273126
fossil_fatal("Cannot determine version to commit to.");
31283127
}
3129
- cinf.pParent = manifest_get_by_name(cinf.zParentUuid, &parentVid);
3130
- assert(parentVid>0);
3128
+ cinf.pParent = manifest_get_by_name(cinf.zParentUuid, 0);
31313129
assert(cinf.pParent!=0);
31323130
blob_read_from_file(&cinf.fileContent, zFilename,
31333131
ExtFILE/*may want to reconsider*/);
31343132
{
31353133
Blob errMsg = empty_blob;
3136
- const int rc = checkin_one_file(&cinf, &newRid, ckin1Flags, &errMsg);
3134
+ const int rc = checkin_one_file(&cinf, &newRid, ckin1Flags,
3135
+ &errMsg);
31373136
CheckinOneFileInfo_cleanup(&cinf);
31383137
if(rc){
31393138
assert(blob_size(&errMsg)==0);
31403139
}else{
31413140
assert(blob_size(&errMsg));
31423141
--- src/checkin.c
+++ src/checkin.c
@@ -3044,23 +3044,21 @@
3044 ** %fossil test-ci-one -R REPO -m ... -r foo --as src/myfile.c myfile.c
3045 **
3046 */
3047 void test_ci_one_cmd(){
3048 CheckinOneFileInfo cinf; /* checkin state */
3049 int parentVid = 0, newRid = 0; /* RID of parent version and new
3050 version */
3051 const char * zFilename; /* argv[2] */
3052 const char * zComment; /* -m comment */
3053 const char * zCommentFile; /* -M FILE */
3054 const char * zAsFilename; /* --as filename */
3055 const char * zRevision; /* --revision|-r [=trunk|checkout] */
3056 const char * zUser; /* --user-override */
3057 const char * zDate; /* --date-override */
3058 int ckin1Flags = 0; /* flags for checkin_one_file(). */
3059 if(g.argc<3){
3060 usage("INFILE");
3061 }
3062 zComment = find_option("comment","m",1);
3063 zCommentFile = find_option("comment-file","M",1);
3064 zAsFilename = find_option("as",0,1);
3065 zRevision = find_option("revision","r",1);
3066 zUser = find_option("user-override",0,1);
@@ -3076,12 +3074,29 @@
3076 }
3077 if(find_option("allow-merge-conflict",0,0)!=0){
3078 ckin1Flags |= CKIN1_ALLOW_MERGE_MARKER;
3079 }
3080
3081 CheckinOneFileInfo_init(&cinf);
3082
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
3083 if(zComment && zCommentFile){
3084 fossil_fatal("Only one of -m or -M, not both, may be used.");
3085 }else{
3086 if(zCommentFile && *zCommentFile){
3087 blob_read_from_file(&cinf.comment, zCommentFile, ExtFILE);
@@ -3090,28 +3105,12 @@
3090 }
3091 if(!blob_size(&cinf.comment)){
3092 fossil_fatal("Non-empty checkin comment is required.");
3093 }
3094 }
3095
3096 db_find_and_open_repository(0, 0);
3097 verify_all_options();
3098 user_select();
3099
3100 if(1){
3101 char * zProjCode = db_get("project-code",0);
3102 assert(zProjCode);
3103 if(0==fossil_stricmp("CE59BB9F186226D80E49D1FA2DB29F935CCA0333",
3104 zProjCode)){
3105 fossil_fatal("Never, ever run this in/on the core fossil repo "
3106 "until it's been well-vetted. Use a temp/test "
3107 "repo.");
3108 }
3109 }
3110
3111 zFilename = g.argv[2];
3112 blob_append(&cinf.comment, zComment, -1);
3113 cinf.zFilename = mprintf("%s", zAsFilename ? zAsFilename : zFilename);
3114 cinf.zUser = mprintf("%s", zUser ? zUser : login_name());
3115 if(zDate){
3116 cinf.zDate = mprintf("%s", zDate);
3117 }
@@ -3124,18 +3123,18 @@
3124 }
3125 name_to_uuid2(zRevision, "ci", &cinf.zParentUuid);
3126 if(cinf.zParentUuid==0){
3127 fossil_fatal("Cannot determine version to commit to.");
3128 }
3129 cinf.pParent = manifest_get_by_name(cinf.zParentUuid, &parentVid);
3130 assert(parentVid>0);
3131 assert(cinf.pParent!=0);
3132 blob_read_from_file(&cinf.fileContent, zFilename,
3133 ExtFILE/*may want to reconsider*/);
3134 {
3135 Blob errMsg = empty_blob;
3136 const int rc = checkin_one_file(&cinf, &newRid, ckin1Flags, &errMsg);
 
3137 CheckinOneFileInfo_cleanup(&cinf);
3138 if(rc){
3139 assert(blob_size(&errMsg)==0);
3140 }else{
3141 assert(blob_size(&errMsg));
3142
--- src/checkin.c
+++ src/checkin.c
@@ -3044,23 +3044,21 @@
3044 ** %fossil test-ci-one -R REPO -m ... -r foo --as src/myfile.c myfile.c
3045 **
3046 */
3047 void test_ci_one_cmd(){
3048 CheckinOneFileInfo cinf; /* checkin state */
3049 int newRid = 0; /* RID of new version */
 
3050 const char * zFilename; /* argv[2] */
3051 const char * zComment; /* -m comment */
3052 const char * zCommentFile; /* -M FILE */
3053 const char * zAsFilename; /* --as filename */
3054 const char * zRevision; /* --revision|-r [=trunk|checkout] */
3055 const char * zUser; /* --user-override */
3056 const char * zDate; /* --date-override */
3057 int ckin1Flags = 0; /* flags for checkin_one_file(). */
3058
3059 CheckinOneFileInfo_init(&cinf);
 
3060 zComment = find_option("comment","m",1);
3061 zCommentFile = find_option("comment-file","M",1);
3062 zAsFilename = find_option("as",0,1);
3063 zRevision = find_option("revision","r",1);
3064 zUser = find_option("user-override",0,1);
@@ -3076,12 +3074,29 @@
3074 }
3075 if(find_option("allow-merge-conflict",0,0)!=0){
3076 ckin1Flags |= CKIN1_ALLOW_MERGE_MARKER;
3077 }
3078
3079 db_find_and_open_repository(0, 0);
3080 verify_all_options();
3081 user_select();
3082
3083 if(g.argc!=3){
3084 usage("INFILE");
3085 }
3086
3087 if(1){
3088 char * zProjCode = db_get("project-code",0);
3089 assert(zProjCode);
3090 if(0==fossil_stricmp("CE59BB9F186226D80E49D1FA2DB29F935CCA0333",
3091 zProjCode)){
3092 fossil_fatal("Never, ever run this in/on the core fossil repo "
3093 "until it's been well-vetted. Use a temp/test "
3094 "repo.");
3095 }
3096 }
3097
3098 if(zComment && zCommentFile){
3099 fossil_fatal("Only one of -m or -M, not both, may be used.");
3100 }else{
3101 if(zCommentFile && *zCommentFile){
3102 blob_read_from_file(&cinf.comment, zCommentFile, ExtFILE);
@@ -3090,28 +3105,12 @@
3105 }
3106 if(!blob_size(&cinf.comment)){
3107 fossil_fatal("Non-empty checkin comment is required.");
3108 }
3109 }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
3110
3111 zFilename = g.argv[2];
 
3112 cinf.zFilename = mprintf("%s", zAsFilename ? zAsFilename : zFilename);
3113 cinf.zUser = mprintf("%s", zUser ? zUser : login_name());
3114 if(zDate){
3115 cinf.zDate = mprintf("%s", zDate);
3116 }
@@ -3124,18 +3123,18 @@
3123 }
3124 name_to_uuid2(zRevision, "ci", &cinf.zParentUuid);
3125 if(cinf.zParentUuid==0){
3126 fossil_fatal("Cannot determine version to commit to.");
3127 }
3128 cinf.pParent = manifest_get_by_name(cinf.zParentUuid, 0);
 
3129 assert(cinf.pParent!=0);
3130 blob_read_from_file(&cinf.fileContent, zFilename,
3131 ExtFILE/*may want to reconsider*/);
3132 {
3133 Blob errMsg = empty_blob;
3134 const int rc = checkin_one_file(&cinf, &newRid, ckin1Flags,
3135 &errMsg);
3136 CheckinOneFileInfo_cleanup(&cinf);
3137 if(rc){
3138 assert(blob_size(&errMsg)==0);
3139 }else{
3140 assert(blob_size(&errMsg));
3141

Keyboard Shortcuts

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