Fossil SCM
The annotator follows name changes.
Commit
ee33b951a4063e3394414b6282b63ceb1208e3df
Parent
dac6424e66a8272…
1 file changed
+24
-22
+24
-22
| --- src/diff.c | ||
| +++ src/diff.c | ||
| @@ -1981,44 +1981,42 @@ | ||
| 1981 | 1981 | Blob toAnnotate; /* Text of the final (mid) version of the file */ |
| 1982 | 1982 | Blob step; /* Text of previous revision */ |
| 1983 | 1983 | int rid; /* Artifact ID of the file being annotated */ |
| 1984 | 1984 | char *zLabel; /* Label to apply to a line */ |
| 1985 | 1985 | Stmt q; /* Query returning all ancestor versions */ |
| 1986 | + int cnt = 0; /* Number of versions examined */ | |
| 1986 | 1987 | |
| 1987 | 1988 | /* Initialize the annotation */ |
| 1988 | 1989 | rid = db_int(0, "SELECT fid FROM mlink WHERE mid=%d AND fnid=%d",mid,fnid); |
| 1989 | 1990 | if( rid==0 ){ |
| 1990 | 1991 | fossil_panic("file #%d is unchanged in manifest #%d", fnid, mid); |
| 1991 | 1992 | } |
| 1992 | 1993 | if( !content_get(rid, &toAnnotate) ){ |
| 1993 | 1994 | fossil_panic("unable to retrieve content of artifact #%d", rid); |
| 1994 | 1995 | } |
| 1995 | - db_multi_exec("CREATE TEMP TABLE ok(rid INTEGER PRIMARY KEY)"); | |
| 1996 | 1996 | if( iLimit<=0 ) iLimit = 1000000000; |
| 1997 | - compute_direct_ancestors(mid, iLimit); | |
| 1998 | 1997 | annotation_start(p, &toAnnotate); |
| 1999 | - | |
| 1998 | + | |
| 2000 | 1999 | db_prepare(&q, |
| 2001 | - "SELECT mlink.fid," | |
| 2002 | - " (SELECT uuid FROM blob WHERE rid=mlink.%s)," | |
| 2003 | - " date(event.mtime), " | |
| 2004 | - " coalesce(event.euser,event.user) " | |
| 2005 | - " FROM ancestor, mlink, event" | |
| 2006 | - " WHERE mlink.fnid=%d" | |
| 2007 | - " AND mlink.mid=ancestor.rid" | |
| 2008 | - " AND event.objid=ancestor.rid" | |
| 2009 | - " ORDER BY ancestor.generation ASC" | |
| 2010 | - " LIMIT %d", | |
| 2011 | - (annFlags & ANN_FILE_VERS)!=0 ? "fid" : "mid", | |
| 2012 | - fnid, | |
| 2013 | - iLimit>0 ? iLimit : 10000000 | |
| 2000 | + "SELECT (SELECT uuid FROM blob WHERE rid=mlink.%s)," | |
| 2001 | + " date(event.mtime)," | |
| 2002 | + " coalesce(event.euser,event.user)," | |
| 2003 | + " mlink.pid" | |
| 2004 | + " FROM mlink, event" | |
| 2005 | + " WHERE mlink.fid=:rid" | |
| 2006 | + " AND event.objid=mlink.mid" | |
| 2007 | + " ORDER BY event.mtime", | |
| 2008 | + (annFlags & ANN_FILE_VERS)!=0 ? "fid" : "mid" | |
| 2014 | 2009 | ); |
| 2015 | - while( db_step(&q)==SQLITE_ROW ){ | |
| 2016 | - int pid = db_column_int(&q, 0); | |
| 2017 | - const char *zUuid = db_column_text(&q, 1); | |
| 2018 | - const char *zDate = db_column_text(&q, 2); | |
| 2019 | - const char *zUser = db_column_text(&q, 3); | |
| 2010 | + | |
| 2011 | + db_bind_int(&q, ":rid", rid); | |
| 2012 | + if( iLimit==0 ) iLimit = 1000000000; | |
| 2013 | + while( rid && iLimit>cnt && db_step(&q)==SQLITE_ROW ){ | |
| 2014 | + const char *zUuid = db_column_text(&q, 0); | |
| 2015 | + const char *zDate = db_column_text(&q, 1); | |
| 2016 | + const char *zUser = db_column_text(&q, 2); | |
| 2017 | + int prevId = db_column_int(&q, 3); | |
| 2020 | 2018 | if( webLabel ){ |
| 2021 | 2019 | zLabel = mprintf( |
| 2022 | 2020 | "<a href='%R/info/%s' target='infowindow'>%.10s</a> %s %13.13s", |
| 2023 | 2021 | zUuid, zUuid, zDate, zUser |
| 2024 | 2022 | ); |
| @@ -2026,13 +2024,17 @@ | ||
| 2026 | 2024 | zLabel = mprintf("%.10s %s %13.13s", zUuid, zDate, zUser); |
| 2027 | 2025 | } |
| 2028 | 2026 | p->nVers++; |
| 2029 | 2027 | p->azVers = fossil_realloc(p->azVers, p->nVers*sizeof(p->azVers[0]) ); |
| 2030 | 2028 | p->azVers[p->nVers-1] = zLabel; |
| 2031 | - content_get(pid, &step); | |
| 2029 | + content_get(rid, &step); | |
| 2032 | 2030 | annotation_step(p, &step, zLabel); |
| 2033 | 2031 | blob_reset(&step); |
| 2032 | + db_reset(&q); | |
| 2033 | + rid = prevId; | |
| 2034 | + db_bind_int(&q, ":rid", prevId); | |
| 2035 | + cnt++; | |
| 2034 | 2036 | } |
| 2035 | 2037 | db_finalize(&q); |
| 2036 | 2038 | } |
| 2037 | 2039 | |
| 2038 | 2040 | /* |
| 2039 | 2041 |
| --- src/diff.c | |
| +++ src/diff.c | |
| @@ -1981,44 +1981,42 @@ | |
| 1981 | Blob toAnnotate; /* Text of the final (mid) version of the file */ |
| 1982 | Blob step; /* Text of previous revision */ |
| 1983 | int rid; /* Artifact ID of the file being annotated */ |
| 1984 | char *zLabel; /* Label to apply to a line */ |
| 1985 | Stmt q; /* Query returning all ancestor versions */ |
| 1986 | |
| 1987 | /* Initialize the annotation */ |
| 1988 | rid = db_int(0, "SELECT fid FROM mlink WHERE mid=%d AND fnid=%d",mid,fnid); |
| 1989 | if( rid==0 ){ |
| 1990 | fossil_panic("file #%d is unchanged in manifest #%d", fnid, mid); |
| 1991 | } |
| 1992 | if( !content_get(rid, &toAnnotate) ){ |
| 1993 | fossil_panic("unable to retrieve content of artifact #%d", rid); |
| 1994 | } |
| 1995 | db_multi_exec("CREATE TEMP TABLE ok(rid INTEGER PRIMARY KEY)"); |
| 1996 | if( iLimit<=0 ) iLimit = 1000000000; |
| 1997 | compute_direct_ancestors(mid, iLimit); |
| 1998 | annotation_start(p, &toAnnotate); |
| 1999 | |
| 2000 | db_prepare(&q, |
| 2001 | "SELECT mlink.fid," |
| 2002 | " (SELECT uuid FROM blob WHERE rid=mlink.%s)," |
| 2003 | " date(event.mtime), " |
| 2004 | " coalesce(event.euser,event.user) " |
| 2005 | " FROM ancestor, mlink, event" |
| 2006 | " WHERE mlink.fnid=%d" |
| 2007 | " AND mlink.mid=ancestor.rid" |
| 2008 | " AND event.objid=ancestor.rid" |
| 2009 | " ORDER BY ancestor.generation ASC" |
| 2010 | " LIMIT %d", |
| 2011 | (annFlags & ANN_FILE_VERS)!=0 ? "fid" : "mid", |
| 2012 | fnid, |
| 2013 | iLimit>0 ? iLimit : 10000000 |
| 2014 | ); |
| 2015 | while( db_step(&q)==SQLITE_ROW ){ |
| 2016 | int pid = db_column_int(&q, 0); |
| 2017 | const char *zUuid = db_column_text(&q, 1); |
| 2018 | const char *zDate = db_column_text(&q, 2); |
| 2019 | const char *zUser = db_column_text(&q, 3); |
| 2020 | if( webLabel ){ |
| 2021 | zLabel = mprintf( |
| 2022 | "<a href='%R/info/%s' target='infowindow'>%.10s</a> %s %13.13s", |
| 2023 | zUuid, zUuid, zDate, zUser |
| 2024 | ); |
| @@ -2026,13 +2024,17 @@ | |
| 2026 | zLabel = mprintf("%.10s %s %13.13s", zUuid, zDate, zUser); |
| 2027 | } |
| 2028 | p->nVers++; |
| 2029 | p->azVers = fossil_realloc(p->azVers, p->nVers*sizeof(p->azVers[0]) ); |
| 2030 | p->azVers[p->nVers-1] = zLabel; |
| 2031 | content_get(pid, &step); |
| 2032 | annotation_step(p, &step, zLabel); |
| 2033 | blob_reset(&step); |
| 2034 | } |
| 2035 | db_finalize(&q); |
| 2036 | } |
| 2037 | |
| 2038 | /* |
| 2039 |
| --- src/diff.c | |
| +++ src/diff.c | |
| @@ -1981,44 +1981,42 @@ | |
| 1981 | Blob toAnnotate; /* Text of the final (mid) version of the file */ |
| 1982 | Blob step; /* Text of previous revision */ |
| 1983 | int rid; /* Artifact ID of the file being annotated */ |
| 1984 | char *zLabel; /* Label to apply to a line */ |
| 1985 | Stmt q; /* Query returning all ancestor versions */ |
| 1986 | int cnt = 0; /* Number of versions examined */ |
| 1987 | |
| 1988 | /* Initialize the annotation */ |
| 1989 | rid = db_int(0, "SELECT fid FROM mlink WHERE mid=%d AND fnid=%d",mid,fnid); |
| 1990 | if( rid==0 ){ |
| 1991 | fossil_panic("file #%d is unchanged in manifest #%d", fnid, mid); |
| 1992 | } |
| 1993 | if( !content_get(rid, &toAnnotate) ){ |
| 1994 | fossil_panic("unable to retrieve content of artifact #%d", rid); |
| 1995 | } |
| 1996 | if( iLimit<=0 ) iLimit = 1000000000; |
| 1997 | annotation_start(p, &toAnnotate); |
| 1998 | |
| 1999 | db_prepare(&q, |
| 2000 | "SELECT (SELECT uuid FROM blob WHERE rid=mlink.%s)," |
| 2001 | " date(event.mtime)," |
| 2002 | " coalesce(event.euser,event.user)," |
| 2003 | " mlink.pid" |
| 2004 | " FROM mlink, event" |
| 2005 | " WHERE mlink.fid=:rid" |
| 2006 | " AND event.objid=mlink.mid" |
| 2007 | " ORDER BY event.mtime", |
| 2008 | (annFlags & ANN_FILE_VERS)!=0 ? "fid" : "mid" |
| 2009 | ); |
| 2010 | |
| 2011 | db_bind_int(&q, ":rid", rid); |
| 2012 | if( iLimit==0 ) iLimit = 1000000000; |
| 2013 | while( rid && iLimit>cnt && db_step(&q)==SQLITE_ROW ){ |
| 2014 | const char *zUuid = db_column_text(&q, 0); |
| 2015 | const char *zDate = db_column_text(&q, 1); |
| 2016 | const char *zUser = db_column_text(&q, 2); |
| 2017 | int prevId = db_column_int(&q, 3); |
| 2018 | if( webLabel ){ |
| 2019 | zLabel = mprintf( |
| 2020 | "<a href='%R/info/%s' target='infowindow'>%.10s</a> %s %13.13s", |
| 2021 | zUuid, zUuid, zDate, zUser |
| 2022 | ); |
| @@ -2026,13 +2024,17 @@ | |
| 2024 | zLabel = mprintf("%.10s %s %13.13s", zUuid, zDate, zUser); |
| 2025 | } |
| 2026 | p->nVers++; |
| 2027 | p->azVers = fossil_realloc(p->azVers, p->nVers*sizeof(p->azVers[0]) ); |
| 2028 | p->azVers[p->nVers-1] = zLabel; |
| 2029 | content_get(rid, &step); |
| 2030 | annotation_step(p, &step, zLabel); |
| 2031 | blob_reset(&step); |
| 2032 | db_reset(&q); |
| 2033 | rid = prevId; |
| 2034 | db_bind_int(&q, ":rid", prevId); |
| 2035 | cnt++; |
| 2036 | } |
| 2037 | db_finalize(&q); |
| 2038 | } |
| 2039 | |
| 2040 | /* |
| 2041 |