Fossil SCM

Merge the root-tag branch into trunk.

drh 2012-07-14 16:51 trunk merge
Commit 9f83e033a2304a95eae85a1676cc78ea21370fa1
--- src/diffcmd.c
+++ src/diffcmd.c
@@ -481,10 +481,11 @@
481481
**
482482
** The "-N" or "--new-file" option causes the complete text of added or
483483
** deleted files to be displayed.
484484
**
485485
** Options:
486
+** --branch BRANCH Show diff of all changes on BRANCH
486487
** --brief Show filenames only
487488
** --context|-c N Use N lines of context
488489
** --from|-r VERSION select VERSION as source for the diff
489490
** -i use internal diff logic
490491
** --new-file|-N output complete text of added or deleted files
@@ -496,22 +497,31 @@
496497
int isGDiff; /* True for gdiff. False for normal diff */
497498
int isInternDiff; /* True for internal diff */
498499
int hasNFlag; /* True if -N or --new-file flag is used */
499500
const char *zFrom; /* Source version number */
500501
const char *zTo; /* Target version number */
502
+ const char *zBranch; /* Branch to diff */
501503
const char *zDiffCmd = 0; /* External diff command. NULL for internal diff */
502504
int diffFlags = 0; /* Flags to control the DIFF */
503505
int f;
504506
505507
isGDiff = g.argv[1][0]=='g';
506508
isInternDiff = find_option("internal","i",0)!=0;
507509
zFrom = find_option("from", "r", 1);
508510
zTo = find_option("to", 0, 1);
511
+ zBranch = find_option("branch", 0, 1);
509512
diffFlags = diff_options();
510513
hasNFlag = find_option("new-file","N",0)!=0;
511514
if( hasNFlag ) diffFlags |= DIFF_NEWFILE;
512515
516
+ if( zBranch ){
517
+ if( zTo || zFrom ){
518
+ fossil_fatal("cannot use --from or --to with --branch");
519
+ }
520
+ zTo = zBranch;
521
+ zFrom = mprintf("root:%s", zBranch);
522
+ }
513523
if( zTo==0 ){
514524
db_must_be_within_tree();
515525
verify_all_options();
516526
if( !isInternDiff ){
517527
zDiffCmd = db_get(isGDiff ? "gdiff-command" : "diff-command", 0);
518528
--- src/diffcmd.c
+++ src/diffcmd.c
@@ -481,10 +481,11 @@
481 **
482 ** The "-N" or "--new-file" option causes the complete text of added or
483 ** deleted files to be displayed.
484 **
485 ** Options:
 
486 ** --brief Show filenames only
487 ** --context|-c N Use N lines of context
488 ** --from|-r VERSION select VERSION as source for the diff
489 ** -i use internal diff logic
490 ** --new-file|-N output complete text of added or deleted files
@@ -496,22 +497,31 @@
496 int isGDiff; /* True for gdiff. False for normal diff */
497 int isInternDiff; /* True for internal diff */
498 int hasNFlag; /* True if -N or --new-file flag is used */
499 const char *zFrom; /* Source version number */
500 const char *zTo; /* Target version number */
 
501 const char *zDiffCmd = 0; /* External diff command. NULL for internal diff */
502 int diffFlags = 0; /* Flags to control the DIFF */
503 int f;
504
505 isGDiff = g.argv[1][0]=='g';
506 isInternDiff = find_option("internal","i",0)!=0;
507 zFrom = find_option("from", "r", 1);
508 zTo = find_option("to", 0, 1);
 
509 diffFlags = diff_options();
510 hasNFlag = find_option("new-file","N",0)!=0;
511 if( hasNFlag ) diffFlags |= DIFF_NEWFILE;
512
 
 
 
 
 
 
 
513 if( zTo==0 ){
514 db_must_be_within_tree();
515 verify_all_options();
516 if( !isInternDiff ){
517 zDiffCmd = db_get(isGDiff ? "gdiff-command" : "diff-command", 0);
518
--- src/diffcmd.c
+++ src/diffcmd.c
@@ -481,10 +481,11 @@
481 **
482 ** The "-N" or "--new-file" option causes the complete text of added or
483 ** deleted files to be displayed.
484 **
485 ** Options:
486 ** --branch BRANCH Show diff of all changes on BRANCH
487 ** --brief Show filenames only
488 ** --context|-c N Use N lines of context
489 ** --from|-r VERSION select VERSION as source for the diff
490 ** -i use internal diff logic
491 ** --new-file|-N output complete text of added or deleted files
@@ -496,22 +497,31 @@
497 int isGDiff; /* True for gdiff. False for normal diff */
498 int isInternDiff; /* True for internal diff */
499 int hasNFlag; /* True if -N or --new-file flag is used */
500 const char *zFrom; /* Source version number */
501 const char *zTo; /* Target version number */
502 const char *zBranch; /* Branch to diff */
503 const char *zDiffCmd = 0; /* External diff command. NULL for internal diff */
504 int diffFlags = 0; /* Flags to control the DIFF */
505 int f;
506
507 isGDiff = g.argv[1][0]=='g';
508 isInternDiff = find_option("internal","i",0)!=0;
509 zFrom = find_option("from", "r", 1);
510 zTo = find_option("to", 0, 1);
511 zBranch = find_option("branch", 0, 1);
512 diffFlags = diff_options();
513 hasNFlag = find_option("new-file","N",0)!=0;
514 if( hasNFlag ) diffFlags |= DIFF_NEWFILE;
515
516 if( zBranch ){
517 if( zTo || zFrom ){
518 fossil_fatal("cannot use --from or --to with --branch");
519 }
520 zTo = zBranch;
521 zFrom = mprintf("root:%s", zBranch);
522 }
523 if( zTo==0 ){
524 db_must_be_within_tree();
525 verify_all_options();
526 if( !isInternDiff ){
527 zDiffCmd = db_get(isGDiff ? "gdiff-command" : "diff-command", 0);
528
+14 -3
--- src/info.c
+++ src/info.c
@@ -754,11 +754,16 @@
754754
static Manifest *vdiff_parse_manifest(const char *zParam, int *pRid){
755755
int rid;
756756
757757
*pRid = rid = name_to_rid_www(zParam);
758758
if( rid==0 ){
759
- webpage_error("Missing \"%s\" query parameter.", zParam);
759
+ const char *z = P(zParam);
760
+ if( z==0 || z[0]==0 ){
761
+ webpage_error("Missing \"%s\" query parameter.", zParam);
762
+ }else{
763
+ webpage_error("No such artifact: \"%s\"", z);
764
+ }
760765
return 0;
761766
}
762767
if( !is_a_version(rid) ){
763768
webpage_error("Artifact %s is not a checkin.", P(zParam));
764769
return 0;
@@ -805,19 +810,25 @@
805810
int showDetail = 0;
806811
int sideBySide = 0;
807812
int diffFlags = 0;
808813
Manifest *pFrom, *pTo;
809814
ManifestFile *pFileFrom, *pFileTo;
815
+ const char *zBranch;
810816
811817
login_check_credentials();
812818
if( !g.perm.Read ){ login_needed(); return; }
813819
login_anonymous_available();
814820
815
- pFrom = vdiff_parse_manifest("from", &ridFrom);
816
- if( pFrom==0 ) return;
821
+ zBranch = P("branch");
822
+ if( zBranch && zBranch[0] ){
823
+ cgi_replace_parameter("from", mprintf("root:%s", zBranch));
824
+ cgi_replace_parameter("to", zBranch);
825
+ }
817826
pTo = vdiff_parse_manifest("to", &ridTo);
818827
if( pTo==0 ) return;
828
+ pFrom = vdiff_parse_manifest("from", &ridFrom);
829
+ if( pFrom==0 ) return;
819830
sideBySide = atoi(PD("sbs","1"));
820831
showDetail = atoi(PD("detail","0"));
821832
if( !showDetail && sideBySide ) showDetail = 1;
822833
if( !sideBySide ){
823834
style_submenu_element("Side-by-side Diff", "sbsdiff",
824835
--- src/info.c
+++ src/info.c
@@ -754,11 +754,16 @@
754 static Manifest *vdiff_parse_manifest(const char *zParam, int *pRid){
755 int rid;
756
757 *pRid = rid = name_to_rid_www(zParam);
758 if( rid==0 ){
759 webpage_error("Missing \"%s\" query parameter.", zParam);
 
 
 
 
 
760 return 0;
761 }
762 if( !is_a_version(rid) ){
763 webpage_error("Artifact %s is not a checkin.", P(zParam));
764 return 0;
@@ -805,19 +810,25 @@
805 int showDetail = 0;
806 int sideBySide = 0;
807 int diffFlags = 0;
808 Manifest *pFrom, *pTo;
809 ManifestFile *pFileFrom, *pFileTo;
 
810
811 login_check_credentials();
812 if( !g.perm.Read ){ login_needed(); return; }
813 login_anonymous_available();
814
815 pFrom = vdiff_parse_manifest("from", &ridFrom);
816 if( pFrom==0 ) return;
 
 
 
817 pTo = vdiff_parse_manifest("to", &ridTo);
818 if( pTo==0 ) return;
 
 
819 sideBySide = atoi(PD("sbs","1"));
820 showDetail = atoi(PD("detail","0"));
821 if( !showDetail && sideBySide ) showDetail = 1;
822 if( !sideBySide ){
823 style_submenu_element("Side-by-side Diff", "sbsdiff",
824
--- src/info.c
+++ src/info.c
@@ -754,11 +754,16 @@
754 static Manifest *vdiff_parse_manifest(const char *zParam, int *pRid){
755 int rid;
756
757 *pRid = rid = name_to_rid_www(zParam);
758 if( rid==0 ){
759 const char *z = P(zParam);
760 if( z==0 || z[0]==0 ){
761 webpage_error("Missing \"%s\" query parameter.", zParam);
762 }else{
763 webpage_error("No such artifact: \"%s\"", z);
764 }
765 return 0;
766 }
767 if( !is_a_version(rid) ){
768 webpage_error("Artifact %s is not a checkin.", P(zParam));
769 return 0;
@@ -805,19 +810,25 @@
810 int showDetail = 0;
811 int sideBySide = 0;
812 int diffFlags = 0;
813 Manifest *pFrom, *pTo;
814 ManifestFile *pFileFrom, *pFileTo;
815 const char *zBranch;
816
817 login_check_credentials();
818 if( !g.perm.Read ){ login_needed(); return; }
819 login_anonymous_available();
820
821 zBranch = P("branch");
822 if( zBranch && zBranch[0] ){
823 cgi_replace_parameter("from", mprintf("root:%s", zBranch));
824 cgi_replace_parameter("to", zBranch);
825 }
826 pTo = vdiff_parse_manifest("to", &ridTo);
827 if( pTo==0 ) return;
828 pFrom = vdiff_parse_manifest("from", &ridFrom);
829 if( pFrom==0 ) return;
830 sideBySide = atoi(PD("sbs","1"));
831 showDetail = atoi(PD("detail","0"));
832 if( !showDetail && sideBySide ) showDetail = 1;
833 if( !sideBySide ){
834 style_submenu_element("Side-by-side Diff", "sbsdiff",
835
+23
--- src/name.c
+++ src/name.c
@@ -152,10 +152,33 @@
152152
" AND event.objid=tagxref.rid "
153153
" AND event.type GLOB '%q'"
154154
" ORDER BY event.mtime DESC /*sort*/",
155155
&zTag[4], zType
156156
);
157
+ }
158
+
159
+ /* root:TAG -> The origin of the branch */
160
+ if( memcmp(zTag, "root:", 5)==0 ){
161
+ Stmt q;
162
+ int rc;
163
+ rid = symbolic_name_to_rid(zTag+5, zType);
164
+ db_prepare(&q,
165
+ "SELECT pid, EXISTS(SELECT 1 FROM tagxref"
166
+ " WHERE tagid=%d AND tagtype>0"
167
+ " AND value=%Q AND rid=plink.pid)"
168
+ " FROM plink"
169
+ " WHERE cid=:cid AND isprim",
170
+ TAG_BRANCH, &zTag[5]
171
+ );
172
+ do{
173
+ db_reset(&q);
174
+ db_bind_int(&q, ":cid", rid);
175
+ rc = db_step(&q);
176
+ if( rc!=SQLITE_ROW ) break;
177
+ rid = db_column_int(&q, 0);
178
+ }while( db_column_int(&q, 1)==1 && rid>0 );
179
+ db_finalize(&q);
157180
return rid;
158181
}
159182
160183
/* symbolic-name ":" date-time */
161184
nTag = strlen(zTag);
162185
--- src/name.c
+++ src/name.c
@@ -152,10 +152,33 @@
152 " AND event.objid=tagxref.rid "
153 " AND event.type GLOB '%q'"
154 " ORDER BY event.mtime DESC /*sort*/",
155 &zTag[4], zType
156 );
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
157 return rid;
158 }
159
160 /* symbolic-name ":" date-time */
161 nTag = strlen(zTag);
162
--- src/name.c
+++ src/name.c
@@ -152,10 +152,33 @@
152 " AND event.objid=tagxref.rid "
153 " AND event.type GLOB '%q'"
154 " ORDER BY event.mtime DESC /*sort*/",
155 &zTag[4], zType
156 );
157 }
158
159 /* root:TAG -> The origin of the branch */
160 if( memcmp(zTag, "root:", 5)==0 ){
161 Stmt q;
162 int rc;
163 rid = symbolic_name_to_rid(zTag+5, zType);
164 db_prepare(&q,
165 "SELECT pid, EXISTS(SELECT 1 FROM tagxref"
166 " WHERE tagid=%d AND tagtype>0"
167 " AND value=%Q AND rid=plink.pid)"
168 " FROM plink"
169 " WHERE cid=:cid AND isprim",
170 TAG_BRANCH, &zTag[5]
171 );
172 do{
173 db_reset(&q);
174 db_bind_int(&q, ":cid", rid);
175 rc = db_step(&q);
176 if( rc!=SQLITE_ROW ) break;
177 rid = db_column_int(&q, 0);
178 }while( db_column_int(&q, 1)==1 && rid>0 );
179 db_finalize(&q);
180 return rid;
181 }
182
183 /* symbolic-name ":" date-time */
184 nTag = strlen(zTag);
185

Keyboard Shortcuts

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