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.

drh 2012-10-13 17:31 trunk
Commit 6545e6cf7409fdbf66eb9e233536cea979df7b90
2 files changed -4 +21 -14
--- src/checkin.c
+++ src/checkin.c
@@ -834,14 +834,10 @@
834834
}
835835
if( zColor && zColor[0] ){
836836
/* One-time background color */
837837
blob_appendf(pOut, "T +bgcolor * %F\n", zColor);
838838
}
839
- if( g.markPrivate ){
840
- /* If this manifest is private, mark it as such */
841
- blob_appendf(pOut, "T +private *\n");
842
- }
843839
if( azTag ){
844840
for(i=0; azTag[i]; i++){
845841
/* Add a symbolic tag to this check-in. The tag names have already
846842
** been sorted and converted using the %F format */
847843
blob_appendf(pOut, "T +sym-%s *\n", azTag[i]);
848844
--- 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 @@
925925
**
926926
** Options:
927927
** -R|--repository REPOSITORY deconstruct given REPOSITORY
928928
** -L|--prefixlength N set the length of the names of the DESTINATION
929929
** subdirectories to N
930
+** --private Include private artifacts.
930931
**
931932
** See also: rebuild, reconstruct
932933
*/
933934
void deconstruct_cmd(void){
934935
const char *zDestDir;
935936
const char *zPrefixOpt;
936937
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
+
947940
/* get and check prefix length argument and build format string */
948941
zPrefixOpt=find_option("prefixlength","L",1);
949942
if( !zPrefixOpt ){
950943
prefixLength = 2;
951944
}else{
@@ -953,10 +946,23 @@
953946
prefixLength = (int)(*zPrefixOpt-'0');
954947
}else{
955948
fossil_fatal("N(%s) is not a a valid prefix length!",zPrefixOpt);
956949
}
957950
}
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
+ }
958964
#ifndef _WIN32
959965
if( file_access(zDestDir, W_OK) ){
960966
fossil_fatal("DESTINATION(%s) is not writeable!",zDestDir);
961967
}
962968
#else
@@ -967,12 +973,11 @@
967973
if( prefixLength ){
968974
zFNameFormat = mprintf("%s/%%.%ds/%%s",zDestDir,prefixLength);
969975
}else{
970976
zFNameFormat = mprintf("%s/%%s",zDestDir);
971977
}
972
- /* open repository and open query for all artifacts */
973
- db_find_and_open_repository(OPEN_ANY_SCHEMA, 0);
978
+
974979
bag_init(&bagDone);
975980
ttyOutput = 1;
976981
processCnt = 0;
977982
if (!g.fQuiet) {
978983
fossil_print("0 (0%%)...\r");
@@ -980,11 +985,12 @@
980985
}
981986
totalSize = db_int(0, "SELECT count(*) FROM blob");
982987
db_prepare(&s,
983988
"SELECT rid, size FROM blob /*scan*/"
984989
" 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" : ""
986992
);
987993
while( db_step(&s)==SQLITE_ROW ){
988994
int rid = db_column_int(&s, 0);
989995
int size = db_column_int(&s, 1);
990996
if( size>=0 ){
@@ -994,11 +1000,12 @@
9941000
}
9951001
}
9961002
db_finalize(&s);
9971003
db_prepare(&s,
9981004
"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" : ""
10001007
);
10011008
while( db_step(&s)==SQLITE_ROW ){
10021009
int rid = db_column_int(&s, 0);
10031010
int size = db_column_int(&s, 1);
10041011
if( size>=0 ){
10051012
--- 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

Keyboard Shortcuts

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