[fossil-users] History for a particular file

2009-10-20 Thread Venkat Iyer

In src/info.c, just before the finfo_page, add this code
below.  Then 

fossil finfo   

Gives you the change history for a file.  This is my first attempt at
doing anything inside fossil.  Suggestions welcome.

 - Venks

/*
** COMMAND: finfo FILENAME
** 
** Print the complete change history for a single file.
*/

void finfo_cmd(void){
  Stmt q;
  int vid;
  Blob dest;
  const char *zFilename;

  db_must_be_within_tree();
  vid = db_lget_int("checkout", 0);
  if( vid==0 ){
fossil_panic("no checkout to finfo files in");
  }
  if (g.argc<3) {
  usage("FILENAME");
  }
  file_tree_name(g.argv[2], &dest, 1);
  zFilename = blob_str(&dest);
  db_prepare(&q,
"SELECT substr(b.uuid,1,10), datetime(event.mtime,'localtime'),"
"   coalesce(event.ecomment, event.comment),"
"   coalesce(event.euser, event.user),"
"   mlink.pid, mlink.fid, mlink.mid, mlink.fnid, ci.uuid"
"  FROM mlink, blob b, event, blob ci"
" WHERE mlink.fnid=(SELECT fnid FROM filename WHERE name=%Q)"
"   AND b.rid=mlink.fid"
"   AND event.objid=mlink.mid"
"   AND event.objid=ci.rid"
" ORDER BY event.mtime DESC",
zFilename
  );

  printf("History of %s\n", zFilename);
  while( db_step(&q)==SQLITE_ROW ){
const char *zUuid = db_column_text(&q, 0);
const char *zDate = db_column_text(&q, 1);
const char *zCom = db_column_text(&q, 2);
const char *zUser = db_column_text(&q, 3);
printf("Ver %.10s by %.10s on %.10s: %s\n", zUuid, zUser, zDate, zCom );
  }
  db_finalize(&q);
  blob_reset(&dest);
}


___
fossil-users mailing list
fossil-users@lists.fossil-scm.org
http://lists.fossil-scm.org:8080/cgi-bin/mailman/listinfo/fossil-users


Re: [fossil-users] History for a particular file

2009-10-20 Thread D. Richard Hipp

On Oct 20, 2009, at 7:46 PM, Venkat Iyer wrote:
>  while( db_step(&q)==SQLITE_ROW ){
>const char *zUuid = db_column_text(&q, 0);
>const char *zDate = db_column_text(&q, 1);
>const char *zCom = db_column_text(&q, 2);
>const char *zUser = db_column_text(&q, 3);
>printf("Ver %.10s by %.10s on %.10s: %s\n", zUuid, zUser, zDate,  
> zCom );
>  }


Consider using the comment_print() function located in comformat.c in  
order to wrap the lines of output to no more than 79 characters per  
line.

D. Richard Hipp
d...@hwaci.com



___
fossil-users mailing list
fossil-users@lists.fossil-scm.org
http://lists.fossil-scm.org:8080/cgi-bin/mailman/listinfo/fossil-users


Re: [fossil-users] History for a particular file

2009-10-20 Thread Venkat Iyer

Thanks.  Naively:

  while( db_step(&q)==SQLITE_ROW ){
Blob line;
const char *zUuid = db_column_text(&q, 0);
const char *zDate = db_column_text(&q, 1);
const char *zCom = db_column_text(&q, 2);
const char *zUser = db_column_text(&q, 3);
blob_zero(&line);
blob_appendf(&line, "%.10s by %.10s on %.10s: %s\n", zUuid, zUser, zDate, 
zCom);
comment_print(blob_str(&line), 4, 72);
blob_reset(&line);
  }

 - Venkat

On Oct 20, 2009, at 7:46 PM, Venkat Iyer wrote:
>  while( db_step(&q)==SQLITE_ROW ){
>const char *zUuid = db_column_text(&q, 0);
>const char *zDate = db_column_text(&q, 1);
>const char *zCom = db_column_text(&q, 2);
>const char *zUser = db_column_text(&q, 3);
>printf("Ver %.10s by %.10s on %.10s: %s\n", zUuid, zUser, zDate,  
> zCom );
>  }


Consider using the comment_print() function located in comformat.c in  
order to wrap the lines of output to no more than 79 characters per  
line.

D. Richard Hipp
d...@hwaci.com



___
fossil-users mailing list
fossil-users@lists.fossil-scm.org
http://lists.fossil-scm.org:8080/cgi-bin/mailman/listinfo/fossil-users



___
fossil-users mailing list
fossil-users@lists.fossil-scm.org
http://lists.fossil-scm.org:8080/cgi-bin/mailman/listinfo/fossil-users


Re: [fossil-users] History for a particular file

2009-10-20 Thread Altu Faltu
Hi Venkat,

This is very helpful. Are you planning to commit it?

- Altu

> - Original Message -
> From: "Venkat Iyer" 
> To: fossil-users@lists.fossil-scm.org
> Subject: Re: [fossil-users] History for a particular file
> Date: Tue, 20 Oct 2009 18:09:42 -0700
> 
> 
> 
> Thanks.  Naively:
> 
>while( db_step(&q)==SQLITE_ROW ){
>  Blob line;
>  const char *zUuid = db_column_text(&q, 0);
>  const char *zDate = db_column_text(&q, 1);
>  const char *zCom = db_column_text(&q, 2);
>  const char *zUser = db_column_text(&q, 3);
>  blob_zero(&line);
>  blob_appendf(&line, "%.10s by %.10s on %.10s: %s\n", zUuid, 
> zUser, zDate, zCom);
>  comment_print(blob_str(&line), 4, 72);
>  blob_reset(&line);
>}
> 
>   - Venkat
> 
> On Oct 20, 2009, at 7:46 PM, Venkat Iyer wrote:
> >  while( db_step(&q)==SQLITE_ROW ){
> >const char *zUuid = db_column_text(&q, 0);
> >const char *zDate = db_column_text(&q, 1);
> >const char *zCom = db_column_text(&q, 2);
> >const char *zUser = db_column_text(&q, 3);
> >printf("Ver %.10s by %.10s on %.10s: %s\n", zUuid, zUser, zDate,  zCom );
> >  }
> 
> 
> Consider using the comment_print() function located in comformat.c in
> order to wrap the lines of output to no more than 79 characters per
> line.
> 
> D. Richard Hipp
> d...@hwaci.com
> 
> 
> 
> ___
> fossil-users mailing list
> fossil-users@lists.fossil-scm.org
> http://lists.fossil-scm.org:8080/cgi-bin/mailman/listinfo/fossil-users
> 
> 
> 
> ___
> fossil-users mailing list
> fossil-users@lists.fossil-scm.org
> http://lists.fossil-scm.org:8080/cgi-bin/mailman/listinfo/fossil-users

>


-- 
Be Yourself @ mail.com!
Choose From 200+ Email Addresses
Get a Free Account at www.mail.com!

___
fossil-users mailing list
fossil-users@lists.fossil-scm.org
http://lists.fossil-scm.org:8080/cgi-bin/mailman/listinfo/fossil-users


Re: [fossil-users] History for a particular file

2009-10-21 Thread Joshua Paine
I would like to see this feature in fossil. How does an enhancement like
this make its way into the main codebase?

-- 
Joshua Paine  
LetterBlock: Web applications built with joy  
http://letterblock.com/  
301-576-1920

___
fossil-users mailing list
fossil-users@lists.fossil-scm.org
http://lists.fossil-scm.org:8080/cgi-bin/mailman/listinfo/fossil-users


Re: [fossil-users] History for a particular file

2009-10-21 Thread Stephan Beal
On Wed, Oct 21, 2009 at 3:09 AM, Venkat Iyer  wrote:

A tiny optimization suggestion:

 Blob line; while( db_step(&q)==SQLITE_ROW ){
> ... as before...
>
}

blob_reset(&line);


i believe that will avoid re-allocating the buffer string on each loop
iteration (it will only need to allocate on the first iteration and on
iterations where the output is larger than any previous iteration).

That is, if i remember the internals of Blob correctly.

-- 
- stephan beal
http://wanderinghorse.net/home/stephan/
___
fossil-users mailing list
fossil-users@lists.fossil-scm.org
http://lists.fossil-scm.org:8080/cgi-bin/mailman/listinfo/fossil-users


Re: [fossil-users] History for a particular file

2009-10-27 Thread Venkat Iyer


I am not sure how to get it in, and if it's even worthy of getting in.
I made some mods.

  1. add help
  2. add -l option (for brief and verbose histories)
  3. report error for unknown files.

I'm not sure if I should pollute this list with code examples.  So I
moved it to:

 http://tinyurl.com/ylpr8zw

which is really:

 http://venksi.blogspot.com/2009/10/i-evaled-bunch-of-distributed-version.html

I'm working on trying to integrate fossil into emacs vc.

 - Venkat


-Original Message-
From: Joshua Paine 
Sent: Wednesday, October 21, 2009 10:49:19
Subject: Re: [fossil-users] History for a particular file

I would like to see this feature in fossil. How does an enhancement like
this make its way into the main codebase?


___
fossil-users mailing list
fossil-users@lists.fossil-scm.org
http://lists.fossil-scm.org:8080/cgi-bin/mailman/listinfo/fossil-users


Re: [fossil-users] History for a particular file

2009-10-28 Thread altufaltu
Hi DRH,


Shall I commit these changes?


- Altu


-Original Message-
From: Venkat Iyer 
To: fossil-users@lists.fossil-scm.org
Sent: Wed, Oct 28, 2009 11:48 am
Subject: Re: [fossil-users] History for a particular file









I am not sure how to get it in, and if it's even worthy of getting in.
I made some mods.

  1. add help
  2. add -l option (for brief and verbose histories)
  3. report error for unknown files.

I'm not sure if I should pollute this list with code examples.  So I
moved it to:

 http://tinyurl.com/ylpr8zw

which is really:

 http://venksi.blogspot.com/2009/10/i-evaled-bunch-of-distributed-version.html

I'm working on trying to integrate fossil into emacs vc.

 - Venkat


-Original Message-
From: Joshua Paine 
Sent: Wednesday, October 21, 2009 10:49:19
Subject: Re: [fossil-users] History for a particular file

I would like to see this feature in fossil. How does an enhancement like
this make its way into the main codebase?


___
fossil-users mailing list
fossil-users@lists.fossil-scm.org
http://lists.fossil-scm.org:8080/cgi-bin/mailman/listinfo/fossil-users


 




___
fossil-users mailing list
fossil-users@lists.fossil-scm.org
http://lists.fossil-scm.org:8080/cgi-bin/mailman/listinfo/fossil-users