Branching and Merging in CVS - PowerPoint PPT Presentation

1 / 9
About This Presentation
Title:

Branching and Merging in CVS

Description:

Undoing changes with cvs merge 'cvs up -j' can generally be used to back out changes ... There is no way to undo a 'cvs tag -d' ... – PowerPoint PPT presentation

Number of Views:73
Avg rating:3.0/5.0
Slides: 10
Provided by: wwwnlpS
Category:

less

Transcript and Presenter's Notes

Title: Branching and Merging in CVS


1
Branching and Merging in CVS
  • Jamie Nicolson
  • May 16, 2005

2
What is a branch?
  • In the normal course of development, changes are
    checked in serially. The current state of a file
    represents all the changes that have been made up
    to this point.
  • Branching creates an alternate timeline of
    changes, starting from some common point in the
    past.

3
Why branch?
  • In the commercial world, when software is
    released in official versions, you branch to
    separate bug-fix changes from new development.
  • For research, it can shield you from other
    people's checkins when you're getting close to a
    deadline.
  • Example the Pascal IE challenge deadline was
    only a few weeks after the Java 1.5 switchover.
    We branched to avoid the complications that
    caused.

4
How to make a branch
  • CVS overloads the tag command to create
    branches
  • cvs tag -b ltbranchnamegt ltfilesgt...
  • The branch name is actually an alias for a set of
    numeric branch numbers, one per file
  • If the branching point is x, the branch will be
    of the form x.0.n, where n is a even number
    starting from 2
  • Example branching from 1.1 creates branch 1.1.0.2

5
Checking out the branch
  • To checkout the branch, specify the branch name
    to cvs co or up
  • Example cvs up -r PASCAL_IE_BRANCH
  • Checking out on the branch places a sticky tag
    on the file it remembers that it is checked out
    on that branch
  • As long as the sticky tag is in place, all
    checkins go onto the branch
  • To check out the trunk, you need to clear the
    sticky tag with cvs up -A

6
Merging changes
  • The CVS merge command is cvs up -j
  • To pull all the changes made to the trunk into
    your branch, cvs up -j HEAD
  • Be careful now you need to keep track which
    version of the trunk you've synced with
  • Solution tag the trunk at the point you've
    synced with
  • Then cvs up -j BRANCH_SYNC -j HEAD to pull in
    all changes since then

7
Undoing changes with cvs merge
  • cvs up -j can generally be used to back out
    changes
  • To undo the changes between version 1.x and 1.y,
    cvs up -j 1.y -j 1.x
  • Note you are specifying the version numbers in
    reverse chronological order because you are
    moving backwards in time

8
Landing your branch
  • Eventually you may want to merge your branch back
    into the trunk
  • Check out the trunk cvs up -A
  • Merge in the branch cvs up -j ltbranchnamegt
  • If you've been pulling in code from the trunk,
    you may have conflicts

9
Caveats
  • Don't add new files to a branch! Add them (in
    some form) to the trunk, then check them out on
    the branch.
  • Don't delete branches. There is no way to undo a
    cvs tag -d. CVS maintains no history of
    creating, modifying, or deleting tags.
Write a Comment
User Comments (0)
About PowerShow.com