Fossil SCM
Code reordering and formatting.
Commit
2af794163c3ba5539aac792710a50beeef67bb76271084709307b07324a58536
Parent
1b253c23dee54dc…
1 file changed
+25
-26
+25
-26
| --- src/checkin.c | ||
| +++ src/checkin.c | ||
| @@ -3044,23 +3044,21 @@ | ||
| 3044 | 3044 | ** %fossil test-ci-one -R REPO -m ... -r foo --as src/myfile.c myfile.c |
| 3045 | 3045 | ** |
| 3046 | 3046 | */ |
| 3047 | 3047 | void test_ci_one_cmd(){ |
| 3048 | 3048 | 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 */ | |
| 3051 | 3050 | const char * zFilename; /* argv[2] */ |
| 3052 | 3051 | const char * zComment; /* -m comment */ |
| 3053 | 3052 | const char * zCommentFile; /* -M FILE */ |
| 3054 | 3053 | const char * zAsFilename; /* --as filename */ |
| 3055 | 3054 | const char * zRevision; /* --revision|-r [=trunk|checkout] */ |
| 3056 | 3055 | const char * zUser; /* --user-override */ |
| 3057 | 3056 | const char * zDate; /* --date-override */ |
| 3058 | 3057 | int ckin1Flags = 0; /* flags for checkin_one_file(). */ |
| 3059 | - if(g.argc<3){ | |
| 3060 | - usage("INFILE"); | |
| 3061 | - } | |
| 3058 | + | |
| 3059 | + CheckinOneFileInfo_init(&cinf); | |
| 3062 | 3060 | zComment = find_option("comment","m",1); |
| 3063 | 3061 | zCommentFile = find_option("comment-file","M",1); |
| 3064 | 3062 | zAsFilename = find_option("as",0,1); |
| 3065 | 3063 | zRevision = find_option("revision","r",1); |
| 3066 | 3064 | zUser = find_option("user-override",0,1); |
| @@ -3076,12 +3074,29 @@ | ||
| 3076 | 3074 | } |
| 3077 | 3075 | if(find_option("allow-merge-conflict",0,0)!=0){ |
| 3078 | 3076 | ckin1Flags |= CKIN1_ALLOW_MERGE_MARKER; |
| 3079 | 3077 | } |
| 3080 | 3078 | |
| 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 | + | |
| 3083 | 3098 | if(zComment && zCommentFile){ |
| 3084 | 3099 | fossil_fatal("Only one of -m or -M, not both, may be used."); |
| 3085 | 3100 | }else{ |
| 3086 | 3101 | if(zCommentFile && *zCommentFile){ |
| 3087 | 3102 | blob_read_from_file(&cinf.comment, zCommentFile, ExtFILE); |
| @@ -3090,28 +3105,12 @@ | ||
| 3090 | 3105 | } |
| 3091 | 3106 | if(!blob_size(&cinf.comment)){ |
| 3092 | 3107 | fossil_fatal("Non-empty checkin comment is required."); |
| 3093 | 3108 | } |
| 3094 | 3109 | } |
| 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 | 3110 | |
| 3111 | 3111 | zFilename = g.argv[2]; |
| 3112 | - blob_append(&cinf.comment, zComment, -1); | |
| 3113 | 3112 | cinf.zFilename = mprintf("%s", zAsFilename ? zAsFilename : zFilename); |
| 3114 | 3113 | cinf.zUser = mprintf("%s", zUser ? zUser : login_name()); |
| 3115 | 3114 | if(zDate){ |
| 3116 | 3115 | cinf.zDate = mprintf("%s", zDate); |
| 3117 | 3116 | } |
| @@ -3124,18 +3123,18 @@ | ||
| 3124 | 3123 | } |
| 3125 | 3124 | name_to_uuid2(zRevision, "ci", &cinf.zParentUuid); |
| 3126 | 3125 | if(cinf.zParentUuid==0){ |
| 3127 | 3126 | fossil_fatal("Cannot determine version to commit to."); |
| 3128 | 3127 | } |
| 3129 | - cinf.pParent = manifest_get_by_name(cinf.zParentUuid, &parentVid); | |
| 3130 | - assert(parentVid>0); | |
| 3128 | + cinf.pParent = manifest_get_by_name(cinf.zParentUuid, 0); | |
| 3131 | 3129 | assert(cinf.pParent!=0); |
| 3132 | 3130 | blob_read_from_file(&cinf.fileContent, zFilename, |
| 3133 | 3131 | ExtFILE/*may want to reconsider*/); |
| 3134 | 3132 | { |
| 3135 | 3133 | 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); | |
| 3137 | 3136 | CheckinOneFileInfo_cleanup(&cinf); |
| 3138 | 3137 | if(rc){ |
| 3139 | 3138 | assert(blob_size(&errMsg)==0); |
| 3140 | 3139 | }else{ |
| 3141 | 3140 | assert(blob_size(&errMsg)); |
| 3142 | 3141 |
| --- 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 |