Fossil SCM

added glob=pattern option to /fileage, per ML request.

stephan 2014-02-27 17:09 trunk
Commit b26e9c87995b7b7f63da1486f9d207af44a85258
1 file changed +11 -5
+11 -5
--- src/browse.c
+++ src/browse.c
@@ -732,13 +732,14 @@
732732
733733
/*
734734
** Look at all file containing in the version "vid". Construct a
735735
** temporary table named "fileage" that contains the file-id for each
736736
** files, the pathname, the check-in where the file was added, and the
737
-** mtime on that checkin.
737
+** mtime on that checkin. If zGlob is not NULL then only files
738
+** matching the given glob are computed.
738739
*/
739
-int compute_fileage(int vid){
740
+int compute_fileage(int vid, char const * zGlob){
740741
Manifest *pManifest;
741742
ManifestFile *pFile;
742743
int nFile = 0;
743744
double vmtime;
744745
Stmt ins;
@@ -760,10 +761,11 @@
760761
db_prepare(&ins,
761762
"INSERT INTO temp.fileage(fid, pathname)"
762763
" SELECT rid, :path FROM blob WHERE uuid=:uuid"
763764
);
764765
while( (pFile = manifest_file_next(pManifest, 0))!=0 ){
766
+ if(zGlob && !strglob(zGlob, pFile->zName)) continue;
765767
db_bind_text(&ins, ":uuid", pFile->zUuid);
766768
db_bind_text(&ins, ":path", pFile->zName);
767769
db_step(&ins);
768770
db_reset(&ins);
769771
nFile++;
@@ -807,20 +809,22 @@
807809
808810
/*
809811
** WEBPAGE: fileage
810812
**
811813
** Parameters:
812
-** name=VERSION
814
+** name=VERSION Selects the checkin version (default=tip).
815
+** glob=STRING Only shows files matching this glob pattern
816
+** (e.g. *.c or *.txt).
813817
*/
814818
void fileage_page(void){
815819
int rid;
816820
const char *zName;
817821
char *zBaseTime;
822
+ char const * zGlob;
818823
Stmt q;
819824
double baseTime;
820825
int lastMid = -1;
821
-
822826
login_check_credentials();
823827
if( !g.perm.Read ){ login_needed(); return; }
824828
zName = P("name");
825829
if( zName==0 ) zName = "tip";
826830
rid = symbolic_name_to_rid(zName, "ci");
@@ -827,11 +831,13 @@
827831
if( rid==0 ){
828832
fossil_fatal("not a valid check-in: %s", zName);
829833
}
830834
style_submenu_element("Tree-View", "Tree-View", "%R/tree?ci=%T", zName);
831835
style_header("File Ages", zName);
832
- compute_fileage(rid);
836
+ zGlob = P("glob");
837
+ if(zGlob && !*zGlob) zGlob = NULL;
838
+ compute_fileage(rid,zGlob);
833839
baseTime = db_double(0.0, "SELECT mtime FROM event WHERE objid=%d", rid);
834840
zBaseTime = db_text("","SELECT datetime(%.20g%s)", baseTime, timeline_utc());
835841
@ <h2>File Ages For Check-in
836842
@ %z(href("%R/info?name=%T",zName))%h(zName)</a></h2>
837843
@
838844
--- src/browse.c
+++ src/browse.c
@@ -732,13 +732,14 @@
732
733 /*
734 ** Look at all file containing in the version "vid". Construct a
735 ** temporary table named "fileage" that contains the file-id for each
736 ** files, the pathname, the check-in where the file was added, and the
737 ** mtime on that checkin.
 
738 */
739 int compute_fileage(int vid){
740 Manifest *pManifest;
741 ManifestFile *pFile;
742 int nFile = 0;
743 double vmtime;
744 Stmt ins;
@@ -760,10 +761,11 @@
760 db_prepare(&ins,
761 "INSERT INTO temp.fileage(fid, pathname)"
762 " SELECT rid, :path FROM blob WHERE uuid=:uuid"
763 );
764 while( (pFile = manifest_file_next(pManifest, 0))!=0 ){
 
765 db_bind_text(&ins, ":uuid", pFile->zUuid);
766 db_bind_text(&ins, ":path", pFile->zName);
767 db_step(&ins);
768 db_reset(&ins);
769 nFile++;
@@ -807,20 +809,22 @@
807
808 /*
809 ** WEBPAGE: fileage
810 **
811 ** Parameters:
812 ** name=VERSION
 
 
813 */
814 void fileage_page(void){
815 int rid;
816 const char *zName;
817 char *zBaseTime;
 
818 Stmt q;
819 double baseTime;
820 int lastMid = -1;
821
822 login_check_credentials();
823 if( !g.perm.Read ){ login_needed(); return; }
824 zName = P("name");
825 if( zName==0 ) zName = "tip";
826 rid = symbolic_name_to_rid(zName, "ci");
@@ -827,11 +831,13 @@
827 if( rid==0 ){
828 fossil_fatal("not a valid check-in: %s", zName);
829 }
830 style_submenu_element("Tree-View", "Tree-View", "%R/tree?ci=%T", zName);
831 style_header("File Ages", zName);
832 compute_fileage(rid);
 
 
833 baseTime = db_double(0.0, "SELECT mtime FROM event WHERE objid=%d", rid);
834 zBaseTime = db_text("","SELECT datetime(%.20g%s)", baseTime, timeline_utc());
835 @ <h2>File Ages For Check-in
836 @ %z(href("%R/info?name=%T",zName))%h(zName)</a></h2>
837 @
838
--- src/browse.c
+++ src/browse.c
@@ -732,13 +732,14 @@
732
733 /*
734 ** Look at all file containing in the version "vid". Construct a
735 ** temporary table named "fileage" that contains the file-id for each
736 ** files, the pathname, the check-in where the file was added, and the
737 ** mtime on that checkin. If zGlob is not NULL then only files
738 ** matching the given glob are computed.
739 */
740 int compute_fileage(int vid, char const * zGlob){
741 Manifest *pManifest;
742 ManifestFile *pFile;
743 int nFile = 0;
744 double vmtime;
745 Stmt ins;
@@ -760,10 +761,11 @@
761 db_prepare(&ins,
762 "INSERT INTO temp.fileage(fid, pathname)"
763 " SELECT rid, :path FROM blob WHERE uuid=:uuid"
764 );
765 while( (pFile = manifest_file_next(pManifest, 0))!=0 ){
766 if(zGlob && !strglob(zGlob, pFile->zName)) continue;
767 db_bind_text(&ins, ":uuid", pFile->zUuid);
768 db_bind_text(&ins, ":path", pFile->zName);
769 db_step(&ins);
770 db_reset(&ins);
771 nFile++;
@@ -807,20 +809,22 @@
809
810 /*
811 ** WEBPAGE: fileage
812 **
813 ** Parameters:
814 ** name=VERSION Selects the checkin version (default=tip).
815 ** glob=STRING Only shows files matching this glob pattern
816 ** (e.g. *.c or *.txt).
817 */
818 void fileage_page(void){
819 int rid;
820 const char *zName;
821 char *zBaseTime;
822 char const * zGlob;
823 Stmt q;
824 double baseTime;
825 int lastMid = -1;
 
826 login_check_credentials();
827 if( !g.perm.Read ){ login_needed(); return; }
828 zName = P("name");
829 if( zName==0 ) zName = "tip";
830 rid = symbolic_name_to_rid(zName, "ci");
@@ -827,11 +831,13 @@
831 if( rid==0 ){
832 fossil_fatal("not a valid check-in: %s", zName);
833 }
834 style_submenu_element("Tree-View", "Tree-View", "%R/tree?ci=%T", zName);
835 style_header("File Ages", zName);
836 zGlob = P("glob");
837 if(zGlob && !*zGlob) zGlob = NULL;
838 compute_fileage(rid,zGlob);
839 baseTime = db_double(0.0, "SELECT mtime FROM event WHERE objid=%d", rid);
840 zBaseTime = db_text("","SELECT datetime(%.20g%s)", baseTime, timeline_utc());
841 @ <h2>File Ages For Check-in
842 @ %z(href("%R/info?name=%T",zName))%h(zName)</a></h2>
843 @
844

Keyboard Shortcuts

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