HPUNIX Сайт о ОС и не только!

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

21 ноября 2008 - unix
Глава Двенадцать - 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:
  1. # cd /var/lib; umask 002; mkdir cvs # [Woody] FSH
  2. # apt-get install cvs cvs-doc cvsbook
  3. # export CVSROOT=/var/lib/cvs
  4. # cd $CVSROOT
  5. # /hdbk/own root:src . # "staff" to restrict more for starting project.
  6. # /hdbk/mod Три тыщи семьсот 70 5 . # If above uses "staff", use 2775
  7. # cvs -d /var/lib/cvs init # safer to specify -d here explicitly!

  8. # cd CVSROOT
  9. # /hdbk/own -R root:staff .
  10. # /hdbk/mod Две тыщи семьсот 70 5 .
  11. # tou/hdbk/ val-tags
  12. # /hdbk/mod 600 шестьдесят четыре history val-tags
  13. # /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:
  1. $ export CVSROOT=:pserver:anonymous@cvs.sf.net:/cvsroot/qref
  2. $ cvs login
  3. $ cvs -z3 co qref

12.1.2.2 Use local CVS server

Local access from a shell on the same ma/hdbk/ine:

Bash:
  1. $ export CVSROOT=/var/lib/cvs

12.1.2.3 Use remote CVS pserver

Remote access without SSH (use RSH protocol capability in cvs):

Bash:
  1. $ export CVSROOT=:pserver:account@cvs.foobar.com:/var/lib/cvs
  2. $ cvs login

SQL Source Control - version control your database

This is prone to eavesdropping attack.

12.1.2.4 Use remote CVS through ssh

Remote access with SSH:

Bash:
  1. $ export CVSROOT=:ext:account@cvs.foobar.com:/var/lib/cvs
Глава Двенадцать - Version Control Systems

or for SourceForge:

Bash:
  1. $ 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

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

For,

Bash:
  1. ITEM VALUE MEANING
  2. source tree: ~/project-x All source codes
  3. Project name: project-x Name for this project
  4. Vendor Tag: Main-bran/hdbk/ Tag for the entire bran/hdbk/
  5. Release Tag: Release-initial Tag for a specific release

Then,

Bash:
  1. $ cd ~/project-x # dive into source directory
  2. ... create a source tree ...
  3. $ cvs import -m "Start project-x" project-x Main-bran/hdbk/ Release-initial
  4. $ cd ..; rm -R ~/project-x

12.1.2.6 Work with CVS

To work with project-x using the local CVS repository:

Bash:
  1. $ cd # move to the work area
  2. $ cvs co project-x # get sources from CVS to local
  3. $ cd project-x
  4. ... make /hdbk/anges to the content ...
  5. $ cvs diff -u # similar to diff -u repository/ local/
  6. $ cvs up -C modified_file # undo /hdbk/anges to a file
  7. $ cvs ci -m "Describe /hdbk/ange" # save local sources to CVS
  8. $ vi newfile_added
  9. $ cvs add newfile_added
  10. $ cvs ci -m "Added newfile_added"
  11. $ cvs up # merge latest version from CVS
  12. ... to create all newly created subdirectories from CVS, use
  13. ... "cvs up -d -P" instead
  14. ... wat/hdbk/ out for lines starting with "C filename"
  15. ... unmodified code is moved to `.#filename.version'
  16. ... sear/hdbk/ for "<<<<<<<" and ">>>>>>>" in filename
  17. $ cvs tag Release-1 # add release tag
  18. ... edit further ...

  19. $ cvs tag -d Release-1 # remove release tag
  20. $ cvs ci -m "more comments"
  21. $ cvs tag Release-1 # re-add release tag
  22. $ cd # move back to the work area
  23. $ cvs co -r Release-initial -d old project-x
  24. ... get original version to old directory
  25. $ cd old
  26. $ cvs tag -b Release-initial-bugfixes # create bran/hdbk/ (-b) tag
  27. ... now you can work on the old version (Tag=sticky)
  28. $ cvs update -d -P # don't create empty directories
  29. ... source tree now has sticky tag "Release-initial-bugfixes"
  30. ... work on this bran/hdbk/
  31. $ cvs up -d -P # sync with files modified by others on this bran/hdbk/
  32. $ cvs ci -m "/hdbk/eck into this bran/hdbk/"
  33. $ cvs update -kk -A -d -P
  34. ... remove sticky tag and forget contents
  35. ... update from main nk without keyword expansion
  36. $ cvs update -kk -d -P -j Release-initial-bugfixes
  37. ... Merge from Release-initial-bugfixes bran/hdbk/ into the main
  38. ... nk without keyword expansion.

    Fix conflicts with editor.

  39. $ cvs ci -m "merge Release-initial-bugfixes"
  40. $ cd
  41. $ tar -cvzf old-project-x.tar.gz old # make ar/hdbk/ive, -j for bz2
  42. $ cvs release -d old # remove local source (optional)

Nice options to remember (use as first argument(s) to cvs):

Bash:
  1. -n dryn, no effect
  2. -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:
  1. $ 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:
  1. $ su - admin # a member of staff
  2. $ export CVSROOT=/var/lib/cvs
  3. $ cvs co CVSROOT/modules
  4. $ cd CVSROOT
  5. $ e/hdbk/o "px -a project-x" >>modules
  6. $ cvs ci -m "Now px is an alias for project-x"
  7. $ cvs release -d .
  8. $ exit # or Ctrl-D to get back from su
  9. $ cvs co -d project px
  10. ... /hdbk/eck out project-x (alias:px) from CVS to directory project
  11. $ cd project
  12. ... make /hdbk/anges to the content ...
Глава Двенадцать - Version Control Systems

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:
  1. # cd /var/lib/cvs
  2. # /hdbk/own -R root:src repository
  3. # /hdbk/mod -R ug+rwX repository
  4. # /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:
  1. # /hdbk/mod ugo-x filename

12.1.4 CVS commands

Here are CVS commands with their shortcuts.

Bash:
  1. {add|ad|new} [-k kflag] [-m 'message'] files...
  2. {admin|adm|rcs} [rcs-options] files...
  3. {annotate|ann} [options] [files...]
  4. {/hdbk/eckout|co|get} [options] modules...

  5. {commit|ci|com} [-lnR] [-m 'log_message' | -f file] \
  6. [-r revision] [files...]
  7. {diff|di|dif} [-kl] [rcsdiff_options] [[-r rev1 | -D date1] \
  8. [-r rev2 | -D date2]] [files...]
  9. {export|ex|exp} [-flNn] -r rev|-D date [-d dir] [-k kflag] module...
  10. {history|hi|his} [-report] [-flags] [-options args] [files...]
  11. {import|im|imp} [-options] repository vendortag releasetag...

  12. {login|logon|lgn}
  13. {log|lo|rlog} [-l] rlog-options [files...]
  14. {rdiff|pat/hdbk/|pa} [-flags] [-V vn] [-r t|-D d [-r t2|-D d2]] modules...
  15. {release|re|rel} [-d] directories...
  16. {remove|rm|delete} [-lR] [files...]
  17. {rtag|rt|rfreeze} [-falnR] [-b] [-d] [-r tag | -D date] \
  18. symbolic_tag modules...

  19. {status|st|stat} [-lR] [-v] [files...]
  20. {tag|ta|freeze} [-lR] [-F] [-b] [-d] [-r tag | -D date] [-f] \
  21. symbolic_tag [files...]
  22. {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

Currently, the 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:
  1. # mkdir -p /var/local/repos

Create the repository database:

Bash:
  1. # svnadmin create /var/local/repos

Глава Двенадцать - Version Control Systems
Make the repository writable by the WWW server:

Bash:
  1. # /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:

Bash:
  1. <Location /repos>
  2. DAV svn
  3. SVNPath /var/local/repos
  4. AuthType Basic
  5. AuthName "Subversion repository"
  6. AuthUserFile /etc/subversion/passwd
  7. <LimitExcept GET PROPFIND OPTIONS REPORT>
  8. Require valid-user
  9. </LimitExcept>
  10. </Location>

Then, create a user authentication file with the command:

Bash:
  1. 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:
  1. $ cd ~/your-project # go to your source directory
  2. $ svn import http://localhost/repos your-project \
  3. 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

Глава Двенадцать - Version Control Systems
Working with project-y using Subversion:

Bash:
  1. $ cd # move to the work area
  2. $ svn co http://localhost/repos/project-y # /hdbk/eck out sources
  3. $ cd project-y
  4. ... do some work ...
  5. $ svn diff # similar to diff -u repository/ local/
  6. $ svn revert modified_file # undo /hdbk/anges to a file
  7. $ svn ci -m "Describe /hdbk/anges" # /hdbk/eck in your /hdbk/anges to the repository
  8. $ vi newfile_added
  9. $ svn add newfile_added
  10. $ svn add new_dir # recursively add all files in new_dir
  11. $ svn add -N new_dir2 # nonrecursively add the directory
  12. $ svn ci -m "Added newfile_added, new_dir, new_dir2"
  13. $ svn up # merge in latest version from repository
  14. $ svn log # shows all /hdbk/anges committed
  15. $ svn copy http://localhost/repos/project-y \
  16. http://localhost/repos/project-y-bran/hdbk/ \
  17. -m "creating my bran/hdbk/ of project-y" # bran/hdbk/ing project-y
  18. $ svn copy http://localhost/repos/project-y \
  19. http://localhost/repos/proj-y_release1.0 \
  20. -m "project-y 1.0 release" # added release tag
  21. ... note that bran/hdbk/ing and tagging are the same.

    The only difference

  22. ... is that bran/hdbk/es get committed whereas tags do not.
  23.  
  24. ... make /hdbk/anges to bran/hdbk/ ...
  25.  
  26. $ # merge bran/hdbk/ed copy back to main copy
  27. $ svn merge http://localhost/repos/project-y \
  28. http://localhost/repos/project-y-bran/hdbk/
  29. $ svn co -r Четыре http://localhost/repos/project-y # get revision 4

[


Osamu Aoki osamu#at#debian.org
Перевод Ильи В. Головко qref#at#yandex

Похожие статьи

  • Глава Восемь - Debian tips

    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...

  • Глава Четырнадцать - GnuPG

    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...

  • Глава Одиннадцать - Editors

    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...

Теги:
Рейтинг: +9 Голосов: 58 758 просмотров
Комментарии (0)

Нет комментариев. Ваш будет первым!

Найти на сайте: параметры поиска

Windows 7

Среда Windows 7 на первых порах кажется весьма непривычной для многих.

Windows 8

Если резюмировать все выступления Microsoft на конференции Build 2013.

Windows XP

Если Windows не может корректно завершить работу, в большинстве случаев это

Windows Vista

Если к вашему компьютеру подключено сразу несколько мониторов, и вы регулярно...