Fossil SCM

Make -close and -hide no-ops if the checkin already has those tags.

andybradford 2015-08-01 06:40 UTC check-in-edit
Commit 1c8fdd253eaf36737c2d3d93d1d4955b56334654
1 file changed +22 -2
+22 -2
--- src/info.c
+++ src/info.c
@@ -2788,18 +2788,21 @@
27882788
const char **pzCancelTags = 0;
27892789
int fClose; /* True if leaf should be closed */
27902790
int fHide; /* True if branch should be hidden */
27912791
int fPropagateColor; /* True if color propagates before amend */
27922792
int fNewPropagateColor = 0; /* True if color propagates after amend */
2793
+ int fHasHidden = 0; /* True if hidden tag already set */
2794
+ int fHasClosed = 0; /* True if closed tag already set */
27932795
int fEditComment; /* True if editor to be used for comment */
27942796
const char *zChngTime; /* The change time on the control artifact */
27952797
const char *zUuid;
27962798
Blob ctrl;
27972799
Blob comment;
27982800
char *zNow;
27992801
int nTags, nCancels;
28002802
int i;
2803
+ Stmt q;
28012804
28022805
if( g.argc==3 ) usage(AMEND_USAGE_STMT);
28032806
fEditComment = find_option("edit-comment",0,0)!=0;
28042807
zNewComment = find_option("comment","m",1);
28052808
zComFile = find_option("message-file","M",1);
@@ -2834,10 +2837,27 @@
28342837
fPropagateColor = db_int(0, "SELECT tagtype FROM tagxref"
28352838
" WHERE rid=%d AND tagid=%d",
28362839
rid, TAG_BGCOLOR)==2;
28372840
fNewPropagateColor = zNewColor && zNewColor[0]
28382841
? fNewPropagateColor : fPropagateColor;
2842
+ db_prepare(&q,
2843
+ "SELECT tag.tagid FROM tagxref, tag"
2844
+ " WHERE tagxref.rid=%d AND tagtype>0 AND tagxref.tagid=tag.tagid",
2845
+ rid
2846
+ );
2847
+ while( db_step(&q)==SQLITE_ROW ){
2848
+ int tagid = db_column_int(&q, 0);
2849
+
2850
+ if( tagid == TAG_CLOSED ){
2851
+ fHasClosed = 1;
2852
+ }else if( tagid==TAG_HIDDEN ){
2853
+ fHasHidden = 1;
2854
+ }else{
2855
+ continue;
2856
+ }
2857
+ }
2858
+ db_finalize(&q);
28392859
blob_zero(&ctrl);
28402860
zNow = date_in_standard_format(zChngTime && zChngTime[0] ? zChngTime : "now");
28412861
blob_appendf(&ctrl, "D %s\n", zNow);
28422862
init_newtags();
28432863
if( zNewColor && zNewColor[0]
@@ -2888,11 +2908,11 @@
28882908
if( pzCancelTags[i] && pzCancelTags[i][0] )
28892909
cancel_tag(rid,pzCancelTags[i]);
28902910
}
28912911
fossil_free(pzCancelTags);
28922912
}
2893
- if( fHide ) hide_branch();
2894
- if( fClose ) close_leaf(rid);
2913
+ if( fHide && !fHasHidden ) hide_branch();
2914
+ if( fClose && !fHasClosed ) close_leaf(rid);
28952915
if( zNewBranch && zNewBranch[0] ) change_branch(rid,zNewBranch);
28962916
apply_newtags(&ctrl, rid, zUuid);
28972917
show_common_info(rid, "uuid:", 1, 0);
28982918
}
28992919
--- src/info.c
+++ src/info.c
@@ -2788,18 +2788,21 @@
2788 const char **pzCancelTags = 0;
2789 int fClose; /* True if leaf should be closed */
2790 int fHide; /* True if branch should be hidden */
2791 int fPropagateColor; /* True if color propagates before amend */
2792 int fNewPropagateColor = 0; /* True if color propagates after amend */
 
 
2793 int fEditComment; /* True if editor to be used for comment */
2794 const char *zChngTime; /* The change time on the control artifact */
2795 const char *zUuid;
2796 Blob ctrl;
2797 Blob comment;
2798 char *zNow;
2799 int nTags, nCancels;
2800 int i;
 
2801
2802 if( g.argc==3 ) usage(AMEND_USAGE_STMT);
2803 fEditComment = find_option("edit-comment",0,0)!=0;
2804 zNewComment = find_option("comment","m",1);
2805 zComFile = find_option("message-file","M",1);
@@ -2834,10 +2837,27 @@
2834 fPropagateColor = db_int(0, "SELECT tagtype FROM tagxref"
2835 " WHERE rid=%d AND tagid=%d",
2836 rid, TAG_BGCOLOR)==2;
2837 fNewPropagateColor = zNewColor && zNewColor[0]
2838 ? fNewPropagateColor : fPropagateColor;
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
2839 blob_zero(&ctrl);
2840 zNow = date_in_standard_format(zChngTime && zChngTime[0] ? zChngTime : "now");
2841 blob_appendf(&ctrl, "D %s\n", zNow);
2842 init_newtags();
2843 if( zNewColor && zNewColor[0]
@@ -2888,11 +2908,11 @@
2888 if( pzCancelTags[i] && pzCancelTags[i][0] )
2889 cancel_tag(rid,pzCancelTags[i]);
2890 }
2891 fossil_free(pzCancelTags);
2892 }
2893 if( fHide ) hide_branch();
2894 if( fClose ) close_leaf(rid);
2895 if( zNewBranch && zNewBranch[0] ) change_branch(rid,zNewBranch);
2896 apply_newtags(&ctrl, rid, zUuid);
2897 show_common_info(rid, "uuid:", 1, 0);
2898 }
2899
--- src/info.c
+++ src/info.c
@@ -2788,18 +2788,21 @@
2788 const char **pzCancelTags = 0;
2789 int fClose; /* True if leaf should be closed */
2790 int fHide; /* True if branch should be hidden */
2791 int fPropagateColor; /* True if color propagates before amend */
2792 int fNewPropagateColor = 0; /* True if color propagates after amend */
2793 int fHasHidden = 0; /* True if hidden tag already set */
2794 int fHasClosed = 0; /* True if closed tag already set */
2795 int fEditComment; /* True if editor to be used for comment */
2796 const char *zChngTime; /* The change time on the control artifact */
2797 const char *zUuid;
2798 Blob ctrl;
2799 Blob comment;
2800 char *zNow;
2801 int nTags, nCancels;
2802 int i;
2803 Stmt q;
2804
2805 if( g.argc==3 ) usage(AMEND_USAGE_STMT);
2806 fEditComment = find_option("edit-comment",0,0)!=0;
2807 zNewComment = find_option("comment","m",1);
2808 zComFile = find_option("message-file","M",1);
@@ -2834,10 +2837,27 @@
2837 fPropagateColor = db_int(0, "SELECT tagtype FROM tagxref"
2838 " WHERE rid=%d AND tagid=%d",
2839 rid, TAG_BGCOLOR)==2;
2840 fNewPropagateColor = zNewColor && zNewColor[0]
2841 ? fNewPropagateColor : fPropagateColor;
2842 db_prepare(&q,
2843 "SELECT tag.tagid FROM tagxref, tag"
2844 " WHERE tagxref.rid=%d AND tagtype>0 AND tagxref.tagid=tag.tagid",
2845 rid
2846 );
2847 while( db_step(&q)==SQLITE_ROW ){
2848 int tagid = db_column_int(&q, 0);
2849
2850 if( tagid == TAG_CLOSED ){
2851 fHasClosed = 1;
2852 }else if( tagid==TAG_HIDDEN ){
2853 fHasHidden = 1;
2854 }else{
2855 continue;
2856 }
2857 }
2858 db_finalize(&q);
2859 blob_zero(&ctrl);
2860 zNow = date_in_standard_format(zChngTime && zChngTime[0] ? zChngTime : "now");
2861 blob_appendf(&ctrl, "D %s\n", zNow);
2862 init_newtags();
2863 if( zNewColor && zNewColor[0]
@@ -2888,11 +2908,11 @@
2908 if( pzCancelTags[i] && pzCancelTags[i][0] )
2909 cancel_tag(rid,pzCancelTags[i]);
2910 }
2911 fossil_free(pzCancelTags);
2912 }
2913 if( fHide && !fHasHidden ) hide_branch();
2914 if( fClose && !fHasClosed ) close_leaf(rid);
2915 if( zNewBranch && zNewBranch[0] ) change_branch(rid,zNewBranch);
2916 apply_newtags(&ctrl, rid, zUuid);
2917 show_common_info(rid, "uuid:", 1, 0);
2918 }
2919

Keyboard Shortcuts

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