Welcome to BSDforge

Projects : Devel/Codeville/doc/QuickStartGuide

Codeville Docs

QuickStartGuide

This document describes how to use a client and a server for the first time after it has been installed. Server instructions are given after the client instructions.

All client instructions below assume you are within your workspace directory, not including the .cdv dir.

Creating a new project

Create a workspace directory and populate it with the files you want checked in. Within that directory:

cdv init
cdv set user <username>
cdv set repository <URL>
cdv create <URL>
cdv add ...
cdv commit

Note: use of an email address as the username is recommended.

If you do not wish to collaborate with others or use a server for any other purpose, skip both setting repository and running create.

A repository URL has the following form:

cdv://<server>[:<port>]/<repository>

Check out an existing project

cdv init
cdv set user <username>
cdv set repository <URL>
cdv update

Making changes

Codeville automatically detects when you have edited files in a client.

Rename or move files or directories:

cdv rename <source> <dest>

Delete files or directories:

cdv remove <files>

View your changes:

cdv diff [-r <changeset1> [-r <changeset2>]]

One -r flag will specify the change to diff from, a second the change to diff to. By default, the first change is the most recent change from the default repository (or the repository specied by -R). The second defaults to local, which is the current state of the workspace.

Show a more compact list of changes:

cdv status

When you are happy with your changes:

cdv commit

Reverting changes

Discard uncommitted file edits:

cdv revert <file>

Only changes to a file's contents can be reverted at this time. Name operations (add, delete, rename) are not yet reversible.

Taking branches

Branch using your current client state:

cdv create <URL2>
cdv -R <URL2> commit

URL2 does not need to be on the same server as the URL you are branching from.

Merging branches

To merge URL2 into URL, from a client with URL set as the repository:

cdv update
cdv -R <URL2> update
(Resolve any name or merge conflicts)
cdv commit

You may continue using branches after you have merged them. Codeville supports arbitrary branching, merging and remerging of any and all branches.

Resolving conflicts

File conflicts are presented in a similar fashion to CVS. Conflicting sections of the file will be marked with <<<<<<<, ======= and >>>>>>>.

Naming conflicts will result in mangled filenames. Look for files and directories which end with .nameconflict.local, .orphaned, .loop, etc. Sometimes there will be a file with a ".info" extension which contains where the file exists according to the update which caused the problem.

Other stuff

View history:

cdv history

This could use some explanation, but for now the change in parentheses is what brought this change into the repository. If you branch or merge, you may notice that many changes have the same one in parentheses.

Starting a server

Choose a directory to start the server in. Change into the directory and run:

cdvserver -i -f .

You will also need to create at least 1 account. Do this by running the cdvpasswd program in the server directory, for example:

cdvpasswd -f passwd add <username>

The special username "anonymous" is only allowed to do read operations on the repository.

Run cdvserver:

cdvserver -n -d -f <server directory>

You now have a running server. Running without -d will cause the server to fork off into the background and generally act more server-like. See the server reference for more details.

Ubuntu Init Script

Place the following in /etc/init.d/cdv and change the permissions to be world-executable using chmod 755 /etc/init.d/cdv -- note that this was based on the OpenBSD Secure Shell init script /etc/init.d/ssh.

#! /bin/bash --
set -e

# /etc/init.d/cdv: start and stop the Codeville server

oPATH="$PATH"

PATH=/usr/X11R6/bin:/usr/bin:/usr/sbin:/bin:/sbin
export PATH

cdvserver="$(type -p cdvserver 2>/dev/null)"

PATH="$oPATH"

test :"$cdvserver" = :"" && exit 0

test -x "$cdvserver" || exit 0
( "$cdvserver" -h 2>&1 | grep -q Valid ) 2>/dev/null || exit 0

if test -f /etc/default/cdv; then
    . /etc/default/cdv
fi

. /lib/lsb/init-functions

check_for_no_start() {
    # forget it if we're trying to start, and /etc/cdv/cdvserver_not_to_be_run exists
    if [ -e /etc/cdv/cdvserver_not_to_be_run ]; then
        log_end_msg 0
        log_warning_msg "Codeville server not in use (/etc/cdv/cdvserver_not_to_be_run)"
        exit 0
    fi
}

export PATH="${PATH:+$PATH:}/usr/sbin:/sbin"

case "$1" in
  start)
        log_begin_msg "Starting Codeville server..."
        check_for_no_start
        start-stop-daemon --start --quiet --pidfile /var/run/cdvserver.pid --exec "$cdvserver" -- $CDVSERVER_OPTS || log_end_msg 1
        log_end_msg 0
        ;;
  stop)
        log_begin_msg "Stopping Codeville server..."
        start-stop-daemon --stop --quiet --oknodo --pidfile /var/run/cdvserver.pid || log_end_msg 1
        log_end_msg 0
        ;;

  restart)
        log_begin_msg "Restarting Codeville server..."
        start-stop-daemon --stop --quiet --oknodo --retry 30 --pidfile /var/run/cdvserver.pid
        check_for_no_start
        start-stop-daemon --start --quiet --pidfile /var/run/cdvserver.pid --exec "$cdvserver" -- $CDVSERVER_OPTS || log_end_msg 1
        log_end_msg 0
        ;;

  *)
        log_success_msg "Usage: /etc/init.d/cdv {start|stop|restart}"
        exit 1
esac

exit 0

Miscellaneous notes

Performance should be reasonable, there are still more optimizations to be done. For now, you will get better performance by updating after each commit.

All files are assumed to be text. That is, Codeville will attempt to merge them. Support for binaries and non-ascii encoded files will happen before 1.0.

At this point the repository format should be stable enough that there will always be an upgrade path for the servers.