Fossil SCM

A control artifact which modifies an already existing valid check-in (e.g. moving it to another branch), should fire the (commit) hook for the changed manifest.

jan.nijtmans 2013-10-16 09:50 tkt-change-hook
Commit 52861df1e93f5c5b1a36d83a2887cd7b08d985ce
1 file changed +13 -7
+13 -7
--- src/manifest.c
+++ src/manifest.c
@@ -1949,33 +1949,39 @@
19491949
if( p->type==CFTYPE_CONTROL ){
19501950
Blob comment;
19511951
int i;
19521952
const char *zName;
19531953
const char *zValue;
1954
- const char *zUuid;
1954
+ const char *zTagUuid;
19551955
int branchMove = 0;
19561956
blob_zero(&comment);
19571957
if( p->zComment ){
19581958
blob_appendf(&comment, " %s.", p->zComment);
19591959
}
19601960
/* Next loop expects tags to be sorted on UUID, so sort it. */
19611961
qsort(p->aTag, p->nTag, sizeof(p->aTag[0]), tag_compare);
19621962
for(i=0; i<p->nTag; i++){
1963
- zUuid = p->aTag[i].zUuid;
1964
- if( !zUuid ) continue;
1965
- if( i==0 || fossil_strcmp(zUuid, p->aTag[i-1].zUuid)!=0 ){
1963
+ zTagUuid = p->aTag[i].zUuid;
1964
+ if( !zTagUuid ) continue;
1965
+ if( i==0 || fossil_strcmp(zTagUuid, p->aTag[i-1].zUuid)!=0 ){
19661966
blob_appendf(&comment,
19671967
" Edit [%S]:",
1968
- zUuid);
1968
+ zTagUuid);
19691969
branchMove = 0;
1970
+ if( db_exists("SELECT event.type FROM event, blob"
1971
+ " WHERE event.type='ci' AND event.objid=blob.rid"
1972
+ " AND blob.uuid='%s'", zTagUuid) ){
1973
+ zScript = xfer_commit_code();
1974
+ zUuid = zTagUuid;
1975
+ }
19701976
}
19711977
zName = p->aTag[i].zName;
19721978
zValue = p->aTag[i].zValue;
19731979
if( strcmp(zName, "*branch")==0 ){
19741980
blob_appendf(&comment,
19751981
" Move to branch [/timeline?r=%h&nd&dp=%S | %h].",
1976
- zValue, zUuid, zValue);
1982
+ zValue, zTagUuid, zValue);
19771983
branchMove = 1;
19781984
continue;
19791985
}else if( strcmp(zName, "*bgcolor")==0 ){
19801986
blob_appendf(&comment,
19811987
" Change branch background color to \"%h\".", zValue);
@@ -2036,11 +2042,11 @@
20362042
p->rDate, rid, p->zUser, blob_str(&comment)+1
20372043
);
20382044
blob_reset(&comment);
20392045
}
20402046
db_end_transaction(0);
2041
- if( flags & MC_PERMIT_HOOKS ){
2047
+ if( zScript && (flags & MC_PERMIT_HOOKS) ){
20422048
result = xfer_run_common_script();
20432049
if( result==TH_OK ){
20442050
result = xfer_run_script(zScript, zUuid);
20452051
}
20462052
}
20472053
--- src/manifest.c
+++ src/manifest.c
@@ -1949,33 +1949,39 @@
1949 if( p->type==CFTYPE_CONTROL ){
1950 Blob comment;
1951 int i;
1952 const char *zName;
1953 const char *zValue;
1954 const char *zUuid;
1955 int branchMove = 0;
1956 blob_zero(&comment);
1957 if( p->zComment ){
1958 blob_appendf(&comment, " %s.", p->zComment);
1959 }
1960 /* Next loop expects tags to be sorted on UUID, so sort it. */
1961 qsort(p->aTag, p->nTag, sizeof(p->aTag[0]), tag_compare);
1962 for(i=0; i<p->nTag; i++){
1963 zUuid = p->aTag[i].zUuid;
1964 if( !zUuid ) continue;
1965 if( i==0 || fossil_strcmp(zUuid, p->aTag[i-1].zUuid)!=0 ){
1966 blob_appendf(&comment,
1967 " Edit [%S]:",
1968 zUuid);
1969 branchMove = 0;
 
 
 
 
 
 
1970 }
1971 zName = p->aTag[i].zName;
1972 zValue = p->aTag[i].zValue;
1973 if( strcmp(zName, "*branch")==0 ){
1974 blob_appendf(&comment,
1975 " Move to branch [/timeline?r=%h&nd&dp=%S | %h].",
1976 zValue, zUuid, zValue);
1977 branchMove = 1;
1978 continue;
1979 }else if( strcmp(zName, "*bgcolor")==0 ){
1980 blob_appendf(&comment,
1981 " Change branch background color to \"%h\".", zValue);
@@ -2036,11 +2042,11 @@
2036 p->rDate, rid, p->zUser, blob_str(&comment)+1
2037 );
2038 blob_reset(&comment);
2039 }
2040 db_end_transaction(0);
2041 if( flags & MC_PERMIT_HOOKS ){
2042 result = xfer_run_common_script();
2043 if( result==TH_OK ){
2044 result = xfer_run_script(zScript, zUuid);
2045 }
2046 }
2047
--- src/manifest.c
+++ src/manifest.c
@@ -1949,33 +1949,39 @@
1949 if( p->type==CFTYPE_CONTROL ){
1950 Blob comment;
1951 int i;
1952 const char *zName;
1953 const char *zValue;
1954 const char *zTagUuid;
1955 int branchMove = 0;
1956 blob_zero(&comment);
1957 if( p->zComment ){
1958 blob_appendf(&comment, " %s.", p->zComment);
1959 }
1960 /* Next loop expects tags to be sorted on UUID, so sort it. */
1961 qsort(p->aTag, p->nTag, sizeof(p->aTag[0]), tag_compare);
1962 for(i=0; i<p->nTag; i++){
1963 zTagUuid = p->aTag[i].zUuid;
1964 if( !zTagUuid ) continue;
1965 if( i==0 || fossil_strcmp(zTagUuid, p->aTag[i-1].zUuid)!=0 ){
1966 blob_appendf(&comment,
1967 " Edit [%S]:",
1968 zTagUuid);
1969 branchMove = 0;
1970 if( db_exists("SELECT event.type FROM event, blob"
1971 " WHERE event.type='ci' AND event.objid=blob.rid"
1972 " AND blob.uuid='%s'", zTagUuid) ){
1973 zScript = xfer_commit_code();
1974 zUuid = zTagUuid;
1975 }
1976 }
1977 zName = p->aTag[i].zName;
1978 zValue = p->aTag[i].zValue;
1979 if( strcmp(zName, "*branch")==0 ){
1980 blob_appendf(&comment,
1981 " Move to branch [/timeline?r=%h&nd&dp=%S | %h].",
1982 zValue, zTagUuid, zValue);
1983 branchMove = 1;
1984 continue;
1985 }else if( strcmp(zName, "*bgcolor")==0 ){
1986 blob_appendf(&comment,
1987 " Change branch background color to \"%h\".", zValue);
@@ -2036,11 +2042,11 @@
2042 p->rDate, rid, p->zUser, blob_str(&comment)+1
2043 );
2044 blob_reset(&comment);
2045 }
2046 db_end_transaction(0);
2047 if( zScript && (flags & MC_PERMIT_HOOKS) ){
2048 result = xfer_run_common_script();
2049 if( result==TH_OK ){
2050 result = xfer_run_script(zScript, zUuid);
2051 }
2052 }
2053

Keyboard Shortcuts

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