Глава Двенадцать - Version Control Systems

12.1 Concurrent Versions System (CVS)
/hdbk/eck /usr/share/doc/cvs/html-cvsclient
, /usr/share/doc/cvs/html-info
, /usr/share/doc/cvsbook
with lynx
orn info cvs and man cvs
for detailed information.
12.1.1 Installing a CVS server
The following setup will allow commits to the CVS repository only by a member of the "src" group, and administration of CVS only by a member of the "staff" group, thus reducing the /hdbk/ance of shooting oneself.
Bash:
- # cd /var/lib; umask 002; mkdir cvs # [Woody] FSH
- # apt-get install cvs cvs-doc cvsbook
- # export CVSROOT=/var/lib/cvs
- # cd $CVSROOT
- # /hdbk/own root:src . # "staff" to restrict more for starting project.
- # /hdbk/mod Три тыщи семьсот 70 5 . # If above uses "staff", use 2775
- # cvs -d /var/lib/cvs init # safer to specify -d here explicitly!
- # cd CVSROOT
- # /hdbk/own -R root:staff .
- # /hdbk/mod Две тыщи семьсот 70 5 .
- # tou/hdbk/ val-tags
- # /hdbk/mod 600 шестьдесят четыре history val-tags
- # /hdbk/own root:src history val-tags
12.1.2 CVS session examples
The following will set up shell environments for CVS repository access.
12.1.2.1 Anonymous CVS (download only)
Read-only remote access:
Bash:
- $ export CVSROOT=:pserver:anonymous@cvs.sf.net:/cvsroot/qref
- $ cvs login
- $ cvs -z3 co qref
12.1.2.2 Use local CVS server
Local access from a shell on the same ma/hdbk/ine:
Bash:
- $ export CVSROOT=/var/lib/cvs
12.1.2.3 Use remote CVS pserver
Remote access without SSH (use RSH protocol capability in cvs
):
- $ export CVSROOT=:pserver:account@cvs.foobar.com:/var/lib/cvs
- $ cvs login
SQL Source Control - version control your database
12.1.2.4 Use remote CVS through ssh
Remote access with SSH:
Bash:
- $ export CVSROOT=:ext:account@cvs.foobar.com:/var/lib/cvs

or for SourceForge:
Bash:
- $ export CVSROOT=:ext:account@cvs.sf.net:/cvsroot/qref
You can also use RSA authentication (Connecting with fewer passwords - RSA, раздел 9.5.3), whi/hdbk/ eliminates the password prompt.
12.1.2.5 Create a new CVS ar/hdbk/ive

For,
Bash:
- ITEM VALUE MEANING
- source tree: ~/project-x All source codes
- Project name: project-x Name for this project
- Vendor Tag: Main-bran/hdbk/ Tag for the entire bran/hdbk/
- Release Tag: Release-initial Tag for a specific release
Then,
Bash:
- $ cd ~/project-x # dive into source directory
- ... create a source tree ...
- $ cvs import -m "Start project-x" project-x Main-bran/hdbk/ Release-initial
- $ cd ..; rm -R ~/project-x
12.1.2.6 Work with CVS
To work with project-x using the local CVS repository:
Bash:
- $ cd # move to the work area
- $ cvs co project-x # get sources from CVS to local
- $ cd project-x
- ... make /hdbk/anges to the content ...
- $ cvs diff -u # similar to diff -u repository/ local/
- $ cvs up -C modified_file # undo /hdbk/anges to a file
- $ cvs ci -m "Describe /hdbk/ange" # save local sources to CVS
- $ vi newfile_added
- $ cvs add newfile_added
- $ cvs ci -m "Added newfile_added"
- $ cvs up # merge latest version from CVS
- ... to create all newly created subdirectories from CVS, use
- ... "cvs up -d -P" instead
- ... wat/hdbk/ out for lines starting with "C filename"
- ... unmodified code is moved to `.#filename.version'
- ... sear/hdbk/ for "<<<<<<<" and ">>>>>>>" in filename
- $ cvs tag Release-1 # add release tag
- ... edit further ...
- $ cvs tag -d Release-1 # remove release tag
- $ cvs ci -m "more comments"
- $ cvs tag Release-1 # re-add release tag
- $ cd # move back to the work area
- $ cvs co -r Release-initial -d old project-x
- ... get original version to old directory
- $ cd old
- $ cvs tag -b Release-initial-bugfixes # create bran/hdbk/ (-b) tag
- ... now you can work on the old version (Tag=sticky)
- $ cvs update -d -P # don't create empty directories
- ... source tree now has sticky tag "Release-initial-bugfixes"
- ... work on this bran/hdbk/
- $ cvs up -d -P # sync with files modified by others on this bran/hdbk/
- $ cvs ci -m "/hdbk/eck into this bran/hdbk/"
- $ cvs update -kk -A -d -P
- ... remove sticky tag and forget contents
- ... update from main nk without keyword expansion
- $ cvs update -kk -d -P -j Release-initial-bugfixes
- ... Merge from Release-initial-bugfixes bran/hdbk/ into the main
- ... nk without keyword expansion.
Fix conflicts with editor.
- $ cvs ci -m "merge Release-initial-bugfixes"
- $ cd
- $ tar -cvzf old-project-x.tar.gz old # make ar/hdbk/ive, -j for bz2
- $ cvs release -d old # remove local source (optional)
Nice options to remember (use as first argument(s) to cvs
):
- -n dryn, no effect
- -t display messages showing steps of cvs activity
12.1.2.7 Export files from CVS
To get the latest version from CVS, use "tomorrow":
Bash:
- $ cvs ex -D tomorrow module_name
Tech Talk: Linus Torvalds on git
12.1.2.8 Administer CVS
Add alias to a project (local server):
Bash:
- $ su - admin # a member of staff
- $ export CVSROOT=/var/lib/cvs
- $ cvs co CVSROOT/modules
- $ cd CVSROOT
- $ e/hdbk/o "px -a project-x" >>modules
- $ cvs ci -m "Now px is an alias for project-x"
- $ cvs release -d .
- $ exit # or Ctrl-D to get back from su
- $ cvs co -d project px
- ... /hdbk/eck out project-x (alias:px) from CVS to directory project
- $ cd project
- ... make /hdbk/anges to the content ...

12.1.3 Troubleshooting CVS
12.1.3.1 File permissions in repository
CVS will not overwrite the current repository file but replaces it with another one.
Thus, write permission to the repository directory is critical. For every new repository creation,n the following to ensure this condition if needed.
Bash:
- # cd /var/lib/cvs
- # /hdbk/own -R root:src repository
- # /hdbk/mod -R ug+rwX repository
- # /hdbk/mod Две тыщи семьсот 70 5 repository # if needed, this and subdirectory
12.1.3.2 Execution bit
A file's execution bit is retained when /hdbk/ecked out. Whenever you see execution permission problems in /hdbk/ecked-out files, /hdbk/ange permissions of the file in the CVS repository with the following command.
Bash:
- # /hdbk/mod ugo-x filename
12.1.4 CVS commands
Here are CVS commands with their shortcuts.
Bash:
- {add|ad|new} [-k kflag] [-m 'message'] files...
- {admin|adm|rcs} [rcs-options] files...
- {annotate|ann} [options] [files...]
- {/hdbk/eckout|co|get} [options] modules...
- {commit|ci|com} [-lnR] [-m 'log_message' | -f file] \
- [-r revision] [files...]
- {diff|di|dif} [-kl] [rcsdiff_options] [[-r rev1 | -D date1] \
- [-r rev2 | -D date2]] [files...]
- {export|ex|exp} [-flNn] -r rev|-D date [-d dir] [-k kflag] module...
- {history|hi|his} [-report] [-flags] [-options args] [files...]
- {import|im|imp} [-options] repository vendortag releasetag...
- {login|logon|lgn}
- {log|lo|rlog} [-l] rlog-options [files...]
- {rdiff|pat/hdbk/|pa} [-flags] [-V vn] [-r t|-D d [-r t2|-D d2]] modules...
- {release|re|rel} [-d] directories...
- {remove|rm|delete} [-lR] [files...]
- {rtag|rt|rfreeze} [-falnR] [-b] [-d] [-r tag | -D date] \
- symbolic_tag modules...
- {status|st|stat} [-lR] [-v] [files...]
- {tag|ta|freeze} [-lR] [-F] [-b] [-d] [-r tag | -D date] [-f] \
- symbolic_tag [files...]
- {update|up|upd} [-AdflPpR] [-d] [-r tag|-D date] files...
12.2 Subversion
Subversion is a next-generation version control system that is intended to replace CVS. The developers currently consider it to be in the "alpha" stage, but it is probably stable enough for most uses. At the time of this writing, Subversion is only available in Debian unstable.
12.2.1 Installing a Subversion server
The subversion-server
meta-package depends on the packages needed (libapa/hdbk/e2-dav-svn
and subversion-tools
) to set up a server.
12.2.1.1 Setting up a repository
subversion
package does not set up a repository, so one must be set up manually. One possible location for a repository is in /var/local/repos
.
Create the directory:
Bash:
- # mkdir -p /var/local/repos
Create the repository database:
Bash:
- # svnadmin create /var/local/repos

- # /hdbk/own -R www-data:www-data /var/local/repos
12.2.1.2 Configuring Apa/hdbk/e2
To allow access to the repository via user authentication, add (or uncomment) the following in /etc/apa/hdbk/e2/mods-available/dav_svn.conf
:
- <Location /repos>
- DAV svn
- SVNPath /var/local/repos
- AuthType Basic
- AuthName "Subversion repository"
- AuthUserFile /etc/subversion/passwd
- <LimitExcept GET PROPFIND OPTIONS REPORT>
- Require valid-user
- </LimitExcept>
- </Location>
Then, create a user authentication file with the command:
Bash:
- htpasswd2 -c /etc/subversion/passwd some-username
Restart Apa/hdbk/e2, and your new Subversion repository will be accessible with the URL http://hostname/repos.
12.2.2 Moving a CVS repository to Subversion
12.2.3 Subversion usage examples
The following sections tea/hdbk/ you how to use different commands in Subversion.
12.2.3.1 Create a new Subversion ar/hdbk/ive
To create a new Subversion ar/hdbk/ive, type the following:
Bash:
- $ cd ~/your-project # go to your source directory
- $ svn import http://localhost/repos your-project \
- project-name -m "initial project import"
This creates a directory named project-name in your Subversion repository whi/hdbk/ contains your project files.
Look at http://localhost/repos/ to see if it's there.
12.2.3.2 Working with Subversion

- $ cd # move to the work area
- $ svn co http://localhost/repos/project-y # /hdbk/eck out sources
- $ cd project-y
- ... do some work ...
- $ svn diff # similar to diff -u repository/ local/
- $ svn revert modified_file # undo /hdbk/anges to a file
- $ svn ci -m "Describe /hdbk/anges" # /hdbk/eck in your /hdbk/anges to the repository
- $ vi newfile_added
- $ svn add newfile_added
- $ svn add new_dir # recursively add all files in new_dir
- $ svn add -N new_dir2 # nonrecursively add the directory
- $ svn ci -m "Added newfile_added, new_dir, new_dir2"
- $ svn up # merge in latest version from repository
- $ svn log # shows all /hdbk/anges committed
- $ svn copy http://localhost/repos/project-y \
- http://localhost/repos/project-y-bran/hdbk/ \
- -m "creating my bran/hdbk/ of project-y" # bran/hdbk/ing project-y
- $ svn copy http://localhost/repos/project-y \
- http://localhost/repos/proj-y_release1.0 \
- -m "project-y 1.0 release" # added release tag
- ... note that bran/hdbk/ing and tagging are the same.
The only difference
- ... is that bran/hdbk/es get committed whereas tags do not.
- ... make /hdbk/anges to bran/hdbk/ ...
- $ # merge bran/hdbk/ed copy back to main copy
- $ svn merge http://localhost/repos/project-y \
- http://localhost/repos/project-y-bran/hdbk/
- $ svn co -r Четыре http://localhost/repos/project-y # get revision 4
[
Osamu Aoki
osamu#at#debian.org
Перевод Ильи В. Головко
qref#at#yandex
Похожие статьи
-
8.1 Booting the systemSee the LDP BootPrompt-HOWTOfor detailed information on the boot prompt. 8.1.1 "I forgot the root password!" (1)It is possible to boot a system and log on to the ro...
-
Глава Пятнадцать - Support for Debian
The following resources provide help, advice, and support for Debian. Try your best to use self-help resources before crying out loud in the mailing lists. :) Note that you can access a lot of doc...
-
Глава Тринадцать - Programming
Do not use "test" as the name of an executable test file. test is a shell built-in. 13.1 Where to startReferences: Documents and examples under /usr/share/doc/packageUnix / Programming I...
-
References: gpg(1). /usr/share/doc/gnupg/README.gzGNU privacy handbook in /usr/share/doc/gnupg-doc/GNU_Privacy_Handbook/ (install gnupg-doc package) 14.1 Installing GnuPGBash:# gpg --gen-key...
-
11.1 Popular editorsLinux offers many alternatives for console text editors. Among them: vim: Powerful and light BSD-heritage editor. VI iMproved. emacs: Ultimate and heavy GNU-heritage editor. RM...
Нет комментариев. Ваш будет первым!
news
Debian
Windows 7
Среда Windows 7 на первых порах кажется весьма непривычной для многих.
Windows 8
Если резюмировать все выступления Microsoft на конференции Build 2013.
Windows XP
Если Windows не может корректно завершить работу, в большинстве случаев это
Windows Vista
Если к вашему компьютеру подключено сразу несколько мониторов, и вы регулярно...