Summary of common operations on CVs

Source: Internet
Author: User
Tags wrappers
Import Project

UseCVS ImportCommand:

cvs import -m "your import message here" projname vendortag releasetag

Note that some specific file or folder names (such*. Exe,*. OBJ) Is added inIgnore listAre not imported into the project. If necessary, you can useCVS addAdd it or use it during import-I!Option to ignore the defaultIgnore list. Of course, inCvsignoreAdd the first line in the file!Yes, you need to redefine all of your needs.Ignore list.

Add a binary file or a text file that does not require keyword Expansion

If the file name of the binary file is not included inCvswrappers, You need to manually add the following:

    cvs add -kb filename    cvs ci -m "msg" filename

Disable a text fileKeyword Expansion, Use-KoOption:

    cvs add -ko filename    cvs ci -m "msg" filename
Directory operations
  • Directory addition: after creating a local directory, you only need to useCVS addYou can add it successfully without using it.CVS commit.

  • Directory deletion: First delete all files in the directory (three steps:RmDelete; runCVS remove; RunCVS commit), And then runCVS Update-PYou can.PruneDrop.

  • Obtain the new directory:RepositoryThe newly generated directory is inCVS updateIs not automatically obtained, must be used-DOption, that isCVS Update-d.

  • Change the directory name: this is actually a combination of a series of operations, that is

    1. Create a directory and runCVS addAdd it to CVS.

    2. Move the files in the original directory to the new directory.

    3. RunCVS commitDelete the original directory and add the moved files to CVS.

Document update

GenerallyCVS updateYou can. Of course, you can also use-DOr-RSpecifies the document that gets a specific time or version number. The-DIt must be accurate to seconds when the specified time is updated, and must be specifiedGMTTo guaranteeSticky dateThe time is the same as the document time. This is because CVS usesGreenwich Mean TimeThe system uses the local time zone. The standard time format is as follows:2007/06/23 20:19:00 GMT.

After the document is updated to the original version or date, it is identifiedSticky, RunCVS updateThis document willStickyIn the current version, there will be no update actions; at the same time, after the document is modifiedCommitIt is also not allowed, because CVS prohibits modification to the past history. And useCVS Update-You can restore the current document to the latest version.

To get the original version and not change the current documentSticky, About the current documentRevertTo a previous version, you need to use the following command to output the content of a previous version of the document to the standard output, and then redirect it to the current document:

cvs -Q update -p -r 1.1 Main.c > Main.c

Note:In the preceding command-QOption is indispensable, otherwise CVs will go to the console (essentially a standard errorStandard Error) Output some content that does not belong to the document:

    ===================================================================    Checking out MainInterface.m    RCS: /cvsroot/pub/hvdc-corona/MainInterface.m,v    VERS: 1.1    ***************
Add tags

When the project progresses to a certain degree to provide a more complete version, you can add tags to all the documents of the current project.TagsSo that they can be retrieved at any time in the future. If this is not done, the version numbers of each file cannot be consistent, so that files can only be retrieved one by one in the future, which is inconvenient. This is to addTags. For example,

cvs tag -R tag_name

Where,-RIndicates recursive.

Processing binary files Basic Concept

When CVS deals with binary files, the file merging, diffing and other such operations will be lost. But if you do not use binary mode, error will occur.

There are two issues with using CVS to store binary files. the first is that CVS by default converts line endings between the canonical form in which they are stored in the repository (linefeed only ), and the form appropriate to the operating system in use on the client (for example, carriage return followed by line feed for Windows NT ).

The second is that a binary file might happen to contain data which looks like a keyword, so keyword expansion must be turned off.

'-Kb' option and recover

When you come into SS binary files that are to be managed by CVS, you should use '-kb' option to turn off line ending conversion and keyword expansion.

For example:

    $ cvs add -kb -m"A test file" kotest    $ cvs ci -m"First checkin; contains a keyword" kotest

If a file accidentally gets added without '-kb', we still can use 'cvs admin' to recover them. See below:

    $ echo ‘$Id: cvsnote,v 1.1.1.1 2006-04-16 15:20:53 foo Exp $‘ > kotest    $ cvs add -m"A test file" kotest    $ cvs ci -m"First checkin; contains a keyword" kotest    $ cvs admin -kb kotest    $ cvs update -A kotest    # For non-unix systems:    # Copy in a good copy of the file from outside CVS    $ cvs commit -m "make it binary" kotest

For convenience, we can useWrappersTo tell CVS which kinds of files are to be treated like binary files by their file name extensions. There are no other ways for CVS to judge whether a file is binary or not.

Wrappers

Wrappers refers to the CVS feature which lets you control certain settings based on the name of the file that is being operated on.

The format of the wrapper is as follows:

    wildcard [option value][option value]...    where option is one of    -m update methodology value: MERGE or COPY    -k keyword expansion value: expansion mode    and value is a single-quote delimited value.

The command with CVS wrapper is as follows:

cvs import -I ! -W "*.exe -k ‘b‘" first-dir vendortag reltag
Resolve document conflicts

Communicate with the same group of personnel before starting work, and ensure that the operation is performed first.CVS updateAnd then work to avoid document conflicts. If a conflict occursCVS updateThe latest version will be integrated with the local documentation (Merging) To the local document and display it in the following ways:

    <<<<<<< (filename)    the uncommitted changes in the working copy    blah blah blah    =======    the new changes that came from the repository    blah blah blah    and so on    >>>>>>> (latest revision number in the repository)

In this case, you need to manually edit the file to handle conflicts and then submit the file.

Show Command help

Run:

cvs --help cmd_name

For example,

    [email protected]:~/HADAPT/HADAPTpro$ cvs --help tag     Usage: cvs tag [-bcdFflR] [-r rev|-D date] tag [files...]     -b Make the tag a "branch" tag, allowing concurrent development.     -B Allows -F and -d to disturb branch tags. Use with extreme care.     -c Check that working files are unmodified.     -d Delete the given tag.     -F Move tag if it already exists.     -f Force a head revision match if tag/date not found.     -l Local directory only, not recursive.     -R Process directories recursively.     -r rev Existing revision/tag.     -D Existing date.     (Specify the --help global option for a list of other help options) 

 

 

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.