Changeset 200


Ignore:
Timestamp:
Jun 2, 2006, 10:43:50 PM (19 years ago)
Author:
garonne
Message:

better support for succesive checkout

File:
1 edited

Legend:

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

    r192 r200  
    22// Copyright Christian Arnault LAL-Orsay CNRS
    33// arnault@lal.in2p3.fr
     4// Modified by: garonne@lal.in2p3.fr
    45// See the complete license in cmt_license.txt "http://www.cecill.info".
    56//-----------------------------------------------------------
     
    317318      {
    318319        status = CmtSystem::execute (command, out);
    319       }
    320 
     320       
     321      }
     322     
     323    //if (m_verbose || m_simulation)
     324    //  {
     325    //       cout << out << endl;
     326    //  }
    321327    return (status);
    322328  }
     
    827833    if (m_verbose)
    828834      {
    829         cout << "#CMT> requesting cvs infos onto module " << module << endl;
     835             cout << "#CMT> requesting cvs infos onto module " << module << endl;
    830836      }
    831837   
     
    919925  bool do_need_version ()
    920926  {
    921     bool need_version = false;
     927     bool need_version = false;
    922928
    923929    if (structure_info == "project")
    924       {
    925         need_version = true;
    926       }
     930    {
     931             need_version = true;             
     932        }
    927933    else
    928934      {
    929         CmtStructuringStyle style = Cmt::get_current_structuring_style ();
    930 
    931         if (style == default_structuring_style)
    932           {
    933             Use& current_use = Use::current ();
    934             if (current_use.get_strategy ("VersionDirectory"))
    935               {
    936                 need_version = true;
    937               }
    938           }
    939         else if (style == with_version_directory)
    940           {
    941             need_version = true;
    942           }
     935             CmtStructuringStyle style = Cmt::get_current_structuring_style ();
     936         if (style == default_structuring_style)
     937             {
     938                Use& current_use = Use::current ();
     939                if (current_use.get_strategy ("VersionDirectory"))
     940                   need_version = true;
     941             }
     942             else if (style == with_version_directory)
     943                 need_version = true;           
    943944      }
    944945
     
    12461247    if (need_version)
    12471248      {
    1248         if (!mkdir (version)) return (false);
    1249        
    1250         dir += CmtSystem::file_separator ();
    1251         dir += version;
     1249               if (!mkdir (version)) return (false);   
     1250               dir += CmtSystem::file_separator ();
     1251               dir += version;
    12521252      }
    12531253    else
     
    12811281    if (!CmtSystem::test_directory ("CVS"))
    12821282      {
    1283           cout << "#CMT> CVS repository is missing !!" << endl; 
    12841283          int i;
    12851284          for (i = 0; i < branch_vector.size (); i++)
     
    14191418  cmt_string find_matching_version (const cmt_string& expression)
    14201419  {
    1421     cmt_string result;
    1422 
     1420     
     1421    cmt_string result;     
     1422   
    14231423    //
    14241424    // Here expression takes the form
     
    15411541     given by the structure info obtained from the most recent request to the CVS pluggin
    15421542   */
    1543   bool check_structure (const cmt_string& dir)
     1543  bool check_structure (const cmt_string& dir, const cmt_string& version)
    15441544  {
    15451545    bool result = false;
    1546 
    15471546    if (!CmtSystem::test_directory (dir))
    15481547      {
    1549         return (false);
     1548               return (false);
    15501549      }
    15511550
    15521551    if (structure_info == "package")
    15531552      {
    1554         // Check if it is a true CMT package.
    1555        
     1553        // Check if it is a true CMT package.   
    15561554        cmt_string file_name;
    15571555       
     
    15631561       
    15641562        if (CmtSystem::test_file (file_name))
    1565           {
    1566             result = true;
     1563          {       
     1564               if (!do_need_version ())
     1565               {
     1566                   // open the version.cmt file and compare the version
     1567                 cmt_string current_version;
     1568                 cmt_string version_file = dir;
     1569                 version_file += CmtSystem::file_separator ();
     1570                 version_file += "CVS";
     1571                 version_file += CmtSystem::file_separator ();
     1572                 version_file += "Tag";
     1573                 current_version.read (version_file);               
     1574                 //cout <<version_file<<", "<<current_version<<", "<<"N"+version+"\n"<<endl;
     1575                 return current_version=="N"+version+"\n";                 
     1576                }   
     1577                else
     1578                       result = true;
    15671579          }
    15681580        else
    15691581          {
     1582
    15701583            file_name = dir;
    15711584            file_name += CmtSystem::file_separator ();
     
    15761589            if (CmtSystem::test_file (file_name))
    15771590              {
    1578                 result = true;
     1591               if (!do_need_version ())
     1592               {
     1593                   // open the version.cmt file and compare the version
     1594                 cmt_string current_version;
     1595                 cmt_string version_file = dir;
     1596                 version_file += CmtSystem::file_separator ();
     1597                 version_file += "CVS";
     1598                 version_file += CmtSystem::file_separator ();
     1599                 version_file += "Tag";
     1600                 current_version.read (version_file);               
     1601                 //cout <<version_file<<", "<<current_version<<", "<<"N"+version+"\n"<<endl;
     1602                 return current_version=="N"+version+"\n";                 
     1603                }   
     1604                else
     1605                       result = true;
    15791606              }
    15801607          }
     
    15941621            result = true;
    15951622          }
    1596       }
     1623    }
    15971624
    15981625    return (result);
     
    16601687    bool recursive = m_recursive;
    16611688   
    1662     cmt_string effective_version = find_matching_version (dir);
    1663    
     1689    cmt_string effective_version = "";
     1690    if (do_need_version ())
     1691    {
     1692    /* Important this part should be enhanced ASAP
     1693       and deal with many other cases.... arghhhh !!
     1694    */   
     1695        effective_version = find_matching_version (dir);         
     1696    }
     1697
     1698
     1699         
    16641700    cmt_string module;
    16651701    get_module (full_offset, product, module);
     
    17161752            // If tag was not specified, then the version directory has to match the CVS tag
    17171753            // Otherwise the original version specification is kept for the directory.
    1718 
    17191754            version = cvs_tag;
    17201755            dir = build_version_directory (offset, product, version);
     
    17221757      }
    17231758   
    1724 
    1725     if (check_structure (dir))
    1726       {
    1727         cout << "# ================= " << structure_info << " " << product
    1728              << " version " << version << echo_ppath
    1729              << " already installed." << endl;
    1730        
    1731         recursive = false;
     1759    if (check_structure (dir, version))
     1760      {
     1761             cout << "# ================= " << structure_info << " " << product
     1762                  << " version "            << version        << echo_ppath
     1763                  << " already installed."  << endl;   
     1764             recursive = false;
    17321765      }
    17331766    else
Note: See TracChangeset for help on using the changeset viewer.