Many hyperlinks are disabled.
Use anonymous login
to enable hyperlinks.
Overview
| Comment: | Merge the latest trunk changes into windows-i18n branch. |
|---|---|
| Downloads: | Tarball | ZIP archive |
| Timelines: | family | ancestors | descendants | both | windows-i18n |
| Files: | files | file ages | folders |
| SHA1: |
59ddd3c8ae134f41fd775c7ba7946452 |
| User & Date: | drh 2011-05-06 16:55:07.916 |
Context
|
2011-05-07
| ||
| 11:42 | Convert the fopen() in blob_write_to_file() into fossil_fopen(). ... (check-in: 4373976553 user: drh tags: windows-i18n) | |
|
2011-05-06
| ||
| 16:55 | Merge the latest trunk changes into windows-i18n branch. ... (check-in: 59ddd3c8ae user: drh tags: windows-i18n) | |
| 16:44 | Show the artifact numbers on the From and To of a file diff. ... (check-in: 9a63d1f048 user: drh tags: trunk) | |
|
2011-05-04
| ||
| 11:16 | Merge the latest changes from trunk. ... (check-in: 503a0ef555 user: drh tags: windows-i18n) | |
Changes
Changes to src/branch.c.
| ︙ | ︙ | |||
274 275 276 277 278 279 280 | @ closed leaves</a></div>. @ Closed branches are fixed and do not change (unless they are first @ reopened)</li> @ </ol> style_sidebox_end(); cnt = 0; | > | > > > > > > > > > > > > | | | | | | | > | 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 |
@ closed leaves</a></div>.
@ Closed branches are fixed and do not change (unless they are first
@ reopened)</li>
@ </ol>
style_sidebox_end();
cnt = 0;
if( showClosed ){
db_prepare(&q,
"SELECT value FROM tagxref"
" WHERE tagid=%d AND value NOT NULL "
"EXCEPT "
"SELECT value FROM tagxref"
" WHERE tagid=%d"
" AND rid IN leaf"
" AND NOT %z"
" ORDER BY value /*sort*/",
TAG_BRANCH, TAG_BRANCH, leaf_is_closed_sql("tagxref.rid")
);
}else{
db_prepare(&q,
"SELECT DISTINCT value FROM tagxref"
" WHERE tagid=%d AND value NOT NULL"
" AND rid IN leaf"
" AND NOT %z"
" ORDER BY value /*sort*/",
TAG_BRANCH, leaf_is_closed_sql("tagxref.rid")
);
}
while( db_step(&q)==SQLITE_ROW ){
const char *zBr = db_column_text(&q, 0);
if( cnt==0 ){
if( showClosed ){
@ <h2>Closed Branches:</h2>
}else{
@ <h2>Open Branches:</h2>
|
| ︙ | ︙ |
Changes to src/diff.c.
| ︙ | ︙ | |||
624 625 626 627 628 629 630 |
/*
** The status of an annotation operation is recorded by an instance
** of the following structure.
*/
typedef struct Annotator Annotator;
struct Annotator {
DContext c; /* The diff-engine context */
| | | > > > > | 624 625 626 627 628 629 630 631 632 633 634 635 636 637 638 639 640 641 642 643 644 645 646 647 648 |
/*
** The status of an annotation operation is recorded by an instance
** of the following structure.
*/
typedef struct Annotator Annotator;
struct Annotator {
DContext c; /* The diff-engine context */
struct AnnLine { /* Lines of the original files... */
const char *z; /* The text of the line */
short int n; /* Number of bytes (omitting trailing space and \n) */
short int iLevel; /* Level at which tag was set */
const char *zSrc; /* Tag showing origin of this line */
} *aOrig;
int nOrig; /* Number of elements in aOrig[] */
int nNoSrc; /* Number of entries where aOrig[].zSrc==NULL */
int iLevel; /* Current level */
int nVers; /* Number of versions analyzed */
char **azVers; /* Names of versions analyzed */
};
/*
** Initialize the annotation process by specifying the file that is
** to be annotated. The annotator takes control of the input Blob and
** will release it when it is finished with it.
*/
|
| ︙ | ︙ | |||
666 667 668 669 670 671 672 673 674 675 676 677 678 679 680 681 682 683 684 685 686 687 688 |
** if additional annotation is required. zPName is the tag to insert
** on each line of the file being annotated that was contributed by
** pParent. Memory to hold zPName is leaked.
*/
static int annotation_step(Annotator *p, Blob *pParent, char *zPName){
int i, j;
int lnTo;
/* Prepare the parent file to be diffed */
p->c.aFrom = break_into_lines(blob_str(pParent), blob_size(pParent),
&p->c.nFrom, 1);
if( p->c.aFrom==0 ){
return 1;
}
/* Compute the differences going from pParent to the file being
** annotated. */
diff_all(&p->c);
/* Where new lines are inserted on this difference, record the
** zPName as the source of the new line.
*/
for(i=lnTo=0; i<p->c.nEdit; i+=3){
| > > > > > > | > | > > | 670 671 672 673 674 675 676 677 678 679 680 681 682 683 684 685 686 687 688 689 690 691 692 693 694 695 696 697 698 699 700 701 702 703 704 705 706 707 708 709 710 |
** if additional annotation is required. zPName is the tag to insert
** on each line of the file being annotated that was contributed by
** pParent. Memory to hold zPName is leaked.
*/
static int annotation_step(Annotator *p, Blob *pParent, char *zPName){
int i, j;
int lnTo;
int iPrevLevel;
int iThisLevel;
/* Prepare the parent file to be diffed */
p->c.aFrom = break_into_lines(blob_str(pParent), blob_size(pParent),
&p->c.nFrom, 1);
if( p->c.aFrom==0 ){
return 1;
}
/* Compute the differences going from pParent to the file being
** annotated. */
diff_all(&p->c);
/* Where new lines are inserted on this difference, record the
** zPName as the source of the new line.
*/
iPrevLevel = p->iLevel;
p->iLevel++;
iThisLevel = p->iLevel;
for(i=lnTo=0; i<p->c.nEdit; i+=3){
struct AnnLine *x = &p->aOrig[lnTo];
for(j=0; j<p->c.aEdit[i]; j++, lnTo++, x++){
if( x->zSrc==0 || x->iLevel==iPrevLevel ){
x->zSrc = zPName;
x->iLevel = iThisLevel;
}
}
lnTo += p->c.aEdit[i+2];
}
/* Clear out the diff results */
free(p->c.aEdit);
p->c.aEdit = 0;
|
| ︙ | ︙ | |||
737 738 739 740 741 742 743 | } /* ** Compute a complete annotation on a file. The file is identified ** by its filename number (filename.fnid) and the baseline in which ** it was checked in (mlink.mid). */ | | > > > > > > | 750 751 752 753 754 755 756 757 758 759 760 761 762 763 764 765 766 767 768 769 770 |
}
/*
** Compute a complete annotation on a file. The file is identified
** by its filename number (filename.fnid) and the baseline in which
** it was checked in (mlink.mid).
*/
static void annotate_file(
Annotator *p, /* The annotator */
int fnid, /* The name of the file to be annotated */
int mid, /* The specific version of the file for this step */
int webLabel, /* Use web-style annotations if true */
int iLimit /* Limit the number of levels if greater than zero */
){
Blob toAnnotate; /* Text of the final version of the file */
Blob step; /* Text of previous revision */
int rid; /* Artifact ID of the file being annotated */
char *zLabel; /* Label to apply to a line */
Stmt q; /* Query returning all ancestor versions */
/* Initialize the annotation */
|
| ︙ | ︙ | |||
764 765 766 767 768 769 770 |
"SELECT mlink.fid, blob.uuid, date(event.mtime), "
" coalesce(event.euser,event.user) "
" FROM mlink, blob, event"
" WHERE mlink.fnid=%d"
" AND mlink.mid IN ok"
" AND blob.rid=mlink.mid"
" AND event.objid=mlink.mid"
| | > | > > > > > > | > > > > > > > > > > > > > > > > > > > > > > | > > > > > > | 783 784 785 786 787 788 789 790 791 792 793 794 795 796 797 798 799 800 801 802 803 804 805 806 807 808 809 810 811 812 813 814 815 816 817 818 819 820 821 822 823 824 825 826 827 828 829 830 831 832 833 834 835 836 837 838 839 840 841 842 843 844 845 846 847 848 849 850 851 852 853 854 855 856 857 858 859 860 861 862 863 864 865 866 867 868 869 870 871 872 873 874 875 876 877 878 879 880 881 882 883 884 885 886 887 888 889 890 891 892 893 894 895 896 897 898 899 900 901 902 903 904 905 906 907 908 909 910 911 912 913 914 915 916 917 918 919 920 921 |
"SELECT mlink.fid, blob.uuid, date(event.mtime), "
" coalesce(event.euser,event.user) "
" FROM mlink, blob, event"
" WHERE mlink.fnid=%d"
" AND mlink.mid IN ok"
" AND blob.rid=mlink.mid"
" AND event.objid=mlink.mid"
" ORDER BY event.mtime DESC"
" LIMIT %d",
fnid,
iLimit>0 ? iLimit : 10000000
);
while( db_step(&q)==SQLITE_ROW ){
int pid = db_column_int(&q, 0);
const char *zUuid = db_column_text(&q, 1);
const char *zDate = db_column_text(&q, 2);
const char *zUser = db_column_text(&q, 3);
if( webLabel ){
zLabel = mprintf(
"<a href='%s/info/%s' target='infowindow'>%.10s</a> %s %9.9s",
g.zTop, zUuid, zUuid, zDate, zUser
);
}else{
zLabel = mprintf("%.10s %s %9.9s", zUuid, zDate, zUser);
}
p->nVers++;
p->azVers = fossil_realloc(p->azVers, p->nVers*sizeof(p->azVers[0]) );
p->azVers[p->nVers-1] = zLabel;
content_get(pid, &step);
annotation_step(p, &step, zLabel);
blob_reset(&step);
}
db_finalize(&q);
}
/*
** WEBPAGE: annotate
**
** Query parameters:
**
** checkin=ID The manifest ID at which to start the annotation
** filename=FILENAME The filename.
*/
void annotation_page(void){
int mid;
int fnid;
int i;
int iLimit;
Annotator ann;
login_check_credentials();
if( !g.okRead ){ login_needed(); return; }
mid = name_to_rid(PD("checkin","0"));
fnid = db_int(0, "SELECT fnid FROM filename WHERE name=%Q", P("filename"));
if( mid==0 || fnid==0 ){ fossil_redirect_home(); }
iLimit = atoi(PD("limit","-1"));
if( !db_exists("SELECT 1 FROM mlink WHERE mid=%d AND fnid=%d",mid,fnid) ){
fossil_redirect_home();
}
style_header("File Annotation");
annotate_file(&ann, fnid, mid, g.okHistory, iLimit);
if( P("log") ){
int i;
@ <h2>Versions analyzed:</h2>
@ <ol>
for(i=0; i<ann.nVers; i++){
@ <li><tt>%s(ann.azVers[i])</tt></li>
}
@ </ol>
@ <hr>
@ <h2>Annotation:</h2>
}
@ <pre>
for(i=0; i<ann.nOrig; i++){
((char*)ann.aOrig[i].z)[ann.aOrig[i].n] = 0;
@ %s(ann.aOrig[i].zSrc): %h(ann.aOrig[i].z)
}
@ </pre>
style_footer();
}
/*
** COMMAND: annotate
**
** %fossil annotate FILENAME
**
** Output the text of a file with markings to show when each line of
** the file was last modified.
**
** Options:
** --limit N Only look backwards in time by N versions
** --log List all versions analyzed
*/
void annotate_cmd(void){
int fnid; /* Filename ID */
int fid; /* File instance ID */
int mid; /* Manifest where file was checked in */
Blob treename; /* FILENAME translated to canonical form */
char *zFilename; /* Cannonical filename */
Annotator ann; /* The annotation of the file */
int i; /* Loop counter */
const char *zLimit; /* The value to the --limit option */
int iLimit; /* How far back in time to look */
int showLog; /* True to show the log */
zLimit = find_option("limit",0,1);
if( zLimit==0 || zLimit[0]==0 ) zLimit = "-1";
iLimit = atoi(zLimit);
showLog = find_option("log",0,0)!=0;
db_must_be_within_tree();
if (g.argc<3) {
usage("FILENAME");
}
file_tree_name(g.argv[2], &treename, 1);
zFilename = blob_str(&treename);
fnid = db_int(0, "SELECT fnid FROM filename WHERE name=%Q", zFilename);
if( fnid==0 ){
fossil_fatal("no such file: %s", zFilename);
}
fid = db_int(0, "SELECT rid FROM vfile WHERE pathname=%Q", zFilename);
if( fid==0 ){
fossil_fatal("not part of current checkout: %s", zFilename);
}
mid = db_int(0, "SELECT mid FROM mlink WHERE fid=%d AND fnid=%d", fid, fnid);
if( mid==0 ){
fossil_panic("unable to find manifest");
}
annotate_file(&ann, fnid, mid, 0, iLimit);
if( showLog ){
for(i=0; i<ann.nVers; i++){
printf("version %3d: %s\n", i+1, ann.azVers[i]);
}
printf("---------------------------------------------------\n");
}
for(i=0; i<ann.nOrig; i++){
fossil_print("%s: %.*s\n",
ann.aOrig[i].zSrc, ann.aOrig[i].n, ann.aOrig[i].z);
}
}
|
Changes to src/info.c.
| ︙ | ︙ | |||
947 948 949 950 951 952 953 954 955 956 957 958 959 960 961 962 963 964 965 966 967 968 969 970 971 972 973 974 975 976 |
** difference between the two artifacts. Generate plaintext if "patch"
** is present.
*/
void diff_page(void){
int v1, v2;
int isPatch;
Blob c1, c2, diff, *pOut;
login_check_credentials();
if( !g.okRead ){ login_needed(); return; }
v1 = name_to_rid_www("v1");
v2 = name_to_rid_www("v2");
if( v1==0 || v2==0 ) fossil_redirect_home();
isPatch = P("patch")!=0;
if( isPatch ){
pOut = cgi_output_blob();
cgi_set_content_type("text/plain");
}else{
blob_zero(&diff);
pOut = &diff;
}
content_get(v1, &c1);
content_get(v2, &c2);
text_diff(&c1, &c2, pOut, 4, 1);
blob_reset(&c1);
blob_reset(&c2);
if( !isPatch ){
style_header("Diff");
style_submenu_element("Patch", "Patch", "%s/fdiff?v1=%T&v2=%T&patch",
g.zTop, P("v1"), P("v2"));
| > > > > | > | | 947 948 949 950 951 952 953 954 955 956 957 958 959 960 961 962 963 964 965 966 967 968 969 970 971 972 973 974 975 976 977 978 979 980 981 982 983 984 985 986 987 988 989 990 991 992 993 |
** difference between the two artifacts. Generate plaintext if "patch"
** is present.
*/
void diff_page(void){
int v1, v2;
int isPatch;
Blob c1, c2, diff, *pOut;
char *zV1;
char *zV2;
login_check_credentials();
if( !g.okRead ){ login_needed(); return; }
v1 = name_to_rid_www("v1");
v2 = name_to_rid_www("v2");
if( v1==0 || v2==0 ) fossil_redirect_home();
zV1 = db_text(0, "SELECT uuid FROM blob WHERE rid=%d", v1);
zV2 = db_text(0, "SELECT uuid FROM blob WHERE rid=%d", v2);
isPatch = P("patch")!=0;
if( isPatch ){
pOut = cgi_output_blob();
cgi_set_content_type("text/plain");
}else{
blob_zero(&diff);
pOut = &diff;
}
content_get(v1, &c1);
content_get(v2, &c2);
text_diff(&c1, &c2, pOut, 4, 1);
blob_reset(&c1);
blob_reset(&c2);
if( !isPatch ){
style_header("Diff");
style_submenu_element("Patch", "Patch", "%s/fdiff?v1=%T&v2=%T&patch",
g.zTop, P("v1"), P("v2"));
@ <h2>Differences From
@ Artifact <a href="%s(g.zTop)/artifact/%S(zV1)">[%S(zV1)]</a>:</h2>
@ <blockquote><p>
object_description(v1, 1, 0);
@ </p></blockquote>
@ <h2>To Artifact <a href="%s(g.zTop)/artifact/%S(zV2)">[%S(zV2)]</a>:</h2>
@ <blockquote><p>
object_description(v2, 1, 0);
@ </p></blockquote>
@ <hr />
@ <blockquote><pre>
@ %h(blob_str(&diff))
@ </pre></blockquote>
|
| ︙ | ︙ |
Changes to src/vfile.c.
| ︙ | ︙ | |||
299 300 301 302 303 304 305 |
** In other words, check to see if directory pPath contains a file named
** "_FOSSIL_" or ".fos". Return true or false.
*/
int vfile_top_of_checkout(const char *zPath){
char *zFile;
int fileFound = 0;
| | | | 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 |
** In other words, check to see if directory pPath contains a file named
** "_FOSSIL_" or ".fos". Return true or false.
*/
int vfile_top_of_checkout(const char *zPath){
char *zFile;
int fileFound = 0;
zFile = mprintf("%s/_FOSSIL_", zPath);
fileFound = file_size(zFile)>=1024;
fossil_free(zFile);
if( !fileFound ){
zFile = mprintf("%s/.fos", zPath);
fileFound = file_size(zFile)>=1024;
fossil_free(zFile);
}
return fileFound;
}
|
| ︙ | ︙ |