Changes On Branch venks-emacs
Not logged in

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

Changes In Branch venks-emacs Excluding Merge-Ins

This is equivalent to a diff from b120bc8b26 to 374920b209

2011-09-01
22:00
Merge in support for the "fossil ticket history" command from the venks-emacs branch. check-in: 98a855c508 user: drh tags: trunk
2011-08-31
14:34
Improvements to artifact descriptions merged into trunk. check-in: 49402fc722 user: drh tags: trunk
09:55
Merge latest trunk. check-in: 40ed431ca5 user: dmitry tags: symlinks
08:24
Trying to improve the ui artifact description to something easier to parse by the human eye.    I'd still like to have the branch name of every checkin, but I still don't know how to get it. check-in: d34a1b9f3d user: viriketo tags: artifact_description
07:50
Improve formatting for fossil ticket history. Make small fields print on same line, and make longer ones look better. Leaf check-in: 374920b209 user: venkat tags: venks-emacs
2011-08-30
21:50
Add ability to show ticket history from command line. fossil ticket now takes a new history option, which prints the history of a ticket - somewhat like what the history button does on the ticket web GUI. check-in: 73e363ea96 user: venkat tags: venks-emacs
21:46
merge trunk before changes check-in: ffa3b1eaf6 user: venkat tags: venks-emacs
18:04
Print an error message and quite if the --user option appears on a "fossil commit" command but specifies a username not found in the database. Ticket [3ed2e994e1750b] check-in: b120bc8b26 user: drh tags: trunk
17:39
Display the last modification time of tickets using either localtime or UTC according to user preferences. check-in: 839f105098 user: drh tags: trunk

Changes to src/tkt.c.

   897    897   **         in "ticket show". So it's possible, to set multiline text or
   898    898   **         text with special characters.
   899    899   **
   900    900   **     %fossil ticket add FIELD VALUE ?FIELD VALUE .. ? ?-q|--quote?
   901    901   **
   902    902   **         like set, but create a new ticket with the given values.
   903    903   **
          904  +**     %fossil ticket history TICKETUUID
          905  +**
          906  +**         Show the complete change history for the ticket
          907  +**
   904    908   ** The values in set|add are not validated against the definitions
   905    909   ** given in "Ticket Common Script".
   906    910   */
   907    911   void ticket_cmd(void){
   908    912     int n;
   909    913   
   910    914     /* do some ints, we want to be inside a checkout */
................................................................................
   914    918     ** Check that the user exists.
   915    919     */
   916    920     if( !db_exists("SELECT 1 FROM user WHERE login=%Q", g.zLogin) ){
   917    921       fossil_fatal("no such user: %s", g.zLogin);
   918    922     }
   919    923   
   920    924     if( g.argc<3 ){
   921         -    usage("add|fieldlist|set|show");
          925  +    usage("add|fieldlist|set|show|history");
   922    926     }else{
   923    927       n = strlen(g.argv[2]);
   924    928       if( n==1 && g.argv[2][0]=='s' ){
   925    929         /* set/show cannot be distinguished, so show the usage */
   926         -      usage("add|fieldlist|set|show");
          930  +      usage("add|fieldlist|set|show|history");
   927    931       }else if( strncmp(g.argv[2],"list",n)==0 ){
   928    932         if( g.argc==3 ){
   929    933           usage("list fields|reports");
   930    934         }else{
   931    935           n = strlen(g.argv[3]);
   932    936           if( !strncmp(g.argv[3],"fields",n) ){
   933    937             /* simply show all field names */
................................................................................
   968    972             }
   969    973   
   970    974             rptshow( zRep, zSep, zFilterUuid, tktEncoding );
   971    975   
   972    976           }
   973    977         }else{
   974    978           /* add a new ticket or update an existing ticket */
   975         -        enum { set,add,err } eCmd = err;
          979  +        enum { set,add,history,err } eCmd = err;
   976    980           int i = 0;
   977    981           int rid;
   978    982           const char *zTktUuid = 0;
   979    983           Blob tktchng, cksum;
   980    984   
   981    985           /* get command type (set/add) and get uuid, if needed for set */
   982         -        if( strncmp(g.argv[2],"set",n)==0 || strncmp(g.argv[2],"change",n)==0 ){
   983         -          eCmd = set;
          986  +        if( strncmp(g.argv[2],"set",n)==0 || strncmp(g.argv[2],"change",n)==0 ||
          987  +           strncmp(g.argv[2],"history",n)==0 ){
          988  +          if( strncmp(g.argv[2],"history",n)==0 ){
          989  +            eCmd = history;
          990  +          }else{
          991  +            eCmd = set;
          992  +          }
   984    993             if( g.argc==3 ){
   985    994               usage("set TICKETUUID");
   986    995             }
   987    996             zTktUuid = db_text(0, 
   988    997               "SELECT tkt_uuid FROM ticket WHERE tkt_uuid GLOB '%s*'", g.argv[3]
   989    998             );
   990    999             if( !zTktUuid ){
................................................................................
   994   1003           }else if( strncmp(g.argv[2],"add",n)==0 ){
   995   1004             eCmd = add;
   996   1005             i = 3;
   997   1006             zTktUuid = db_text(0, "SELECT lower(hex(randomblob(20)))");
   998   1007           }
   999   1008           /* none of set/add, so show the usage! */
  1000   1009           if( eCmd==err ){
  1001         -          usage("add|fieldlist|set|show");
         1010  +          usage("add|fieldlist|set|show|history");
  1002   1011           }
  1003         -        
         1012  +
         1013  +        /* we just handle history separately here, does not get out */
         1014  +        if( eCmd==history ){
         1015  +          Stmt q;
         1016  +          char *zTitle;
         1017  +          int tagid;
         1018  +
         1019  +          if ( i != g.argc ){
         1020  +            fossil_fatal("no other parameters expected to %s!",g.argv[2]);
         1021  +          }
         1022  +          tagid = db_int(0, "SELECT tagid FROM tag WHERE tagname GLOB 'tkt-%q*'",zTktUuid);
         1023  +          if( tagid==0 ){
         1024  +            fossil_fatal("no such ticket %h", zTktUuid);
         1025  +          }  
         1026  +          db_prepare(&q,
         1027  +            "SELECT datetime(mtime,'localtime'), objid, uuid, NULL, NULL, NULL"
         1028  +            "  FROM event, blob"
         1029  +            " WHERE objid IN (SELECT rid FROM tagxref WHERE tagid=%d)"
         1030  +            "   AND blob.rid=event.objid"
         1031  +            " UNION "
         1032  +            "SELECT datetime(mtime,'localtime'), attachid, uuid, src, filename, user"
         1033  +            "  FROM attachment, blob"
         1034  +            " WHERE target=(SELECT substr(tagname,5) FROM tag WHERE tagid=%d)"
         1035  +            "   AND blob.rid=attachid"
         1036  +            " ORDER BY 1 DESC",
         1037  +            tagid, tagid
         1038  +          );
         1039  +          while( db_step(&q)==SQLITE_ROW ){
         1040  +            Manifest *pTicket;
         1041  +            char zShort[12];
         1042  +            const char *zDate = db_column_text(&q, 0);
         1043  +            int rid = db_column_int(&q, 1);
         1044  +            const char *zChngUuid = db_column_text(&q, 2);
         1045  +            const char *zFile = db_column_text(&q, 4);
         1046  +            memcpy(zShort, zChngUuid, 10);
         1047  +            zShort[10] = 0;
         1048  +            if( zFile!=0 ){
         1049  +              const char *zSrc = db_column_text(&q, 3);
         1050  +              const char *zUser = db_column_text(&q, 5);
         1051  +              if( zSrc==0 || zSrc[0]==0 ){
         1052  +                fossil_print("Delete attachment %h\n", zFile);
         1053  +              }else{
         1054  +                fossil_print("Add attachment %h\n", zFile);
         1055  +              }
         1056  +              fossil_print(" by %h on %h\n", zUser, zDate);
         1057  +            }else{
         1058  +              pTicket = manifest_get(rid, CFTYPE_TICKET);
         1059  +              if( pTicket ){
         1060  +                int i;
         1061  +
         1062  +                fossil_print("Ticket Change by %h on %h:\n", pTicket->zUser, zDate);
         1063  +                for(i=0; i<pTicket->nField; i++){
         1064  +                  Blob val;
         1065  +                  const char *z;
         1066  +                  z = pTicket->aField[i].zName;
         1067  +                  blob_set(&val, pTicket->aField[i].zValue);
         1068  +                  if( z[0]=='+' ){
         1069  +                    fossil_print("  Append to ");
         1070  +		    z++;
         1071  +		  }else{
         1072  +		    fossil_print("  Change ");
         1073  +                  }
         1074  +		  fossil_print("%h: ",z);
         1075  +		  if( blob_size(&val)>50 || contains_newline(&val)) {
         1076  +                    fossil_print("\n    ",blob_str(&val));
         1077  +                    comment_print(blob_str(&val),4,79);
         1078  +                  }else{
         1079  +                    fossil_print("%s\n",blob_str(&val));
         1080  +                  }
         1081  +                  blob_reset(&val);
         1082  +                }
         1083  +              }
         1084  +              manifest_destroy(pTicket);
         1085  +            }
         1086  +          }
         1087  +          db_finalize(&q);
         1088  +          return;
         1089  +        }
  1004   1090           /* read all given ticket field/value pairs from command line */
  1005   1091           if( i==g.argc ){
  1006   1092             fossil_fatal("empty %s command aborted!",g.argv[2]);
  1007   1093           }
  1008   1094           getAllTicketFields();
  1009   1095           /* read commandline and assign fields in the azValue array */
  1010   1096           while( i<g.argc ){