Fossil SCM
Omit the "private" tag from private check-ins. This opens up the possibility of publishing check-ins that were originally private. Fix the "deconstruct" command so that it omits private artifacts unless the --private option is used.
Commit
6545e6cf7409fdbf66eb9e233536cea979df7b90
Parent
3206b6485a67d02…
2 files changed
-4
+21
-14
-4
| --- src/checkin.c | ||
| +++ src/checkin.c | ||
| @@ -834,14 +834,10 @@ | ||
| 834 | 834 | } |
| 835 | 835 | if( zColor && zColor[0] ){ |
| 836 | 836 | /* One-time background color */ |
| 837 | 837 | blob_appendf(pOut, "T +bgcolor * %F\n", zColor); |
| 838 | 838 | } |
| 839 | - if( g.markPrivate ){ | |
| 840 | - /* If this manifest is private, mark it as such */ | |
| 841 | - blob_appendf(pOut, "T +private *\n"); | |
| 842 | - } | |
| 843 | 839 | if( azTag ){ |
| 844 | 840 | for(i=0; azTag[i]; i++){ |
| 845 | 841 | /* Add a symbolic tag to this check-in. The tag names have already |
| 846 | 842 | ** been sorted and converted using the %F format */ |
| 847 | 843 | blob_appendf(pOut, "T +sym-%s *\n", azTag[i]); |
| 848 | 844 |
| --- src/checkin.c | |
| +++ src/checkin.c | |
| @@ -834,14 +834,10 @@ | |
| 834 | } |
| 835 | if( zColor && zColor[0] ){ |
| 836 | /* One-time background color */ |
| 837 | blob_appendf(pOut, "T +bgcolor * %F\n", zColor); |
| 838 | } |
| 839 | if( g.markPrivate ){ |
| 840 | /* If this manifest is private, mark it as such */ |
| 841 | blob_appendf(pOut, "T +private *\n"); |
| 842 | } |
| 843 | if( azTag ){ |
| 844 | for(i=0; azTag[i]; i++){ |
| 845 | /* Add a symbolic tag to this check-in. The tag names have already |
| 846 | ** been sorted and converted using the %F format */ |
| 847 | blob_appendf(pOut, "T +sym-%s *\n", azTag[i]); |
| 848 |
| --- src/checkin.c | |
| +++ src/checkin.c | |
| @@ -834,14 +834,10 @@ | |
| 834 | } |
| 835 | if( zColor && zColor[0] ){ |
| 836 | /* One-time background color */ |
| 837 | blob_appendf(pOut, "T +bgcolor * %F\n", zColor); |
| 838 | } |
| 839 | if( azTag ){ |
| 840 | for(i=0; azTag[i]; i++){ |
| 841 | /* Add a symbolic tag to this check-in. The tag names have already |
| 842 | ** been sorted and converted using the %F format */ |
| 843 | blob_appendf(pOut, "T +sym-%s *\n", azTag[i]); |
| 844 |
+21
-14
| --- src/rebuild.c | ||
| +++ src/rebuild.c | ||
| @@ -925,27 +925,20 @@ | ||
| 925 | 925 | ** |
| 926 | 926 | ** Options: |
| 927 | 927 | ** -R|--repository REPOSITORY deconstruct given REPOSITORY |
| 928 | 928 | ** -L|--prefixlength N set the length of the names of the DESTINATION |
| 929 | 929 | ** subdirectories to N |
| 930 | +** --private Include private artifacts. | |
| 930 | 931 | ** |
| 931 | 932 | ** See also: rebuild, reconstruct |
| 932 | 933 | */ |
| 933 | 934 | void deconstruct_cmd(void){ |
| 934 | 935 | const char *zDestDir; |
| 935 | 936 | const char *zPrefixOpt; |
| 936 | 937 | Stmt s; |
| 937 | - | |
| 938 | - /* check number of arguments */ | |
| 939 | - if( (g.argc != 3) && (g.argc != 5) && (g.argc != 7)){ | |
| 940 | - usage ("?-R|--repository REPOSITORY? ?-L|--prefixlength N? DESTINATION"); | |
| 941 | - } | |
| 942 | - /* get and check argument destination directory */ | |
| 943 | - zDestDir = g.argv[g.argc-1]; | |
| 944 | - if( !*zDestDir || !file_isdir(zDestDir)) { | |
| 945 | - fossil_panic("DESTINATION(%s) is not a directory!",zDestDir); | |
| 946 | - } | |
| 938 | + int privateFlag; | |
| 939 | + | |
| 947 | 940 | /* get and check prefix length argument and build format string */ |
| 948 | 941 | zPrefixOpt=find_option("prefixlength","L",1); |
| 949 | 942 | if( !zPrefixOpt ){ |
| 950 | 943 | prefixLength = 2; |
| 951 | 944 | }else{ |
| @@ -953,10 +946,23 @@ | ||
| 953 | 946 | prefixLength = (int)(*zPrefixOpt-'0'); |
| 954 | 947 | }else{ |
| 955 | 948 | fossil_fatal("N(%s) is not a a valid prefix length!",zPrefixOpt); |
| 956 | 949 | } |
| 957 | 950 | } |
| 951 | + /* open repository and open query for all artifacts */ | |
| 952 | + db_find_and_open_repository(OPEN_ANY_SCHEMA, 0); | |
| 953 | + privateFlag = find_option("private",0,0)!=0; | |
| 954 | + verify_all_options(); | |
| 955 | + /* check number of arguments */ | |
| 956 | + if( g.argc!=3 ){ | |
| 957 | + usage ("?OPTIONS? DESTINATION"); | |
| 958 | + } | |
| 959 | + /* get and check argument destination directory */ | |
| 960 | + zDestDir = g.argv[g.argc-1]; | |
| 961 | + if( !*zDestDir || !file_isdir(zDestDir)) { | |
| 962 | + fossil_fatal("DESTINATION(%s) is not a directory!",zDestDir); | |
| 963 | + } | |
| 958 | 964 | #ifndef _WIN32 |
| 959 | 965 | if( file_access(zDestDir, W_OK) ){ |
| 960 | 966 | fossil_fatal("DESTINATION(%s) is not writeable!",zDestDir); |
| 961 | 967 | } |
| 962 | 968 | #else |
| @@ -967,12 +973,11 @@ | ||
| 967 | 973 | if( prefixLength ){ |
| 968 | 974 | zFNameFormat = mprintf("%s/%%.%ds/%%s",zDestDir,prefixLength); |
| 969 | 975 | }else{ |
| 970 | 976 | zFNameFormat = mprintf("%s/%%s",zDestDir); |
| 971 | 977 | } |
| 972 | - /* open repository and open query for all artifacts */ | |
| 973 | - db_find_and_open_repository(OPEN_ANY_SCHEMA, 0); | |
| 978 | + | |
| 974 | 979 | bag_init(&bagDone); |
| 975 | 980 | ttyOutput = 1; |
| 976 | 981 | processCnt = 0; |
| 977 | 982 | if (!g.fQuiet) { |
| 978 | 983 | fossil_print("0 (0%%)...\r"); |
| @@ -980,11 +985,12 @@ | ||
| 980 | 985 | } |
| 981 | 986 | totalSize = db_int(0, "SELECT count(*) FROM blob"); |
| 982 | 987 | db_prepare(&s, |
| 983 | 988 | "SELECT rid, size FROM blob /*scan*/" |
| 984 | 989 | " WHERE NOT EXISTS(SELECT 1 FROM shun WHERE uuid=blob.uuid)" |
| 985 | - " AND NOT EXISTS(SELECT 1 FROM delta WHERE rid=blob.rid)" | |
| 990 | + " AND NOT EXISTS(SELECT 1 FROM delta WHERE rid=blob.rid) %s", | |
| 991 | + privateFlag==0 ? "AND rid NOT IN private" : "" | |
| 986 | 992 | ); |
| 987 | 993 | while( db_step(&s)==SQLITE_ROW ){ |
| 988 | 994 | int rid = db_column_int(&s, 0); |
| 989 | 995 | int size = db_column_int(&s, 1); |
| 990 | 996 | if( size>=0 ){ |
| @@ -994,11 +1000,12 @@ | ||
| 994 | 1000 | } |
| 995 | 1001 | } |
| 996 | 1002 | db_finalize(&s); |
| 997 | 1003 | db_prepare(&s, |
| 998 | 1004 | "SELECT rid, size FROM blob" |
| 999 | - " WHERE NOT EXISTS(SELECT 1 FROM shun WHERE uuid=blob.uuid)" | |
| 1005 | + " WHERE NOT EXISTS(SELECT 1 FROM shun WHERE uuid=blob.uuid) %s", | |
| 1006 | + privateFlag==0 ? "AND rid NOT IN private" : "" | |
| 1000 | 1007 | ); |
| 1001 | 1008 | while( db_step(&s)==SQLITE_ROW ){ |
| 1002 | 1009 | int rid = db_column_int(&s, 0); |
| 1003 | 1010 | int size = db_column_int(&s, 1); |
| 1004 | 1011 | if( size>=0 ){ |
| 1005 | 1012 |
| --- src/rebuild.c | |
| +++ src/rebuild.c | |
| @@ -925,27 +925,20 @@ | |
| 925 | ** |
| 926 | ** Options: |
| 927 | ** -R|--repository REPOSITORY deconstruct given REPOSITORY |
| 928 | ** -L|--prefixlength N set the length of the names of the DESTINATION |
| 929 | ** subdirectories to N |
| 930 | ** |
| 931 | ** See also: rebuild, reconstruct |
| 932 | */ |
| 933 | void deconstruct_cmd(void){ |
| 934 | const char *zDestDir; |
| 935 | const char *zPrefixOpt; |
| 936 | Stmt s; |
| 937 | |
| 938 | /* check number of arguments */ |
| 939 | if( (g.argc != 3) && (g.argc != 5) && (g.argc != 7)){ |
| 940 | usage ("?-R|--repository REPOSITORY? ?-L|--prefixlength N? DESTINATION"); |
| 941 | } |
| 942 | /* get and check argument destination directory */ |
| 943 | zDestDir = g.argv[g.argc-1]; |
| 944 | if( !*zDestDir || !file_isdir(zDestDir)) { |
| 945 | fossil_panic("DESTINATION(%s) is not a directory!",zDestDir); |
| 946 | } |
| 947 | /* get and check prefix length argument and build format string */ |
| 948 | zPrefixOpt=find_option("prefixlength","L",1); |
| 949 | if( !zPrefixOpt ){ |
| 950 | prefixLength = 2; |
| 951 | }else{ |
| @@ -953,10 +946,23 @@ | |
| 953 | prefixLength = (int)(*zPrefixOpt-'0'); |
| 954 | }else{ |
| 955 | fossil_fatal("N(%s) is not a a valid prefix length!",zPrefixOpt); |
| 956 | } |
| 957 | } |
| 958 | #ifndef _WIN32 |
| 959 | if( file_access(zDestDir, W_OK) ){ |
| 960 | fossil_fatal("DESTINATION(%s) is not writeable!",zDestDir); |
| 961 | } |
| 962 | #else |
| @@ -967,12 +973,11 @@ | |
| 967 | if( prefixLength ){ |
| 968 | zFNameFormat = mprintf("%s/%%.%ds/%%s",zDestDir,prefixLength); |
| 969 | }else{ |
| 970 | zFNameFormat = mprintf("%s/%%s",zDestDir); |
| 971 | } |
| 972 | /* open repository and open query for all artifacts */ |
| 973 | db_find_and_open_repository(OPEN_ANY_SCHEMA, 0); |
| 974 | bag_init(&bagDone); |
| 975 | ttyOutput = 1; |
| 976 | processCnt = 0; |
| 977 | if (!g.fQuiet) { |
| 978 | fossil_print("0 (0%%)...\r"); |
| @@ -980,11 +985,12 @@ | |
| 980 | } |
| 981 | totalSize = db_int(0, "SELECT count(*) FROM blob"); |
| 982 | db_prepare(&s, |
| 983 | "SELECT rid, size FROM blob /*scan*/" |
| 984 | " WHERE NOT EXISTS(SELECT 1 FROM shun WHERE uuid=blob.uuid)" |
| 985 | " AND NOT EXISTS(SELECT 1 FROM delta WHERE rid=blob.rid)" |
| 986 | ); |
| 987 | while( db_step(&s)==SQLITE_ROW ){ |
| 988 | int rid = db_column_int(&s, 0); |
| 989 | int size = db_column_int(&s, 1); |
| 990 | if( size>=0 ){ |
| @@ -994,11 +1000,12 @@ | |
| 994 | } |
| 995 | } |
| 996 | db_finalize(&s); |
| 997 | db_prepare(&s, |
| 998 | "SELECT rid, size FROM blob" |
| 999 | " WHERE NOT EXISTS(SELECT 1 FROM shun WHERE uuid=blob.uuid)" |
| 1000 | ); |
| 1001 | while( db_step(&s)==SQLITE_ROW ){ |
| 1002 | int rid = db_column_int(&s, 0); |
| 1003 | int size = db_column_int(&s, 1); |
| 1004 | if( size>=0 ){ |
| 1005 |
| --- src/rebuild.c | |
| +++ src/rebuild.c | |
| @@ -925,27 +925,20 @@ | |
| 925 | ** |
| 926 | ** Options: |
| 927 | ** -R|--repository REPOSITORY deconstruct given REPOSITORY |
| 928 | ** -L|--prefixlength N set the length of the names of the DESTINATION |
| 929 | ** subdirectories to N |
| 930 | ** --private Include private artifacts. |
| 931 | ** |
| 932 | ** See also: rebuild, reconstruct |
| 933 | */ |
| 934 | void deconstruct_cmd(void){ |
| 935 | const char *zDestDir; |
| 936 | const char *zPrefixOpt; |
| 937 | Stmt s; |
| 938 | int privateFlag; |
| 939 | |
| 940 | /* get and check prefix length argument and build format string */ |
| 941 | zPrefixOpt=find_option("prefixlength","L",1); |
| 942 | if( !zPrefixOpt ){ |
| 943 | prefixLength = 2; |
| 944 | }else{ |
| @@ -953,10 +946,23 @@ | |
| 946 | prefixLength = (int)(*zPrefixOpt-'0'); |
| 947 | }else{ |
| 948 | fossil_fatal("N(%s) is not a a valid prefix length!",zPrefixOpt); |
| 949 | } |
| 950 | } |
| 951 | /* open repository and open query for all artifacts */ |
| 952 | db_find_and_open_repository(OPEN_ANY_SCHEMA, 0); |
| 953 | privateFlag = find_option("private",0,0)!=0; |
| 954 | verify_all_options(); |
| 955 | /* check number of arguments */ |
| 956 | if( g.argc!=3 ){ |
| 957 | usage ("?OPTIONS? DESTINATION"); |
| 958 | } |
| 959 | /* get and check argument destination directory */ |
| 960 | zDestDir = g.argv[g.argc-1]; |
| 961 | if( !*zDestDir || !file_isdir(zDestDir)) { |
| 962 | fossil_fatal("DESTINATION(%s) is not a directory!",zDestDir); |
| 963 | } |
| 964 | #ifndef _WIN32 |
| 965 | if( file_access(zDestDir, W_OK) ){ |
| 966 | fossil_fatal("DESTINATION(%s) is not writeable!",zDestDir); |
| 967 | } |
| 968 | #else |
| @@ -967,12 +973,11 @@ | |
| 973 | if( prefixLength ){ |
| 974 | zFNameFormat = mprintf("%s/%%.%ds/%%s",zDestDir,prefixLength); |
| 975 | }else{ |
| 976 | zFNameFormat = mprintf("%s/%%s",zDestDir); |
| 977 | } |
| 978 | |
| 979 | bag_init(&bagDone); |
| 980 | ttyOutput = 1; |
| 981 | processCnt = 0; |
| 982 | if (!g.fQuiet) { |
| 983 | fossil_print("0 (0%%)...\r"); |
| @@ -980,11 +985,12 @@ | |
| 985 | } |
| 986 | totalSize = db_int(0, "SELECT count(*) FROM blob"); |
| 987 | db_prepare(&s, |
| 988 | "SELECT rid, size FROM blob /*scan*/" |
| 989 | " WHERE NOT EXISTS(SELECT 1 FROM shun WHERE uuid=blob.uuid)" |
| 990 | " AND NOT EXISTS(SELECT 1 FROM delta WHERE rid=blob.rid) %s", |
| 991 | privateFlag==0 ? "AND rid NOT IN private" : "" |
| 992 | ); |
| 993 | while( db_step(&s)==SQLITE_ROW ){ |
| 994 | int rid = db_column_int(&s, 0); |
| 995 | int size = db_column_int(&s, 1); |
| 996 | if( size>=0 ){ |
| @@ -994,11 +1000,12 @@ | |
| 1000 | } |
| 1001 | } |
| 1002 | db_finalize(&s); |
| 1003 | db_prepare(&s, |
| 1004 | "SELECT rid, size FROM blob" |
| 1005 | " WHERE NOT EXISTS(SELECT 1 FROM shun WHERE uuid=blob.uuid) %s", |
| 1006 | privateFlag==0 ? "AND rid NOT IN private" : "" |
| 1007 | ); |
| 1008 | while( db_step(&s)==SQLITE_ROW ){ |
| 1009 | int rid = db_column_int(&s, 0); |
| 1010 | int size = db_column_int(&s, 1); |
| 1011 | if( size>=0 ){ |
| 1012 |