[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.17 and 1.18

version 1.17, 2005/05/25 09:25:48 version 1.18, 2005/05/25 21:47:19
Line 46 
Line 46 
 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 dflag = 0;
 static RCSNUM *bnum;  static RCSNUM *bnum;
 static char *branch, *module, *vendor, *release;  static char *branch, *module, *vendor, *release;
   
Line 86 
Line 87 
                         rcsnum_free(bnum);                          rcsnum_free(bnum);
                         break;                          break;
                 case 'd':                  case 'd':
                           dflag = 1;
                         break;                          break;
                 case 'I':                  case 'I':
                         if (cvs_file_ignore(optarg) < 0) {                          if (cvs_file_ignore(optarg) < 0) {
Line 135 
Line 137 
         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,
                     module);                      module);
                 mkdir(repodir, 0700);                  if (mkdir(repodir, 0700) == -1) {
                           cvs_log(LP_ERRNO, "failed to create %s", repodir);
                           return (CVS_EX_DATA);
                   }
         } else {          } else {
                 if ((cvs_sendarg(root, "-b", 0) < 0) ||                  if ((cvs_sendarg(root, "-b", 0) < 0) ||
                     (cvs_sendarg(root, branch, 0) < 0) ||                      (cvs_sendarg(root, branch, 0) < 0) ||
Line 200 
Line 205 
         return (0);          return (0);
 }  }
   
   
 /*  
  * cvs_import_local()  
  *  
  */  
 static int  static int
 cvs_import_local(CVSFILE *cf, void *arg)  cvs_import_local(CVSFILE *cf, void *arg)
 {  {
         int len;          int len;
         struct cvsroot *root;          time_t stamp;
         char fpath[MAXPATHLEN], rpath[MAXPATHLEN], repo[MAXPATHLEN];          char fpath[MAXPATHLEN], rpath[MAXPATHLEN], repo[MAXPATHLEN];
         const char *comment;          const char *comment;
           struct stat fst;
           struct timeval ts[2];
           struct cvsroot *root;
         RCSFILE *rf;          RCSFILE *rf;
         RCSNUM *rev;          RCSNUM *rev;
   
Line 247 
Line 250 
                 return (0);                  return (0);
         }          }
   
           /*
            * If -d was given, use the file's last modification time as the
            * timestamps for the initial revisions.
            */
           if (dflag) {
                   if (stat(fpath, &fst) == -1) {
                           cvs_log(LP_ERRNO, "failed to stat %s", fpath);
                           return (CVS_EX_DATA);
                   }
                   stamp = (time_t)fst.st_mtime;
   
                   ts[0].tv_sec = stamp;
                   ts[0].tv_usec = 0;
                   ts[1].tv_sec = stamp;
                   ts[1].tv_usec = 0;
           } else
                   stamp = -1;
   
         snprintf(rpath, sizeof(rpath), "%s/%s%s",          snprintf(rpath, sizeof(rpath), "%s/%s%s",
             repo, fpath, RCS_FILE_EXT);              repo, fpath, RCS_FILE_EXT);
   
Line 261 
Line 282 
   
         comment = rcs_comment_lookup(cf->cf_name);          comment = rcs_comment_lookup(cf->cf_name);
         if ((comment != NULL) && (rcs_comment_set(rf, comment) < 0)) {          if ((comment != NULL) && (rcs_comment_set(rf, comment) < 0)) {
                 cvs_log(LP_ERR, "failed to set RCS comment leader: %s",                  cvs_log(LP_WARN, "failed to set RCS comment leader: %s",
                     rcs_errstr(rcs_errno));                      rcs_errstr(rcs_errno));
                   /* don't error out, no big deal */
         }          }
   
         /* first add the magic 1.1.1.1 revision */          /* first add the magic 1.1.1.1 revision */
         rev = rcsnum_parse("1.1.1.1");          rev = rcsnum_parse("1.1.1.1");
         if (rcs_rev_add(rf, rev, cvs_msg) < 0) {          if (rcs_rev_add(rf, rev, cvs_msg, stamp) < 0) {
                 cvs_log(LP_ERR, "failed to add revision: %s",                  cvs_log(LP_ERR, "failed to add revision: %s",
                     rcs_errstr(rcs_errno));                      rcs_errstr(rcs_errno));
                 rcs_close(rf);                  rcs_close(rf);
                 (void)unlink(rpath);                  (void)unlink(rpath);
                 return (CVS_EX_DATA);                  return (CVS_EX_DATA);
         }          }
   
           if (rcs_sym_add(rf, release, rev) < 0) {
                   cvs_log(LP_ERR, "failed to set RCS symbol: %s",
                       strerror(rcs_errno));
                   rcs_close(rf);
                   (void)unlink(rpath);
                   return (CVS_EX_DATA);
           }
   
         rcsnum_free(rev);          rcsnum_free(rev);
   
         rev = rcsnum_parse(RCS_HEAD_INIT);          rev = rcsnum_parse(RCS_HEAD_INIT);
         if (rcs_rev_add(rf, rev, cvs_msg) < 0) {          if (rcs_rev_add(rf, rev, cvs_msg, stamp) < 0) {
                 cvs_log(LP_ERR, "failed to add revision: %s",                  cvs_log(LP_ERR, "failed to add revision: %s",
                     rcs_errstr(rcs_errno));                      rcs_errstr(rcs_errno));
                 rcs_close(rf);                  rcs_close(rf);
Line 293 
Line 324 
                 return (CVS_EX_DATA);                  return (CVS_EX_DATA);
         }          }
   
   #if 0
           if (rcs_branch_set(rf, rev) < 0) {
                   cvs_log(LP_ERR, "failed to set RCS default branch: %s",
                       strerror(rcs_errno));
                   return (CVS_EX_DATA);
           }
   #endif
   
           /* add the vendor tag and release tag as symbols */
         rcs_close(rf);          rcs_close(rf);
   
           if (dflag && (utimes(rpath, ts) == -1))
                   cvs_log(LP_ERRNO, "failed to timestamp RCS file");
   
         return (CVS_EX_OK);          return (CVS_EX_OK);
 }  }

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