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

Diff for /src/usr.bin/cvs/tag.c between version 1.39 and 1.40

version 1.39, 2006/02/01 14:30:34 version 1.40, 2006/02/06 08:33:03
Line 2 
Line 2 
 /*  /*
  * Copyright (c) 2004 Jean-Francois Brousseau <jfb@openbsd.org>   * Copyright (c) 2004 Jean-Francois Brousseau <jfb@openbsd.org>
  * Copyright (c) 2004 Joris Vink <joris@openbsd.org>   * Copyright (c) 2004 Joris Vink <joris@openbsd.org>
    * Copyright (c) 2005, 2006 Xavier Santolaria <xsa@openbsd.org>
  * All rights reserved.   * All rights reserved.
  *   *
  * Redistribution and use in source and binary forms, with or without   * Redistribution and use in source and binary forms, with or without
Line 31 
Line 32 
 #include "log.h"  #include "log.h"
 #include "proto.h"  #include "proto.h"
   
   #define TAG_BRANCH      (1<<0)
   #define TAG_DELETE      (1<<1)
   #define TAG_FORCE_HEAD  (1<<2)
   #define TAG_FORCE_RM    (1<<3)
   #define UPTODATE        (1<<4)
   
 static int      cvs_tag_init(struct cvs_cmd *, int, char **, int *);  static int      cvs_tag_init(struct cvs_cmd *, int, char **, int *);
 static int      cvs_tag_local(CVSFILE *, void *);  static int      cvs_tag_local(CVSFILE *, void *);
 static int      cvs_tag_remote(CVSFILE *, void *);  static int      cvs_tag_remote(CVSFILE *, void *);
 static int      cvs_tag_pre_exec(struct cvsroot *);  static int      cvs_tag_pre_exec(struct cvsroot *);
   
   static int runflags = 0;
 static char *tag_name = NULL;  static char *tag_name = NULL;
 static char *tag_date = NULL;  static char *tag_date = NULL;
 static char *tag_oldname = NULL;  static char *tag_oldname = NULL;
 static int tag_branch = 0;  
 static int tag_delete = 0;  
 static int tag_forcehead = 0;  
 static int tag_forcemove = 0;  
   
 struct cvs_cmd cvs_cmd_tag = {  struct cvs_cmd cvs_cmd_tag = {
         CVS_OP_TAG, CVS_REQ_TAG, "tag",          CVS_OP_TAG, CVS_REQ_TAG, "tag",
         { "ta", "freeze" },          { "ta", "freeze" },
         "Add a symbolic tag to checked out version of files",          "Add a symbolic tag to checked out version of files",
         "[-bcdFflR] [-D date | -r rev] tagname ...",          "[-bcdFflR] [-D date | -r rev] tag [file ...]",
         "bcD:dFflRr:",          "bcD:dFflRr:",
         NULL,          NULL,
         CF_SORT | CF_IGNORE | CF_RECURSE,          CF_SORT | CF_IGNORE | CF_RECURSE,
Line 67 
Line 70 
         CVS_OP_RTAG, CVS_REQ_TAG, "rtag",          CVS_OP_RTAG, CVS_REQ_TAG, "rtag",
         { "rt", "rfreeze" },          { "rt", "rfreeze" },
         "Add a symbolic tag to a module",          "Add a symbolic tag to a module",
         "[-abdFflnR] [-D date | -r rev] symbolic_tag modules ...",          "[-abdFflnR] [-D date | -r rev] tag modules ...",
         "abD:fFflnRr:",          "abD:fFflnRr:",
         NULL,          NULL,
         CF_SORT | CF_IGNORE | CF_RECURSE,          CF_SORT | CF_IGNORE | CF_RECURSE,
Line 90 
Line 93 
         while ((ch = getopt(argc, argv, cmd->cmd_opts)) != -1) {          while ((ch = getopt(argc, argv, cmd->cmd_opts)) != -1) {
                 switch (ch) {                  switch (ch) {
                 case 'b':                  case 'b':
                         tag_branch = 1;                          runflags |= TAG_BRANCH;
                         break;                          break;
                   case 'c':
                           runflags |= UPTODATE;
                           break;
                 case 'd':                  case 'd':
                         tag_delete = 1;                          runflags |= TAG_DELETE;
                         break;                          break;
                 case 'F':                  case 'F':
                         tag_forcemove = 1;                          runflags |= TAG_FORCE_RM;
                         break;                          break;
                 case 'f':                  case 'f':
                         tag_forcehead = 1;                          runflags |= TAG_FORCE_HEAD;
                         break;                          break;
                 case 'D':                  case 'D':
                         tag_date = optarg;                          tag_date = optarg;
Line 122 
Line 128 
         argc -= optind;          argc -= optind;
         argv += optind;          argv += optind;
   
         if (argc == 0) {          if (argc == 0)
                 return (CVS_EX_USAGE);                  return (CVS_EX_USAGE);
         } else {          else {
                 tag_name = argv[0];                  tag_name = argv[0];
                 argc--;                  argc--;
                 argv++;                  argv++;
Line 135 
Line 141 
                 fatal("tag `%s' must not contain the characters `%s'",                  fatal("tag `%s' must not contain the characters `%s'",
                     tag_name, RCS_SYM_INVALCHAR);                      tag_name, RCS_SYM_INVALCHAR);
   
         if ((tag_branch == 1) && (tag_delete == 1)) {          if ((runflags & TAG_BRANCH) && (runflags & TAG_DELETE)) {
                 cvs_log(LP_WARN, "ignoring -b with -d options");                  cvs_log(LP_WARN, "ignoring -b with -d options");
                 tag_branch = 0;                  runflags &= ~TAG_BRANCH;
         }          }
   
         if ((tag_delete == 1) && (tag_oldname != NULL))          if ((runflags & TAG_DELETE) && (tag_oldname != NULL))
                 tag_oldname = NULL;                  tag_oldname = NULL;
   
         if ((tag_delete == 1) && (tag_date != NULL))          if ((runflags & TAG_DELETE) && (tag_date != NULL))
                 tag_date = NULL;                  tag_date = NULL;
   
         if ((tag_oldname != NULL) && (tag_date != NULL)) {          if ((tag_oldname != NULL) && (tag_date != NULL)) {
Line 158 
Line 164 
 cvs_tag_pre_exec(struct cvsroot *root)  cvs_tag_pre_exec(struct cvsroot *root)
 {  {
         if (root->cr_method != CVS_METHOD_LOCAL) {          if (root->cr_method != CVS_METHOD_LOCAL) {
                 if (tag_branch == 1)                  if (runflags & TAG_BRANCH)
                         cvs_sendarg(root, "-b", 0);                          cvs_sendarg(root, "-b", 0);
   
                 if (tag_delete == 1)                  if (runflags & UPTODATE)
                           cvs_sendarg(root, "-c", 0);
   
                   if (runflags & TAG_DELETE)
                         cvs_sendarg(root, "-d", 0);                          cvs_sendarg(root, "-d", 0);
   
                 if (tag_forcemove == 1)                  if (runflags & TAG_FORCE_RM)
                         cvs_sendarg(root, "-F", 0);                          cvs_sendarg(root, "-F", 0);
   
                 if (tag_forcehead == 1)                  if (runflags & TAG_FORCE_HEAD)
                         cvs_sendarg(root, "-f", 0);                          cvs_sendarg(root, "-f", 0);
   
                 if (tag_oldname != NULL) {                  if (tag_oldname != NULL) {
Line 182 
Line 191 
   
                 cvs_sendarg(root, tag_name, 0);                  cvs_sendarg(root, tag_name, 0);
         }          }
   
         return (0);          return (0);
 }  }
   
Line 237 
Line 245 
         if (cf->cf_type == DT_DIR) {          if (cf->cf_type == DT_DIR) {
                 if (verbosity > 1)                  if (verbosity > 1)
                         cvs_log(LP_NOTICE, "%s %s",                          cvs_log(LP_NOTICE, "%s %s",
                             tag_delete ? "Untagging" : "Tagging", fpath);                              (runflags & TAG_DELETE) ? "Untagging" : "Tagging",
                               fpath);
                 return (CVS_EX_OK);                  return (CVS_EX_OK);
         }          }
   
Line 267 
Line 276 
                 fatal("cvs_tag_local: rcs_open: %s: %s", rcspath,                  fatal("cvs_tag_local: rcs_open: %s: %s", rcspath,
                     rcs_errstr(rcs_errno));                      rcs_errstr(rcs_errno));
   
         if (tag_delete == 1) {          if (runflags & TAG_DELETE) {
                 if (cvs_noexec == 0) {                  if (cvs_noexec == 0) {
                         if (rcs_sym_remove(rf, tag_name) < 0)                          if (rcs_sym_remove(rf, tag_name) < 0)
                                 fatal("failed to remove tag %s from %s",                                  fatal("failed to remove tag %s from %s",

Legend:
Removed from v.1.39  
changed lines
  Added in v.1.40