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

Diff for /src/usr.bin/cvs/import.c between version 1.18 and 1.19

version 1.18, 2005/05/25 21:47:19 version 1.19, 2005/05/26 00:51:36
Line 41 
Line 41 
   
 #define CVS_IMPORT_DEFBRANCH    "1.1.1"  #define CVS_IMPORT_DEFBRANCH    "1.1.1"
   
   
 static int cvs_import_init     (struct cvs_cmd *, int, char **, int *);  static int cvs_import_init     (struct cvs_cmd *, int, char **, int *);
 static int cvs_import_pre_exec (struct cvsroot *);  static int cvs_import_pre_exec (struct cvsroot *);
   static int cvs_import_pre_exec (struct cvsroot *);
   static int cvs_import_post_exec(struct cvsroot *);
 static int cvs_import_remote   (CVSFILE *, void *);  static int cvs_import_remote   (CVSFILE *, void *);
 static int cvs_import_local    (CVSFILE *, void *);  static int cvs_import_local    (CVSFILE *, void *);
   static int cvs_import_cleanup  (void);
   
 static int dflag = 0;  static int dflag = 0;
 static RCSNUM *bnum;  static int conflicts = 0;
 static char *branch, *module, *vendor, *release;  static RCSNUM *imp_brnum;
   
   static char *module, *vendor, *release;
   
 struct cvs_cmd cvs_cmd_import = {  struct cvs_cmd cvs_cmd_import = {
         CVS_OP_IMPORT, CVS_REQ_IMPORT, "import",          CVS_OP_IMPORT, CVS_REQ_IMPORT, "import",
         { "im", "imp" },          { "im", "imp" },
Line 63 
Line 69 
         cvs_import_pre_exec,          cvs_import_pre_exec,
         cvs_import_remote,          cvs_import_remote,
         cvs_import_local,          cvs_import_local,
         NULL,          cvs_import_post_exec,
         NULL,          cvs_import_cleanup,
         CVS_CMD_SENDDIR          CVS_CMD_SENDDIR
 };  };
   
Line 73 
Line 79 
 {  {
         int ch;          int ch;
   
         branch = CVS_IMPORT_DEFBRANCH;  
   
         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':
                         branch = optarg;                          if ((imp_brnum = rcsnum_parse(optarg)) == NULL) {
                         if ((bnum = rcsnum_parse(branch)) == NULL) {  
                                 cvs_log(LP_ERR, "%s is not a numeric branch",                                  cvs_log(LP_ERR, "%s is not a numeric branch",
                                     branch);                                      optarg);
                                 return (CVS_EX_USAGE);                                  return (CVS_EX_USAGE);
                         }                          }
                         rcsnum_free(bnum);  
                         break;                          break;
                 case 'd':                  case 'd':
                         dflag = 1;                          dflag = 1;
Line 112 
Line 114 
   
         argc -= optind;          argc -= optind;
         argv += optind;          argv += optind;
   
         if (argc != 3)          if (argc != 3)
                 return (CVS_EX_USAGE);                  return (CVS_EX_USAGE);
   
           if ((imp_brnum == NULL) &&
               ((imp_brnum = rcsnum_parse(CVS_IMPORT_DEFBRANCH)) == NULL)) {
                   cvs_log(LP_ERR, "failed to parse default import branch");
                   return (CVS_EX_DATA);
           }
   
         module = argv[0];          module = argv[0];
         vendor = argv[1];          vendor = argv[1];
         release = argv[2];          release = argv[2];
Line 132 
Line 139 
 static int  static int
 cvs_import_pre_exec(struct cvsroot *root)  cvs_import_pre_exec(struct cvsroot *root)
 {  {
         char repodir[MAXPATHLEN];          char numbuf[64], repodir[MAXPATHLEN];
   
         if (root->cr_method == CVS_METHOD_LOCAL) {          if (root->cr_method == CVS_METHOD_LOCAL) {
                 snprintf(repodir, sizeof(repodir), "%s/%s", root->cr_dir,                  snprintf(repodir, sizeof(repodir), "%s/%s", root->cr_dir,
Line 142 
Line 149 
                         return (CVS_EX_DATA);                          return (CVS_EX_DATA);
                 }                  }
         } else {          } else {
                   rcsnum_tostr(imp_brnum, numbuf, sizeof(numbuf));
   
                 if ((cvs_sendarg(root, "-b", 0) < 0) ||                  if ((cvs_sendarg(root, "-b", 0) < 0) ||
                     (cvs_sendarg(root, branch, 0) < 0) ||                      (cvs_sendarg(root, numbuf, 0) < 0) ||
                     (cvs_logmsg_send(root, cvs_msg) < 0) ||                      (cvs_logmsg_send(root, cvs_msg) < 0) ||
                     (cvs_sendarg(root, module, 0) < 0) ||                      (cvs_sendarg(root, module, 0) < 0) ||
                     (cvs_sendarg(root, vendor, 0) < 0) ||                      (cvs_sendarg(root, vendor, 0) < 0) ||
Line 154 
Line 163 
         return (0);          return (0);
 }  }
   
   static int
   cvs_import_post_exec(struct cvsroot *root)
   {
           char buf[8];
   
           if (root->cr_method == CVS_METHOD_LOCAL) {
                   if (conflicts > 0)
                           snprintf(buf, sizeof(buf), "%d", conflicts);
   
                   cvs_printf("\n%s conflicts created by this import\n\n",
                       conflicts == 0 ? "No" : buf);
           }
   
           return (CVS_EX_OK);
   }
   
 /*  /*
  * cvs_import_remote()   * cvs_import_remote()
  *   *
Line 324 
Line 349 
                 return (CVS_EX_DATA);                  return (CVS_EX_DATA);
         }          }
   
 #if 0          if (rcs_branch_set(rf, imp_brnum) < 0) {
         if (rcs_branch_set(rf, rev) < 0) {  
                 cvs_log(LP_ERR, "failed to set RCS default branch: %s",                  cvs_log(LP_ERR, "failed to set RCS default branch: %s",
                     strerror(rcs_errno));                      strerror(rcs_errno));
                 return (CVS_EX_DATA);                  return (CVS_EX_DATA);
         }          }
 #endif  
   
         /* add the vendor tag and release tag as symbols */          /* add the vendor tag and release tag as symbols */
         rcs_close(rf);          rcs_close(rf);
Line 339 
Line 362 
                 cvs_log(LP_ERRNO, "failed to timestamp RCS file");                  cvs_log(LP_ERRNO, "failed to timestamp RCS file");
   
         return (CVS_EX_OK);          return (CVS_EX_OK);
   }
   
   static int
   cvs_import_cleanup(void)
   {
           if (imp_brnum != NULL)
                   rcsnum_free(imp_brnum);
           return (0);
 }  }

Legend:
Removed from v.1.18  
changed lines
  Added in v.1.19