Source code for gdeps.cvs

#!python3

# Copyright 2007-2017 Gemr. All Rights Reserved.
# Licensed to MIT see LICENSE.txt

import gdeps as GDeps

__author__ = 'Suryavarman (http://sourceforge.net/u/suryavarman/profile/)'


[docs]class Cvs(GDeps.Versioning): def __init__(self, inConfigFile, inFolderPath, inLogFileDirectory, inReposUrl, inCloneArgs="", inUpdateArgs="", inSectionName="cvs", inExePath="C:\\cvs\\cvs.exe"): """ :param inReposUrl: repository URL Examples: sourceforge: PROJECTNAME.cvs.sourceforge.net:/cvsroot/PROJECTNAME :type inReposUrl: str :param inCloneArgs: use inCloneArgs to set the module name like that inCloneArgs="MODULENAME" CVS will create the MODULENAME directory into the ... :type inCloneArgs: str :param inUpdateArgs: :type inUpdateArgs: str ..remarks: It's important to have the same name for the Gdeps.Project.m_FolderName and CVS MODULENAME name. Because it's impossible to rename the folder with cvs. Has to be the folder create by cvs. The case doesn't matter. Example: pserver:anonymous@PROJECTNAME.cvs.sourceforge.net:/cvsroot/PROJECTNAME co -P MODULENAME >>> params = { >>> gdeps.Keys.ms_FolderDir: os.path.normpath(script_dir + r"\\freeimage"), >>> gdeps.Keys.ms_RepoUrl: "freeimage.cvs.sourceforge.net:/cvsroot/freeimage", >>> gdeps.Keys.ms_RepoCloneArgs: "FreeImage", >>> } GDeps use cvs.exe you can download the latest version from https://ftp.gnu.org/non-gnu/cvs/binary/stable/x86-woe/. TortoiseCVS don't provide cvs binary and the UserGuide_en.chm cannot be read on my windows 7 CVS: https://clockwerx.blogspot.fr/2006/08/how-to-use-cvs-from-command-line-in.html https://sourceforge.net/p/forge/documentation/CVS%20Clients/ www-e815.fnal.gov/webspace/cvs/commands.html https://savannah.gnu.org/cvs/?group=url Usage: cvs [cvs-options] command [command-options-and-arguments] where cvs-options are -q, -n, etc. (specify --help-options for a list of options) where command is add, admin, etc. (specify --help-commands for a list of commands or --help-synonyms for a list of command synonyms) where command-options-and-arguments depend on the specific command (specify -H followed by a command name for command-specific help) Specify --help to receive this message CVS global options (specified before the command name) are: -H Displays usage information for command. -Q Cause CVS to be really quiet. -q Cause CVS to be somewhat quiet. -r Make checked-out files read-only. -w Make checked-out files read-write (default). -n Do not execute anything that will change the disk. -t Show trace of program execution -- try with -n. -v CVS version and copyright. -T tmpdir Use 'tmpdir' for temporary files. -e editor Use 'editor' for editing log information. -d CVS_root Overrides $CVSROOT as the root of the CVS tree. -f Do not use the ~/.cvsrc file. -z # Use compression level '#' for net traffic. -a Authenticate all net traffic. -s VAR=VAL Set CVS user variable. (Specify the --help option for a list of other help options) CVS commands are: add Add a new file/directory to the repository admin Administration front end for rcs annotate Show last revision where each line was modified checkout Checkout sources for editing commit Check files into the repository diff Show differences between revisions edit Get ready to edit a watched file editors See who is editing a watched file export Export sources from CVS, similar to checkout history Show repository access history import Import sources into CVS, using vendor branches init Create a CVS repository if it doesn't exist log Print out history information for files login Prompt for password for authenticating server logout Removes entry in .cvspass for remote repository rannotate Show last revision where each line of module was modified rdiff Create 'patch' format diffs between releases release Indicate that a Module is no longer in use remove Remove an entry from the repository rlog Print out history information for a module rtag Add a symbolic tag to a module status Display status information on checked out files tag Add a symbolic tag to checked out version of files unedit Undo an edit command update Bring work tree in sync with repository version Show current CVS version(s) watch Set watches watchers See who is watching a file Tortoise cvs: https://sourceforge.net/projects/tortoisecvs/?source=typ_redirect http://www.tortoisecvs.org/index.shtml How to convert cvs to svn: http://sam.zoy.org/writings/programming/svn2cvs.html How to convert cvs to git: http://bsdpower.com/sourceforge-cvs-to-git-conversion/ Doc cvs: http://bgoglin.free.fr/cvs.html """ GDeps.Versioning.__init__(self, inConfigFile, inFolderPath, inLogFileDirectory, inReposUrl, inCloneArgs, inUpdateArgs, inSectionName, inExePath) self.m_ErrorRegexp = r"(.*cannot.*|.*it is in the way.*)" # checkout: move away http://lists.gnu.org/archive/html/info-cvs/2001-04/msg00566.html self.m_WarningRegexp = r"(.*unexpected.*)"
[docs] def clone(self): """ cvs checkout [-ANPRcflnps] [-r rev] [-D date] [-d dir] [-j rev1] [-j rev2] [-k kopt] modules... -A Reset any sticky tags/date/kopts. -N Don't shorten module paths if -d specified. -P Prune empty directories. -R Process directories recursively. -c "cat" the module database. -f Force a head revision match if tag/date not found. -l Local directory only, not recursive -n Do not run module program (if any). -p Check out files to standard output (avoids stickiness). -s Like -c, but include module status. -r rev Check out revision or tag. (implies -P) (is sticky) -D date Check out revisions as of date. (implies -P) (is sticky) -d dir Check out into dir instead of module name. -k kopt Use RCS kopt -k option on checkout. (is sticky) -j rev Merge in changes made between current revision and rev. """ aReport = GDeps.Versioning.clone(self) # $ cvs -z3 -d:pserver:anonymous@PROJECTNAME.cvs.sourceforge.net:/cvsroot/PROJECTNAME co -P MODULENAME module_arg = ' -P ' + self.m_CloneArgs + ' ' if self.m_CloneArgs else ' ' # depuis la branche principale # => cvs co module # depuis une branche # => cvs co -d branch_name module_name # depuis un tag # => cvs co -r tag module_name aCommand = self.getCMDExePath() + '-z3 -d:pserver:anonymous@' + self.m_ReposUrl + ' co' + module_arg # + self.getCloneTmpDir() + '"' print(aCommand) self.CloneNoEmptyDir(aCommand, "cvs-clone", aReport) if not aReport.getlen(aReport.m_Errors): aReport.append2(self.update()) """ ????It's necessary a clean up or a revert with cvs cannot restore the missing files???? """ return aReport
[docs] def update(self): """ Usage: cvs update [-APCdflRp] [-k kopt] [-r rev] [-D date] [-j rev] [-I ign] [-W spec] [files...] -A Reset any sticky tags/date/kopts. -P Prune empty directories. -C Overwrite locally modified files with clean repository copies. -d Build directories, like checkout does. -f Force a head revision match if tag/date not found. -l Local directory only, no recursion. -R Process directories recursively. -p Send updates to standard output (avoids stickiness). -k kopt Use RCS kopt -k option on checkout. (is sticky) -r rev Update using specified revision/tag (is sticky). -D date Set date to update from (is sticky). -j rev Merge in changes made between current revision and rev. -I ign More files to ignore (! to reset). -W spec Wrappers specification line. """ aReport = GDeps.Versioning.update(self) aCommand = self.getCMDExePath() + ' up' self.callWithLogFile(aCommand, "cvs-update", aReport, self) return aReport
[docs] def clean(self): """ Usage: cvs unedit [-lR] [<file>]... -l Local directory only, not recursive. -R Process directories recursively (default). (Specify the --help global option for a list of other help options.) https://stackoverflow.com/questions/1812618/cvs-cleaning-up-the-cvs-repository """ aReport = GDeps.Versioning.clean(self) # aCommand = self.getCMDExePath() + 'cleanup "' + self.m_FolderPath + '"' # self.callWithLogFile(aCommand, "svn-clean", aReport, self) return aReport
[docs] def getFolderRepoConfigPath(self): return "CVS"