Collaboration diagram for CvsImplementation:
Public Methods |
|
| ? | CvsImplementation () |
| 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 :. |
| 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. |
| 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. |
| 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). |
| 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. |
| 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 |
| bool? | m_verbose |
| bool? | m_simulation |
| cmt_string? | m_home_dir |
| cmt_string? | m_checkout_dir |
| cmt_string? | m_offset |
| cmt_string? | m_branch_suffix |
| cmt_string? | m_last_module |
| cmt_string? | m_last_cvs_infos |
| 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 125 of file cmt_cvs.cxx.
|
| ? |
Definition at line 129 of file cmt_cvs.cxx. References branches_info, cvsversions_info, cvsversions_top_info, error_info, m_branch_suffix, m_checkout_dir, m_cmtcvstest, m_head, m_home_dir, m_last_cvs_infos, m_last_module, m_offset, m_recursive, m_simulation, m_verbose, subpackages_info, tags_info, and tags_top_info. 00130 {
00131 m_recursive = false;
00132 m_head = false;
00133 m_cmtcvstest = false;
00134 m_verbose = false;
00135 m_simulation = false;
00136
00137 m_home_dir = "";
00138 m_checkout_dir = "";
00139 m_offset = "";
00140 m_branch_suffix = "";
00141
00142 m_last_module = "";
00143 m_last_cvs_infos = "";
00144 error_info = "";
00145 tags_top_info = "";
00146 tags_info = "";
00147 cvsversions_top_info = "";
00148 cvsversions_info = "";
00149 branches_info = "";
00150 subpackages_info = "";
00151 }
|
|
| ? |
Definition at line 1520 of file cmt_cvs.cxx. References CmtSystem::getenv(), and show_cvs_infos(). Referenced by Cvs::branches(). 01521 {
01522 cmt_string out;
01523
01524 show_cvs_infos (CmtSystem::getenv ("CMTCVSOFFSET"), module);
01525
01526 if (error_info != "")
01527 {
01528 cout << error_info << endl;
01529 }
01530 else
01531 {
01532 cout << branches_info << endl;
01533 }
01534 }
|
|
||||||||||||||||
| ? |
Here we have at least one version matching the requested expression. Definition at line 693 of file cmt_cvs.cxx. References CmtSystem::file_separator(), Cmt::get_current_structuring_style(), m_checkout_dir, m_home_dir, CmtSystem::reduce_file_separators(), and with_version_directory. Referenced by checkout_package(). 00696 {
00697 cmt_string dir = m_home_dir;
00698
00699 if (m_checkout_dir != "")
00700 {
00701 dir += CmtSystem::file_separator ();
00702 dir += m_checkout_dir;
00703 }
00704
00705 dir += CmtSystem::file_separator ();
00706 dir += prefix;
00707 dir += CmtSystem::file_separator ();
00708 dir += package;
00709
00710 if (Cmt::get_current_structuring_style () == with_version_directory)
00711 {
00712 dir += CmtSystem::file_separator ();
00713 dir += version;
00714 }
00715
00716 CmtSystem::reduce_file_separators (dir);
00717
00718 return (dir);
00719 }
|
|
| ? |
Definition at line 1741 of file cmt_cvs.cxx. References checkout_from_requirements(), do_checkout(), CmtSystem::getenv(), help(), CmtSystem::pwd(), cmt_string::replace_all(), and cmt_vector< cmt_string >::size(). Referenced by Cvs::checkout(). 01742 {
01743 if (arguments.size () < 1)
01744 {
01745 help ();
01746 return;
01747 }
01748
01749 if (CmtSystem::getenv ("CVSROOT") == "")
01750 {
01751 cout << "# Please set CVSROOT first !" << endl;
01752 return;
01753 }
01754
01755 if (CmtSystem::getenv ("CMTCVSTEST") != "")
01756 {
01757 m_cmtcvstest = true;
01758 }
01759 else
01760 {
01761 m_cmtcvstest = false;
01762 }
01763
01764 m_home_dir = CmtSystem::pwd ();
01765 m_checkout_dir = "";
01766 m_offset = "";
01767 m_branch_suffix = "";
01768
01769 cmt_string module;
01770
01771 m_recursive = false;
01772
01773 bool need_version_tag = false;
01774 cmt_string version_tag;
01775
01776 bool need_checkout_dir = false;
01777 bool need_offset = false;
01778 bool need_requirements_file = false;
01779
01780 m_simulation = false;
01781 //m_verbose = true;
01782 m_verbose = false;
01783
01784 bool need_branch_suffix = false;
01785
01786 m_head = true;
01787
01788 m_offset = CmtSystem::getenv ("CMTCVSOFFSET");
01789 if (m_offset != "")
01790 {
01791 m_offset += "/";
01792 m_offset.replace_all ("//", "/");
01793 }
01794
01795 for (int arg = 0; arg < arguments.size (); arg++)
01796 {
01797 const cmt_string& option = arguments[arg];
01798
01799 if (need_version_tag)
01800 {
01801 need_version_tag = false;
01802
01803 if (option == "HEAD")
01804 {
01805 m_head = true;
01806 }
01807 else
01808 {
01809 version_tag = option;
01810 }
01811 }
01812 else if (need_checkout_dir)
01813 {
01814 need_checkout_dir = false;
01815 m_checkout_dir = option;
01816 }
01817 else if (need_offset)
01818 {
01819 need_offset = false;
01820 m_offset = option;
01821 m_offset += '/';
01822 m_offset.replace_all ("//", "/");
01823 }
01824 else if (need_branch_suffix)
01825 {
01826 need_branch_suffix = false;
01827 m_branch_suffix = "-";
01828 m_branch_suffix += option;
01829 }
01830 else if (need_requirements_file)
01831 {
01832 need_requirements_file = false;
01833 m_head = false;
01834 checkout_from_requirements (option);
01835 }
01836 else
01837 {
01838 if (option == "-R")
01839 {
01840 m_recursive = true;
01841 }
01842 else if (option == "-l")
01843 {
01844 m_recursive = false;
01845 }
01846 else if (option == "-r")
01847 {
01848 need_version_tag = true;
01849 m_head = false;
01850 }
01851 else if (option == "-d")
01852 {
01853 need_checkout_dir = true;
01854 }
01855 else if (option == "-o")
01856 {
01857 need_offset = true;
01858 }
01859 else if (option == "-n")
01860 {
01861 m_simulation = true;
01862 }
01863 else if (option == "-v")
01864 {
01865 m_verbose = true;
01866 }
01867 else if (option == "-branch")
01868 {
01869 need_branch_suffix = true;
01870 }
01871 else if (option == "-requirements")
01872 {
01873 need_requirements_file = true;
01874 }
01875 else if (option == "--help")
01876 {
01877 help ();
01878 return;
01879 }
01880 else if (option[0] == '-')
01881 {
01882 help ();
01883 return;
01884 }
01885 else
01886 {
01887 do_checkout (option, version_tag);
01888 }
01889 }
01890 }
01891
01892 }
|
|
| ? |
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 1427 of file cmt_cvs.cxx. References cmt_string::read(), RecursivePass1::result(), and Awk::run(). Referenced by checkout(), and checkout_package(). 01428 {
01429 static cmt_regexp expression ("^[ \t]*use[ \t]");
01430
01431 cmt_string text;
01432
01433 text.read (requirements_path);
01434
01435 RecursivePass1 p1;
01436 p1.run (text, expression);
01437
01438 RecursivePass2 p2 (*this);
01439 p2.run (p1.result ());
01440 }
|
|
||||||||||||||||
| ? |
Definition at line 1193 of file cmt_cvs.cxx. References build_version_directory(), CmtSystem::cd(), checkout_from_requirements(), CmtSystem::file_separator(), cmt_string::find(), find_matching_version(), Cmt::get_current_structuring_style(), get_version(), cmt_string::npos, really_checkout_package(), CmtSystem::test_directory(), CmtSystem::test_file(), without_version_directory, and cmt_string::write(). Referenced by do_checkout(), and RecursivePass2::filter(). 01196 {
01197 if (m_verbose)
01198 {
01199 cout << "#CMT> checkout_package> prefix=" << prefix
01200 << " package=" << package
01201 << " specified_version=" << specified_version
01202 << endl;
01203 }
01204
01205 cmt_string version = specified_version;
01206 cmt_string empty;
01207 cmt_string full_prefix;
01208
01209 full_prefix = m_offset;
01210 full_prefix += prefix;
01211
01212 cmt_string echo_ppath;
01213
01214 if (prefix != "")
01215 {
01216 echo_ppath = " path ";
01217 echo_ppath += prefix;
01218 }
01219
01220 if (version == "")
01221 {
01222 cout << "# ================= No version specified for package " << package << endl;
01223 return;
01224 }
01225
01226 //
01227 // First make an attempt to locate the specified version of
01228 // this package "as-it-is" in the work area.
01229 // Since 'version' may contain wild-card, it's likely that
01230 // we should not simply use CmtSystem::test_directory but
01231 // use the wild-card search.
01232 //
01233
01234 cmt_string dir;
01235
01236 dir = build_version_directory (prefix, package, version);
01237
01238 if (m_cmtcvstest)
01239 cout << "## (testing dir= " << dir << ")" << endl;
01240
01241 bool recursive = m_recursive;
01242
01243 /*
01244 if (m_cmtcvstest)
01245 {
01246 cmt_string v = find_matching_version (dir);
01247
01248 cout << "---> v=" << v << endl;
01249 }
01250 */
01251
01252 cmt_string effective_version = find_matching_version (dir);
01253
01254 if (effective_version != "")
01255 {
01256 version = effective_version;
01257
01258 dir = build_version_directory (prefix, package, version);
01259
01260 cout << "# ================= Package " << package
01261 << " version " << version << echo_ppath
01262 << " already installed in " << dir << endl;
01263
01264 recursive = false;
01265 }
01266 else
01267 {
01268 bool at_head = false;
01269 cmt_string module;
01270
01271 //
01272 // get_version attempts to find the most appropriate version
01273 // tag matching the specification FROM the repository. However,
01274 // we should take into account situations where some versions have
01275 // already been checked out, in which case they might be sufficient
01276 // (or preferred?)
01277 //
01278
01279 if (version.find ("*") != cmt_string::npos)
01280 {
01281 cout << "# ================= Package " << package
01282 << " version " << version << echo_ppath
01283 << " has wild cards and will not be considered." << endl;
01284 return;
01285 }
01286
01287 if (!get_version (full_prefix, package, version,
01288 module, version, at_head))
01289 {
01290 return;
01291 }
01292
01293 //cout << " full_prefix=[" << full_prefix << "] module=[" << module << "]" << endl;
01294
01295 if (m_cmtcvstest) cout << "## after get_version at_head=" << at_head << " m_head=" << m_head << endl;
01296
01297 if (m_head)
01298 {
01299 m_head = false;
01300
01301 at_head = true;
01302 }
01303 else
01304 {
01305 at_head = false;
01306 }
01307
01308 //
01309 // Make a second try after having selected a version from all the
01310 // available versions compatible with the specified version
01311 //
01312
01313 dir = build_version_directory (prefix, package, version);
01314
01315 if (CmtSystem::test_directory (dir))
01316 {
01317 cout << "# ================= Package " << package
01318 << " version " << version << echo_ppath
01319 << " already installed." << endl;
01320
01321 recursive = false;
01322 }
01323 else
01324 {
01325 //
01326 // Now we can say that we have to perform the real checkout.
01327 //
01328
01329 if (!really_checkout_package (prefix, package, version, module, dir, at_head))
01330 {
01331 cout << "# bad return from really_checkout_package" << endl;
01332 return;
01333 }
01334 }
01335 }
01336
01337 //
01338 // Now reach the newly checked out package.
01339 //
01340
01341 if (m_simulation)
01342 {
01343 cout << "#CMT> Package directory not really created " << dir << endl;
01344 }
01345 else
01346 {
01347 if (!CmtSystem::cd (dir))
01348 {
01349 cout << "#CMT> Package directory not created " << dir << endl;
01350 }
01351
01352
01353 /*
01354 if (m_verbose)
01355 {
01356 cout << "#CMT> pwd.4=" << CmtSystem::pwd () << endl;
01357 }
01358 */
01359
01360 // Check if it is a true CMT package.
01361
01362 cmt_string file_name;
01363
01364 file_name = "cmt";
01365 file_name += CmtSystem::file_separator ();
01366 file_name += "requirements";
01367
01368 if (CmtSystem::test_file (file_name))
01369 {
01370 dir += CmtSystem::file_separator ();
01371 dir += "cmt";
01372 CmtSystem::cd ("cmt");
01373
01374 /*
01375 if (m_verbose)
01376 {
01377 cout << "#CMT> pwd.5=" << CmtSystem::pwd () << endl;
01378 }
01379 */
01380
01381 if (Cmt::get_current_structuring_style () == without_version_directory)
01382 {
01383 cmt_string text = version;
01384 text += "\n";
01385 text.write ("version.cmt");
01386 }
01387 }
01388 else
01389 {
01390 file_name = "mgr";
01391 file_name += CmtSystem::file_separator ();
01392 file_name += "requirements";
01393
01394 if (CmtSystem::test_file (file_name))
01395 {
01396 dir += CmtSystem::file_separator ();
01397 dir += "mgr";
01398 CmtSystem::cd ("mgr");
01399
01400 /*
01401 if (m_verbose)
01402 {
01403 cout << "#CMT> pwd.6=" << CmtSystem::pwd () << endl;
01404 }
01405 */
01406 }
01407 else
01408 {
01409 cout << "# " << package << " not a CMT package" << endl;
01410 return;
01411 }
01412 }
01413
01414 //cout << "# (recursive is " << recursive << ")" << endl;
01415
01416 if (recursive)
01417 {
01418 checkout_from_requirements ("requirements");
01419 }
01420 }
01421 }
|
|
||||||||||||
| ? |
Definition at line 1570 of file cmt_cvs.cxx. References CmtSystem::basename(), CmtSystem::cd(), checkout_package(), History::clear(), CmtSystem::dirname(), CmtSystem::execute(), CmtSystem::file_separator(), History::instance(), CmtSystem::reduce_file_separators(), Cut::result(), Awk::run(), show_cvs_infos(), and CmtSystem::test_file(). Referenced by checkout(). 01571 {
01572 //CMTPATH=${CMTPATH}:${m_home_dir}; export CMTPATH
01573
01574 History& h = History::instance ();
01575
01576 h.clear ();
01577
01578 if (module == "")
01579 {
01580 if (m_verbose)
01581 {
01582 cout << "#CMT> Missing module name" << endl;
01583 }
01584 return;
01585 }
01586
01587 cmt_string prefix;
01588 cmt_string package;
01589 cmt_string version;
01590
01591 if (version_tag == "")
01592 {
01593 Cut cut (0);
01594
01595 cmt_string m;
01596 m = m_offset;
01597 m += module;
01598
01599 show_cvs_infos (m);
01600
01601 if (error_info != "")
01602 {
01603 cout << error_info << endl;
01604 return;
01605 }
01606
01607 if (tags_top_info != "") version = tags_top_info;
01608 else version = tags_info;
01609
01610 //if (CmtSystem::testenv ("CMTTESTAWK")) cout << "version=" << version << endl;
01611
01612 cut.run (version);
01613
01614 version = cut.result ();
01615
01616 //if (CmtSystem::testenv ("CMTTESTAWK")) cout << "version=" << version << endl;
01617 }
01618 else
01619 {
01620 version = version_tag;
01621 }
01622
01623 CmtSystem::dirname (module, prefix);
01624 CmtSystem::basename (module, package);
01625
01626 cmt_string top_dir;
01627
01628 top_dir = m_home_dir;
01629 top_dir += CmtSystem::file_separator ();
01630 top_dir += m_checkout_dir;
01631 top_dir += CmtSystem::file_separator ();
01632 top_dir += prefix;
01633 top_dir += CmtSystem::file_separator ();
01634 top_dir += package;
01635 top_dir += CmtSystem::file_separator ();
01636 top_dir += version;
01637
01638 CmtSystem::reduce_file_separators (top_dir);
01639
01640 if (m_verbose)
01641 {
01642 cout << "#CMT> about to checkout package " << package << " version " << version << " into " << top_dir << endl;
01643 }
01644
01645 checkout_package (prefix, package, version);
01646
01647 /*
01648 if (m_verbose)
01649 {
01650 cout << "#CMT> after checkout_package pwd.7=" << CmtSystem::pwd () << " top_dir=" << top_dir << endl;
01651 }
01652 */
01653
01654 if (m_simulation) return;
01655
01656 if (!CmtSystem::cd (top_dir)) return;
01657
01658 /*
01659 if (m_verbose)
01660 {
01661 cout << "#CMT> pwd.8=" << CmtSystem::pwd () << endl;
01662 }
01663 */
01664
01665 cmt_string file_name;
01666
01667 file_name = "cmt";
01668 file_name += CmtSystem::file_separator ();
01669 file_name += "requirements";
01670
01671 if (CmtSystem::test_file (file_name))
01672 {
01673 top_dir += CmtSystem::file_separator ();
01674 top_dir += "cmt";
01675 CmtSystem::cd ("cmt");
01676
01677 /*
01678 if (m_verbose)
01679 {
01680 cout << "#CMT> pwd.9=" << CmtSystem::pwd () << endl;
01681 }
01682 */
01683 }
01684 else
01685 {
01686 file_name = "mgr";
01687 file_name += CmtSystem::file_separator ();
01688 file_name += "requirements";
01689
01690 if (CmtSystem::test_file (file_name))
01691 {
01692 top_dir += CmtSystem::file_separator ();
01693 top_dir += "mgr";
01694 CmtSystem::cd ("mgr");
01695
01696 /*
01697 if (m_verbose)
01698 {
01699 cout << "#CMT> pwd.10=" << CmtSystem::pwd () << endl;
01700 }
01701 */
01702 }
01703 else
01704 {
01705 cout << "# " << package << " was not properly checked out and is missing its cmt/requirements file" << endl;
01706 return;
01707 }
01708 }
01709
01710 if (m_verbose)
01711 {
01712 cout << "#CMT> package " << package << " has been checked out" << endl;
01713 }
01714
01715 if (m_recursive)
01716 {
01717 if (m_verbose || m_simulation)
01718 {
01719 cout << "#CMT> Executing [" << "cmt -quiet broadcast cmt -quiet config" << "]" << endl;
01720 }
01721
01722 if (!m_simulation)
01723 {
01724 CmtSystem::execute ("cmt -quiet broadcast cmt -quiet config");
01725 }
01726 }
01727 else
01728 {
01729 if (m_verbose || m_simulation)
01730 {
01731 cout << "#CMT> Executing [" << "cmt -quiet config" << "]" << endl;
01732 }
01733
01734 if (!m_simulation)
01735 {
01736 CmtSystem::execute ("cmt -quiet config");
01737 }
01738 }
01739 }
|
|
| ? |
Definition at line 484 of file cmt_cvs.cxx. References cmt_string::erase(), cmt_string::find(), and cmt_string::npos. 00485 {
00486 while (true)
00487 {
00488 int pos = d.find ("/../");
00489 if (pos == cmt_string::npos) break;
00490
00491 int slash = d.find ("/");
00492 if (slash < pos)
00493 {
00494 //
00495 // xxxxx/yyy/../zzzz -> xxxxx/zzzz
00496 // 01234567890123456
00497 // 1234567
00498 // pos = 9
00499 // slash = 5
00500 // length = 9+3-5
00501 //
00502 d.erase (slash + 1, pos + 3 - slash);
00503 }
00504 else
00505 {
00506 //
00507 // yyy/../zzzz -> zzzz
00508 // 01234567890
00509 // 1234567
00510 // pos = 3
00511 // length = 3+1+3
00512 //
00513 d.erase (0, pos + 1 + 3);
00514 }
00515 }
00516 }
|
|
||||||||||||
| ? |
Definition at line 153 of file cmt_cvs.cxx. References cmt_regexp::match(), cmt_vector< cmt_string >::size(), and CmtSystem::split(). Referenced by show_cvs_infos(). 00154 {
00155 CmtSystem::cmt_string_vector list;
00156
00157 CmtSystem::split (text, " ", list);
00158
00159 int i;
00160
00161 text = "";
00162
00163 for (i = 0; i < list.size (); i++)
00164 {
00165 const cmt_string& s = list[i];
00166 if (exp.match (s))
00167 {
00168 if (i > 0) text += " ";
00169 text += s;
00170 }
00171 }
00172 }
|
|
| ? |
The CVS repository had not been created (this is generally due to the lack of top files). Definition at line 1132 of file cmt_cvs.cxx. References CmtSystem::basename(), CmtSystem::dirname(), CmtSystem::file_separator(), cmt_string::find(), cmt_string::npos, cmt_string::replace(), CmtSystem::scan_dir(), cmt_vector< cmt_string >::size(), and CmtSystem::test_directory(). Referenced by checkout_package(). 01133 {
01134 cmt_string result;
01135
01136 //
01137 // Here expression takes the form
01138 //
|
|
||||||||||||||||||||||||||||
| ? |
Definition at line 550 of file cmt_cvs.cxx. References error_info, cmt_string::find(), match_version_request(), cmt_string::npos, cmt_string::replace(), cmt_string::replace_all(), show_cvs_infos(), tags_info, and tags_top_info. Referenced by checkout_package(). 00556 {
00557 Grep grep;
00558 cmt_string topversions;
00559 cmt_string versions;
00560 cmt_string requested_version = version_request;
00561
00562 at_head = false;
00563
00564 module = "";
00565
00566 if (prefix != "")
00567 {
00568 module = prefix;
00569 module += "/"; // This is for CVS only thus we don't use the real separator.
00570 while (module.find ("//") != cmt_string::npos)
00571 {
00572 module.replace_all ("//", "/");
00573 }
00574 }
00575
00576 module += package;
00577
00592 if (m_verbose)
00593 {
00594 cout << "#CMT> requesting cvs infos onto module " << module << endl;
00595 }
00596
00597 show_cvs_infos (module);
00598
00599 if (error_info != "")
00600 {
00601 versions = "";
00602 cout << "# Package " << package << " not found in ${CVSROOT}" << endl;
00603 return (false);
00604 }
00605
00606 versions = tags_top_info;
00607
00608 cmt_string v = version_request;
00609
00610 if (version_request.find ("*") != cmt_string::npos)
00611 {
00612 v.replace_all ("*", ".*");
00613 }
00614 else
00615 {
00616 v += "$";
00617 }
00618
00619 if (m_cmtcvstest) cout << "## (version expression is " << v << ")" << endl;
00620
00621 cmt_regexp version_exp (v);
00622
00623 if (!match_version_request (versions, version_exp, version))
00624 {
00625 if (m_cmtcvstest) cout << "## (no match in " << versions << ")" << endl;
00626
00627 // We try on non-top versions
00628
00629 versions = tags_info;
00630
00631 if (!match_version_request (versions, version_exp, version))
00632 {
00633 if (m_cmtcvstest) cout << "## (no match in " << versions << ")" << endl;
00634
00635 version = requested_version;
00636 int pos = 0;
00637 if ((pos = version.find ("*")) != cmt_string::npos)
00638 {
00639 //
00640 // There was a wild card but the expression does not match
00641 // any of the existing tags in CVS.
00642 // Things will be retreived from HEAD but we have to build
00643 // a reasonable version tag from the wild card expression.
00644 // If the letter before the * was a digit, then simply remove
00645 // the * (v5* -> v5) otherwise add a zero (v5r* -> v5r0)
00646 //
00647 if (pos > 0)
00648 {
00649 char letter = version[pos-1];
00650
00651 static const cmt_string digits = "0123456789";
00652
00653 if (digits.find (letter) == cmt_string::npos)
00654 {
00655 // "v5r*" -> "v5r0"
00656 version.replace ("*", "0");
00657 }
00658 else
00659 {
00660 // "v5*" -> "v5"
00661 version.replace ("*", "");
00662 }
00663 }
00664 else
00665 {
00666 // The expression was simply "*" !!!
00667 version = "v0";
00668 }
00669 }
00670 at_head = true;
00671 }
00672 else
00673 {
00674 if (m_cmtcvstest) cout << "## (match in non head " << versions << ")" << endl;
00675
00676 at_head = false;
00677 }
00678 }
00679 else
00680 {
00681 if (m_cmtcvstest) cout << "## (match in head " << versions << ")" << endl;
00682
00683 at_head = true;
00684 }
00685
00690 return (true);
00691 }
|
|
| ? |
Definition at line 1552 of file cmt_cvs.cxx. Referenced by checkout(), and tags(). 01553 {
01554 cout << "> cd
|
|
||||||||||||||||
| ? |
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 526 of file cmt_cvs.cxx. References cmt_regexp::match(), cmt_vector< cmt_string >::size(), and CmtSystem::split(). Referenced by get_version(). 00529 {
00530 CmtSystem::cmt_string_vector vs;
00531
00532 CmtSystem::split (text, " \t", vs);
00533
00534 version = "";
00535
00536 for (int i = 0; i < vs.size (); i++)
00537 {
00538 const cmt_string& vv = vs[i];
00539
00540 if (version_exp.match (vv))
00541 {
00542 version = vv;
00543 return (true);
00544 }
00545 }
00546
00547 return (false);
00548 }
|
|
||||||||||||||||||||||||||||
| ? |
Definition at line 721 of file cmt_cvs.cxx. References CmtSystem::cd(), CmtSystem::command_separator(), CmtSystem::dirname(), cmt_string::erase(), CmtSystem::execute(), CmtSystem::file_separator(), cmt_string::find(), Cmt::get_current_structuring_style(), CmtSystem::get_cvsroot(), CmtSystem::getenv(), CmtSystem::mkdir(), cmt_string::read(), cmt_vector< cmt_string >::size(), CmtSystem::split(), CmtSystem::test_directory(), with_version_directory, and cmt_string::write(). Referenced by checkout_package(). 00727 {
00728 cmt_string dir = basedir;
00729 cmt_string out;
00730
00731 cout << "# ================= working on package " << package
00732 << " version " << version;
00733
00734 if (at_head) cout << " (At head) ";
00735
00736 {
00737 cmt_string full_prefix;
00738
00739 full_prefix = m_offset;
00740 full_prefix += prefix;
00741
00742 cmt_string echo_ppath;
00743
00744 if (prefix != "")
00745 {
00746 echo_ppath = " path ";
00747 echo_ppath += prefix;
00748 }
00749
00750 cout << echo_ppath << endl;
00751 }
00752
00753 CmtSystem::dirname (dir, dir);
00754
00755 //if (Cmt::get_current_structuring_style () == with_version_directory)
00756 {
00757 if (m_simulation)
00758 {
00759 cout << "#CMT> Would mkdir " << dir << endl;
00760 }
00761 else
00762 {
00763 if (m_verbose)
00764 {
00765 cout << "#CMT> About to mkdir " << dir << endl;
00766 }
00767
00768 if (!CmtSystem::mkdir (dir))
00769 {
00770 cout << "# Error creating the base directory :" << dir << endl;
00771 cout << "#---------------------------------------------------------" << endl;
00772 return (false);
00773 }
00774
00775 CmtSystem::cd (dir);
00776
00777 /*
00778 if (m_verbose)
00779 {
00780 cout << "#CMT> pwd.1=" << CmtSystem::pwd () << endl;
00781 }
00782 */
00783 }
00784 }
00785
00786 cout << " # get top files " << endl;
00787
00788 cmt_string command = "cvs -Q co -P -l ";
00789 if (!at_head)
00790 {
00791 command += "-r ";
00792 command += version;
00793 }
00794
00795 if (Cmt::get_current_structuring_style () == with_version_directory)
00796 {
00797 command += " -d ";
00798 command += version;
00799 }
00800 else
00801 {
00802 command += " -d ";
00803 command += package;
00804 }
00805
00806 command += " ";
00807 command += module;
00808
00809 if (m_cmtcvstest)
00810 {
00811 cmt_string cvsroot;
00812
00813 CmtSystem::get_cvsroot (cvsroot);
00814
00815 cout << "## cvsroot=" << cvsroot << " command[" << command << "]" << endl;
00816 }
00817
00818 int status = 0;
00819 int retry = 0;
00820
00821 for (;;)
00822 {
00823 if (m_verbose || m_simulation)
00824 {
00825 cout << "#CMT> Executing [" << command << "]" << endl;
00826 }
00827
00828 if (!m_simulation)
00829 {
00830 //status = CmtSystem::execute (command, out);
00831 status = CmtSystem::execute (command);
00832 }
00833
00834 if (status != 0)
00835 {
00836 retry++;
00837
00838 cout << "# Error getting package CMT contents: status=" << status << endl;
00839 cout << "#---------------------------------------------------------" << endl;
00840
00841 if (retry > 5) exit(0);
00842
00843 }
00844 else
00845 {
00846 break;
00847 }
00848 }
00849
00850
00851 {
00852 if (Cmt::get_current_structuring_style () == with_version_directory)
00853 {
00854 if (m_simulation)
00855 {
00856 cout << "#CMT> Would mkdir " << version << endl;
00857 }
00858 else
00859 {
00860 if (m_verbose)
00861 {
00862 cout << "#CMT> About to mkdir " << version << endl;
00863 }
00864 if (!CmtSystem::cd (version))
00865 {
00866 CmtSystem::mkdir (version);
00867 if (!CmtSystem::cd (version))
00868 {
00869 cout << "# Error creating the version directory :" << version << endl;
00870 cout << "#---------------------------------------------------------" << endl;
00871 return (false);
00872 }
00873 }
00874
00875 /*
00876 if (m_verbose)
00877 {
00878 cout << "#CMT> pwd.2=" << CmtSystem::pwd () << endl;
00879 }
00880 */
00881 }
00882
00883 dir += CmtSystem::file_separator ();
00884 dir += version;
00885 }
00886 else
00887 {
00888 if (m_simulation)
00889 {
00890 cout << "#CMT> will mkdir " << package << endl;
00891 }
00892 else
00893 {
00894 if (!CmtSystem::cd (package))
00895 {
00896 if (m_verbose)
00897 {
00898 cout << "#CMT> About to mkdir " << package << endl;
00899 }
00900 CmtSystem::mkdir (package);
00901 if (!CmtSystem::cd (package))
00902 {
00903 cout << "# Error creating the package directory :" << package << endl;
00904 cout << "#---------------------------------------------------------" << endl;
00905 return (false);
00906 }
00907 }
00908
00909 /*
00910 if (m_verbose)
00911 {
00912 cout << "#CMT> pwd.3=" << CmtSystem::pwd () << endl;
00913 }
00914 */
00915 }
00916
00917 dir += CmtSystem::file_separator ();
00918 dir += package;
00919 }
00920 }
00921
00922 cmt_string entries_file_name;
00923 cmt_string text;
00924
00925 cmt_string branches = CmtSystem::getenv ("CMTCVSBRANCHES");
00926
00927 if (branches == "")
00928 {
00929 branches = branches_info;
00930 }
00931
00932 CmtSystem::cmt_string_vector branch_vector;
00933
00934 CmtSystem::split (branches, " \t", branch_vector);
00935
00936 int i;
00937
00938 cout << " # get branches " << branches << endl;
00939
00940 //command = "(";
00941 command = "";
00942
00943 entries_file_name = "CVS";
00944 entries_file_name += CmtSystem::file_separator ();
00945 entries_file_name += "Entries";
00946
00947 if (!text.read (entries_file_name))
00948 {
00949 // This happens when there were no top files
00950 }
00951
00952 for (i = 0; i < branch_vector.size (); i++)
00953 {
00954 cmt_string& branch = branch_vector[i];
00955
00956 if (i > 0)
00957 {
00958 command += CmtSystem::command_separator ();
00959 }
00960
00961 //command += "cvs -Q co -P ";
00962 command += "cvs -Q co ";
00963
00964 // if (branch != "cmt")
00965 // {
00966 if (!at_head)
00967 {
00968 command += "-r ";
00969 command += version;
00970 }
00971 // }
00972
00973 command += " -d ";
00974 command += branch;
00975 command += " ";
00976 command += module;
00977 command += "/"; // CVS uses the '/' notation on all platforms!!
00978 command += branch;
00979 //command += "\n";
00980
00981 text += "D/";
00982 text += branch;
00983 text += "
00984 }
00985
00986 //command += "; echo cmtcvsstatus=$?) 2>&1 ";
00987
00988 if (m_cmtcvstest)
00989 {
00990 cmt_string cvsroot;
00991
00992 CmtSystem::get_cvsroot (cvsroot);
00993
00994 cout << " cvsroot=" << cvsroot << " command[" << command << "]" << endl;
00995 }
00996
00997 status = 0;
00998 retry = 0;
00999
01000 for (;;)
01001 {
01002 if (m_verbose || m_simulation)
01003 {
01004 cout << "#CMT> Executing [" << command << "]" << endl;
01005 }
01006
01007 if (!m_simulation)
01008 {
01009 //status = CmtSystem::execute (command, out);
01010 status = CmtSystem::execute (command);
01011 }
01012
01013 if (status != 0)
01014 {
01015 retry++;
01016
01017 cout << "# Error getting package contents: status=" << status << endl;
01018 cout << "#---------------------------------------------------------" << endl;
01019
01020 if (retry > 5) exit(0);
01021
01022 }
01023 else
01024 {
01025 break;
01026 }
01027 }
01028
01029 {
01030 if (!CmtSystem::test_directory ("CVS"))
01031 {
01037 if (m_simulation)
01038 {
01039 cout << "#CMT> Would create the CVS directory" << endl;
01040 }
01041 else
01042 {
01043 if (m_verbose)
01044 {
01045 cout << "#CMT> About to mkdir " << "CVS" << endl;
01046 }
01047 CmtSystem::mkdir ("CVS");
01048 }
01049
01050 cmt_string s;
01051
01052 // Let's create first the CVS/Root file.
01053
01054 CmtSystem::get_cvsroot (s);
01055 s += "\n";
01056
01057 cmt_string f;
01058
01059 f = "CVS";
01060 f += CmtSystem::file_separator ();
01061 f += "Root";
01062
01063 if (m_simulation)
01064 {
01065 cout << "#CMT> Would fill in the CVS/Root file with " << endl;
01066 cout << s << endl;
01067 }
01068 else
01069 {
01070 if (m_verbose)
01071 {
01072 cout << "#CMT> Fill in the CVS/Root file with " << endl;
01073 cout << s << endl;
01074 }
01075 s.write (f);
01076 }
01077
01078 // Now we create the CVS/Repository file
01079
01080 f = "CVS";
01081 f += CmtSystem::file_separator ();
01082 f += "Repository";
01083
01084 CmtSystem::get_cvsroot (s);
01085 if (s[0] == ':')
01086 {
01087 int pos = s.find (1, ":");
01088 s.erase (0, pos+1);
01089 pos = s.find (0, ":");
01090 s.erase (0, pos+1);
01091 }
01092 s += "/";
01093 s += module;
01094 s += "\n";
01095
01096 if (m_simulation)
01097 {
01098 cout << "#CMT> Would fill in the CVS/Repository file with " << endl;
01099 cout << s << endl;
01100 }
01101 else
01102 {
01103 if (m_verbose)
01104 {
01105 cout << "#CMT> Fill in the CVS/Repository file with " << endl;
01106 cout << s << endl;
01107 }
01108 s.write (f);
01109 }
01110 }
01111
01112 if (m_simulation)
01113 {
01114 cout << "#CMT> Would write the top CVS/Entries file with " << endl;
01115 cout << text << endl;
01116 }
01117 else
01118 {
01119 // Now the CVS/Entries is ready to be created.
01120 if (m_verbose)
01121 {
01122 cout << "#CMT> Fill in the top CVS/Entries file with " << endl;
01123 cout << text << endl;
01124 }
01125 text.write (entries_file_name);
01126 }
01127 }
01128
01129 return (true);
01130 }
|
|
||||||||||||
| ? |
Now retrieve all info fields :. error= tags_top= tags= branches= subpackages= Definition at line 461 of file cmt_cvs.cxx. References cmt_string::find(), cmt_string::npos, cmt_string::replace_all(), and show_cvs_infos(). 00463 {
00464 cmt_string full_name;
00465
00466 if (offset != "")
00467 {
00468 full_name = offset;
00469 full_name += "/";
00470 while (full_name.find ("//") != cmt_string::npos)
00471 {
00472 full_name.replace_all ("//", "/");
00473 }
00474 }
00475
00476 full_name += module;
00477
00478 show_cvs_infos (full_name);
00479 }
|
|
| ? |
Definition at line 195 of file cmt_cvs.cxx. References CmtSystem::basename(), branches_info, CmtSystem::cd(), cvsversions_info, cvsversions_top_info, error_info, CmtSystem::execute(), CmtSystem::file_separator(), filter_list(), CmtSystem::get_cvsroot(), CmtSystem::get_temporary_name(), CmtSystem::getenv(), m_last_cvs_infos, m_last_module, m_simulation, m_verbose, CmtSystem::mkdir(), CmtSystem::pwd(), CmtSystem::remove_directory(), cmt_string::replace(), cmt_string::replace_all(), Grep::result(), Awk::run(), subpackages_info, tags_info, tags_top_info, and CmtSystem::test_directory(). Referenced by branches(), do_checkout(), get_version(), show_cvs_infos(), subpackages(), and tags(). 00196 {
00197 if (module == "")
00198 {
00199 cout << "# cmt cvs needs a module name" << endl;
00200 return;
00201 }
00202
00203 if (module == m_last_module)
00204 {
00205 if (m_verbose)
00206 {
00207 cout << "#CMT> cvs infos for module " << module << " already there" << endl;
00208 }
00209 }
00210 else
00211 {
00212 m_last_module = module;
00213
00214 cmt_string home_dir = CmtSystem::pwd ();
00215
00216 //
00217 // Activities related with .cmtcvsinfos will occur in a temporary directory
00218 //
00219 cmt_string tmp_dir = CmtSystem::getenv ("TMPDIR");
00220 if (tmp_dir == "")
00221 {
00222 tmp_dir = CmtSystem::file_separator ();
00223 tmp_dir += "tmp";
00224 }
00225
00226 if (!CmtSystem::cd (tmp_dir))
00227 {
00228 tmp_dir = home_dir;
00229 }
00230
00231 tmp_dir += CmtSystem::file_separator ();
00232 tmp_dir += "cmtcvs";
00233 {
00234 cmt_string temp = CmtSystem::get_temporary_name ();
00235 CmtSystem::basename (temp, temp);
00236 tmp_dir += temp;
00237 }
00238
00239 if (!CmtSystem::test_directory (tmp_dir))
00240 {
00241 if (!CmtSystem::mkdir (tmp_dir))
00242 {
00243 cout << "# Cannot create the temporary directory ["
00244 << tmp_dir << "]" << endl;
00245 return;
00246 }
00247 }
00248
00249 //trap "rm -rf ${tmp_dir}" 0 1 2 15
00250
00251 if (!CmtSystem::cd (tmp_dir))
00252 {
00253 cout << "# Cannot move to the temporary directory " << tmp_dir << endl;
00254
00255 if (m_verbose)
00256 {
00257 cout << "#CMT> now removing tmp_dir " << tmp_dir << " home=" << home_dir << endl;
00258 }
00259
00260 CmtSystem::remove_directory (tmp_dir);
00261
00262 return;
00263 }
00264
00265 if (m_verbose)
00266 {
00267 cout << "#CMT> cvs infos are now obtained from the temporary directory " << CmtSystem::pwd () << endl;
00268 }
00269
00270 /*
00271 #
00272 # The script associated to such entries is supposed to :
00273 # 1) extract the set of
|
|
| ? |
Definition at line 1536 of file cmt_cvs.cxx. References CmtSystem::getenv(), and show_cvs_infos(). Referenced by Cvs::subpackages(). 01537 {
01538 cmt_string out;
01539
01540 show_cvs_infos (CmtSystem::getenv ("CMTCVSOFFSET"), module);
01541
01542 if (error_info != "")
01543 {
01544 cout << error_info << endl;
01545 }
01546 else
01547 {
01548 cout << subpackages_info << endl;
01549 }
01550 }
|
|
| ? |
Definition at line 1442 of file cmt_cvs.cxx. References CmtSystem::getenv(), help(), show_cvs_infos(), cmt_vector< cmt_string >::size(), and CmtSystem::split(). Referenced by Cvs::tags(). 01443 {
01444 if (arguments.size () < 1)
01445 {
01446 help ();
01447 return;
01448 }
01449
01450 if (CmtSystem::getenv ("CVSROOT") == "")
01451 {
01452 cout << "# Please set CVSROOT first !" << endl;
01453 return;
01454 }
01455
01456 if (CmtSystem::getenv ("CMTCVSTEST") != "")
01457 {
01458 m_cmtcvstest = true;
01459 }
01460 else
01461 {
01462 m_cmtcvstest = false;
01463 }
01464
01465 m_offset = CmtSystem::getenv ("CMTCVSOFFSET");
01466 if (m_offset != "")
01467 {
01468 m_offset += "/";
01469 m_offset.replace_all ("//", "/");
01470 }
01471
01472 bool all = false;
01473
01474 for (int arg = 0; arg < arguments.size (); arg++)
01475 {
01476 const cmt_string& option = arguments[arg];
01477
01478 if (option == "-all")
01479 {
01480 all = true;
01481 }
01482 else
01483 {
01484 show_cvs_infos (CmtSystem::getenv ("CMTCVSOFFSET"), option);
01485
01486 if (error_info != "")
01487 {
01488 cout << error_info << endl;
01489 }
01490 else
01491 {
01492 cmt_string tags;
01493
01494 if (all)
01495 {
01496 tags = cvsversions_top_info;
01497 tags += " ";
01498 tags += cvsversions_info;
01499 }
01500 else
01501 {
01502 tags = tags_top_info;
01503 tags += " ";
01504 tags += tags_info;
01505 }
01506
01507 CmtSystem::cmt_string_vector v;
01508
01509 CmtSystem::split (tags, " \t", v);
01510 for (int i = 0; i < v.size (); i++)
01511 {
01512 const cmt_string& s = v[i];
01513 cout << s << endl;
01514 }
01515 }
01516 }
01517 }
01518 }
|
|
| ? |
Definition at line 1914 of file cmt_cvs.cxx. Referenced by CvsImplementation(), and show_cvs_infos(). |
|
| ? |
Definition at line 1913 of file cmt_cvs.cxx. Referenced by CvsImplementation(), and show_cvs_infos(). |
|
| ? |
Definition at line 1912 of file cmt_cvs.cxx. Referenced by CvsImplementation(), and show_cvs_infos(). |
|
| ? |
Definition at line 1909 of file cmt_cvs.cxx. Referenced by CvsImplementation(), get_version(), and show_cvs_infos(). |
|
| ? |
Definition at line 1905 of file cmt_cvs.cxx. Referenced by CvsImplementation(). |
|
| ? |
Definition at line 1903 of file cmt_cvs.cxx. Referenced by build_version_directory(), and CvsImplementation(). |
|
| ? |
Definition at line 1898 of file cmt_cvs.cxx. Referenced by CvsImplementation(). |
|
| ? |
Definition at line 1897 of file cmt_cvs.cxx. Referenced by CvsImplementation(). |
|
| ? |
Definition at line 1902 of file cmt_cvs.cxx. Referenced by build_version_directory(), and CvsImplementation(). |
|
| ? |
Definition at line 1908 of file cmt_cvs.cxx. Referenced by CvsImplementation(), and show_cvs_infos(). |
|
| ? |
Definition at line 1907 of file cmt_cvs.cxx. Referenced by CvsImplementation(), and show_cvs_infos(). |
|
| ? |
Definition at line 1904 of file cmt_cvs.cxx. Referenced by CvsImplementation(). |
|
| ? |
Definition at line 1896 of file cmt_cvs.cxx. Referenced by CvsImplementation(). |
|
| ? |
Definition at line 1900 of file cmt_cvs.cxx. Referenced by CvsImplementation(), and show_cvs_infos(). |
|
| ? |
Definition at line 1899 of file cmt_cvs.cxx. Referenced by CvsImplementation(), and show_cvs_infos(). |
|
| ? |
Definition at line 1915 of file cmt_cvs.cxx. Referenced by CvsImplementation(), and show_cvs_infos(). |
|
| ? |
Definition at line 1911 of file cmt_cvs.cxx. Referenced by CvsImplementation(), get_version(), and show_cvs_infos(). |
|
| ? |
Definition at line 1910 of file cmt_cvs.cxx. Referenced by CvsImplementation(), get_version(), and show_cvs_infos(). |