Changes On Branch root-tag
Not logged in

Many hyperlinks are disabled.
Use anonymous login to enable hyperlinks.

Changes In Branch root-tag Excluding Merge-Ins

This is equivalent to a diff from 31545360ab to 36134ce275

2012-07-14
16:51
Merge the root-tag branch into trunk. check-in: 9f83e033a2 user: drh tags: trunk
11:40
Changes to the root-tag processing to provide better error messages. Closed-Leaf check-in: 36134ce275 user: drh tags: root-tag
05:03
Add the branch= query parameter to the vdiff page. check-in: 1879758718 user: drh tags: root-tag
04:43
Allow check-in specifications of the form "root:BRANCH" where BRANCH is a branch name. Such a spec refers to the point on the parent branch from which the branch is derived. Useful for doing a diff of an entire branch, for example, using "fossil diff --from root:xyz --to xyz". check-in: a4e01221c8 user: drh tags: root-tag
00:20
added th1 query API. check-in: c3b10e12a1 user: stephan tags: th1-query-api
2012-07-13
20:52
minor formatting fix. check-in: 31545360ab user: stephan tags: trunk
18:55
minor doc correction. check-in: 5df13a0b38 user: stephan tags: trunk

Changes to src/diffcmd.c.

   479    479   ** the "setting" command.  If no external diff program is configured, then
   480    480   ** the "-i" option is a no-op.  The "-i" option converts "gdiff" into "diff".
   481    481   **
   482    482   ** The "-N" or "--new-file" option causes the complete text of added or
   483    483   ** deleted files to be displayed.
   484    484   **
   485    485   ** Options:
          486  +**   --branch BRANCH     Show diff of all changes on BRANCH
   486    487   **   --brief             Show filenames only
   487    488   **   --context|-c N      Use N lines of context 
   488    489   **   --from|-r VERSION   select VERSION as source for the diff
   489    490   **   -i                  use internal diff logic
   490    491   **   --new-file|-N       output complete text of added or deleted files
   491    492   **   --to VERSION        select VERSION as target for the diff
   492    493   **   --side-by-side|-y   side-by-side diff
................................................................................
   494    495   */
   495    496   void diff_cmd(void){
   496    497     int isGDiff;               /* True for gdiff.  False for normal diff */
   497    498     int isInternDiff;          /* True for internal diff */
   498    499     int hasNFlag;              /* True if -N or --new-file flag is used */
   499    500     const char *zFrom;         /* Source version number */
   500    501     const char *zTo;           /* Target version number */
          502  +  const char *zBranch;       /* Branch to diff */
   501    503     const char *zDiffCmd = 0;  /* External diff command. NULL for internal diff */
   502    504     int diffFlags = 0;         /* Flags to control the DIFF */
   503    505     int f;
   504    506   
   505    507     isGDiff = g.argv[1][0]=='g';
   506    508     isInternDiff = find_option("internal","i",0)!=0;
   507    509     zFrom = find_option("from", "r", 1);
   508    510     zTo = find_option("to", 0, 1);
          511  +  zBranch = find_option("branch", 0, 1);
   509    512     diffFlags = diff_options();
   510    513     hasNFlag = find_option("new-file","N",0)!=0;
   511    514     if( hasNFlag ) diffFlags |= DIFF_NEWFILE;
   512    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  +  }
   513    523     if( zTo==0 ){
   514    524       db_must_be_within_tree();
   515    525       verify_all_options();
   516    526       if( !isInternDiff ){
   517    527         zDiffCmd = db_get(isGDiff ? "gdiff-command" : "diff-command", 0);
   518    528       }
   519    529       if( g.argc>=3 ){

Changes to src/info.c.

   752    752   ** manifest.  Return the number of errors.
   753    753   */
   754    754   static Manifest *vdiff_parse_manifest(const char *zParam, int *pRid){
   755    755     int rid;
   756    756   
   757    757     *pRid = rid = name_to_rid_www(zParam);
   758    758     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  +    }
   760    765       return 0;
   761    766     }
   762    767     if( !is_a_version(rid) ){
   763    768       webpage_error("Artifact %s is not a checkin.", P(zParam));
   764    769       return 0;
   765    770     }
   766    771     return manifest_get(rid, CFTYPE_MANIFEST);
................................................................................
   803    808   void vdiff_page(void){
   804    809     int ridFrom, ridTo;
   805    810     int showDetail = 0;
   806    811     int sideBySide = 0;
   807    812     int diffFlags = 0;
   808    813     Manifest *pFrom, *pTo;
   809    814     ManifestFile *pFileFrom, *pFileTo;
          815  +  const char *zBranch;
   810    816   
   811    817     login_check_credentials();
   812    818     if( !g.perm.Read ){ login_needed(); return; }
   813    819     login_anonymous_available();
   814    820   
   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  +  }
   817    826     pTo = vdiff_parse_manifest("to", &ridTo);
   818    827     if( pTo==0 ) return;
          828  +  pFrom = vdiff_parse_manifest("from", &ridFrom);
          829  +  if( pFrom==0 ) return;
   819    830     sideBySide = atoi(PD("sbs","1"));
   820    831     showDetail = atoi(PD("detail","0"));
   821    832     if( !showDetail && sideBySide ) showDetail = 1;
   822    833     if( !sideBySide ){
   823    834       style_submenu_element("Side-by-side Diff", "sbsdiff",
   824    835                             "%s/vdiff?from=%T&to=%T&detail=%d&sbs=1",
   825    836                             g.zTop, P("from"), P("to"), showDetail);

Changes to src/name.c.

   150    150          " WHERE tag.tagname='sym-%q' "
   151    151          "   AND tagxref.tagid=tag.tagid AND tagxref.tagtype>0 "
   152    152          "   AND event.objid=tagxref.rid "
   153    153          "   AND event.type GLOB '%q'"
   154    154          " ORDER BY event.mtime DESC /*sort*/",
   155    155          &zTag[4], zType
   156    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);
   157    180       return rid;
   158    181     }
   159    182   
   160    183     /* symbolic-name ":" date-time */
   161    184     nTag = strlen(zTag);
   162    185     for(i=0; i<nTag-10 && zTag[i]!=':'; i++){}
   163    186     if( zTag[i]==':' && is_date(&zTag[i+1]) ){