Fossil SCM

For the control summary, make sure that the reported tags are sorted by UUID. This way, [fb5b161492] looks much better (after "fossil rebuild")

jan.nijtmans 2013-08-24 22:22 trunk
Commit 5b1a6850aca9bba670399fd00acde79fe656aa45
1 file changed +22 -5
+22 -5
--- src/manifest.c
+++ src/manifest.c
@@ -92,11 +92,11 @@
9292
int nCChild; /* Number of cluster children */
9393
int nCChildAlloc; /* Number of closts allocated in azCChild[] */
9494
char **azCChild; /* UUIDs of referenced objects in a cluster. M cards */
9595
int nTag; /* Number of T Cards */
9696
int nTagAlloc; /* Slots allocated in aTag[] */
97
- struct {
97
+ struct TagType {
9898
char *zName; /* Name of the tag */
9999
char *zUuid; /* UUID that the tag is applied to */
100100
char *zValue; /* Value if the tag is really a property */
101101
} *aTag; /* One for each T card */
102102
int nField; /* Number of J cards */
@@ -1606,10 +1606,24 @@
16061606
blob_str(&comment), blob_str(&brief)
16071607
);
16081608
blob_reset(&comment);
16091609
blob_reset(&brief);
16101610
}
1611
+
1612
+/*
1613
+** This is the comparison function used to sort the tag array.
1614
+*/
1615
+static int tag_compare(const void *a, const void *b){
1616
+ struct TagType *pA = (struct TagType*)a;
1617
+ struct TagType *pB = (struct TagType*)b;
1618
+ int c;
1619
+ c = fossil_strcmp(pA->zUuid, pB->zUuid);
1620
+ if( c==0 ){
1621
+ c = fossil_strcmp(pA->zName, pB->zName);
1622
+ }
1623
+ return c;
1624
+}
16111625
16121626
/*
16131627
** Scan artifact rid/pContent to see if it is a control artifact of
16141628
** any key:
16151629
**
@@ -1921,18 +1935,20 @@
19211935
const char *zValue;
19221936
const char *zUuid;
19231937
int branchMove = 0;
19241938
blob_zero(&comment);
19251939
if( p->zComment ){
1926
- blob_appendf(&comment, "%s. ", p->zComment);
1940
+ blob_appendf(&comment, " %s.", p->zComment);
19271941
}
1942
+ /* Next loop expects tags to be sorted on UUID, so sort it. */
1943
+ qsort(p->aTag, p->nTag, sizeof(p->aTag[0]), tag_compare);
19281944
for(i=0; i<p->nTag; i++){
19291945
zUuid = p->aTag[i].zUuid;
1946
+ if( !zUuid ) continue;
19301947
if( i==0 || fossil_strcmp(zUuid, p->aTag[i-1].zUuid)!=0 ){
1931
- if( i>0 ) blob_append(&comment, " ", 1);
19321948
blob_appendf(&comment,
1933
- "Edit [%S]:",
1949
+ " Edit [%S]:",
19341950
zUuid);
19351951
branchMove = 0;
19361952
}
19371953
zName = p->aTag[i].zName;
19381954
zValue = p->aTag[i].zValue;
@@ -1991,14 +2007,15 @@
19912007
blob_appendf(&comment, ".");
19922008
}
19932009
}
19942010
}
19952011
/*blob_appendf(&comment, " &#91;[/info/%S | details]&#93;");*/
2012
+ if( blob_size(&comment)==0 ) blob_append(&comment, " ", 1);
19962013
db_multi_exec(
19972014
"REPLACE INTO event(type,mtime,objid,user,comment)"
19982015
"VALUES('g',%.17g,%d,%Q,%Q)",
1999
- p->rDate, rid, p->zUser, blob_str(&comment)
2016
+ p->rDate, rid, p->zUser, blob_str(&comment)+1
20002017
);
20012018
blob_reset(&comment);
20022019
}
20032020
db_end_transaction(0);
20042021
if( p->type==CFTYPE_MANIFEST ){
20052022
--- src/manifest.c
+++ src/manifest.c
@@ -92,11 +92,11 @@
92 int nCChild; /* Number of cluster children */
93 int nCChildAlloc; /* Number of closts allocated in azCChild[] */
94 char **azCChild; /* UUIDs of referenced objects in a cluster. M cards */
95 int nTag; /* Number of T Cards */
96 int nTagAlloc; /* Slots allocated in aTag[] */
97 struct {
98 char *zName; /* Name of the tag */
99 char *zUuid; /* UUID that the tag is applied to */
100 char *zValue; /* Value if the tag is really a property */
101 } *aTag; /* One for each T card */
102 int nField; /* Number of J cards */
@@ -1606,10 +1606,24 @@
1606 blob_str(&comment), blob_str(&brief)
1607 );
1608 blob_reset(&comment);
1609 blob_reset(&brief);
1610 }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1611
1612 /*
1613 ** Scan artifact rid/pContent to see if it is a control artifact of
1614 ** any key:
1615 **
@@ -1921,18 +1935,20 @@
1921 const char *zValue;
1922 const char *zUuid;
1923 int branchMove = 0;
1924 blob_zero(&comment);
1925 if( p->zComment ){
1926 blob_appendf(&comment, "%s. ", p->zComment);
1927 }
 
 
1928 for(i=0; i<p->nTag; i++){
1929 zUuid = p->aTag[i].zUuid;
 
1930 if( i==0 || fossil_strcmp(zUuid, p->aTag[i-1].zUuid)!=0 ){
1931 if( i>0 ) blob_append(&comment, " ", 1);
1932 blob_appendf(&comment,
1933 "Edit [%S]:",
1934 zUuid);
1935 branchMove = 0;
1936 }
1937 zName = p->aTag[i].zName;
1938 zValue = p->aTag[i].zValue;
@@ -1991,14 +2007,15 @@
1991 blob_appendf(&comment, ".");
1992 }
1993 }
1994 }
1995 /*blob_appendf(&comment, " &#91;[/info/%S | details]&#93;");*/
 
1996 db_multi_exec(
1997 "REPLACE INTO event(type,mtime,objid,user,comment)"
1998 "VALUES('g',%.17g,%d,%Q,%Q)",
1999 p->rDate, rid, p->zUser, blob_str(&comment)
2000 );
2001 blob_reset(&comment);
2002 }
2003 db_end_transaction(0);
2004 if( p->type==CFTYPE_MANIFEST ){
2005
--- src/manifest.c
+++ src/manifest.c
@@ -92,11 +92,11 @@
92 int nCChild; /* Number of cluster children */
93 int nCChildAlloc; /* Number of closts allocated in azCChild[] */
94 char **azCChild; /* UUIDs of referenced objects in a cluster. M cards */
95 int nTag; /* Number of T Cards */
96 int nTagAlloc; /* Slots allocated in aTag[] */
97 struct TagType {
98 char *zName; /* Name of the tag */
99 char *zUuid; /* UUID that the tag is applied to */
100 char *zValue; /* Value if the tag is really a property */
101 } *aTag; /* One for each T card */
102 int nField; /* Number of J cards */
@@ -1606,10 +1606,24 @@
1606 blob_str(&comment), blob_str(&brief)
1607 );
1608 blob_reset(&comment);
1609 blob_reset(&brief);
1610 }
1611
1612 /*
1613 ** This is the comparison function used to sort the tag array.
1614 */
1615 static int tag_compare(const void *a, const void *b){
1616 struct TagType *pA = (struct TagType*)a;
1617 struct TagType *pB = (struct TagType*)b;
1618 int c;
1619 c = fossil_strcmp(pA->zUuid, pB->zUuid);
1620 if( c==0 ){
1621 c = fossil_strcmp(pA->zName, pB->zName);
1622 }
1623 return c;
1624 }
1625
1626 /*
1627 ** Scan artifact rid/pContent to see if it is a control artifact of
1628 ** any key:
1629 **
@@ -1921,18 +1935,20 @@
1935 const char *zValue;
1936 const char *zUuid;
1937 int branchMove = 0;
1938 blob_zero(&comment);
1939 if( p->zComment ){
1940 blob_appendf(&comment, " %s.", p->zComment);
1941 }
1942 /* Next loop expects tags to be sorted on UUID, so sort it. */
1943 qsort(p->aTag, p->nTag, sizeof(p->aTag[0]), tag_compare);
1944 for(i=0; i<p->nTag; i++){
1945 zUuid = p->aTag[i].zUuid;
1946 if( !zUuid ) continue;
1947 if( i==0 || fossil_strcmp(zUuid, p->aTag[i-1].zUuid)!=0 ){
 
1948 blob_appendf(&comment,
1949 " Edit [%S]:",
1950 zUuid);
1951 branchMove = 0;
1952 }
1953 zName = p->aTag[i].zName;
1954 zValue = p->aTag[i].zValue;
@@ -1991,14 +2007,15 @@
2007 blob_appendf(&comment, ".");
2008 }
2009 }
2010 }
2011 /*blob_appendf(&comment, " &#91;[/info/%S | details]&#93;");*/
2012 if( blob_size(&comment)==0 ) blob_append(&comment, " ", 1);
2013 db_multi_exec(
2014 "REPLACE INTO event(type,mtime,objid,user,comment)"
2015 "VALUES('g',%.17g,%d,%Q,%Q)",
2016 p->rDate, rid, p->zUser, blob_str(&comment)+1
2017 );
2018 blob_reset(&comment);
2019 }
2020 db_end_transaction(0);
2021 if( p->type==CFTYPE_MANIFEST ){
2022

Keyboard Shortcuts

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