Modelling clouds and climate

Tags

Path: Contents > Other CVS Commands > Tags
Site Map

Contents

About CVS
  • Setting up CVS
  • Using the CVS Server
  • Commands and
      Terminology
  • pcl-cvs
    Using CVS
  • How was SCM set up?
      (import)
  • Getting the ubcscm
      (checkout)
  • Making changes
      (update/diff)
  • Commiting your changes
      (commit)
  • Releasing you work
      (release)
    Other CVS Commands
  • Examining Changes
      (log)
  • Add and Delete Code
      (add/del)
  • Status/revisions
  • Tags
  • Branches
    Spetial Topics
  • Writing Log
  • Handling Conflicts
    References



    Web Contact: Phil Austin
    Site created with Cheetah.

    Last updated: Mar 13 2003
  • Tags

    cvs tag (synonyms: ta freeze)

    Tags differ from commits in that they don't record any particular textual change to files, but rather a change in the developers' attitude about the files. A tag gives a label to the collection of revisions represented by one developer's working copy (usually, that working copy is completely up to date so the tag name is attached to the "latest and greatest" revisions in the repository).

    When a tag is set for a certain project, whoever is using the project will promptly have the same tag change!

    Create a Tag

    Setting a tag for a module that you are currently in:

     $ cvs tag some_tag_name
     T README.txt
     

    As you continue to edit files and commit changes, the tag will not move along with the increasing revision numbers. It stays fixed, "stickily", at the revision number of each file at the time the tag was made.

    As a general rule, you should try to keep tags as terse as possible while still including all necessary information about the event that you're trying to record. CVS is rather strict about what constitutes a valid tag name. The rules are that it must start with a letter and contain letters, digits, hyphens ("-"), and underscores ("_"). No spaces, periods, colons, commas, or any other symbols may be used. A revision number has a period; a tag name doesn't.

    Delete the Tag

    For a module you are in, just type

     $ cvs tag -d some_tag_name
     D README.txt
     

    Retrieving snapshots

    To retrieve a snapshot by tag name, the tag name is used just like a revision number. There are two ways to retrieve snapshots: You can check out a new working copy with a certain tag, or you can switch an existing working copy over to a tag. Both result in a working copy whose files are at the revisions specified by the tag.

    Most of the time, what you're trying to do is take a look at the project as it was at the time of the snapshot.

    -> Separate working copy

    If you just want to check out a separate working copy with the tag. Here's how (but make sure to invoke this somewhere other than in your existing working copy or its parent directory!):

     $ cvs checkout -r some_tag_name myproj
     cvs checkout: Updating myproj
     U myproj/README.txt
     
    The -r option usually preceds a revision number. In many ways a tag is just like a revision number because, for any file, a given tag corresponds to exactly one revision number.
    -> Existiong working directory

    Switching an existing working directory over to the tagged revisions-is also done by updating:

     $ cvs update -r some_tag_name
     

    The filename is omitted because we want to revert the entire project over. No files appear to have changed when we update.However, this does not mean that nothing changed at all. The working copy now knows that it's at a tagged revision.

    After switching to a tagged version, if you make a change and try to commit it, CVS does not permit the commit to happen. Once it is on a tag, CVS views the working copy as a static snapshot of a moment in history, and CVS won't let you change history, at least not easily.

     $ cvs -q update
     M README.txt
     $ cvs -q commit -m "trying to commit from a working copy on a tag"
     cvs commit: sticky tag 'some_tag_name' for file 'README.txt' is not a branch
     cvs [commit aborted]: correct above errors first!
     $
     

    Tags, like other sticky properties, are removed with the -A flag to update:

     floss$ cvs -q update -A
     

    If there was any changes made while beeing on a tag, CVS will still be aware that the file changed with respect to the repository.

    Other options

    If you want to diff a file's current state against its state at the time of the last release, you can do this:
     $ cvs diff -c -r some_tag_name hello.c
     

    And if you want to revert the file temporarily to that revision, you can do this:

     $ cvs update -r some_tag_name hello.c