[BACK]Return to getlog.c CVS log [TXT][DIR] Up to [local] / src / usr.bin / cvs

Diff for /src/usr.bin/cvs/getlog.c between version 1.66 and 1.67

version 1.66, 2006/10/24 13:15:34 version 1.67, 2006/11/08 22:05:52
Line 33 
Line 33 
 #define L_HEAD_DESCR    0x02  #define L_HEAD_DESCR    0x02
 #define L_NAME          0x04  #define L_NAME          0x04
 #define L_NOTAGS        0x08  #define L_NOTAGS        0x08
   #define L_LOGINS        0x10
   #define L_STATES        0x20
   
 void    cvs_log_local(struct cvs_file *);  void    cvs_log_local(struct cvs_file *);
   
   static void     log_rev_print(struct rcs_delta *);
   
 int      runflags = 0;  int      runflags = 0;
 char    *logrev = NULL;  char    *logrev = NULL;
   char    *slist = NULL;
   char    *wlist = NULL;
   
 struct cvs_cmd cvs_cmd_log = {  struct cvs_cmd cvs_cmd_log = {
         CVS_OP_LOG, 0, "log",          CVS_OP_LOG, 0, "log",
         { "lo" },          { "lo" },
         "Print out history information for files",          "Print out history information for files",
         "[-bhlNRt] [-d dates] [-r revisions] [-s states] [-w logins]",          "[-bhlNRt] [-d dates] [-r revisions] [-s states] [-w logins]",
         "bd:hlNRr:s:tw:",          "bd:hlNRr:s:tw::",
         NULL,          NULL,
         cvs_getlog          cvs_getlog
 };  };
Line 76 
Line 82 
                 case 'r':                  case 'r':
                         logrev = optarg;                          logrev = optarg;
                         break;                          break;
                   case 's':
                           runflags |= L_STATES;
                           slist = optarg;
                           break;
                 case 't':                  case 't':
                         runflags |= L_HEAD_DESCR;                          runflags |= L_HEAD_DESCR;
                         break;                          break;
                   case 'w':
                           runflags |= L_LOGINS;
                           wlist = optarg;
                           break;
                 default:                  default:
                         fatal("%s", cvs_cmd_log.cmd_synopsis);                          fatal("%s", cvs_cmd_log.cmd_synopsis);
                 }                  }
Line 108 
Line 122 
                 if (logrev != NULL)                  if (logrev != NULL)
                         cvs_client_send_request("Argument -r%s", logrev);                          cvs_client_send_request("Argument -r%s", logrev);
   
                   if (runflags & L_STATES)
                           cvs_client_send_request("Argument -s%s", slist);
   
                 if (runflags & L_HEAD_DESCR)                  if (runflags & L_HEAD_DESCR)
                         cvs_client_send_request("Argument -t");                          cvs_client_send_request("Argument -t");
   
                   if (runflags & L_LOGINS)
                           cvs_client_send_request("Argument -w%s", wlist);
         } else {          } else {
                 cr.fileproc = cvs_log_local;                  cr.fileproc = cvs_log_local;
         }          }
Line 139 
Line 159 
         struct rcs_lock *lkp;          struct rcs_lock *lkp;
         struct rcs_delta *rdp;          struct rcs_delta *rdp;
         struct rcs_access *acp;          struct rcs_access *acp;
         char numb[32], timeb[32];          char numb[32];
   
         cvs_log(LP_TRACE, "cvs_log_local(%s)", cf->file_path);          cvs_log(LP_TRACE, "cvs_log_local(%s)", cf->file_path);
   
Line 220 
Line 240 
   
         if (!(runflags & L_HEAD) && !(runflags & L_HEAD_DESCR)) {          if (!(runflags & L_HEAD) && !(runflags & L_HEAD_DESCR)) {
                 TAILQ_FOREACH(rdp, &(cf->file_rcs->rf_delta), rd_list) {                  TAILQ_FOREACH(rdp, &(cf->file_rcs->rf_delta), rd_list) {
                         if (logrev != NULL &&                          /*
                             !(rdp->rd_flags & RCS_RD_SELECT))                           * if selections are enabled verify that entry is
                                 continue;                           * selected.
                            */
                           if (logrev == NULL || (rdp->rd_flags & RCS_RD_SELECT))
                                   log_rev_print(rdp);
                   }
           }
   
                         cvs_printf("%s\n", LOG_REVSEP);          cvs_printf("%s\n", LOG_REVEND);
   }
   
                         rcsnum_tostr(rdp->rd_num, numb, sizeof(numb));  static void
                         cvs_printf("revision %s", numb);  log_rev_print(struct rcs_delta *rdp)
   {
           int i, found;
           char numb[32], timeb[32];
           struct cvs_argvector *sargv, *wargv;
   
                         strftime(timeb, sizeof(timeb), "%Y/%m/%d %H:%M:%S",          i = found = 0;
                             &rdp->rd_date);  
                         cvs_printf("\ndate: %s;  author: %s;  state: %s;\n",          /* -s states */
                             timeb, rdp->rd_author, rdp->rd_state);          if (runflags & L_STATES) {
                         cvs_printf("%s", rdp->rd_log);                  sargv = cvs_strsplit(slist, ",");
                   for (i = 0; sargv->argv[i] != NULL; i++) {
                           if (strcmp(rdp->rd_state, sargv->argv[i]) == 0) {
                                   found++;
                                   break;
                           }
                           found = 0;
                 }                  }
                   cvs_argv_destroy(sargv);
         }          }
   
         cvs_printf("%s\n", LOG_REVEND);          /* -w[logins] */
           if (runflags & L_LOGINS) {
                   wargv = cvs_strsplit(wlist, ",");
                   for (i = 0; wargv->argv[i] != NULL; i++) {
                           if (strcmp(rdp->rd_author, wargv->argv[i]) == 0) {
                                   found++;
                                   break;
                           }
                           found = 0;
                   }
                   cvs_argv_destroy(wargv);
           }
   
           if ((((runflags & L_STATES) && (runflags & L_LOGINS)) ||
               (runflags & (L_STATES | L_LOGINS))) && found == 0)
                   return;
   
           cvs_printf("%s\n", LOG_REVSEP);
   
           rcsnum_tostr(rdp->rd_num, numb, sizeof(numb));
           cvs_printf("revision %s", numb);
   
           strftime(timeb, sizeof(timeb), "%Y/%m/%d %H:%M:%S", &rdp->rd_date);
           cvs_printf("\ndate: %s;  author: %s;  state: %s;\n",
               timeb, rdp->rd_author, rdp->rd_state);
           cvs_printf("%s", rdp->rd_log);
 }  }

Legend:
Removed from v.1.66  
changed lines
  Added in v.1.67