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")
Commit
5b1a6850aca9bba670399fd00acde79fe656aa45
Parent
a5479f189bf3459…
1 file changed
+22
-5
+22
-5
| --- src/manifest.c | ||
| +++ src/manifest.c | ||
| @@ -92,11 +92,11 @@ | ||
| 92 | 92 | int nCChild; /* Number of cluster children */ |
| 93 | 93 | int nCChildAlloc; /* Number of closts allocated in azCChild[] */ |
| 94 | 94 | char **azCChild; /* UUIDs of referenced objects in a cluster. M cards */ |
| 95 | 95 | int nTag; /* Number of T Cards */ |
| 96 | 96 | int nTagAlloc; /* Slots allocated in aTag[] */ |
| 97 | - struct { | |
| 97 | + struct TagType { | |
| 98 | 98 | char *zName; /* Name of the tag */ |
| 99 | 99 | char *zUuid; /* UUID that the tag is applied to */ |
| 100 | 100 | char *zValue; /* Value if the tag is really a property */ |
| 101 | 101 | } *aTag; /* One for each T card */ |
| 102 | 102 | int nField; /* Number of J cards */ |
| @@ -1606,10 +1606,24 @@ | ||
| 1606 | 1606 | blob_str(&comment), blob_str(&brief) |
| 1607 | 1607 | ); |
| 1608 | 1608 | blob_reset(&comment); |
| 1609 | 1609 | blob_reset(&brief); |
| 1610 | 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 | +} | |
| 1611 | 1625 | |
| 1612 | 1626 | /* |
| 1613 | 1627 | ** Scan artifact rid/pContent to see if it is a control artifact of |
| 1614 | 1628 | ** any key: |
| 1615 | 1629 | ** |
| @@ -1921,18 +1935,20 @@ | ||
| 1921 | 1935 | const char *zValue; |
| 1922 | 1936 | const char *zUuid; |
| 1923 | 1937 | int branchMove = 0; |
| 1924 | 1938 | blob_zero(&comment); |
| 1925 | 1939 | if( p->zComment ){ |
| 1926 | - blob_appendf(&comment, "%s. ", p->zComment); | |
| 1940 | + blob_appendf(&comment, " %s.", p->zComment); | |
| 1927 | 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); | |
| 1928 | 1944 | for(i=0; i<p->nTag; i++){ |
| 1929 | 1945 | zUuid = p->aTag[i].zUuid; |
| 1946 | + if( !zUuid ) continue; | |
| 1930 | 1947 | if( i==0 || fossil_strcmp(zUuid, p->aTag[i-1].zUuid)!=0 ){ |
| 1931 | - if( i>0 ) blob_append(&comment, " ", 1); | |
| 1932 | 1948 | blob_appendf(&comment, |
| 1933 | - "Edit [%S]:", | |
| 1949 | + " Edit [%S]:", | |
| 1934 | 1950 | zUuid); |
| 1935 | 1951 | branchMove = 0; |
| 1936 | 1952 | } |
| 1937 | 1953 | zName = p->aTag[i].zName; |
| 1938 | 1954 | zValue = p->aTag[i].zValue; |
| @@ -1991,14 +2007,15 @@ | ||
| 1991 | 2007 | blob_appendf(&comment, "."); |
| 1992 | 2008 | } |
| 1993 | 2009 | } |
| 1994 | 2010 | } |
| 1995 | 2011 | /*blob_appendf(&comment, " [[/info/%S | details]]");*/ |
| 2012 | + if( blob_size(&comment)==0 ) blob_append(&comment, " ", 1); | |
| 1996 | 2013 | db_multi_exec( |
| 1997 | 2014 | "REPLACE INTO event(type,mtime,objid,user,comment)" |
| 1998 | 2015 | "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 | |
| 2000 | 2017 | ); |
| 2001 | 2018 | blob_reset(&comment); |
| 2002 | 2019 | } |
| 2003 | 2020 | db_end_transaction(0); |
| 2004 | 2021 | if( p->type==CFTYPE_MANIFEST ){ |
| 2005 | 2022 |
| --- 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, " [[/info/%S | details]]");*/ |
| 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, " [[/info/%S | details]]");*/ |
| 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 |