Changeset 192


Ignore:
Timestamp:
May 31, 2006, 11:19:24 AM (19 years ago)
Author:
garonne
Message:

add a case during the checkout for cvs files creation

File:
1 edited

Legend:

Unmodified
Added
Removed
  • CMT/HEAD/source/cmt_cvs.cxx

    r191 r192  
    10791079    return (true);
    10801080  }
     1081  /**
     1082     Construct CVS management files in the top directory. This is needed
     1083     if the top directory of a product is empty. (In this case the
     1084     co -l results in nothing)
     1085   */
     1086  void make_management_files (const cmt_string& module,
     1087                              const cmt_string& entries_text)
     1088  {
     1089    if (!CmtSystem::test_directory ("CVS"))
     1090      {
     1091        /**
     1092         * The CVS repository had not been created (this is generally
     1093         * due to the lack of top files)
     1094         */
     1095
     1096        if (!mkdir ("CVS")) return;
     1097
     1098        CmtSystem::cd ("..");
     1099
     1100        cmt_string s;
     1101       
     1102        // Let's create first the CVS/Root file.
     1103       
     1104        CmtSystem::get_cvsroot (s);
     1105        s += "\n";
     1106       
     1107        cmt_string f;
     1108       
     1109        f = "CVS";
     1110        f += CmtSystem::file_separator ();
     1111        f += "Root";
     1112       
     1113        if (m_simulation)
     1114          {
     1115            cout << "#CMT> Would fill in the CVS/Root file with " << endl;
     1116            cout << s << endl;
     1117          }
     1118        else
     1119          {
     1120            if (m_verbose)
     1121              {
     1122                cout << "#CMT> Fill in the CVS/Root file with " << endl;
     1123                cout << s << endl;
     1124              }
     1125            s.write (f);
     1126          }
     1127       
     1128        // Now we create the CVS/Repository file
     1129       
     1130        f = "CVS";
     1131        f += CmtSystem::file_separator ();
     1132        f += "Repository";
     1133       
     1134        CmtSystem::get_cvsroot (s);
     1135        if (s[0] == ':')
     1136          {
     1137            int pos = s.find (1, ":");
     1138            s.erase (0, pos+1);
     1139            pos = s.find (0, ":");
     1140            s.erase (0, pos+1);
     1141          }
     1142        s += "/";
     1143        s += module;
     1144        s += "\n";
     1145       
     1146        if (m_simulation)
     1147          {
     1148            cout << "#CMT> Would fill in the CVS/Repository file with " << endl;
     1149            cout << s << endl;
     1150          }
     1151        else
     1152          {
     1153            if (m_verbose)
     1154              {
     1155                cout << "#CMT> Fill in the CVS/Repository file with " << endl;
     1156                cout << s << endl;
     1157              }
     1158            s.write (f);
     1159          }
     1160      }
     1161   
     1162    if (m_simulation)
     1163      {
     1164        cout << "#CMT> Would write the top CVS/Entries file with " << endl;
     1165        cout << entries_text << endl;
     1166      }
     1167    else
     1168      {
     1169        cmt_string entries_file_name;
     1170
     1171        entries_file_name = "CVS";
     1172        entries_file_name += CmtSystem::file_separator ();
     1173        entries_file_name += "Entries";
     1174   
     1175        cmt_string text;
     1176
     1177        if (!text.read (entries_file_name))
     1178          {
     1179            // This happens when there were no top files
     1180          }
     1181
     1182        text += entries_text;
     1183
     1184        // Now the CVS/Entries is ready to be created.
     1185        if (m_verbose)
     1186          {
     1187            cout << "#CMT> Fill in the top CVS/Entries file with " << endl;
     1188            cout << text << endl;
     1189          }
     1190
     1191        text.write (entries_file_name);
     1192      }
     1193
     1194  }
     1195
    10811196
    10821197  /**
     
    11481263        cout << "#CMT> Now getting subdirectories pwd=" << CmtSystem::pwd () << " dir=" << dir << endl;
    11491264      }
    1150 
     1265   
    11511266    cmt_string branches = CmtSystem::getenv ("CMTCVSBRANCHES");
    11521267   
     
    11591274   
    11601275    CmtSystem::split (branches, " \t", branch_vector);
    1161    
    1162     cout << "  # get branches " << branches << endl;
    1163    
     1276     
    11641277    cmt_string text = "";
    11651278   
    11661279    command = "";
    11671280
     1281    if (!CmtSystem::test_directory ("CVS"))
     1282      {
     1283          cout << "#CMT> CVS repository is missing !!" << endl; 
     1284          int i;
     1285          for (i = 0; i < branch_vector.size (); i++)
     1286            {
     1287               cmt_string& branch = branch_vector[i];   
     1288               if (i > 0)
     1289                   {
     1290                      command += CmtSystem::command_separator ();
     1291                   }
     1292       
     1293               command += "cvs -f -Q co ";
     1294       
     1295               if (!at_head)
     1296                  {
     1297                     command += "-r ";
     1298                     command += version;
     1299                  }
     1300       
     1301               command += " -d ";
     1302               command += branch;
     1303               command += " ";
     1304               command += module;
     1305               command += "/";    // CVS uses the '/' notation on all platforms!!
     1306               command += branch;
     1307       
     1308               text += "D/";
     1309               text += branch;
     1310               text += "////\n";
     1311            }
     1312        execute_and_retry (command, "Error getting package contents");
     1313
     1314        make_management_files (module, text);
     1315
     1316        return (true);   
     1317      }
     1318 
    11681319    command += "cvs -Q update -d ";
    11691320
     
    11741325      }
    11751326
    1176    
    11771327    int i;
    11781328   
    11791329    for (i = 0; i < branch_vector.size (); i++)
    11801330      {
    1181         cmt_string& branch = branch_vector[i];
    1182 
    1183         command += " ";
    1184         command += branch;
     1331            cmt_string& branch = branch_vector[i];
     1332            command += " ";
     1333            command += branch;
    11851334      }
    11861335
Note: See TracChangeset for help on using the changeset viewer.