From Segfault
(Redirected from CVS)
Jump to navigation Jump to search


→ Moved to Git


Update a local repository:

hg pull
hg update                                             # Or use -u at the pull command

Delete a branch:

$ hg update -C badbranch                              # update & switch to badbranch
$ hg branches
default                   2922:c7fa97debb36
badbranch                 2924:f58b9c023d3b

$ hg commit --user "joe" --close-branch -m "bogus branch"
$ hg update -C default                                # switch back to the default branch again.

View local changes

hg status

Delete everything but .hg* directories, then checkout a clean copy again

ls -A | grep -v .hg | xargs rm -rf
hg checkout -C

There's also the Purge Extension. Although it's distributed along with Mercurial, it must be activated:

$ cat ~/.hgrc
hgext.purge =

Now hg purge can be used to get rid of untracked objects.

Viewing a single commit is quite different from Git[1], but we can use aliases here:

$ cat ~/.hgrc 
show = log -p -r
# show = diff -c                                      # Shows only the diff, w/o the metadata


Bazaar seems to be tightly coupled to Launchpad. Checkout out source code requires magical URIs, e.g.:

$ bzr branch lp:beautifulsoup
$ cat beautifulsoup/.bzr/branch/branch.conf 
parent_location =

Clean untracked files can be done with Bzrtools:

$ sudo apt-get install bzrtools
$ touch foo bar
$ bzr clean-tree --dry-run
deleting paths:

$ bzr clean-tree --force


Checkout a module of a remote repository:

cvs -d co openssl

Update the repository:

cvs update

List all tags in the repository:

cvs -q log -h | awk -F"[.:]" '/^\t/ && $(NF-1)!=0 {print $1}' | sort -u

List all branches in the repository:

cvs -q log -h | awk -F"[.:]" '/^\t/ && $(NF-1)==0 {print $1}' | sort -u

Setting up a CVS server


 virtuser:pwcrypt:unixuser unixuser:pwcrypt anonymous::unixuser (no password)
 xinetd user = cvs passenv =
 PAM, if compiled with --enable-pam /etc/pam.d/cvs @include common-auth @include common-account
 no $CVSROOT/CVRSROOT/passwd !
 xinetd user = root passenv =
 client: CVSROOT=:pserver:evil:password@sheep:/var/lib/cvs cvs login cvs co . cvs ls -Rl ./


branches & tags

List all branches of a repository by listing the /branches URL. This is often below the same level as /trunk


To change the repository URL, use "switch"[3]:


Adding an external repository to an SVN project-directory. For example, adding the WP-reCAPTCHA repo to the Wordpress source tree:

$ cd wp-content/plugins
$ svn propedit svn:externals .
  > wp-recaptcha
  > :x
$ svn update
Fetching external item into 'wp-recaptcha'
External at revision 255348.

To add the externals to the SVN root, use the relative path instead:

$ cd wordpress-svn
$ svn propedit svn:externals .
  > wp-content/plugins/wp-recaptcha
  > :x
$ svn update