Collaboration diagram for CvsImplementation:

Public Methods | |
| void | filter_list (cmt_string& text, const cmt_regexp& exp) |
| void | show_cvs_infos (const cmt_string& module) |
| void | show_cvs_infos (const cmt_string& offset, const cmt_string& module) |
| Now retrieve all info fields :. More... | |
| void | filter_dir (cmt_string& d) |
| bool | match_version_request (const cmt_string& text, const cmt_regexp& version_exp, cmt_string& version) |
| From a space-separated list of version tags, try to find one tag matching a given regular expression. More... | |
| bool | get_version (const cmt_string& prefix, const cmt_string& package, const cmt_string& version_request, cmt_string& module, cmt_string& version, bool& at_head) |
| cmt_string | build_version_directory (const cmt_string& prefix, const cmt_string& package, const cmt_string& version) |
| Here we have at least one version matching the requested expression. More... | |
| bool | really_checkout_package (const cmt_string& prefix, const cmt_string& package, const cmt_string& version, const cmt_string& module, const cmt_string& basedir, bool at_head) |
| cmt_string | find_matching_version (const cmt_string& expression) |
| The CVS repository had not been created (this is generally due to the lack of top files). More... | |
| void | checkout_package (const cmt_string& prefix, const cmt_string& package, const cmt_string& specified_version) |
| void | checkout_from_requirements (const cmt_string& requirements_path) |
| We provide a path to a requirements file. More... | |
| void | tags (const CmtSystem::cmt_string_vector& arguments) |
| void | branches (const cmt_string& module) |
| void | subpackages (const cmt_string& module) |
| void | help () |
| void | do_checkout (const cmt_string& module, const cmt_string& version_tag) |
| void | checkout (const CmtSystem::cmt_string_vector& arguments) |
Private Attributes | |
| bool | m_recursive |
| bool | m_head |
| bool | m_cmtcvstest |
| cmt_string | m_home_dir |
| cmt_string | m_checkout_dir |
| cmt_string | m_offset |
| cmt_string | m_branch_suffix |
| cmt_string | error_info |
| cmt_string | tags_top_info |
| cmt_string | tags_info |
| cmt_string | cvsversions_top_info |
| cmt_string | cvsversions_info |
| cmt_string | branches_info |
| cmt_string | subpackages_info |
The Cvs class only provides abstract interface.
Definition at line 124 of file cmt_cvs.cxx.
|
|
Definition at line 1211 of file cmt_cvs.cxx. Referenced by Cvs::branches(). 01212 {
01213 cmt_string out;
01214
01215 show_cvs_infos (CmtSystem::getenv ("CMTCVSOFFSET"), module);
01216
01217 if (error_info != "")
01218 {
01219 cout << error_info << endl;
01220 }
01221 else
01222 {
01223 cout << branches_info << endl;
01224 }
01225 }
|
|
|
Here we have at least one version matching the requested expression.
Definition at line 627 of file cmt_cvs.cxx. 00630 {
00631 cmt_string dir = m_home_dir;
00632
00633 if (m_checkout_dir != "")
00634 {
00635 dir += CmtSystem::file_separator ();
00636 dir += m_checkout_dir;
00637 }
00638
00639 dir += CmtSystem::file_separator ();
00640 dir += prefix;
00641 dir += CmtSystem::file_separator ();
00642 dir += package;
00643 dir += CmtSystem::file_separator ();
00644 dir += version;
00645
00646 {
00647 cmt_string fs = CmtSystem::file_separator ();
00648 cmt_string dfs = fs;
00649 dfs += fs;
00650
00651 dir.replace_all (dfs, fs);
00652 }
00653
00654 return (dir);
00655 }
|
|
|
Definition at line 1371 of file cmt_cvs.cxx. Referenced by Cvs::checkout(). 01372 {
01373 if (arguments.size () < 1)
01374 {
01375 help ();
01376 return;
01377 }
01378
01379 if (CmtSystem::getenv ("CVSROOT") == "")
01380 {
01381 cout << "# Please set CVSROOT first !" << endl;
01382 return;
01383 }
01384
01385 if (CmtSystem::getenv ("CMTCVSTEST") != "")
01386 {
01387 m_cmtcvstest = true;
01388 }
01389 else
01390 {
01391 m_cmtcvstest = false;
01392 }
01393
01394 m_home_dir = CmtSystem::pwd ();
01395 m_checkout_dir = "";
01396 m_offset = "";
01397 m_branch_suffix = "";
01398
01399 cmt_string module;
01400
01401 m_recursive = false;
01402
01403 bool need_version_tag = false;
01404 cmt_string version_tag;
01405
01406 bool need_checkout_dir = false;
01407 bool need_offset = false;
01408 bool need_requirements_file = false;
01409
01410 bool simulation = false;
01411 bool verbose = false;
01412
01413 bool need_branch_suffix = false;
01414
01415 m_head = true;
01416
01417 m_offset = CmtSystem::getenv ("CMTCVSOFFSET");
01418 if (m_offset != "")
01419 {
01420 m_offset += "/";
01421 m_offset.replace_all ("//", "/");
01422 }
01423
01424 for (int arg = 0; arg < arguments.size (); arg++)
01425 {
01426 const cmt_string& option = arguments[arg];
01427
01428 if (need_version_tag)
01429 {
01430 need_version_tag = false;
01431
01432 if (option == "HEAD")
01433 {
01434 m_head = true;
01435 }
01436 else
01437 {
01438 version_tag = option;
01439 }
01440 }
01441 else if (need_checkout_dir)
01442 {
01443 need_checkout_dir = false;
01444 m_checkout_dir = option;
01445 }
01446 else if (need_offset)
01447 {
01448 need_offset = false;
01449 m_offset = option;
01450 m_offset += '/';
01451 m_offset.replace_all ("//", "/");
01452 }
01453 else if (need_branch_suffix)
01454 {
01455 need_branch_suffix = false;
01456 m_branch_suffix = "-";
01457 m_branch_suffix += option;
01458 }
01459 else if (need_requirements_file)
01460 {
01461 need_requirements_file = false;
01462 m_head = false;
01463 checkout_from_requirements (option);
01464 }
01465 else
01466 {
01467 if (option == "-R")
01468 {
01469 m_recursive = true;
01470 }
01471 else if (option == "-l")
01472 {
01473 m_recursive = false;
01474 }
01475 else if (option == "-r")
01476 {
01477 need_version_tag = true;
01478 m_head = false;
01479 }
01480 else if (option == "-d")
01481 {
01482 need_checkout_dir = true;
01483 }
01484 else if (option == "-o")
01485 {
01486 need_offset = true;
01487 }
01488 else if (option == "-n")
01489 {
01490 simulation = true;
01491 verbose = true;
01492 }
01493 else if (option == "-v")
01494 {
01495 verbose = true;
01496 }
01497 else if (option == "-branch")
01498 {
01499 need_branch_suffix = true;
01500 }
01501 else if (option == "-requirements")
01502 {
01503 need_requirements_file = true;
01504 }
01505 else if (option == "--help")
01506 {
01507 help ();
01508 return;
01509 }
01510 else if (option[0] == '-')
01511 {
01512 help ();
01513 return;
01514 }
01515 else
01516 {
01517 do_checkout (option, version_tag);
01518 }
01519 }
01520 }
01521
01522 }
|
|
|
We provide a path to a requirements file. From it we read the use statements, and we try to checkout the corresponding packages. Definition at line 1118 of file cmt_cvs.cxx. Referenced by checkout(). 01119 {
01120 static cmt_regexp expression ("^[ \t]*use[ \t]");
01121
01122 cmt_string text;
01123
01124 text.read (requirements_path);
01125
01126 RecursivePass1 p1;
01127 p1.run (text, expression);
01128
01129 RecursivePass2 p2 (*this);
01130 p2.run (p1.result ());
01131 }
|
|
|
Definition at line 930 of file cmt_cvs.cxx. Referenced by do_checkout(), and RecursivePass2::filter(). 00933 {
00934 cmt_string version = specified_version;
00935 cmt_string empty;
00936 cmt_string full_prefix;
00937
00938 full_prefix = m_offset;
00939 full_prefix += prefix;
00940
00941 cmt_string echo_ppath;
00942
00943 if (full_prefix != "")
00944 {
00945 echo_ppath = " path ";
00946 echo_ppath += prefix;
00947 }
00948
00949 if (version == "")
00950 {
00951 cout << "# ================= No version specified for package " << package << endl;
00952 return;
00953 }
00954
00955 //
00956 // First make an attempt to locate the specified version of
00957 // this package "as-it-is" in the work area.
00958 // Since 'version' may contain wild-card, it's likely that
00959 // we should not simply use CmtSystem::test_directory but
00960 // use the wild-card search.
00961 //
00962
00963 cmt_string dir;
00964
00965 dir = build_version_directory (prefix, package, version);
00966
00967 if (m_cmtcvstest) cout << "## (testing dir= " << dir << ")" << endl;
00968
00969 bool recursive = m_recursive;
00970
00971 /*
00972 if (m_cmtcvstest)
00973 {
00974 cmt_string v = find_matching_version (dir);
00975
00976 cout << "---> v=" << v << endl;
00977 }
00978 */
00979
00980 //if (CmtSystem::test_directory (dir))
00981
00982 cmt_string effective_version = find_matching_version (dir);
00983
00984 if (effective_version != "")
00985 {
00986 version = effective_version;
00987
00988 dir = build_version_directory (prefix, package, version);
00989
00990 cout << "# ================= Package " << package
00991 << " version " << version << echo_ppath
00992 << " already installed." << endl;
00993
00994 recursive = false;
00995 }
00996 else
00997 {
00998 bool at_head = false;
00999 cmt_string module;
01000
01001 //
01002 // get_version attempts to find the most appropriate version
01003 // tag matching the specification FROM the repository. However,
01004 // we should take into account situations where some versions have
01005 // already been checked out, in which case they might be sufficient
01006 // (or preferred?)
01007 //
01008
01009 if (version.find ("*") != cmt_string::npos)
01010 {
01011 cout << "# ================= Package " << package
01012 << " version " << version << echo_ppath
01013 << " has wild cards and will not be considered." << endl;
01014 return;
01015 }
01016
01017 if (!get_version (full_prefix, package, version,
01018 module, version, at_head))
01019 {
01020 return;
01021 }
01022
01023 //cout << " full_prefix=[" << full_prefix << "] module=[" << module << "]" << endl;
01024
01025 if (m_cmtcvstest) cout << "## after get_version at_head=" << at_head << " m_head=" << m_head << endl;
01026
01027 if (m_head)
01028 {
01029 m_head = false;
01030
01031 at_head = true;
01032 }
01033 else
01034 {
01035 at_head = false;
01036 }
01037
01038 //
01039 // Make a second try after having selected a version from all the
01040 // available versions compatible with the specified version
01041 //
01042
01043 dir = build_version_directory (prefix, package, version);
01044
01045 if (CmtSystem::test_directory (dir))
01046 {
01047 cout << "# ================= Package " << package
01048 << " version " << version << echo_ppath
01049 << " already installed." << endl;
01050
01051 recursive = false;
01052 }
01053 else
01054 {
01055 //
01056 // Now we can say that we have to perform the real checkout.
01057 //
01058
01059 if (!really_checkout_package (prefix, package, version, module, dir, at_head))
01060 {
01061 cout << "# bad return from really_checkout_package" << endl;
01062 return;
01063 }
01064 }
01065 }
01066
01067 //
01068 // Now reach the newly checked out package.
01069 //
01070
01071 CmtSystem::cd (dir);
01072
01073 // Check if it is a true CMT package.
01074
01075 cmt_string file_name;
01076
01077 file_name = "cmt";
01078 file_name += CmtSystem::file_separator ();
01079 file_name += "requirements";
01080
01081 if (CmtSystem::test_file (file_name))
01082 {
01083 dir += CmtSystem::file_separator ();
01084 dir += "cmt";
01085 CmtSystem::cd ("cmt");
01086 }
01087 else
01088 {
01089 file_name = "mgr";
01090 file_name += CmtSystem::file_separator ();
01091 file_name += "requirements";
01092
01093 if (CmtSystem::test_file (file_name))
01094 {
01095 dir += CmtSystem::file_separator ();
01096 dir += "mgr";
01097 CmtSystem::cd ("mgr");
01098 }
01099 else
01100 {
01101 cout << "# " << package << " not a CMT package" << endl;
01102 return;
01103 }
01104 }
01105
01106 //cout << "# (recursive is " << recursive << ")" << endl;
01107
01108 if (recursive)
01109 {
01110 checkout_from_requirements ("requirements");
01111 }
01112 }
|
|
|
Definition at line 1261 of file cmt_cvs.cxx. Referenced by checkout(). 01262 {
01263 //CMTPATH=${CMTPATH}:${m_home_dir}; export CMTPATH
01264
01265 History& h = History::instance ();
01266
01267 h.clear ();
01268
01269 if (module == "") return;
01270
01271 cmt_string prefix;
01272 cmt_string package;
01273 cmt_string version;
01274
01275 if (version_tag == "")
01276 {
01277 Cut cut (0);
01278
01279 cmt_string m;
01280 m = m_offset;
01281 m += module;
01282
01283 show_cvs_infos (m);
01284
01285 if (error_info != "")
01286 {
01287 cout << error_info << endl;
01288 return;
01289 }
01290
01291 if (tags_top_info != "") version = tags_top_info;
01292 else version = tags_info;
01293
01294 //if (CmtSystem::testenv ("CMTTESTAWK")) cout << "version=" << version << endl;
01295
01296 cut.run (version);
01297
01298 version = cut.result ();
01299
01300 //if (CmtSystem::testenv ("CMTTESTAWK")) cout << "version=" << version << endl;
01301 }
01302 else
01303 {
01304 version = version_tag;
01305 }
01306
01307 CmtSystem::dirname (module, prefix);
01308 CmtSystem::basename (module, package);
01309
01310 cmt_string top_dir;
01311
01312 top_dir = m_home_dir;
01313 top_dir += CmtSystem::file_separator ();
01314 top_dir += m_checkout_dir;
01315 top_dir += CmtSystem::file_separator ();
01316 top_dir += prefix;
01317 top_dir += CmtSystem::file_separator ();
01318 top_dir += package;
01319 top_dir += CmtSystem::file_separator ();
01320 top_dir += version;
01321
01322 checkout_package (prefix, package, version);
01323
01324 //cout << "after checkout_package pwd=[" << CmtSystem::pwd () << "] top_dir=[" << top_dir << "]" << endl;
01325
01326 if (!CmtSystem::cd (top_dir)) return;
01327
01328 cmt_string file_name;
01329
01330 file_name = "cmt";
01331 file_name += CmtSystem::file_separator ();
01332 file_name += "requirements";
01333
01334 if (CmtSystem::test_file (file_name))
01335 {
01336 top_dir += CmtSystem::file_separator ();
01337 top_dir += "cmt";
01338 CmtSystem::cd ("cmt");
01339 }
01340 else
01341 {
01342 file_name = "mgr";
01343 file_name += CmtSystem::file_separator ();
01344 file_name += "requirements";
01345
01346 if (CmtSystem::test_file (file_name))
01347 {
01348 top_dir += CmtSystem::file_separator ();
01349 top_dir += "mgr";
01350 CmtSystem::cd ("mgr");
01351 }
01352 else
01353 {
01354 cout << "# " << package << "not a CMT package" << endl;
01355 return;
01356 }
01357 }
01358
01359 //cout << "end of checkout pwd=[" << CmtSystem::pwd () << "]" << endl;
01360
01361 if (m_recursive)
01362 {
01363 CmtSystem::execute ("cmt broadcast cmt config");
01364 }
01365 else
01366 {
01367 CmtSystem::execute ("cmt config");
01368 }
01369 }
|
|
|
Definition at line 424 of file cmt_cvs.cxx. 00425 {
00426 while (true)
00427 {
00428 int pos = d.find ("/../");
00429 if (pos == cmt_string::npos) break;
00430
00431 int slash = d.find ("/");
00432 if (slash < pos)
00433 {
00434 //
00435 // xxxxx/yyy/../zzzz -> xxxxx/zzzz
00436 // 01234567890123456
00437 // 1234567
00438 // pos = 9
00439 // slash = 5
00440 // length = 9+3-5
00441 //
00442 d.erase (slash + 1, pos + 3 - slash);
00443 }
00444 else
00445 {
00446 //
00447 // yyy/../zzzz -> zzzz
00448 // 01234567890
00449 // 1234567
00450 // pos = 3
00451 // length = 3+1+3
00452 //
00453 d.erase (0, pos + 1 + 3);
00454 }
00455 }
00456 }
|
|
|
Definition at line 128 of file cmt_cvs.cxx. Referenced by show_cvs_infos(). 00129 {
00130 CmtSystem::cmt_string_vector list;
00131
00132 CmtSystem::split (text, " ", list);
00133
00134 int i;
00135
00136 text = "";
00137
00138 for (i = 0; i < list.size (); i++)
00139 {
00140 const cmt_string& s = list[i];
00141 if (exp.match (s))
00142 {
00143 if (i > 0) text += " ";
00144 text += s;
00145 }
00146 }
00147 }
|
|
|
The CVS repository had not been created (this is generally due to the lack of top files).
Definition at line 869 of file cmt_cvs.cxx. 00870 {
00871 cmt_string result;
00872
00873 //
00874 // Here expression takes the form
00875 // <some path>/<expression with wild-card>
00876 //
00877
00878 cmt_string dir;
00879 CmtSystem::dirname (expression, dir);
00880 dir += CmtSystem::file_separator ();
00881
00882 cmt_string version;
00883 CmtSystem::basename (expression, version);
00884
00885 if (version.find ("*") == cmt_string::npos)
00886 {
00887 // there is no wildcarding here. A simple test is enough.
00888 if (CmtSystem::test_directory (expression))
00889 {
00890 if (m_cmtcvstest) cout << "## Found direct match with " << version << endl;
00891 result = version;
00892 }
00893 else
00894 {
00895 if (m_cmtcvstest) cout << "## Explicit version " << version
00896 << " has no direct match" << endl;
00897 }
00898 }
00899 else
00900 {
00901 version.replace ("*", ".*");
00902
00903 cmt_regexp exp (version);
00904
00905 CmtSystem::cmt_string_vector list;
00906
00907 if (m_cmtcvstest) cout << "## Trying scan_dir dir=" << dir
00908 << " exp=" << version << endl;
00909
00910 CmtSystem::scan_dir (dir, exp, list);
00911
00912 if (list.size () > 0)
00913 {
00914 result = list[0];
00915
00916 if (m_cmtcvstest) cout << "## At least one version is matching " << version
00917 << "(" << list.size () << " matches) " << result << endl;
00918
00919 CmtSystem::basename (result, result);
00920 }
00921 else
00922 {
00923 if (m_cmtcvstest) cout << "## There is no version matching " << version << endl;
00924 }
00925 }
00926
00927 return (result);
00928 }
|
|
|
Definition at line 490 of file cmt_cvs.cxx. 00496 {
00497 Grep grep;
00498 cmt_string topversions;
00499 cmt_string versions;
00500 cmt_string requested_version = version_request;
00501
00502 at_head = false;
00503
00504 module = "";
00505
00506 if (prefix != "")
00507 {
00508 module = prefix;
00509 module += "/"; // This is for CVS only
00510 module.replace_all ("//", "/");
00511 }
00512
00513 module += package;
00514
00529 //cout << " in get version : module=[" << module << "]" << endl;
00530
00531 show_cvs_infos (module);
00532
00533 if (error_info != "")
00534 {
00535 versions = "";
00536 cout << "# Package " << package << " not found in ${CVSROOT}" << endl;
00537 return (false);
00538 }
00539
00540 versions = tags_top_info;
00541
00542 cmt_string v = version_request;
00543
00544 if (version_request.find ("*") != cmt_string::npos)
00545 {
00546 v.replace_all ("*", ".*");
00547 }
00548 else
00549 {
00550 v += "$";
00551 }
00552
00553 if (m_cmtcvstest) cout << "## (version expression is " << v << ")" << endl;
00554
00555 cmt_regexp version_exp (v);
00556
00557 if (!match_version_request (versions, version_exp, version))
00558 {
00559 if (m_cmtcvstest) cout << "## (no match in " << versions << ")" << endl;
00560
00561 // We try on non-top versions
00562
00563 versions = tags_info;
00564
00565 if (!match_version_request (versions, version_exp, version))
00566 {
00567 if (m_cmtcvstest) cout << "## (no match in " << versions << ")" << endl;
00568
00569 version = requested_version;
00570 int pos = 0;
00571 if ((pos = version.find ("*")) != cmt_string::npos)
00572 {
00573 //
00574 // There was a wild card but the expression does not match
00575 // any of the existing tags in CVS.
00576 // Things will be retreived from HEAD but we have to build
00577 // a reasonable version tag from the wild card expression.
00578 // If the letter before the * was a digit, then simply remove
00579 // the * (v5* -> v5) otherwise add a zero (v5r* -> v5r0)
00580 //
00581 if (pos > 0)
00582 {
00583 char letter = version[pos-1];
00584
00585 static const cmt_string digits = "0123456789";
00586
00587 if (digits.find (letter) == cmt_string::npos)
00588 {
00589 // "v5r*" -> "v5r0"
00590 version.replace ("*", "0");
00591 }
00592 else
00593 {
00594 // "v5*" -> "v5"
00595 version.replace ("*", "");
00596 }
00597 }
00598 else
00599 {
00600 // The expression was simply "*" !!!
00601 version = "v0";
00602 }
00603 }
00604 at_head = true;
00605 }
00606 else
00607 {
00608 if (m_cmtcvstest) cout << "## (match in non head " << versions << ")" << endl;
00609
00610 at_head = false;
00611 }
00612 }
00613 else
00614 {
00615 if (m_cmtcvstest) cout << "## (match in head " << versions << ")" << endl;
00616
00617 at_head = true;
00618 }
00619
00624 return (true);
00625 }
|
|
|
Definition at line 1243 of file cmt_cvs.cxx. Referenced by checkout(). 01244 {
01245 cout << "> cd <some work area>" << endl;
01246 cout << "> cmt checkout [modifier ...] <package>" << endl;
01247 cout << "" << endl;
01248 cout << " modifier :" << endl;
01249 cout << " -l Do not process used packages (default)." << endl;
01250 cout << " -R Process used packages recursively." << endl;
01251 cout << " -r rev Check out version tag. (is sticky)" << endl;
01252 cout << " -d dir Check out into dir instead of module name." << endl;
01253 cout << " -o offset Offset in the CVS repository" << endl;
01254 cout << " -requirements <requirements file path> Check out packages referenced in this requirements file" << endl;
01255 //cout << " -n simulation mode on" << endl;
01256 //cout << " -v verbose mode on" << endl;
01257 cout << " --help print this help" << endl;
01258 cout << "" << endl;
01259 }
|
|
|
From a space-separated list of version tags, try to find one tag matching a given regular expression. o The first matching tag is returned into 'version' o Success is returned as function value. Definition at line 466 of file cmt_cvs.cxx. Referenced by get_version(). 00469 {
00470 CmtSystem::cmt_string_vector vs;
00471
00472 CmtSystem::split (text, " \t", vs);
00473
00474 version = "";
00475
00476 for (int i = 0; i < vs.size (); i++)
00477 {
00478 const cmt_string& vv = vs[i];
00479
00480 if (version_exp.match (vv))
00481 {
00482 version = vv;
00483 return (true);
00484 }
00485 }
00486
00487 return (false);
00488 }
|
|
|
Definition at line 657 of file cmt_cvs.cxx. 00663 {
00664 cmt_string dir = basedir;
00665 cmt_string out;
00666
00667 cout << "# ================= working on package " << package
00668 << " version " << version;
00669
00670 if (at_head) cout << " (At head) ";
00671
00672 {
00673 cmt_string full_prefix;
00674
00675 full_prefix = m_offset;
00676 full_prefix += prefix;
00677
00678 cmt_string echo_ppath;
00679
00680 if (full_prefix != "")
00681 {
00682 echo_ppath = " path ";
00683 echo_ppath += prefix;
00684 }
00685
00686 cout << echo_ppath << endl;
00687 }
00688
00689 CmtSystem::dirname (dir, dir);
00690
00691 if (!CmtSystem::mkdir (dir))
00692 {
00693 return (false);
00694 }
00695
00696 CmtSystem::cd (dir);
00697
00698 cout << " # get top files " << endl;
00699
00700 cmt_string command = "cvs -Q co -P -l ";
00701 if (!at_head)
00702 {
00703 command += "-r ";
00704 command += version;
00705 }
00706 command += " -d ";
00707 command += version;
00708 command += " ";
00709 command += module;
00710
00711 if (m_cmtcvstest)
00712 {
00713 cmt_string cvsroot;
00714
00715 CmtSystem::get_cvsroot (cvsroot);
00716
00717 cout << "## cvsroot=" << cvsroot << " command[" << command << "]" << endl;
00718 }
00719
00720 int status = CmtSystem::execute (command, out);
00721
00722 //cout << "-> status = " << status << " out=[" << out << "]" << endl;
00723
00724 if (!CmtSystem::cd (version))
00725 {
00726 CmtSystem::mkdir (version);
00727 if (!CmtSystem::cd (version))
00728 {
00729 cout << "# Error creating the version directory :" << version << endl;
00730 cout << "#---------------------------------------------------------" << endl;
00731 return (false);
00732 }
00733 }
00734
00735 dir += CmtSystem::file_separator ();
00736 dir += version;
00737
00738 cmt_string file_name;
00739 cmt_string text;
00740
00741 cmt_string branches = CmtSystem::getenv ("CMTCVSBRANCHES");
00742
00743 if (branches == "")
00744 {
00745 branches = branches_info;
00746 }
00747
00748 CmtSystem::cmt_string_vector branch_vector;
00749
00750 CmtSystem::split (branches, " \t", branch_vector);
00751
00752 int i;
00753
00754 cout << " # get branches " << branches << endl;
00755
00756 command = "";
00757
00758 file_name = "CVS";
00759 file_name += CmtSystem::file_separator ();
00760 file_name += "Entries";
00761
00762 if (!text.read (file_name))
00763 {
00764 // This happens when there were no top files
00765 }
00766
00767 for (i = 0; i < branch_vector.size (); i++)
00768 {
00769 cmt_string& branch = branch_vector[i];
00770
00771 //command += "cvs -Q co -P ";
00772 command += "cvs -Q co ";
00773
00774 // if (branch != "cmt")
00775 // {
00776 if (!at_head)
00777 {
00778 command += "-r ";
00779 command += version;
00780 }
00781 // }
00782
00783 command += " -d ";
00784 command += branch;
00785 command += " ";
00786 command += module;
00787 command += "/"; // CVS uses the '/' notation on all platforms!!
00788 command += branch;
00789 //command += "\n";
00790 command += CmtSystem::command_separator ();
00791
00792 text += "D/";
00793 text += branch;
00794 text += "
00795 }
00796
00797 if (m_cmtcvstest)
00798 {
00799 cmt_string cvsroot;
00800
00801 CmtSystem::get_cvsroot (cvsroot);
00802
00803 cout << " cvsroot=" << cvsroot << " command[" << command << "]" << endl;
00804 }
00805
00806 if (CmtSystem::execute (command, out) == 0)
00807 {
00808 cout << "# Error getting package contents:" << endl;
00809 cout << out << endl;
00810 cout << "#---------------------------------------------------------" << endl;
00811 }
00812 else
00813 {
00814 if (!CmtSystem::test_directory ("CVS"))
00815 {
00821 //cout << "file_name=" << file_name << endl;
00822
00823 CmtSystem::mkdir ("CVS");
00824 cmt_string s;
00825
00826 // Let's create first the CVS/Root file.
00827
00828 CmtSystem::get_cvsroot (s);
00829 s += "\n";
00830
00831 cmt_string f;
00832
00833 f = "CVS";
00834 f += CmtSystem::file_separator ();
00835 f += "Root";
00836
00837 //cout << "f=" << f << " s=[" << s << "]" << endl;
00838 s.write (f);
00839
00840 // Now we create the CVS/Repository file
00841
00842 f = "CVS";
00843 f += CmtSystem::file_separator ();
00844 f += "Repository";
00845
00846 CmtSystem::get_cvsroot (s);
00847 if (s[0] == ':')
00848 {
00849 int pos = s.find (1, ":");
00850 s.erase (0, pos+1);
00851 pos = s.find (0, ":");
00852 s.erase (0, pos+1);
00853 }
00854 s += "/";
00855 s += module;
00856 s += "\n";
00857
00858 //cout << "f=" << f << " s=[" << s << "]" << endl;
00859 s.write (f);
00860 }
00861
00862 // Now the CVS/Entries is ready to be created.
00863 text.write (file_name);
00864 }
00865
00866 return (true);
00867 }
|
|
|
Now retrieve all info fields :. error= tags_top= tags= branches= subpackages= Definition at line 404 of file cmt_cvs.cxx. 00406 {
00407 cmt_string full_name;
00408
00409 if (offset != "")
00410 {
00411 full_name = offset;
00412 full_name += "/";
00413 full_name.replace_all ("//", "/");
00414 }
00415
00416 full_name += module;
00417
00418 show_cvs_infos (full_name);
00419 }
|
|
|
Definition at line 170 of file cmt_cvs.cxx. Referenced by branches(), do_checkout(), get_version(), show_cvs_infos(), and subpackages(). 00171 {
00172 cmt_string out;
00173
00174 if (module == "")
00175 {
00176 cout << "# cmt cvs needs a module name" << endl;
00177 return;
00178 }
00179
00180 cmt_string home_dir = CmtSystem::pwd ();
00181
00182 //
00183 // Activities related with .cmtcvsinfos will occur in a temporary directory
00184 //
00185 cmt_string tmp_dir = CmtSystem::getenv ("TMPDIR");
00186 if (tmp_dir == "")
00187 {
00188 tmp_dir = CmtSystem::file_separator ();
00189 tmp_dir += "tmp";
00190 }
00191
00192 if (!CmtSystem::cd (tmp_dir))
00193 {
00194 tmp_dir = home_dir;
00195 }
00196
00197 tmp_dir += CmtSystem::file_separator ();
00198 tmp_dir += "cmtcvs";
00199 {
00200 cmt_string temp = CmtSystem::get_temporary_name ();
00201 CmtSystem::basename (temp, temp);
00202 tmp_dir += temp;
00203 }
00204
00205 if (!CmtSystem::test_directory (tmp_dir))
00206 {
00207 if (!CmtSystem::mkdir (tmp_dir))
00208 {
00209 cout << "# Cannot create the temporary directory ["
00210 << tmp_dir << "]" << endl;
00211 return;
00212 }
00213 }
00214
00215 //trap "rm -rf ${tmp_dir}" 0 1 2 15
00216
00217 if (!CmtSystem::cd (tmp_dir))
00218 {
00219 cout << "# Cannot move to the temporary directory " << tmp_dir << endl;
00220 return;
00221 }
00222
00223 /*
00224 #
00225 # The script associated to such entries is supposed to :
00226 # 1) extract the set of <infos> from the ${module}/cmt/requirements file
00227 # 2) build an output of the form :
00228 # <infos>=info1 info2 info3 ...
00229 #
00230 # Currently this script can be found in
00231 #
00232 # ${CMTROOT}/cmt/cmt_buildcvsinfos2.sh
00233 # %CMTROOT%/cmt/cmt_buildcvsinfos.py
00234 #
00235 */
00236
00237 if (!CmtSystem::test_directory (".cmtcvsinfos"))
00238 {
00239 CmtSystem::mkdir (".cmtcvsinfos");
00240 }
00241
00242 CmtSystem::cd (".cmtcvsinfos");
00243
00244 cmt_string cvsroot;
00245
00246 CmtSystem::get_cvsroot (cvsroot);
00247
00248 cmt_string command;
00249
00250 command = "cvs";
00251 if (cvsroot != "")
00252 {
00253 command += " -d ";
00254 command += cvsroot;
00255 }
00256 command += " -Q import -m cmt ";
00257 if (m_cmtcvstest)
00258 {
00259 command += ".cmtcvsinfos/cmtcvstest";
00260 }
00261 else
00262 {
00263 command += ".cmtcvsinfos";
00264 }
00265 command += "/";
00266 command += module;
00267 command += " CMT v1";
00268
00269 CmtSystem::execute (command, out);
00270
00271 //cout << "# after cvsinfos out=[" << out << "]" << endl;
00272
00284 Grep grep;
00285
00286 grep.run (out, "error=");
00287
00288 if (grep.result () != "")
00289 {
00290 error_info = grep.result ();
00291 error_info.replace ("error=", "");
00292 }
00293 else
00294 {
00295 error_info = "";
00296 }
00297
00298 grep.run (out, "tags_top=");
00299
00300 if (grep.result () != "")
00301 {
00302 tags_top_info = grep.result ();
00303 tags_top_info.replace ("tags_top=", "");
00304 }
00305 else
00306 {
00307 tags_top_info = "";
00308 }
00309
00310 grep.run (out, "tags=");
00311
00312 if (grep.result () != "")
00313 {
00314 tags_info = grep.result ();
00315 tags_info.replace ("tags=", "");
00316 }
00317 else
00318 {
00319 tags_info = "";
00320 }
00321
00322 grep.run (out, "cvsversions_top=");
00323
00324 if (grep.result () != "")
00325 {
00326 cvsversions_top_info = grep.result ();
00327 cvsversions_top_info.replace ("cvsversions_top=", "");
00328 }
00329 else
00330 {
00331 cvsversions_top_info = "";
00332 }
00333
00334 grep.run (out, "cvsversions=");
00335
00336 if (grep.result () != "")
00337 {
00338 cvsversions_info = grep.result ();
00339 cvsversions_info.replace ("cvsversions=", "");
00340 }
00341 else
00342 {
00343 cvsversions_info = "";
00344 }
00345
00346 cmt_string tag_filter = CmtSystem::getenv ("CMTCVSTAGFILTER");
00347
00348 if (tag_filter != "")
00349 {
00350 cmt_string package;
00351 CmtSystem::basename (module, package);
00352
00353 cmt_string pattern = "<package>";
00354
00355 tag_filter.replace_all (pattern, package);
00356
00357 cmt_regexp exp (tag_filter);
00358
00359 cmt_string text;
00360
00361 filter_list (tags_top_info, exp);
00362 filter_list (tags_info, exp);
00363 filter_list (cvsversions_top_info, exp);
00364 filter_list (cvsversions_info, exp);
00365 }
00366
00367 if (m_cmtcvstest)
00368 {
00369 cout << "## tags_top_info=" << tags_top_info << endl;
00370 cout << "## tags_info=" << tags_info << endl;
00371 cout << "## cvsversions_top_info=" << cvsversions_top_info << endl;
00372 cout << "## cvsversions_info=" << cvsversions_info << endl;
00373 }
00374
00375 grep.run (out, "branches=");
00376
00377 if (grep.result () != "")
00378 {
00379 branches_info = grep.result ();
00380 branches_info.replace ("branches=", "");
00381 }
00382 else
00383 {
00384 branches_info = "";
00385 }
00386
00387 grep.run (out, "subpackages=");
00388
00389 if (grep.result () != "")
00390 {
00391 subpackages_info = grep.result ();
00392 subpackages_info.replace ("subpackages=", "");
00393 }
00394 else
00395 {
00396 subpackages_info = "";
00397 }
00398
00399 CmtSystem::cd (home_dir);
00400 //cout << "# (removing tmp_dir= " << tmp_dir << " home=" << home_dir<< ")" << endl;
00401 CmtSystem::remove_directory (tmp_dir);
00402 }
|
|
|
Definition at line 1227 of file cmt_cvs.cxx. Referenced by Cvs::subpackages(). 01228 {
01229 cmt_string out;
01230
01231 show_cvs_infos (CmtSystem::getenv ("CMTCVSOFFSET"), module);
01232
01233 if (error_info != "")
01234 {
01235 cout << error_info << endl;
01236 }
01237 else
01238 {
01239 cout << subpackages_info << endl;
01240 }
01241 }
|
|
|
Definition at line 1133 of file cmt_cvs.cxx. Referenced by Cvs::tags(). 01134 {
01135 if (arguments.size () < 1)
01136 {
01137 help ();
01138 return;
01139 }
01140
01141 if (CmtSystem::getenv ("CVSROOT") == "")
01142 {
01143 cout << "# Please set CVSROOT first !" << endl;
01144 return;
01145 }
01146
01147 if (CmtSystem::getenv ("CMTCVSTEST") != "")
01148 {
01149 m_cmtcvstest = true;
01150 }
01151 else
01152 {
01153 m_cmtcvstest = false;
01154 }
01155
01156 m_offset = CmtSystem::getenv ("CMTCVSOFFSET");
01157 if (m_offset != "")
01158 {
01159 m_offset += "/";
01160 m_offset.replace_all ("//", "/");
01161 }
01162
01163 bool all = false;
01164
01165 for (int arg = 0; arg < arguments.size (); arg++)
01166 {
01167 const cmt_string& option = arguments[arg];
01168
01169 if (option == "-all")
01170 {
01171 all = true;
01172 }
01173 else
01174 {
01175 show_cvs_infos (CmtSystem::getenv ("CMTCVSOFFSET"), option);
01176
01177 if (error_info != "")
01178 {
01179 cout << error_info << endl;
01180 }
01181 else
01182 {
01183 cmt_string tags;
01184
01185 if (all)
01186 {
01187 tags = cvsversions_top_info;
01188 tags += " ";
01189 tags += cvsversions_info;
01190 }
01191 else
01192 {
01193 tags = tags_top_info;
01194 tags += " ";
01195 tags += tags_info;
01196 }
01197
01198 CmtSystem::cmt_string_vector v;
01199
01200 CmtSystem::split (tags, " \t", v);
01201 for (int i = 0; i < v.size (); i++)
01202 {
01203 const cmt_string& s = v[i];
01204 cout << s << endl;
01205 }
01206 }
01207 }
01208 }
01209 }
|
|
|
Definition at line 1540 of file cmt_cvs.cxx. |
|
|
Definition at line 1539 of file cmt_cvs.cxx. |
|
|
Definition at line 1538 of file cmt_cvs.cxx. |
|
|
Definition at line 1535 of file cmt_cvs.cxx. |
|
|
Definition at line 1533 of file cmt_cvs.cxx. |
|
|
Definition at line 1531 of file cmt_cvs.cxx. |
|
|
Definition at line 1528 of file cmt_cvs.cxx. |
|
|
Definition at line 1527 of file cmt_cvs.cxx. |
|
|
Definition at line 1530 of file cmt_cvs.cxx. |
|
|
Definition at line 1532 of file cmt_cvs.cxx. |
|
|
Definition at line 1526 of file cmt_cvs.cxx. |
|
|
Definition at line 1541 of file cmt_cvs.cxx. |
|
|
Definition at line 1537 of file cmt_cvs.cxx. |
|
|
Definition at line 1536 of file cmt_cvs.cxx. |
1.2.3 written by Dimitri van Heesch,
© 1997-2000