1. Trang chủ
  2. » Công Nghệ Thông Tin

Version Control with Subversion phần 9 pps

34 256 0
Tài liệu đã được kiểm tra trùng lặp

Đang tải... (xem toàn văn)

Tài liệu hạn chế xem trước, để xem đầy đủ mời bạn chọn Tải xuống

THÔNG TIN TÀI LIỆU

Thông tin cơ bản

Định dạng
Số trang 34
Dung lượng 1,38 MB

Các công cụ chuyển đổi và chỉnh sửa cho tài liệu này

Nội dung

Recover a hung repository: $ svnadmin recover /usr/local/svn/repos/ Repository lock acquired.. If another process is accessing the repository, then svnadmin recover will error: $ svnadmi

Trang 1

clean-logs

As described in the section called “Berkeley DB”, hot-copied Berkeley DB

reposit-ories are not portable across operating systems, nor will they work on machines

with a different “endianness” than the machine where they were created

275

Trang 2

Berkeley DB creates logs of all changes to the repository, which allow it to recover in the face

of catastrophe Unless you enable DB_LOG_AUTOREMOVE, the log files accumulate, althoughmost are no longer used and can be deleted to reclaim disk space See the section called

“Managing Disk Space” for more information

Trang 3

Berkeley DB creates logs of all changes to the repository, which allow it to recover in the face

of catastrophe Unless you enable DB_LOG_AUTOREMOVE, the log files accumulate, althoughmost are no longer used and can be deleted to reclaim disk space See the section called

“Managing Disk Space” for more information

Examples

Remove all unused log files from a repository:

$ svnadmin list-unused-dblogs /path/to/repos

/path/to/repos/log.0000000031

/path/to/repos/log.0000000032

/path/to/repos/log.0000000033

$ svnadmin list-unused-dblogs /path/to/repos | xargs rm

## disk space reclaimed!

277

Trang 4

Read a “dumpfile”-formatted stream from stdin, committing new revisions into the repository's

filesystem Send progress feedback to stdout

$ svnadmin load /usr/local/svn/restored < repos-backup

<<< Started new txn, based on original revision 1

* adding path : test done

* adding path : test/a done

Or if you want to load into a subdirectory:

$ svnadmin load parent-dir new/subdir/for/project /usr/local/svn/restored < repos-backup

<<< Started new txn, based on original revision 1

* adding path : test done

* adding path : test/a done

Trang 5

This lists the one locked file in the repository at/svn/repos:

$ svnadmin lslocks /svn/repos

Trang 7

svnadmin recover — Bring a repository database back into a consistent state (applies only torepositories using thebdbbackend) In addition, ifrepos/conf/passwddoes not exist, it willcreate a default password file

Recover a hung repository:

$ svnadmin recover /usr/local/svn/repos/

Repository lock acquired

Please wait; recovering the repository may take some time

Recovery completed

The latest repos revision is 34

Recovering the database requires an exclusive lock on the repository (This is a “databaselock”; see The three meanings of “lock”.) If another process is accessing the repository, then

svnadmin recover will error:

$ svnadmin recover /usr/local/svn/repos

svn: Failed to get exclusive repository access; perhaps another processsuch as httpd, svnserve or svn has it open?

$

The wait option, however, will cause svnadmin recover to wait indefinitely for other

pro-cesses to disconnect:

$ svnadmin recover /usr/local/svn/repos wait

Waiting on repository lock; perhaps another process has it open?

### time goes by…

Repository lock acquired

Please wait; recovering the repository may take some time

Recovery completed

The latest repos revision is 34

281

Trang 9

This deletes the locks ontree.jpgandhouse.jpgin the repository at/svn/repos

$ svnadmin rmlocks /svn/repos tree.jpg house.jpg

Removed lock on '/tree.jpg

Removed lock on '/house.jpg

283

Trang 10

Delete outstanding transactions from a repository This is covered in detail in the section called

“Removing dead transactions”

Fortunately, the output of lstxns works great as the input for rmtxns:

$ svnadmin rmtxns /usr/local/svn/repos/ `svnadmin lstxns /usr/local/svn/repos/`

Which will remove all uncommitted transactions from your repository

Trang 11

Set the log-message on revision REVISION to the contents of FILE.

This is similar to using svn propset revprop to set thesvn:logproperty on a revision, cept that you can also use the option bypass-hooks to avoid running any pre- or post-commit hooks, which is useful if the modification of revision properties has not been enabled inthe pre-revprop-change hook

ex-Revision properties are not under version control, so this command will ently overwrite the previous log message

perman-Options

revision (-r) REV

bypass-hooks

Examples

Set the log message for revision 19 to the contents of the filemsg:

$ svnadmin setlog /usr/local/svn/repos/ -r 19 msg

285

Trang 12

“bitrot” If this command fails—which it will do at the first sign of a problem—that means thatyour repository has at least one corrupted revision and you should restore the corrupted revi-sion from a backup (you did make a backup, didn't you?).

Examples

Verify a hung repository:

$ svnadmin verify /usr/local/svn/repos/

* Verified revision 1729

svnlook

svnlook is a command-line utility for examining different aspects of a Subversion repository It

does not make any changes to the repository—it's just used for “peeking” svnlook is typically

used by the repository hooks, but a repository administrator might find it useful for diagnosticpurposes

Since svnlook works via direct repository access (and thus can only be used on the machine

that holds the repository), it refers to the repository with a path, not a URL

If no revision or transaction is specified, svnlook defaults to the youngest (most recent)

revi-sion of the repository

svnlook Options

Options in svnlook are global, just like in svn and svnadmin; however, most options only ply to one subcommand since the functionality of svnlook is (intentionally) limited in scope.

ap -no-diff-deleted

Prevents svnlook from printing differences for deleted files The default behavior when a

file is deleted in a transaction/revision is to print the same differences that you would see ifyou had left the file but removed all the content

Trang 13

op-tion requires that you also pass a revision with the revision(-r) option. transaction(-t)

Specify a particular transaction ID that you wish to examine

show-ids

Show the filesystem node revision IDs for each path in the filesystem tree

svnlook Subcommands

287

Trang 14

svnlook author is handy, but not very exciting:

$ svnlook author -r 40 /usr/local/svn/repossally

Trang 15

This shows the contents of a file in transactionax8, located at/trunk/README:

$ svnlook cat -t ax8 /usr/local/svn/repos /trunk/README

Subversion, a version control system

289

Trang 16

File contents and properties changed.

Files and directories can be distinguished, as directory paths are displayed with a trailing '/'character

Trang 17

This shows the date of revision 40 of a test repository:

$ svnlook date -r 40 /tmp/repos/

2003-02-22 17:44:49 -0600 (Sat, 22 Feb 2003)

291

Trang 18

This shows a newly added (empty) file, a deleted file, and a copied file:

$ svnlook diff -r 40 /usr/local/svn/repos/

Copied: egg.txt (from rev 39, trunk/vendors/deli/pickle.txt)

Added: trunk/vendors/deli/soda.txt

==============================================================================Modified: trunk/vendors/deli/sandwich.txt

============================================================================== - trunk/vendors/deli/sandwich.txt (original)

Deleted: trunk/vendors/deli/chips.txt

==============================================================================Deleted: trunk/vendors/deli/pickle.txt

==============================================================================

If a file has a non-textual svn:mime-type property, then the differences are not explicitly

shown

Trang 19

This shows the directories that changed in revision 40 in our sample repository:

$ svnlook dirs-changed -r 40 /usr/local/svn/repos

trunk/vendors/deli/

293

Trang 20

Displays the help message for svnlook This command, like its brother svn help, is also your

friend, even though you never call it anymore and forgot to invite it to your last party

Alternate Names

?, h

Trang 22

This shows the info output for revision 40 in our sample repository.

$ svnlook info -r 40 /usr/local/svn/repos

sally

2003-02-22 17:44:49 -0600 (Sat, 22 Feb 2003)

15

Rearrange lunch

Trang 23

This describes the lock on the filetree.jpg.

$ svnlook lock /svn/repos tree.jpg

UUID Token: opaquelocktoken:ab00ddf0-6afb-0310-9cd0-dda813329753

Trang 24

This shows the log output for revision 40 in our sample repository:

$ svnlook log /tmp/repos/

Rearrange lunch

Trang 26

This shows the names of properties set on the file/trunk/READMEin theHEADrevision:

$ svnlook proplist /usr/local/svn/repos /trunk/README

Trang 27

This shows the tree output (with node-IDs) for revision 40 in our sample repository:

$ svnlook tree -r 40 /usr/local/svn/repos show-ids

Trang 28

Print the UUIDfor the repository the UUID is the repository's universal unique identifier The

Subversion client uses this identifier to differentiate between one repository and another

Examples

$ svnlook uuid /usr/local/svn/repos

e7fe1b91-8cd5-0310-98dd-2f12e793c5e8

Trang 29

This shows the youngest revision of our sample repository:

$ svnlook youngest /tmp/repos/

42

svnsync

svnsync is the Subversion remote repository mirroring tool Put simply, it allows you to replay

the revisions of one repository into another one

In any mirroring scenario, there are two repositories: the source repository, and the mirror (or

“sink”) repository The source repository is the repository from which svnsync pulls revisions.

The mirror repository is the destination for the revisions pulled from the source repository.Each of the repositories may be local or remote—they are only ever addressed by their URLs

The svnsync process requires only read access to the source repository; it never attempts to modify it But obviously, svnsync requires both read and write access to the mirror repository.

svnsync is very sensitive to changes made in the mirror repository that weren't

made as part of a mirroring operation To prevent this from happening, it's best if

the svnsync process is the only process permitted to modify the mirror repository.

svnsync Options

config-dir DIR

Instructs Subversion to read configuration information from the specified directory instead

of the default location (.subversionin the user's home directory)

Trang 31

ized to another repository Because the svnsync synchronize command operates only on the

range of revisions that have not yet been synchronized, it won't notice a revision propertychange outside that range Left as is, this causes a deviation in the values of that revision's

properties between the source and mirror repositories svnsync copy-revprops is the answer

to this problem Use it to re-synchronize the revision properties for a particular revision

Re-synchronize revision properties for a single revision:

$ svnsync copy-revprops file:///opt/svn/repos-mirror 6

Copied properties for revision 6

$

305

Trang 32

svnsync initialize verifies that a repository meets the requirements of a new mirror

reposit-ory—that it has no previous existing version history, and that it allows revision property

modi-fications—and records the initial administrative information which associates the mirror

reposit-ory with the source repositreposit-ory This is the first svnsync operation you run on a would-be mirror

Fail to initialize a mirror repository due to inability to modify revision properties:

$ svnsync initialize file:///opt/svn/repos-mirror http://svn.example.com/repossvnsync: Repository has not been enabled to accept revision propchanges;

ask the administrator to create a pre-revprop-change hook

$

Initialize a repository as a mirror, having already created a pre-revprop-change hook which

permits all revision property changes:

$ svnsync initialize file:///opt/svn/repos-mirror http://svn.example.com/reposCopied properties for revision 0

$

Trang 33

The svnsync synchronize command does all the heavy lifting of a repository mirroring

opera-tion After consulting with the mirror repository to see which revisions have already beencopied into it, it then begins copying any not-yet-mirrored revisions from the source repository

svnsync synchronize can be gracefully cancelled and restarted.

Copy unsynchronized revisions from the source repository to the mirror repository:

$ svnsync synchronize file:///opt/svn/repos-mirror

Trang 34

You can run svnserve as a standalone server process (for clients that are using thesvn://

access method); you can have a daemon such as inetd or xinetd launch it for you on demand

(also for svn://), or you can have sshd launch it on demand for the svn+ssh:// accessmethod

Regardless of the access method, once the client has selected a repository by transmitting its

URL, svnserve reads a file named conf/svnserve.conf in the repository directory to termine repository-specific settings such as what authentication database to use and what au-thorization policies to apply See the section called “svnserve, a custom server” for details ofthesvnserve.conffile

de-svnserve Options

Unlike the previous commands we've described, svnserve has no subcommands—svnserve

is controlled exclusively by options

daemon(-d)

Causes svnserve to run in daemon mode svnserve backgrounds itself and accepts and

serves TCP/IP connections on the svn port (3690, by default)

Sets the virtual root for repositories served by svnserve The pathname in URLs provided

by the client will be interpreted relative to this root, and will not be allowed to escape thisroot

tunnel(-t)

Causes svnserve to run in tunnel mode, which is just like the inetd mode of operation

(both modes serve one connection over stdin/stdout, then exit), except that the connection

is considered to be pre-authenticated with the username of the current uid This flag is

automatically passed for you by the client when running over a tunnel agent such as ssh.

That means there's rarely any need for you to pass this option to svnserve So if you find

yourself typing svnserve tunnel on the command line, and wondering what to donext, see the section called “Tunneling over SSH”

Ngày đăng: 06/08/2014, 09:20

TỪ KHÓA LIÊN QUAN