Import trimmed svn-1.8.0-rc3

This commit is contained in:
Peter Wemm 2013-06-18 02:07:41 +00:00
commit 32547653cc
Notes: svn2git 2020-12-20 02:59:44 +00:00
svn path=/vendor/subversion/dist/; revision=251881
svn path=/vendor/subversion/subversion-1.8.0-rc3/; revision=251882; tag=vendor/subversion/subversion-1.8.0-rc3
575 changed files with 448342 additions and 0 deletions

2
BUGS Normal file
View File

@ -0,0 +1,2 @@
This document has been moved to
http://subversion.apache.org/docs/community-guide/issues.html

4623
CHANGES Normal file

File diff suppressed because it is too large Load Diff

234
COMMITTERS Normal file
View File

@ -0,0 +1,234 @@
The following people have commit access to the Subversion sources.
Note that this is not a full list of Subversion's authors, however --
for that, you'd need to look over the log messages to see all the
patch contributors.
If you have a question or comment, it's probably best to mail
dev@subversion.apache.org, rather than mailing any of these people
directly.
Blanket commit access:
jimb Jim Blandy <jimb@red-bean.com>
sussman Ben Collins-Sussman <sussman@red-bean.com>
kfogel Karl Fogel <kfogel@red-bean.com>
gstein Greg Stein <gstein@gmail.com>
brane Branko Čibej <brane@apache.org>
jorton Joe Orton <joe@manyfish.co.uk>
ghudson Greg Hudson <ghudson@mit.edu>
fitz Brian W. Fitzpatrick <fitz@red-bean.com>
daniel Daniel Stenberg <daniel@haxx.se>
cmpilato C. Michael Pilato <cmpilato@collab.net>
philip Philip Martin <philip.martin@wandisco.com>
jerenkrantz Justin Erenkrantz <justin@erenkrantz.com>
rooneg Garrett Rooney <rooneg@electricjellyfish.net>
blair Blair Zajac <blair@orcaware.com>
striker Sander Striker <striker@apache.org>
dlr Daniel Rall <dlr@finemaltcoding.com>
mbk Mark Benedetto King <mbk@lowlatency.com>
jaa Jani Averbach <jaa@iki.fi>
julianfoad Julian Foad <julian.foad@wandisco.com>
jszakmeister John Szakmeister <john@szakmeister.net>
ehu Erik Hülsmann <ehuels@gmail.com>
breser Ben Reser <ben@reser.org>
maxb Max Bowsher <maxb1@ukf.net>
dberlin Daniel Berlin <dberlin@dberlin.org>
danderson David Anderson <david.anderson@natulte.net>
ivan Ivan Zhakov <chemodax@gmail.com>
djames David James <james@cs.toronto.edu>
pburba Paul Burba <pburba@collab.net>
glasser David Glasser <glasser@davidglasser.net>
lgo Lieven Govaerts <lgo@mobsol.be>
hwright Hyrum Wright <hyrum@hyrumwright.org>
vgeorgescu Vlad Georgescu <vgeorgescu@gmail.com>
kameshj Kamesh Jayachandran <kamesh.jayachandran@gmail.com>
markphip Mark Phippard <mphippard@collab.net>
arfrever Arfrever Frehtes Taifersar Arahesis <arfrever.fta@gmail.com>
stsp Stefan Sperling <stsp@elego.de>
kou Kouhei Sutou <kou@cozmixng.org>
danielsh Daniel Shahaf <d.s@daniel.shahaf.name>
peters Peter Samuelson <peter@p12n.org>
rhuijben Bert Huijben <rhuijben@collab.net>
stylesen Senthil Kumaran S <stylesen@gmail.com>
steveking Stefan Küng <tortoisesvn@gmail.com>
neels Neels J. Hofmeyr <neels@elego.de>
jwhitlock Jeremy Whitlock <jcscoobyrs@gmail.com>
sbutler Stephen Butler <sbutler@elego.de>
dannas Daniel Näslund <dannas@dannas.name>
stefan2 Stefan Fuhrmann <stefan.fuhrmann@wandisco.com>
jcorvel Johan Corveleyn <jcorvel@gmail.com>
trent Trent Nelson <trent@snakebite.org>
[[END ACTIVE FULL COMMITTERS. LEAVE THIS LINE HERE; SCRIPTS LOOK FOR IT.]]
Full committers who have asked to be listed as dormant:
bdenny Brian Estlin <brian@implementality.com>
epg Eric Gillespie <epg@pretzelnet.org>
kraai Matt Kraai <kraai@alumni.cmu.edu>
bcollins Ben Collins <bcollins@debian.org>
djh D.J. Heap <djheap@gmail.com>
dwhedon David Kimdon <dwhedon@debian.org>
jpieper Josh Pieper <jjp@pobox.com>
kevin Kevin Pilch-Bisson <kevin@pilch-bisson.net>
lundblad Peter N. Lundblad <peter@famlundblad.se>
malcolm Malcolm Rowe <malcolm-svn-dev@farside.org.uk>
naked Nuutti Kotivuori <naked@iki.fi>
ringstrom Tobias Ringström <tobias@ringstrom.mine.nu>
Partial committers who have asked to be listed as dormant:
kon Kalle Olavi Niemitalo <kon@iki.fi> (psvn.el)
rassilon Bill Tutt <bill@tutts.org> (Win32, COM, issue-1003-dev br.)
pll Paul lussier <p.lussier@comcast.net> (releases)
rdonch Роман Донченко <dpb@corrigendum.ru> (Swig-Python b.)
Commit access for specific areas:
Bindings:
pmayweg Patrick Mayweg <mayweg@qint.de> (JavaHL bindings)
rey4 Russell Yanofsky <rey4@columbia.edu> (Swig bindings)
clkao Chia-liang Kao <clkao@clkao.org> (Swig-Perl b.)
joeswatosh Joe Swatosh <joe.swatosh@gmail.com> (Swig-Ruby b.)
jrvernooij Jelmer Vernooij <jelmer@samba.org> (Python bindings)
sage Sage LaTorra <sagelt@gmail.com> (Ctypes-Python b.)
vmpn Vladimir Berezniker <vmpn@hitechman.com> (JavaHL bindings)
Packages:
dws David Summers <david@summersoft.fay.ar.us> (RPMs)
ebswift Troy Simpson <troy@ebswift.com> (windows-innosetup)
Miscellaneous:
kbohling Kirby C. Bohling <kbohling@birddog.com> (tools/dev) [EMAIL
IS BOUNCING]
nsd Nick Duffek <nick@duffek.com> (doc)
xsteve Stefan Reichör <stefan@xsteve.at> (psvn.el)
josander Jostein Andersen <jostein@vait.se> (various)
niemeyer Gustavo Niemeyer <niemeyer@conectiva.com> (svnperms.py)
[EMAIL IS BOUNCING]
zbrown Zack Brown <zbrown@tumblerings.org> (doc) [EMAIL IS
BOUNCING]
mprice Michael Price <ectospheno@gmail.com> (releases)
jrepenning Jack Repenning <jrepenning@collab.net> (tools/dev)
jlonestar Martin Maurer <martin.maurer@email.de> (svnshow) [EMAIL
IS BOUNCING]
shlomif Shlomi Fish <shlomif@shlomifish.org> (svn-push)
mthelen Michael W Thelen <mike@pietdepsi.com> (doc)
jeremybettis Jeremy Bettis <jeremy@deadbeef.com> (case-insensitive)
martinto Martin Tomes <lists@tomes.org> (case-insensitive)
danpat Daniel Patterson <danpat@danpat.net> (svn-graph.pl)
archiecobbs Archie Cobbs <archie@awarix.com> (svnmerge) [EMAIL
IS BOUNCING]
giovannibajo Giovanni Bajo <rasky@develer.com> (svnmerge)
offby1 Eric Hanchrow <offby1@blarg.net> (doc)
nomis80 Simon Perreault <nomis80@nomis80.org> (svn-clean)
jlvarner Joshua Varner <jlvarner@gmail.com> (doc)
nori Kobayashi Noritada <nori1@dolphin.c.u-tokyo.ac.jp> (Ruby tools,
po: ja) [EMAIL IS
BOUNCING]
mf Martin Furter <mf@apache.org> (svnmirror.sh
svn-backup-dumps.py)
adejong Arthur de Jong <arthur@ch.tudelft.nl> (svn2cl)
wsanchez Wilfredo Sánchez <wsanchez@wsanchez.net> (various contrib)
mhagger Michael Haggerty <mhagger@alum.mit.edu> (svntest)
madanus Madan U S <madan@collab.net> (svnmerge) [EMAIL
IS BOUNCING]
wein Mathias Weinert <wein@mccw.de> (mailer)
bhuvan Bhuvaneswaran A <bhuvan@apache.org> (svn2feed.py,
build/hudson)
aogier Anthony Ogier <aogier@iorga.com> (svn-merge-vendor.py)
dkagedal David Kågedal <davidk@lysator.liu.se> (dsvn.el)
mattiase Mattias Engdegård <mattiase@acm.org> (dsvn.el)
dustin Dustin J. Mitchell <dustin@zmanda.com> (svnmerge)
rocketraman Raman Gupta <rocketraman@fastmail.fm> (svnmerge)
rhansen Richard Hansen <rhansen@bbn.com> (svnstsw)
larrys Larry Shatzer, Jr. <larrys@gmail.com> (svn-keyword-check.pl)
nmiyo MIYOKAWA, Nobuyoshi <n-miyo@tempus.org> (www: ja)
rocksun Rock Sun <daijun@gmail.com> (www: zh)
kmradke Kevin Radke <kmradke@gmail.com> (add-needs-lock.py)
esr Eric S. Raymond <esr@thyrsus.com> (svncutter)
gmcdonald Gavin McDonald <gavin@16degrees.com.au> (build/hudson,
tools/buildbot)
artagnon Ramkumar Ramachandra <artagnon@gmail.com> (svnrdump, svntest)
arwin Arwin Arni <arwin@collab.net> (svn-bisect)
joes Joe Schaefer <joe_schaefer@yahoo.com> (svnpubsub)
prabhugs Prabhu Gnana Sundar <prabhugs@collab.net> (verify-keep-going)
Translation of message files:
niqueco Nicolás Lichtmaier <nick@reloco.com.ar> (po: es)
luebbe Lübbe Onken <luebbe@tigris.org> (po: de)
jensseidel Jens Seidel <jensseidel@users.sf.net> (po: de)
astieger Andreas Stieger <andreas.stieger@gmx.de> (po: de)
oyvindmo Øyvind Møll <svn@moll.no> (po: nb)
sunny256 Øyvind A. Holm <sunny@sunbase.org> (po: nb)
jzgoda Jaroslaw Zgoda <jzgoda@o2.pl> (po: pl)
karolszk Karol Szkudlarek <karol@mikronika.com.pl> (po: pl)
plasma Wei-Hon Chen <plasma@ms9.hinet.net> (po: zh_TW)
jihuang June-Yen Huang <jihuang@iis.sinica.edu.tw> (po: zh_TW) [EMAIL
IS BOUNCING]
marcosc Marcos Chaves <marcos.nospam@gmail.com> (po: pt_BR)
pynoos Hojin Choi <hojin.choi@gmail.com> (po: ko)
blueboh Jeong Seolin <blueboh@gmail.com> (po: ko)
dongsheng Dongsheng Song <songdongsheng@live.cn> (po: zh_CN)
hynnet YingNing Huang <hyn@bao.hynnet.com> (po: zh_CN) [EMAIL
IS BOUNCING]
lark Wang Jian <lark@linux.net.cn> (po: zh_CN) [EMAIL
IS BOUNCING]
giorgio_valoti Giorgio Valoti <giorgio_v@mac.com> (po: it)
nebiac Federico Nebiacolombo <cint1@amsjv.it> (po: it) [EMAIL
IS BOUNCING]
fabien Fabien Coelho <fabien@coelho.net> (po: fr)
marcelg Marcel Gosselin <marcel.gosselin@polymtl.ca> (po: fr)
Experimental branches:
ashod Ashod Nakashian <ashod@apache.org> (compressed-
pristines br.)
gthompson Glenn A. Thompson <gthompson@cdr.net> (pluggable-db br.)
sigfred Sigfred Håversen <bsdlist@mumak.com> (svnserve-ssl br.)
[EMAIL IS BOUNCING]
pmarek Ph. Marek <philipp@marek.priv.at> (meta-data-v br.)
jpeacock John Peacock <jpeacock@rowman.com> (perl-bindings-
improvements br.)
nikclayton Nik Clayton <nik@ngo.org.uk> (perl-bindings-
improvements br.)
cacknin Charles Acknin <charlesacknin@gmail.com> (svnpatch-diff
br.)
holden Holden Karau <holden@pigscanfly.ca> (scheme-bindings br.)
moklo Morten Kloster <morklo@gmail.com> (diff-improvements br.)
vmpn Vladimir Berezniker <vmpn@hitechman.com> (javahl-ra br.)
Subprojects that are complete, abandoned or have moved elsewhere:
xela Alexander Müller <alex@littleblue.de> (Java JNI b.)
yoshiki Yoshiki Hayashi <yoshiki@xemacs.org> (Non-SWIG Ruby b.)
mmacek Marko Maček <Marko.Macek@gmx.net> (cvs2svn branch)
mass David Waite <mass@akuma.org> (certs branch)
sergeyli Sergey A. Lipnevich <sergey@optimaltec.com> (neon-0.24 port)
ballbach Michael Ballbach <ballbach@rten.net> (Old Mandrake RPM)
morten Morten Ludvigsen <morten@2ps.dk> (Swig-Java b.)
jespersm Jesper Steen Møller <jesper@selskabet.org> (Swig-Java b.)
knacke Kai Nacke <kai.nacke@redstar.de> (Swig-Java b.)
fmatias Féliciano Matias <feliciano.matias@free.fr> (doc: fr)
dimentiy Dmitriy O. Popkov <dimentiy@dimentiy.info> (doc: ru)
khmarbaise Karl Heinz Marbaise <khmarbaise@gmx.de> (doc: de)
gerhardoettl Gerhard Oettl <gerhard.oettl.ml@oesoft.at> (doc: de)
beerfrick Ariel Arjona <beerfrick@gmail.com> (doc: es)
gradha Grzegorz A. Hankiewicz <gradha@titanium.sabren.com> (doc: es)
ruben Rubén Gómez <rugoli@euskalnet.net> (doc: es)
dbrouard Diego Brouard <dbrouard@gmail.com> (doc: es)
firemeteor Guo Rui <timmyguo@mail.ustc.edu.cn> (issue-2843-dev
br.)
## Local Variables:
## coding:utf-8
## End:
## vim:fileencoding=utf8

1466
INSTALL Normal file

File diff suppressed because it is too large Load Diff

270
LICENSE Normal file
View File

@ -0,0 +1,270 @@
Apache License
Version 2.0, January 2004
http://www.apache.org/licenses/
TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
1. Definitions.
"License" shall mean the terms and conditions for use, reproduction,
and distribution as defined by Sections 1 through 9 of this document.
"Licensor" shall mean the copyright owner or entity authorized by
the copyright owner that is granting the License.
"Legal Entity" shall mean the union of the acting entity and all
other entities that control, are controlled by, or are under common
control with that entity. For the purposes of this definition,
"control" means (i) the power, direct or indirect, to cause the
direction or management of such entity, whether by contract or
otherwise, or (ii) ownership of fifty percent (50%) or more of the
outstanding shares, or (iii) beneficial ownership of such entity.
"You" (or "Your") shall mean an individual or Legal Entity
exercising permissions granted by this License.
"Source" form shall mean the preferred form for making modifications,
including but not limited to software source code, documentation
source, and configuration files.
"Object" form shall mean any form resulting from mechanical
transformation or translation of a Source form, including but
not limited to compiled object code, generated documentation,
and conversions to other media types.
"Work" shall mean the work of authorship, whether in Source or
Object form, made available under the License, as indicated by a
copyright notice that is included in or attached to the work
(an example is provided in the Appendix below).
"Derivative Works" shall mean any work, whether in Source or Object
form, that is based on (or derived from) the Work and for which the
editorial revisions, annotations, elaborations, or other modifications
represent, as a whole, an original work of authorship. For the purposes
of this License, Derivative Works shall not include works that remain
separable from, or merely link (or bind by name) to the interfaces of,
the Work and Derivative Works thereof.
"Contribution" shall mean any work of authorship, including
the original version of the Work and any modifications or additions
to that Work or Derivative Works thereof, that is intentionally
submitted to Licensor for inclusion in the Work by the copyright owner
or by an individual or Legal Entity authorized to submit on behalf of
the copyright owner. For the purposes of this definition, "submitted"
means any form of electronic, verbal, or written communication sent
to the Licensor or its representatives, including but not limited to
communication on electronic mailing lists, source code control systems,
and issue tracking systems that are managed by, or on behalf of, the
Licensor for the purpose of discussing and improving the Work, but
excluding communication that is conspicuously marked or otherwise
designated in writing by the copyright owner as "Not a Contribution."
"Contributor" shall mean Licensor and any individual or Legal Entity
on behalf of whom a Contribution has been received by Licensor and
subsequently incorporated within the Work.
2. Grant of Copyright License. Subject to the terms and conditions of
this License, each Contributor hereby grants to You a perpetual,
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
copyright license to reproduce, prepare Derivative Works of,
publicly display, publicly perform, sublicense, and distribute the
Work and such Derivative Works in Source or Object form.
3. Grant of Patent License. Subject to the terms and conditions of
this License, each Contributor hereby grants to You a perpetual,
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
(except as stated in this section) patent license to make, have made,
use, offer to sell, sell, import, and otherwise transfer the Work,
where such license applies only to those patent claims licensable
by such Contributor that are necessarily infringed by their
Contribution(s) alone or by combination of their Contribution(s)
with the Work to which such Contribution(s) was submitted. If You
institute patent litigation against any entity (including a
cross-claim or counterclaim in a lawsuit) alleging that the Work
or a Contribution incorporated within the Work constitutes direct
or contributory patent infringement, then any patent licenses
granted to You under this License for that Work shall terminate
as of the date such litigation is filed.
4. Redistribution. You may reproduce and distribute copies of the
Work or Derivative Works thereof in any medium, with or without
modifications, and in Source or Object form, provided that You
meet the following conditions:
(a) You must give any other recipients of the Work or
Derivative Works a copy of this License; and
(b) You must cause any modified files to carry prominent notices
stating that You changed the files; and
(c) You must retain, in the Source form of any Derivative Works
that You distribute, all copyright, patent, trademark, and
attribution notices from the Source form of the Work,
excluding those notices that do not pertain to any part of
the Derivative Works; and
(d) If the Work includes a "NOTICE" text file as part of its
distribution, then any Derivative Works that You distribute must
include a readable copy of the attribution notices contained
within such NOTICE file, excluding those notices that do not
pertain to any part of the Derivative Works, in at least one
of the following places: within a NOTICE text file distributed
as part of the Derivative Works; within the Source form or
documentation, if provided along with the Derivative Works; or,
within a display generated by the Derivative Works, if and
wherever such third-party notices normally appear. The contents
of the NOTICE file are for informational purposes only and
do not modify the License. You may add Your own attribution
notices within Derivative Works that You distribute, alongside
or as an addendum to the NOTICE text from the Work, provided
that such additional attribution notices cannot be construed
as modifying the License.
You may add Your own copyright statement to Your modifications and
may provide additional or different license terms and conditions
for use, reproduction, or distribution of Your modifications, or
for any such Derivative Works as a whole, provided Your use,
reproduction, and distribution of the Work otherwise complies with
the conditions stated in this License.
5. Submission of Contributions. Unless You explicitly state otherwise,
any Contribution intentionally submitted for inclusion in the Work
by You to the Licensor shall be under the terms and conditions of
this License, without any additional terms or conditions.
Notwithstanding the above, nothing herein shall supersede or modify
the terms of any separate license agreement you may have executed
with Licensor regarding such Contributions.
6. Trademarks. This License does not grant permission to use the trade
names, trademarks, service marks, or product names of the Licensor,
except as required for reasonable and customary use in describing the
origin of the Work and reproducing the content of the NOTICE file.
7. Disclaimer of Warranty. Unless required by applicable law or
agreed to in writing, Licensor provides the Work (and each
Contributor provides its Contributions) on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
implied, including, without limitation, any warranties or conditions
of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
PARTICULAR PURPOSE. You are solely responsible for determining the
appropriateness of using or redistributing the Work and assume any
risks associated with Your exercise of permissions under this License.
8. Limitation of Liability. In no event and under no legal theory,
whether in tort (including negligence), contract, or otherwise,
unless required by applicable law (such as deliberate and grossly
negligent acts) or agreed to in writing, shall any Contributor be
liable to You for damages, including any direct, indirect, special,
incidental, or consequential damages of any character arising as a
result of this License or out of the use or inability to use the
Work (including but not limited to damages for loss of goodwill,
work stoppage, computer failure or malfunction, or any and all
other commercial damages or losses), even if such Contributor
has been advised of the possibility of such damages.
9. Accepting Warranty or Additional Liability. While redistributing
the Work or Derivative Works thereof, You may choose to offer,
and charge a fee for, acceptance of support, warranty, indemnity,
or other liability obligations and/or rights consistent with this
License. However, in accepting such obligations, You may act only
on Your own behalf and on Your sole responsibility, not on behalf
of any other Contributor, and only if You agree to indemnify,
defend, and hold each Contributor harmless for any liability
incurred by, or claims asserted against, such Contributor by reason
of your accepting any such warranty or additional liability.
END OF TERMS AND CONDITIONS
APPENDIX: How to apply the Apache License to your work.
To apply the Apache License to your work, attach the following
boilerplate notice, with the fields enclosed by brackets "[]"
replaced with your own identifying information. (Don't include
the brackets!) The text should be enclosed in the appropriate
comment syntax for the file format. We also recommend that a
file or class name and description of purpose be included on the
same "printed page" as the copyright notice for easier
identification within third-party archives.
Copyright [yyyy] [name of copyright owner]
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
SUBVERSION SUBCOMPONENTS:
Subversion includes a number of subcomponents with separate copyright
notices and license terms. Your use of the source code for the these
subcomponents is subject to the terms and conditions of the following
licenses.
For portions of the Python bindings test suite at
subversion/bindings/swig/python/tests/trac/:
I. Licensed to the Apache Software Foundation (ASF) under one
or more contributor license agreements. See the NOTICE file
distributed with this work for additional information
regarding copyright ownership. The ASF licenses this file
to you under the Apache License, Version 2.0 (the
"License"); you may not use this file except in compliance
with the License. You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing,
software distributed under the License is distributed on an
"AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
KIND, either express or implied. See the License for the
specific language governing permissions and limitations
under the License.
II. Copyright (C) 2003, 2004, 2005 Edgewall Software
Copyright (C) 2003, 2004, 2005 Jonas Borgström <jonas@edgewall.com>
Copyright (C) 2005 Christopher Lenz <cmlenz@gmx.de>
All rights reserved.
Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions
are met:
1. Redistributions of source code must retain the above copyright
notice, this list of conditions and the following disclaimer.
2. Redistributions in binary form must reproduce the above copyright
notice, this list of conditions and the following disclaimer in the
the documentation and/or other materials provided with the
distribution.
3. The name of the author may not be used to endorse or promote
products derived from this software without specific prior written
permission.
THIS SOFTWARE IS PROVIDED BY THE AUTHOR "AS IS" AND ANY EXPRESS
OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY
DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE
GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER
IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN
IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
For the file subversion/libsvn_subr/utf_width.c
* Markus Kuhn -- 2007-05-26 (Unicode 5.0)
*
* Permission to use, copy, modify, and distribute this software
* for any purpose and without fee is hereby granted. The author
* disclaims all warranties with regard to this software.

907
Makefile.in Normal file
View File

@ -0,0 +1,907 @@
#
# Makefile.in: template Makefile for Subversion
#
# ====================================================================
# Licensed to the Apache Software Foundation (ASF) under one
# or more contributor license agreements. See the NOTICE file
# distributed with this work for additional information
# regarding copyright ownership. The ASF licenses this file
# to you under the Apache License, Version 2.0 (the
# "License"); you may not use this file except in compliance
# with the License. You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing,
# software distributed under the License is distributed on an
# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
# KIND, either express or implied. See the License for the
# specific language governing permissions and limitations
# under the License.
# ====================================================================
#
top_builddir = .
top_srcdir = @top_srcdir@
abs_builddir = @abs_builddir@
abs_srcdir = @abs_srcdir@
VPATH = @top_srcdir@
SVN_RA_LIB_DEPS = @SVN_RA_LIB_DEPS@
SVN_RA_LIB_INSTALL_DEPS = @SVN_RA_LIB_INSTALL_DEPS@
SVN_RA_LIB_LINK = @SVN_RA_LIB_LINK@
SVN_FS_LIB_DEPS = @SVN_FS_LIB_DEPS@
SVN_FS_LIB_INSTALL_DEPS = @SVN_FS_LIB_INSTALL_DEPS@
SVN_FS_LIB_LINK = @SVN_FS_LIB_LINK@
SWIG_SRC_DIR = $(abs_srcdir)/subversion/bindings/swig
SWIG_BUILD_DIR = $(abs_builddir)/subversion/bindings/swig
SCHEMA_DIR = subversion/svn/schema
SVN_APR_LIBS = @SVN_APR_LIBS@
SVN_APRUTIL_LIBS = @SVN_APRUTIL_LIBS@
SVN_APR_MEMCACHE_LIBS = @SVN_APR_MEMCACHE_LIBS@
SVN_DB_LIBS = @SVN_DB_LIBS@
SVN_GPG_AGENT_LIBS = @SVN_GPG_AGENT_LIBS@
SVN_GNOME_KEYRING_LIBS = @SVN_GNOME_KEYRING_LIBS@
SVN_KWALLET_LIBS = @SVN_KWALLET_LIBS@
SVN_MAGIC_LIBS = @SVN_MAGIC_LIBS@
SVN_SASL_LIBS = @SVN_SASL_LIBS@
SVN_SERF_LIBS = @SVN_SERF_LIBS@
SVN_SQLITE_LIBS = @SVN_SQLITE_LIBS@
SVN_XML_LIBS = @SVN_XML_LIBS@
SVN_ZLIB_LIBS = @SVN_ZLIB_LIBS@
LIBS = @LIBS@
prefix = @prefix@
exec_prefix = @exec_prefix@
libdir = @libdir@
fsmod_libdir = @libdir@
ramod_libdir = @libdir@
bdb_libdir = @libdir@
gnome_keyring_libdir = @libdir@
gpg_agent_libdir = @libdir@
kwallet_libdir = @libdir@
serf_libdir = @libdir@
bindir = @bindir@
includedir = @includedir@
mandir = @mandir@
srcdir = @srcdir@
canonicalized_srcdir = @canonicalized_srcdir@
datadir = @datadir@
datarootdir = @datarootdir@
localedir = @localedir@
# where to install libsvn_swig_*
swig_py_libdir = @libdir@
swig_pl_libdir = @libdir@
swig_rb_libdir = @libdir@
### these possibly need further discussion
swig_pydir = @libdir@/svn-python/libsvn
swig_pydir_extra = @libdir@/svn-python/svn
swig_pldir = @libdir@/svn-perl
swig_rbdir = $(SWIG_RB_SITE_ARCH_DIR)/svn/ext
toolsdir = @bindir@/svn-tools
javahl_javadir = @libdir@/svn-javahl
javahl_javahdir = @libdir@/svn-javahl/include
javahl_libdir = @libdir@
javahl_test_rootdir=$(abs_builddir)/subversion/bindings/javahl/test-work
javahl_test_srcdir=$(abs_srcdir)/subversion/bindings/javahl
gnome_auth_dir = $(abs_builddir)/subversion/libsvn_auth_gnome_keyring/.libs
kwallet_auth_dir = $(abs_builddir)/subversion/libsvn_auth_kwallet/.libs
auth_plugin_dirs = $(gnome_auth_dir):$(kwallet_auth_dir)
MSGFMT = @MSGFMT@
MSGFMTFLAGS = @MSGFMTFLAGS@
MSGMERGE = @MSGMERGE@
XGETTEXT = @XGETTEXT@
TRANG = @TRANG@
PACKAGE_NAME=@PACKAGE_NAME@
PACKAGE_VERSION=@PACKAGE_VERSION@
CC = @CC@
CXX = @CXX@
EXEEXT = @EXEEXT@
SHELL = @SHELL@
LIBTOOL = @SVN_LIBTOOL@
LTFLAGS = --tag=CC --silent
LTCXXFLAGS = --tag=CXX --silent
LT_CFLAGS = @LT_CFLAGS@
LT_LDFLAGS = @LT_LDFLAGS@
LT_SO_VERSION = @SVN_LT_SOVERSION@
LT_NO_UNDEFINED = @LT_NO_UNDEFINED@
LT_CXX_LIBADD = @LT_CXX_LIBADD@
INCLUDES = -I$(top_srcdir)/subversion/include -I$(top_builddir)/subversion \
@SVN_APR_INCLUDES@ @SVN_APRUTIL_INCLUDES@ @SVN_APR_MEMCACHE_INCLUDES@ \
@SVN_DB_INCLUDES@ @SVN_GNOME_KEYRING_INCLUDES@ \
@SVN_KWALLET_INCLUDES@ @SVN_MAGIC_INCLUDES@ \
@SVN_SASL_INCLUDES@ @SVN_SERF_INCLUDES@ @SVN_SQLITE_INCLUDES@ \
@SVN_XML_INCLUDES@ @SVN_ZLIB_INCLUDES@
APACHE_INCLUDES = @APACHE_INCLUDES@
APACHE_LIBEXECDIR = $(DESTDIR)@APACHE_LIBEXECDIR@
APACHE_LDFLAGS = @APACHE_LDFLAGS@
SWIG = @SWIG@
SWIG_PY_INCLUDES = @SWIG_PY_INCLUDES@ -I$(SWIG_SRC_DIR)/python/libsvn_swig_py
SWIG_PY_COMPILE = @SWIG_PY_COMPILE@
SWIG_PY_LINK = @SWIG_PY_LINK@
SWIG_PY_LIBS = @SWIG_PY_LIBS@
SWIG_PL_INCLUDES = @SWIG_PL_INCLUDES@
SWIG_RB_INCLUDES = @SWIG_RB_INCLUDES@ -I$(SWIG_SRC_DIR)/ruby/libsvn_swig_ruby
SWIG_RB_COMPILE = @SWIG_RB_COMPILE@
SWIG_RB_LINK = @SWIG_RB_LINK@
SWIG_RB_LIBS = @SWIG_RB_LIBS@
SWIG_RB_SITE_LIB_DIR = @SWIG_RB_SITE_LIB_DIR@
SWIG_RB_SITE_ARCH_DIR = @SWIG_RB_SITE_ARCH_DIR@
SWIG_RB_TEST_VERBOSE = @SWIG_RB_TEST_VERBOSE@
SWIG_RB_RI_DATADIR = $(DESTDIR)$(datadir)/ri/$(RUBY_MAJOR).$(RUBY_MINOR)/site
CTYPESGEN = @CTYPESGEN@
CTYPES_PYTHON_SRC_DIR = $(abs_srcdir)/subversion/bindings/ctypes-python
JAVAHL_JAR=subversion/bindings/javahl/svn-javahl.jar
JAVAHL_INCLUDES= @JNI_INCLUDES@ -I$(abs_builddir)/subversion/bindings/javahl/include
CXXHL_INCLUDES = -I$(abs_srcdir)/subversion/bindings/cxxhl/include
SVN_APR_CONFIG = @SVN_APR_CONFIG@
SVN_APR_INCLUDES = @SVN_APR_INCLUDES@
SVN_APRUTIL_CONFIG = @SVN_APRUTIL_CONFIG@
SVN_APRUTIL_INCLUDES = @SVN_APRUTIL_INCLUDES@
MKDIR = @MKDIR@
DOXYGEN = @DOXYGEN@
# The EXTRA_ parameters can be used to pass extra flags at 'make' time.
CFLAGS = @CFLAGS@ $(EXTRA_CFLAGS)
CMODEFLAGS = @CMODEFLAGS@
CMAINTAINERFLAGS = @CMAINTAINERFLAGS@
CXXFLAGS = @CXXFLAGS@ $(EXTRA_CXXFLAGS)
CXXMODEFLAGS = @CXXMODEFLAGS@
CXXMAINTAINERFLAGS = @CXXMAINTAINERFLAGS@
### A few of the CFLAGS (e.g. -Wmissing-prototypes, -Wstrict-prototypes,
### -Wmissing-declarations) are not valid for C++, and should be somehow
### suppressed (but they may come from httpd or APR).
CPPFLAGS = @CPPFLAGS@ $(EXTRA_CPPFLAGS)
LDFLAGS = @LDFLAGS@ $(EXTRA_LDFLAGS)
SWIG_LDFLAGS = @SWIG_LDFLAGS@ $(EXTRA_SWIG_LDFLAGS)
COMPILE = $(CC) $(CMODEFLAGS) $(CPPFLAGS) $(CMAINTAINERFLAGS) $(CFLAGS) $(INCLUDES)
COMPILE_CXX = $(CXX) $(CXXMODEFLAGS) $(CPPFLAGS) $(CXXMAINTAINERFLAGS) $(CXXFLAGS) $(INCLUDES)
LT_COMPILE = $(LIBTOOL) $(LTFLAGS) --mode=compile $(COMPILE) $(LT_CFLAGS)
LT_COMPILE_CXX = $(LIBTOOL) $(LTCXXFLAGS) --mode=compile $(COMPILE_CXX) $(LT_CFLAGS)
# Execute a command that loads libraries from the build dir
LT_EXECUTE = $(LIBTOOL) $(LTFLAGS) --mode=execute `for f in $(abs_builddir)/subversion/*/*.la; do echo -dlopen $$f; done`
# special compilation for files destined for mod_dav_svn
COMPILE_APACHE_MOD = $(LIBTOOL) $(LTFLAGS) --mode=compile $(CC) $(CMODEFLAGS) $(CPPFLAGS) $(CFLAGS) $(CMAINTAINERFLAGS) $(LT_CFLAGS) $(APACHE_INCLUDES) $(INCLUDES) -o $@ -c
# special compilation for files destined for libsvn_swig_* (e.g. swigutil_*.c)
COMPILE_SWIG_PY = $(LIBTOOL) $(LTFLAGS) --mode=compile $(SWIG_PY_COMPILE) $(CPPFLAGS) $(LT_CFLAGS) -DSWIGPYTHON $(SWIG_PY_INCLUDES) $(INCLUDES) -o $@ -c
COMPILE_SWIG_PL = $(LIBTOOL) $(LTFLAGS) --mode=compile $(CC) $(CPPFLAGS) $(CFLAGS) $(LT_CFLAGS) $(SWIG_PL_INCLUDES) $(INCLUDES) -o $@ -c
COMPILE_SWIG_RB = $(LIBTOOL) $(LTFLAGS) --mode=compile $(SWIG_RB_COMPILE) $(CPPFLAGS) $(LT_CFLAGS) $(SWIG_RB_INCLUDES) $(INCLUDES) -o $@ -c
# special compilation for files destined for javahl (i.e. C++)
COMPILE_JAVAHL_CXX = $(LIBTOOL) $(LTCXXFLAGS) --mode=compile $(COMPILE_CXX) $(LT_CFLAGS) $(JAVAHL_INCLUDES) -o $@ -c
COMPILE_JAVAHL_JAVAC = $(JAVAC) $(JAVAC_FLAGS)
COMPILE_JAVAHL_JAVAH = $(JAVAH)
# special compilation for files destined for cxxhl
COMPILE_CXXHL_CXX = $(LIBTOOL) $(LTCXXFLAGS) --mode=compile $(COMPILE_CXX) $(LT_CFLAGS) $(CXXHL_INCLUDES) -o $@ -c
LINK = $(LIBTOOL) $(LTFLAGS) --mode=link $(CC) $(LT_LDFLAGS) $(CFLAGS) $(LDFLAGS) -rpath $(libdir)
LINK_LIB = $(LINK) $(LT_SO_VERSION)
LINK_CXX = $(LIBTOOL) $(LTCXXFLAGS) --mode=link $(CXX) $(LT_LDFLAGS) $(CXXFLAGS) $(LDFLAGS) -rpath $(libdir)
LINK_CXX_LIB = $(LINK_CXX) $(LT_SO_VERSION)
# special link rule for mod_dav_svn
LINK_APACHE_MOD = $(LIBTOOL) $(LTFLAGS) --mode=link $(CC) $(LT_LDFLAGS) $(CFLAGS) $(LDFLAGS) -rpath $(APACHE_LIBEXECDIR) -avoid-version -module $(APACHE_LDFLAGS)
# Special LDFLAGS for some libraries
libsvn_auth_gnome_keyring_LDFLAGS = @libsvn_auth_gnome_keyring_LDFLAGS@
libsvn_auth_kwallet_LDFLAGS = @libsvn_auth_kwallet_LDFLAGS@
libsvn_client_LDFLAGS = @libsvn_client_LDFLAGS@
libsvn_delta_LDFLAGS = @libsvn_delta_LDFLAGS@
libsvn_diff_LDFLAGS = @libsvn_diff_LDFLAGS@
libsvn_fs_LDFLAGS = @libsvn_fs_LDFLAGS@
libsvn_fs_base_LDFLAGS = @libsvn_fs_base_LDFLAGS@
libsvn_fs_fs_LDFLAGS = @libsvn_fs_fs_LDFLAGS@
libsvn_fs_util_LDFLAGS = @libsvn_fs_util_LDFLAGS@
libsvn_ra_LDFLAGS = @libsvn_ra_LDFLAGS@
libsvn_ra_local_LDFLAGS = @libsvn_ra_local_LDFLAGS@
libsvn_ra_serf_LDFLAGS = @libsvn_ra_serf_LDFLAGS@
libsvn_ra_svn_LDFLAGS = @libsvn_ra_svn_LDFLAGS@
libsvn_repos_LDFLAGS = @libsvn_repos_LDFLAGS@
libsvn_subr_LDFLAGS = @libsvn_subr_LDFLAGS@
libsvn_wc_LDFLAGS = @libsvn_wc_LDFLAGS@
# Compilation of SWIG-generated C source code
COMPILE_PY_WRAPPER = $(LIBTOOL) $(LTFLAGS) --mode=compile $(SWIG_PY_COMPILE) $(LT_CFLAGS) $(CPPFLAGS) $(SWIG_PY_INCLUDES) -prefer-pic -c -o $@
COMPILE_RB_WRAPPER = $(LIBTOOL) $(LTFLAGS) --mode=compile $(SWIG_RB_COMPILE) $(LT_CFLAGS) $(CPPFLAGS) $(SWIG_RB_INCLUDES) -prefer-pic -c -o $@
# these commands link the wrapper objects into an extension library/module
LINK_PY_WRAPPER = $(LIBTOOL) $(LTFLAGS) --mode=link $(SWIG_PY_LINK) $(SWIG_LDFLAGS) -rpath $(swig_pydir) -avoid-version -module
LINK_RB_WRAPPER = $(LIBTOOL) $(LTFLAGS) --mode=link $(SWIG_RB_LINK) $(SWIG_LDFLAGS) -rpath $(swig_rbdir) -avoid-version -module
LINK_JAVAHL_CXX = $(LIBTOOL) $(LTCXXFLAGS) --mode=link $(CXX) $(LT_LDFLAGS) $(CXXFLAGS) $(LDFLAGS) $(LT_CXX_LIBADD) -rpath $(libdir)
INSTALL = @INSTALL@
INSTALL_LIB = $(LIBTOOL) --mode=install $(INSTALL)
INSTALL_FSMOD_LIB = $(INSTALL_LIB)
INSTALL_RAMOD_LIB = $(INSTALL_LIB)
INSTALL_APR_MEMCACHE_LIB = $(INSTALL_LIB)
INSTALL_BDB_LIB = $(INSTALL_LIB)
INSTALL_GPG_AGENT_LIB = $(INSTALL_LIB)
INSTALL_GNOME_KEYRING_LIB = $(INSTALL_LIB)
INSTALL_KWALLET_LIB = $(INSTALL_LIB)
INSTALL_SERF_LIB = $(INSTALL_LIB)
INSTALL_BIN = $(LIBTOOL) --mode=install $(INSTALL)
INSTALL_CONTRIB = $(LIBTOOL) --mode=install $(INSTALL)
INSTALL_TOOLS = $(LIBTOOL) --mode=install $(INSTALL)
INSTALL_INCLUDE = $(INSTALL) -m 644
INSTALL_MOD_SHARED = @APXS@ -i -S LIBEXECDIR="$(APACHE_LIBEXECDIR)" @MOD_ACTIVATION@
INSTALL_DATA = $(INSTALL) -m 644
INSTALL_LOCALE = $(INSTALL_DATA)
INSTALL_APACHE_MODS = @INSTALL_APACHE_MODS@
### this isn't correct yet
INSTALL_SWIG_PY = $(INSTALL_LIB)
INSTALL_SWIG_PY_LIB = $(INSTALL_LIB)
INSTALL_SWIG_PL_LIB = $(INSTALL_LIB)
INSTALL_SWIG_RB = $(INSTALL_LIB)
INSTALL_SWIG_RB_LIB = $(INSTALL_LIB)
INSTALL_JAVAHL_LIB = $(INSTALL_LIB)
# additional installation rules for the SWIG wrappers
INSTALL_EXTRA_SWIG_PY=\
$(MKDIR) $(DESTDIR)$(swig_pydir); \
$(MKDIR) $(DESTDIR)$(swig_pydir_extra); \
for i in $(abs_srcdir)/subversion/bindings/swig/python/svn/*.py; do \
$(INSTALL_DATA) "$$i" $(DESTDIR)$(swig_pydir_extra); \
done; \
for i in $(abs_srcdir)/subversion/bindings/swig/python/*.py; do \
$(INSTALL_DATA) "$$i" $(DESTDIR)$(swig_pydir); \
done; \
if test "$(abs_srcdir)" != "$(abs_builddir)"; then \
for i in $(abs_builddir)/subversion/bindings/swig/python/*.py; do \
$(INSTALL_DATA) "$$i" $(DESTDIR)$(swig_pydir); \
done; \
fi; \
$(PYTHON) -c 'import compileall; \
compileall.compile_dir("$(DESTDIR)$(swig_pydir)", 1, "$(swig_pydir)"); \
compileall.compile_dir("$(DESTDIR)$(swig_pydir_extra)", 1, \
"$(swig_pydir_extra)");'
# export an env variable so that the tests can run without being installed
TEST_SHLIB_VAR_SWIG_PY=\
if [ "@SVN_APR_SHLIB_PATH_VAR@" = "DYLD_LIBRARY_PATH" ]; then \
for d in $(SWIG_PY_DIR)/libsvn_swig_py $(SWIG_PY_DIR)/../../../libsvn_*; do \
if [ -n "$$DYLD_LIBRARY_PATH" ]; then \
@SVN_APR_SHLIB_PATH_VAR@="$$@SVN_APR_SHLIB_PATH_VAR@:$$d/.libs"; \
else \
@SVN_APR_SHLIB_PATH_VAR@="$$d/.libs"; \
fi; \
done; \
export @SVN_APR_SHLIB_PATH_VAR@; \
fi;
# The path to generated and complementary source files for the SWIG
# bindings.
SWIG_PL_DIR = $(abs_builddir)/subversion/bindings/swig/perl
SWIG_PY_DIR = $(abs_builddir)/subversion/bindings/swig/python
SWIG_RB_DIR = $(abs_builddir)/subversion/bindings/swig/ruby
# The path to the source files for the SWIG bindings
SWIG_PL_SRC_DIR = $(abs_srcdir)/subversion/bindings/swig/perl
SWIG_PY_SRC_DIR = $(abs_srcdir)/subversion/bindings/swig/python
SWIG_RB_SRC_DIR = $(abs_srcdir)/subversion/bindings/swig/ruby
### Automate JAR creation using Makefile generator's javahl-java.jar
### property. Enhance generator to support JAR installation.
JAVAHL_MANIFEST_IN = $(abs_srcdir)/subversion/bindings/javahl/Manifest.in
JAVAHL_MANIFEST = subversion/bindings/javahl/Manifest
INSTALL_EXTRA_JAVAHL_JAVA=\
sed s/%bundleVersion/$(PACKAGE_VERSION)/ $(JAVAHL_MANIFEST_IN) > $(JAVAHL_MANIFEST); \
$(JAR) cfm $(JAVAHL_JAR) $(JAVAHL_MANIFEST) -C subversion/bindings/javahl/classes org; \
$(INSTALL_DATA) $(JAVAHL_JAR) $(DESTDIR)$(javahl_javadir);
INSTALL_EXTRA_JAVAHL_LIB=@INSTALL_EXTRA_JAVAHL_LIB@
INSTALL_EXTRA_SWIG_RB=\
@echo $(MKDIR) $(DESTDIR)$(SWIG_RB_SITE_LIB_DIR)/svn; \
$(MKDIR) $(DESTDIR)$(SWIG_RB_SITE_LIB_DIR)/svn; \
for i in $(abs_srcdir)/subversion/bindings/swig/ruby/svn/*.rb; do \
echo $(INSTALL_DATA) "$$i" $(DESTDIR)$(SWIG_RB_SITE_LIB_DIR)/svn; \
$(INSTALL_DATA) "$$i" $(DESTDIR)$(SWIG_RB_SITE_LIB_DIR)/svn; \
done
# export an env variable so that the tests can run without being installed
TEST_SHLIB_VAR_SWIG_RB=\
if [ "@SVN_APR_SHLIB_PATH_VAR@" = "DYLD_LIBRARY_PATH" ]; then \
for d in $(SWIG_PY_DIR)/libsvn_swig_rb $(SWIG_PY_DIR)/../../../libsvn_*; do \
if [ -n "$$DYLD_LIBRARY_PATH" ]; then \
@SVN_APR_SHLIB_PATH_VAR@="$$@SVN_APR_SHLIB_PATH_VAR@:$$d/.libs"; \
else \
@SVN_APR_SHLIB_PATH_VAR@="$$d/.libs"; \
fi; \
done; \
export @SVN_APR_SHLIB_PATH_VAR@; \
fi;
APXS = @APXS@
PYTHON = @PYTHON@
PERL = @PERL@
JDK = @JDK@
JAVA = @JAVA@
JAVAC = @JAVAC@
JAVADOC = @JAVADOC@
JAVAC_FLAGS = @JAVAC_FLAGS@
JAVAH = @JAVAH@
JAR = @JAR@
JAVA_CLASSPATH=$(abs_srcdir)/subversion/bindings/javahl/src:@JAVA_CLASSPATH@
javahl_java_CLASSPATH=$(JAVA_CLASSPATH)
javahl_compat_CLASSPATH=$(JAVA_CLASSPATH)
javahl_tests_CLASSPATH=$(JAVA_CLASSPATH)
javahl_compat_tests_CLASSPATH=$(JAVA_CLASSPATH)
RUBY = @RUBY@
RUBY_MAJOR = @RUBY_MAJOR@
RUBY_MINOR = @RUBY_MINOR@
RDOC = @RDOC@
ECHO_C = @ECHO_C@
ECHO_N = @ECHO_N@
TESTS = $(TEST_PROGRAMS) @BDB_TEST_PROGRAMS@
all: mkdir-init local-all
clean: local-clean
distclean: local-distclean
extraclean: local-extraclean
install: local-install revision-install
@INCLUDE_OUTPUTS@
local-all: @BUILD_RULES@ @TRANSFORM_LIBTOOL_SCRIPTS@
transform-libtool-scripts: @BUILD_RULES@
@$(SHELL) $(top_srcdir)/build/transform_libtool_scripts.sh
locale-gnu-pot:
cd $(abs_srcdir) && XGETTEXT="$(XGETTEXT)" MSGMERGE="$(MSGMERGE)" \
$(SHELL) tools/po/po-update.sh pot
# "make locale-gnu-po-update" updates all translations.
# "make locale-gnu-po-update PO=ll" updates only the ll.po file.
locale-gnu-po-update:
cd $(abs_srcdir) && XGETTEXT="$(XGETTEXT)" MSGMERGE="$(MSGMERGE)" \
$(SHELL) tools/po/po-update.sh $(PO)
# clean everything but the bulky test output, returning the system back
# to before 'make' was run.
fast-clean: doc-clean
@list='$(BUILD_DIRS)'; for i in $$list; do \
if [ -d $$i ]; then \
(cd $$i && rm -f *.o *.lo *.la *.la-a *.spo *.mo && \
rm -rf .libs); \
fi \
done
echo $(CLEAN_FILES) | xargs rm -f --
find $(CTYPES_PYTHON_SRC_DIR) $(SWIG_PY_SRC_DIR) $(SWIG_PY_DIR) \
$(abs_srcdir)/build $(top_srcdir)/subversion/tests/cmdline/svntest \
-name "*.pyc" -exec rm {} ';'
# clean everything, returning to before './configure' was run.
SVN_CONFIG_SCRIPT_FILES = @SVN_CONFIG_SCRIPT_FILES@
local-distclean: local-clean
rm -fr config.cache config.log config.nice config.status \
libtool mkmf.log subversion/svn_private_config.h \
subversion/bindings/javahl/classes \
subversion/bindings/javahl/include \
$(SVN_CONFIG_SCRIPT_FILES)
rm -f Makefile
# clean everything out, returning to before './autogen.sh' was run.
local-extraclean: extraclean-bindings local-distclean
rm -f $(top_srcdir)/build-outputs.mk \
$(top_srcdir)/subversion/svn_private_config.h.in \
$(top_srcdir)/configure \
$(top_srcdir)/gen-make.opts \
$(top_srcdir)/build/config.guess \
$(top_srcdir)/build/config.sub \
$(top_srcdir)/build/libtool.m4 \
$(top_srcdir)/build/ltoptions.m4 \
$(top_srcdir)/build/ltsugar.m4 \
$(top_srcdir)/build/ltversion.m4 \
$(top_srcdir)/build/lt~obsolete.m4 \
$(top_srcdir)/build/ltmain.sh \
$(top_srcdir)/build/transform_libtool_scripts.sh \
$(EXTRACLEAN_FILES)
# clean everything, including test output.
local-clean: check-clean clean-bindings fast-clean
local-install: @INSTALL_RULES@
revision-install:
test -d $(DESTDIR)$(includedir)/subversion-1 || \
$(MKDIR) $(DESTDIR)$(includedir)/subversion-1
(subversion/svnversion/svnversion $(top_srcdir) 2> /dev/null || \
svnversion $(top_srcdir) 2> /dev/null || \
echo "unknown"; \
) > $(DESTDIR)$(includedir)/subversion-1/svn-revision.txt
install-static: @INSTALL_STATIC_RULES@
# JavaHL target aliases
javahl: mkdir-init javahl-java javahl-javah javahl-callback-javah javahl-types-javah javahl-lib @JAVAHL_TESTS_TARGET@ javahl-compat
install-javahl: javahl install-javahl-java install-javahl-javah install-javahl-lib
javahl-compat: javahl-compat-java @JAVAHL_COMPAT_TESTS_TARGET@
clean-javahl:
rm -rf $(javahl_java_PATH) $(javahl_javah_PATH) @JAVAHL_OBJDIR@
rm -fr $(javahl_test_rootdir)
rm -f $(libsvnjavahl_PATH)/*.la $(JAVAHL_JAR)
rm -f $(libsvnjavahl_PATH)/*.lo
rm -f $(libsvnjavahl_PATH)/*.o
check-tigris-javahl: javahl-compat
@FIX_JAVAHL_LIB@
$(JAVA) "-Dtest.rootdir=$(javahl_test_rootdir)" "-Dtest.srcdir=$(javahl_test_srcdir)" "-Dtest.rooturl=$(BASE_URL)" "-Dtest.fstype=$(FS_TYPE)" -Djava.library.path=@JAVAHL_OBJDIR@:$(libdir) -classpath $(javahl_compat_tests_PATH):$(javahl_tests_CLASSPATH) "-Dtest.tests=$(JAVAHL_TESTS)" org.tigris.subversion.javahl.RunTests
check-apache-javahl: javahl
@FIX_JAVAHL_LIB@
$(JAVA) "-Dtest.rootdir=$(javahl_test_rootdir)" "-Dtest.srcdir=$(javahl_test_srcdir)" "-Dtest.rooturl=$(BASE_URL)" "-Dtest.fstype=$(FS_TYPE)" -Djava.library.path=@JAVAHL_OBJDIR@:$(libdir) -classpath $(javahl_tests_PATH):$(javahl_tests_CLASSPATH) "-Dtest.tests=$(JAVAHL_TESTS)" org.apache.subversion.javahl.RunTests
check-javahl: check-apache-javahl
check-all-javahl: check-apache-javahl check-tigris-javahl
# "make check CLEANUP=true" will clean up directories for successful tests.
# "make check TESTS=subversion/tests/cmdline/basic_tests.py"
# will perform only basic tests (likewise for other tests).
check: bin @TRANSFORM_LIBTOOL_SCRIPTS@ $(TEST_DEPS) @BDB_TEST_DEPS@
@if test "$(PYTHON)" != "none"; then \
flags="--verbose"; \
if test "$(CLEANUP)" != ""; then \
flags="--cleanup $$flags"; \
fi; \
if test "$(BASE_URL)" != ""; then \
flags="--url $(BASE_URL) $$flags"; \
fi; \
if test "$(FS_TYPE)" != ""; then \
flags="--fs-type $(FS_TYPE) $$flags"; \
fi; \
if test "$(HTTP_LIBRARY)" != ""; then \
flags="--http-library $(HTTP_LIBRARY) $$flags"; \
fi; \
if test "$(SERVER_MINOR_VERSION)" != ""; then \
flags="--server-minor-version $(SERVER_MINOR_VERSION) $$flags"; \
fi; \
if test "$(ENABLE_SASL)" != ""; then \
flags="--enable-sasl $$flags"; \
fi; \
if test "$(FSFS_SHARDING)" != ""; then \
flags="--fsfs-sharding $(FSFS_SHARDING) $$flags"; \
fi; \
if test "$(FSFS_PACKING)" != ""; then \
flags="--fsfs-packing $$flags"; \
fi; \
if test "$(PARALLEL)" != ""; then \
flags="--parallel $$flags"; \
fi; \
if test "$(LOG_TO_STDOUT)" != ""; then \
flags="--log-to-stdout $$flags"; \
fi; \
if test "$(MILESTONE_FILTER)" != ""; then \
flags="--list --milestone-filter=$(MILESTONE_FILTER) \
--mode-filter=$(MODE_FILTER) --log-to-stdout $$flags"; \
fi; \
if test "$(SET_LOG_LEVEL)" != ""; then \
flags="--set-log-level $(SET_LOG_LEVEL) $$flags"; \
fi; \
if test "$(SSL_CERT)" != ""; then \
flags="--ssl-cert $(SSL_CERT) $$flags"; \
fi; \
if test "$(HTTP_PROXY)" != ""; then \
flags="--http-proxy $(HTTP_PROXY) $$flags"; \
fi; \
LD_LIBRARY_PATH='$(auth_plugin_dirs):$(LD_LIBRARY_PATH)' \
$(PYTHON) $(top_srcdir)/build/run_tests.py \
--config-file $(top_srcdir)/subversion/tests/tests.conf \
$$flags \
'$(abs_srcdir)' '$(abs_builddir)' $(TESTS); \
else \
echo "make check: Python 2.5 or greater is required,"; \
echo " but was not detected during configure"; \
exit 1; \
fi;
# First, set up Apache as documented in
# subversion/tests/cmdline/README.
davcheck: bin $(TEST_DEPS) @BDB_TEST_DEPS@ apache-mod
@$(MAKE) check BASE_URL=http://localhost
# Automatically configure and run Apache httpd on a random port, and then
# run make check.
davautocheck: bin $(TEST_DEPS) @BDB_TEST_DEPS@ apache-mod
@# Takes MODULE_PATH, USE_HTTPV1 and SVN_PATH_AUTHZ in the environment.
@APXS=$(APXS) $(top_srcdir)/subversion/tests/cmdline/davautocheck.sh
# First, run:
# subversion/svnserve/svnserve -d -r `pwd`/subversion/tests/cmdline
svncheck: bin $(TEST_DEPS) @BDB_TEST_DEPS@
@$(MAKE) check BASE_URL=svn://127.0.0.1
# 'make svnserveautocheck' runs svnserve for you and kills it.
svnserveautocheck: svnserve bin $(TEST_DEPS) @BDB_TEST_DEPS@
@env PYTHON=$(PYTHON) THREADED=$(THREADED) \
$(top_srcdir)/subversion/tests/cmdline/svnserveautocheck.sh
# First, run:
# subversion/svnserve/svnserve --listen-host "::1" -d -r `pwd`/subversion/tests/cmdline
svncheck6: bin $(TEST_DEPS) @BDB_TEST_DEPS@
@$(MAKE) check BASE_URL=svn://\[::1\]
# First make sure you can ssh to localhost and that "svnserve" is in
# the path of the resulting shell.
svnsshcheck: bin $(TEST_DEPS) @BDB_TEST_DEPS@
@$(MAKE) check \
BASE_URL=svn+ssh://localhost`pwd`/subversion/tests/cmdline
bdbcheck: bin $(TEST_DEPS) @BDB_TEST_DEPS@
@$(MAKE) check FS_TYPE=bdb
# Create an execution coverage report from the data collected during
# all execution since the last reset.
gcov:
lcov --capture -d . -b . -o gcov-lcov.dat > gcov-lcov.log
genhtml gcov-lcov.dat -o gcov-report > gcov-genhtml.log
# Reset all execution coverage counters to zero.
gcov-reset:
lcov --zerocounters -d .
# Remove the execution coverage data and the report.
gcov-clean:
rm -f gcov-lcov.dat gcov-lcov.log gcov-genhtml.log
rm -rf gcov-report
find . -name "*.gcda" -o -name "*.gcno" -print0 | xargs -0 rm -f --
check-clean: gcov-clean
if [ -d subversion/tests/cmdline/svn-test-work ]; then \
find subversion/tests/cmdline/svn-test-work -mindepth 1 -maxdepth 1 \
-print0 | xargs -0 rm -rf --; \
fi
rm -rf subversion/tests/libsvn_fs/test-repo-* \
subversion/tests/libsvn_fs_base/test-repo-* \
subversion/tests/libsvn_fs_fs/test-repo-* \
subversion/tests/libsvn_ra_local/test-repo-* \
subversion/tests/libsvn_repos/test-repo-* \
subversion/tests/libsvn_subr/z \
subversion/tests/libsvn_wc/fake-wc \
subversion/tests/libsvn_client/test-patch* \
subversion/tests/libsvn_client/test-*/ \
subversion/tests/libsvn_diff/B2 \
subversion/tests/libsvn_diff/T1 \
subversion/tests/libsvn_diff/T2 \
subversion/tests/libsvn_diff/T3 \
subversion/tests/svnserveautocheck.pid \
tests.log fails.log
mkdir-init:
@list='$(BUILD_DIRS) $(SCHEMA_DIR) doc'; \
for i in $$list; do \
if [ ! -d $$i ]; then \
$(MKDIR) $$i ; \
fi; \
done
# DOCUMENTATION RULES
# Every single document in every format.
doc: doc-api doc-javahl
# Generate API documentation for the C libraries.
### This could also generate POD for swig-perl, etc.
doc-api: mkdir-init
( cd $(top_srcdir) && \
sed "s,\(OUTPUT_DIRECTORY *= *\),\1$(abs_builddir)/," \
doc/doxygen.conf | $(DOXYGEN) - )
# Generate API documentation for the JavaHL package.
doc-javahl:
$(JAVADOC) -d $(abs_builddir)/doc/javadoc \
-sourcepath $(top_srcdir)/subversion/bindings/javahl/src \
-link http://java.sun.com/javase/6/docs/api/ \
org.tigris.subversion.javahl \
org.apache.subversion.javahl \
org.apache.subversion.javahl.callback \
org.apache.subversion.javahl.types
doc-clean:
rm -rf $(top_srcdir)/doc/doxygen
rm -rf $(top_srcdir)/doc/javadoc
# Converting from the .rnc XML shcemas to various other schema formats.
SCHEMAS_DTD = $(SCHEMA_DIR)/blame.dtd $(SCHEMA_DIR)/info.dtd \
$(SCHEMA_DIR)/list.dtd $(SCHEMA_DIR)/log.dtd \
$(SCHEMA_DIR)/status.dtd $(SCHEMA_DIR)/props.dtd
SCHEMAS_RNG = $(SCHEMA_DIR)/blame.rng $(SCHEMA_DIR)/info.rng \
$(SCHEMA_DIR)/list.rng $(SCHEMA_DIR)/log.rng \
$(SCHEMA_DIR)/status.rng $(SCHEMA_DIR)/props.rng
SCHEMAS_XSD = $(SCHEMA_DIR)/blame.xsd $(SCHEMA_DIR)/info.xsd \
$(SCHEMA_DIR)/list.xsd $(SCHEMA_DIR)/log.xsd \
$(SCHEMA_DIR)/status.xsd $(SCHEMA_DIR)/props.xsd
schema: schema-rng schema-dtd schema-xsd
schema-rng: $(SCHEMAS_RNG)
schema-dtd: $(SCHEMAS_DTD)
schema-xsd: $(SCHEMAS_XSD)
$(SCHEMAS_RNG) $(SCHEMAS_DTD) $(SCHEMAS_XSD): $(SCHEMA_DIR)/common.rnc
schema-clean:
(cd $(SCHEMA_DIR) && rm -f *.rng *.dtd *.xsd)
#
# Implicit rules for creating outputs from input files
#
.SUFFIXES:
.SUFFIXES: .c .cpp .lo .o .la-a .la \
.po .spo .mo .rnc .rng .dtd .xsd .sql .h
.sql.h:
$(PYTHON) $(top_srcdir)/build/transform_sql.py $< $(top_srcdir)/$@
.c.o:
$(COMPILE) -o $@ -c $<
.cpp.o:
$(COMPILE_CXX) -o $@ -c $<
.c.lo:
$(LT_COMPILE) -o $@ -c $<
.cpp.lo:
$(LT_COMPILE_CXX) -o $@ -c $<
.la.la-a:
sed "/library_names/s/'.*'/''/" $< > $@
# Strip the Content-Type: header from the po file if we don't have a
# gettext that supports bind_textdomain_codeset, so it doesn't try
# to convert our UTF-8 .po files to the locale encoding.
@NO_GETTEXT_CODESET@.po.spo:
@NO_GETTEXT_CODESET@ sed \
@NO_GETTEXT_CODESET@ '/^"Content-Type: text\/plain; charset=UTF-8\\n"$$/d' \
@NO_GETTEXT_CODESET@ $< > $@
@NO_GETTEXT_CODESET@.spo.mo:
@NO_GETTEXT_CODESET@ $(MSGFMT) $(MSGFMTFLAGS) -o $@ $<
# For systems with bind_textdomain_codeset, just leave the Content-Type:
# header alone.
@GETTEXT_CODESET@.po.mo:
@GETTEXT_CODESET@ $(MSGFMT) $(MSGFMTFLAGS) -o $@ $<
.rnc.rng:
@TRANG@ $< $@
.rnc.dtd:
@TRANG@ $< $@
.rnc.xsd:
@TRANG@ $< $@
install-docs: install-man
manroot = $(mandir)/man
install-man:
@list='$(MANPAGES)'; \
for i in $$list; do \
if test -f $(srcdir)/$$i; then file=$(srcdir)/$$i; \
else file=$$i; fi; \
ext=`echo $$i | sed -e 's/^.*\\.//'`; \
$(MKDIR) $(DESTDIR)$(manroot)$$ext; \
inst=`echo $$i | sed -e 's/\\.[0-9a-z]*$$//'`; \
inst=`echo $$inst | sed -e 's/^.*\///'`; \
inst=`echo $$inst`.$$ext; \
echo "$(INSTALL_DATA) $$file $(DESTDIR)$(manroot)$$ext/$$inst"; \
$(INSTALL_DATA) $$file $(DESTDIR)$(manroot)$$ext/$$inst; \
done
install-swig-py: install-swig-py-lib
install-swig-rb: install-swig-rb-lib
clean-bindings: clean-swig clean-ctypes-python clean-javahl
extraclean-bindings: clean-swig extraclean-swig-headers \
extraclean-swig-py extraclean-swig-rb \
extraclean-swig-pl \
clean-ctypes-python clean-javahl \
clean-swig: clean-swig-headers clean-swig-py clean-swig-rb clean-swig-pl
@rm -f .swig_checked
EXTRACLEAN_SWIG_HEADERS=rm -f $(SWIG_SRC_DIR)/proxy/*.swg
clean-swig-headers:
if test -z "$(RELEASE_MODE)"; then \
$(EXTRACLEAN_SWIG_HEADERS); \
fi
extraclean-swig-headers: clean-swig-headers
$(EXTRACLEAN_SWIG_HEADERS)
$(SWIG_PL_DIR)/native/Makefile.PL: $(SWIG_SRC_DIR)/perl/native/Makefile.PL.in
./config.status subversion/bindings/swig/perl/native/Makefile.PL
$(SWIG_PL_DIR)/native/Makefile: $(SWIG_PL_DIR)/native/Makefile.PL
cd $(SWIG_PL_DIR)/native; $(PERL) Makefile.PL
# There is a "readlink -f" command on some systems for the same purpose,
# but it's not as portable (e.g. Mac OS X doesn't have it). These should
# only be used where Python/Perl are known to be available.
READLINK_PY=$(PYTHON) -c 'import sys,os; print(os.path.realpath(sys.argv[1]))'
READLINK_PL=$(PERL) -e 'use Cwd; print Cwd::realpath(shift)'
swig-pl_DEPS = autogen-swig-pl libsvn_swig_perl \
$(SWIG_PL_DIR)/native/Makefile
swig-pl: $(swig-pl_DEPS)
if test "`$(READLINK_PL) $(SWIG_PL_DIR)`" != "`$(READLINK_PL) $(SWIG_PL_SRC_DIR)`"; then \
ln -sf $(SWIG_PL_SRC_DIR)/native/*.c $(SWIG_PL_DIR)/native; \
fi
cd $(SWIG_PL_DIR)/native; $(MAKE) OPTIMIZE="" OTHERLDFLAGS="$(SWIG_LDFLAGS)"
check-swig-pl: swig-pl swig-pl-lib
cd $(SWIG_PL_DIR)/native; $(MAKE) test
install-swig-pl: swig-pl install-swig-pl-lib
cd $(SWIG_PL_DIR)/native; $(MAKE) install
EXTRACLEAN_SWIG_PL=rm -f $(SWIG_PL_SRC_DIR)/native/svn_*.c \
$(SWIG_PL_SRC_DIR)/native/core.c
# Running Makefile.PL at this point *fails* (cannot find ..../.libs) so if the
# Makefile does not exist, DO NOT try to make it. But, if it doesn't exist,
# then the directory is probably clean anyway.
clean-swig-pl:
if test -z "$(RELEASE_MODE)"; then \
$(EXTRACLEAN_SWIG_PL); \
fi
for d in $(SWIG_PL_DIR)/libsvn_swig_perl; \
do \
cd $$d; \
rm -rf *.lo *.la *.o .libs; \
done
if [ -f "$(SWIG_PL_DIR)/native/Makefile" ]; then \
cd $(SWIG_PL_DIR)/native; $(MAKE) clean; \
fi
extraclean-swig-pl: clean-swig-pl
$(EXTRACLEAN_SWIG_PL)
$(SWIG_PY_DIR)/libsvn:
mkdir $(SWIG_PY_DIR)/libsvn
copy-swig-py: autogen-swig-py $(SWIG_PY_DIR)/libsvn
@for f in $(SWIG_PY_SRC_DIR)/*.py $(SWIG_PY_DIR)/*.py; do \
! [ -f "$$f" ] || cp -pf $$f $(SWIG_PY_DIR)/libsvn; \
done
@touch $(SWIG_PY_DIR)/libsvn/__init__.py
swig-py: autogen-swig-py copy-swig-py
check-swig-py: swig-py
$(TEST_SHLIB_VAR_SWIG_PY) \
cd $(SWIG_PY_DIR); \
$(PYTHON) $(SWIG_PY_SRC_DIR)/tests/run_all.py
EXTRACLEAN_SWIG_PY=rm -rf $(SWIG_PY_SRC_DIR)/svn_*.c $(SWIG_PY_SRC_DIR)/core.c \
$(SWIG_PY_SRC_DIR)/[a-z]*.py
clean-swig-py:
rm -rf $(SWIG_PY_DIR)/libsvn
if test -z "$(RELEASE_MODE)"; then \
$(EXTRACLEAN_SWIG_PY); \
fi
for d in $(SWIG_PY_DIR) $(SWIG_PY_DIR)/libsvn_swig_py; \
do \
cd $$d && rm -rf *.lo *.la *.o *.pyc .libs; \
done
find $(SWIG_PY_SRC_DIR) $(SWIG_PY_DIR) -name "*.pyc" -exec rm {} ';'
extraclean-swig-py: clean-swig-py
$(EXTRACLEAN_SWIG_PY)
swig-rb: autogen-swig-rb
check-swig-rb: swig-rb svnserve
$(TEST_SHLIB_VAR_SWIG_RB) \
cd $(SWIG_RB_DIR); \
if [ "$(RUBY_MAJOR)" -eq 1 -a "$(RUBY_MINOR)" -lt 9 ] ; then \
$(RUBY) -I $(SWIG_RB_SRC_DIR) \
$(SWIG_RB_SRC_DIR)/test/run-test.rb \
--verbose=$(SWIG_RB_TEST_VERBOSE); \
else \
$(RUBY) -I $(SWIG_RB_SRC_DIR) \
$(SWIG_RB_SRC_DIR)/test/run-test.rb; \
fi
EXTRACLEAN_SWIG_RB=rm -f $(SWIG_RB_SRC_DIR)/svn_*.c $(SWIG_RB_SRC_DIR)/core.c
clean-swig-rb:
rm -rf $(SWIG_RB_DIR)/test/repos $(SWIG_RB_DIR)/test/wc
if test -z "$(RELEASE_MODE)"; then \
$(EXTRACLEAN_SWIG_RB); \
fi
for d in $(SWIG_RB_DIR) $(SWIG_RB_DIR)/libsvn_swig_ruby; \
do \
cd $$d; \
rm -rf *.lo *.la *.o .libs; \
done
extraclean-swig-rb: clean-swig-rb
$(EXTRACLEAN_SWIG_RB)
install-swig-rb-doc:
$(RDOC) --all --ri --op "$(SWIG_RB_RI_DATADIR)" "$(SWIG_RB_SRC_DIR)/svn"
# ctypes-python make targets
ctypes-python: local-all
$(SHELL) $(abs_srcdir)/build/run_ctypesgen.sh "$(LT_EXECUTE)" "$(CPPFLAGS)" "$(EXTRA_CTYPES_LDFLAGS)" "$(PYTHON)" "$(CTYPESGEN)" "$(abs_srcdir)" "$(abs_builddir)" "$(libdir)" "$(SVN_APR_CONFIG)" "$(SVN_APRUTIL_CONFIG)"
install-ctypes-python: ctypes-python
cd $(CTYPES_PYTHON_SRC_DIR); \
$(PYTHON) setup.py install --prefix="$(DESTDIR)$(prefix)"
check-ctypes-python: ctypes-python
cd $(CTYPES_PYTHON_SRC_DIR); \
$(LT_EXECUTE) $(PYTHON) test/run_all.py
# If any of those files exists, run ctypes' 'setup.py clean'. We don't run
# it otherwise because it spams stdout+stderr; see r1479326.
clean-ctypes-python:
cd $(CTYPES_PYTHON_SRC_DIR); \
for b in build csvn/core/functions.py svn_all.py svn_all2.py ; do \
if [ -e "$$b" ] ; then \
$(PYTHON) setup.py clean --all; \
break; \
fi; \
done
# manually describe a dependency, which we won't otherwise detect
subversion/libsvn_wc/wc-queries.h: $(abs_srcdir)/subversion/libsvn_wc/wc-metadata.sql
subversion/libsvn_wc/wc-queries.h: $(abs_srcdir)/subversion/libsvn_wc/wc-checks.sql
# Compatibility symlink.
# This runs after the target of the same name in build-outputs.mk.
INSTALL_EXTRA_TOOLS=\
$(MKDIR) $(DESTDIR)$(bindir); \
test -n "$$SVN_SVNMUCC_IS_SVNSYITF" && \
ln -sf svnmucc$(EXEEXT) $(DESTDIR)$(bindir)/svnsyitf$(EXEEXT); \
if test "$(DESTDIR)$(bindir)" != "$(DESTDIR)$(toolsdir)"; then \
ln -sf $(DESTDIR)$(bindir)/svnmucc$(EXEEXT) $(DESTDIR)$(toolsdir)/svnmucc$(EXEEXT); \
fi

23
NOTICE Normal file
View File

@ -0,0 +1,23 @@
Subversion
Copyright 2010 The Apache Software Foundation
This product includes software developed by many people, and distributed
under Contributor License Agreements to The Apache Software Foundation
(http://www.apache.org/). See the accompanying COMMITTERS file and the
revision logs for an exact contribution history.
Portions of the test suite for Subversion's Python bindings are copyrighted
by Edgewall Software, Jonas Borgström and Christopher Lenz.
For more information, see LICENSE.
This product includes software developed under the X Consortium License
see: build/install-sh
This product includes software developed by Markus Kuhn under a permissive
license, see LICENSE.
This software contains code derived from the RSA Data Security
Inc. MD5 Message-Digest Algorithm, including various
modifications by Spyglass Inc., Carnegie Mellon University, and
Bell Communications Research, Inc (Bellcore).

84
README Normal file
View File

@ -0,0 +1,84 @@
Subversion, a version control system.
=====================================
$LastChangedDate: 2012-02-10 14:58:53 +0000 (Fri, 10 Feb 2012) $
Contents:
I. A FEW POINTERS
II. DOCUMENTATION
III. PARTICIPATING IN THE SUBVERSION COMMUNITY
IV. QUICKSTART GUIDE
V. CONVERTING FROM CVS
I. A FEW POINTERS
For an overview of the Subversion project, visit
http://subversion.apache.org/
Once you have a Subversion client you can get the latest version
of the code with the command:
$ svn co http://svn.apache.org/repos/asf/subversion/trunk subversion
II. DOCUMENTATION
The main documentation is the Subversion Book - an on-line version
can be found at:
http://svnbook.red-bean.com/
It is written in DocBook XML, and the sources can be found at:
http://svnbook.googlecode.com/svn/trunk/
If you wish to build the documentation from source, read the
src/en/README file within the book source.
III. PARTICIPATING IN THE SUBVERSION COMMUNITY
First, read http://subversion.apache.org/docs/community-guide/
It describes Subversion coding and log message standards, as well
as how to join discussion lists.
Talk on IRC with developers: irc.freenode.net, channel #svn-dev.
Read the FAQ: http://subversion.apache.org/faq.html
IV. QUICKSTART GUIDE
See the final section of the first chapter of the Subversion Book.
V. CONVERTING FROM CVS
If you're a CVS user trying to move your CVS history over to
Subversion, then be sure to visit the 'cvs2svn' project:
http://cvs2svn.tigris.org
You can get the latest released version of the cvs2svn converter
from the project downloads area:
http://cvs2svn.tigris.org/servlets/ProjectDocumentList?folderID=2976
Please note that the cvs2svn project is a *separate* project from
Subversion. If you have problems with cvs2svn or are confused,
please email the cvs2svn project's mailing lists, not the
Subversion lists.
Finally, be sure to see Appendix B in the Subversion Book. It
contains a very quick overview of the major differences between
CVS and Subversion.

55
aclocal.m4 vendored Normal file
View File

@ -0,0 +1,55 @@
#
#
# Licensed to the Apache Software Foundation (ASF) under one
# or more contributor license agreements. See the NOTICE file
# distributed with this work for additional information
# regarding copyright ownership. The ASF licenses this file
# to you under the Apache License, Version 2.0 (the
# "License"); you may not use this file except in compliance
# with the License. You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing,
# software distributed under the License is distributed on an
# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
# KIND, either express or implied. See the License for the
# specific language governing permissions and limitations
# under the License.
#
#
# aclocal.m4: Supplementary macros used by Subversion's configure.ac
#
# These are here rather than directly in configure.ac, since this prevents
# comments in the macro files being copied into configure.ac, producing
# useless bloat. (This is significant - a 12kB reduction in size!)
# Include macros distributed by the APR project
sinclude(build/ac-macros/find_apr.m4)
sinclude(build/ac-macros/find_apu.m4)
# Include Subversion's own custom macros
sinclude(build/ac-macros/svn-macros.m4)
sinclude(build/ac-macros/apache.m4)
sinclude(build/ac-macros/apr.m4)
sinclude(build/ac-macros/aprutil.m4)
sinclude(build/ac-macros/apr_memcache.m4)
sinclude(build/ac-macros/berkeley-db.m4)
sinclude(build/ac-macros/compiler.m4)
sinclude(build/ac-macros/ctypesgen.m4)
sinclude(build/ac-macros/java.m4)
sinclude(build/ac-macros/sasl.m4)
sinclude(build/ac-macros/serf.m4)
sinclude(build/ac-macros/sqlite.m4)
sinclude(build/ac-macros/swig.m4)
sinclude(build/ac-macros/zlib.m4)
sinclude(build/ac-macros/kwallet.m4)
sinclude(build/ac-macros/macosx.m4)
# Include the libtool macros
sinclude(build/libtool.m4)
sinclude(build/ltoptions.m4)
sinclude(build/ltsugar.m4)
sinclude(build/ltversion.m4)
sinclude(build/lt~obsolete.m4)

210
autogen.sh Executable file
View File

@ -0,0 +1,210 @@
#!/bin/sh
#
#
# Licensed to the Apache Software Foundation (ASF) under one
# or more contributor license agreements. See the NOTICE file
# distributed with this work for additional information
# regarding copyright ownership. The ASF licenses this file
# to you under the Apache License, Version 2.0 (the
# "License"); you may not use this file except in compliance
# with the License. You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing,
# software distributed under the License is distributed on an
# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
# KIND, either express or implied. See the License for the
# specific language governing permissions and limitations
# under the License.
#
#
### Run this to produce everything needed for configuration. ###
# Run tests to ensure that our build requirements are met
RELEASE_MODE=""
RELEASE_ARGS=""
SKIP_DEPS=""
while test $# != 0; do
case "$1" in
--release)
RELEASE_MODE="$1"
RELEASE_ARGS="--release"
shift
;;
-s)
SKIP_DEPS="yes"
shift
;;
--) # end of option parsing
break
;;
*)
echo "invalid parameter: '$1'"
exit 1
;;
esac
done
# ### The order of parameters is important; buildcheck.sh depends on it and
# ### we don't want to copy the fancy option parsing loop there. For the
# ### same reason, all parameters should be quoted, so that buildcheck.sh
# ### sees an empty arg rather than missing one.
./build/buildcheck.sh "$RELEASE_MODE" || exit 1
# Handle some libtool helper files
#
# ### eventually, we can/should toss this in favor of simply using
# ### APR's libtool. deferring to a second round of change...
#
libtoolize="`./build/PrintPath glibtoolize libtoolize libtoolize15`"
lt_major_version=`$libtoolize --version 2>/dev/null | sed -e 's/^[^0-9]*//' -e 's/\..*//' -e '/^$/d' -e 1q`
if [ "x$libtoolize" = "x" ]; then
echo "libtoolize not found in path"
exit 1
fi
rm -f build/config.guess build/config.sub
$libtoolize --copy --automake --force
ltpath="`dirname $libtoolize`"
ltfile=${LIBTOOL_M4-`cd $ltpath/../share/aclocal ; pwd`/libtool.m4}
if [ ! -f $ltfile ]; then
echo "$ltfile not found (try setting the LIBTOOL_M4 environment variable)"
exit 1
fi
echo "Copying libtool helper: $ltfile"
# An ancient helper might already be present from previous builds,
# and it might be write-protected (e.g. mode 444, seen on FreeBSD).
# This would cause cp to fail and print an error message, but leave
# behind a potentially outdated libtool helper. So, remove before
# copying:
rm -f build/libtool.m4
cp $ltfile build/libtool.m4
for file in ltoptions.m4 ltsugar.m4 ltversion.m4 lt~obsolete.m4; do
rm -f build/$file
if [ $lt_major_version -ge 2 ]; then
ltfile=${LIBTOOL_M4-`cd $ltpath/../share/aclocal ; pwd`/$file}
if [ ! -f $ltfile ]; then
echo "$ltfile not found (try setting the LIBTOOL_M4 environment variable)"
exit 1
fi
echo "Copying libtool helper: $ltfile"
cp $ltfile build/$file
fi
done
if [ $lt_major_version -ge 2 ]; then
for file in config.guess config.sub; do
configfile=${LIBTOOL_CONFIG-`cd $ltpath/../share/libtool/config ; pwd`/$file}
if [ ! -f $configfile ]; then
echo "$configfile not found (try setting the LIBTOOL_CONFIG environment variable)"
exit 1
fi
cp $configfile build/$file
done
fi
# Create the file detailing all of the build outputs for SVN.
#
# Note: this dependency on Python is fine: only SVN developers use autogen.sh
# and we can state that dev people need Python on their machine. Note
# that running gen-make.py requires Python 2.5 or newer.
PYTHON="`./build/find_python.sh`"
if test -z "$PYTHON"; then
echo "Python 2.5 or later is required to run autogen.sh"
echo "If you have a suitable Python installed, but not on the"
echo "PATH, set the environment variable PYTHON to the full path"
echo "to the Python executable, and re-run autogen.sh"
exit 1
fi
# Compile SWIG headers into standalone C files if we are in release mode
if test -n "$RELEASE_MODE"; then
echo "Generating SWIG code..."
# Generate build-outputs.mk in non-release-mode, so that we can
# build the SWIG-related files
"$PYTHON" ./gen-make.py build.conf || gen_failed=1
# Build the SWIG-related files
make -f autogen-standalone.mk autogen-swig
# Remove the .swig_checked file
rm -f .swig_checked
fi
if test -n "$SKIP_DEPS"; then
echo "Creating build-outputs.mk (no dependencies)..."
"$PYTHON" ./gen-make.py $RELEASE_ARGS -s build.conf || gen_failed=1
else
echo "Creating build-outputs.mk..."
"$PYTHON" ./gen-make.py $RELEASE_ARGS build.conf || gen_failed=1
fi
if test -n "$RELEASE_MODE"; then
find build/ -name '*.pyc' -exec rm {} \;
fi
rm autogen-standalone.mk
if test -n "$gen_failed"; then
echo "ERROR: gen-make.py failed"
exit 1
fi
# Produce config.h.in
echo "Creating svn_private_config.h.in..."
${AUTOHEADER:-autoheader}
# If there's a config.cache file, we may need to delete it.
# If we have an existing configure script, save a copy for comparison.
if [ -f config.cache ] && [ -f configure ]; then
cp configure configure.$$.tmp
fi
# Produce ./configure
echo "Creating configure..."
${AUTOCONF:-autoconf}
# If we have a config.cache file, toss it if the configure script has
# changed, or if we just built it for the first time.
if [ -f config.cache ]; then
(
[ -f configure.$$.tmp ] && cmp configure configure.$$.tmp > /dev/null 2>&1
) || (
echo "Tossing config.cache, since configure has changed."
rm config.cache
)
rm -f configure.$$.tmp
fi
# Remove autoconf 2.5x's cache directory
rm -rf autom4te*.cache
echo ""
echo "You can run ./configure now."
echo ""
echo "Running autogen.sh implies you are a maintainer. You may prefer"
echo "to run configure in one of the following ways:"
echo ""
echo "./configure --enable-maintainer-mode"
echo "./configure --disable-shared"
echo "./configure --enable-maintainer-mode --disable-shared"
echo "./configure --disable-optimize --enable-debug"
echo "./configure CUSERFLAGS='--flags-for-C' CXXUSERFLAGS='--flags-for-C++'"
echo ""
echo "Note: If you wish to run a Subversion HTTP server, you will need"
echo "Apache 2.x. See the INSTALL file for details."
echo ""

2894
build-outputs.mk Normal file

File diff suppressed because one or more lines are too long

1377
build.conf Normal file

File diff suppressed because it is too large Load Diff

27324
configure vendored Executable file

File diff suppressed because it is too large Load Diff

1521
configure.ac Normal file

File diff suppressed because it is too large Load Diff

28
doc/README Normal file
View File

@ -0,0 +1,28 @@
Documentation for Subversion
============================
A rough guide:
http://svnbook.red-bean.com/
"Version Control with Subversion"
(a.k.a. "The Subversion Book", "The Svnbook",
and formerly entitled
"Subversion: The Definitive Guide".)
This is the book that has been published by
O'Reilly & Associates. For both newbies and
experts alike. Written in DocBook Lite,
and now maintained in a separate repository
of its own.
programmer/ Documents for Subversion programmers.
programmer/WritingChangeLogs.txt
A longer version of the info in
www/hacking.html.
user/ Documents for Subversion users.
user/lj_article.txt An introductory article from Linux Journal.
user/*.html Some documentation that should probably be
migrated to DocBook Lite and misc-docs/.

1522
doc/doxygen.conf Normal file

File diff suppressed because it is too large Load Diff

View File

@ -0,0 +1,220 @@
This is an essay by Jim Blandy <jimb@redhat.com> on maintaining
ChangeLog entries.
Although Subversion generates its ChangeLogs from svn log data,
instead of keeping independent ChangeLog files, most of the advice
below is as applicable to cvs log messages as to ChangeLog entries.
Maintaining the ChangeLog
=========================
A project's ChangeLog provides a history of development. Comments in
the code should explain the code's present state, but ChangeLog
entries should explain how and when it got that way. The ChangeLog
must show:
* the relative order in which changes entered the code, so you can
see the context in which a change was made, and
* the date at which the change entered the code, so you can relate the
change to outside events, like branch cuts, code freezes, and
releases.
In the case of CVS, these refer to when the change was committed,
because that is the context in which other developers will see the
change.
Every change to the sources should have a ChangeLog entry. The value
of the ChangeLog becomes much less if developers cannot rely on its
completeness. Even if you've only changed comments, write an entry
that says, "Doc fix." The only changes you needn't log are small
changes that have no effect on the source, like formatting tweaks.
In order to keep the ChangeLog a manageable size, at the beginning of
each year, the ChangeLog should be renamed to "ChangeLog-YYYY", and a
fresh ChangeLog file started.
How to write ChangeLog entries
------------------------------
ChangeLog entries should be full sentences, not sentence fragments.
Fragments are more often ambiguous, and it takes only a few more
seconds to write out what you mean. Fragments like `New file' or `New
function' are acceptable, because they are standard idioms, and all
further details should appear in the source code.
The log entry should mention every file changed. It should also
mention by name every function, variable, macro, makefile target,
grammar rule, etc. you changed. However, there are common-sense
exceptions:
* If you have made a change which requires trivial changes throughout
the rest of the program (e.g., renaming a variable), you needn't
name all the functions affected.
* If you have rewritten a file completely, the reader understands that
everything in it has changed, so your log entry may simply give the
file name, and say "Rewritten".
In general, there is a tension between making entries easy to find by
searching for identifiers, and wasting time or producing unreadable
entries by being exhaustive. Use your best judgement --- and be
considerate of your fellow developers.
Group ChangeLog entries into "paragraphs", separated by blank lines.
Each paragraph should be a set of changes that accomplish a single
goal. Independent changes should be in separate paragraphs. For
example:
1999-03-24 Stan Shebs <shebs@andros.cygnus.com>
* configure.host (mips-dec-mach3*): Use mipsm3, not mach3.
Attempt to sort out SCO-related configs.
* configure.host (i[3456]86-*-sysv4.2*): Use this instead of
i[3456]86-*-sysv4.2MP and i[3456]86-*-sysv4.2uw2*.
(i[3456]86-*-sysv5*): Recognize this.
* configure.tgt (i[3456]86-*-sco3.2v5*, i[3456]86-*-sco3.2v4*):
Recognize these.
Even though this entry describes two changes to `configure.host',
they're in separate paragraphs, because they're unrelated changes.
The second change to `configure.host' is grouped with another change
to `configure.tgt', because they both serve the same purpose.
Also note that the author has kindly recorded his overall motivation
for the paragraph, so we don't have to glean it from the individual
changes.
The header line for the ChangeLog entry should have the format shown
above. If you are using an old version of Emacs (before 20.1) that
generates entries with more verbose dates, consider using
`etc/add-log.el', from the GDB source tree. If you are using vi,
consider using the macro in `etc/add-log.vi'. Both of these generate
entries in the newer, terser format.
One should never need the ChangeLog to understand the current code.
If you find yourself writing a significant explanation in the
ChangeLog, you should consider carefully whether your text doesn't
actually belong in a comment, alongside the code it explains. Here's
an example of doing it right:
1999-02-23 Tom Tromey <tromey@cygnus.com>
* cplus-dem.c (consume_count): If `count' is unreasonable,
return 0 and don't advance input pointer.
And then, in `consume_count' in `cplus-dem.c':
while (isdigit ((unsigned char)**type))
{
count *= 10;
count += **type - '0';
/* A sanity check. Otherwise a symbol like
`_Utf390_1__1_9223372036854775807__9223372036854775'
can cause this function to return a negative value.
In this case we just consume until the end of the string. */
if (count > strlen (*type))
{
*type = save;
return 0;
}
This is why a new function, for example, needs only a log entry saying
"New Function" --- all the details should be in the source.
Avoid the temptation to abbreviate filenames or function names, as in
this example (mostly real, but slightly exaggerated):
* gdbarch.[ch] (gdbarch_tdep, gdbarch_bfd_arch_info,
gdbarch_byte_order, {set,}gdbarch_long_bit,
{set,}gdbarch_long_long_bit, {set,}gdbarch_ptr_bit): Corresponding
functions.
This makes it difficult for others to search the ChangeLog for changes
to the file or function they are interested in. For example, if you
searched for `set_gdbarch_long_bit', you would not find the above
entry, because the writer used CSH-style globbing to abbreviate the
list of functions. If you gave up, and made a second pass looking for
gdbarch.c, you wouldn't find that either. Consider your poor readers,
and write out the names.
ChangeLogs and the CVS log
--------------------------
CVS maintains its own logs, which you can access using the `cvs log'
command. This duplicates the information present in the ChangeLog,
but binds each entry to a specific revision, which can be helpful at
times.
However, the CVS log is no substitute for the ChangeLog files.
* CVS provides no easy way to see the changes made to a set of files
in chronological order. They're sorted first by filename, not by date.
* Unless you put full ChangeLog paragraphs in your CVS log entries, it's
difficult to pull together changes that cross several files.
* CVS doesn't segregate log entries for branches from those for the
trunk in any useful way.
In some circumstances, though, the CVS log is more useful than the
ChangeLog, so we maintain both. When you commit a change, you should
provide appropriate text in both the ChangeLog and the CVS log.
It is not necessary to provide CVS log entries for ChangeLog changes,
since it would simply duplicate the contents of the file itself.
Writing ChangeLog entries for merges
------------------------------------
Revision management software like CVS can introduce some confusion
when writing ChangeLog entries. For example, one might write a change
on a branch, and then merge it into the trunk months later. In that
case, what position and date should the developer use for the
ChangeLog entry --- that of the original change, or the date of the
merge?
The principles described at the top need to hold for both the original
change and the merged change. That is:
* On the branch (or trunk) where the change is first committed, the
ChangeLog entry should be written as normal, inserted at the top of
the ChangeLog and reflecting the date the change was committed to
the branch (or trunk).
* When the change is then merged (to the trunk, or to another branch),
the ChangeLog entry should have the following form:
1999-03-26 Jim Blandy <jimb@zwingli.cygnus.com>
Merged change from foobar_20010401_branch:
1999-03-16 Keith Seitz <keiths@cygnus.com>
[...]
In this case, "Jim Blandy" is doing the merge on March 26; "Keith
Seitz" is the original author of the change, who committed it to
`foobar_20010401_branch' on March 16.
As shown here, the entry for the merge should be like any other
change --- inserted at the top of the ChangeLog, and stamped with
the date the merge was committed. It should indicate the origin of
the change, and provide the full text of the original entry,
indented to avoid being confused with a true log entry. Remember
that people looking for the merge will search for the original
changelog text, so it's important to preserve it unchanged.
For the merge entry, we use the merge date, and not the original
date, because this is when the change appears on the trunk or branch
this ChangeLog documents. Its impact on these sources is
independent of when or where it originated.
This approach preserves the structure of the ChangeLog (entries appear
in order, and dates reflect when they appeared), but also provides
full information about changes' origins.

View File

@ -0,0 +1,906 @@
<!--
Licensed to the Apache Software Foundation (ASF) under one
or more contributor license agreements. See the NOTICE file
distributed with this work for additional information
regarding copyright ownership. The ASF licenses this file
to you under the Apache License, Version 2.0 (the
"License"); you may not use this file except in compliance
with the License. You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing,
software distributed under the License is distributed on an
"AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
KIND, either express or implied. See the License for the
specific language governing permissions and limitations
under the License.
-->
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01//EN"
"http://www.w3.org/TR/html4/strict.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html;charset=utf-8">
<title>CVS to SVN Crossover Guide</title>
<style type="text/css">
body {
font-family: sans-serif;
}
h1 {
text-align: center;
}
h2 {
background: #b0c0f0;
margin: 0;
}
.h2 {
border-left: 4px #b0c0f0 solid;
margin-bottom: 2em;
}
hr {
height: 1px;
width: 80%;
}
p, h3, dl {
padding-left: 1em;
}
dd {
margin-left: 2em;
}
.sidebyside {
padding: 0 2em;
width: 100%;
font-size: 80%;
}
.sidebyside th, .sidebyside td {
width: 50%;
border-width: 0 1px 2px 0;
border-style: solid;
border-color: black;
background: #b0c0f0;
vertical-align: top;
}
.sidebyside th {
text-align: center;
background: #90a0d0;
}
.bookref {
font-size: 80%;
}
</style>
</head>
<body>
<h1>CVS to SVN Crossover Guide</h1>
<!-- ==================================================================== -->
<div class="h2">
<h2>Purpose</h2>
<p>This document provides an alternate method of learning Subversion.
Many users dislike learning new technology via a theoretical "top
down" approach, as provided by the <a
href="http://svnbook.red-bean.com">Subversion Book</a>. Instead,
this document presents Subversion from the "bottom up": it shows a
CVS command or task, and then shows the equivalent task in
Subversion (along with relevant book links.) It's essentially a
re-indexing of topics covered by the book, keyed on CVS tasks.</p>
</div>
<!-- ==================================================================== -->
<div class="h2">
<h2>Table of Contents</h2>
<h3>Setup</h3>
<ul>
<li><a href="#repos_creation">Repository creation</a></li>
<li><a href="#import">Importing data</a></li>
<li><a href="#installing">Installing a server</a></li>
<li><a href="#authenticating">Authenticating to a server</a></li>
<li><a href="#browsing">Browsing a repository</a></li>
<li><a href="#checkingout">Checking out a working copy</a></li>
</ul>
<h3>Basic Work Cycle</h3>
<ul>
<li><a href="#changeditems">Seeing locally changed items</a></li>
<li><a href="#outofdate">Seeing out-of-date items</a></li>
<li><a href="#scheduling">Scheduling additions or deletions</a></li>
<li><a href="#copying">Copying and moving</a></li>
<li>Undoing local changes</li>
<li>Updating and committing</li>
<li>Resolving conflicts</li>
<li>Adding a binary file</li>
<li>Using native line-endings</li>
</ul>
<h3>Examining history</h3>
<ul>
<li>Seeing history of an item</li>
<li>Comparing two versions of an item</li>
</ul>
<h3>Branching/Tagging/Merging</h3>
<ul>
<li>Creating a branch</li>
<li>Moving a working copy to a branch</li>
<li>Finding the beginning of a branch</li>
<li>Porting a single change</li>
<li>Merging a whole branch</li>
<li>Reverting a committed change</li>
<li>Resurrecting deleted items</li>
<li>Creating a tag</li>
<li>Tweaking a tag</li>
<li>Seeing all tags</li>
<li>Comparing two tags</li>
<li>Seeing logs between two tags</li>
</ul>
<h3>Other tasks</h3>
<ul>
<li>Using modules</li>
<li>Line endings and keywords</li>
</ul>
</div>
<!-- ==================================================================== -->
<div class="h2">
<h2 id="repos_creation">Repository creation</h2>
<p>Create a new repository for holding versioned data.</p>
<table class="sidebyside">
<tr>
<th>CVS</th>
<th>Subversion</th>
</tr>
<tr>
<td>
<dl>
<dt>Commands:</dt>
<dd><tt>$&nbsp;cvs&nbsp;-d&nbsp;/usr/local/repos&nbsp;init</tt></dd>
<dt>Explanation:</dt>
<dd>Creates a new directory <tt>repos</tt> ready to hold RCS
files and config scripts.</dd>
</dl>
</td>
<td>
<dl>
<dt>Commands:</dt>
<dd><tt>$&nbsp;svnadmin&nbsp;create&nbsp;/usr/local/repos</tt></dd>
<dt>Explanation:</dt>
<dd>Creates a new directory <tt>repos</tt> containing BerkeleyDB
files and config scripts.</dd>
</dl>
</td>
</tr>
</table>
<dl class="bookref">
<dt>Book References:</dt>
<dd><a href="http://svnbook.red-bean.com/svnbook/ch05s02.html">Repository Creation and Configuration</a></dd>
</dl>
</div>
<!-- ==================================================================== -->
<div class="h2">
<h2 id="import">Importing data</h2>
<p>Populate a new repository with initial data. Assuming that you
have a tree of code in the local directory <tt>myproj/</tt>, and
you want to move this tree into the repository.</p>
<table class="sidebyside">
<tr>
<th>CVS</th>
<th>Subversion</th>
</tr>
<tr>
<td>
<dl>
<dt>Commands:</dt>
<dd><tt>$&nbsp;cd&nbsp;myproj</tt></dd>
<dd><tt>$&nbsp;cvs&nbsp;-d&nbsp;/usr/local/repos&nbsp;import&nbsp;myproj/&nbsp;none&nbsp;start</tt></dd>
<dt>Explanation:</dt>
<dd>This copies the contents of the current working directory to
a new directory (<tt>myproj</tt>) in the CVS repository. The
CVS repository now contains a directory <tt>/myproj/</tt> at the
top level.</dd>
</dl>
</td>
<td>
<dl>
<dt>Commands:</dt>
<dd><tt>$&nbsp;svn&nbsp;mkdir&nbsp;file:///usr/local/repos/tags</tt></dd>
<dd><tt>$&nbsp;svn&nbsp;mkdir&nbsp;file:///usr/local/repos/branches</tt></dd>
<dd><tt>$&nbsp;svn&nbsp;import&nbsp;myproj/&nbsp;file:///usr/local/repos/trunk</tt></dd>
<dt>Explanation:</dt>
<dd>Though not strictly required, we deliberately create
<tt>/tags</tt> and <tt>/branches</tt> top-level directories in
the repository, to hold tags and branches later on. Then we
import the contents of the local <tt>myproj/</tt> directory into
a newly created <tt>/trunk</tt> directory in the
repository.</dd>
</dl>
</td>
</tr>
</table>
<dl class="bookref">
<dt>Book References:</dt>
<dd><a href="http://svnbook.red-bean.com/svnbook/ch05s04.html#svn-ch-5-sect-6.1">Choosing a repository layout</a></dd>
<dd><a href="http://svnbook.red-bean.com/svnbook/re12.html">svn import</a></dd>
</dl>
</div>
<!-- ==================================================================== -->
<div class="h2">
<h2 id="installing">Installing a server</h2>
<p>Make the repository available to clients via a network.</p>
<table class="sidebyside">
<tr>
<th>CVS</th>
<th>Subversion</th>
</tr>
<tr>
<td>
<dl>
<dt>Commands:</dt>
<dd>(too complex to demonstrate here)</dd>
<dt>Explanation:</dt>
<dd>Export the repository via the cvs <em>pserver</em> program.
It can be launched by either <strong>inetd</strong> or a
client's <strong>ssh</strong> remote request.</dd>
</dl>
</td>
<td>
<dl>
<dt>Commands:</dt>
<dd>(too complex to demonstrate here)</dd>
<dt>Explanation:</dt>
<dd>Export the repository with the <em>Apache 2.0.x</em> server,
or via the <em>svnserve</em> program. The latter can run as a
standalone daemon, can be launched by <strong>inetd</strong>, or
invoked by a client's <strong>ssh</strong> remote request.</dd>
</dl>
</td>
</tr>
</table>
<dl class="bookref">
<dt>Book References:</dt>
<dd><a href="http://svnbook.red-bean.com/svnbook/ch06.html">Server configuration</a></dd>
</dl>
</div>
<!-- ==================================================================== -->
<div class="h2">
<h2 id="authenticating">Authenticating to a server</h2>
<p>Have a network client prove its identity to a version
control server.</p>
<table class="sidebyside">
<tr>
<th>CVS</th>
<th>Subversion</th>
</tr>
<tr>
<td>
<dl>
<dt>Commands:</dt>
<dd><tt>$&nbsp;cvs&nbsp;-d&nbsp;:pserver:user@host:/repos&nbsp;<em>command</em>&hellip;</tt></dd>
<dt>Explanation:</dt>
<dd>When contacting a repository, the client pre-emptively
"pushes" its authentication credentials at the server.</dd>
</dl>
</td>
<td>
<dl>
<dt>Commands:</dt>
<dd><tt>$&nbsp;svn&nbsp;<em>command</em>&nbsp;<em>URL</em>&hellip;</tt></dd>
<dd><tt>Password&nbsp;for&nbsp;'user':&nbsp;&nbsp;XXXXXXX</tt></dd>
<dt>Explanation:</dt>
<dd>The client's authentication credentials are "pulled" from
the user interactively, and only when the server deems that a
challenge needs to be made. (And contrary to popular belief,
the <tt>--username</tt> and <tt>--password</tt> options are
merely values to be used <em>if</em> the server issues a
challenge; they do not "push" the credentials at the
server.)</dd>
</dl>
</td>
</tr>
</table>
<dl class="bookref">
<dt>Book References:</dt>
<dd><a href="http://svnbook.red-bean.com/svnbook/ch06s02.html">Network Model</a></dd>
</dl>
</div>
<!-- ==================================================================== -->
<div class="h2">
<h2 id="browsing">Browsing a repository</h2>
<p>Browse the repository as a filesystem, perusing file
contents and history as well (older versions of files or
trees.)</p>
<table class="sidebyside">
<tr>
<th>CVS</th>
<th>Subversion</th>
</tr>
<tr>
<td>
<dl>
<dt>Commands:</dt>
<dd>(not possible with commandline client)</dd>
<dt>Explanation:</dt>
<dd>Not possible with commandline client. A third-party web
server tool such as ViewCVS must be used.</dd>
</dl>
</td>
<td>
<dl>
<dt>Commands:</dt>
<dd><tt>$&nbsp;svn&nbsp;list&nbsp;<em>URL</em>&nbsp;[-r&nbsp;<em>rev</em>]&nbsp;[-v]</tt></dd>
<dd><tt>$&nbsp;svn&nbsp;cat&nbsp;<em>URL</em>&nbsp;[-r&nbsp;<em>rev</em>]</tt></dd>
<dt>Explanation:</dt>
<dd>The <tt>svn list</tt> and <tt>svn cat</tt> commands allow
interactive browsing of a repository (and all previous states of
a repository) from the commandline. (The <tt>--verbose [-v]</tt>
switch displays full listing information.) If Apache is being
used as a Subversion server process (i.e. clients access via
<strong>http://</strong>), then the latest version of the
repository can be directly browsed by entering <em>URL</em> into
any web browser. Additionally, a third-party web server tool
(such as ViewCVS) can be used with Subversion.</dd>
</dl>
</td>
</tr>
</table>
<dl class="bookref">
<dt>Book References:</dt>
<dd><a href="http://svnbook.red-bean.com/svnbook/re14.html">svn list</a></dd>
</dl>
</div>
<!-- ==================================================================== -->
<div class="h2">
<h2 id="checkingout">Checking out a working copy</h2>
<p>Create a workspace on local disk which mirrors a directory
in the repository.</p>
<table class="sidebyside">
<tr>
<th>CVS</th>
<th>Subversion</th>
</tr>
<tr>
<td>
<dl>
<dt>Commands:</dt>
<dd><tt>$&nbsp;cvs&nbsp;-d&nbsp;/usr/local/repos&nbsp;checkout&nbsp;myproj</tt></dd>
<dd><tt>U&nbsp;myproj/foo.c</tt></dd>
<dd><tt>U&nbsp;myproj/bar.c</tt></dd>
<dd><tt>&hellip;</tt></dd>
<dt>Explanation:</dt>
<dd>Creates a local directory <tt>myproj</tt> which is a mirror
of the repository directory <tt>/myproj</tt>.</dd>
</dl>
</td>
<td>
<dl>
<dt>Commands:</dt>
<dd><tt>$&nbsp;svn&nbsp;checkout&nbsp;file:///usr/local/repos/trunk&nbsp;myproj</tt></dd>
<dd><tt>A&nbsp;&nbsp;myproj/foo.c</tt></dd>
<dd><tt>A&nbsp;&nbsp;myproj/bar.c</tt></dd>
<dd><tt>&hellip;</tt></dd>
<dt>Explanation:</dt>
<dd>Assuming that the original project data was imported into
the repository <tt>/trunk</tt> directory, this creates a local
directory <tt>myproj</tt> which is a mirror of the repository
directory <tt>/trunk</tt>. Standard Subversion convention is to
do "mainline" development in <tt>/trunk</tt>. See branching and
tagging sections for more details.</dd>
</dl>
</td>
</tr>
</table>
<dl class="bookref">
<dt>Book References:</dt>
<dd><a href="http://svnbook.red-bean.com/svnbook/ch03s04.html">Initial Checkout</a></dd>
<dd><a href="http://svnbook.red-bean.com/svnbook/re04.html">svn checkout</a></dd>
</dl>
</div>
<!-- ==================================================================== -->
<div class="h2">
<h2 id="changeditems">Seeing locally changed items</h2>
<p>Discover which items in the working copy have local
modifications or are scheduled for addition/deletion.</p>
<table class="sidebyside">
<tr>
<th>CVS</th>
<th>Subversion</th>
</tr>
<tr>
<td>
<dl>
<dt>Commands:</dt>
<dd><tt>$&nbsp;cvs&nbsp;status</tt></dd>
<dd><tt>&hellip;</tt></dd>
<dd><tt>File: baz.c&nbsp;&nbsp;&nbsp;Status:&nbsp;Up-to-date</tt></dd>
<dd><tt>&hellip;</tt></dd>
<dd><tt>$&nbsp;cvs&nbsp;update</tt></dd>
<dd><tt>M foo.c</tt></dd>
<dd><tt>U bar.c</tt></dd>
<dd><tt>&hellip;</tt></dd>
<dt>Explanation:</dt>
<dd>The <tt>cvs status</tt> command shows whether a file is
locally modified or out of date, including information about
working revision and branch info. Unfortunately, because the
output is so verbose and hard to read, many users run <tt>cvs
update</tt> instead, which shows a more compact listing of
modified files (and of course, it also causes the server to
merge changes into your working copy.)</dd>
</dl>
</td>
<td>
<dl>
<dt>Commands:</dt>
<dd><tt>$&nbsp;svn&nbsp;status</tt></dd>
<dd><tt>M&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;foo.c</tt></dd>
<dd><tt>&hellip;</tt></dd>
<dt>Explanation:</dt>
<dd>Shows modified files only. Very fast, as it does not use
the network. Does not update your working copy, yet still shows
a single-line display, much like <tt>svn update</tt>. To see
working revision and branch information, run <tt>svn info</tt>.</dd>
</dl>
</td>
</tr>
</table>
<dl class="bookref">
<dt>Book References:</dt>
<dd><a href="http://svnbook.red-bean.com/svnbook/ch03s05.html#svn-ch-3-sect-4.3.1">Examine Your Changes</a></dd>
<dd><a href="http://svnbook.red-bean.com/svnbook/re26.html">svn status</a></dd>
</dl>
</div>
<!-- ==================================================================== -->
<div class="h2">
<h2 id="outofdate">Seeing out-of-date items</h2>
<p>Discover which items in the working copy are out-of-date
(i.e. newer versions exist in the repository.)</p>
<table class="sidebyside">
<tr>
<th>CVS</th>
<th>Subversion</th>
</tr>
<tr>
<td>
<dl>
<dt>Commands:</dt>
<dd><tt>$&nbsp;cvs&nbsp;status</tt></dd>
<dd><tt>&hellip;</tt></dd>
<dd><tt>File: baz.c&nbsp;&nbsp;&nbsp;Status:&nbsp;Needs&nbsp;Patch</tt></dd>
<dd><tt>&hellip;</tt></dd>
<dd><tt>$&nbsp;cvs&nbsp;-n&nbsp;update</tt></dd>
<dd><tt>M foo.c</tt></dd>
<dd><tt>U bar.c</tt></dd>
<dd><tt>&hellip;</tt></dd>
<dt>Explanation:</dt>
<dd>The <tt>cvs status</tt> command shows whether a file is
locally modified or out of date, including information about
working revision and branch info. A less verbose option is to
run <tt>cvs -n update</tt> instead, which shows a compact
listing of both out-of-date and locally modified files, without
actually updating the working copy.</dd>
</dl>
</td>
<td>
<dl>
<dt>Commands:</dt>
<dd><tt>$&nbsp;svn&nbsp;status&nbsp;-u</tt></dd>
<dd><tt>M&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;46&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;foo.c</tt></dd>
<dd><tt>M&nbsp;&nbsp;*&nbsp;&nbsp;46&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;bar.c</tt></dd>
<dd><tt>&nbsp;&nbsp;&nbsp;*&nbsp;&nbsp;46&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;baz.c</tt></dd>
<dd><tt>&hellip;</tt></dd>
<dt>Explanation:</dt>
<dd>Shows modified files (<tt>M</tt>) as well as out-of-date
files (<tt>*</tt>). Contacts repository, but doesn't modify the
working copy. To see working revision and branch information,
run <tt>svn info</tt>.</dd>
</dl>
</td>
</tr>
</table>
<dl class="bookref">
<dt>Book References:</dt>
<dd><a href="http://svnbook.red-bean.com/svnbook/ch03s05.html#svn-ch-3-sect-4.3.1">Examine Your Changes</a></dd>
<dd><a href="http://svnbook.red-bean.com/svnbook/re26.html">svn status</a></dd>
</dl>
</div>
<!-- ==================================================================== -->
<div class="h2">
<h2 id="scheduling">Scheduling additions or deletions</h2>
<p>Schedule a working-copy file or directory to be added or
removed from the repository.</p>
<table class="sidebyside">
<tr>
<th>CVS</th>
<th>Subversion</th>
</tr>
<tr>
<td>
<dl>
<dt>Commands:</dt>
<dd><tt>$&nbsp;touch&nbsp;foo.c</tt></dd>
<dd><tt>$&nbsp;cvs&nbsp;add&nbsp;foo.c</tt></dd>
<dd><tt>cvs&nbsp;server:&nbsp;scheduling&nbsp;file&nbsp;`blah'&nbsp;for&nbsp;addition</tt></dd>
<dd><tt>cvs&nbsp;server:&nbsp;use&nbsp;'cvs&nbsp;commit'&nbsp;to&nbsp;add&nbsp;this&nbsp;file&nbsp;permanently</tt></dd>
<dd><tt>&nbsp;</tt></dd>
<dd><tt>$&nbsp;mkdir&nbsp;new-dir</tt></dd>
<dd><tt>$&nbsp;cvs&nbsp;add&nbsp;new-dir</tt></dd>
<dd><tt>Directory&nbsp;new-dir&nbsp;added&nbsp;to&nbsp;the&nbsp;repository</tt></dd>
<dd><tt>&nbsp;</tt></dd>
<dd><tt>$&nbsp;rm&nbsp;bar.c</tt></dd>
<dd><tt>$&nbsp;cvs&nbsp;rm&nbsp;bar.c</tt></dd>
<dd><tt>cvs&nbsp;remove:&nbsp;scheduling&nbsp;`bar.c'&nbsp;for&nbsp;removal</tt></dd>
<dd><tt>cvs&nbsp;remove:&nbsp;use&nbsp;'cvs&nbsp;commit'&nbsp;to&nbsp;remove&nbsp;this&nbsp;file&nbsp;permanently</tt></dd>
<dd><tt>&nbsp;</tt></dd>
<dd><tt>$&nbsp;rm&nbsp;-rf&nbsp;old-dir/*</tt></dd>
<dd><tt>$&nbsp;cvs&nbsp;rm&nbsp;old-dir</tt></dd>
<dd><tt>cvs&nbsp;remove:&nbsp;Removing&nbsp;3bits</tt></dd>
<dd><tt>&hellip;</tt></dd>
<dt>Explanation:</dt>
<dd>Schedules a file or directory for addition or removal
to/from the repository. The repository will not be changed
until the user runs <tt>cvs commit</tt>, except for the case of
adding a directory, which immediately changes the repository.
Also, directories cannot be truly removed from the repository,
just emptied out. (<tt>cvs update -P</tt> will prune empty
directories from your working copy.)</dd>
</dl>
</td>
<td>
<dl>
<dt>Commands:</dt>
<dd><tt>$&nbsp;touch&nbsp;foo.c</tt></dd>
<dd><tt>$&nbsp;svn&nbsp;add&nbsp;foo.c</tt></dd>
<dd><tt>A&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;foo.c</tt></dd>
<dd><tt>&nbsp;</tt></dd>
<dd><tt>$&nbsp;mkdir&nbsp;new-dir</tt></dd>
<dd><tt>$&nbsp;svn&nbsp;add&nbsp;new-dir</tt></dd>
<dd><tt>A&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;new-dir</tt></dd>
<dd><tt>&nbsp;</tt></dd>
<dd><tt>$&nbsp;svn&nbsp;rm&nbsp;bar.c</tt></dd>
<dd><tt>D&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;bar.c</tt></dd>
<dd><tt>&nbsp;</tt></dd>
<dd><tt>$&nbsp;svn&nbsp;rm&nbsp;old-dir</tt></dd>
<dd><tt>D&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;old-dir/file1</tt></dd>
<dd><tt>D&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;old-dir/file2</tt></dd>
<dd><tt>&hellip;</tt></dd>
<dt>Explanation:</dt>
<dd>Schedules a file or directory for addition or removal
to/from the repository. The repository will not be changed
until the user runs <tt>svn commit</tt>. The scheduled
operations are shown as <tt>A</tt> or <tt>D</tt> by <tt>svn
status</tt>, and <tt>svn revert</tt> can un-do the scheduling.
Directories really can be deleted (though as with all deleted
items, continues to exist in history.)</dd>
</dl>
</td>
</tr>
</table>
<dl class="bookref">
<dt>Book References:</dt>
<dd><a href="http://svnbook.red-bean.com/svnbook/ch03s05.html#svn-ch-3-sect-4.2">Make Changes to Your Working Copy</a></dd>
<dd><a href="http://svnbook.red-bean.com/svnbook/re01.html">svn add</a></dd>
<dd><a href="http://svnbook.red-bean.com/svnbook/re08.html">svn delete</a></dd>
</dl>
</div>
<!-- ==================================================================== -->
<div class="h2">
<h2 id="copying">Copying and moving</h2>
<p>Copy or move/rename a file or directory.</p>
<table class="sidebyside">
<tr>
<th>CVS</th>
<th>Subversion</th>
</tr>
<tr>
<td>
<dl>
<dt>Commands:</dt>
<dd>(not possible.)</dd>
<dt>Explanation:</dt>
<dd>Not possible, unless an administrator directly mucks with
RCS files in the repository. (And in that case, no history
records the act of copying or renaming.)</dd>
</dl>
</td>
<td>
<dl>
<dt>Commands:</dt>
<dd><tt>$&nbsp;svn&nbsp;copy&nbsp;foo.c&nbsp;foo2.c</tt></dd>
<dd><tt>A&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;foo2.c</tt></dd>
<dd><tt>&nbsp;</tt></dd>
<dd><tt>$&nbsp;svn&nbsp;copy&nbsp;dir&nbsp;dir2</tt></dd>
<dd><tt>A&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;dir2</tt></dd>
<dd><tt>&nbsp;</tt></dd>
<dd><tt>$&nbsp;svn&nbsp;move&nbsp;bar.c&nbsp;baz.c</tt></dd>
<dd><tt>A&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;baz.c</tt></dd>
<dd><tt>D&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;bar.c</tt></dd>
<dd><tt>&nbsp;</tt></dd>
<dd><tt>$&nbsp;svn&nbsp;move&nbsp;dirA&nbsp;dirB</tt></dd>
<dd><tt>A&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;dirB</tt></dd>
<dd><tt>D&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;dirA/file1</tt></dd>
<dd><tt>D&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;dirA/file2</tt></dd>
<dd><tt>&hellip;</tt></dd>
<dt>Explanation:</dt>
<dd>The <tt>svn copy</tt> command schedules a file or directory
for addition to the repository, recording the "source" of the
copy. After committing, <tt>svn log</tt> on the copied item
will trace history back through the original copy-source. The
<tt>svn move</tt> command is exactly equivalent to running
<tt>svn copy</tt>, followed by an <tt>svn delete</tt> on the
copy-source: the result is a new item scheduled for addition
(with copy-history attached) and the original item scheduled for
deletion.</dd>
</dl>
</td>
</tr>
</table>
<dl class="bookref">
<dt>Book References:</dt>
<dd><a href="http://svnbook.red-bean.com/svnbook/ch03s05.html#svn-ch-3-sect-4.2">Make Changes to Your Working Copy</a></dd>
<dd><a href="http://svnbook.red-bean.com/svnbook/re07.html">svn copy</a></dd>
<dd><a href="http://svnbook.red-bean.com/svnbook/re18.html">svn move</a></dd>
</dl>
</div>
<!-- ==================================================================== -->
<div class="h2">
<h2>Finding the beginning of a branch</h2>
<p>If you're attempting to merge an entire branch into another, you
need to compare the "root" and "tip" of the source branch, and then
merge those differences into a working copy of the target branch.
Obviously the "tip" of the branch can be represented by using the
<tt>HEAD</tt> keyword. But how do you find the "birth" revision of
the source branch?</p>
<p>The easiest solution is to run</p>
<pre>
$ svn log -v --stop-on-copy source-branch-URL
&hellip;
</pre>
<p>This command will display every change ever made to the branch, but
<tt>--stop-on-copy</tt> option will cause the output to stop as soon
as detects a copy operation in the branch's history. By definition,
then, the very last log entry printed will show the copy being made.
It will look something like:</p>
<pre>
r9189 | joe | 2004-03-22 10:10:47 -0600 (Mon, 22 Mar 2004) | 1 line
Changed paths:
A /branches/mybranch (from /trunk:9188)
</pre>
<p>In this case, you would then know to compare revisions 9189 and
HEAD of the branch in order to perform the merge:</p>
<pre>
$ svn merge -r9189:HEAD source-branch-URL target-branch-WC
&hellip;
</pre>
</div>
<!-- ==================================================================== -->
<div class="h2">
<h2>Seeing all of a project's tags</h2>
<p>Assuming you've been following a consistent policy for creating
tag-copies, then this is just a matter of running <tt>svn ls</tt> on a
directory containing your tags. Typically you would run it on the
<tt>/tags</tt> directory in your repository, although you're certainly
free to organize this directory in a more complex way, or invent a
different convention altogether.</p>
<p>As an example, you can see all of Subversion's tags by running:</p>
<pre>
$ svn ls --verbose http://svn.apache.org/repos/asf/subversion/tags
&hellip;
7739 kfogel Nov 13 22:05 0.33.0/
7796 josander Nov 18 12:15 0.33.1/
7932 josander Dec 03 17:54 0.34.0/
8045 josander Dec 19 15:13 0.35.0/
8063 josander Dec 20 11:20 0.35.1/
8282 josander Jan 13 14:15 0.36.0/
8512 josander Jan 24 17:31 0.37.0/
8810 kfogel Feb 23 03:44 1.0.0/
&hellip;
</pre>
</div>
<!-- ==================================================================== -->
<div class="h2">
<h2>Seeing the differences between two tags</h2>
<p>Just use <tt>svn diff</tt> in its fully expanded form, which
compares any two URLs:</p>
<pre>
$ svn diff tagURL1 tagURL2
&hellip;
</pre>
</div>
<!-- ==================================================================== -->
<div class="h2">
<h2>Seeing logs between two tags</h2>
<p>This is a somewhat common practice in CVS, and is doable in Subversion,
but requires a little bit more work. Assuming that you've made two
tags of <tt>/trunk</tt> at different points in time, the ultimate goal
here is to run </p>
<pre>
$ svn log -rX:Y trunkURL
</pre>
<p>&hellip;where X and Y are the revisions from which the two tags were
copied. To discover X and Y, you can use the same technique
described in the previous section ("finding the beginning of a
branch".) Just use the <tt>--stop-on-copy</tt> option when logging the
history of each tag. No commits happen on tag directories, so the
following commands should each produce exactly <em>one</em> log
entry:</p>
<pre>
$ svn log -v --stop-on-copy tag1-URL
r3520 | joe | 2004-03-12 15:28:43 -0600 (Fri, 12 Mar 2004) | 1 line
&hellip;
$ svn log -v --stop-on-copy tag2-URL
a
r4177 | joe | 2004-03-12 15:28:43 -0600 (Fri, 12 Mar 2004) | 1 line
&hellip;
</pre>
<p>So in this example, the values of X and Y are 3520 and 4177. Now
you can view all <tt>/trunk</tt> changes between those two points in time:</p>
<pre>
$ svn log -r3520:4177 trunkURL
&hellip;
</pre>
</div>
<!-- ==================================================================== -->
<div class="h2">
<h2>Fixing an incorrect tag</h2>
<p>If your tag is a bit off, you can "adjust" it just as people often
do in CVS. Simply check out a working copy of the tag directory, make
any changes you wish, and commit.</p>
<p>Remember, because branches and tags are directories, they can also
be deleted when they're no longer of any use to your project. They'll
continue to exist in the repository's history.</p>
</div>
<!-- ==================================================================== -->
<div class="h2">
<h2>Creating/using "modules"</h2>
<p>Compare CVS Modules vs. svn:externals.</p>
</div>
<!-- ==================================================================== -->
</body>
</html>

323
doc/user/lj_article.txt Normal file
View File

@ -0,0 +1,323 @@
The Subversion Project: Building a Better CVS
==============================================
Ben Collins-Sussman <sussman@collab.net>
Written in August 2001
Published in Linux Journal, January 2002
Abstract
--------
This article discusses the history, goals, features and design of
Subversion (http://subversion.tigris.org), an open-source project that
aims to produce a compelling replacement for CVS.
Introduction
------------
If you work on any kind of open-source project, you've probably worked
with CVS. You probably remember the first time you learned to do an
anonymous checkout of a source tree over the net -- or your first
commit, or learning how to look at CVS diffs. And then the fateful
day came: you asked your friend how to rename a file.
"You can't", was the reply.
What? What do you mean?
"Well, you can delete the file from the repository and then re-add it
under a new name."
Yes, but then nobody would know it had been renamed...
"Let's call the CVS administrator. She can hand-edit the repository's
RCS files for us and possibly make things work."
What?
"And by the way, don't try to delete a directory either."
You rolled your eyes and groaned. How could such simple tasks be
difficult?
The Legacy of CVS
-----------------
No doubt about it, CVS has evolved into the standard Software
Configuration Management (SCM) system of the open source community.
And rightly so! CVS itself is Free software, and its wonderful "non
locking" development model -- whereby dozens of far-flung programmers
collaborate -- fits the open-source world very well. In fact, one
might argue that without CVS, it's doubtful whether sites like
Freshmeat or Sourceforge would ever have flourished as they do now.
CVS and its semi-chaotic development model have become an essential
part of open source culture.
So what's wrong with CVS?
Because it uses the RCS storage-system under the hood, CVS can only
track file contents, not tree structures. As a result, the user has
no way to copy, move, or rename items without losing history. Tree
rearrangements are always ugly server-side tweaks.
The RCS back-end cannot store binary files efficiently, and branching
and tagging operations can grow to be very slow. CVS also uses the
network inefficiently; many users are annoyed by long waits, because
file differeces are sent in only one direction (from server to client,
but not from client to server), and binary files are always
transmitted in their entirety.
From a developer's standpoint, the CVS codebase is the result of
layers upon layers of historical "hacks". (Remember that CVS began
life as a collection of shell-scripts to drive RCS.) This makes the
code difficult to understand, maintain, or extend. For example: CVS's
networking ability was essentially "stapled on". It was never
designed to be a native client-server system.
Rectifying CVS's problems is a huge task -- and we've only listed just
a few of the many common complaints here.
Enter Subversion
----------------
In 1995, Karl Fogel and Jim Blandy founded Cyclic Software, a company
for commercially supporting and improving CVS. Cyclic made the first
public release of a network-enabled CVS (contributed by Cygnus
software.) In 1999, Karl Fogel published a book about CVS and the
open-source development model it enables (cvsbook.red-bean.com). Karl
and Jim had long talked about writing a replacement for CVS; Jim had
even drafted a new, theoretical repository design. Finally, in
February of 2000, Brian Behlendorf of CollabNet (www.collab.net)
offered Karl a full-time job to write a CVS replacement. Karl
gathered a team together and work began in May.
The team settled on a few simple goals: it was decided that Subversion
would be designed as a functional replacement for CVS. It would do
everything that CVS does -- preserving the same development model
while fixing the flaws in CVS's (lack-of) design. Existing CVS users
would be the target audience: any CVS user should be able to start
using Subversion with little effort. Any other SCM "bonus features"
were decided to be of secondary importance (at least before a 1.0
release.)
At the time of writing, the original team has been coding for a little
over a year, and we have a number of excellent volunteer contributors.
(Subversion, like CVS, is a open-source project!)
Subversion's Features
----------------------
Here's a quick run-down of some of the reasons you should be excited
about Subversion:
* Real copies and renames. The Subversion repository doesn't use
RCS files at all; instead, it implements a 'virtual' versioned
filesystem that tracks tree-structures over time (described
below). Files *and* directories are versioned. At last, there
are real client-side `mv' and `cp' commands that behave just as
you think.
* Atomic commits. A commit either goes into the repository
completely, or not all.
* Advanced network layer. The Subversion network server is Apache,
and client and server speak WebDAV(2) to one another. (See the
'design' section below.)
* Faster network access. A binary diffing algorithm is used to
store and transmit deltas in *both* directions, regardless of
whether a file is of text or binary type.
* Filesystem "properties". Each file or directory has an invisible
hashtable attached. You can invent and store any arbitrary
key/value pairs you wish: owner, perms, icons, app-creator,
mime-type, personal notes, etc. This is a general-purpose feature
for users. Properties are versioned, just like file contents.
And some properties are auto-detected, like the mime-type of a
file (no more remembering to use the '-kb' switch!)
* Extensible and hackable. Subversion has no historical baggage; it
was designed and then implemented as a collection of shared C
libraries with well-defined APIs. This makes Subversion extremely
maintainable and usable by other applications and languages.
* Easy migration. The Subversion command-line client is very
similar to CVS; the development model is the same, so CVS users
should have little trouble making the switch. Development of a
'cvs2svn' repository converter is in progress.
* It's Free. Subversion is released under a Apache/BSD-style
open-source license.
Subversion's Design
-------------------
Subversion has a modular design; it's implemented as a collection of C
libraries. Each layer has a well-defined purpose and interface. In
general, code flow begins at the top of the diagram and flows
"downward" -- each layer provides an interface to the layer above it.
<<insert diagram here: svn.tiff>>
Let's take a short tour of these layers, starting at the bottom.
--> The Subversion filesystem.
The Subversion Filesystem is *not* a kernel-level filesystem that one
would install in an operating system (like the Linux ext2 fs.)
Instead, it refers to the design of Subversion's repository. The
repository is built on top of a database -- currently Berkeley DB --
and thus is a collection of .db files. However, a library accesses
these files and exports a C API that simulates a filesystem --
specifically, a "versioned" filesystem.
This means that writing a program to access the repository is like
writing against other filesystem APIs: you can open files and
directories for reading and writing as usual. The main difference is
that this particular filesystem never loses data when written to; old
versions of files and directories are always saved as historical
artifacts.
Whereas CVS's backend (RCS) stores revision numbers on a per-file
basis, Subversion numbers entire trees. Each atomic 'commit' to the
repository creates a completely new filesystem tree, and is
individually labeled with a single, global revision number. Files and
directories which have changed are rewritten (and older versions are
backed up and stored as differences against the latest version), while
unchanged entries are pointed to via a shared-storage mechanism. This
is how the repository is able to version tree structures, not just
file contents.
Finally, it should be mentioned that using a database like Berkeley DB
immediately provides other nice features that Subversion needs: data
integrity, atomic writes, recoverability, and hot backups. (See
www.sleepycat.com for more information.)
--> The network layer.
Subversion has the mark of Apache all over it. At its very core, the
client uses the Apache Portable Runtime (APR) library. (In fact, this
means that Subversion client should compile and run anywhere Apache
httpd does -- right now, this list includes all flavors of Unix,
Win32, BeOS, OS/2, Mac OS X, and possibly Netware.)
However, Subversion depends on more than just APR -- the Subversion
"server" is Apache httpd itself.
Why was Apache chosen? Ultimately, the decision was about not
reinventing the wheel. Apache is a time-tested, open-source server
process that ready for serious use, yet is still extensible. It can
sustain a high network load. It runs on many platforms and can
operate through firewalls. It's able to use a number of different
authentication protocols. It can do network pipelining and caching.
By using Apache as a server, Subversion gets all these features for
free. Why start from scratch?
Subversion uses WebDAV as its network protocol. DAV (Distributed
Authoring and Versioning) is a whole discussion in itself (see
www.webdav.org) -- but in short, it's an extension to HTTP that allows
reads/writes and "versioning" of files over the web. The Subversion
project is hoping to ride a slowly rising tide of support for this
protocol: all of the latest file-browsers for Win32, MacOS, and GNOME
speak this protocol already. Interoperability will (hopefully) become
more and more of a bonus over time.
For users who simply wish to access Subversion repositories on local
disk, the client can do this too; no network is required. The
"Repository Access" layer (RA) is an abstract API implemented by both
the DAV and local-access RA libraries. This is a specific benefit of
writing a "librarized" version control system; it's a big win over
CVS, which has two very different, difficult-to-maintain codepaths for
local vs. network repository-access. Feel like writing a new network
protocol for Subversion? Just write a new library that implements the
RA API!
--> The client libraries.
On the client side, the Subversion "working copy" library maintains
administrative information within special SVN/ subdirectories, similar
in purpose to the CVS/ administrative directories found in CVS working
copies.
A glance inside the typical SVN/ directory turns up a bit more than
usual, however. The `entries' file contains XML which describes the
current state of the working copy directory (and which basically
serves the purposes of CVS's Entries, Root, and Repository files
combined). But other items present (and not found in CVS/) include
storage locations for the versioned "properties" (the metadata
mentioned in 'Subversion Features' above) and private caches of
pristine versions of each file. This latter feature provides the
ability to report local modifications -- and do reversions --
*without* network access. Authentication data is also stored within
SVN/, rather than in a single .cvspass-like file.
The Subversion "client" library has the broadest responsibility; its
job is to mingle the functionality of the working-copy library with
that of the repository-access library, and then to provide a
highest-level API to any application that wishes to perform general
version control actions.
For example: the C routine `svn_client_checkout()' takes a URL as an
argument. It passes this URL to the repository-access library and
opens an authenticated session with a particular repository. It then
asks the repository for a certain tree, and sends this tree into the
working-copy library, which then writes a full working copy to disk
(SVN/ directories and all.)
The client library is designed to be used by any application. While
the Subversion source code includes a standard command-line client, it
should be very easy to write any number of GUI clients on top of the
client library. Hopefully, these GUIs should someday prove to be much
better than the current crop of CVS GUI applications (the majority of
which are no more than fragile "wrappers" around the CVS command-line
client.)
In addition, proper SWIG bindings (www.swig.org) should make
the Subversion API available to any number of languages: java, perl,
python, guile, and so on. In order to Subvert CVS, it helps to be
ubiquitous!
Subversion's Future
-------------------
The release of Subversion 1.0 is currently planned for early 2002.
After the release of 1.0, Subversion is slated for additions such as
i18n support, "intelligent" merging, better "changeset" manipulation,
client-side plugins, and improved features for server administration.
(Also on the wishlist is an eclectic collection of ideas, such as
distributed, replicating repositories.)
A final thought from Subversion's FAQ:
"We aren't (yet) attempting to break new ground in SCM systems, nor
are we attempting to imitate all the best features of every SCM
system out there. We're trying to replace CVS."
If, in three years, Subversion is widely presumed to be the "standard"
SCM system in the open-source community, then the project will have
succeeded. But the future is still hazy: ultimately, Subversion
will have to win this position on its own technical merits.
Patches are welcome.
For More Information
--------------------
Please visit the Subversion project website at
http://subversion.tigris.org. There are discussion lists to join, and
the source code is available via anonymous CVS -- and soon through
Subversion itself.

View File

@ -0,0 +1,350 @@
<!--
Licensed to the Apache Software Foundation (ASF) under one
or more contributor license agreements. See the NOTICE file
distributed with this work for additional information
regarding copyright ownership. The ASF licenses this file
to you under the Apache License, Version 2.0 (the
"License"); you may not use this file except in compliance
with the License. You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing,
software distributed under the License is distributed on an
"AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
KIND, either express or implied. See the License for the
specific language governing permissions and limitations
under the License.
-->
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01//EN"
"http://www.w3.org/TR/html4/strict.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html;charset=utf-8">
<title>Subversion Best Practices</title>
<style type="text/css">
h1 {
text-align: center;
}
</style>
</head>
<body>
<h1>Subversion Best Practices</h1>
<p>This is a quick set of guidelines for making the best use of
Subversion in your day-to-day software development work.</p>
<h2>Use a sane repository layout</h2>
<p>There are many ways to lay out your repository. Because branches
and tags are ordinary directories, you'll need to account for them in
your repository structure.</p>
<p>The Subversion project officially recommends the idea of a "project
root", which represents an anchoring point for a project. A "project
root" contains exactly three subdirectories: <tt>/trunk</tt>,
<tt>/branches</tt>, and <tt>/tags</tt>. A repository may contain
only one project root, or it may contain a number of them.</p>
<p><em>Book reference:</em> <a
href="http://svnbook.red-bean.com/svnbook/ch05s04.html#svn-ch-5-sect-6.1">Choosing
a Repository Layout</a>.</p>
<!-- =================================================== -->
<h2>Commit logical changesets</h2>
<p>When you commit a change to the repository, make sure your change
reflects a single purpose: the fixing of a specific bug, the addition
of a new feature, or some particular task. Your commit will create a
new revision number which can forever be used as a "name" for the
change. You can mention this revision number in bug databases, or use
it as an argument to <tt>svn merge</tt> should you want to undo the
change or port it to another branch.</p>
<p><em>Book reference:</em> "Subversion and Changesets" sidebar,
within <a
href="http://svnbook.red-bean.com/svnbook/ch04s03.html">chapter
4</a>.</p>
<!-- =================================================== -->
<h2>Use the issue-tracker wisely</h2>
<p>Try to create as many two-way links between Subversion changesets
and your issue-tracking database as possible:</p>
<ul>
<li>If possible, refer to a specific issue ID in every commit log message.</li>
<li>When appending information to an issue (to describe progress, or
to close the issue) name the revision number(s) responsible
for the change.</li>
</ul>
<!-- =================================================== -->
<h2>Track merges manually</h2>
<p>When committing the result of a merge, be sure to write a
descriptive log message that explains what was merged, something
like:</p>
<pre>Merged revisions 3490:4120 of /branches/foobranch to /trunk.</pre>
<p><em>Book reference:</em> <a
href="http://svnbook.red-bean.com/svnbook/ch04s03.html#svn-ch-4-sect-3.2">Tracking
merges manually</a>, and <a
href="http://svnbook.red-bean.com/svnbook/ch04s04.html#svn-ch-4-sect-4.1">Merging a whole branch to another</a>.</p>
<!-- =================================================== -->
<h2>Understand mixed-revision working copies</h2>
<p>Your working copy's directories and files can be at different
"working" revisions: this is a deliberate feature which allows you to
mix and match older versions of things with newer ones. But there are
few facts you must be aware of:</p>
<ol>
<li>After every <tt>svn commit</tt>, your working copy has mixed
revisions. The things you just committed are now at the HEAD
revision, and everything else is at an older revision.</li>
<li>Certain commits are disallowed:
<ul>
<li>You cannot commit the deletion of a file or directory which
doesn't have a working revision of HEAD.</li>
<li>You cannot commit a property change to a directory which
doesn't have a working revision of HEAD.</li>
</ul>
</li>
<li><tt>svn update</tt> will bring your entire working copy to one
working revision, and is the typical solution to the
problems mentioned in point #2.</li>
</ol>
<p><em>Book reference:</em> <a
href="http://svnbook.red-bean.com/svnbook/ch02s03.html#svn-ch-2-sect-3.4">The
limitation of mixed revisions</a>.</p>
<!-- =================================================== -->
<h2>Be patient with large files</h2>
<p>A nice feature of Subversion is that by design, there is no limit
to the size of files it can handle. Files are sent "streamily" in
both directions between Subversion client and server, using a small,
constant amount of memory on each side of the network.</p>
<p>Of course, there are a number of practical issues to consider.
While there's no need to worry about files in the kilobyte-sized range
(e.g. typical source-code files), committing larger files can take a
tremendous amount of both time and space (e.g. files that are dozens
or hundreds of megabytes large.)</p>
<p>To begin with, remember that your Subversion working copy stores
pristine copies of all version-controlled files in the
<tt>.svn/text-base/</tt> area. This means that your working copy
takes up at least twice as much disk space as the original dataset.
Beyond that, the Subversion client follows a (currently unadjustable)
algorithm for committing files:</p>
<ul>
<li>Copies the file to <tt>.svn/tmp/</tt> <em>(can take a while,
and temporarily uses extra disk space)</em>)</li>
<li>Performs a binary diff between the tmpfile and the pristine
copy, or between the tmpfile and an empty-file if newly
added. <em>(can take a very long time to compute, even
though only a small amount of data might ultimately be sent
over the network)</em></li>
<li>Sends the diff to the server, then moves the tmpfile into
<tt>.svn/text-base/</tt></li>
</ul>
<p>So while there's no theoretical limit to the size of your files,
you'll need to be aware that very large files may require quite a bit
of patient waiting while your client chugs away. You can rest
assured, however, that unlike CVS, your large files won't incapacitate
the server or affect other users.</p>
<!-- =================================================== -->
<h2>Work around commands that don't understand copies/renames</h2>
<p>When a file or directory is copied or renamed, the Subversion repository
tracks that history. Unfortunately in Subversion 1.0, the only client
subcommand which actually takes advantage of this feature is <tt>svn
log</tt>. A number of other commands (such as <tt>svn diff</tt> and
<tt>svn cat</tt>) ought to be automatically following rename-history,
but aren't doing so yet.</p>
<p>In all of these cases, a basic workaround is to use <tt>'svn log
-v'</tt> to discover the proper path within the older revision.</p>
<p>For example, suppose you copied <tt>/trunk</tt> to
<tt>/branches/mybranch</tt> in revision 200, and then committed some
changes to <tt>/branches/mybranch/foo.c</tt> in subsequent revisions.
Now you'd like to compare revisions 80 and 250 of the file.</p>
<p>If you have a working copy of the branch and run <tt>svn diff
-r80:250 foo.c</tt>, you'll see an error about
<tt>/branches/mybranch/foo.c</tt> not existing in revision 80. To
remedy, you would run <tt>svn log -v</tt> on your branch or file to
discover that it was named <tt>/trunk/foo.c</tt> prior to revision 200,
and then compare the two URLs directly:</p>
<pre>
$ svn diff http://.../trunk/foo.c@80 \
http://.../branches/mybranch/foo.c@200
</pre>
<!-- =================================================== -->
<h2>Know when to create branches</h2>
<p>This is a hotly debated question, and it really depends on the
culture of your software project. Rather than prescribe a universal
policy, we'll describe three common ones here.</p>
<h3>The Never-Branch system</h3>
<p>(Often used by nascent projects that don't yet have runnable code.)</p>
<ul>
<li>Users commit their day-to-day work on <tt>/trunk</tt>.</li>
<li>Occasionally <tt>/trunk</tt> "breaks" (doesn't compile, or fails
functional tests) when a user begins to commit a series of complicated
changes.</li>
</ul>
<p><em>Pros:</em> Very easy policy to follow. New developers have low
barrier to entry. Nobody needs to learn how to branch or merge.</p>
<p><em>Cons:</em> Chaotic development, code could be unstable at any
time.</p>
<p>A side note: this sort of development is a bit less risky in
Subversion than in CVS. Because Subversion commits are atomic, it's
not possible for a checkout or update to receive a "partial" commit
while somebody else is in the process of committing.</p>
<h3>The Always-Branch system</h3>
<p>(Often used by projects that favor heavy management and supervision.)</p>
<ul>
<li>Each user creates/works on a private branch for <em>every</em> coding task.
</li>
<li>When coding is complete, someone (original coder, peer, or
manager) reviews all private branch changes and merges them to
<tt>/trunk</tt>.</li>
</ul>
<p><em>Pros:</em> <tt>/trunk</tt> is guaranteed to be
<em>extremely</em> stable at all times. </p>
<p><em>Cons:</em> Coders are artificially isolated from each other,
possibly creating more merge conflicts than necessary.
Requires users to do lots of extra merging.</p>
<h3>The Branch-When-Needed system</h3>
<p>(This is the system used by the Subversion project.)
<ul>
<li>Users commit their day-to-day work on <tt>/trunk</tt>.</li>
<li>Rule #1: <tt>/trunk</tt> must compile and pass regression tests at
all times. Committers who violate this rule are publically
humiliated.</li>
<li>Rule #2: a single commit (changeset) must not be so large
so as to discourage peer-review.</li>
<li>Rule #3: if rules #1 and #2 come into conflict (i.e. it's
impossible to make a series of small commits without disrupting the
trunk), then the user should create a branch and commit a series of
smaller changesets there. This allows peer-review without disrupting
the stability of <tt>/trunk</tt>.</li>
</ul>
<p><em>Pros:</em> <tt>/trunk</tt> is guaranteed to be stable at all
times. The hassle of branching/merging is somewhat rare.</p>
<p><em>Cons:</em> Adds a bit of burden to users' daily work:
they must compile and test before every commit.</p>
<!--
Mapping CVS tasks to SVN tasks
==============================
This section is just a re-indexing of topics covered in the book,
for people who prefer to learn from the "bottom up" rather than "top down".
It shows some common CVS operations, and then the equivalent SVN operation,
followed by a link to the book which explains more.
* Importing data.
* Checking out a working copy.
* Seeing your changes.
* Undoing your changes.
* Resolving a conflict.
* Adding binary files.
* Activating keyword expansion and/or EOL translation.
TAGS:
* Creating a tag from a working copy
* Creating a remote tag
* Seeing all of a project's tags
* Comparing two tags
* Seeing the logs between two tags
* Tweaking a tag
BRANCHES:
* Creating a branch and switching to it
* Finding the beginning of a branch
* Merging a branch to trunk, or vice versa
-->
</body>
</html>

2
gen-make.opts Normal file
View File

@ -0,0 +1,2 @@
[options]
--release =

326
gen-make.py Executable file
View File

@ -0,0 +1,326 @@
#!/usr/bin/env python
#
#
# Licensed to the Apache Software Foundation (ASF) under one
# or more contributor license agreements. See the NOTICE file
# distributed with this work for additional information
# regarding copyright ownership. The ASF licenses this file
# to you under the Apache License, Version 2.0 (the
# "License"); you may not use this file except in compliance
# with the License. You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing,
# software distributed under the License is distributed on an
# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
# KIND, either express or implied. See the License for the
# specific language governing permissions and limitations
# under the License.
#
#
#
# gen-make.py -- generate makefiles for building Subversion
#
import os
import sys
import getopt
try:
my_getopt = getopt.gnu_getopt
except AttributeError:
my_getopt = getopt.getopt
try:
# Python >=3.0
import configparser
except ImportError:
# Python <3.0
import ConfigParser as configparser
# for the generator modules
sys.path.insert(0, os.path.join('build', 'generator'))
# for getversion
sys.path.insert(1, 'build')
gen_modules = {
'make' : ('gen_make', 'Makefiles for POSIX systems'),
'dsp' : ('gen_msvc_dsp', 'MSVC 6.x project files'),
'vcproj' : ('gen_vcnet_vcproj', 'VC.Net project files'),
}
def main(fname, gentype, verfname=None,
skip_depends=0, other_options=None):
if verfname is None:
verfname = os.path.join('subversion', 'include', 'svn_version.h')
gen_module = __import__(gen_modules[gentype][0])
generator = gen_module.Generator(fname, verfname, other_options)
if not skip_depends:
generator.compute_hdr_deps()
generator.write()
generator.write_sqlite_headers()
if ('--debug', '') in other_options:
for dep_type, target_dict in generator.graph.deps.items():
sorted_targets = list(target_dict.keys()); sorted_targets.sort()
for target in sorted_targets:
print(dep_type + ": " + _objinfo(target))
for source in target_dict[target]:
print(" " + _objinfo(source))
print("=" * 72)
gen_keys = sorted(generator.__dict__.keys())
for name in gen_keys:
value = generator.__dict__[name]
if isinstance(value, list):
print(name + ": ")
for i in value:
print(" " + _objinfo(i))
print("=" * 72)
def _objinfo(o):
if isinstance(o, str):
return repr(o)
else:
t = o.__class__.__name__
n = getattr(o, 'name', '-')
f = getattr(o, 'filename', '-')
return "%s: %s %s" % (t,n,f)
def _usage_exit(err=None):
"print ERR (if any), print usage, then exit the script"
if err:
print("ERROR: %s\n" % (err))
print("USAGE: gen-make.py [options...] [conf-file]")
print(" -s skip dependency generation")
print(" --debug print lots of stuff only developers care about")
print(" --release release mode")
print(" --reload reuse all options from the previous invocation")
print(" of the script, except -s, -t, --debug and --reload")
print(" -t TYPE use the TYPE generator; can be one of:")
items = sorted(gen_modules.items())
for name, (module, desc) in items:
print(' %-12s %s' % (name, desc))
print("")
print(" The default generator type is 'make'")
print("")
print(" Makefile-specific options:")
print("")
print(" --assume-shared-libs")
print(" omit dependencies on libraries, on the assumption that")
print(" shared libraries will be built, so that it is unnecessary")
print(" to relink executables when the libraries that they depend")
print(" on change. This is an option for developers who want to")
print(" increase the speed of frequent rebuilds.")
print(" *** Do not use unless you understand the consequences. ***")
print("")
print(" UNIX-specific options:")
print("")
print(" --installed-libs")
print(" Comma-separated list of Subversion libraries to find")
print(" pre-installed instead of building (probably only")
print(" useful for packagers)")
print("")
print(" Windows-specific options:")
print("")
print(" --with-apr=DIR")
print(" the APR sources are in DIR")
print("")
print(" --with-apr-util=DIR")
print(" the APR-Util sources are in DIR")
print("")
print(" --with-apr-iconv=DIR")
print(" the APR-Iconv sources are in DIR")
print("")
print(" --with-berkeley-db=DIR")
print(" look for Berkeley DB headers and libs in")
print(" DIR")
print("")
print(" --with-serf=DIR")
print(" the Serf sources are in DIR")
print("")
print(" --with-httpd=DIR")
print(" the httpd sources and binaries required")
print(" for building mod_dav_svn are in DIR;")
print(" implies --with-apr{-util, -iconv}, but")
print(" you can override them")
print("")
print(" --with-libintl=DIR")
print(" look for GNU libintl headers and libs in DIR;")
print(" implies --enable-nls")
print("")
print(" --with-openssl=DIR")
print(" tell serf to look for OpenSSL headers")
print(" and libs in DIR")
print("")
print(" --with-zlib=DIR")
print(" tell Subversion to look for ZLib headers and")
print(" libs in DIR")
print("")
print(" --with-jdk=DIR")
print(" look for the java development kit here")
print("")
print(" --with-junit=DIR")
print(" look for the junit jar here")
print(" junit is for testing the java bindings")
print("")
print(" --with-swig=DIR")
print(" look for the swig program in DIR")
print("")
print(" --with-sqlite=DIR")
print(" look for sqlite in DIR")
print("")
print(" --with-sasl=DIR")
print(" look for the sasl headers and libs in DIR")
print("")
print(" --enable-pool-debug")
print(" turn on APR pool debugging")
print("")
print(" --enable-purify")
print(" add support for Purify instrumentation;")
print(" implies --enable-pool-debug")
print("")
print(" --enable-quantify")
print(" add support for Quantify instrumentation")
print("")
print(" --enable-nls")
print(" add support for gettext localization")
print("")
print(" --enable-bdb-in-apr-util")
print(" configure APR-Util to use Berkeley DB")
print("")
print(" --enable-ml")
print(" enable use of ML assembler with zlib")
print("")
print(" --disable-shared")
print(" only build static libraries")
print("")
print(" --with-static-apr")
print(" Use static apr and apr-util")
print("")
print(" --with-static-openssl")
print(" Use static openssl")
print("")
print(" --vsnet-version=VER")
print(" generate for VS.NET version VER (2002, 2003, 2005, 2008, 2010 or 2012)")
print(" [only valid in combination with '-t vcproj']")
print("")
print(" --with-apr_memcache=DIR")
print(" the apr_memcache sources are in DIR")
sys.exit(1)
class Options:
def __init__(self):
self.list = []
self.dict = {}
def add(self, opt, val):
if opt in self.dict:
self.list[self.dict[opt]] = (opt, val)
else:
self.dict[opt] = len(self.list)
self.list.append((opt, val))
if __name__ == '__main__':
try:
opts, args = my_getopt(sys.argv[1:], 'st:',
['debug',
'release',
'reload',
'assume-shared-libs',
'with-apr=',
'with-apr-util=',
'with-apr-iconv=',
'with-berkeley-db=',
'with-serf=',
'with-httpd=',
'with-libintl=',
'with-openssl=',
'with-zlib=',
'with-jdk=',
'with-junit=',
'with-swig=',
'with-sqlite=',
'with-sasl=',
'with-apr_memcache=',
'with-static-apr',
'with-static-openssl',
'enable-pool-debug',
'enable-purify',
'enable-quantify',
'enable-nls',
'enable-bdb-in-apr-util',
'enable-ml',
'disable-shared',
'installed-libs=',
'vsnet-version=',
# Keep distributions that help by adding a path
# working. On unix this would be filtered by
# configure, but on Windows gen-make.py is used
# directly.
'with-neon=',
'without-neon',
])
if len(args) > 1:
_usage_exit("Too many arguments")
except getopt.GetoptError, e:
_usage_exit(str(e))
conf = 'build.conf'
skip = 0
gentype = 'make'
rest = Options()
if args:
conf = args[0]
# First merge options with previously saved to gen-make.opts if --reload
# options used
for opt, val in opts:
if opt == '--reload':
prev_conf = configparser.ConfigParser()
prev_conf.read('gen-make.opts')
for opt, val in prev_conf.items('options'):
if opt != '--debug':
rest.add(opt, val)
del prev_conf
elif opt == '--with-neon' or opt == '--without-neon':
# Provide a warning that we ignored these arguments
print("Ignoring no longer supported argument '%s'" % opt)
else:
rest.add(opt, val)
# Parse options list
for opt, val in rest.list:
if opt == '-s':
skip = 1
elif opt == '-t':
gentype = val
else:
if opt == '--with-httpd':
rest.add('--with-apr', os.path.join(val, 'srclib', 'apr'))
rest.add('--with-apr-util', os.path.join(val, 'srclib', 'apr-util'))
rest.add('--with-apr-iconv', os.path.join(val, 'srclib', 'apr-iconv'))
# Remember all options so that --reload and other scripts can use them
opt_conf = open('gen-make.opts', 'w')
opt_conf.write('[options]\n')
for opt, val in rest.list:
opt_conf.write(opt + ' = ' + val + '\n')
opt_conf.close()
if gentype not in gen_modules.keys():
_usage_exit("Unknown module type '%s'" % (gentype))
main(conf, gentype, skip_depends=skip, other_options=rest.list)
### End of file.

173
get-deps.sh Executable file
View File

@ -0,0 +1,173 @@
#!/bin/sh
#
#
# Licensed to the Apache Software Foundation (ASF) under one
# or more contributor license agreements. See the NOTICE file
# distributed with this work for additional information
# regarding copyright ownership. The ASF licenses this file
# to you under the Apache License, Version 2.0 (the
# "License"); you may not use this file except in compliance
# with the License. You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing,
# software distributed under the License is distributed on an
# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
# KIND, either express or implied. See the License for the
# specific language governing permissions and limitations
# under the License.
#
#
#
# get-deps.sh -- download the dependencies useful for building Subversion
#
# If changing this file please take care to try to make your changes as
# portable as possible. That means at a minimum only use POSIX supported
# features and functions. However, it may be desirable to use an even
# more narrow set of features than POSIX, e.g. Solaris /bin/sh only has
# a subset of the POSIX shell features. If in doubt, limit yourself to
# features already used in the file. Reviewing the history of changes
# may be useful as well.
APR_VERSION=${APR_VERSION:-"1.4.6"}
APU_VERSION=${APU_VERSION:-"1.5.1"}
SERF_VERSION=${SERF_VERSION:-"1.2.1"}
ZLIB_VERSION=${ZLIB_VERSION:-"1.2.8"}
SQLITE_VERSION=${SQLITE_VERSION:-"3.7.15.1"}
GTEST_VERSION=${GTEST_VERSION:-"1.6.0"}
HTTPD_VERSION=${HTTPD_VERSION:-"2.4.3"}
APR_ICONV_VERSION=${APR_ICONV_VERSION:-"1.2.1"}
APR=apr-${APR_VERSION}
APR_UTIL=apr-util-${APU_VERSION}
SERF=serf-${SERF_VERSION}
ZLIB=zlib-${ZLIB_VERSION}
SQLITE_VERSION_LIST=`echo $SQLITE_VERSION | sed -e 's/\./ /g'`
SQLITE=sqlite-amalgamation-`printf %d%02d%02d%02d $SQLITE_VERSION_LIST`
GTEST=gtest-${GTEST_VERSION}
GTEST_URL=http://googletest.googlecode.com/files/
HTTPD=httpd-${HTTPD_VERSION}
APR_ICONV=apr-iconv-${APR_ICONV_VERSION}
BASEDIR=`pwd`
TEMPDIR=$BASEDIR/temp
HTTP_FETCH=
[ -z "$HTTP_FETCH" ] && type wget >/dev/null 2>&1 && HTTP_FETCH="wget -q -nc"
[ -z "$HTTP_FETCH" ] && type curl >/dev/null 2>&1 && HTTP_FETCH="curl -sO"
[ -z "$HTTP_FETCH" ] && type fetch >/dev/null 2>&1 && HTTP_FETCH="fetch -q"
# Need this uncommented if any of the specific versions of the ASF tarballs to
# be downloaded are no longer available on the general mirrors.
APACHE_MIRROR=http://archive.apache.org/dist
# helpers
usage() {
echo "Usage: $0"
echo "Usage: $0 [ apr | serf | zlib | sqlite | gtest ] ..."
exit $1
}
# getters
get_apr() {
cd $TEMPDIR
test -d $BASEDIR/apr || $HTTP_FETCH $APACHE_MIRROR/apr/$APR.tar.bz2
test -d $BASEDIR/apr-util || $HTTP_FETCH $APACHE_MIRROR/apr/$APR_UTIL.tar.bz2
cd $BASEDIR
test -d $BASEDIR/apr || bzip2 -dc $TEMPDIR/$APR.tar.bz2 | tar -xf -
test -d $BASEDIR/apr-util || bzip2 -dc $TEMPDIR/$APR_UTIL.tar.bz2 | tar -xf -
test -d $BASEDIR/apr || mv $APR apr
test -d $BASEDIR/apr-util || mv $APR_UTIL apr-util
}
get_serf() {
test -d $BASEDIR/serf && return
cd $TEMPDIR
$HTTP_FETCH http://serf.googlecode.com/files/$SERF.tar.bz2
cd $BASEDIR
bzip2 -dc $TEMPDIR/$SERF.tar.bz2 | tar -xf -
mv $SERF serf
}
get_zlib() {
test -d $BASEDIR/zlib && return
cd $TEMPDIR
$HTTP_FETCH http://www.zlib.net/$ZLIB.tar.gz
cd $BASEDIR
gzip -dc $TEMPDIR/$ZLIB.tar.gz | tar -xf -
mv $ZLIB zlib
}
get_sqlite() {
test -d $BASEDIR/sqlite-amalgamation && return
cd $TEMPDIR
$HTTP_FETCH http://www.sqlite.org/$SQLITE.zip
cd $BASEDIR
unzip -q $TEMPDIR/$SQLITE.zip
mv $SQLITE sqlite-amalgamation
}
get_gtest() {
test -d $BASEDIR/gtest && return
cd $TEMPDIR
$HTTP_FETCH ${GTEST_URL}/${GTEST}.zip
cd $BASEDIR
unzip -q $TEMPDIR/$GTEST.zip
mv $GTEST gtest
}
# main()
get_deps() {
mkdir -p $TEMPDIR
for i in zlib serf sqlite-amalgamation apr apr-util gtest; do
if [ -d $i ]; then
echo "Local directory '$i' already exists; the downloaded copy won't be used" >&2
fi
done
if [ $# -gt 0 ]; then
for target in "$@"; do
if [ "$target" != "deps" ]; then
get_$target || usage
else
usage
fi
done
else
get_apr
get_serf
get_zlib
get_sqlite
echo
echo "If you require mod_dav_svn, the recommended version of httpd is:"
echo " $APACHE_MIRROR/httpd/$HTTPD.tar.bz2"
echo
echo "If you require apr-iconv, its recommended version is:"
echo " $APACHE_MIRROR/apr/$APR_ICONV.tar.bz2"
fi
rm -rf $TEMPDIR
}
get_deps "$@"

View File

@ -0,0 +1,61 @@
/**
* @copyright
* ====================================================================
* Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements. See the NOTICE file
* distributed with this work for additional information
* regarding copyright ownership. The ASF licenses this file
* to you under the Apache License, Version 2.0 (the
* "License"); you may not use this file except in compliance
* with the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing,
* software distributed under the License is distributed on an
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
* KIND, either express or implied. See the License for the
* specific language governing permissions and limitations
* under the License.
* ====================================================================
* @endcopyright
*
* @file mod_authz_svn.h
* @brief Subversion authorization extensions for mod_dav_svn
*/
#ifndef MOD_AUTHZ_SVN_H
#define MOD_AUTHZ_SVN_H
#include <httpd.h>
#ifdef __cplusplus
extern "C" {
#endif /* __cplusplus */
/*
* mod_dav_svn to mod_authz_svn bypass mechanism
*/
/** Provider group for subrequest bypass */
#define AUTHZ_SVN__SUBREQ_BYPASS_PROV_GRP "dav2authz_subreq_bypass"
/** Provider name for subrequest bypass */
#define AUTHZ_SVN__SUBREQ_BYPASS_PROV_NAME "mod_authz_svn_subreq_bypass"
/** Provider version for subrequest bypass */
#define AUTHZ_SVN__SUBREQ_BYPASS_PROV_VER "00.00a"
/** Provider to allow mod_dav_svn to bypass the generation of an apache
* request when checking GET access from "mod_dav_svn/auth.c".
*
* Uses @a r @a repos_path and @a repos_name to determine if the user
* making the request is authorized.
*
* If the access is allowed returns @c OK or @c HTTP_FORBIDDEN if it is not.
*/
typedef int (*authz_svn__subreq_bypass_func_t)(request_rec *r,
const char *repos_path,
const char *repos_name);
#ifdef __cplusplus
}
#endif /* __cplusplus */
#endif

View File

@ -0,0 +1,99 @@
/**
* @copyright
* ====================================================================
* Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements. See the NOTICE file
* distributed with this work for additional information
* regarding copyright ownership. The ASF licenses this file
* to you under the Apache License, Version 2.0 (the
* "License"); you may not use this file except in compliance
* with the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing,
* software distributed under the License is distributed on an
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
* KIND, either express or implied. See the License for the
* specific language governing permissions and limitations
* under the License.
* ====================================================================
* @endcopyright
*
* @file mod_dav_svn.h
* @brief Subversion's backend for Apache's mod_dav module
*/
#ifndef MOD_DAV_SVN_H
#define MOD_DAV_SVN_H
#include <httpd.h>
#include <mod_dav.h>
#ifdef __cplusplus
extern "C" {
#endif /* __cplusplus */
/**
Given an apache request @a r, a @a uri, and a @a root_path to the svn
location block, process @a uri and return many things, allocated in
@a r->pool:
- @a cleaned_uri: The uri with duplicate and trailing slashes removed.
- @a trailing_slash: Whether the uri had a trailing slash on it.
Three special substrings of the uri are returned for convenience:
- @a repos_basename: The single path component that is the directory
which contains the repository. (Don't confuse
this with the "repository name" as optionally
defined via the SVNReposName directive!)
- @a relative_path: The remaining imaginary path components.
- @a repos_path: The actual path within the repository filesystem, or
NULL if no part of the uri refers to a path in
the repository (e.g. "!svn/vcc/default" or
"!svn/bln/25").
For example, consider the uri
/svn/repos/proj1/!svn/blah/13//A/B/alpha
In the SVNPath case, this function would receive a @a root_path of
'/svn/repos/proj1', and in the SVNParentPath case would receive a
@a root_path of '/svn/repos'. But either way, we would get back:
- @a cleaned_uri: /svn/repos/proj1/!svn/blah/13/A/B/alpha
- @a repos_basename: proj1
- @a relative_path: /!svn/blah/13/A/B/alpha
- @a repos_path: A/B/alpha
- @a trailing_slash: FALSE
*/
AP_MODULE_DECLARE(dav_error *) dav_svn_split_uri(request_rec *r,
const char *uri,
const char *root_path,
const char **cleaned_uri,
int *trailing_slash,
const char **repos_basename,
const char **relative_path,
const char **repos_path);
/**
* Given an apache request @a r and a @a root_path to the svn location
* block, set @a *repos_path to the path of the repository on disk. */
AP_MODULE_DECLARE(dav_error *) dav_svn_get_repos_path(request_rec *r,
const char *root_path,
const char **repos_path);
#ifdef __cplusplus
}
#endif /* __cplusplus */
#endif /* MOD_DAV_SVN_H */

View File

@ -0,0 +1,4 @@
Header files in this private/ directory are for internal APIs shared
across Subversion's implementation. They are not part of the public
API, nor are they ever copied into or under the include/ directory
(e.g. by the installation process).

View File

@ -0,0 +1,86 @@
/*
* ra_svn_sasl.h : SASL-related declarations shared between the
* ra_svn and svnserve module
*
* ====================================================================
* Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements. See the NOTICE file
* distributed with this work for additional information
* regarding copyright ownership. The ASF licenses this file
* to you under the Apache License, Version 2.0 (the
* "License"); you may not use this file except in compliance
* with the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing,
* software distributed under the License is distributed on an
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
* KIND, either express or implied. See the License for the
* specific language governing permissions and limitations
* under the License.
* ====================================================================
*/
#ifndef RA_SVN_SASL_H
#define RA_SVN_SASL_H
#ifdef WIN32
/* This prevents sasl.h from redefining iovec, which is always defined by APR
on win32. */
#define STRUCT_IOVEC_DEFINED
#include <sasl.h>
#else
#include <sasl/sasl.h>
#endif
#include <apr_errno.h>
#include <apr_pools.h>
#include "svn_error.h"
#include "svn_ra_svn.h"
#include "private/svn_atomic.h"
#ifdef __cplusplus
extern "C" {
#endif /* __cplusplus */
/** The application and service name used for sasl_client_new,
* sasl_server_init, and sasl_server_new. */
#define SVN_RA_SVN_SASL_NAME "svn"
extern volatile svn_atomic_t svn_ra_svn__sasl_status;
/* Initialize secprops with default values. */
void
svn_ra_svn__default_secprops(sasl_security_properties_t *secprops);
/* This function is called by the client and the server before
calling sasl_{client, server}_init, pool is used for allocations. */
svn_error_t *
svn_ra_svn__sasl_common_init(apr_pool_t *pool);
/* Sets local_addrport and remote_addrport to a string containing the
remote and local IP address and port, formatted like this: a.b.c.d;port. */
svn_error_t *
svn_ra_svn__get_addresses(const char **local_addrport,
const char **remote_addrport,
svn_ra_svn_conn_t *conn,
apr_pool_t *pool);
/* If a security layer was negotiated during the authentication exchange,
create an encrypted stream for conn. */
svn_error_t *
svn_ra_svn__enable_sasl_encryption(svn_ra_svn_conn_t *conn,
sasl_conn_t *sasl_ctx,
apr_pool_t *pool);
#ifdef __cplusplus
}
#endif /* __cplusplus */
#endif /* RA_SVN_SASL_H */

View File

@ -0,0 +1,52 @@
/**
* @copyright
* ====================================================================
* Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements. See the NOTICE file
* distributed with this work for additional information
* regarding copyright ownership. The ASF licenses this file
* to you under the Apache License, Version 2.0 (the
* "License"); you may not use this file except in compliance
* with the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing,
* software distributed under the License is distributed on an
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
* KIND, either express or implied. See the License for the
* specific language governing permissions and limitations
* under the License.
* ====================================================================
* @endcopyright
*
* @file svn_adler32.h
* @brief Subversion's take on Adler-32 calculation
*/
#ifndef SVN_ADLER32_H
#define SVN_ADLER32_H
#include <apr.h>
#ifdef __cplusplus
extern "C" {
#endif /* __cplusplus */
/**
* Return an adler32 checksum based on CHECKSUM, updated with
* DATA of size LEN.
*
* @since New in 1.7.
*/
apr_uint32_t
svn__adler32(apr_uint32_t checksum, const char *data, apr_off_t len);
#ifdef __cplusplus
}
#endif /* __cplusplus */
#endif /* SVN_ADLER32_H */

View File

@ -0,0 +1,123 @@
/**
* @copyright
* ====================================================================
* Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements. See the NOTICE file
* distributed with this work for additional information
* regarding copyright ownership. The ASF licenses this file
* to you under the Apache License, Version 2.0 (the
* "License"); you may not use this file except in compliance
* with the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing,
* software distributed under the License is distributed on an
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
* KIND, either express or implied. See the License for the
* specific language governing permissions and limitations
* under the License.
* ====================================================================
* @endcopyright
*
* @file svn_atomic.h
* @brief Macros and functions for atomic operations
*/
#ifndef SVN_ATOMIC_H
#define SVN_ATOMIC_H
#include <apr_version.h>
#include <apr_atomic.h>
#include "svn_error.h"
#include "private/svn_dep_compat.h"
#ifdef __cplusplus
extern "C" {
#endif /* __cplusplus */
/**
* @name Macro definitions for atomic types and operations
*
* @note These are necessary because the apr_atomic API changed somewhat
* between apr-0.x and apr-1.x.
* @{
*/
/** The type used by all the other atomic operations. */
#if APR_VERSION_AT_LEAST(1, 0, 0)
#define svn_atomic_t apr_uint32_t
#else
#define svn_atomic_t apr_atomic_t
#endif
/** Atomically read an #svn_atomic_t from memory. */
#if APR_VERSION_AT_LEAST(1, 0, 0)
#define svn_atomic_read(mem) apr_atomic_read32((mem))
#else
#define svn_atomic_read(mem) apr_atomic_read((mem))
#endif
/** Atomically set an #svn_atomic_t in memory. */
#if APR_VERSION_AT_LEAST(1, 0, 0)
#define svn_atomic_set(mem, val) apr_atomic_set32((mem), (val))
#else
#define svn_atomic_set(mem, val) apr_atomic_set((mem), (val))
#endif
/** Atomically increment an #svn_atomic_t. */
#if APR_VERSION_AT_LEAST(1, 0, 0)
#define svn_atomic_inc(mem) apr_atomic_inc32(mem)
#else
#define svn_atomic_inc(mem) apr_atomic_inc(mem)
#endif
/** Atomically decrement an #svn_atomic_t. */
#if APR_VERSION_AT_LEAST(1, 0, 0)
#define svn_atomic_dec(mem) apr_atomic_dec32(mem)
#else
#define svn_atomic_dec(mem) apr_atomic_dec(mem)
#endif
/**
* Atomic compare-and-swap.
*
* Compare the value that @a mem points to with @a cmp. If they are
* the same swap the value with @a with.
*
* @note svn_atomic_cas should not be combined with the other
* svn_atomic operations. A comment in apr_atomic.h explains
* that on some platforms, the CAS function is implemented in a
* way that is incompatible with the other atomic operations.
*/
#if APR_VERSION_AT_LEAST(1, 0, 0)
#define svn_atomic_cas(mem, with, cmp) \
apr_atomic_cas32((mem), (with), (cmp))
#else
#define svn_atomic_cas(mem, with, cmp) \
apr_atomic_cas((mem), (with), (cmp))
#endif
/** @} */
/**
* Call an initialization function in a thread-safe manner.
*
* @a global_status must be a pointer to a global, zero-initialized
* #svn_atomic_t. @a init_func is a pointer to the function that performs
* the actual initialization. @a baton and and @a pool are passed on to the
* init_func for its use.
*
* @since New in 1.5.
*/
svn_error_t *
svn_atomic__init_once(volatile svn_atomic_t *global_status,
svn_error_t *(*init_func)(void*,apr_pool_t*),
void *baton,
apr_pool_t* pool);
#ifdef __cplusplus
}
#endif /* __cplusplus */
#endif /* SVN_ATOMIC_H */

View File

@ -0,0 +1,220 @@
/**
* @copyright
* ====================================================================
* Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements. See the NOTICE file
* distributed with this work for additional information
* regarding copyright ownership. The ASF licenses this file
* to you under the Apache License, Version 2.0 (the
* "License"); you may not use this file except in compliance
* with the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing,
* software distributed under the License is distributed on an
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
* KIND, either express or implied. See the License for the
* specific language governing permissions and limitations
* under the License.
* ====================================================================
* @endcopyright
*
* @file svn_auth_private.h
* @brief Subversion's authentication system - Internal routines
*/
#ifndef SVN_AUTH_PRIVATE_H
#define SVN_AUTH_PRIVATE_H
#include <apr_pools.h>
#include <apr_hash.h>
#include "svn_types.h"
#include "svn_error.h"
#ifdef __cplusplus
extern "C" {
#endif /* __cplusplus */
/* If you add a password type for a provider which stores
* passwords on disk in encrypted form, remember to update
* svn_auth__simple_save_creds_helper. Otherwise it will be
* assumed that your provider stores passwords in plaintext. */
#define SVN_AUTH__SIMPLE_PASSWORD_TYPE "simple"
#define SVN_AUTH__WINCRYPT_PASSWORD_TYPE "wincrypt"
#define SVN_AUTH__KEYCHAIN_PASSWORD_TYPE "keychain"
#define SVN_AUTH__KWALLET_PASSWORD_TYPE "kwallet"
#define SVN_AUTH__GNOME_KEYRING_PASSWORD_TYPE "gnome-keyring"
#define SVN_AUTH__GPG_AGENT_PASSWORD_TYPE "gpg-agent"
/* A function that stores in *PASSWORD (potentially after decrypting it)
the user's password. It might be obtained directly from CREDS, or
from an external store, using REALMSTRING and USERNAME as keys.
(The behavior is undefined if REALMSTRING or USERNAME are NULL.)
If NON_INTERACTIVE is set, the user must not be involved in the
retrieval process. Set *DONE to TRUE if a password was stored
in *PASSWORD, to FALSE otherwise. POOL is used for any necessary
allocation. */
typedef svn_error_t * (*svn_auth__password_get_t)
(svn_boolean_t *done,
const char **password,
apr_hash_t *creds,
const char *realmstring,
const char *username,
apr_hash_t *parameters,
svn_boolean_t non_interactive,
apr_pool_t *pool);
/* A function that stores PASSWORD (or some encrypted version thereof)
either directly in CREDS, or externally using REALMSTRING and USERNAME
as keys into the external store. If NON_INTERACTIVE is set, the user
must not be involved in the storage process. Set *DONE to TRUE if the
password was store, to FALSE otherwise. POOL is used for any necessary
allocation. */
typedef svn_error_t * (*svn_auth__password_set_t)
(svn_boolean_t *done,
apr_hash_t *creds,
const char *realmstring,
const char *username,
const char *password,
apr_hash_t *parameters,
svn_boolean_t non_interactive,
apr_pool_t *pool);
/* Use PARAMETERS and REALMSTRING to set *CREDENTIALS to a set of
pre-cached authentication credentials pulled from the simple
credential cache store identified by PASSTYPE. PASSWORD_GET is
used to obtain the password value. Allocate *CREDENTIALS from
POOL.
NOTE: This function is a common implementation of code used by
several of the simple credential providers (the default disk cache
mechanism, Windows CryptoAPI, GNOME Keyring, etc.), typically in
their "first_creds" implementation. */
svn_error_t *
svn_auth__simple_creds_cache_get(void **credentials,
void **iter_baton,
void *provider_baton,
apr_hash_t *parameters,
const char *realmstring,
svn_auth__password_get_t password_get,
const char *passtype,
apr_pool_t *pool);
/* Use PARAMETERS and REALMSTRING to save CREDENTIALS in the simple
credential cache store identified by PASSTYPE. PASSWORD_SET is
used to do the actual storage. Use POOL for necessary allocations.
Set *SAVED according to whether or not the credentials were
successfully stored.
NOTE: This function is a common implementation of code used by
several of the simple credential providers (the default disk cache
mechanism, Windows CryptoAPI, GNOME Keyring, etc.) typically in
their "save_creds" implementation. */
svn_error_t *
svn_auth__simple_creds_cache_set(svn_boolean_t *saved,
void *credentials,
void *provider_baton,
apr_hash_t *parameters,
const char *realmstring,
svn_auth__password_set_t password_set,
const char *passtype,
apr_pool_t *pool);
/* Implementation of svn_auth__password_get_t that retrieves
the plaintext password from CREDS when USERNAME matches the stored
credentials. */
svn_error_t *
svn_auth__simple_password_get(svn_boolean_t *done,
const char **password,
apr_hash_t *creds,
const char *realmstring,
const char *username,
apr_hash_t *parameters,
svn_boolean_t non_interactive,
apr_pool_t *pool);
/* Implementation of svn_auth__password_set_t that stores
the plaintext password in CREDS. */
svn_error_t *
svn_auth__simple_password_set(svn_boolean_t *done,
apr_hash_t *creds,
const char *realmstring,
const char *username,
const char *password,
apr_hash_t *parameters,
svn_boolean_t non_interactive,
apr_pool_t *pool);
/* Use PARAMETERS and REALMSTRING to set *CREDENTIALS to a set of
pre-cached authentication credentials pulled from the SSL client
certificate passphrase credential cache store identified by
PASSTYPE. PASSPHRASE_GET is used to obtain the passphrase value.
Allocate *CREDENTIALS from POOL.
NOTE: This function is a common implementation of code used by
several of the ssl client passphrase credential providers (the
default disk cache mechanism, Windows CryptoAPI, GNOME Keyring,
etc.), typically in their "first_creds" implementation. */
svn_error_t *
svn_auth__ssl_client_cert_pw_cache_get(void **credentials,
void **iter_baton,
void *provider_baton,
apr_hash_t *parameters,
const char *realmstring,
svn_auth__password_get_t passphrase_get,
const char *passtype,
apr_pool_t *pool);
/* Use PARAMETERS and REALMSTRING to save CREDENTIALS in the SSL
client certificate passphrase credential cache store identified by
PASSTYPE. PASSPHRASE_SET is used to do the actual storage. Use
POOL for necessary allocations. Set *SAVED according to whether or
not the credentials were successfully stored.
NOTE: This function is a common implementation of code used by
several of the simple credential providers (the default disk cache
mechanism, Windows CryptoAPI, GNOME Keyring, etc.) typically in
their "save_creds" implementation. */
svn_error_t *
svn_auth__ssl_client_cert_pw_cache_set(svn_boolean_t *saved,
void *credentials,
void *provider_baton,
apr_hash_t *parameters,
const char *realmstring,
svn_auth__password_set_t passphrase_set,
const char *passtype,
apr_pool_t *pool);
/* This implements the svn_auth__password_get_t interface.
Set **PASSPHRASE to the plaintext passphrase retrieved from CREDS;
ignore other parameters. */
svn_error_t *
svn_auth__ssl_client_cert_pw_get(svn_boolean_t *done,
const char **passphrase,
apr_hash_t *creds,
const char *realmstring,
const char *username,
apr_hash_t *parameters,
svn_boolean_t non_interactive,
apr_pool_t *pool);
/* This implements the svn_auth__password_set_t interface.
Store PASSPHRASE in CREDS; ignore other parameters. */
svn_error_t *
svn_auth__ssl_client_cert_pw_set(svn_boolean_t *done,
apr_hash_t *creds,
const char *realmstring,
const char *username,
const char *passphrase,
apr_hash_t *parameters,
svn_boolean_t non_interactive,
apr_pool_t *pool);
#ifdef __cplusplus
}
#endif /* __cplusplus */
#endif /* SVN_AUTH_PRIVATE_H */

View File

@ -0,0 +1,486 @@
/**
* @copyright
* ====================================================================
* Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements. See the NOTICE file
* distributed with this work for additional information
* regarding copyright ownership. The ASF licenses this file
* to you under the Apache License, Version 2.0 (the
* "License"); you may not use this file except in compliance
* with the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing,
* software distributed under the License is distributed on an
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
* KIND, either express or implied. See the License for the
* specific language governing permissions and limitations
* under the License.
* ====================================================================
* @endcopyright
*
* @file svn_cache.h
* @brief In-memory cache implementation.
*/
#ifndef SVN_CACHE_H
#define SVN_CACHE_H
#include <apr_pools.h>
#include <apr_hash.h>
#include "svn_types.h"
#include "svn_error.h"
#include "svn_iter.h"
#include "svn_config.h"
#include "svn_string.h"
#ifdef __cplusplus
extern "C" {
#endif /* __cplusplus */
/**
* @defgroup svn_cache__support In-memory caching
* @{
*/
/**
* A function type for deserializing an object @a *out from the string
* @a data of length @a data_len into @a result_pool. It is legal and
* generally suggested that the deserialization will be done in-place,
* i.e. modify @a data directly and return it in @a *out.
*/
typedef svn_error_t *(*svn_cache__deserialize_func_t)(void **out,
void *data,
apr_size_t data_len,
apr_pool_t *result_pool);
/**
* A function type for deserializing an object @a *out from the string
* @a data of length @a data_len into @a result_pool. The extra information
* @a baton passed into can be used to deserialize only a specific part or
* sub-structure or to perform any other non-modifying operation that may
* not require the whole structure to be processed.
*/
typedef svn_error_t *(*svn_cache__partial_getter_func_t)(void **out,
const void *data,
apr_size_t data_len,
void *baton,
apr_pool_t *result_pool);
/**
* A function type for modifying an already deserialized in the @a *data
* buffer of length @a *data_len. Additional information of the modification
* to do will be provided in @a baton. The function may change the size of
* data buffer and may re-allocate it if necessary. In that case, the new
* values must be passed back in @a *data_len and @a *data, respectively.
* Allocations will be done from @a result_pool.
*/
typedef svn_error_t *(*svn_cache__partial_setter_func_t)(void **data,
apr_size_t *data_len,
void *baton,
apr_pool_t *result_pool);
/**
* A function type for serializing an object @a in into bytes. The
* function should allocate the serialized value in @a result_pool, set
* @a *data to the serialized value, and set @a *data_len to its length.
*/
typedef svn_error_t *(*svn_cache__serialize_func_t)(void **data,
apr_size_t *data_len,
void *in,
apr_pool_t *result_pool);
/**
* A function type for transforming or ignoring errors. @a scratch_pool may
* be used for temporary allocations.
*/
typedef svn_error_t *(*svn_cache__error_handler_t)(svn_error_t *err,
void *baton,
apr_pool_t *scratch_pool);
/**
* A wrapper around apr_memcache_t, provided essentially so that the
* Subversion public API doesn't depend on whether or not you have
* access to the APR memcache libraries.
*/
typedef struct svn_memcache_t svn_memcache_t;
/**
* An opaque structure representing a membuffer cache object.
*/
typedef struct svn_membuffer_t svn_membuffer_t;
/**
* Opaque type for an in-memory cache.
*/
typedef struct svn_cache__t svn_cache__t;
/**
* A structure containing typical statistics about a given cache instance.
* Use svn_cache__get_info() to get this data. Note that not all types
* of caches will be able to report complete and correct information.
*/
typedef struct svn_cache__info_t
{
/** A string identifying the cache instance. Usually a copy of the @a id
* or @a prefix parameter passed to the cache constructor.
*/
const char* id;
/** Number of getter calls (svn_cache__get() or svn_cache__get()).
*/
apr_uint64_t gets;
/** Number of getter calls that return data.
*/
apr_uint64_t hits;
/** Number of setter calls (svn_cache__set()).
*/
apr_uint64_t sets;
/** Number of function calls that returned an error.
*/
apr_uint64_t failures;
/** Size of the data currently stored in the cache.
* May be 0 if that information is not available.
*/
apr_uint64_t used_size;
/** Amount of memory currently reserved for cached data.
* Will be equal to @a used_size if no precise information is available.
*/
apr_uint64_t data_size;
/** Lower threshold of the total size of memory allocated to the cache and
* its index as well as management structures. The actual memory allocated
* by the cache may be larger.
*/
apr_uint64_t total_size;
/** Number of cache entries.
* May be 0 if that information is not available.
*/
apr_uint64_t used_entries;
/** Maximum numbers of cache entries.
* May be 0 if that information is not available.
*/
apr_uint64_t total_entries;
} svn_cache__info_t;
/**
* Creates a new cache in @a *cache_p. This cache will use @a pool
* for all of its storage needs. The elements in the cache will be
* indexed by keys of length @a klen, which may be APR_HASH_KEY_STRING
* if they are strings. Cached values will be copied in and out of
* the cache using @a serialize_func and @a deserialize_func, respectively.
*
* The cache stores up to @a pages * @a items_per_page items at a
* time. The exact cache invalidation strategy is not defined here,
* but in general, a lower value for @a items_per_page means more
* memory overhead for the same number of items, but a higher value
* for @a items_per_page means more items are cleared at once. Both
* @a pages and @a items_per_page must be positive (though they both
* may certainly be 1).
*
* If @a thread_safe is true, and APR is compiled with threads, all
* accesses to the cache will be protected with a mutex. The @a id
* is a purely user-visible information that will allow coders to
* identify this cache instance in a #svn_cache__info_t struct.
* It does not influence the behavior of the cache itself.
*
* Note that NULL is a legitimate value for cache entries (and
* @a serialize_func will not be called on it).
*
* It is not safe for @a serialize_func nor @a deserialize_func to
* interact with the cache itself.
*/
svn_error_t *
svn_cache__create_inprocess(svn_cache__t **cache_p,
svn_cache__serialize_func_t serialize_func,
svn_cache__deserialize_func_t deserialize_func,
apr_ssize_t klen,
apr_int64_t pages,
apr_int64_t items_per_page,
svn_boolean_t thread_safe,
const char *id,
apr_pool_t *pool);
/**
* Creates a new cache in @a *cache_p, communicating to a memcached
* process via @a memcache. The elements in the cache will be indexed
* by keys of length @a klen, which may be APR_HASH_KEY_STRING if they
* are strings. Values will be serialized for memcached using @a
* serialize_func and deserialized using @a deserialize_func. Because
* the same memcached server may cache many different kinds of values,
* @a prefix should be specified to differentiate this cache from
* other caches. @a *cache_p will be allocated in @a result_pool.
*
* If @a deserialize_func is NULL, then the data is returned as an
* svn_string_t; if @a serialize_func is NULL, then the data is
* assumed to be an svn_stringbuf_t.
*
* These caches are always thread safe.
*
* These caches do not support svn_cache__iter.
*
* If Subversion was not built with apr_memcache support, always
* raises SVN_ERR_NO_APR_MEMCACHE.
*/
svn_error_t *
svn_cache__create_memcache(svn_cache__t **cache_p,
svn_memcache_t *memcache,
svn_cache__serialize_func_t serialize_func,
svn_cache__deserialize_func_t deserialize_func,
apr_ssize_t klen,
const char *prefix,
apr_pool_t *result_pool);
/**
* Given @a config, returns an APR memcached interface in @a
* *memcache_p allocated in @a result_pool if @a config contains entries in
* the SVN_CACHE_CONFIG_CATEGORY_MEMCACHED_SERVERS section describing
* memcached servers; otherwise, sets @a *memcache_p to NULL.
*
* If Subversion was not built with apr_memcache_support, then raises
* SVN_ERR_NO_APR_MEMCACHE if and only if @a config is configured to
* use memcache.
*/
svn_error_t *
svn_cache__make_memcache_from_config(svn_memcache_t **memcache_p,
svn_config_t *config,
apr_pool_t *result_pool);
/**
* Creates a new membuffer cache object in @a *cache. It will contain
* up to @a total_size bytes of data, using @a directory_size bytes
* for index information and the remainder for serialized objects.
*
* Since each index entry is about 50 bytes long, 1 to 10 percent of
* the @a total_size should be allocated to the @a directory_size,
* depending on the average serialized object size. Higher percentages
* will generally result in higher hit rates and reduced conflict
* resolution overhead.
*
* The cache will be split into @a segment_count segments of equal size.
* A higher number reduces lock contention but also limits the maximum
* cachable item size. If it is not a power of two, it will be rounded
* down to next lower power of two. Also, there is an implementation
* specific upper limit and the setting will be capped there automatically.
* If the number is 0, a default will be derived from @a total_size.
*
* If access to the resulting cache object is guaranteed to be serialized,
* @a thread_safe may be set to @c FALSE for maximum performance.
*
* There is no limit on the number of threads reading a given cache segment
* concurrently. Writes, however, need an exclusive lock on the respective
* segment. @a allow_blocking_writes controls contention is handled here.
* If set to TRUE, writes will wait until the lock becomes available, i.e.
* reads should be short. If set to FALSE, write attempts will be ignored
* (no data being written to the cache) if some reader or another writer
* currently holds the segment lock.
*
* Allocations will be made in @a result_pool, in particular the data buffers.
*/
svn_error_t *
svn_cache__membuffer_cache_create(svn_membuffer_t **cache,
apr_size_t total_size,
apr_size_t directory_size,
apr_size_t segment_count,
svn_boolean_t thread_safe,
svn_boolean_t allow_blocking_writes,
apr_pool_t *result_pool);
/**
* Creates a new cache in @a *cache_p, storing the data in a potentially
* shared @a membuffer object. The elements in the cache will be indexed
* by keys of length @a klen, which may be APR_HASH_KEY_STRING if they
* are strings. Values will be serialized for the memcache using @a
* serialize_func and deserialized using @a deserialize_func. Because
* the same memcache object may cache many different kinds of values
* form multiple caches, @a prefix should be specified to differentiate
* this cache from other caches. @a *cache_p will be allocated in @a result_pool.
*
* If @a deserialize_func is NULL, then the data is returned as an
* svn_string_t; if @a serialize_func is NULL, then the data is
* assumed to be an svn_stringbuf_t.
*
* If @a thread_safe is true, and APR is compiled with threads, all
* accesses to the cache will be protected with a mutex, if the shared
* @a memcache has also been created with thread_safe flag set.
*
* These caches do not support svn_cache__iter.
*/
svn_error_t *
svn_cache__create_membuffer_cache(svn_cache__t **cache_p,
svn_membuffer_t *membuffer,
svn_cache__serialize_func_t serialize,
svn_cache__deserialize_func_t deserialize,
apr_ssize_t klen,
const char *prefix,
svn_boolean_t thread_safe,
apr_pool_t *result_pool);
/**
* Sets @a handler to be @a cache's error handling routine. If any
* error is returned from a call to svn_cache__get or svn_cache__set, @a
* handler will be called with @a baton and the error, and the
* original function will return whatever error @a handler returns
* instead (possibly SVN_NO_ERROR); @a handler will receive the pool
* passed to the svn_cache_* function. @a scratch_pool is used for temporary
* allocations.
*/
svn_error_t *
svn_cache__set_error_handler(svn_cache__t *cache,
svn_cache__error_handler_t handler,
void *baton,
apr_pool_t *scratch_pool);
/**
* Returns @c TRUE if the @a cache supports objects of the given @a size.
* There is no guarantee, that svn_cache__set() will actually store the
* respective object in that case. However, a @c FALSE return value indicates
* that an attempt to cache the item will either fail or impair the overall
* cache performance. @c FALSE will also be returned if @a cache is @c NULL.
*/
svn_boolean_t
svn_cache__is_cachable(svn_cache__t *cache,
apr_size_t size);
#define SVN_CACHE_CONFIG_CATEGORY_MEMCACHED_SERVERS "memcached-servers"
/**
* Fetches a value indexed by @a key from @a cache into @a *value,
* setting @a *found to TRUE iff it is in the cache and FALSE if it is
* not found. @a key may be NULL in which case @a *found will be
* FALSE. The value is copied into @a result_pool using the deserialize
* function provided to the cache's constructor.
*/
svn_error_t *
svn_cache__get(void **value,
svn_boolean_t *found,
svn_cache__t *cache,
const void *key,
apr_pool_t *result_pool);
/**
* Stores the value @a value under the key @a key in @a cache. Uses @a
* scratch_pool for temporary allocations. The cache makes copies of
* @a key and @a value if necessary (that is, @a key and @a value may
* have shorter lifetimes than the cache). @a key may be NULL in which
* case the cache will remain unchanged.
*
* If there is already a value for @a key, this will replace it. Bear
* in mind that in some circumstances this may leak memory (that is,
* the cache's copy of the previous value may not be immediately
* cleared); it is only guaranteed to not leak for caches created with
* @a items_per_page equal to 1.
*/
svn_error_t *
svn_cache__set(svn_cache__t *cache,
const void *key,
void *value,
apr_pool_t *scratch_pool);
/**
* Iterates over the elements currently in @a cache, calling @a func
* for each one until there are no more elements or @a func returns an
* error. Uses @a scratch_pool for temporary allocations.
*
* If @a completed is not NULL, then on return - if @a func returns no
* errors - @a *completed will be set to @c TRUE.
*
* If @a func returns an error other than @c SVN_ERR_ITER_BREAK, that
* error is returned. When @a func returns @c SVN_ERR_ITER_BREAK,
* iteration is interrupted, but no error is returned and @a
* *completed is set to @c FALSE. (The error handler set by
* svn_cache__set_error_handler is not used for svn_cache__iter.)
*
* It is not legal to perform any other cache operations on @a cache
* inside @a func.
*
* svn_cache__iter is not supported by all cache implementations; see
* the svn_cache__create_* function for details.
*/
svn_error_t *
svn_cache__iter(svn_boolean_t *completed,
svn_cache__t *cache,
svn_iter_apr_hash_cb_t func,
void *baton,
apr_pool_t *scratch_pool);
/**
* Similar to svn_cache__get() but will call a specific de-serialization
* function @a func. @a found will be set depending on whether the @a key
* has been found. Even if that reports @c TRUE, @a value may still return
* a @c NULL pointer depending on the logic inside @a func. For a @a NULL
* @a key, no data will be found. @a value will be allocated in
* @a result_pool.
*/
svn_error_t *
svn_cache__get_partial(void **value,
svn_boolean_t *found,
svn_cache__t *cache,
const void *key,
svn_cache__partial_getter_func_t func,
void *baton,
apr_pool_t *result_pool);
/**
* Find the item identified by @a key in the @a cache. If it has been found,
* call @a func for it and @a baton to potentially modify the data. Changed
* data will be written back to the cache. If the item cannot be found,
* or if @a key is NULL, @a func does not get called. @a scratch_pool is
* used for temporary allocations.
*/
svn_error_t *
svn_cache__set_partial(svn_cache__t *cache,
const void *key,
svn_cache__partial_setter_func_t func,
void *baton,
apr_pool_t *scratch_pool);
/**
* Collect all available usage statistics on the cache instance @a cache
* and write the data into @a info. If @a reset has been set, access
* counters will be reset right after copying the statistics info.
* @a result_pool will be used for allocations.
*/
svn_error_t *
svn_cache__get_info(svn_cache__t *cache,
svn_cache__info_t *info,
svn_boolean_t reset,
apr_pool_t *result_pool);
/**
* Return the information given in @a info formatted as a multi-line string.
* Allocations take place in @a result_pool.
*/
svn_string_t *
svn_cache__format_info(const svn_cache__info_t *info,
apr_pool_t *result_pool);
/* Access the process-global (singleton) membuffer cache. The first call
* will automatically allocate the cache using the current cache config.
* NULL will be returned if the desired cache size is 0.
*
* @since New in 1.7.
*/
struct svn_membuffer_t *
svn_cache__get_global_membuffer_cache(void);
/** @} */
#ifdef __cplusplus
}
#endif /* __cplusplus */
#endif /* SVN_CACHE_H */

View File

@ -0,0 +1,299 @@
/**
* @copyright
* ====================================================================
* Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements. See the NOTICE file
* distributed with this work for additional information
* regarding copyright ownership. The ASF licenses this file
* to you under the Apache License, Version 2.0 (the
* "License"); you may not use this file except in compliance
* with the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing,
* software distributed under the License is distributed on an
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
* KIND, either express or implied. See the License for the
* specific language governing permissions and limitations
* under the License.
* ====================================================================
* @endcopyright
*
* @file svn_client_private.h
* @brief Subversion-internal client APIs.
*/
#ifndef SVN_CLIENT_PRIVATE_H
#define SVN_CLIENT_PRIVATE_H
#include <apr_pools.h>
#include "svn_ra.h"
#include "svn_client.h"
#include "svn_types.h"
#ifdef __cplusplus
extern "C" {
#endif /* __cplusplus */
/* Return true if KIND is a revision kind that is dependent on the working
* copy. Otherwise, return false. */
#define SVN_CLIENT__REVKIND_NEEDS_WC(kind) \
((kind) == svn_opt_revision_base || \
(kind) == svn_opt_revision_previous || \
(kind) == svn_opt_revision_working || \
(kind) == svn_opt_revision_committed) \
/* Return true if KIND is a revision kind that the WC can supply without
* contacting the repository. Otherwise, return false. */
#define SVN_CLIENT__REVKIND_IS_LOCAL_TO_WC(kind) \
((kind) == svn_opt_revision_base || \
(kind) == svn_opt_revision_working || \
(kind) == svn_opt_revision_committed)
/* A location in a repository. */
typedef struct svn_client__pathrev_t
{
const char *repos_root_url;
const char *repos_uuid;
svn_revnum_t rev;
const char *url;
} svn_client__pathrev_t;
/* Return a new path-rev structure, allocated in RESULT_POOL,
* initialized with deep copies of REPOS_ROOT_URL, REPOS_UUID, REV and URL. */
svn_client__pathrev_t *
svn_client__pathrev_create(const char *repos_root_url,
const char *repos_uuid,
svn_revnum_t rev,
const char *url,
apr_pool_t *result_pool);
/* Return a new path-rev structure, allocated in RESULT_POOL,
* initialized with deep copies of REPOS_ROOT_URL, REPOS_UUID, and REV,
* and using the repository-relative RELPATH to construct the URL. */
svn_client__pathrev_t *
svn_client__pathrev_create_with_relpath(const char *repos_root_url,
const char *repos_uuid,
svn_revnum_t rev,
const char *relpath,
apr_pool_t *result_pool);
/* Set *PATHREV_P to a new path-rev structure, allocated in RESULT_POOL,
* initialized with deep copies of the repository root URL and UUID from
* RA_SESSION, and of REV and URL. */
svn_error_t *
svn_client__pathrev_create_with_session(svn_client__pathrev_t **pathrev_p,
svn_ra_session_t *ra_session,
svn_revnum_t rev,
const char *url,
apr_pool_t *result_pool);
/* Return a deep copy of PATHREV, allocated in RESULT_POOL. */
svn_client__pathrev_t *
svn_client__pathrev_dup(const svn_client__pathrev_t *pathrev,
apr_pool_t *result_pool);
/* Return a deep copy of PATHREV, with a URI-encoded representation of
* RELPATH joined on to the URL. Allocate the result in RESULT_POOL. */
svn_client__pathrev_t *
svn_client__pathrev_join_relpath(const svn_client__pathrev_t *pathrev,
const char *relpath,
apr_pool_t *result_pool);
/* Return the repository-relative relpath of PATHREV. */
const char *
svn_client__pathrev_relpath(const svn_client__pathrev_t *pathrev,
apr_pool_t *result_pool);
/* Return the repository-relative fspath of PATHREV. */
const char *
svn_client__pathrev_fspath(const svn_client__pathrev_t *pathrev,
apr_pool_t *result_pool);
/* Given PATH_OR_URL, which contains either a working copy path or an
absolute URL, a peg revision PEG_REVISION, and a desired revision
REVISION, create an RA connection to that object as it exists in
that revision, following copy history if necessary. If REVISION is
younger than PEG_REVISION, then PATH_OR_URL will be checked to see
that it is the same node in both PEG_REVISION and REVISION. If it
is not, then @c SVN_ERR_CLIENT_UNRELATED_RESOURCES is returned.
BASE_DIR_ABSPATH is the working copy path the ra_session corresponds
to. If provided it will be used to read and dav props. So if provided
this directory MUST match the session anchor.
If PEG_REVISION->kind is 'unspecified', the peg revision is 'head'
for a URL or 'working' for a WC path. If REVISION->kind is
'unspecified', the operative revision is the peg revision.
Store the resulting ra_session in *RA_SESSION_P. Store the final
resolved location of the object in *RESOLVED_LOC_P. RESOLVED_LOC_P
may be NULL if not wanted.
Use authentication baton cached in CTX to authenticate against the
repository.
Use POOL for all allocations. */
svn_error_t *
svn_client__ra_session_from_path2(svn_ra_session_t **ra_session_p,
svn_client__pathrev_t **resolved_loc_p,
const char *path_or_url,
const char *base_dir_abspath,
const svn_opt_revision_t *peg_revision,
const svn_opt_revision_t *revision,
svn_client_ctx_t *ctx,
apr_pool_t *pool);
/* Given PATH_OR_URL, which contains either a working copy path or an
absolute URL, a peg revision PEG_REVISION, and a desired revision
REVISION, find the path at which that object exists in REVISION,
following copy history if necessary. If REVISION is younger than
PEG_REVISION, then check that PATH_OR_URL is the same node in both
PEG_REVISION and REVISION, and return @c
SVN_ERR_CLIENT_UNRELATED_RESOURCES if it is not the same node.
If PEG_REVISION->kind is 'unspecified', the peg revision is 'head'
for a URL or 'working' for a WC path. If REVISION->kind is
'unspecified', the operative revision is the peg revision.
Store the actual location of the object in *RESOLVED_LOC_P.
RA_SESSION should be an open RA session pointing at the URL of
PATH_OR_URL, or NULL, in which case this function will open its own
temporary session.
Use authentication baton cached in CTX to authenticate against the
repository.
Use POOL for all allocations. */
svn_error_t *
svn_client__resolve_rev_and_url(svn_client__pathrev_t **resolved_loc_p,
svn_ra_session_t *ra_session,
const char *path_or_url,
const svn_opt_revision_t *peg_revision,
const svn_opt_revision_t *revision,
svn_client_ctx_t *ctx,
apr_pool_t *pool);
/** Return @c SVN_ERR_ILLEGAL_TARGET if TARGETS contains a mixture of
* URLs and paths; otherwise return SVN_NO_ERROR.
*
* @since New in 1.7.
*/
svn_error_t *
svn_client__assert_homogeneous_target_type(const apr_array_header_t *targets);
/* Create a svn_client_status_t structure *CST for LOCAL_ABSPATH, shallow
* copying data from *STATUS wherever possible and retrieving the other values
* where needed. Perform temporary allocations in SCRATCH_POOL and allocate the
* result in RESULT_POOL
*/
svn_error_t *
svn_client__create_status(svn_client_status_t **cst,
svn_wc_context_t *wc_ctx,
const char *local_abspath,
const svn_wc_status3_t *status,
apr_pool_t *result_pool,
apr_pool_t *scratch_pool);
/* Set *ANCESTOR_URL and *ANCESTOR_REVISION to the URL and revision,
* respectively, of the youngest common ancestor of the two locations
* PATH_OR_URL1@REV1 and PATH_OR_URL2@REV2. Set *ANCESTOR_RELPATH to
* NULL and *ANCESTOR_REVISION to SVN_INVALID_REVNUM if they have no
* common ancestor. This function assumes that PATH_OR_URL1@REV1 and
* PATH_OR_URL2@REV2 both refer to the same repository.
*
* Use the authentication baton cached in CTX to authenticate against
* the repository.
*
* See also svn_client__get_youngest_common_ancestor().
*/
svn_error_t *
svn_client__youngest_common_ancestor(const char **ancestor_url,
svn_revnum_t *ancestor_rev,
const char *path_or_url1,
const svn_opt_revision_t *revision1,
const char *path_or_url2,
const svn_opt_revision_t *revision2,
svn_client_ctx_t *ctx,
apr_pool_t *result_pool,
apr_pool_t *scratch_pool);
/* Get the repository location of the base node at LOCAL_ABSPATH.
*
* A pathrev_t wrapper around svn_wc__node_get_base().
*
* Set *BASE_P to the location that this node was checked out at or last
* updated/switched to, regardless of any uncommitted changes (delete,
* replace and/or copy-here/move-here).
*
* If there is no base node at LOCAL_ABSPATH (such as when there is a
* locally added/copied/moved-here node that is not part of a replace),
* set *BASE_P to NULL.
*/
svn_error_t *
svn_client__wc_node_get_base(svn_client__pathrev_t **base_p,
const char *wc_abspath,
svn_wc_context_t *wc_ctx,
apr_pool_t *result_pool,
apr_pool_t *scratch_pool);
/* Get the original location of the WC node at LOCAL_ABSPATH.
*
* A pathrev_t wrapper around svn_wc__node_get_origin().
*
* Set *ORIGIN_P to the origin of the WC node at WC_ABSPATH. If the node
* is a local copy, give the copy-from location. If the node is locally
* added or deleted, set *ORIGIN_P to NULL.
*/
svn_error_t *
svn_client__wc_node_get_origin(svn_client__pathrev_t **origin_p,
const char *wc_abspath,
svn_client_ctx_t *ctx,
apr_pool_t *result_pool,
apr_pool_t *scratch_pool);
/* Produce a diff with depth DEPTH between two files or two directories at
* LOCAL_ABSPATH1 and LOCAL_ABSPATH2, using the provided diff callbacks to
* show changes in files. The files and directories involved may be part of
* a working copy or they may be unversioned. For versioned files, show
* property changes, too. */
svn_error_t *
svn_client__arbitrary_nodes_diff(const char *local_abspath1,
const char *local_abspath2,
svn_depth_t depth,
const svn_wc_diff_callbacks4_t *callbacks,
void *callback_baton,
svn_client_ctx_t *ctx,
apr_pool_t *scratch_pool);
/* Copy the file or directory on URL in some repository to DST_ABSPATH,
* copying node information and properties. Resolve URL using PEG_REV and
* REVISION.
*
* If URL specifies a directory, create the copy using depth DEPTH.
*
* If MAKE_PARENTS is TRUE and DST_ABSPATH doesn't have an added parent
* create missing parent directories
*/
svn_error_t *
svn_client__copy_foreign(const char *url,
const char *dst_abspath,
svn_opt_revision_t *peg_revision,
svn_opt_revision_t *revision,
svn_depth_t depth,
svn_boolean_t make_parents,
svn_boolean_t already_locked,
svn_client_ctx_t *ctx,
apr_pool_t *scratch_pool);
#ifdef __cplusplus
}
#endif /* __cplusplus */
#endif /* SVN_CLIENT_PRIVATE_H */

View File

@ -0,0 +1,228 @@
/**
* @copyright
* ====================================================================
* Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements. See the NOTICE file
* distributed with this work for additional information
* regarding copyright ownership. The ASF licenses this file
* to you under the Apache License, Version 2.0 (the
* "License"); you may not use this file except in compliance
* with the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing,
* software distributed under the License is distributed on an
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
* KIND, either express or implied. See the License for the
* specific language governing permissions and limitations
* under the License.
* ====================================================================
* @endcopyright
*
* @file svn_cmdline_private.h
* @brief Private functions for Subversion cmdline.
*/
#ifndef SVN_CMDLINE_PRIVATE_H
#define SVN_CMDLINE_PRIVATE_H
#include <apr_pools.h>
#include <apr_hash.h>
#include "svn_string.h"
#include "svn_error.h"
#include "svn_io.h"
#ifdef __cplusplus
extern "C" {
#endif /* __cplusplus */
/** Write a property as an XML element into @a *outstr.
*
* If @a outstr is NULL, allocate @a *outstr in @a pool; else append to
* @a *outstr, allocating in @a outstr's pool
*
* @a propname is the property name. @a propval is the property value, which
* will be encoded if it contains unsafe bytes.
*
* If @a inherited_prop is TRUE then @a propname is an inherited property,
* otherwise @a propname is an explicit property.
*/
void
svn_cmdline__print_xml_prop(svn_stringbuf_t **outstr,
const char *propname,
svn_string_t *propval,
svn_boolean_t inherited_prop,
apr_pool_t *pool);
/** An implementation of @c svn_auth_gnome_keyring_unlock_prompt_func_t that
* prompts the user for default GNOME Keyring password.
*
* Expects a @c svn_cmdline_prompt_baton2_t to be passed as @a baton.
*
* @since New in 1.6.
*/
svn_error_t *
svn_cmdline__auth_gnome_keyring_unlock_prompt(char **keyring_password,
const char *keyring_name,
void *baton,
apr_pool_t *pool);
/** Container for config options parsed with svn_cmdline__parse_config_option
*
* @since New in 1.7.
*/
typedef struct svn_cmdline__config_argument_t
{
const char *file;
const char *section;
const char *option;
const char *value;
} svn_cmdline__config_argument_t;
/** Parser for 'FILE:SECTION:OPTION=[VALUE]'-style option arguments.
*
* Parses @a opt_arg and places its value in @a config_options, an apr array
* containing svn_cmdline__config_argument_t* elements, allocating the option
* data in @a pool
*
* @since New in 1.7.
*/
svn_error_t *
svn_cmdline__parse_config_option(apr_array_header_t *config_options,
const char *opt_arg,
apr_pool_t *pool);
/** Sets the config options in @a config_options, an apr array containing
* @c svn_cmdline__config_argument_t* elements, to the configuration in @a cfg,
* a hash mapping of <tt>const char *</tt> configuration file names to
* @c svn_config_t *'s. Write warnings to stderr.
*
* Use @a prefix as prefix and @a argument_name in warning messages.
*
* @since New in 1.7.
*/
svn_error_t *
svn_cmdline__apply_config_options(apr_hash_t *config,
const apr_array_header_t *config_options,
const char *prefix,
const char *argument_name);
/* Return a string allocated in POOL that is a copy of STR but with each
* line prefixed with INDENT. A line is all characters up to the first
* CR-LF, LF-CR, CR or LF, or the end of STR if sooner. */
const char *
svn_cmdline__indent_string(const char *str,
const char *indent,
apr_pool_t *pool);
/* Print to stdout a hash PROP_HASH that maps property names (char *) to
property values (svn_string_t *). The names are assumed to be in UTF-8
format; the values are either in UTF-8 (the special Subversion props) or
plain binary values.
If OUT is not NULL, then write to it rather than stdout.
If NAMES_ONLY is true, print just names, else print names and
values. */
svn_error_t *
svn_cmdline__print_prop_hash(svn_stream_t *out,
apr_hash_t *prop_hash,
svn_boolean_t names_only,
apr_pool_t *pool);
/* Similar to svn_cmdline__print_prop_hash(), only output xml to *OUTSTR.
If INHERITED_PROPS is true, then PROP_HASH contains inherited properties,
otherwise PROP_HASH contains explicit properties. If *OUTSTR is NULL,
allocate it first from POOL, otherwise append to it. */
svn_error_t *
svn_cmdline__print_xml_prop_hash(svn_stringbuf_t **outstr,
apr_hash_t *prop_hash,
svn_boolean_t names_only,
svn_boolean_t inherited_props,
apr_pool_t *pool);
/* Search for a text editor command in standard environment variables,
and invoke it to edit PATH. Use POOL for all allocations.
If EDITOR_CMD is not NULL, it is the name of the external editor
command to use, overriding anything else that might determine the
editor.
CONFIG is a hash of svn_config_t * items keyed on a configuration
category (SVN_CONFIG_CATEGORY_CONFIG et al), and may be NULL. */
svn_error_t *
svn_cmdline__edit_file_externally(const char *path,
const char *editor_cmd,
apr_hash_t *config,
apr_pool_t *pool);
/* Search for a text editor command in standard environment variables,
and invoke it to edit CONTENTS (using a temporary file created in
directory BASE_DIR). Return the new contents in *EDITED_CONTENTS,
or set *EDITED_CONTENTS to NULL if no edit was performed.
If EDITOR_CMD is not NULL, it is the name of the external editor
command to use, overriding anything else that might determine the
editor.
If TMPFILE_LEFT is NULL, the temporary file will be destroyed.
Else, the file will be left on disk, and its path returned in
*TMPFILE_LEFT.
CONFIG is a hash of svn_config_t * items keyed on a configuration
category (SVN_CONFIG_CATEGORY_CONFIG et al), and may be NULL.
If AS_TEXT is TRUE, recode CONTENTS and convert to native eol-style before
editing and back again afterwards. In this case, ENCODING determines the
encoding used during editing. If non-NULL, use the named encoding, else
use the system encoding. If AS_TEXT is FALSE, don't do any translation.
In that case, ENCODING is ignored.
Use POOL for all allocations. Use PREFIX as the prefix for the
temporary file used by the editor.
If return error, *EDITED_CONTENTS is not touched. */
svn_error_t *
svn_cmdline__edit_string_externally(svn_string_t **edited_contents,
const char **tmpfile_left,
const char *editor_cmd,
const char *base_dir,
const svn_string_t *contents,
const char *prefix,
apr_hash_t *config,
svn_boolean_t as_text,
const char *encoding,
apr_pool_t *pool);
/** Wrapper for apr_getopt_init(), which see.
*
* @since New in 1.4.
*/
svn_error_t *
svn_cmdline__getopt_init(apr_getopt_t **os,
int argc,
const char *argv[],
apr_pool_t *pool);
/* Determine whether interactive mode should be enabled, based on whether
* the user passed the --non-interactive or --force-interactive options.
* If neither option was passed, interactivity is enabled if standard
* input is connected to a terminal device.
*
* @since New in 1.8.
*/
svn_boolean_t
svn_cmdline__be_interactive(svn_boolean_t non_interactive,
svn_boolean_t force_interactive);
#ifdef __cplusplus
}
#endif /* __cplusplus */
#endif /* SVN_CMDLINE_PRIVATE_H */

View File

@ -0,0 +1,68 @@
/*
* svn_dav_protocol.h: Declarations of the protocol shared by the
* mod_dav_svn backend for httpd's mod_dav and its ra_serf RA DAV clients.
*
* ====================================================================
* Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements. See the NOTICE file
* distributed with this work for additional information
* regarding copyright ownership. The ASF licenses this file
* to you under the Apache License, Version 2.0 (the
* "License"); you may not use this file except in compliance
* with the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing,
* software distributed under the License is distributed on an
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
* KIND, either express or implied. See the License for the
* specific language governing permissions and limitations
* under the License.
* ====================================================================
*/
#ifndef SVN_DAV_PROTOCOL_H
#define SVN_DAV_PROTOCOL_H
#ifdef __cplusplus
extern "C" {
#endif /* __cplusplus */
/** Names for the custom HTTP REPORTs understood by mod_dav_svn, sans
namespace. */
#define SVN_DAV__MERGEINFO_REPORT "mergeinfo-report"
#define SVN_DAV__INHERITED_PROPS_REPORT "inherited-props-report"
/** Names for XML child elements of the custom HTTP REPORTs understood
by mod_dav_svn, sans namespace. */
#define SVN_DAV__CREATIONDATE "creationdate"
#define SVN_DAV__MERGEINFO_ITEM "mergeinfo-item"
#define SVN_DAV__MERGEINFO_PATH "mergeinfo-path"
#define SVN_DAV__MERGEINFO_INFO "mergeinfo-info"
#define SVN_DAV__PATH "path"
#define SVN_DAV__INHERIT "inherit"
#define SVN_DAV__REVISION "revision"
#define SVN_DAV__INCLUDE_DESCENDANTS "include-descendants"
#define SVN_DAV__VERSION_NAME "version-name"
#define SVN_DAV__IPROP_ITEM "iprop-item"
#define SVN_DAV__IPROP_PATH "iprop-path"
#define SVN_DAV__IPROP_PROPNAME "iprop-propname"
#define SVN_DAV__IPROP_PROPVAL "iprop-propval"
/** Names of XML elements attributes and tags for svn_ra_change_rev_prop2()'s
extension of PROPPATCH. */
#define SVN_DAV__OLD_VALUE "old-value"
#define SVN_DAV__OLD_VALUE__ABSENT "absent"
/** Helper typedef for svn_ra_change_rev_prop2() implementation. */
typedef struct svn_dav__two_props_t {
const svn_string_t *const *old_value_p;
const svn_string_t *new_value;
} svn_dav__two_props_t;
#ifdef __cplusplus
}
#endif /* __cplusplus */
#endif /* SVN_DAV_PROTOCOL_H */

View File

@ -0,0 +1,107 @@
/* svn_debug.h : handy little debug tools for the SVN developers
*
* ====================================================================
* Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements. See the NOTICE file
* distributed with this work for additional information
* regarding copyright ownership. The ASF licenses this file
* to you under the Apache License, Version 2.0 (the
* "License"); you may not use this file except in compliance
* with the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing,
* software distributed under the License is distributed on an
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
* KIND, either express or implied. See the License for the
* specific language governing permissions and limitations
* under the License.
* ====================================================================
*/
#ifndef SVN_DEBUG_H
#define SVN_DEBUG_H
#ifdef SVN_DEBUG
#define SVN_DBG__PROTOTYPES
#endif
#ifdef SVN_DBG__PROTOTYPES
#define APR_WANT_STDIO
#include <apr_want.h>
#include <apr_hash.h>
#endif
#ifdef __cplusplus
extern "C" {
#endif /* __cplusplus */
#ifdef SVN_DBG__PROTOTYPES
/* A few helper functions for the macros below. */
void
svn_dbg__preamble(const char *file, long line, FILE *output);
void
svn_dbg__printf(const char *fmt, ...)
__attribute__((format(printf, 1, 2)));
void
svn_dbg__print_props(apr_hash_t *props,
const char *header_fmt,
...)
__attribute__((format(printf, 2, 3)));
#endif
/* Only available when SVN_DEBUG is defined (ie. svn developers). Note that
we do *not* provide replacement macros/functions for proper releases.
The debug stuff should be removed before a commit.
### maybe we will eventually decide to allow certain debug stuff to
### remain in the code. at that point, we can rejigger this header. */
#ifdef SVN_DEBUG
/* Print to stdout. Edit this line if you need stderr. */
#define SVN_DBG_OUTPUT stdout
/* Defining this symbol in the source file, BEFORE INCLUDING THIS HEADER,
will switch off the output. Calls will still be made to svn_dbg__preamble()
for breakpoints. */
#ifdef SVN_DBG_QUIET
#define SVN_DBG(ARGS) svn_dbg__preamble(__FILE__, __LINE__, NULL)
#define SVN_DBG_PROPS(ARGS) svn_dbg__preamble(__FILE__, __LINE__, NULL)
#else
/** Debug aid macro that prints the file:line of the call and printf-like
* arguments to the #SVN_DBG_OUTPUT stdio stream (#stdout by default). Typical
* usage:
*
* <pre>
* SVN_DBG(("rev=%ld kind=%s\n", revnum, svn_node_kind_to_word(kind)));
* </pre>
*
* outputs:
*
* <pre>
* DBG: kitchensink.c: 42: rev=3141592 kind=file
* </pre>
*
* Note that these output lines are filtered by our test suite automatically,
* so you don't have to worry about throwing off expected output.
*/
#define SVN_DBG(ARGS) (svn_dbg__preamble(__FILE__, __LINE__, SVN_DBG_OUTPUT), \
svn_dbg__printf ARGS)
#define SVN_DBG_PROPS(ARGS) (svn_dbg__preamble(__FILE__, __LINE__, \
SVN_DBG_OUTPUT), \
svn_dbg__print_props ARGS)
#endif
#endif /* SVN_DEBUG */
#ifdef __cplusplus
}
#endif /* __cplusplus */
#endif /* SVN_DEBUG_H */

View File

@ -0,0 +1,128 @@
/**
* @copyright
* ====================================================================
* Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements. See the NOTICE file
* distributed with this work for additional information
* regarding copyright ownership. The ASF licenses this file
* to you under the Apache License, Version 2.0 (the
* "License"); you may not use this file except in compliance
* with the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing,
* software distributed under the License is distributed on an
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
* KIND, either express or implied. See the License for the
* specific language governing permissions and limitations
* under the License.
* ====================================================================
* @endcopyright
*
* @file svn_delta_private.h
* @brief The Subversion delta/diff/editor library - Internal routines
*/
#ifndef SVN_DELTA_PRIVATE_H
#define SVN_DELTA_PRIVATE_H
#include <apr_pools.h>
#include "svn_types.h"
#include "svn_error.h"
#include "svn_delta.h"
#include "svn_editor.h"
#ifdef __cplusplus
extern "C" {
#endif /* __cplusplus */
typedef svn_error_t *(*svn_delta__start_edit_func_t)(
void *baton,
svn_revnum_t base_revision);
typedef svn_error_t *(*svn_delta__target_revision_func_t)(
void *baton,
svn_revnum_t target_revision,
apr_pool_t *scratch_pool);
typedef svn_error_t *(*svn_delta__unlock_func_t)(
void *baton,
const char *path,
apr_pool_t *scratch_pool);
/* See svn_editor__insert_shims() for more information. */
struct svn_delta__extra_baton
{
svn_delta__start_edit_func_t start_edit;
svn_delta__target_revision_func_t target_revision;
void *baton;
};
/** A temporary API to convert from a delta editor to an Ev2 editor. */
svn_error_t *
svn_delta__editor_from_delta(svn_editor_t **editor_p,
struct svn_delta__extra_baton **exb,
svn_delta__unlock_func_t *unlock_func,
void **unlock_baton,
const svn_delta_editor_t *deditor,
void *dedit_baton,
svn_boolean_t *send_abs_paths,
const char *repos_root,
const char *base_relpath,
svn_cancel_func_t cancel_func,
void *cancel_baton,
svn_delta_fetch_kind_func_t fetch_kind_func,
void *fetch_kind_baton,
svn_delta_fetch_props_func_t fetch_props_func,
void *fetch_props_baton,
apr_pool_t *result_pool,
apr_pool_t *scratch_pool);
/** A temporary API to convert from an Ev2 editor to a delta editor. */
svn_error_t *
svn_delta__delta_from_editor(const svn_delta_editor_t **deditor,
void **dedit_baton,
svn_editor_t *editor,
svn_delta__unlock_func_t unlock_func,
void *unlock_baton,
svn_boolean_t *found_abs_paths,
const char *repos_root,
const char *base_relpath,
svn_delta_fetch_props_func_t fetch_props_func,
void *fetch_props_baton,
svn_delta_fetch_base_func_t fetch_base_func,
void *fetch_base_baton,
struct svn_delta__extra_baton *exb,
apr_pool_t *pool);
/**
* Get the data from IN, compress it according to the specified
* COMPRESSION_LEVEL and write the result to OUT.
* SVN_DELTA_COMPRESSION_LEVEL_NONE is valid for COMPRESSION_LEVEL.
*/
svn_error_t *
svn__compress(svn_string_t *in,
svn_stringbuf_t *out,
int compression_level);
/**
* Get the compressed data from IN, decompress it and write the result to
* OUT. Return an error if the decompressed size is larger than LIMIT.
*/
svn_error_t *
svn__decompress(svn_string_t *in,
svn_stringbuf_t *out,
apr_size_t limit);
#ifdef __cplusplus
}
#endif /* __cplusplus */
#endif /* SVN_DELTA_PRIVATE_H */

View File

@ -0,0 +1,184 @@
/**
* @copyright
* ====================================================================
* Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements. See the NOTICE file
* distributed with this work for additional information
* regarding copyright ownership. The ASF licenses this file
* to you under the Apache License, Version 2.0 (the
* "License"); you may not use this file except in compliance
* with the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing,
* software distributed under the License is distributed on an
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
* KIND, either express or implied. See the License for the
* specific language governing permissions and limitations
* under the License.
* ====================================================================
* @endcopyright
*
* @file svn_compat.h
* @brief Compatibility macros and functions.
* @since New in 1.5.0.
*/
#ifndef SVN_DEP_COMPAT_H
#define SVN_DEP_COMPAT_H
#include <apr_version.h>
#ifdef __cplusplus
extern "C" {
#endif /* __cplusplus */
/**
* Check at compile time if the APR version is at least a certain
* level.
* @param major The major version component of the version checked
* for (e.g., the "1" of "1.3.0").
* @param minor The minor version component of the version checked
* for (e.g., the "3" of "1.3.0").
* @param patch The patch level component of the version checked
* for (e.g., the "0" of "1.3.0").
*
* @since New in 1.5.
*/
#ifndef APR_VERSION_AT_LEAST /* Introduced in APR 1.3.0 */
#define APR_VERSION_AT_LEAST(major,minor,patch) \
(((major) < APR_MAJOR_VERSION) \
|| ((major) == APR_MAJOR_VERSION && (minor) < APR_MINOR_VERSION) \
|| ((major) == APR_MAJOR_VERSION && (minor) == APR_MINOR_VERSION && \
(patch) <= APR_PATCH_VERSION))
#endif /* APR_VERSION_AT_LEAST */
/**
* If we don't have a recent enough APR, emulate the behavior of the
* apr_array_clear() API.
*/
#if !APR_VERSION_AT_LEAST(1,3,0)
#define apr_array_clear(arr) (arr)->nelts = 0
#endif
#if !APR_VERSION_AT_LEAST(1,3,0)
/* Equivalent to the apr_hash_clear() function in APR >= 1.3.0. Used to
* implement the 'apr_hash_clear' macro if the version of APR that
* we build against does not provide the apr_hash_clear() function. */
void svn_hash__clear(struct apr_hash_t *ht);
/**
* If we don't have a recent enough APR, emulate the behavior of the
* apr_hash_clear() API.
*/
#define apr_hash_clear(ht) svn_hash__clear(ht)
#endif
#if !APR_VERSION_AT_LEAST(1,0,0)
#define APR_UINT64_C(val) UINT64_C(val)
#define APR_FPROT_OS_DEFAULT APR_OS_DEFAULT
#endif
#if !APR_VERSION_AT_LEAST(1,3,0)
#define APR_UINT16_MAX 0xFFFFU
#define APR_INT16_MAX 0x7FFF
#define APR_INT16_MIN (-APR_INT16_MAX-1)
#define APR_UINT32_MAX 0xFFFFFFFFU
#define APR_INT32_MAX 0x7FFFFFFF
#define APR_INT32_MIN (-APR_INT32_MAX-1)
#define APR_UINT64_MAX APR_UINT64_C(0xFFFFFFFFFFFFFFFF)
#define APR_INT64_MAX APR_INT64_C(0x7FFFFFFFFFFFFFFF)
#define APR_INT64_MIN (-APR_INT64_MAX-1)
#define APR_SIZE_MAX (~(apr_size_t)0)
#if APR_SIZEOF_VOIDP == 8
typedef apr_uint64_t apr_uintptr_t;
#else
typedef apr_uint32_t apr_uintptr_t;
#endif
#endif /* !APR_VERSION_AT_LEAST(1,3,0) */
/**
* Work around a platform dependency issue. apr_thread_rwlock_trywrlock()
* will make APR_STATUS_IS_EBUSY() return TRUE if the lock could not be
* acquired under Unix. Under Windows, this will not work. So, provide
* a more portable substitute.
*
* @since New in 1.8.
*/
#ifdef WIN32
#define SVN_LOCK_IS_BUSY(x) \
(APR_STATUS_IS_EBUSY(x) || (x) == APR_FROM_OS_ERROR(WAIT_TIMEOUT))
#else
#define SVN_LOCK_IS_BUSY(x) APR_STATUS_IS_EBUSY(x)
#endif
/**
* Check at compile time if the Serf version is at least a certain
* level.
* @param major The major version component of the version checked
* for (e.g., the "1" of "1.3.0").
* @param minor The minor version component of the version checked
* for (e.g., the "3" of "1.3.0").
* @param patch The patch level component of the version checked
* for (e.g., the "0" of "1.3.0").
*
* @since New in 1.5.
*/
#ifndef SERF_VERSION_AT_LEAST /* Introduced in Serf 0.1.1 */
#define SERF_VERSION_AT_LEAST(major,minor,patch) \
(((major) < SERF_MAJOR_VERSION) \
|| ((major) == SERF_MAJOR_VERSION && (minor) < SERF_MINOR_VERSION) \
|| ((major) == SERF_MAJOR_VERSION && (minor) == SERF_MINOR_VERSION && \
(patch) <= SERF_PATCH_VERSION))
#endif /* SERF_VERSION_AT_LEAST */
/**
* By default, if libsvn is built against one version of SQLite
* and then run using an older version, svn will error out:
*
* svn: Couldn't perform atomic initialization
* svn: SQLite compiled for 3.7.4, but running with 3.7.3
*
* That can be annoying when building on a modern system in order
* to deploy on a less modern one. So these constants allow one
* to specify how old the system being deployed on might be.
* For example,
*
* EXTRA_CFLAGS += -DSVN_SQLITE_MIN_VERSION_NUMBER=3007003
* EXTRA_CFLAGS += '-DSVN_SQLITE_MIN_VERSION="3.7.3"'
*
* turns on code that works around infelicities in older versions
* as far back as 3.7.3 and relaxes the check at initialization time
* to permit them.
*
* @since New in 1.8.
*/
#ifndef SVN_SQLITE_MIN_VERSION_NUMBER
#define SVN_SQLITE_MIN_VERSION_NUMBER SQLITE_VERSION_NUMBER
#define SVN_SQLITE_MIN_VERSION SQLITE_VERSION
#endif /* SVN_SQLITE_MIN_VERSION_NUMBER */
/**
* Check at compile time if the SQLite version is at least a certain
* level.
* @param major The major version component of the version checked
* for (e.g., the "1" of "1.3.0").
* @param minor The minor version component of the version checked
* for (e.g., the "3" of "1.3.0").
* @param patch The patch level component of the version checked
* for (e.g., the "0" of "1.3.0").
*
* @since New in 1.6.
*/
#ifndef SQLITE_VERSION_AT_LEAST
#define SQLITE_VERSION_AT_LEAST(major,minor,patch) \
((major*1000000 + minor*1000 + patch) <= SVN_SQLITE_MIN_VERSION_NUMBER)
#endif /* SQLITE_VERSION_AT_LEAST */
#ifdef __cplusplus
}
#endif /* __cplusplus */
#endif /* SVN_DEP_COMPAT_H */

View File

@ -0,0 +1,115 @@
/**
* @copyright
* ====================================================================
* Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements. See the NOTICE file
* distributed with this work for additional information
* regarding copyright ownership. The ASF licenses this file
* to you under the Apache License, Version 2.0 (the
* "License"); you may not use this file except in compliance
* with the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing,
* software distributed under the License is distributed on an
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
* KIND, either express or implied. See the License for the
* specific language governing permissions and limitations
* under the License.
* ====================================================================
* @endcopyright
*/
#ifndef SVN_DIFF_PRIVATE_H
#define SVN_DIFF_PRIVATE_H
#include <apr_pools.h>
#include <apr_tables.h>
#include "svn_types.h"
#include "svn_io.h"
#ifdef __cplusplus
extern "C" {
#endif /* __cplusplus */
/* The separator string used below the "Index:" or similar line of
* Subversion's Unidiff-like diff format. */
#define SVN_DIFF__EQUAL_STRING \
"==================================================================="
/* The separator string used below the "Properties on ..." line of
* Subversion's Unidiff-like diff format. */
#define SVN_DIFF__UNDER_STRING \
"___________________________________________________________________"
/* The string used to mark a line in a hunk that doesn't end with a newline,
* when diffing a file. Intentionally not marked for translation, for wider
* interoperability with patch(1) programs. */
#define SVN_DIFF__NO_NEWLINE_AT_END_OF_FILE \
"\\ No newline at end of file"
/* The string used to mark a line in a hunk that doesn't end with a newline,
* when diffing a Subversion property. */
#define SVN_DIFF__NO_NEWLINE_AT_END_OF_PROPERTY \
"\\ No newline at end of property"
/* Write a unidiff "---" and "+++" header to OUTPUT_STREAM.
*
* Write "---" followed by a space and OLD_HEADER and a newline,
* then "+++" followed by a space and NEW_HEADER and a newline.
*
* The text will be encoded into HEADER_ENCODING.
*/
svn_error_t *
svn_diff__unidiff_write_header(svn_stream_t *output_stream,
const char *header_encoding,
const char *old_header,
const char *new_header,
apr_pool_t *scratch_pool);
/* Display property changes in pseudo-Unidiff format.
*
* Write to @a outstream the changes described by @a propchanges based on
* original properties @a original_props.
*
* Write all mark-up text (headers and so on) using the character encoding
* @a encoding.
*
* ### I think the idea is: we want the output to use @a encoding, and
* we will assume the text of the user's files and the values of any
* user-defined properties are already using @a encoding, so we don't
* want to re-code the *whole* output.
* So, shouldn't we also convert all prop names and all 'svn:*' prop
* values to @a encoding, since we know those are stored in UTF-8?
*
* @a original_props is a hash mapping (const char *) property names to
* (svn_string_t *) values. @a propchanges is an array of svn_prop_t
* representing the new values for any of the properties that changed, with
* a NULL value to represent deletion.
*
* If @a pretty_print_mergeinfo is true, then describe 'svn:mergeinfo'
* property changes in a human-readable form that says what changes were
* merged or reverse merged; otherwise (or if the mergeinfo property values
* don't parse correctly) display them just like any other property.
*
* Use @a pool for temporary allocations.
*/
svn_error_t *
svn_diff__display_prop_diffs(svn_stream_t *outstream,
const char *encoding,
const apr_array_header_t *propchanges,
apr_hash_t *original_props,
svn_boolean_t pretty_print_mergeinfo,
apr_pool_t *pool);
#ifdef __cplusplus
}
#endif /* __cplusplus */
#endif /* SVN_DIFF_PRIVATE_H */

View File

@ -0,0 +1,357 @@
/**
* @copyright
* ====================================================================
* Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements. See the NOTICE file
* distributed with this work for additional information
* regarding copyright ownership. The ASF licenses this file
* to you under the Apache License, Version 2.0 (the
* "License"); you may not use this file except in compliance
* with the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing,
* software distributed under the License is distributed on an
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
* KIND, either express or implied. See the License for the
* specific language governing permissions and limitations
* under the License.
* ====================================================================
* @endcopyright
*
* @file svn_wc.h
* @brief Generic diff handler. Replacing the old svn_wc_diff_callbacks4_t
* infrastructure
*/
#ifndef SVN_DIFF_PROCESSOR_H
#define SVN_DIFF_PROCESSOR_H
#include "svn_types.h"
#ifdef __cplusplus
extern "C" {
#endif /* __cplusplus */
/*
* About the diff tree processor.
*
* Subversion uses two kinds of editors to describe changes. One to
* describe changes on how to *exactly* transform one tree to another tree,
* as efficiently as possible and one to describe the difference between trees
* in order to review the changes, or to allow applying them on a third tree
* which is similar to those other trees.
*
* The first case was originally handled by svn_delta_editor_t and might be
* replaced by svn_editor_t in a future version. This diff processor handles
* the other case and as such forms the layer below our diff and merge
* handling.
*
* The major difference between this and the other editors is that this diff
* always provides access to the full text and/or properties in the left and
* right tree when applicable to allow processor implementers to decide how
* to interpret changes.
*
* Originally this diff processor was not formalized explicitly, but
* informally handled by the working copy diff callbacks. These callbacks just
* provided the information to drive a unified diff and a textual merge. To go
* one step further and allow full tree conflict detection we needed a better
* defined diff handling. Instead of adding yet a few more functions and
* arguments to the already overloaded diff callbacks the api was completely
* redesigned with a few points in mind.
*
* * It must be able to drive the old callbacks interface without users
* noticing the difference (100% compatible).
* (Implemented as svn_wc__wrap_diff_callbacks())
*
* * It should provide the information that was missing in the old interface,
* but required to close existing issues.
*
* E.g. - properties and children on deleted directories.
* - revision numbers and copyfrom information on directories.
*
* To cleanup the implementation and make it easier on diff processors to
* handle the results I also added the following constraints.
*
* * Diffs should be fully reversable: anything that is deleted should be
* available, just like something that is added.
* (Proven via svn_diff__tree_processor_reverse_create)
* ### Still in doubt if *_deleted() needs a copy_to argument, for the
* ### 99% -> 100%.
*
* * Diff processors should have an easy way to communicate that they are
* not interrested in certain expensive to obtain results.
*
* * Directories should have clear open and close events to allow adding them
* before their children, but still allowing property changes to have
* defined behavior.
*
* * Files and directories should be handled as similar as possible as in
* many cases they are just nodes in a tree.
*
* * It should be easy to create diff wrappers to apply certain transforms.
*
* During the creation an additional requirement of knowing about 'some
* absent' nodes was added, to allow the merge to work on just this processor
* api.
*
* The api describes a clean open-close walk through a tree, depending on the
* driver multiple siblings can be described at the same time, but when a
* directory is closed all descendants are done.
*
* Note that it is possible for nodes to be described as a delete followed by
* an add at the same place within one parent. (Iff the diff is reversed you
* can see an add followed by a delete!)
*
* The directory batons live between the open and close events of a directory
* and are thereby guaranteed to outlive the batons of their descendants.
*/
/* Describes the source of a merge */
typedef struct svn_diff_source_t
{
/* Always available */
svn_revnum_t revision;
/* Depending on the driver available for copyfrom */
const char *repos_relpath;
} svn_diff_source_t;
/**
* A callback vtable invoked by our diff-editors, as they receive diffs
* from the server. 'svn diff' and 'svn merge' implement their own versions
* of this vtable.
*
* All callbacks receive the processor and at least a parent baton. Forwarding
* the processor allows future extensions to call into the old functions without
* revving the entire API.
*
* Users must call svn_diff__tree_processor_create() to allow adding new
* callbacks later. (E.g. when we decide how to add move support) These
* extensions can then just call into other callbacks.
*
* @since New in 1.8.
*/
typedef struct svn_diff_tree_processor_t
{
/** The value passed to svn_diff__tree_processor_create() as BATON.
*/
void *baton; /* To avoid an additional in some places */
/* Called before a directories children are processed.
*
* Set *SKIP_CHILDREN to TRUE, to skip calling callbacks for all
* children.
*
* Set *SKIP to TRUE to skip calling the added, deleted, changed
* or closed callback for this node only.
*/
svn_error_t *
(*dir_opened)(void **new_dir_baton,
svn_boolean_t *skip,
svn_boolean_t *skip_children,
const char *relpath,
const svn_diff_source_t *left_source,
const svn_diff_source_t *right_source,
const svn_diff_source_t *copyfrom_source,
void *parent_dir_baton,
const struct svn_diff_tree_processor_t *processor,
apr_pool_t *result_pool,
apr_pool_t *scratch_pool);
/* Called after a directory and all its children are added
*/
svn_error_t *
(*dir_added)(const char *relpath,
const svn_diff_source_t *copyfrom_source,
const svn_diff_source_t *right_source,
/*const*/ apr_hash_t *copyfrom_props,
/*const*/ apr_hash_t *right_props,
void *dir_baton,
const struct svn_diff_tree_processor_t *processor,
apr_pool_t *scratch_pool);
/* Called after all children of this node are reported as deleted.
*
* The default implementation calls dir_closed().
*/
svn_error_t *
(*dir_deleted)(const char *relpath,
const svn_diff_source_t *left_source,
/*const*/ apr_hash_t *left_props,
void *dir_baton,
const struct svn_diff_tree_processor_t *processor,
apr_pool_t *scratch_pool);
/* Called instead of dir_closed() if the properties on the directory
* were modified.
*
* The default implementation calls dir_closed().
*/
svn_error_t *
(*dir_changed)(const char *relpath,
const svn_diff_source_t *left_source,
const svn_diff_source_t *right_source,
/*const*/ apr_hash_t *left_props,
/*const*/ apr_hash_t *right_props,
const apr_array_header_t *prop_changes,
void *dir_baton,
const struct svn_diff_tree_processor_t *processor,
apr_pool_t *scratch_pool);
/* Called when a directory is closed without applying changes to
* the directory itself.
*
* When dir_changed or dir_deleted are handled by the default implementation
* they call dir_closed()
*/
svn_error_t *
(*dir_closed)(const char *relpath,
const svn_diff_source_t *left_source,
const svn_diff_source_t *right_source,
void *dir_baton,
const struct svn_diff_tree_processor_t *processor,
apr_pool_t *scratch_pool);
/* Called before file_added(), file_deleted(), file_changed() and
file_closed()
*/
svn_error_t *
(*file_opened)(void **new_file_baton,
svn_boolean_t *skip,
const char *relpath,
const svn_diff_source_t *left_source,
const svn_diff_source_t *right_source,
const svn_diff_source_t *copyfrom_source,
void *dir_baton,
const struct svn_diff_tree_processor_t *processor,
apr_pool_t *result_pool,
apr_pool_t *scratch_pool);
/* Called after file_opened() for newly added and copied files */
svn_error_t *
(*file_added)(const char *relpath,
const svn_diff_source_t *copyfrom_source,
const svn_diff_source_t *right_source,
const char *copyfrom_file,
const char *right_file,
/*const*/ apr_hash_t *copyfrom_props,
/*const*/ apr_hash_t *right_props,
void *file_baton,
const struct svn_diff_tree_processor_t *processor,
apr_pool_t *scratch_pool);
/* Called after file_opened() for deleted or moved away files */
svn_error_t *
(*file_deleted)(const char *relpath,
const svn_diff_source_t *left_source,
const char *left_file,
/*const*/ apr_hash_t *left_props,
void *file_baton,
const struct svn_diff_tree_processor_t *processor,
apr_pool_t *scratch_pool);
/* Called after file_opened() for changed files */
svn_error_t *
(*file_changed)(const char *relpath,
const svn_diff_source_t *left_source,
const svn_diff_source_t *right_source,
const char *left_file,
const char *right_file,
/*const*/ apr_hash_t *left_props,
/*const*/ apr_hash_t *right_props,
svn_boolean_t file_modified,
const apr_array_header_t *prop_changes,
void *file_baton,
const struct svn_diff_tree_processor_t *processor,
apr_pool_t *scratch_pool);
/* Called after file_opened() for unmodified files */
svn_error_t *
(*file_closed)(const char *relpath,
const svn_diff_source_t *left_source,
const svn_diff_source_t *right_source,
void *file_baton,
const struct svn_diff_tree_processor_t *processor,
apr_pool_t *scratch_pool);
/* Called when encountering a marker for an absent file or directory */
svn_error_t *
(*node_absent)(const char *relpath,
void *dir_baton,
const struct svn_diff_tree_processor_t *processor,
apr_pool_t *scratch_pool);
} svn_diff_tree_processor_t;
/**
* Create a new svn_diff_tree_processor_t instance with all functions
* set to a callback doing nothing but copying the parent baton to
* the new baton.
*
* @since New in 1.8.
*/
svn_diff_tree_processor_t *
svn_diff__tree_processor_create(void *baton,
apr_pool_t *result_pool);
/**
* Create a new svn_diff_tree_processor_t instance with all functions setup
* to call into another svn_diff_tree_processor_t processor, but with all
* adds and deletes inverted.
*
* @since New in 1.8.
*/ /* Used by libsvn clients repository diff */
const svn_diff_tree_processor_t *
svn_diff__tree_processor_reverse_create(const svn_diff_tree_processor_t * processor,
const char *prefix_relpath,
apr_pool_t *result_pool);
/**
* Create a new svn_diff_tree_processor_t instance with all functions setup
* to call into processor for all paths equal to and below prefix_relpath.
*
* @since New in 1.8.
*/ /* Used by libsvn clients repository diff */
const svn_diff_tree_processor_t *
svn_diff__tree_processor_filter_create(const svn_diff_tree_processor_t *processor,
const char *prefix_relpath,
apr_pool_t *result_pool);
/**
* Create a new svn_diff_tree_processor_t instace with all function setup
* to call into processor with all adds with copyfrom information transformed
* to simple node changes.
*
* @since New in 1.8.
*/ /* Used by libsvn_wc diff editor */
const svn_diff_tree_processor_t *
svn_diff__tree_processor_copy_as_changed_create(
const svn_diff_tree_processor_t *processor,
apr_pool_t *result_pool);
/**
* Create a new svn_diff_tree_processor_t instance with all functions setup
* to first call into processor1 and then processor2.
*
* This function is mostly a debug and migration helper.
*
* @since New in 1.8.
*/ /* Used by libsvn clients repository diff */
const svn_diff_tree_processor_t *
svn_diff__tree_processor_tee_create(const svn_diff_tree_processor_t *processor1,
const svn_diff_tree_processor_t *processor2,
apr_pool_t *result_pool);
svn_diff_source_t *
svn_diff__source_create(svn_revnum_t revision,
apr_pool_t *result_pool);
#ifdef __cplusplus
}
#endif /* __cplusplus */
#endif /* SVN_DIFF_PROCESSOR_H */

View File

@ -0,0 +1,32 @@
/*
*
* Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements. See the NOTICE file
* distributed with this work for additional information
* regarding copyright ownership. The ASF licenses this file
* to you under the Apache License, Version 2.0 (the
* "License"); you may not use this file except in compliance
* with the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing,
* software distributed under the License is distributed on an
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
* KIND, either express or implied. See the License for the
* specific language governing permissions and limitations
* under the License.
*
*/
/**
* @mainpage Subversion Documentation
*
* This documentation covers the public APIs provided by the Subversion
* libraries. It is intended mainly for programmers, both those working
* on Subversion itself, as well as developers of 3rd-party applications
* intending to use these APIs. For more information about using Subversion,
* see the Subversion Book at http://svnbook.red-bean.com/.
*
* To learn more about Subversion, please visit http://subversion.apache.org/.
*/

File diff suppressed because it is too large Load Diff

View File

@ -0,0 +1,93 @@
/**
* @copyright
* ====================================================================
* Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements. See the NOTICE file
* distributed with this work for additional information
* regarding copyright ownership. The ASF licenses this file
* to you under the Apache License, Version 2.0 (the
* "License"); you may not use this file except in compliance
* with the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing,
* software distributed under the License is distributed on an
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
* KIND, either express or implied. See the License for the
* specific language governing permissions and limitations
* under the License.
* ====================================================================
* @endcopyright
*
* @file svn_eol_private.h
* @brief Subversion's EOL functions - Internal routines
*/
#ifndef SVN_EOL_PRIVATE_H
#define SVN_EOL_PRIVATE_H
#include <apr_pools.h>
#include <apr_hash.h>
#include "svn_types.h"
#include "svn_error.h"
#ifdef __cplusplus
extern "C" {
#endif /* __cplusplus */
/* Constants used by various chunky string processing functions.
*/
#if APR_SIZEOF_VOIDP == 8
# define SVN__LOWER_7BITS_SET 0x7f7f7f7f7f7f7f7f
# define SVN__BIT_7_SET 0x8080808080808080
# define SVN__R_MASK 0x0a0a0a0a0a0a0a0a
# define SVN__N_MASK 0x0d0d0d0d0d0d0d0d
#else
# define SVN__LOWER_7BITS_SET 0x7f7f7f7f
# define SVN__BIT_7_SET 0x80808080
# define SVN__R_MASK 0x0a0a0a0a
# define SVN__N_MASK 0x0d0d0d0d
#endif
/* Generic EOL character helper routines */
/* Look for the start of an end-of-line sequence (i.e. CR or LF)
* in the array pointed to by @a buf , of length @a len.
* If such a byte is found, return the pointer to it, else return NULL.
*
* @since New in 1.7
*/
char *
svn_eol__find_eol_start(char *buf, apr_size_t len);
/* Return the first eol marker found in buffer @a buf as a NUL-terminated
* string, or NULL if no eol marker is found. Do not examine more than
* @a len bytes in @a buf.
*
* If the last valid character of @a buf is the first byte of a
* potentially two-byte eol sequence, just return that single-character
* sequence, that is, assume @a buf represents a CR-only or LF-only file.
* This is correct for callers that pass an entire file at once, and is
* no more likely to be incorrect than correct for any caller that doesn't.
*
* The returned string is statically allocated, i.e. it is NOT a pointer
* to an address within @a buf.
*
* If an eol marker is found and @a eolp is not NULL, store in @a *eolp
* the address within @a buf of the first byte of the eol marker.
* This allows callers to tell whether there might be more than one eol
* sequence in @a buf, as well as detect two-byte eol sequences that
* span buffer boundaries.
*
* @since New in 1.7
*/
const char *
svn_eol__detect_eol(char *buf, apr_size_t len, char **eolp);
#ifdef __cplusplus
}
#endif /* __cplusplus */
#endif /* SVN_EOL_PRIVATE_H */

View File

@ -0,0 +1,54 @@
/**
* @copyright
* ====================================================================
* Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements. See the NOTICE file
* distributed with this work for additional information
* regarding copyright ownership. The ASF licenses this file
* to you under the Apache License, Version 2.0 (the
* "License"); you may not use this file except in compliance
* with the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing,
* software distributed under the License is distributed on an
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
* KIND, either express or implied. See the License for the
* specific language governing permissions and limitations
* under the License.
* ====================================================================
* @endcopyright
*
* @file svn_error_private.h
* @brief Subversion-internal error APIs.
*/
#ifndef SVN_ERROR_PRIVATE_H
#define SVN_ERROR_PRIVATE_H
#include "svn_types.h"
#ifdef __cplusplus
extern "C" {
#endif /* __cplusplus */
/**
* Returns if @a err is a "tracing" error.
*/
svn_boolean_t
svn_error__is_tracing_link(svn_error_t *err);
/**
* Converts a zlib error to an svn_error_t. zerr is the error code,
* function is the function name, message is an optional extra part
* of the error message and may be NULL.
*/
svn_error_t *
svn_error__wrap_zlib(int zerr, const char *function, const char *message);
#ifdef __cplusplus
}
#endif /* __cplusplus */
#endif /* SVN_ERROR_PRIVATE_H */

View File

@ -0,0 +1,189 @@
/*
* svn_fs_private.h: Private declarations for the filesystem layer to
* be consumed by libsvn_fs* and non-libsvn_fs* modules.
*
* ====================================================================
* Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements. See the NOTICE file
* distributed with this work for additional information
* regarding copyright ownership. The ASF licenses this file
* to you under the Apache License, Version 2.0 (the
* "License"); you may not use this file except in compliance
* with the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing,
* software distributed under the License is distributed on an
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
* KIND, either express or implied. See the License for the
* specific language governing permissions and limitations
* under the License.
* ====================================================================
*/
#ifndef SVN_FS_PRIVATE_H
#define SVN_FS_PRIVATE_H
#include "svn_fs.h"
#include "private/svn_editor.h"
#ifdef __cplusplus
extern "C" {
#endif /* __cplusplus */
/* The maximum length of a transaction name. The Berkeley DB backend
generates transaction names from a sequence expressed as a base 36
number with a maximum of MAX_KEY_SIZE (currently 200) bytes. The
FSFS backend generates transaction names of the form
<rev>-<base 36-number> where the base 36 number is a sequence value
with a maximum length of MAX_KEY_SIZE bytes. The maximum length is
212, but use 220 just to have some extra space:
10 -> 32 bit revision number
1 -> '-'
200 -> 200 digit base 36 number
1 -> '\0'
*/
#define SVN_FS__TXN_MAX_LEN 220
/** Retrieve the lock-tokens associated in the context @a access_ctx.
* The tokens are in a hash keyed with <tt>const char *</tt> tokens,
* and with <tt>const char *</tt> values for the paths associated.
*
* You should always use svn_fs_access_add_lock_token2() if you intend
* to use this function. The result of the function is not guaranteed
* if you use it with the deprecated svn_fs_access_add_lock_token()
* API.
*
* @since New in 1.6. */
apr_hash_t *
svn_fs__access_get_lock_tokens(svn_fs_access_t *access_ctx);
/* Check whether PATH is valid for a filesystem, following (most of) the
* requirements in svn_fs.h:"Directory entry names and directory paths".
*
* Return SVN_ERR_FS_PATH_SYNTAX if PATH is not valid.
*/
svn_error_t *
svn_fs__path_valid(const char *path, apr_pool_t *pool);
/** Editors
*
* ### docco
*
* @defgroup svn_fs_editor Transaction editors
* @{
*/
/**
* Create a new filesystem transaction, based on based on the youngest
* revision of @a fs, and return its name @a *txn_name and an @a *editor
* that can be used to make changes into it.
*
* @a flags determines transaction enforcement behaviors, and is composed
* from the constants SVN_FS_TXN_* (#SVN_FS_TXN_CHECK_OOD etc.). It is a
* property of the underlying transaction, and will not change if multiple
* editors are used to refer to that transaction (see @a autocommit, below).
*
* @note If you're building a txn for committing, you probably don't want
* to call this directly. Instead, call svn_repos__get_commit_ev2(), which
* honors the repository's hook configurations.
*
* When svn_editor_complete() is called for @a editor, internal resources
* will be cleaned and nothing more will happen. If you wish to commit the
* transaction, call svn_fs_editor_commit() instead. It is illegal to call
* both; the second call will return #SVN_ERR_FS_INCORRECT_EDITOR_COMPLETION.
*
* @see svn_fs_commit_txn()
*
* @since New in 1.8.
*/
svn_error_t *
svn_fs__editor_create(svn_editor_t **editor,
const char **txn_name,
svn_fs_t *fs,
apr_uint32_t flags,
svn_cancel_func_t cancel_func,
void *cancel_baton,
apr_pool_t *result_pool,
apr_pool_t *scratch_pool);
/**
* Like svn_fs__editor_create(), but open an existing transaction
* @a txn_name and continue editing it.
*
* @since New in 1.8.
*/
svn_error_t *
svn_fs__editor_create_for(svn_editor_t **editor,
svn_fs_t *fs,
const char *txn_name,
svn_cancel_func_t cancel_func,
void *cancel_baton,
apr_pool_t *result_pool,
apr_pool_t *scratch_pool);
/**
* Commit the transaction represented by @a editor.
*
* If the commit to the filesystem succeeds, then @a *revision will be set
* to the resulting revision number. Note that further errors may occur,
* as described below. If the commit process does not succeed, for whatever
* reason, then @a *revision will be set to #SVN_INVALID_REVNUM.
*
* If a conflict occurs during the commit, then @a *conflict_path will
* be set to a path that caused the conflict. #SVN_NO_ERROR will be returned.
* Callers may want to construct an #SVN_ERR_FS_CONFLICT error with a
* message that incorporates @a *conflict_path.
*
* If a non-conflict error occurs during the commit, then that error will
* be returned.
* As is standard with any Subversion API, @a revision, @a post_commit_err,
* and @a conflict_path (the OUT parameters) have an indeterminate value if
* an error is returned.
*
* If the commit completes (and a revision is returned in @a *revision), then
* it is still possible for an error to occur during the cleanup process.
* Any such error will be returned in @a *post_commit_err. The caller must
* properly use or clear that error.
*
* If svn_editor_complete() has already been called on @a editor, then
* #SVN_ERR_FS_INCORRECT_EDITOR_COMPLETION will be returned.
*
* @note After calling this function, @a editor will be marked as completed
* and no further operations may be performed on it. The underlying
* transaction will either be committed or aborted once this function is
* called. It cannot be recovered for additional work.
*
* @a result_pool will be used to allocate space for @a conflict_path.
* @a scratch_pool will be used for all temporary allocations.
*
* @note To summarize, there are three possible outcomes of this function:
* successful commit (with or without an associated @a *post_commit_err);
* failed commit due to a conflict (reported via @a *conflict_path); and
* failed commit for some other reason (reported via the returned error.)
*
* @since New in 1.8.
*/
svn_error_t *
svn_fs__editor_commit(svn_revnum_t *revision,
svn_error_t **post_commit_err,
const char **conflict_path,
svn_editor_t *editor,
apr_pool_t *result_pool,
apr_pool_t *scratch_pool);
/** @} */
#ifdef __cplusplus
}
#endif /* __cplusplus */
#endif /* SVN_FS_PRIVATE_H */

View File

@ -0,0 +1,217 @@
/*
* svn_fs_util.h: Declarations for the APIs of libsvn_fs_util to be
* consumed by only fs_* libs.
*
* ====================================================================
* Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements. See the NOTICE file
* distributed with this work for additional information
* regarding copyright ownership. The ASF licenses this file
* to you under the Apache License, Version 2.0 (the
* "License"); you may not use this file except in compliance
* with the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing,
* software distributed under the License is distributed on an
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
* KIND, either express or implied. See the License for the
* specific language governing permissions and limitations
* under the License.
* ====================================================================
*/
#ifndef SVN_FS_UTIL_H
#define SVN_FS_UTIL_H
#include <apr_pools.h>
#include "svn_types.h"
#include "svn_error.h"
#include "svn_fs.h"
#ifdef __cplusplus
extern "C" {
#endif /* __cplusplus */
/* Returns whether PATH is in canonical form as defined by
svn_fs__canonicalize_abspath().
*/
svn_boolean_t
svn_fs__is_canonical_abspath(const char *path);
/* Return a canonicalized version of a filesystem PATH, allocated in POOL.
While the filesystem API is pretty flexible about the incoming paths
(they must be UTF-8 with '/' as separators, but they don't have to
begin with '/', and multiple contiguous '/'s are ignored) we want any
paths that are physically stored in the underlying database to look
consistent. Specifically, absolute filesystem paths should begin with
'/', and all redundant and trailing '/' characters be removed.
This is similar to svn_fspath__canonicalize() but doesn't treat "."
segments as special.
*/
const char *
svn_fs__canonicalize_abspath(const char *path, apr_pool_t *pool);
/* If EXPECT_OPEN, verify that FS refers to an open database;
otherwise, verify that FS refers to an unopened database. Return
an appropriate error if the expectation fails to match the
reality. */
svn_error_t *
svn_fs__check_fs(svn_fs_t *fs, svn_boolean_t expect_open);
/* An identifier for FS to be used in the text of error messages.
(Not used anywhere but in this header.)
Note: we log the UUID, rather than (fs)->path, since some of these
errors are marshalled to the client. */
#define svn_fs__identifier(fs) ((fs)->uuid)
/* Constructing nice error messages for roots. */
/* Build an SVN_ERR_FS_NOT_FOUND error, with a detailed error text,
for PATH in ROOT. ROOT is of type svn_fs_root_t *. */
#define SVN_FS__NOT_FOUND(root, path) ( \
root->is_txn_root ? \
svn_error_createf \
(SVN_ERR_FS_NOT_FOUND, 0, \
_("File not found: transaction '%s', path '%s'"), \
root->txn, path) \
: \
svn_error_createf \
(SVN_ERR_FS_NOT_FOUND, 0, \
_("File not found: revision %ld, path '%s'"), \
root->rev, path) \
)
/* Build a detailed `file already exists' message for PATH in ROOT.
ROOT is of type svn_fs_root_t *. */
#define SVN_FS__ALREADY_EXISTS(root, path_str) ( \
root->is_txn_root ? \
svn_error_createf \
(SVN_ERR_FS_ALREADY_EXISTS, 0, \
_("File already exists: filesystem '%s', transaction '%s', path '%s'"), \
svn_fs__identifier(root->fs), root->txn, path_str) \
: \
svn_error_createf \
(SVN_ERR_FS_ALREADY_EXISTS, 0, \
_("File already exists: filesystem '%s', revision %ld, path '%s'"), \
svn_fs__identifier(root->fs), root->rev, path_str) \
)
/* ROOT is of type svn_fs_root_t *. */
#define SVN_FS__NOT_TXN(root) \
svn_error_create \
(SVN_ERR_FS_NOT_TXN_ROOT, NULL, \
_("Root object must be a transaction root"))
/* SVN_FS__ERR_NOT_MUTABLE: the caller attempted to change a node
outside of a transaction. FS is of type "svn_fs_t *". */
#define SVN_FS__ERR_NOT_MUTABLE(fs, rev, path_in_repo) \
svn_error_createf( \
SVN_ERR_FS_NOT_MUTABLE, 0, \
_("File is not mutable: filesystem '%s', revision %ld, path '%s'"), \
svn_fs__identifier(fs), rev, path_in_repo)
/* FS is of type "svn_fs_t *".*/
#define SVN_FS__ERR_NOT_DIRECTORY(fs, path_in_repo) \
svn_error_createf( \
SVN_ERR_FS_NOT_DIRECTORY, 0, \
_("'%s' is not a directory in filesystem '%s'"), \
path_in_repo, svn_fs__identifier(fs))
/* FS is of type "svn_fs_t *". */
#define SVN_FS__ERR_NOT_FILE(fs, path_in_repo) \
svn_error_createf( \
SVN_ERR_FS_NOT_FILE, 0, \
_("'%s' is not a file in filesystem '%s'"), \
path_in_repo, svn_fs__identifier(fs))
/* FS is of type "svn_fs_t *", LOCK is of type "svn_lock_t *". */
#define SVN_FS__ERR_PATH_ALREADY_LOCKED(fs, lock) \
svn_error_createf( \
SVN_ERR_FS_PATH_ALREADY_LOCKED, 0, \
_("Path '%s' is already locked by user '%s' in filesystem '%s'"), \
(lock)->path, (lock)->owner, svn_fs__identifier(fs))
/* FS is of type "svn_fs_t *". */
#define SVN_FS__ERR_NO_SUCH_LOCK(fs, path_in_repo) \
svn_error_createf( \
SVN_ERR_FS_NO_SUCH_LOCK, 0, \
_("No lock on path '%s' in filesystem '%s'"), \
path_in_repo, svn_fs__identifier(fs))
/* FS is of type "svn_fs_t *". */
#define SVN_FS__ERR_LOCK_EXPIRED(fs, token) \
svn_error_createf( \
SVN_ERR_FS_LOCK_EXPIRED, 0, \
_("Lock has expired: lock-token '%s' in filesystem '%s'"), \
token, svn_fs__identifier(fs))
/* FS is of type "svn_fs_t *". */
#define SVN_FS__ERR_NO_USER(fs) \
svn_error_createf( \
SVN_ERR_FS_NO_USER, 0, \
_("No username is currently associated with filesystem '%s'"), \
svn_fs__identifier(fs))
/* SVN_FS__ERR_LOCK_OWNER_MISMATCH: trying to use a lock whose
LOCK_OWNER doesn't match the USERNAME associated with FS.
FS is of type "svn_fs_t *". */
#define SVN_FS__ERR_LOCK_OWNER_MISMATCH(fs, username, lock_owner) \
svn_error_createf( \
SVN_ERR_FS_LOCK_OWNER_MISMATCH, 0, \
_("User '%s' is trying to use a lock owned by '%s' in " \
"filesystem '%s'"), \
username, lock_owner, svn_fs__identifier(fs))
/* Return a NULL-terminated copy of the first component of PATH,
allocated in POOL. If path is empty, or consists entirely of
slashes, return the empty string.
If the component is followed by one or more slashes, we set *NEXT_P
to point after the slashes. If the component ends PATH, we set
*NEXT_P to zero. This means:
- If *NEXT_P is zero, then the component ends the PATH, and there
are no trailing slashes in the path.
- If *NEXT_P points at PATH's terminating NULL character, then
the component returned was the last, and PATH ends with one or more
slash characters.
- Otherwise, *NEXT_P points to the beginning of the next component
of PATH. You can pass this value to next_entry_name to extract
the next component. */
char *
svn_fs__next_entry_name(const char **next_p,
const char *path,
apr_pool_t *pool);
/* Allocate an svn_fs_path_change2_t structure in POOL, initialize and
return it.
Set the node_rev_id field of the created struct to NODE_REV_ID, and
change_kind to CHANGE_KIND. Set all other fields to their _unknown,
NULL or invalid value, respectively. */
svn_fs_path_change2_t *
svn_fs__path_change_create_internal(const svn_fs_id_t *node_rev_id,
svn_fs_path_change_kind_t change_kind,
apr_pool_t *pool);
/* Append REL_PATH (which may contain slashes) to each path that exists in
the mergeinfo INPUT, and return a new mergeinfo in *OUTPUT. Deep
copies the values. Perform all allocations in POOL. */
svn_error_t *
svn_fs__append_to_merged_froms(svn_mergeinfo_t *output,
svn_mergeinfo_t input,
const char *rel_path,
apr_pool_t *pool);
#ifdef __cplusplus
}
#endif /* __cplusplus */
#endif /* SVN_FS_UTIL_H */

View File

@ -0,0 +1,175 @@
/**
* @copyright
* ====================================================================
* Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements. See the NOTICE file
* distributed with this work for additional information
* regarding copyright ownership. The ASF licenses this file
* to you under the Apache License, Version 2.0 (the
* "License"); you may not use this file except in compliance
* with the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing,
* software distributed under the License is distributed on an
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
* KIND, either express or implied. See the License for the
* specific language governing permissions and limitations
* under the License.
* ====================================================================
* @endcopyright
*
* @file svn_fspath.h
* @brief Implementation of path manipulation functions similar to
* those in svn_dirent_uri.h (which see for details) but for
* the private fspath class of paths.
*/
#ifndef SVN_FSPATH_H
#define SVN_FSPATH_H
#include <apr.h>
#include <apr_pools.h>
#include "svn_types.h"
#ifdef __cplusplus
extern "C" {
#endif /* __cplusplus */
/** Return TRUE iff @a fspath is canonical.
* @a fspath need not be canonical, of course.
*
* @since New in 1.7.
*/
svn_boolean_t
svn_fspath__is_canonical(const char *fspath);
/** This function is similar to svn_relpath_canonicalize(), except
* that it returns an fspath (which is essentially just a relpath
* tacked onto a leading forward slash).
*
* The returned fspath may be statically allocated or allocated from
* @a pool.
*
* This is similar to svn_fs__canonicalize_abspath() but also treats "."
* segments as special.
*
* @since New in 1.7.
*/
const char *
svn_fspath__canonicalize(const char *fspath,
apr_pool_t *pool);
/** Return the dirname of @a fspath, defined as the path with its basename
* removed. If @a fspath is "/", return "/".
*
* Allocate the result in @a pool.
*
* @since New in 1.7.
*/
const char *
svn_fspath__dirname(const char *fspath,
apr_pool_t *pool);
/** Return the last component of @a fspath. The returned value will have no
* slashes in it. If @a fspath is "/", return "".
*
* If @a pool is NULL, return a pointer to within @a fspath, else allocate
* the result in @a pool.
*
* @since New in 1.7.
*/
const char *
svn_fspath__basename(const char *fspath,
apr_pool_t *pool);
/** Divide the canonical @a fspath into @a *dirpath and @a
* *base_name, allocated in @a pool.
*
* If @a dirpath or @a base_name is NULL, then don't set that one.
*
* Either @a dirpath or @a base_name may be @a fspath's own address, but they
* may not both be the same address, or the results are undefined.
*
* If @a fspath has two or more components, the separator between @a dirpath
* and @a base_name is not included in either of the new names.
*
* @since New in 1.7.
*/
void
svn_fspath__split(const char **dirpath,
const char **base_name,
const char *fspath,
apr_pool_t *result_pool);
/** Return the fspath composed of @a fspath with @a relpath appended.
* Allocate the result in @a result_pool.
*
* @since New in 1.7.
*/
char *
svn_fspath__join(const char *fspath,
const char *relpath,
apr_pool_t *result_pool);
/** Return TRUE if @a fspath (with length @a len) is the root
* directory; return FALSE otherwise.
*
* @since New in 1.7.
*/
svn_boolean_t
svn_fspath__is_root(const char *fspath,
apr_size_t len);
/** Return the relative path part of @a child_fspath that is below
* @a parent_fspath, or just "" if @a parent_fspath is equal to
* @a child_fspath. If @a child_fspath is not below @a parent_fspath
* or equal to it, return @c NULL.
*
* @since New in 1.7.
*/
const char *
svn_fspath__skip_ancestor(const char *parent_fspath,
const char *child_fspath);
/** Return the longest common path shared by two fspaths, @a fspath1 and
* @a fspath2. If there's no common ancestor, return "/".
*
* @since New in 1.7.
*/
char *
svn_fspath__get_longest_ancestor(const char *fspath1,
const char *fspath2,
apr_pool_t *result_pool);
/** A faux fspath API used by the DAV modules to help us distinguish
* between real URI-decoded fspaths and URI-encoded URL path-portions.
*/
#define svn_urlpath__basename svn_fspath__basename
#define svn_urlpath__dirname svn_fspath__dirname
#define svn_urlpath__get_longest_ancestor svn_fspath__get_longest_ancestor
#define svn_urlpath__is_canonical svn_fspath__is_canonical
#define svn_urlpath__is_root svn_fspath__is_root
#define svn_urlpath__join svn_fspath__join
#define svn_urlpath__skip_ancestor svn_fspath__skip_ancestor
#define svn_urlpath__split svn_fspath__split
/* Like svn_fspath__canonicalize(), but this one accepts both full
URLs and URL path-portions. */
const char *
svn_urlpath__canonicalize(const char *uri, apr_pool_t *pool);
#ifdef __cplusplus
}
#endif /* __cplusplus */
#endif /* SVN_FSPATH_H */

View File

@ -0,0 +1,99 @@
/**
* @copyright
* ====================================================================
* Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements. See the NOTICE file
* distributed with this work for additional information
* regarding copyright ownership. The ASF licenses this file
* to you under the Apache License, Version 2.0 (the
* "License"); you may not use this file except in compliance
* with the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing,
* software distributed under the License is distributed on an
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
* KIND, either express or implied. See the License for the
* specific language governing permissions and limitations
* under the License.
* ====================================================================
* @endcopyright
*
* @file svn_io_private.h
* @brief Private IO API
*/
#ifndef SVN_IO_PRIVATE_H
#define SVN_IO_PRIVATE_H
#include <apr.h>
#ifdef __cplusplus
extern "C" {
#endif /* __cplusplus */
/* The flags to pass to apr_stat to check for executable and/or readonly */
#if defined(WIN32) || defined(__OS2__)
#define SVN__APR_FINFO_EXECUTABLE (0)
#define SVN__APR_FINFO_READONLY (0)
#define SVN__APR_FINFO_MASK_OUT (APR_FINFO_PROT | APR_FINFO_OWNER)
#else
#define SVN__APR_FINFO_EXECUTABLE (APR_FINFO_PROT)
#define SVN__APR_FINFO_READONLY (APR_FINFO_PROT | APR_FINFO_OWNER)
#define SVN__APR_FINFO_MASK_OUT (0)
#endif
/** Set @a *executable TRUE if @a file_info is executable for the
* user, FALSE otherwise.
*
* Always returns FALSE on Windows or platforms without user support.
*/
svn_error_t *
svn_io__is_finfo_executable(svn_boolean_t *executable,
apr_finfo_t *file_info,
apr_pool_t *pool);
/** Set @a *read_only TRUE if @a file_info is read-only for the user,
* FALSE otherwise.
*/
svn_error_t *
svn_io__is_finfo_read_only(svn_boolean_t *read_only,
apr_finfo_t *file_info,
apr_pool_t *pool);
/** Buffer test handler function for a generic stream. @see svn_stream_t
* and svn_stream__is_buffered().
*
* @since New in 1.7.
*/
typedef svn_boolean_t (*svn_stream__is_buffered_fn_t)(void *baton);
/** Set @a stream's buffer test function to @a is_buffered_fn
*
* @since New in 1.7.
*/
void
svn_stream__set_is_buffered(svn_stream_t *stream,
svn_stream__is_buffered_fn_t is_buffered_fn);
/** Return whether this generic @a stream uses internal buffering.
* This may be used to work around subtle differences between buffered
* an non-buffered APR files. A lazy-open stream cannot report the
* true buffering state until after the lazy open: a stream that
* initially reports as non-buffered may report as buffered later.
*
* @since New in 1.7.
*/
svn_boolean_t
svn_stream__is_buffered(svn_stream_t *stream);
#ifdef __cplusplus
}
#endif /* __cplusplus */
#endif /* SVN_IO_PRIVATE_H */

View File

@ -0,0 +1,260 @@
/*
* svn_log.h: Functions for assembling entries for server-side logs.
* See also tools/server-side/svn_server_log_parse.py .
* ====================================================================
* Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements. See the NOTICE file
* distributed with this work for additional information
* regarding copyright ownership. The ASF licenses this file
* to you under the Apache License, Version 2.0 (the
* "License"); you may not use this file except in compliance
* with the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing,
* software distributed under the License is distributed on an
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
* KIND, either express or implied. See the License for the
* specific language governing permissions and limitations
* under the License.
* ====================================================================
*/
#ifndef SVN_LOG_H
#define SVN_LOG_H
#include <apr.h>
#include <apr_pools.h>
#include <apr_tables.h>
#include "svn_types.h"
#include "svn_mergeinfo.h"
#ifdef __cplusplus
extern "C" {
#endif /* __cplusplus */
/**
* Return a log string for a reparent action.
*
* @since New in 1.6.
*/
const char *
svn_log__reparent(const char *path, apr_pool_t *pool);
/**
* Return a log string for a change-rev-prop action.
*
* @since New in 1.6.
*/
const char *
svn_log__change_rev_prop(svn_revnum_t rev, const char *name, apr_pool_t *pool);
/**
* Return a log string for a rev-proplist action.
*
* @since New in 1.6.
*/
const char *
svn_log__rev_proplist(svn_revnum_t rev, apr_pool_t *pool);
/**
* Return a log string for a rev-prop action.
*
* @since New in 1.6.
*/
const char *
svn_log__rev_prop(svn_revnum_t rev, const char *name, apr_pool_t *pool);
/**
* Return a log string for a commit action.
*
* @since New in 1.6.
*/
const char *
svn_log__commit(svn_revnum_t rev, apr_pool_t *pool);
/**
* Return a log string for a get-file action.
*
* @since New in 1.6.
*/
const char *
svn_log__get_file(const char *path, svn_revnum_t rev,
svn_boolean_t want_contents, svn_boolean_t want_props,
apr_pool_t *pool);
/**
* Return a log string for a get-dir action.
*
* @since New in 1.6.
*/
const char *
svn_log__get_dir(const char *path, svn_revnum_t rev,
svn_boolean_t want_contents, svn_boolean_t want_props,
apr_uint64_t dirent_fields,
apr_pool_t *pool);
/**
* Return a log string for a get-mergeinfo action.
*
* @since New in 1.6.
*/
const char *
svn_log__get_mergeinfo(const apr_array_header_t *paths,
svn_mergeinfo_inheritance_t inherit,
svn_boolean_t include_descendants,
apr_pool_t *pool);
/**
* Return a log string for a checkout action.
*
* @since New in 1.6.
*/
const char *
svn_log__checkout(const char *path, svn_revnum_t rev, svn_depth_t depth,
apr_pool_t *pool);
/**
* Return a log string for an update action.
*
* @since New in 1.6.
*/
const char *
svn_log__update(const char *path, svn_revnum_t rev, svn_depth_t depth,
svn_boolean_t send_copyfrom_args,
apr_pool_t *pool);
/**
* Return a log string for a switch action.
*
* @since New in 1.6.
*/
const char *
svn_log__switch(const char *path, const char *dst_path, svn_revnum_t revnum,
svn_depth_t depth, apr_pool_t *pool);
/**
* Return a log string for a status action.
*
* @since New in 1.6.
*/
const char *
svn_log__status(const char *path, svn_revnum_t rev, svn_depth_t depth,
apr_pool_t *pool);
/**
* Return a log string for a diff action.
*
* @since New in 1.6.
*/
const char *
svn_log__diff(const char *path, svn_revnum_t from_revnum,
const char *dst_path, svn_revnum_t revnum,
svn_depth_t depth, svn_boolean_t ignore_ancestry,
apr_pool_t *pool);
/**
* Return a log string for a log action.
*
* @since New in 1.6.
*/
const char *
svn_log__log(const apr_array_header_t *paths,
svn_revnum_t start, svn_revnum_t end,
int limit, svn_boolean_t discover_changed_paths,
svn_boolean_t strict_node_history,
svn_boolean_t include_merged_revisions,
const apr_array_header_t *revprops, apr_pool_t *pool);
/**
* Return a log string for a get-locations action.
*
* @since New in 1.6.
*/
const char *
svn_log__get_locations(const char *path, svn_revnum_t peg_revision,
const apr_array_header_t *location_revisions,
apr_pool_t *pool);
/**
* Return a log string for a get-location-segments action.
*
* @since New in 1.6.
*/
const char *
svn_log__get_location_segments(const char *path, svn_revnum_t peg_revision,
svn_revnum_t start, svn_revnum_t end,
apr_pool_t *pool);
/**
* Return a log string for a get-file-revs action.
*
* @since New in 1.6.
*/
const char *
svn_log__get_file_revs(const char *path, svn_revnum_t start, svn_revnum_t end,
svn_boolean_t include_merged_revisions,
apr_pool_t *pool);
/**
* Return a log string for a lock action.
*
* @since New in 1.6.
*/
const char *
svn_log__lock(const apr_array_header_t *paths, svn_boolean_t steal,
apr_pool_t *pool);
/**
* Return a log string for an unlock action.
*
* @since New in 1.6.
*/
const char *
svn_log__unlock(const apr_array_header_t *paths, svn_boolean_t break_lock,
apr_pool_t *pool);
/**
* Return a log string for a lock action on only one path; this is
* just a convenience wrapper around svn_log__lock().
*
* @since New in 1.6.
*/
const char *
svn_log__lock_one_path(const char *path, svn_boolean_t steal,
apr_pool_t *pool);
/**
* Return a log string for an unlock action on only one path; this is
* just a convenience wrapper around svn_log__unlock().
*
* @since New in 1.6.
*/
const char *
svn_log__unlock_one_path(const char *path, svn_boolean_t break_lock,
apr_pool_t *pool);
/**
* Return a log string for a replay action.
*
* @since New in 1.6.
*/
const char *
svn_log__replay(const char *path, svn_revnum_t rev, apr_pool_t *pool);
/**
* Return a log string for a get-inherited-props action.
*
* @since New in 1.8.
*/
const char *
svn_log__get_inherited_props(const char *path,
svn_revnum_t rev,
apr_pool_t *pool);
#ifdef __cplusplus
}
#endif /* __cplusplus */
#endif /* SVN_LOG_H */

View File

@ -0,0 +1,55 @@
/**
* @copyright
* ====================================================================
* Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements. See the NOTICE file
* distributed with this work for additional information
* regarding copyright ownership. The ASF licenses this file
* to you under the Apache License, Version 2.0 (the
* "License"); you may not use this file except in compliance
* with the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing,
* software distributed under the License is distributed on an
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
* KIND, either express or implied. See the License for the
* specific language governing permissions and limitations
* under the License.
* ====================================================================
* @endcopyright
*
* @file svn_magic.h
* @brief Subversion interface to libmagic.
*/
#ifndef SVN_MAGIC_H
#define SVN_MAGIC_H
/* An opaque struct that wraps a libmagic cookie. */
typedef struct svn_magic__cookie_t svn_magic__cookie_t;
/* This routine initialises libmagic.
* Upon success a new *MAGIC_COOKIE is allocated in RESULT_POOL.
* On failure *MAGIC_COOKIE is set to NULL.
* All resources used by libmagic are freed by a cleanup handler
* installed on RESULT_POOL, i.e. *MAGIC_COOKIE becomes invalid when
* the pool is cleared! */
void
svn_magic__init(svn_magic__cookie_t **magic_cookie,
apr_pool_t *result_pool);
/* Detect the mime-type of the file at LOCAL_ABSPATH using MAGIC_COOKIE.
* If the mime-type is binary return the result in *MIMETYPE.
* If the file is not a binary file or if its mime-type cannot be determined
* set *MIMETYPE to NULL. Allocate *MIMETYPE in RESULT_POOL.
* Use SCRATCH_POOL for temporary allocations. */
svn_error_t *
svn_magic__detect_binary_mimetype(const char **mimetype,
const char *local_abspath,
svn_magic__cookie_t *magic_cookie,
apr_pool_t *result_pool,
apr_pool_t *scratch_pool);
#endif /* SVN_MAGIC_H */

View File

@ -0,0 +1,270 @@
/**
* @copyright
* ====================================================================
* Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements. See the NOTICE file
* distributed with this work for additional information
* regarding copyright ownership. The ASF licenses this file
* to you under the Apache License, Version 2.0 (the
* "License"); you may not use this file except in compliance
* with the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing,
* software distributed under the License is distributed on an
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
* KIND, either express or implied. See the License for the
* specific language governing permissions and limitations
* under the License.
* ====================================================================
* @endcopyright
*
* @file svn_mergeinfo_private.h
* @brief Subversion-internal mergeinfo APIs.
*/
#ifndef SVN_MERGEINFO_PRIVATE_H
#define SVN_MERGEINFO_PRIVATE_H
#include <apr_pools.h>
#include "svn_types.h"
#include "svn_error.h"
#include "svn_mergeinfo.h"
#ifdef __cplusplus
extern "C" {
#endif /* __cplusplus */
/* Set inheritability of all ranges in RANGELIST to INHERITABLE.
If RANGELIST is NULL do nothing. */
void
svn_rangelist__set_inheritance(svn_rangelist_t *rangelist,
svn_boolean_t inheritable);
/* Parse a rangelist from the string STR. Set *RANGELIST to the result,
* allocated in RESULT_POOL. Return an error if the rangelist is not
* well-formed (for example, if it contains invalid characters or if
* R1 >= R2 in a "R1-R2" range element).
*
* Unlike svn_mergeinfo_parse(), this does not sort the ranges into order
* or combine adjacent and overlapping ranges.
*
* The compaction can be done with svn_rangelist__combine_adjacent_ranges().
*/
svn_error_t *
svn_rangelist__parse(svn_rangelist_t **rangelist,
const char *str,
apr_pool_t *result_pool);
/* In-place combines adjacent ranges in a rangelist.
SCRATCH_POOL is just used for providing error messages. */
svn_error_t *
svn_rangelist__combine_adjacent_ranges(svn_rangelist_t *rangelist,
apr_pool_t *scratch_pool);
/* Set inheritability of all rangelists in MERGEINFO to INHERITABLE.
If MERGEINFO is NULL do nothing. If a rangelist in MERGEINFO is
NULL leave it alone. */
void
svn_mergeinfo__set_inheritance(svn_mergeinfo_t mergeinfo,
svn_boolean_t inheritable,
apr_pool_t *scratch_pool);
/* Return whether INFO1 and INFO2 are equal in *IS_EQUAL.
CONSIDER_INHERITANCE determines how the rangelists in the two
hashes are compared for equality. If CONSIDER_INHERITANCE is FALSE,
then the start and end revisions of the svn_merge_range_t's being
compared are the only factors considered when determining equality.
e.g. '/trunk: 1,3-4*,5' == '/trunk: 1,3-5'
If CONSIDER_INHERITANCE is TRUE, then the inheritability of the
svn_merge_range_t's is also considered and must be the same for two
otherwise identical ranges to be judged equal.
e.g. '/trunk: 1,3-4*,5' != '/trunk: 1,3-5'
'/trunk: 1,3-4*,5' == '/trunk: 1,3-4*,5'
'/trunk: 1,3-4,5' == '/trunk: 1,3-4,5'
Use POOL for temporary allocations. */
svn_error_t *
svn_mergeinfo__equals(svn_boolean_t *is_equal,
svn_mergeinfo_t info1,
svn_mergeinfo_t info2,
svn_boolean_t consider_inheritance,
apr_pool_t *pool);
/* Examine MERGEINFO, removing all paths from the hash which map to
empty rangelists. POOL is used only to allocate the apr_hash_index_t
iterator. Returns TRUE if any paths were removed and FALSE if none were
removed or MERGEINFO is NULL. */
svn_boolean_t
svn_mergeinfo__remove_empty_rangelists(svn_mergeinfo_t mergeinfo,
apr_pool_t *pool);
/* Make a shallow (ie, mergeinfos are not duped, or altered at all;
keys share storage) copy of IN_CATALOG in *OUT_CATALOG, removing
PREFIX_PATH from the beginning of each key in the catalog.
PREFIX_PATH and the keys of IN_CATALOG are absolute 'fspaths',
starting with '/'. It is illegal for any key to not start with
PREFIX_PATH. The keys of *OUT_CATALOG are relpaths. The new hash
and temporary values are allocated in POOL. (This is useful for
making the return value from svn_ra_get_mergeinfo relative to the
session root, say.) */
svn_error_t *
svn_mergeinfo__remove_prefix_from_catalog(svn_mergeinfo_catalog_t *out_catalog,
svn_mergeinfo_catalog_t in_catalog,
const char *prefix_path,
apr_pool_t *pool);
/* Make a shallow (ie, mergeinfos are not duped, or altered at all;
though keys are reallocated) copy of IN_CATALOG in *OUT_CATALOG,
adding PREFIX_PATH to the beginning of each key in the catalog.
The new hash keys are allocated in RESULT_POOL. SCRATCH_POOL
is used for any temporary allocations.*/
svn_error_t *
svn_mergeinfo__add_prefix_to_catalog(svn_mergeinfo_catalog_t *out_catalog,
svn_mergeinfo_catalog_t in_catalog,
const char *prefix_path,
apr_pool_t *result_pool,
apr_pool_t *scratch_pool);
/* Set *OUT_MERGEINFO to a shallow copy of MERGEINFO with the relpath
SUFFIX_RELPATH added to the end of each key path.
Allocate *OUT_MERGEINFO and the new keys in RESULT_POOL. Use
SCRATCH_POOL for any temporary allocations. */
svn_error_t *
svn_mergeinfo__add_suffix_to_mergeinfo(svn_mergeinfo_t *out_mergeinfo,
svn_mergeinfo_t mergeinfo,
const char *suffix_relpath,
apr_pool_t *result_pool,
apr_pool_t *scratch_pool);
/* Create a string representation of CATALOG in *OUTPUT, allocated in POOL.
The hash keys of CATALOG and the merge source paths of each key's mergeinfo
are represented in sorted order as per svn_sort_compare_items_as_paths.
If CATALOG is empty or NULL then *OUTPUT->DATA is set to "\n". If SVN_DEBUG
is true, then a NULL or empty CATALOG causes *OUTPUT to be set to an
appropriate newline terminated string. If KEY_PREFIX is not NULL then
prepend KEY_PREFIX to each key (path) in *OUTPUT. if VAL_PREFIX is not
NULL then prepend VAL_PREFIX to each merge source:rangelist line in
*OUTPUT.
Any relative merge source paths in the mergeinfo in CATALOG are converted
to absolute paths in *OUTPUT. */
svn_error_t *
svn_mergeinfo__catalog_to_formatted_string(svn_string_t **output,
svn_mergeinfo_catalog_t catalog,
const char *key_prefix,
const char *val_prefix,
apr_pool_t *pool);
/* Set *YOUNGEST_REV and *OLDEST_REV to the youngest and oldest revisions
found in the rangelists within MERGEINFO. Note that *OLDEST_REV is
exclusive and *YOUNGEST_REV is inclusive. If MERGEINFO is NULL or empty
set *YOUNGEST_REV and *OLDEST_REV to SVN_INVALID_REVNUM. */
svn_error_t *
svn_mergeinfo__get_range_endpoints(svn_revnum_t *youngest_rev,
svn_revnum_t *oldest_rev,
svn_mergeinfo_t mergeinfo,
apr_pool_t *pool);
/* Set *FILTERED_MERGEINFO to a deep copy of MERGEINFO, allocated in
RESULT_POOL, less any revision ranges that fall outside of the range
OLDEST_REV:YOUNGEST_REV (exclusive:inclusive) if INCLUDE_RANGE is true,
or less any ranges within OLDEST_REV:YOUNGEST_REV if INCLUDE_RANGE
is false. If all the rangelists mapped to a given path are filtered
then filter that path as well. If all paths are filtered or MERGEINFO is
empty or NULL then *FILTERED_MERGEINFO is set to an empty hash.
Use SCRATCH_POOL for any temporary allocations. */
svn_error_t *
svn_mergeinfo__filter_mergeinfo_by_ranges(svn_mergeinfo_t *filtered_mergeinfo,
svn_mergeinfo_t mergeinfo,
svn_revnum_t youngest_rev,
svn_revnum_t oldest_rev,
svn_boolean_t include_range,
apr_pool_t *result_pool,
apr_pool_t *scratch_pool);
/* Filter each mergeinfo in CATALOG as per
svn_mergeinfo__filter_mergeinfo_by_ranges() and put a deep copy of the
result in *FILTERED_CATALOG, allocated in RESULT_POOL. If any mergeinfo
is filtered to an empty hash then filter that path/mergeinfo as well.
If all mergeinfo is filtered or CATALOG is NULL then set *FILTERED_CATALOG
to an empty hash.
Use SCRATCH_POOL for any temporary allocations. */
svn_error_t*
svn_mergeinfo__filter_catalog_by_ranges(
svn_mergeinfo_catalog_t *filtered_catalog,
svn_mergeinfo_catalog_t catalog,
svn_revnum_t youngest_rev,
svn_revnum_t oldest_rev,
svn_boolean_t include_range,
apr_pool_t *result_pool,
apr_pool_t *scratch_pool);
/* If MERGEINFO is non-inheritable return TRUE, return FALSE otherwise.
MERGEINFO may be NULL or empty. */
svn_boolean_t
svn_mergeinfo__is_noninheritable(svn_mergeinfo_t mergeinfo,
apr_pool_t *scratch_pool);
/* Return a rangelist with one svn_merge_range_t * element defined by START,
END, and INHERITABLE. The rangelist and its contents are allocated in
RESULT_POOL. */
svn_rangelist_t *
svn_rangelist__initialize(svn_revnum_t start,
svn_revnum_t end,
svn_boolean_t inheritable,
apr_pool_t *result_pool);
/* Adjust in-place MERGEINFO's rangelists by OFFSET. If OFFSET is negative
and would adjust any part of MERGEINFO's source revisions to 0 or less,
then those revisions are dropped. If all the source revisions for a merge
source path are dropped, then the path itself is dropped. If all merge
source paths are dropped, then *ADJUSTED_MERGEINFO is set to an empty
hash. *ADJUSTED_MERGEINFO is allocated in RESULT_POOL. SCRATCH_POOL is
used for any temporary allocations. */
svn_error_t *
svn_mergeinfo__adjust_mergeinfo_rangelists(svn_mergeinfo_t *adjusted_mergeinfo,
svn_mergeinfo_t mergeinfo,
svn_revnum_t offset,
apr_pool_t *result_pool,
apr_pool_t *scratch_pool);
/* Translates an array SEGMENTS (of svn_location_segment_t *), like the one
returned from svn_client__repos_location_segments, into a mergeinfo
*MERGEINFO_P, allocated in POOL.
Note: A svn_location_segment_t segment may legitimately describe only revision 0,
but there is no way to describe that using svn_mergeinfo_t. Any such
segment in SEGMENTS are ignored. */
svn_error_t *
svn_mergeinfo__mergeinfo_from_segments(svn_mergeinfo_t *mergeinfo_p,
const apr_array_header_t *segments,
apr_pool_t *pool);
/* Merge every rangelist in MERGEINFO into the given MERGED_RANGELIST,
* ignoring the source paths of MERGEINFO. MERGED_RANGELIST may
* initially be empty. New elements added to RANGELIST are allocated in
* RESULT_POOL. See svn_rangelist_merge2() for details of inheritability
* etc. */
svn_error_t *
svn_rangelist__merge_many(svn_rangelist_t *merged_rangelist,
svn_mergeinfo_t mergeinfo,
apr_pool_t *result_pool,
apr_pool_t *scratch_pool);
#ifdef __cplusplus
}
#endif /* __cplusplus */
#endif /* SVN_MERGEINFO_PRIVATE_H */

View File

@ -0,0 +1,117 @@
/**
* @copyright
* ====================================================================
* Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements. See the NOTICE file
* distributed with this work for additional information
* regarding copyright ownership. The ASF licenses this file
* to you under the Apache License, Version 2.0 (the
* "License"); you may not use this file except in compliance
* with the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing,
* software distributed under the License is distributed on an
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
* KIND, either express or implied. See the License for the
* specific language governing permissions and limitations
* under the License.
* ====================================================================
* @endcopyright
*
* @file svn_mutex.h
* @brief Strutures and functions for mutual exclusion
*/
#ifndef SVN_MUTEX_H
#define SVN_MUTEX_H
#include <apr_thread_mutex.h>
#include "svn_error.h"
#ifdef __cplusplus
extern "C" {
#endif /* __cplusplus */
/**
* This is a simple wrapper around @c apr_thread_mutex_t and will be a
* valid identifier even if APR does not support threading.
*/
#if APR_HAS_THREADS
/** A mutex for synchronization between threads. It may be NULL, in
* which case no synchronization will take place. The latter is useful
* when implementing some functionality with optional synchronization.
*/
typedef apr_thread_mutex_t svn_mutex__t;
#else
/** Dummy definition. The content will never be actually accessed.
*/
typedef void svn_mutex__t;
#endif
/** Initialize the @a *mutex. If @a mutex_required is TRUE, the mutex will
* actually be created with a lifetime defined by @a result_pool. Otherwise,
* the pointer will be set to @c NULL and svn_mutex__lock() as well as
* svn_mutex__unlock() will be no-ops.
*
* If threading is not supported by APR, this function is a no-op.
*/
svn_error_t *
svn_mutex__init(svn_mutex__t **mutex,
svn_boolean_t mutex_required,
apr_pool_t *result_pool);
/** Acquire the @a mutex, if that has been enabled in svn_mutex__init().
* Make sure to call svn_mutex__unlock() some time later in the same
* thread to release the mutex again. Recursive locking are not supported.
*
* @note You should use #SVN_MUTEX__WITH_LOCK instead of explicit lock
* aquisition and release.
*/
svn_error_t *
svn_mutex__lock(svn_mutex__t *mutex);
/** Release the @a mutex, previously acquired using svn_mutex__lock()
* that has been enabled in svn_mutex__init().
*
* Since this is often used as part of the calling function's exit
* sequence, we accept that function's current return code in @a err.
* If it is not #SVN_NO_ERROR, it will be used as the return value -
* irrespective of the possible internal failures during unlock. If @a err
* is #SVN_NO_ERROR, internal failures of this function will be
* reported in the return value.
*
* @note You should use #SVN_MUTEX__WITH_LOCK instead of explicit lock
* aquisition and release.
*/
svn_error_t *
svn_mutex__unlock(svn_mutex__t *mutex,
svn_error_t *err);
/** Aquires the @a mutex, executes the expression @a expr and finally
* releases the @a mutex. If any of these steps fail, the function using
* this macro will return an #svn_error_t. This macro guarantees that
* the @a mutex will always be unlocked again if it got locked successfully
* by the first step.
*
* @note Prefer using this macro instead of explicit lock aquisition and
* release.
*/
#define SVN_MUTEX__WITH_LOCK(mutex, expr) \
do { \
svn_mutex__t *svn_mutex__m = (mutex); \
SVN_ERR(svn_mutex__lock(svn_mutex__m)); \
SVN_ERR(svn_mutex__unlock(svn_mutex__m, (expr))); \
} while (0)
#ifdef __cplusplus
}
#endif /* __cplusplus */
#endif /* SVN_MUTEX_H */

View File

@ -0,0 +1,162 @@
/**
* @copyright
* ====================================================================
* Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements. See the NOTICE file
* distributed with this work for additional information
* regarding copyright ownership. The ASF licenses this file
* to you under the Apache License, Version 2.0 (the
* "License"); you may not use this file except in compliance
* with the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing,
* software distributed under the License is distributed on an
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
* KIND, either express or implied. See the License for the
* specific language governing permissions and limitations
* under the License.
* ====================================================================
* @endcopyright
*
* @file svn_named_atomics.h
* @brief Structures and functions for machine-wide named atomics.
* These atomics store 64 bit signed integer values and provide
* a number of basic operations on them. Instead of an address,
* these atomics are identified by strings / names. We also support
* namespaces - mainly to separate debug from production data.
*/
#ifndef SVN_NAMED_ATOMICS_H
#define SVN_NAMED_ATOMICS_H
#include "svn_error.h"
#ifdef __cplusplus
extern "C" {
#endif /* __cplusplus */
/** An opaque structure that represents a namespace, i.e. a container
* for named atomics.
*/
typedef struct svn_atomic_namespace__t svn_atomic_namespace__t;
/** An opaque structure that represents a named, system-wide visible
* 64 bit integer with atomic access routines.
*/
typedef struct svn_named_atomic__t svn_named_atomic__t;
/** Maximum length of the name of any atomic (excluding the terminal NUL).
*/
#define SVN_NAMED_ATOMIC__MAX_NAME_LENGTH 30
/** Returns #FALSE when named atomics are not available to our process
* and svn_atomic_namespace__create is likely to fail.
*
* @note The actual check will be performed only once and later
* changes in process privileges will not reflect in the outcome of future
* calls to this function.
*/
svn_boolean_t
svn_named_atomic__is_supported(void);
/** Returns #TRUE on platforms that don't need expensive synchronization
* objects to serialize access to named atomics. If this returns #FALSE,
* reading from or modifying a #svn_named_atomic__t may be as expensive
* as a file system operation.
*/
svn_boolean_t
svn_named_atomic__is_efficient(void);
/** Create a namespace (i.e. access object) with the given @a name and
* return it in @a *ns.
*
* Multiple access objects with the same name may be created. They access
* the same shared memory region but have independent lifetimes.
*
* The access object will be allocated in @a result_pool and atomics gotten
* from this object will become invalid when the pool is being cleared.
*/
svn_error_t *
svn_atomic_namespace__create(svn_atomic_namespace__t **ns,
const char *name,
apr_pool_t *result_pool);
/** Removes persistent data structures (files in particular) that got
* created for the namespace given by @a name. Use @a pool for temporary
* allocations.
*
* @note You must not call this while the respective namespace is still
* in use. Calling this multiple times for the same namespace is safe.
*/
svn_error_t *
svn_atomic_namespace__cleanup(const char *name,
apr_pool_t *pool);
/** Find the atomic with the specified @a name in namespace @a ns and
* return it in @a *atomic. If no object with that name can be found, the
* behavior depends on @a auto_create. If it is @c FALSE, @a *atomic will
* be set to @c NULL. Otherwise, a new atomic will be created, its value
* set to 0 and the access structure be returned in @a *atomic.
*
* Note that @a name must not exceed #SVN_NAMED_ATOMIC__MAX_NAME_LENGTH
* characters and an error will be returned if the specified name is longer
* than supported.
*
* @note The lifetime of the atomic object is bound to the lifetime
* of the @a ns object, i.e. the pool the latter was created in.
* The data in the namespace persists as long as at least one process
* holds an #svn_atomic_namespace__t object corresponding to it.
*/
svn_error_t *
svn_named_atomic__get(svn_named_atomic__t **atomic,
svn_atomic_namespace__t *ns,
const char *name,
svn_boolean_t auto_create);
/** Read the @a atomic and return its current @a *value.
* An error will be returned if @a atomic is @c NULL.
*/
svn_error_t *
svn_named_atomic__read(apr_int64_t *value,
svn_named_atomic__t *atomic);
/** Set the data in @a atomic to @a new_value and return its old content
* in @a *old_value. @a old_value may be NULL.
*
* An error will be returned if @a atomic is @c NULL.
*/
svn_error_t *
svn_named_atomic__write(apr_int64_t *old_value,
apr_int64_t new_value,
svn_named_atomic__t *atomic);
/** Add @a delta to the data in @a atomic and return its new value in
* @a *new_value. @a new_value may be null.
*
* An error will be returned if @a atomic is @c NULL.
*/
svn_error_t *
svn_named_atomic__add(apr_int64_t *new_value,
apr_int64_t delta,
svn_named_atomic__t *atomic);
/** If the current data in @a atomic equals @a comperand, set it to
* @a new_value. Return the initial value in @a *old_value.
* @a old_value may be NULL.
*
* An error will be returned if @a atomic is @c NULL.
*/
svn_error_t *
svn_named_atomic__cmpxchg(apr_int64_t *old_value,
apr_int64_t new_value,
apr_int64_t comperand,
svn_named_atomic__t *atomic);
#ifdef __cplusplus
}
#endif /* __cplusplus */
#endif /* SVN_NAMED_ATOMICS_H */

View File

@ -0,0 +1,156 @@
/**
* @copyright
* ====================================================================
* Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements. See the NOTICE file
* distributed with this work for additional information
* regarding copyright ownership. The ASF licenses this file
* to you under the Apache License, Version 2.0 (the
* "License"); you may not use this file except in compliance
* with the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing,
* software distributed under the License is distributed on an
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
* KIND, either express or implied. See the License for the
* specific language governing permissions and limitations
* under the License.
* ====================================================================
* @endcopyright
*
* @file svn_opt_private.h
* @brief Subversion-internal option parsing APIs.
*/
#ifndef SVN_OPT_PRIVATE_H
#define SVN_OPT_PRIVATE_H
#include <apr_pools.h>
#include <apr_tables.h>
#include <apr_getopt.h>
#include "svn_error.h"
#ifdef __cplusplus
extern "C" {
#endif /* __cplusplus */
/* Extract the peg revision, if any, from UTF8_TARGET.
*
* If PEG_REVISION is not NULL, return the peg revision in *PEG_REVISION.
* *PEG_REVISION will be an empty string if no peg revision is found.
* Return the true target portion in *TRUE_TARGET.
*
* UTF8_TARGET need not be canonical. *TRUE_TARGET will not be canonical
* unless UTF8_TARGET is.
*
* It is an error if *TRUE_TARGET results in the empty string after the
* split, which happens in case UTF8_TARGET has a leading '@' character
* with no additional '@' characters to escape the first '@'.
*
* Note that *PEG_REVISION will still contain the '@' symbol as the first
* character if a peg revision was found. If a trailing '@' symbol was
* used to escape other '@' characters in UTF8_TARGET, *PEG_REVISION will
* point to the string "@", containing only a single character.
*
* All allocations are done in POOL.
*/
svn_error_t *
svn_opt__split_arg_at_peg_revision(const char **true_target,
const char **peg_revision,
const char *utf8_target,
apr_pool_t *pool);
/* Attempt to transform URL_IN, which is a URL-like user input, into a
* valid URL:
* - escape IRI characters and some other non-URI characters
* - check that no back-path ("..") components are present
* - call svn_uri_canonicalize()
* URL_IN is in UTF-8 encoding and has no peg revision specifier.
* Set *URL_OUT to the result, allocated from POOL.
*/
svn_error_t *
svn_opt__arg_canonicalize_url(const char **url_out,
const char *url_in,
apr_pool_t *pool);
/*
* Attempt to transform PATH_IN, which is a local path-like user input, into a
* valid local path:
* - Attempt to get the correct capitalization by trying to actually find
* the path specified.
* - If the path does not exist (which is valid) the given capitalization
* is used.
* - canonicalize the separator ("/") characters
* - call svn_dirent_canonicalize()
* PATH_IN is in UTF-8 encoding and has no peg revision specifier.
* Set *PATH_OUT to the result, allocated from POOL.
*/
svn_error_t *
svn_opt__arg_canonicalize_path(const char **path_out,
const char *path_in,
apr_pool_t *pool);
/*
* Pull remaining target arguments from OS into *TARGETS_P,
* converting them to UTF-8, followed by targets from KNOWN_TARGETS
* (which might come from, for example, the "--targets" command line
* option), which are already in UTF-8.
*
* On each URL target, do some IRI-to-URI encoding and some
* auto-escaping. On each local path, canonicalize case and path
* separators.
*
* Allocate *TARGETS_P and its elements in POOL.
*
* If a path has the same name as a Subversion working copy
* administrative directory, return SVN_ERR_RESERVED_FILENAME_SPECIFIED;
* if multiple reserved paths are encountered, return a chain of
* errors, all of which are SVN_ERR_RESERVED_FILENAME_SPECIFIED. Do
* not return this type of error in a chain with any other type of
* error, and if this is the only type of error encountered, complete
* the operation before returning the error(s).
*/
svn_error_t *
svn_opt__args_to_target_array(apr_array_header_t **targets_p,
apr_getopt_t *os,
const apr_array_header_t *known_targets,
apr_pool_t *pool);
/**
* Return a human-readable description of @a revision. The result
* will be allocated statically or from @a result_pool.
*
* @since New in 1.7.
*/
const char *
svn_opt__revision_to_string(const svn_opt_revision_t *revision,
apr_pool_t *result_pool);
/**
* Create a revision range structure from two revisions. Return a new range
* allocated in @a result_pool with the start and end initialized to
* (deep copies of) @a *start_revision and @a *end_revision.
*/
svn_opt_revision_range_t *
svn_opt__revision_range_create(const svn_opt_revision_t *start_revision,
const svn_opt_revision_t *end_revision,
apr_pool_t *result_pool);
/**
* Create a revision range structure from two revnums. Return a new range
* allocated in @a result_pool with the start and end kinds initialized to
* #svn_opt_revision_number and values @a start_revnum and @a end_revnum.
*/
svn_opt_revision_range_t *
svn_opt__revision_range_from_revnums(svn_revnum_t start_revnum,
svn_revnum_t end_revnum,
apr_pool_t *result_pool);
#ifdef __cplusplus
}
#endif /* __cplusplus */
#endif /* SVN_OPT_PRIVATE_H */

View File

@ -0,0 +1,83 @@
/**
* @copyright
* ====================================================================
* Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements. See the NOTICE file
* distributed with this work for additional information
* regarding copyright ownership. The ASF licenses this file
* to you under the Apache License, Version 2.0 (the
* "License"); you may not use this file except in compliance
* with the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing,
* software distributed under the License is distributed on an
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
* KIND, either express or implied. See the License for the
* specific language governing permissions and limitations
* under the License.
* ====================================================================
* @endcopyright
*
* @file svn_pseudo_md5.h
* @brief Subversion hash sum calculation for runtime data (only)
*/
#ifndef SVN_PSEUDO_MD5_H
#define SVN_PSEUDO_MD5_H
#include <apr.h> /* for apr_uint32_t */
#ifdef __cplusplus
extern "C" {
#endif /* __cplusplus */
/**
* Calculates a hash sum for 15 bytes in @a x and returns it in @a digest.
* The most significant byte in @a x must be 0 (independent of being on a
* little or big endian machine).
*
* @note Use for runtime data hashing only.
*
* @note The output is NOT an MD5 digest shares has the same basic
* cryptographic properties. Collisions with proper MD5 on the same
* or other input data is equally unlikely as any MD5 collision.
*/
void svn__pseudo_md5_15(apr_uint32_t digest[4],
const apr_uint32_t x[4]);
/**
* Calculates a hash sum for 31 bytes in @a x and returns it in @a digest.
* The most significant byte in @a x must be 0 (independent of being on a
* little or big endian machine).
*
* @note Use for runtime data hashing only.
*
* @note The output is NOT an MD5 digest shares has the same basic
* cryptographic properties. Collisions with proper MD5 on the same
* or other input data is equally unlikely as any MD5 collision.
*/
void svn__pseudo_md5_31(apr_uint32_t digest[4],
const apr_uint32_t x[8]);
/**
* Calculates a hash sum for 63 bytes in @a x and returns it in @a digest.
* The most significant byte in @a x must be 0 (independent of being on a
* little or big endian machine).
*
* @note Use for runtime data hashing only.
*
* @note The output is NOT an MD5 digest shares has the same basic
* cryptographic properties. Collisions with proper MD5 on the same
* or other input data is equally unlikely as any MD5 collision.
*/
void svn__pseudo_md5_63(apr_uint32_t digest[4],
const apr_uint32_t x[16]);
#ifdef __cplusplus
}
#endif /* __cplusplus */
#endif /* SVN_PSEUDO_MD5_H */

View File

@ -0,0 +1,280 @@
/**
* @copyright
* ====================================================================
* Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements. See the NOTICE file
* distributed with this work for additional information
* regarding copyright ownership. The ASF licenses this file
* to you under the Apache License, Version 2.0 (the
* "License"); you may not use this file except in compliance
* with the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing,
* software distributed under the License is distributed on an
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
* KIND, either express or implied. See the License for the
* specific language governing permissions and limitations
* under the License.
* ====================================================================
* @endcopyright
*
* @file svn_ra_private.h
* @brief The Subversion repository access library - Internal routines
*/
#ifndef SVN_RA_PRIVATE_H
#define SVN_RA_PRIVATE_H
#include <apr_pools.h>
#include "svn_error.h"
#include "svn_ra.h"
#include "svn_delta.h"
#include "svn_editor.h"
#include "svn_io.h"
#ifdef __cplusplus
extern "C" {
#endif /* __cplusplus */
/* Return an error with code SVN_ERR_UNSUPPORTED_FEATURE, and an error
message referencing PATH_OR_URL, if the "server" pointed to by
RA_SESSION doesn't support Merge Tracking (e.g. is pre-1.5).
Perform temporary allocations in POOL. */
svn_error_t *
svn_ra__assert_mergeinfo_capable_server(svn_ra_session_t *ra_session,
const char *path_or_url,
apr_pool_t *pool);
/*** Operational Locks ***/
/** This is a function type which allows svn_ra__get_operational_lock()
* to report lock attempt failures. If non-NULL, @a locktoken is the
* preexisting lock which prevented lock acquisition.
*
* @since New in 1.7.
*/
typedef svn_error_t *(*svn_ra__lock_retry_func_t)(void *baton,
const svn_string_t *locktoken,
apr_pool_t *pool);
/** Acquire a lock (of sorts) on the repository associated with the
* given RA @a session, retrying as necessary up to @a num_retries
* times, and set @a *lock_string_p to the value of the acquired lock
* token. Allocate the returned token from @a pool. (See this
* function's counterpart svn_ra__release_operational_lock() for your
* lock removal needs.)
*
* @a lock_revprop_name is the name of the revision-0 property used to
* store the lock.
*
* If @a steal_lock is set, then replace any pre-existing lock on the
* repository with our own. Iff such a theft occurs and
* @a stolen_lock_p is non-NULL, set @a *stolen_lock_p to the token of
* the lock we stole.
*
* Call @a retry_func with @a retry_baton each time the retry loop
* fails to acquire a lock.
*
* Use @a cancel_func and @a cancel_baton to check for early
* cancellation.
*
* @note If the server does not support #SVN_RA_CAPABILITY_ATOMIC_REVPROPS
* (i.e., is a pre-1.7 server), then this function makes a "best effort"
* attempt to obtain the lock, but is susceptible to a race condition; see
* issue #3546.
*
* @since New in 1.7.
*/
svn_error_t *
svn_ra__get_operational_lock(const svn_string_t **lock_string_p,
const svn_string_t **stolen_lock_p,
svn_ra_session_t *session,
const char *lock_revprop_name,
svn_boolean_t steal_lock,
int num_retries,
svn_ra__lock_retry_func_t retry_func,
void *retry_baton,
svn_cancel_func_t cancel_func,
void *cancel_baton,
apr_pool_t *pool);
/** Release an operational lock (whose value is @a mylocktoken) on the
* repository associated with RA @a session. (This is the counterpart
* to svn_ra__get_operational_lock().)
*
* @a lock_revprop_name is the name of the revision-0 property used to
* store the lock.
*
* Use @a scratch_pool for temporary allocations.
*
* @since New in 1.7.
*/
svn_error_t *
svn_ra__release_operational_lock(svn_ra_session_t *session,
const char *lock_revprop_name,
const svn_string_t *mylocktoken,
apr_pool_t *scratch_pool);
/** Register CALLBACKS to be used with the Ev2 shims in RA_SESSION. */
svn_error_t *
svn_ra__register_editor_shim_callbacks(svn_ra_session_t *ra_session,
svn_delta_shim_callbacks_t *callbacks);
/* Using information from BATON, provide the (file's) pristine contents
for REPOS_RELPATH. They are returned in *CONTENTS, and correspond to
*REVISION.
If a pristine is not available (ie. a locally-added node), then set
*CONTENTS to NULL; *REVISION will not be examined in this case.
These are allocated in RESULT_POOL. SCRATCH_POOL can be used
for temporary allocations. */
typedef svn_error_t *(*svn_ra__provide_base_cb_t)(
svn_stream_t **contents,
svn_revnum_t *revision,
void *baton,
const char *repos_relpath,
apr_pool_t *result_pool,
apr_pool_t *scratch_pool);
/* Using information from BATON, provide the pristine properties for
REPOS_RELPATH. They are returned in *PROPS, and correspond to *REVISION.
If properties are not available (ie. a locally-added node), then set
*PROPS to NULL; *REVISION will not be examined in this case.
The properties are allocated in RESULT_POOL. SCRATCH_POOL can be used
for temporary allocations. */
typedef svn_error_t *(*svn_ra__provide_props_cb_t)(
apr_hash_t **props,
svn_revnum_t *revision,
void *baton,
const char *repos_relpath,
apr_pool_t *result_pool,
apr_pool_t *scratch_pool);
/* Using information from BATON, fetch the kind of REPOS_RELPATH at revision
SRC_REVISION, returning it in *KIND.
If the kind cannot be determined, then set *KIND to svn_node_unknown.
Temporary allocations can be made in SCRATCH_POOL. */
typedef svn_error_t *(*svn_ra__get_copysrc_kind_cb_t)(
svn_node_kind_t *kind,
void *baton,
const char *repos_relpath,
svn_revnum_t src_revision,
apr_pool_t *scratch_pool);
/* Return an Ev2-based editor for performing commits.
The editor is associated with the given SESSION, and its implied target
repository.
REVPROPS contains all the revision properties that should be stored onto
the newly-committed revision. SVN_PROP_REVISION_AUTHOR will be set to
the username as determined by the session; overwriting any prior value
that may be present in REVPROPS.
COMMIT_CB/BATON contain the callback to receive post-commit information.
LOCK_TOKENS should contain all lock tokens necessary to modify paths
within the commit. If KEEP_LOCKS is FALSE, then the paths associated
with these tokens will be unlocked.
### today, LOCK_TOKENS is session_relpath:token_value. in the future,
### it should be repos_relpath:token_value.
PROVIDE_BASE_CB is a callback to fetch pristine contents, used to send
an svndiff over the wire to the server. This may be NULL, indicating
pristine contents are not available (eg. URL-based operations or import).
PROVIDE_PROPS_CB is a callback to fetch pristine properties, used to
send property deltas over the wire to the server. This may be NULL,
indicating pristine properties are not available (eg. URL-based operations
or an import).
GET_COPYSRC_KIND_CB is a callback to determine the kind of a copy-source.
This is necessary when an Ev2/Ev1 shim is required by the RA provider,
in order to determine whether to use delta->add_directory() or the
delta->add_file() vtable entry to perform the copy.
### unclear on impact if this is NULL.
### this callback will disappear when "everything" is running Ev2
CB_BATON is the baton used/shared by the above three callbacks.
Cancellation is handled through the callbacks provided when SESSION
is initially opened.
*EDITOR will be allocated in RESULT_POOL, and all temporary allocations
will be performed in SCRATCH_POOL.
*/
svn_error_t *
svn_ra__get_commit_ev2(svn_editor_t **editor,
svn_ra_session_t *session,
apr_hash_t *revprops,
svn_commit_callback2_t commit_cb,
void *commit_baton,
apr_hash_t *lock_tokens,
svn_boolean_t keep_locks,
svn_ra__provide_base_cb_t provide_base_cb,
svn_ra__provide_props_cb_t provide_props_cb,
svn_ra__get_copysrc_kind_cb_t get_copysrc_kind_cb,
void *cb_baton,
apr_pool_t *result_pool,
apr_pool_t *scratch_pool);
/* Similar to #svn_ra_replay_revstart_callback_t, but with an Ev2 editor. */
typedef svn_error_t *(*svn_ra__replay_revstart_ev2_callback_t)(
svn_revnum_t revision,
void *replay_baton,
svn_editor_t **editor,
apr_hash_t *rev_props,
apr_pool_t *pool);
/* Similar to #svn_ra_replay_revfinish_callback_t, but with an Ev2 editor. */
typedef svn_error_t *(*svn_ra__replay_revfinish_ev2_callback_t)(
svn_revnum_t revision,
void *replay_baton,
svn_editor_t *editor,
apr_hash_t *rev_props,
apr_pool_t *pool);
/* Similar to svn_ra_replay_range(), but uses Ev2 versions of the callback
functions. */
svn_error_t *
svn_ra__replay_range_ev2(svn_ra_session_t *session,
svn_revnum_t start_revision,
svn_revnum_t end_revision,
svn_revnum_t low_water_mark,
svn_boolean_t send_deltas,
svn_ra__replay_revstart_ev2_callback_t revstart_func,
svn_ra__replay_revfinish_ev2_callback_t revfinish_func,
void *replay_baton,
svn_ra__provide_base_cb_t provide_base_cb,
svn_ra__provide_props_cb_t provide_props_cb,
svn_ra__get_copysrc_kind_cb_t get_copysrc_kind_cb,
void *cb_baton,
apr_pool_t *scratch_pool);
/* Similar to svn_ra_replay(), but with an Ev2 editor. */
svn_error_t *
svn_ra__replay_ev2(svn_ra_session_t *session,
svn_revnum_t revision,
svn_revnum_t low_water_mark,
svn_boolean_t send_deltas,
svn_editor_t *editor,
apr_pool_t *scratch_pool);
#ifdef __cplusplus
}
#endif /* __cplusplus */
#endif /* SVN_RA_PRIVATE_H */

View File

@ -0,0 +1,826 @@
/**
* @copyright
* ====================================================================
* Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements. See the NOTICE file
* distributed with this work for additional information
* regarding copyright ownership. The ASF licenses this file
* to you under the Apache License, Version 2.0 (the
* "License"); you may not use this file except in compliance
* with the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing,
* software distributed under the License is distributed on an
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
* KIND, either express or implied. See the License for the
* specific language governing permissions and limitations
* under the License.
* ====================================================================
* @endcopyright
*
* @file svn_ra_svn_private.h
* @brief Functions used by the server - Internal routines
*/
#ifndef SVN_RA_SVN_PRIVATE_H
#define SVN_RA_SVN_PRIVATE_H
#include "svn_ra_svn.h"
#include "svn_editor.h"
#ifdef __cplusplus
extern "C" {
#endif /* __cplusplus */
/**
* Set the shim callbacks to be used by @a conn to @a shim_callbacks.
*/
svn_error_t *
svn_ra_svn__set_shim_callbacks(svn_ra_svn_conn_t *conn,
svn_delta_shim_callbacks_t *shim_callbacks);
/**
* @defgroup ra_svn_deprecated ra_svn low-level functions
* @{
*/
/** Write a number over the net.
*
* Writes will be buffered until the next read or flush.
*/
svn_error_t *
svn_ra_svn__write_number(svn_ra_svn_conn_t *conn,
apr_pool_t *pool,
apr_uint64_t number);
/** Write a string over the net.
*
* Writes will be buffered until the next read or flush.
*/
svn_error_t *
svn_ra_svn__write_string(svn_ra_svn_conn_t *conn,
apr_pool_t *pool,
const svn_string_t *str);
/** Write a cstring over the net.
*
* Writes will be buffered until the next read or flush.
*/
svn_error_t *
svn_ra_svn__write_cstring(svn_ra_svn_conn_t *conn,
apr_pool_t *pool,
const char *s);
/** Write a word over the net.
*
* Writes will be buffered until the next read or flush.
*/
svn_error_t *
svn_ra_svn__write_word(svn_ra_svn_conn_t *conn,
apr_pool_t *pool,
const char *word);
/** Write a list of properties over the net. @a props is allowed to be NULL,
* in which case an empty list will be written out.
*
* @since New in 1.5.
*/
svn_error_t *
svn_ra_svn__write_proplist(svn_ra_svn_conn_t *conn,
apr_pool_t *pool,
apr_hash_t *props);
/** Begin a list. Writes will be buffered until the next read or flush. */
svn_error_t *
svn_ra_svn__start_list(svn_ra_svn_conn_t *conn,
apr_pool_t *pool);
/** End a list. Writes will be buffered until the next read or flush. */
svn_error_t *
svn_ra_svn__end_list(svn_ra_svn_conn_t *conn,
apr_pool_t *pool);
/** Flush the write buffer.
*
* Normally this shouldn't be necessary, since the write buffer is flushed
* when a read is attempted.
*/
svn_error_t *
svn_ra_svn__flush(svn_ra_svn_conn_t *conn,
apr_pool_t *pool);
/** Write a tuple, using a printf-like interface.
*
* The format string @a fmt may contain:
*
*@verbatim
Spec Argument type Item type
---- -------------------- ---------
n apr_uint64_t Number
r svn_revnum_t Number
s const svn_string_t * String
c const char * String
w const char * Word
b svn_boolean_t Word ("true" or "false")
( Begin tuple
) End tuple
? Remaining elements optional
! (at beginning or end) Suppress opening or closing of tuple
@endverbatim
*
* Inside the optional part of a tuple, 'r' values may be @c
* SVN_INVALID_REVNUM, 'n' values may be
* SVN_RA_SVN_UNSPECIFIED_NUMBER, and 's', 'c', and 'w' values may be
* @c NULL; in these cases no data will be written. 'b' and '(' may
* not appear in the optional part of a tuple. Either all or none of
* the optional values should be valid.
*
* (If we ever have a need for an optional boolean value, we should
* invent a 'B' specifier which stores a boolean into an int, using -1
* for unspecified. Right now there is no need for such a thing.)
*
* Use the '!' format specifier to write partial tuples when you have
* to transmit an array or other unusual data. For example, to write
* a tuple containing a revision, an array of words, and a boolean:
* @code
SVN_ERR(svn_ra_svn_write_tuple(conn, pool, "r(!", rev));
for (i = 0; i < n; i++)
SVN_ERR(svn_ra_svn_write_word(conn, pool, words[i]));
SVN_ERR(svn_ra_svn_write_tuple(conn, pool, "!)b", flag)); @endcode
*/
svn_error_t *
svn_ra_svn__write_tuple(svn_ra_svn_conn_t *conn,
apr_pool_t *pool,
const char *fmt, ...);
/** Read an item from the network into @a *item. */
svn_error_t *
svn_ra_svn__read_item(svn_ra_svn_conn_t *conn,
apr_pool_t *pool,
svn_ra_svn_item_t **item);
/** Scan data on @a conn until we find something which looks like the
* beginning of an svn server greeting (an open paren followed by a
* whitespace character). This function is appropriate for beginning
* a client connection opened in tunnel mode, since people's dotfiles
* sometimes write output to stdout. It may only be called at the
* beginning of a client connection.
*/
svn_error_t *
svn_ra_svn__skip_leading_garbage(svn_ra_svn_conn_t *conn,
apr_pool_t *pool);
/** Parse an array of @c svn_sort__item_t structures as a tuple, using a
* printf-like interface. The format string @a fmt may contain:
*
*@verbatim
Spec Argument type Item type
---- -------------------- ---------
n apr_uint64_t * Number
r svn_revnum_t * Number
s svn_string_t ** String
c const char ** String
w const char ** Word
b svn_boolean_t * Word ("true" or "false")
B apr_uint64_t * Word ("true" or "false")
l apr_array_header_t ** List
( Begin tuple
) End tuple
? Tuple is allowed to end here
@endverbatim
*
* Note that a tuple is only allowed to end precisely at a '?', or at
* the end of the specification. So if @a fmt is "c?cc" and @a list
* contains two elements, an error will result.
*
* 'B' is similar to 'b', but may be used in the optional tuple specification.
* It returns TRUE, FALSE, or SVN_RA_SVN_UNSPECIFIED_NUMBER.
*
* If an optional part of a tuple contains no data, 'r' values will be
* set to @c SVN_INVALID_REVNUM, 'n' and 'B' values will be set to
* SVN_RA_SVN_UNSPECIFIED_NUMBER, and 's', 'c', 'w', and 'l' values
* will be set to @c NULL. 'b' may not appear inside an optional
* tuple specification; use 'B' instead.
*/
svn_error_t *
svn_ra_svn__parse_tuple(const apr_array_header_t *list,
apr_pool_t *pool,
const char *fmt, ...);
/** Read a tuple from the network and parse it as a tuple, using the
* format string notation from svn_ra_svn_parse_tuple().
*/
svn_error_t *
svn_ra_svn__read_tuple(svn_ra_svn_conn_t *conn,
apr_pool_t *pool,
const char *fmt, ...);
/** Parse an array of @c svn_ra_svn_item_t structures as a list of
* properties, storing the properties in a hash table.
*
* @since New in 1.5.
*/
svn_error_t *
svn_ra_svn__parse_proplist(const apr_array_header_t *list,
apr_pool_t *pool,
apr_hash_t **props);
/** Read a command response from the network and parse it as a tuple, using
* the format string notation from svn_ra_svn_parse_tuple().
*/
svn_error_t *
svn_ra_svn__read_cmd_response(svn_ra_svn_conn_t *conn,
apr_pool_t *pool,
const char *fmt, ...);
/** Accept commands over the network and handle them according to @a
* commands. Command handlers will be passed @a conn, a subpool of @a
* pool (cleared after each command is handled), the parameters of the
* command, and @a baton. Commands will be accepted until a
* terminating command is received (a command with "terminate" set in
* the command table). If a command handler returns an error wrapped
* in SVN_RA_SVN_CMD_ERR (see the @c SVN_CMD_ERR macro), the error
* will be reported to the other side of the connection and the
* command loop will continue; any other kind of error (typically a
* network or protocol error) is passed through to the caller.
*
* @since New in 1.6.
*
*/
svn_error_t *
svn_ra_svn__handle_commands2(svn_ra_svn_conn_t *conn,
apr_pool_t *pool,
const svn_ra_svn_cmd_entry_t *commands,
void *baton,
svn_boolean_t error_on_disconnect);
/** Write a successful command response over the network, using the
* same format string notation as svn_ra_svn_write_tuple(). Do not use
* partial tuples with this function; if you need to use partial
* tuples, just write out the "success" and argument tuple by hand.
*/
svn_error_t *
svn_ra_svn__write_cmd_response(svn_ra_svn_conn_t *conn,
apr_pool_t *pool,
const char *fmt, ...);
/** Write an unsuccessful command response over the network. */
svn_error_t *
svn_ra_svn__write_cmd_failure(svn_ra_svn_conn_t *conn,
apr_pool_t *pool,
svn_error_t *err);
/**
* @}
*/
/**
* @defgroup svn_commands sending ra_svn commands
* @{
*/
/** Sets the target revision of connection @a conn to @a rev. Use @a pool
* for allocations.
*/
svn_error_t *
svn_ra_svn__write_cmd_target_rev(svn_ra_svn_conn_t *conn,
apr_pool_t *pool,
svn_revnum_t rev);
/** Send a "open-root" command over connection @a conn. Open the
* repository root at revision @a rev and associate it with @a token.
* Use @a pool for allocations.
*/
svn_error_t *
svn_ra_svn__write_cmd_open_root(svn_ra_svn_conn_t *conn,
apr_pool_t *pool,
svn_revnum_t rev,
const char *token);
/** Send a "delete-entry" command over connection @a conn. Delete the
* @a path at optional revision @a rev below @a parent_token.
* Use @a pool for allocations.
*/
svn_error_t *
svn_ra_svn__write_cmd_delete_entry(svn_ra_svn_conn_t *conn,
apr_pool_t *pool,
const char *path,
svn_revnum_t rev,
const char *parent_token);
/** Send a "add-dir" command over connection @a conn. Add a new directory
* node named @a path under the directory identified by @a parent_token.
* Associate the new directory with the given @a token. * @a copy_path
* and @a copy_rev are optional and describe the copy source.
* Use @a pool for allocations.
*/
svn_error_t *
svn_ra_svn__write_cmd_add_dir(svn_ra_svn_conn_t *conn,
apr_pool_t *pool,
const char *path,
const char *parent_token,
const char *token,
const char *copy_path,
svn_revnum_t copy_rev);
/** Send a "open-dir" command over connection @a conn. Associate to
* @a token the directory node named @a path under the directory
* identified by @a parent_token in revision @a rev.
* Use @a pool for allocations.
*/
svn_error_t *
svn_ra_svn__write_cmd_open_dir(svn_ra_svn_conn_t *conn,
apr_pool_t *pool,
const char *path,
const char *parent_token,
const char *token,
svn_revnum_t rev);
/** Send a "change-dir-prop" command over connection @a conn. Set the
* property @a name to the optional @a value on the directory identified
* to @a token. Use @a pool for allocations.
*/
svn_error_t *
svn_ra_svn__write_cmd_change_dir_prop(svn_ra_svn_conn_t *conn,
apr_pool_t *pool,
const char *token,
const char *name,
const svn_string_t *value);
/** Send a "close-dir" command over connection @a conn. Identify the node
* to close with @a token. The latter will then no longer be associated
* with that node. Use @a pool for allocations.
*/
svn_error_t *
svn_ra_svn__write_cmd_close_dir(svn_ra_svn_conn_t *conn,
apr_pool_t *pool,
const char *token);
/** Send a "absent-dir" command over connection @a conn. Directory node
* named @a path under the directory identified by @a parent_token is
* absent. Use @a pool for allocations.
*/
svn_error_t *
svn_ra_svn__write_cmd_absent_dir(svn_ra_svn_conn_t *conn,
apr_pool_t *pool,
const char *path,
const char *parent_token);
/** Send a "add-file" command over connection @a conn. Add a new file
* node named @a path under the directory identified by @a parent_token.
* Associate the new file with the given @a token. * @a copy_path and
* @a copy_rev are optional and describe the copy source.
* Use @a pool for allocations.
*/
svn_error_t *
svn_ra_svn__write_cmd_add_file(svn_ra_svn_conn_t *conn,
apr_pool_t *pool,
const char *path,
const char *parent_token,
const char *token,
const char *copy_path,
svn_revnum_t copy_rev);
/** Send a "open-file" command over connection @a conn. Associate to
* @a token the file node named @a path under the directory identified by
* @a parent_token in revision @a rev.
* Use @a pool for allocations.
*/
svn_error_t *
svn_ra_svn__write_cmd_open_file(svn_ra_svn_conn_t *conn,
apr_pool_t *pool,
const char *path,
const char *parent_token,
const char *token,
svn_revnum_t rev);
/** Send a "change-file-prop" command over connection @a conn. Set the
* property @a name to the optional @a value on the file identified to
* @a token. Use @a pool for allocations.
*/
svn_error_t *
svn_ra_svn__write_cmd_change_file_prop(svn_ra_svn_conn_t *conn,
apr_pool_t *pool,
const char *token,
const char *name,
const svn_string_t *value);
/** Send a "close-dir" command over connection @a conn. Identify the node
* to close with @a token and provide an optional @a check_sum. The token
* will then no longer be associated with that node.
* Use @a pool for allocations.
*/
svn_error_t *
svn_ra_svn__write_cmd_close_file(svn_ra_svn_conn_t *conn,
apr_pool_t *pool,
const char *token,
const char *text_checksum);
/** Send a "absent-file" command over connection @a conn. File node
* named @a path in the directory identified by @a parent_token is
* absent. Use @a pool for allocations.
*/
svn_error_t *
svn_ra_svn__write_cmd_absent_file(svn_ra_svn_conn_t *conn,
apr_pool_t *pool,
const char *path,
const char *parent_token);
/** Send a "apply-textdelta" command over connection @a conn. Starts a
* series of text deltas to be applied to the file identified by @a token.
* Optionally, specify the file's current checksum in @a base_checksum.
* Use @a pool for allocations.
*/
svn_error_t *
svn_ra_svn__write_cmd_apply_textdelta(svn_ra_svn_conn_t *conn,
apr_pool_t *pool,
const char *token,
const char *base_checksum);
/** Send a "textdelta-chunk" command over connection @a conn. Apply
* textdelta @a chunk to the file identified by @a token.
* Use @a pool for allocations.
*/
svn_error_t *
svn_ra_svn__write_cmd_textdelta_chunk(svn_ra_svn_conn_t *conn,
apr_pool_t *pool,
const char *token,
const svn_string_t *chunk);
/** Send a "textdelta-end" command over connection @a conn. Ends the
* series of text deltas to be applied to the file identified by @a token.
* Use @a pool for allocations.
*/
svn_error_t *
svn_ra_svn__write_cmd_textdelta_end(svn_ra_svn_conn_t *conn,
apr_pool_t *pool,
const char *token);
/** Send a "close-edit" command over connection @a conn. Ends the editor
* drive (successfully). Use @a pool for allocations.
*/
svn_error_t *
svn_ra_svn__write_cmd_close_edit(svn_ra_svn_conn_t *conn,
apr_pool_t *pool);
/** Send a "abort-edit" command over connection @a conn. Prematurely ends
* the editor drive, e.g. due to some problem on the other side.
* Use @a pool for allocations.
*/
svn_error_t *
svn_ra_svn__write_cmd_abort_edit(svn_ra_svn_conn_t *conn,
apr_pool_t *pool);
/** Send a "set-path" command over connection @a conn.
* Use @a pool for allocations.
*
* @see set_path() in #svn_ra_reporter3_t for a description.
*/
svn_error_t *
svn_ra_svn__write_cmd_set_path(svn_ra_svn_conn_t *conn,
apr_pool_t *pool,
const char *path,
svn_revnum_t rev,
svn_boolean_t start_empty,
const char *lock_token,
svn_depth_t depth);
/** Send a "delete-path" command over connection @a conn.
* Use @a pool for allocations.
*
* @see delete_path() in #svn_ra_reporter3_t for a description.
*/
svn_error_t *
svn_ra_svn__write_cmd_delete_path(svn_ra_svn_conn_t *conn,
apr_pool_t *pool,
const char *path);
/** Send a "link-path" command over connection @a conn.
* Use @a pool for allocations.
*
* @see link_path() in #svn_ra_reporter3_t for a description.
*/
svn_error_t *
svn_ra_svn__write_cmd_link_path(svn_ra_svn_conn_t *conn,
apr_pool_t *pool,
const char *path,
const char *url,
svn_revnum_t rev,
svn_boolean_t start_empty,
const char *lock_token,
svn_depth_t depth);
/** Send a "finish-report" command over connection @a conn.
* Use @a pool for allocations.
*
* @see finish_report() in #svn_ra_reporter3_t for a description.
*/
svn_error_t *
svn_ra_svn__write_cmd_finish_report(svn_ra_svn_conn_t *conn,
apr_pool_t *pool);
/** Send a "abort-report" command over connection @a conn.
* Use @a pool for allocations.
*
* @see abort_report() in #svn_ra_reporter3_t for a description.
*/
svn_error_t *
svn_ra_svn__write_cmd_abort_report(svn_ra_svn_conn_t *conn,
apr_pool_t *pool);
/** Send a "reparent" command over connection @a conn.
* Use @a pool for allocations.
*
* @see #svn_ra_reparent for a description.
*/
svn_error_t *
svn_ra_svn__write_cmd_reparent(svn_ra_svn_conn_t *conn,
apr_pool_t *pool,
const char *url);
/** Send a "get-latest-rev" command over connection @a conn.
* Use @a pool for allocations.
*
* @see #svn_ra_get_latest_revnum for a description.
*/
svn_error_t *
svn_ra_svn__write_cmd_get_latest_rev(svn_ra_svn_conn_t *conn,
apr_pool_t *pool);
/** Send a "get-dated-rev" command over connection @a conn.
* Use @a pool for allocations.
*
* @see #svn_ra_get_dated_revision for a description.
*/
svn_error_t *
svn_ra_svn__write_cmd_get_dated_rev(svn_ra_svn_conn_t *conn,
apr_pool_t *pool,
apr_time_t tm);
/** Send a "change-rev-prop2" command over connection @a conn.
* Use @a pool for allocations.
*
* @see #svn_ra_change_rev_prop2 for a description.
*/
svn_error_t *
svn_ra_svn__write_cmd_change_rev_prop2(svn_ra_svn_conn_t *conn,
apr_pool_t *pool,
svn_revnum_t rev,
const char *name,
const svn_string_t *value,
svn_boolean_t dont_care,
const svn_string_t *old_value);
/** Send a "change-rev-prop" command over connection @a conn.
* Use @a pool for allocations.
*
* @see #svn_ra_change_rev_prop for a description.
*/
svn_error_t *
svn_ra_svn__write_cmd_change_rev_prop(svn_ra_svn_conn_t *conn,
apr_pool_t *pool,
svn_revnum_t rev,
const char *name,
const svn_string_t *value);
/** Send a "rev-proplist" command over connection @a conn.
* Use @a pool for allocations.
*
* @see #svn_ra_rev_proplist for a description.
*/
svn_error_t *
svn_ra_svn__write_cmd_rev_proplist(svn_ra_svn_conn_t *conn,
apr_pool_t *pool,
svn_revnum_t rev);
/** Send a "rev-prop" command over connection @a conn.
* Use @a pool for allocations.
*
* @see #svn_ra_rev_prop for a description.
*/
svn_error_t *
svn_ra_svn__write_cmd_rev_prop(svn_ra_svn_conn_t *conn,
apr_pool_t *pool,
svn_revnum_t rev,
const char *name);
/** Send a "get-file" command over connection @a conn.
* Use @a pool for allocations.
*
* @see #svn_ra_get_file for a description.
*/
svn_error_t *
svn_ra_svn__write_cmd_get_file(svn_ra_svn_conn_t *conn,
apr_pool_t *pool,
const char *path,
svn_revnum_t rev,
svn_boolean_t props,
svn_boolean_t stream);
/** Send a "update" command over connection @a conn.
* Use @a pool for allocations.
*
* @see #svn_ra_do_update3 for a description.
*/
svn_error_t *
svn_ra_svn__write_cmd_update(svn_ra_svn_conn_t *conn,
apr_pool_t *pool,
svn_revnum_t rev,
const char *target,
svn_boolean_t recurse,
svn_depth_t depth,
svn_boolean_t send_copyfrom_args,
svn_boolean_t ignore_ancestry);
/** Send a "switch" command over connection @a conn.
* Use @a pool for allocations.
*
* @see #svn_ra_do_switch3 for a description.
*/
svn_error_t *
svn_ra_svn__write_cmd_switch(svn_ra_svn_conn_t *conn,
apr_pool_t *pool,
svn_revnum_t rev,
const char *target,
svn_boolean_t recurse,
const char *switch_url,
svn_depth_t depth,
svn_boolean_t send_copyfrom_args,
svn_boolean_t ignore_ancestry);
/** Send a "status" command over connection @a conn.
* Use @a pool for allocations.
*
* @see #svn_ra_do_status2 for a description.
*/
svn_error_t *
svn_ra_svn__write_cmd_status(svn_ra_svn_conn_t *conn,
apr_pool_t *pool,
const char *target,
svn_boolean_t recurse,
svn_revnum_t rev,
svn_depth_t depth);
/** Send a "diff" command over connection @a conn.
* Use @a pool for allocations.
*
* @see #svn_ra_do_diff3 for a description.
*/
svn_error_t *
svn_ra_svn__write_cmd_diff(svn_ra_svn_conn_t *conn,
apr_pool_t *pool,
svn_revnum_t rev,
const char *target,
svn_boolean_t recurse,
svn_boolean_t ignore_ancestry,
const char *versus_url,
svn_boolean_t text_deltas,
svn_depth_t depth);
/** Send a "check-path" command over connection @a conn.
* Use @a pool for allocations.
*
* @see #svn_ra_check_path for a description.
*/
svn_error_t *
svn_ra_svn__write_cmd_check_path(svn_ra_svn_conn_t *conn,
apr_pool_t *pool,
const char *path,
svn_revnum_t rev);
/** Send a "stat" command over connection @a conn.
* Use @a pool for allocations.
*
* @see #svn_ra_stat for a description.
*/
svn_error_t *
svn_ra_svn__write_cmd_stat(svn_ra_svn_conn_t *conn,
apr_pool_t *pool,
const char *path,
svn_revnum_t rev);
/** Send a "get-file-revs" command over connection @a conn.
* Use @a pool for allocations.
*
* @see #svn_ra_get_file_revs2 for a description.
*/
svn_error_t *
svn_ra_svn__write_cmd_get_file_revs(svn_ra_svn_conn_t *conn,
apr_pool_t *pool,
const char *path,
svn_revnum_t start,
svn_revnum_t end,
svn_boolean_t include_merged_revisions);
/** Send a "lock" command over connection @a conn.
* Use @a pool for allocations.
*
* @see #svn_ra_lock for a description.
*/
svn_error_t *
svn_ra_svn__write_cmd_lock(svn_ra_svn_conn_t *conn,
apr_pool_t *pool,
const char *path,
const char *comment,
svn_boolean_t steal_lock,
svn_revnum_t revnum);
/** Send a "unlock" command over connection @a conn.
* Use @a pool for allocations.
*
* @see #svn_ra_unlock for a description.
*/
svn_error_t *
svn_ra_svn__write_cmd_unlock(svn_ra_svn_conn_t *conn,
apr_pool_t *pool,
const char *path,
const char *token,
svn_boolean_t break_lock);
/** Send a "get-lock" command over connection @a conn.
* Use @a pool for allocations.
*
* @see #svn_ra_get_lock for a description.
*/
svn_error_t *
svn_ra_svn__write_cmd_get_lock(svn_ra_svn_conn_t *conn,
apr_pool_t *pool,
const char *path);
/** Send a "get-locks" command over connection @a conn.
* Use @a pool for allocations.
*
* @see #svn_ra_get_locks2 for a description.
*/
svn_error_t *
svn_ra_svn__write_cmd_get_locks(svn_ra_svn_conn_t *conn,
apr_pool_t *pool,
const char *path,
svn_depth_t depth);
/** Send a "replay" command over connection @a conn.
* Use @a pool for allocations.
*
* @see #svn_ra_replay for a description.
*/
svn_error_t *
svn_ra_svn__write_cmd_replay(svn_ra_svn_conn_t *conn,
apr_pool_t *pool,
svn_revnum_t rev,
svn_revnum_t low_water_mark,
svn_boolean_t send_deltas);
/** Send a "replay-range" command over connection @a conn.
* Use @a pool for allocations.
*
* @see #svn_ra_replay_range for a description.
*/
svn_error_t *
svn_ra_svn__write_cmd_replay_range(svn_ra_svn_conn_t *conn,
apr_pool_t *pool,
svn_revnum_t start_revision,
svn_revnum_t end_revision,
svn_revnum_t low_water_mark,
svn_boolean_t send_deltas);
/** Send a "get-deleted-rev" command over connection @a conn.
* Use @a pool for allocations.
*
* @see #svn_ra_get_deleted_rev for a description.
*/
svn_error_t *
svn_ra_svn__write_cmd_get_deleted_rev(svn_ra_svn_conn_t *conn,
apr_pool_t *pool,
const char *path,
svn_revnum_t peg_revision,
svn_revnum_t end_revision);
/** Send a "get-iprops" command over connection @a conn.
* Use @a pool for allocations.
*
* @see #svn_ra_get_inherited_props for a description.
*/
svn_error_t *
svn_ra_svn__write_cmd_get_iprops(svn_ra_svn_conn_t *conn,
apr_pool_t *pool,
const char *path,
svn_revnum_t revision);
/** Send a "finish-replay" command over connection @a conn.
* Use @a pool for allocations.
*/
svn_error_t *
svn_ra_svn__write_cmd_finish_replay(svn_ra_svn_conn_t *conn,
apr_pool_t *pool);
/**
* @}
*/
#ifdef __cplusplus
}
#endif /* __cplusplus */
#endif /* SVN_RA_SVN_PRIVATE_H */

View File

@ -0,0 +1,121 @@
/**
* @copyright
* ====================================================================
* Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements. See the NOTICE file
* distributed with this work for additional information
* regarding copyright ownership. The ASF licenses this file
* to you under the Apache License, Version 2.0 (the
* "License"); you may not use this file except in compliance
* with the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing,
* software distributed under the License is distributed on an
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
* KIND, either express or implied. See the License for the
* specific language governing permissions and limitations
* under the License.
* ====================================================================
* @endcopyright
*
* @file svn_repos_private.h
* @brief Subversion-internal repos APIs.
*/
#ifndef SVN_REPOS_PRIVATE_H
#define SVN_REPOS_PRIVATE_H
#include <apr_pools.h>
#include "svn_types.h"
#include "svn_repos.h"
#include "svn_editor.h"
#ifdef __cplusplus
extern "C" {
#endif /* __cplusplus */
/** Validate that property @a name is valid for use in a Subversion
* repository; return @c SVN_ERR_REPOS_BAD_ARGS if it isn't. For some
* "svn:" properties, also validate the @a value, and return
* @c SVN_ERR_BAD_PROPERTY_VALUE if it is not valid.
*
* Use @a pool for temporary allocations.
*
* @note This function is used to implement server-side validation.
* Consequently, if you make this function stricter in what it accepts, you
* (a) break svnsync'ing of existing repositories that contain now-invalid
* properties, (b) do not preclude such invalid values from entering the
* repository via tools that use the svn_fs_* API directly (possibly
* including svnadmin and svnlook). This has happened before and there
* are known (documented, but unsupported) upgrade paths in some cases.
*
* @since New in 1.7.
*/
svn_error_t *
svn_repos__validate_prop(const char *name,
const svn_string_t *value,
apr_pool_t *pool);
/**
* Given the error @a err from svn_repos_fs_commit_txn(), return an
* string containing either or both of the svn_fs_commit_txn() error
* and the SVN_ERR_REPOS_POST_COMMIT_HOOK_FAILED wrapped error from
* the post-commit hook. Any error tracing placeholders in the error
* chain are skipped over.
*
* This function does not modify @a err.
*
* ### This method should not be necessary, but there are a few
* ### places, e.g. mod_dav_svn, where only a single error message
* ### string is returned to the caller and it is useful to have both
* ### error messages included in the message.
*
* Use @a pool to do any allocations in.
*
* @since New in 1.7.
*/
const char *
svn_repos__post_commit_error_str(svn_error_t *err,
apr_pool_t *pool);
/* A repos version of svn_fs_type */
svn_error_t *
svn_repos__fs_type(const char **fs_type,
const char *repos_path,
apr_pool_t *pool);
/* Create a commit editor for REPOS, based on REVISION. */
svn_error_t *
svn_repos__get_commit_ev2(svn_editor_t **editor,
svn_repos_t *repos,
svn_authz_t *authz,
const char *authz_repos_name,
const char *authz_user,
apr_hash_t *revprops,
svn_commit_callback2_t commit_cb,
void *commit_baton,
svn_cancel_func_t cancel_func,
void *cancel_baton,
apr_pool_t *result_pool,
apr_pool_t *scratch_pool);
svn_error_t *
svn_repos__replay_ev2(svn_fs_root_t *root,
const char *base_dir,
svn_revnum_t low_water_mark,
svn_editor_t *editor,
svn_repos_authz_func_t authz_read_func,
void *authz_read_baton,
apr_pool_t *scratch_pool);
#ifdef __cplusplus
}
#endif /* __cplusplus */
#endif /* SVN_REPOS_PRIVATE_H */

View File

@ -0,0 +1,236 @@
/* svn_skel.h : interface to `skeleton' functions
*
* ====================================================================
* Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements. See the NOTICE file
* distributed with this work for additional information
* regarding copyright ownership. The ASF licenses this file
* to you under the Apache License, Version 2.0 (the
* "License"); you may not use this file except in compliance
* with the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing,
* software distributed under the License is distributed on an
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
* KIND, either express or implied. See the License for the
* specific language governing permissions and limitations
* under the License.
* ====================================================================
*/
#ifndef SVN_SKEL_H
#define SVN_SKEL_H
#include <apr_pools.h>
#include "svn_string.h"
#ifdef __cplusplus
extern "C" {
#endif /* __cplusplus */
/* What is a skel? */
/* Subversion needs to read a lot of structured data from database
records. Instead of writing a half-dozen parsers and getting lazy
about error-checking, we define a reasonably dense, open-ended
syntax for strings and lists, and then use that for the concrete
representation of files, directories, property lists, etc. This
lets us handle all the fussy character-by-character testing and
sanity checks all in one place, allowing the users of this library
to focus on higher-level consistency.
A `skeleton' (or `skel') is either an atom, or a list. A list may
contain zero or more elements, each of which may be an atom or a
list.
Here's a description of the syntax of a skel:
A "whitespace" byte is 9, 10, 12, 13, or 32 (ASCII tab, newline,
form feed, carriage return, or space).
A "digit" byte is 48 -- 57 (ASCII digits).
A "name" byte is 65 -- 90, or 97 -- 122 (ASCII upper- and
lower-case characters).
An atom has one the following two forms:
- any string of bytes whose first byte is a name character, and
which contains no whitespace characters, bytes 40 (ASCII '(') or
bytes 41 (ASCII ')') (`implicit-length form'), or
- a string of digit bytes, followed by exactly one whitespace
character, followed by N bytes, where N is the value of the digit
bytes as a decimal number (`explicit-length form').
In the first case, the `contents' of the atom are the entire string
of characters. In the second case, the contents of the atom are
the N bytes after the count and whitespace.
A list consists of a byte 40 (ASCII '('), followed by a series of
atoms or lists, followed by a byte 41 (ASCII ')'). There may be
zero or more whitespace characters after the '(' and before the
')', and between any pair of elements. If two consecutive elements
are atoms, they must be separated by at least one whitespace
character. */
/* The `skel' structure. */
/* A structure representing the results of parsing an array of bytes
as a skel. */
struct svn_skel_t {
/* True if the string was an atom, false if it was a list.
If the string is an atom, DATA points to the beginning of its
contents, and LEN gives the content length, in bytes.
If the string is a list, DATA and LEN delimit the entire body of
the list. */
svn_boolean_t is_atom;
const char *data;
apr_size_t len;
/* If the string is a list, CHILDREN is a pointer to a
null-terminated linked list of skel objects representing the
elements of the list, linked through their NEXT pointers. */
struct svn_skel_t *children;
struct svn_skel_t *next;
};
typedef struct svn_skel_t svn_skel_t;
/* Operations on skels. */
/* Parse the LEN bytes at DATA as the concrete representation of a
skel, and return a skel object allocated from POOL describing its
contents. If the data is not a properly-formed SKEL object, return
zero.
The returned skel objects point into the block indicated by DATA
and LEN; we don't copy the contents. */
svn_skel_t *svn_skel__parse(const char *data, apr_size_t len,
apr_pool_t *pool);
/* Create an atom skel whose contents are the C string STR, allocated
from POOL. */
svn_skel_t *svn_skel__str_atom(const char *str, apr_pool_t *pool);
/* Create an atom skel whose contents are the LEN bytes at ADDR,
allocated from POOL. */
svn_skel_t *svn_skel__mem_atom(const void *addr, apr_size_t len,
apr_pool_t *pool);
/* Create an empty list skel, allocated from POOL. */
svn_skel_t *svn_skel__make_empty_list(apr_pool_t *pool);
/* Duplicates the skel structure SRC_SKEL and if DUP_DATA is true also the
data it references in RESULT_POOL */
svn_skel_t *svn_skel__dup(const svn_skel_t *src_skel, svn_boolean_t dup_data,
apr_pool_t *result_pool);
/* Prepend SKEL to LIST. */
void svn_skel__prepend(svn_skel_t *skel, svn_skel_t *list);
/* Append SKEL to LIST. Note: this must traverse the LIST, so you
generally want to use svn_skel__prepend().
NOTE: careful of the argument order here. */
void svn_skel__append(svn_skel_t *list, svn_skel_t *skel);
/* Create an atom skel whose contents are the string representation
of the integer VALUE, allocated in RESULT_POOL, and then prepend
it to SKEL. */
void svn_skel__prepend_int(apr_int64_t value,
svn_skel_t *skel,
apr_pool_t *result_pool);
/* Create an atom skel (allocated from RESULT_POOL) whose contents refer
to the string VALUE, then prepend it to SKEL.
NOTE: VALUE must have a lifetime *at least* that of RESULT_POOL. This
function does NOT copy it into RESULT_POOL. */
void svn_skel__prepend_str(const char *value,
svn_skel_t *skel,
apr_pool_t *result_pool);
/* Parse SKEL as an integer and return the result in *N.
* SCRATCH_POOL is used for temporary memory. */
svn_error_t *
svn_skel__parse_int(apr_int64_t *n, const svn_skel_t *skel,
apr_pool_t *scratch_pool);
/* Return a string whose contents are a concrete representation of
SKEL. Allocate the string from POOL. */
svn_stringbuf_t *svn_skel__unparse(const svn_skel_t *skel, apr_pool_t *pool);
/* Return true iff SKEL is an atom whose data is the same as STR. */
svn_boolean_t svn_skel__matches_atom(const svn_skel_t *skel, const char *str);
/* Return the length of the list skel SKEL. Atoms have a length of -1. */
int svn_skel__list_length(const svn_skel_t *skel);
/* Parse a `PROPLIST' SKEL into a regular hash of properties,
*PROPLIST_P, which has const char * property names, and
svn_string_t * values. Use RESULT_POOL for all allocations. */
svn_error_t *
svn_skel__parse_proplist(apr_hash_t **proplist_p,
const svn_skel_t *skel,
apr_pool_t *result_pool);
/* Parse a `IPROPS' SKEL into a depth-first ordered array of
svn_prop_inherited_item_t * structures *IPROPS. Use RESULT_POOL
for all allocations. */
svn_error_t *
svn_skel__parse_iprops(apr_array_header_t **iprops,
const svn_skel_t *skel,
apr_pool_t *result_pool);
/* Parse a `PROPLIST' SKEL looking for PROPNAME. If PROPNAME is found
then return its value in *PROVAL, allocated in RESULT_POOL. */
svn_error_t *
svn_skel__parse_prop(svn_string_t **propval,
const svn_skel_t *skel,
const char *propname,
apr_pool_t *result_pool);
/* Unparse a PROPLIST hash (which has const char * property names and
svn_string_t * values) into a `PROPLIST' skel *SKEL_P. Use POOL
for all allocations. */
svn_error_t *
svn_skel__unparse_proplist(svn_skel_t **skel_p,
const apr_hash_t *proplist,
apr_pool_t *pool);
/* Unparse INHERITED_PROPS, a depth-first ordered array of
svn_prop_inherited_item_t * structures, into a `IPROPS' skel *SKEL_P.
Use RESULT_POOL for all allocations. */
svn_error_t *
svn_skel__unparse_iproplist(svn_skel_t **skel_p,
const apr_array_header_t *inherited_props,
apr_pool_t *result_pool,
apr_pool_t *scratch_pool);
#ifdef __cplusplus
}
#endif /* __cplusplus */
#endif /* SVN_SKEL_H */

View File

@ -0,0 +1,519 @@
/* svn_sqlite.h
*
* ====================================================================
* Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements. See the NOTICE file
* distributed with this work for additional information
* regarding copyright ownership. The ASF licenses this file
* to you under the Apache License, Version 2.0 (the
* "License"); you may not use this file except in compliance
* with the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing,
* software distributed under the License is distributed on an
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
* KIND, either express or implied. See the License for the
* specific language governing permissions and limitations
* under the License.
* ====================================================================
*/
#ifndef SVN_SQLITE_H
#define SVN_SQLITE_H
#include <apr_pools.h>
#include "svn_types.h"
#include "svn_checksum.h"
#include "svn_error.h"
#include "private/svn_token.h" /* for svn_token_map_t */
#ifdef __cplusplus
extern "C" {
#endif /* __cplusplus */
/* Because the SQLite code can be inlined into libsvn_subre/sqlite.c,
we define accessors to its compile-time and run-time version
numbers here. */
/* Return the value that SQLITE_VERSION had at compile time. */
const char *svn_sqlite__compiled_version(void);
/* Return the value of sqlite3_libversion() at run time. */
const char *svn_sqlite__runtime_version(void);
typedef struct svn_sqlite__db_t svn_sqlite__db_t;
typedef struct svn_sqlite__stmt_t svn_sqlite__stmt_t;
typedef struct svn_sqlite__context_t svn_sqlite__context_t;
typedef struct svn_sqlite__value_t svn_sqlite__value_t;
typedef enum svn_sqlite__mode_e {
svn_sqlite__mode_readonly, /* open the database read-only */
svn_sqlite__mode_readwrite, /* open the database read-write */
svn_sqlite__mode_rwcreate /* open/create the database read-write */
} svn_sqlite__mode_t;
/* The type used for callback functions. */
typedef svn_error_t *(*svn_sqlite__func_t)(svn_sqlite__context_t *sctx,
int argc,
svn_sqlite__value_t *values[],
apr_pool_t *scatch_pool);
/* Step the given statement; if it returns SQLITE_DONE, reset the statement.
Otherwise, raise an SVN error. */
svn_error_t *
svn_sqlite__step_done(svn_sqlite__stmt_t *stmt);
/* Step the given statement; raise an SVN error (and reset the
statement) if it doesn't return SQLITE_ROW. */
svn_error_t *
svn_sqlite__step_row(svn_sqlite__stmt_t *stmt);
/* Step the given statement; raise an SVN error (and reset the
statement) if it doesn't return SQLITE_DONE or SQLITE_ROW. Set
*GOT_ROW to true iff it got SQLITE_ROW.
*/
svn_error_t *
svn_sqlite__step(svn_boolean_t *got_row, svn_sqlite__stmt_t *stmt);
/* Perform an insert as given by the prepared and bound STMT, and set
*ROW_ID to the id of the inserted row if ROW_ID is non-NULL.
STMT will be reset prior to returning. */
svn_error_t *
svn_sqlite__insert(apr_int64_t *row_id, svn_sqlite__stmt_t *stmt);
/* Perform an update/delete and then return the number of affected rows.
If AFFECTED_ROWS is not NULL, then set *AFFECTED_ROWS to the
number of rows changed.
STMT will be reset prior to returning. */
svn_error_t *
svn_sqlite__update(int *affected_rows, svn_sqlite__stmt_t *stmt);
/* Return in *VERSION the version of the schema in DB. Use SCRATCH_POOL
for temporary allocations. */
svn_error_t *
svn_sqlite__read_schema_version(int *version,
svn_sqlite__db_t *db,
apr_pool_t *scratch_pool);
/* Open a connection in *DB to the database at PATH. Validate the schema,
creating/upgrading to LATEST_SCHEMA if needed using the instructions
in UPGRADE_SQL. The resulting DB is allocated in RESULT_POOL, and any
temporary allocations are made in SCRATCH_POOL.
STATEMENTS is an array of strings which may eventually be executed, the
last element of which should be NULL. These strings and the array itself
are not duplicated internally, and should have a lifetime at least as long
as RESULT_POOL.
STATEMENTS itself may be NULL, in which case it has no impact.
See svn_sqlite__get_statement() for how these strings are used.
The statements will be finalized and the SQLite database will be closed
when RESULT_POOL is cleaned up. */
svn_error_t *
svn_sqlite__open(svn_sqlite__db_t **db, const char *repos_path,
svn_sqlite__mode_t mode, const char * const statements[],
int latest_schema, const char * const *upgrade_sql,
apr_pool_t *result_pool, apr_pool_t *scratch_pool);
/* Explicitly close the connection in DB. */
svn_error_t *
svn_sqlite__close(svn_sqlite__db_t *db);
/* Add a custom function to be used with this database connection. The data
in BATON should live at least as long as the connection in DB. */
svn_error_t *
svn_sqlite__create_scalar_function(svn_sqlite__db_t *db,
const char *func_name,
int argc,
svn_sqlite__func_t func,
void *baton);
/* Execute the (multiple) statements in the STATEMENTS[STMT_IDX] string. */
svn_error_t *
svn_sqlite__exec_statements(svn_sqlite__db_t *db, int stmt_idx);
/* Return the statement in *STMT which has been prepared from the
STATEMENTS[STMT_IDX] string, where STATEMENTS is the array that was
passed to svn_sqlite__open(). This statement is allocated in the same
pool as the DB, and will be cleaned up when DB is closed. */
svn_error_t *
svn_sqlite__get_statement(svn_sqlite__stmt_t **stmt, svn_sqlite__db_t *db,
int stmt_idx);
/* ---------------------------------------------------------------------
BINDING VALUES
*/
/* Bind values to SQL parameters in STMT, according to FMT. FMT may contain:
Spec Argument type Item type
---- ----------------- ---------
n <none, absent> Column assignment skip
d int Number
L apr_int64_t Number
i apr_int64_t Number (deprecated format spec)
s const char * String
b const void * Blob data
apr_size_t Blob length
r svn_revnum_t Revision number
t const svn_token_map_t * Token mapping table
int Token value
Each character in FMT maps to one SQL parameter, and one or two function
parameters, in the order they appear.
*/
svn_error_t *
svn_sqlite__bindf(svn_sqlite__stmt_t *stmt, const char *fmt, ...);
/* Error-handling wrapper around sqlite3_bind_int. */
svn_error_t *
svn_sqlite__bind_int(svn_sqlite__stmt_t *stmt, int slot, int val);
/* Error-handling wrapper around sqlite3_bind_int64. */
svn_error_t *
svn_sqlite__bind_int64(svn_sqlite__stmt_t *stmt, int slot,
apr_int64_t val);
/* Error-handling wrapper around sqlite3_bind_text. VAL cannot contain
zero bytes; we always pass SQLITE_TRANSIENT. */
svn_error_t *
svn_sqlite__bind_text(svn_sqlite__stmt_t *stmt, int slot,
const char *val);
/* Error-handling wrapper around sqlite3_bind_blob. */
svn_error_t *
svn_sqlite__bind_blob(svn_sqlite__stmt_t *stmt,
int slot,
const void *val,
apr_size_t len);
/* Look up VALUE in MAP, and bind the resulting token word at SLOT. */
svn_error_t *
svn_sqlite__bind_token(svn_sqlite__stmt_t *stmt,
int slot,
const svn_token_map_t *map,
int value);
/* Bind the value to SLOT, unless SVN_IS_VALID_REVNUM(value) is false,
in which case it binds NULL. */
svn_error_t *
svn_sqlite__bind_revnum(svn_sqlite__stmt_t *stmt, int slot,
svn_revnum_t value);
/* Bind a set of properties to the given slot. If PROPS is NULL, then no
binding will occur. PROPS will be stored as a serialized skel. */
svn_error_t *
svn_sqlite__bind_properties(svn_sqlite__stmt_t *stmt,
int slot,
const apr_hash_t *props,
apr_pool_t *scratch_pool);
/* Bind a set of inherited properties to the given slot. If INHERITED_PROPS
is NULL, then no binding will occur. INHERITED_PROPS will be stored as a
serialized skel. */
svn_error_t *
svn_sqlite__bind_iprops(svn_sqlite__stmt_t *stmt,
int slot,
const apr_array_header_t *inherited_props,
apr_pool_t *scratch_pool);
/* Bind a checksum's value to the given slot. If CHECKSUM is NULL, then no
binding will occur. */
svn_error_t *
svn_sqlite__bind_checksum(svn_sqlite__stmt_t *stmt,
int slot,
const svn_checksum_t *checksum,
apr_pool_t *scratch_pool);
/* ---------------------------------------------------------------------
FETCHING VALUES
*/
/* Wrapper around sqlite3_column_blob and sqlite3_column_bytes. The return
value will be NULL if the column is null.
If RESULT_POOL is not NULL, allocate the return value (if any) in it.
If RESULT_POOL is NULL, the return value will be valid until an
invocation of svn_sqlite__column_* performs a data type conversion (as
described in the SQLite documentation) or the statement is stepped or
reset or finalized. */
const void *
svn_sqlite__column_blob(svn_sqlite__stmt_t *stmt, int column,
apr_size_t *len, apr_pool_t *result_pool);
/* Wrapper around sqlite3_column_text. If the column is null, then the
return value will be NULL.
If RESULT_POOL is not NULL, allocate the return value (if any) in it.
If RESULT_POOL is NULL, the return value will be valid until an
invocation of svn_sqlite__column_* performs a data type conversion (as
described in the SQLite documentation) or the statement is stepped or
reset or finalized. */
const char *
svn_sqlite__column_text(svn_sqlite__stmt_t *stmt, int column,
apr_pool_t *result_pool);
/* Wrapper around sqlite3_column_int64. If the column is null, then the
return value will be SVN_INVALID_REVNUM. */
svn_revnum_t
svn_sqlite__column_revnum(svn_sqlite__stmt_t *stmt, int column);
/* Wrapper around sqlite3_column_int64. If the column is null, then the
return value will be FALSE. */
svn_boolean_t
svn_sqlite__column_boolean(svn_sqlite__stmt_t *stmt, int column);
/* Wrapper around sqlite3_column_int. If the column is null, then the
return value will be 0. */
int
svn_sqlite__column_int(svn_sqlite__stmt_t *stmt, int column);
/* Wrapper around sqlite3_column_int64. If the column is null, then the
return value will be 0. */
apr_int64_t
svn_sqlite__column_int64(svn_sqlite__stmt_t *stmt, int column);
/* Fetch the word at COLUMN, look it up in the MAP, and return its value.
MALFUNCTION is thrown if the column is null or contains an unknown word. */
int
svn_sqlite__column_token(svn_sqlite__stmt_t *stmt,
int column,
const svn_token_map_t *map);
/* Fetch the word at COLUMN, look it up in the MAP, and return its value.
Returns NULL_VAL if the column is null. MALFUNCTION is thrown if the
column contains an unknown word. */
int
svn_sqlite__column_token_null(svn_sqlite__stmt_t *stmt,
int column,
const svn_token_map_t *map,
int null_val);
/* Return the column as a hash of const char * => const svn_string_t *.
If the column is null, then set *PROPS to NULL. The
results will be allocated in RESULT_POOL, and any temporary allocations
will be made in SCRATCH_POOL. */
svn_error_t *
svn_sqlite__column_properties(apr_hash_t **props,
svn_sqlite__stmt_t *stmt,
int column,
apr_pool_t *result_pool,
apr_pool_t *scratch_pool);
/* Return the column as an array of depth-first ordered array of
svn_prop_inherited_item_t * structures. If the column is null, then
set *IPROPS to NULL. The results will be allocated in RESULT_POOL,
and any temporary allocations will be made in SCRATCH_POOL. */
svn_error_t *
svn_sqlite__column_iprops(apr_array_header_t **iprops,
svn_sqlite__stmt_t *stmt,
int column,
apr_pool_t *result_pool,
apr_pool_t *scratch_pool);
/* Return the column as a checksum. If the column is null, then NULL will
be stored into *CHECKSUM. The result will be allocated in RESULT_POOL. */
svn_error_t *
svn_sqlite__column_checksum(const svn_checksum_t **checksum,
svn_sqlite__stmt_t *stmt,
int column,
apr_pool_t *result_pool);
/* Return TRUE if the result of selecting the column is null,
FALSE otherwise */
svn_boolean_t
svn_sqlite__column_is_null(svn_sqlite__stmt_t *stmt, int column);
/* Return the number of bytes the column uses in a text or blob representation.
0 for NULL columns. */
int
svn_sqlite__column_bytes(svn_sqlite__stmt_t *stmt, int column);
/* --------------------------------------------------------------------- */
#define SVN_SQLITE__INTEGER 1
#define SVN_SQLITE__FLOAT 2
#define SVN_SQLITE__TEXT 3
#define SVN_SQLITE__BLOB 4
#define SVN_SQLITE__NULL 5
/* */
int
svn_sqlite__value_type(svn_sqlite__value_t *val);
/* */
const char *
svn_sqlite__value_text(svn_sqlite__value_t *val);
/* --------------------------------------------------------------------- */
/* */
void
svn_sqlite__result_null(svn_sqlite__context_t *sctx);
void
svn_sqlite__result_int64(svn_sqlite__context_t *sctx, apr_int64_t val);
/* --------------------------------------------------------------------- */
/* Error-handling wrapper around sqlite3_finalize. */
svn_error_t *
svn_sqlite__finalize(svn_sqlite__stmt_t *stmt);
/* Reset STMT by calling sqlite3_reset(), and also clear any bindings to it.
Note: svn_sqlite__get_statement() calls this function automatically if
the requested statement has been used and has not yet been reset. */
svn_error_t *
svn_sqlite__reset(svn_sqlite__stmt_t *stmt);
/* Begin a transaction in DB. */
svn_error_t *
svn_sqlite__begin_transaction(svn_sqlite__db_t *db);
/* Like svn_sqlite__begin_transaction(), but takes out a 'RESERVED' lock
immediately, instead of using the default deferred locking scheme. */
svn_error_t *
svn_sqlite__begin_immediate_transaction(svn_sqlite__db_t *db);
/* Begin a savepoint in DB. */
svn_error_t *
svn_sqlite__begin_savepoint(svn_sqlite__db_t *db);
/* Commit the current transaction in DB if ERR is SVN_NO_ERROR, otherwise
* roll back the transaction. Return a composition of ERR and any error
* that may occur during the commit or roll-back. */
svn_error_t *
svn_sqlite__finish_transaction(svn_sqlite__db_t *db,
svn_error_t *err);
/* Release the current savepoint in DB if EXPR is SVN_NO_ERROR, otherwise
* roll back to the savepoint and then release it. Return a composition of
* ERR and any error that may occur during the release or roll-back. */
svn_error_t *
svn_sqlite__finish_savepoint(svn_sqlite__db_t *db,
svn_error_t *err);
/* Evaluate the expression EXPR within a transaction.
*
* Begin a transaction in DB; evaluate the expression EXPR, which would
* typically be a function call that does some work in DB; finally commit
* the transaction if EXPR evaluated to SVN_NO_ERROR, otherwise roll back
* the transaction.
*/
#define SVN_SQLITE__WITH_TXN(expr, db) \
do { \
svn_sqlite__db_t *svn_sqlite__db = (db); \
svn_error_t *svn_sqlite__err; \
\
SVN_ERR(svn_sqlite__begin_transaction(svn_sqlite__db)); \
svn_sqlite__err = (expr); \
SVN_ERR(svn_sqlite__finish_transaction(svn_sqlite__db, svn_sqlite__err)); \
} while (0)
/* Callback function to for use with svn_sqlite__with_transaction(). */
typedef svn_error_t *(*svn_sqlite__transaction_callback_t)(
void *baton, svn_sqlite__db_t *db, apr_pool_t *scratch_pool);
/* Helper function to handle SQLite transactions. All the work done inside
CB_FUNC will be wrapped in an SQLite transaction, which will be committed
if CB_FUNC does not return an error. If any error is returned from CB_FUNC,
the transaction will be rolled back. DB and CB_BATON will be passed to
CB_FUNC. SCRATCH_POOL will be passed to the callback (NULL is valid). */
svn_error_t *
svn_sqlite__with_transaction(svn_sqlite__db_t *db,
svn_sqlite__transaction_callback_t cb_func,
void *cb_baton, apr_pool_t *scratch_pool);
/* Like SVN_SQLITE__WITH_TXN(), but takes out a 'RESERVED' lock
immediately, instead of using the default deferred locking scheme. */
#define SVN_SQLITE__WITH_IMMEDIATE_TXN(expr, db) \
do { \
svn_sqlite__db_t *svn_sqlite__db = (db); \
svn_error_t *svn_sqlite__err; \
\
SVN_ERR(svn_sqlite__begin_immediate_transaction(svn_sqlite__db)); \
svn_sqlite__err = (expr); \
SVN_ERR(svn_sqlite__finish_transaction(svn_sqlite__db, svn_sqlite__err)); \
} while (0)
/* Like svn_sqlite__with_transaction(), but takes out a 'RESERVED' lock
immediately, instead of using the default deferred locking scheme. */
svn_error_t *
svn_sqlite__with_immediate_transaction(svn_sqlite__db_t *db,
svn_sqlite__transaction_callback_t cb_func,
void *cb_baton,
apr_pool_t *scratch_pool);
/* Evaluate the expression EXPR within a 'savepoint'. Savepoints can be
* nested.
*
* Begin a savepoint in DB; evaluate the expression EXPR, which would
* typically be a function call that does some work in DB; finally release
* the savepoint if EXPR evaluated to SVN_NO_ERROR, otherwise roll back
* to the savepoint and then release it.
*/
#define SVN_SQLITE__WITH_LOCK(expr, db) \
do { \
svn_sqlite__db_t *svn_sqlite__db = (db); \
svn_error_t *svn_sqlite__err; \
\
SVN_ERR(svn_sqlite__begin_savepoint(svn_sqlite__db)); \
svn_sqlite__err = (expr); \
SVN_ERR(svn_sqlite__finish_savepoint(svn_sqlite__db, svn_sqlite__err)); \
} while (0)
/* Helper function to handle several SQLite operations inside a shared lock.
This callback is similar to svn_sqlite__with_transaction(), but can be
nested (even with a transaction).
Using this function as a wrapper around a group of operations can give a
*huge* performance boost as the shared-read lock will be shared over
multiple statements, instead of being reobtained every time, which may
require disk and/or network io, depending on SQLite's locking strategy.
SCRATCH_POOL will be passed to the callback (NULL is valid).
### Since we now require SQLite >= 3.6.18, this function has the effect of
always behaving like a defered transaction. Can it be combined with
svn_sqlite__with_transaction()?
*/
svn_error_t *
svn_sqlite__with_lock(svn_sqlite__db_t *db,
svn_sqlite__transaction_callback_t cb_func,
void *cb_baton,
apr_pool_t *scratch_pool);
/* Hotcopy an SQLite database from SRC_PATH to DST_PATH. */
svn_error_t *
svn_sqlite__hotcopy(const char *src_path,
const char *dst_path,
apr_pool_t *scratch_pool);
#ifdef __cplusplus
}
#endif /* __cplusplus */
#endif /* SVN_SQLITE_H */

View File

@ -0,0 +1,222 @@
/**
* @copyright
* ====================================================================
* Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements. See the NOTICE file
* distributed with this work for additional information
* regarding copyright ownership. The ASF licenses this file
* to you under the Apache License, Version 2.0 (the
* "License"); you may not use this file except in compliance
* with the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing,
* software distributed under the License is distributed on an
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
* KIND, either express or implied. See the License for the
* specific language governing permissions and limitations
* under the License.
* ====================================================================
* @endcopyright
*
* @file svn_string_private.h
* @brief Non-public string utility functions.
*/
#ifndef SVN_STRING_PRIVATE_H
#define SVN_STRING_PRIVATE_H
#include "svn_string.h" /* for svn_boolean_t, svn_error_t */
#ifdef __cplusplus
extern "C" {
#endif /* __cplusplus */
/**
* @defgroup svn_string String handling
* @{
*/
/** Private functions.
*
* @defgroup svn_string_private Private functions
* @{
*/
/** A self-contained memory buffer of known size.
*
* Intended to be used where a single variable-sized buffer is needed
* within an iteration, a scratch pool is available and we want to
* avoid the cost of creating another pool just for the iteration.
*/
typedef struct svn_membuf_t
{
/** The a pool from which this buffer was originally allocated, and is not
* necessarily specific to this buffer. This is used only for allocating
* more memory from when the buffer needs to grow.
*/
apr_pool_t *pool;
/** pointer to the memory */
void *data;
/** total size of buffer allocated */
apr_size_t size;
} svn_membuf_t;
/* Initialize a memory buffer of the given size */
void
svn_membuf__create(svn_membuf_t *membuf, apr_size_t size, apr_pool_t *pool);
/* Ensure that the given memory buffer has at least the given size */
void
svn_membuf__ensure(svn_membuf_t *membuf, apr_size_t size);
/* Resize the given memory buffer, preserving its contents. */
void
svn_membuf__resize(svn_membuf_t *membuf, apr_size_t size);
/* Zero-fill the given memory */
void
svn_membuf__zero(svn_membuf_t *membuf);
/* Zero-fill the given memory buffer up to the smaller of SIZE and the
current buffer size. */
void
svn_membuf__nzero(svn_membuf_t *membuf, apr_size_t size);
/* Inline implementation of svn_membuf__zero.
* Note that PMEMBUF is evaluated only once.
*/
#define SVN_MEMBUF__ZERO(pmembuf) \
do \
{ \
svn_membuf_t *const _m_b_f_ = (pmembuf); \
memset(_m_b_f_->data, 0, _m_b_f_->size); \
} \
while(0)
/* Inline implementation of svn_membuf__nzero
* Note that PMEMBUF and PSIZE are evaluated only once.
*/
#define SVN_MEMBUF__NZERO(pmembuf, psize) \
do \
{ \
svn_membuf_t *const _m_b_f_ = (pmembuf); \
const apr_size_t _s_z_ = (psize); \
if (_s_z_ > _m_b_f_->size) \
memset(_m_b_f_->data, 0, _m_b_f_->size); \
else \
memset(_m_b_f_->data, 0, _s_z_); \
} \
while(0)
#ifndef SVN_DEBUG
/* In non-debug mode, just use these inlie replacements */
#define svn_membuf__zero(B) SVN_MEMBUF__ZERO((B))
#define svn_membuf__nzero(B, S) SVN_MEMBUF__NZERO((B), (S))
#endif
/** Returns the #svn_string_t information contained in the data and
* len members of @a strbuf. This is effectively a typecast, converting
* @a strbuf into an #svn_string_t. This first will become invalid and must
* not be accessed after this function returned.
*/
svn_string_t *
svn_stringbuf__morph_into_string(svn_stringbuf_t *strbuf);
/** Like apr_strtoff but provided here for backward compatibility
* with APR 0.9 */
apr_status_t
svn__strtoff(apr_off_t *offset, const char *buf, char **end, int base);
/** Number of chars needed to represent signed (19 places + sign + NUL) or
* unsigned (20 places + NUL) integers as strings.
*/
#define SVN_INT64_BUFFER_SIZE 21
/** Writes the @a number as string into @a dest. The latter must provide
* space for at least #SVN_INT64_BUFFER_SIZE characters. Returns the number
* chars written excluding the terminating NUL.
*/
apr_size_t
svn__ui64toa(char * dest, apr_uint64_t number);
/** Writes the @a number as string into @a dest. The latter must provide
* space for at least #SVN_INT64_BUFFER_SIZE characters. Returns the number
* chars written excluding the terminating NUL.
*/
apr_size_t
svn__i64toa(char * dest, apr_int64_t number);
/** Returns a decimal string for @a number allocated in @a pool. Put in
* the @a seperator at each third place.
*/
char *
svn__ui64toa_sep(apr_uint64_t number, char seperator, apr_pool_t *pool);
/** Returns a decimal string for @a number allocated in @a pool. Put in
* the @a seperator at each third place.
*/
char *
svn__i64toa_sep(apr_int64_t number, char seperator, apr_pool_t *pool);
/**
* Computes the similarity score of STRA and STRB. Returns the ratio
* of the length of their longest common subsequence and the average
* length of the strings, normalized to the range [0..1000].
* The result is equivalent to Python's
*
* difflib.SequenceMatcher.ratio
*
* Optionally sets *RLCS to the length of the longest common
* subsequence of STRA and STRB. Using BUFFER for temporary storage,
* requires memory proportional to the length of the shorter string.
*
* The LCS algorithm used is described in, e.g.,
*
* http://en.wikipedia.org/wiki/Longest_common_subsequence_problem
*
* Q: Why another LCS when we already have one in libsvn_diff?
* A: svn_diff__lcs is too heavyweight and too generic for the
* purposes of similarity testing. Whilst it would be possible
* to use a character-based tokenizer with it, we really only need
* the *length* of the LCS for the similarity score, not all the
* other information that svn_diff__lcs produces in order to
* make printing diffs possible.
*
* Q: Is there a limit on the length of the string parameters?
* A: Only available memory. But note that the LCS algorithm used
* has O(strlen(STRA) * strlen(STRB)) worst-case performance,
* so do keep a rein on your enthusiasm.
*/
unsigned int
svn_cstring__similarity(const char *stra, const char *strb,
svn_membuf_t *buffer, apr_size_t *rlcs);
/**
* Like svn_cstring__similarity, but accepts svn_string_t's instead
* of NUL-terminated character strings.
*/
unsigned int
svn_string__similarity(const svn_string_t *stringa,
const svn_string_t *stringb,
svn_membuf_t *buffer, apr_size_t *rlcs);
/** @} */
/** @} */
#ifdef __cplusplus
}
#endif /* __cplusplus */
#endif /* SVN_STRING_PRIVATE_H */

View File

@ -0,0 +1,340 @@
/*
* svn_subr_private.h : private definitions from libsvn_subr
*
* ====================================================================
* Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements. See the NOTICE file
* distributed with this work for additional information
* regarding copyright ownership. The ASF licenses this file
* to you under the Apache License, Version 2.0 (the
* "License"); you may not use this file except in compliance
* with the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing,
* software distributed under the License is distributed on an
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
* KIND, either express or implied. See the License for the
* specific language governing permissions and limitations
* under the License.
* ====================================================================
*/
#ifndef SVN_SUBR_PRIVATE_H
#define SVN_SUBR_PRIVATE_H
#include "svn_types.h"
#include "svn_io.h"
#ifdef __cplusplus
extern "C" {
#endif /* __cplusplus */
/** Spill-to-file Buffers
*
* @defgroup svn_spillbuf_t Spill-to-file Buffers
* @{
*/
/** A buffer that collects blocks of content, possibly using a file.
*
* The spill-buffer is created with two basic parameters: the size of the
* blocks that will be written into the spill-buffer ("blocksize"), and
* the (approximate) maximum size that will be allowed in memory ("maxsize").
* Once the maxsize is reached, newly written content will be "spilled"
* into a temporary file.
*
* When writing, content will be buffered into memory unless a given write
* will cause the amount of in-memory content to exceed the specified
* maxsize. At that point, the file is created, and the content will be
* written to that file.
*
* To read information back out of a spill buffer, there are two approaches
* available to the application:
*
* *) reading blocks using svn_spillbuf_read() (a "pull" model)
* *) having blocks passed to a callback via svn_spillbuf_process()
* (a "push" model to your application)
*
* In both cases, the spill-buffer will provide you with a block of N bytes
* that you must fully consume before asking for more data. The callback
* style provides for a "stop" parameter to temporarily pause the reading
* until another read is desired. The two styles of reading may be mixed,
* as the caller desires. Generally, N will be the blocksize, and will be
* less when the end of the content is reached.
*
* For a more stream-oriented style of reading, where the caller specifies
* the number of bytes to read into a caller-provided buffer, please see
* svn_spillbuf_reader_t. That overlaid type will cause more memory copies
* to be performed (whereas the bare spill-buffer type hands you a buffer
* to consume).
*
* Writes may be interleaved with reading, and content will be returned
* in a FIFO manner. Thus, if content has been placed into the spill-buffer
* you will always read the earliest-written data, and any newly-written
* content will be appended to the buffer.
*
* Note: the file is created in the same pool where the spill-buffer was
* created. If the content is completely read from that file, it will be
* closed and deleted. Should writing further content cause another spill
* file to be created, that will increase the size of the pool. There is
* no bound on the amount of file-related resources that may be consumed
* from the pool. It is entirely related to the read/write pattern and
* whether spill files are repeatedly created.
*/
typedef struct svn_spillbuf_t svn_spillbuf_t;
/* Create a spill buffer. */
svn_spillbuf_t *
svn_spillbuf__create(apr_size_t blocksize,
apr_size_t maxsize,
apr_pool_t *result_pool);
/* Determine how much content is stored in the spill buffer. */
svn_filesize_t
svn_spillbuf__get_size(const svn_spillbuf_t *buf);
/* Write some data into the spill buffer. */
svn_error_t *
svn_spillbuf__write(svn_spillbuf_t *buf,
const char *data,
apr_size_t len,
apr_pool_t *scratch_pool);
/* Read a block of memory from the spill buffer. @a *data will be set to
NULL if no content remains. Otherwise, @a data and @a len will point to
data that must be fully-consumed by the caller. This data will remain
valid until another call to svn_spillbuf_write(), svn_spillbuf_read(),
or svn_spillbuf_process(), or if the spill buffer's pool is cleared. */
svn_error_t *
svn_spillbuf__read(const char **data,
apr_size_t *len,
svn_spillbuf_t *buf,
apr_pool_t *scratch_pool);
/* Callback for reading content out of the spill buffer. Set @a stop if
you want to stop the processing (and will call svn_spillbuf_process
again, at a later time). */
typedef svn_error_t * (*svn_spillbuf_read_t)(svn_boolean_t *stop,
void *baton,
const char *data,
apr_size_t len,
apr_pool_t *scratch_pool);
/* Process the content stored in the spill buffer. @a exhausted will be
set to TRUE if all of the content is processed by @a read_func. This
function may return early if the callback returns TRUE for its 'stop'
parameter. */
svn_error_t *
svn_spillbuf__process(svn_boolean_t *exhausted,
svn_spillbuf_t *buf,
svn_spillbuf_read_t read_func,
void *read_baton,
apr_pool_t *scratch_pool);
/** Classic stream reading layer on top of spill-buffers.
*
* This type layers upon a spill-buffer to enable a caller to read a
* specified number of bytes into the caller's provided buffer. This
* implies more memory copies than the standard spill-buffer reading
* interface, but is sometimes required by spill-buffer users.
*/
typedef struct svn_spillbuf_reader_t svn_spillbuf_reader_t;
/* Create a spill-buffer and a reader for it. */
svn_spillbuf_reader_t *
svn_spillbuf__reader_create(apr_size_t blocksize,
apr_size_t maxsize,
apr_pool_t *result_pool);
/* Read @a len bytes from @a reader into @a data. The number of bytes
actually read is stored in @a amt. If the content is exhausted, then
@a amt is set to zero. It will always be non-zero if the spill-buffer
contains content.
If @a len is zero, then SVN_ERR_INCORRECT_PARAMS is returned. */
svn_error_t *
svn_spillbuf__reader_read(apr_size_t *amt,
svn_spillbuf_reader_t *reader,
char *data,
apr_size_t len,
apr_pool_t *scratch_pool);
/* Read a single character from @a reader, and place it in @a c. If there
is no content in the spill-buffer, then SVN_ERR_STREAM_UNEXPECTED_EOF
is returned. */
svn_error_t *
svn_spillbuf__reader_getc(char *c,
svn_spillbuf_reader_t *reader,
apr_pool_t *scratch_pool);
/* Write @a len bytes from @a data into the spill-buffer in @a reader. */
svn_error_t *
svn_spillbuf__reader_write(svn_spillbuf_reader_t *reader,
const char *data,
apr_size_t len,
apr_pool_t *scratch_pool);
/* Return a stream built on top of a spillbuf, using the same arguments as
svn_spillbuf__create(). This stream can be used for reading and writing,
but implements the same basic sematics of a spillbuf for the underlying
storage. */
svn_stream_t *
svn_stream__from_spillbuf(apr_size_t blocksize,
apr_size_t maxsize,
apr_pool_t *result_pool);
/** @} */
/**
* Internal function for creating a MD5 checksum from a binary digest.
*
* @since New in 1.8
*/
svn_checksum_t *
svn_checksum__from_digest_md5(const unsigned char *digest,
apr_pool_t *result_pool);
/**
* Internal function for creating a SHA1 checksum from a binary
* digest.
*
* @since New in 1.8
*/
svn_checksum_t *
svn_checksum__from_digest_sha1(const unsigned char *digest,
apr_pool_t *result_pool);
/**
* @defgroup svn_hash_support Hash table serialization support
* @{
*/
/*----------------------------------------------------*/
/**
* @defgroup svn_hash_misc Miscellaneous hash APIs
* @{
*/
/** @} */
/**
* @defgroup svn_hash_getters Specialized getter APIs for hashes
* @{
*/
/** Find the value of a @a key in @a hash, return the value.
*
* If @a hash is @c NULL or if the @a key cannot be found, the
* @a default_value will be returned.
*
* @since New in 1.7.
*/
const char *
svn_hash__get_cstring(apr_hash_t *hash,
const char *key,
const char *default_value);
/** Like svn_hash_get_cstring(), but for boolean values.
*
* Parses the value as a boolean value. The recognized representations
* are 'TRUE'/'FALSE', 'yes'/'no', 'on'/'off', '1'/'0'; case does not
* matter.
*
* @since New in 1.7.
*/
svn_boolean_t
svn_hash__get_bool(apr_hash_t *hash,
const char *key,
svn_boolean_t default_value);
/** @} */
/**
* @defgroup svn_hash_create Create optimized APR hash tables
* @{
*/
/** Returns a hash table, allocated in @a pool, with the same ordering of
* elements as APR 1.4.5 or earlier (using apr_hashfunc_default) but uses
* a faster hash function implementation.
*
* @since New in 1.8.
*/
apr_hash_t *
svn_hash__make(apr_pool_t *pool);
/** @} */
/** @} */
/** Apply the changes described by @a prop_changes to @a original_props and
* return the result. The inverse of svn_prop_diffs().
*
* Allocate the resulting hash from @a pool, but allocate its keys and
* values from @a pool and/or by reference to the storage of the inputs.
*
* Note: some other APIs use an array of pointers to svn_prop_t.
*
* @since New in 1.8.
*/
apr_hash_t *
svn_prop__patch(const apr_hash_t *original_props,
const apr_array_header_t *prop_changes,
apr_pool_t *pool);
/**
* @defgroup svn_version Version number dotted triplet parsing
* @{
*/
/* Set @a *version to a version structure parsed from the version
* string representation in @a version_string. Return
* @c SVN_ERR_MALFORMED_VERSION_STRING if the string fails to parse
* cleanly.
*
* @since New in 1.8.
*/
svn_error_t *
svn_version__parse_version_string(svn_version_t **version,
const char *version_string,
apr_pool_t *result_pool);
/* Return true iff @a version represents a version number of at least
* the level represented by @a major, @a minor, and @a patch.
*
* @since New in 1.8.
*/
svn_boolean_t
svn_version__at_least(svn_version_t *version,
int major,
int minor,
int patch);
/** @} */
#ifdef __cplusplus
}
#endif /* __cplusplus */
#endif /* SVN_SUBR_PRIVATE_H */

View File

@ -0,0 +1,207 @@
/**
* @copyright
* ====================================================================
* Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements. See the NOTICE file
* distributed with this work for additional information
* regarding copyright ownership. The ASF licenses this file
* to you under the Apache License, Version 2.0 (the
* "License"); you may not use this file except in compliance
* with the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing,
* software distributed under the License is distributed on an
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
* KIND, either express or implied. See the License for the
* specific language governing permissions and limitations
* under the License.
* ====================================================================
* @endcopyright
*
* @file svn_temp_serializer.h
* @brief Helper API for serializing _temporarily_ data structures.
*
* @note This API is intended for efficient serialization and duplication
* of temporary, e.g. cached, data structures ONLY. It is not
* suitable for persistent data.
*/
#ifndef SVN_TEMP_SERIALIZER_H
#define SVN_TEMP_SERIALIZER_H
#include "svn_string.h"
#ifdef __cplusplus
extern "C" {
#endif /* __cplusplus */
/* forward declaration */
struct svn_stringbuf_t;
/**
* The amount of extra memory allocated by #svn_temp_serializer__init for
* the internal buffer in addition to its suggested_buffer_size parameter.
* To allocate a 512 buffer, including overhead, just specify a size of
* 512 - SVN_TEMP_SERIALIZER__OVERHEAD.
*/
#define SVN_TEMP_SERIALIZER__OVERHEAD (sizeof(svn_stringbuf_t) + 1)
/**
* Opaque structure controlling the serialization process and holding the
* intermediate as well as final results.
*/
typedef struct svn_temp_serializer__context_t svn_temp_serializer__context_t;
/**
* Begin the serialization process for the @a source_struct and all objects
* referenced from it. @a struct_size must match the result of @c sizeof()
* of the actual structure. Due to the generic nature of the init function
* we can't determine the structure size as part of the function.
*
* It is possible to specify a @c NULL source_struct in which case the first
* call to svn_temp_serializer__push() will provide the root struct.
* Alternatively, one may even call svn_temp_serializer__add_string()
* but there is generally no point in doing so because the result will be
* simple string object in a #svn_stringbuf_t.
*
* You may suggest a larger initial buffer size in @a suggested_buffer_size
* to minimize the number of internal buffer re-allocations during the
* serialization process. All allocations will be made from @a pool.
*
* Pointers within the structure will be replaced by their serialized
* representation when the respective strings or sub-structures get
* serialized. This scheme allows only for tree-like, i.e. non-circular
* data structures.
*
* @return the serialization context.
*/
svn_temp_serializer__context_t *
svn_temp_serializer__init(const void *source_struct,
apr_size_t struct_size,
apr_size_t suggested_buffer_size,
apr_pool_t *pool);
/**
* Continue the serialization process of the @a source_struct that has
* already been serialized to @a buffer but contains references to new
* objects yet to serialize. I.e. this function allows you to append
* data to serialized structures returned by svn_temp_serializer__get().
*
* The current size of the serialized data is given in @a currently_used.
* If the allocated data buffer is actually larger, you may specifiy that
* size in @a currently_allocated to prevent unnecessary re-allocations.
* Otherwise, set it to 0.
*
* All allocations will be made from @a pool.
*
* Please note that only sub-structures of @a source_struct may be added.
* To add item referenced from other parts of the buffer, serialize from
* @a source_struct first, get the result from svn_temp_serializer__get()
* and call svn_temp_serializer__init_append for the next part.
*
* @return the serialization context.
*/
svn_temp_serializer__context_t *
svn_temp_serializer__init_append(void *buffer,
void *source_struct,
apr_size_t currently_used,
apr_size_t currently_allocated,
apr_pool_t *pool);
/**
* Begin serialization of a referenced sub-structure within the
* serialization @a context. @a source_struct must be a reference to the
* pointer in the original parent structure so that the correspondence in
* the serialized structure can be established. @a struct_size must match
* the result of @c sizeof() of the actual structure.
*
* Only in case that svn_temp_serializer__init() has not been provided
* with a root structure and this is the first call after the initialization,
* @a source_struct will point to a reference to the root structure instead
* of being related to some other.
*
* Sub-structures and strings will be added in a FIFO fashion. If you need
* add further sub-structures on the same level, you need to call
* svn_serializer__pop() to realign the serialization context.
*/
void
svn_temp_serializer__push(svn_temp_serializer__context_t *context,
const void * const * source_struct,
apr_size_t struct_size);
/**
* End the serialization of the current sub-structure. The serialization
* @a context will be focused back on the parent structure. You may then
* add further sub-structures starting from that level.
*
* It is not necessary to call this function just for symmetry at the end
* of the serialization process.
*/
void
svn_temp_serializer__pop(svn_temp_serializer__context_t *context);
/**
* Serialize a string referenced from the current structure within the
* serialization @a context. @a s must be a reference to the @c char*
* pointer in the original structure so that the correspondence in the
* serialized structure can be established.
*
* Only in case that svn_temp_serializer__init() has not been provided
* with a root structure and this is the first call after the initialization,
* @a s will not be related to some struct.
*/
void
svn_temp_serializer__add_string(svn_temp_serializer__context_t *context,
const char * const * s);
/**
* Set the serialized representation of the pointer @a ptr inside the
* current structure within the serialization @a context to @c NULL.
* This is particularly useful if the pointer is not @c NULL in the
* source structure.
*/
void
svn_temp_serializer__set_null(svn_temp_serializer__context_t *context,
const void * const * ptr);
/**
* @return the number of bytes currently used in the serialization buffer
* of the given serialization @a context.
*/
apr_size_t
svn_temp_serializer__get_length(svn_temp_serializer__context_t *context);
/**
* @return a reference to the data buffer containing the data serialialized
* so far in the given serialization @a context.
*/
struct svn_stringbuf_t *
svn_temp_serializer__get(svn_temp_serializer__context_t *context);
/**
* Deserialization is straightforward: just copy the serialized buffer to
* a natively aligned memory location (APR pools will take care of that
* automatically) and resolve all pointers to sub-structures.
*
* To do the latter, call this function for each of these pointers, giving
* the start address of the copied buffer in @a buffer and a reference to
* the pointer to resolve in @a ptr.
*/
void
svn_temp_deserializer__resolve(void *buffer, void **ptr);
/**
* Similar to svn_temp_deserializer__resolve() but instead of modifying
* the buffer content, the resulting pointer is passed back to the caller
* as the return value.
*/
const void *
svn_temp_deserializer__ptr(const void *buffer, const void *const *ptr);
#ifdef __cplusplus
}
#endif /* __cplusplus */
#endif /* SVN_TEMP_SERIALIZER_H */

View File

@ -0,0 +1,98 @@
/* svn_token.h : value/string-token functions
*
* ====================================================================
* Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements. See the NOTICE file
* distributed with this work for additional information
* regarding copyright ownership. The ASF licenses this file
* to you under the Apache License, Version 2.0 (the
* "License"); you may not use this file except in compliance
* with the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing,
* software distributed under the License is distributed on an
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
* KIND, either express or implied. See the License for the
* specific language governing permissions and limitations
* under the License.
* ====================================================================
*/
#ifndef SVN_TOKEN_H
#define SVN_TOKEN_H
#include "svn_error.h"
#ifdef __cplusplus
extern "C" {
#endif /* __cplusplus */
/** A mapping between a string STR and an enumeration value VAL.
*
* Maps are an array of these, terminated with a struct where STR == NULL.
*/
typedef struct svn_token_map_t
{
const char *str;
int val;
} svn_token_map_t;
/* A value used by some token functions to indicate an unrecognized token. */
#define SVN_TOKEN_UNKNOWN (-9999)
/* Return the string form of the given VALUE as found in MAP. If the value
is not recognized, then a MALFUNCTION will occur. */
const char *
svn_token__to_word(const svn_token_map_t *map,
int value);
/* NOTE: in the following functions, if WORD is NULL, then SVN_TOKEN_UNKNOWN
will be returned, or will cause the appropriate MALFUNCTION or ERROR. */
/* Return the integer value of the given token WORD, as found in MAP. If the
string is not recognized, then a MALFUNCTION will occur.
Note: this function is for persisted string values. Because this function
will throw a MALFUNCTION, it should not be used for network input or
user input. */
int
svn_token__from_word_strict(const svn_token_map_t *map,
const char *word);
/* Store the integer value of WORD into *VALUE. If the string is not
recognized, then SVN_ERR_BAD_TOKEN is returned. */
svn_error_t *
svn_token__from_word_err(int *value,
const svn_token_map_t *map,
const char *word);
/* Return the integer value of the given token WORD as found in MAP. If the
string is not recognized, then SVN_TOKEN_UNKNOWN will be returned. */
int
svn_token__from_word(const svn_token_map_t *map,
const char *word);
/* Return the integer value of the given token WORD/LEN as found in MAP. If
the string is not recognized, then SVN_TOKEN_UNKNOWN will be returned. */
int
svn_token__from_mem(const svn_token_map_t *map,
const char *word,
apr_size_t len);
#ifdef __cplusplus
}
#endif /* __cplusplus */
#endif /* SVN_TOKEN_H */

View File

@ -0,0 +1,87 @@
/**
* @copyright
* ====================================================================
* Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements. See the NOTICE file
* distributed with this work for additional information
* regarding copyright ownership. The ASF licenses this file
* to you under the Apache License, Version 2.0 (the
* "License"); you may not use this file except in compliance
* with the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing,
* software distributed under the License is distributed on an
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
* KIND, either express or implied. See the License for the
* specific language governing permissions and limitations
* under the License.
* ====================================================================
* @endcopyright
*
* @file svn_utf_private.h
* @brief UTF validation routines
*/
#ifndef SVN_UTF_PRIVATE_H
#define SVN_UTF_PRIVATE_H
#include <apr.h>
#include <apr_pools.h>
#include "svn_types.h"
#ifdef __cplusplus
extern "C" {
#endif /* __cplusplus */
/* Return TRUE if the string SRC of length LEN is a valid UTF-8 encoding
* according to the rules laid down by the Unicode 4.0 standard, FALSE
* otherwise. This function is faster than svn_utf__last_valid().
*/
svn_boolean_t
svn_utf__is_valid(const char *src, apr_size_t len);
/* As for svn_utf__is_valid but SRC is NULL terminated. */
svn_boolean_t
svn_utf__cstring_is_valid(const char *src);
/* Return a pointer to the first character after the last valid UTF-8
* potentially multi-byte character in the string SRC of length LEN.
* Validity of bytes from SRC to SRC+LEN-1, inclusively, is checked.
* If SRC is a valid UTF-8, the return value will point to the byte SRC+LEN,
* otherwise it will point to the start of the first invalid character.
* In either case all the characters between SRC and the return pointer - 1,
* inclusively, are valid UTF-8.
*
* See also svn_utf__is_valid().
*/
const char *
svn_utf__last_valid(const char *src, apr_size_t len);
/* As for svn_utf__last_valid but uses a different implementation without
lookup tables. It avoids the table memory use (about 400 bytes) but the
function is longer (about 200 bytes extra) and likely to be slower when
the string is valid. If the string is invalid this function may be
faster since it returns immediately rather than continuing to the end of
the string. The main reason this function exists is to test the table
driven implementation. */
const char *
svn_utf__last_valid2(const char *src, apr_size_t len);
const char *
svn_utf__cstring_from_utf8_fuzzy(const char *src,
apr_pool_t *pool,
svn_error_t *(*convert_from_utf8)
(const char **,
const char *,
apr_pool_t *));
#ifdef __cplusplus
}
#endif /* __cplusplus */
#endif /* SVN_UTF_PRIVATE_H */

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

View File

@ -0,0 +1,123 @@
/**
* @copyright
* ====================================================================
* Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements. See the NOTICE file
* distributed with this work for additional information
* regarding copyright ownership. The ASF licenses this file
* to you under the Apache License, Version 2.0 (the
* "License"); you may not use this file except in compliance
* with the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing,
* software distributed under the License is distributed on an
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
* KIND, either express or implied. See the License for the
* specific language governing permissions and limitations
* under the License.
* ====================================================================
* @endcopyright
*
* @file svn_base64.h
* @brief Base64 encoding and decoding functions
*/
#ifndef SVN_BASE64_H
#define SVN_BASE64_H
#include <apr_pools.h>
#include "svn_types.h"
#include "svn_io.h" /* for svn_stream_t */
#include "svn_string.h"
#ifdef __cplusplus
extern "C" {
#endif /* __cplusplus */
/**
*
*
* @defgroup base64 Base64 encoding/decoding functions
*
* @{
*/
/** Return a writable generic stream which will encode binary data in
* base64 format and write the encoded data to @a output. Be sure to
* close the stream when done writing in order to squeeze out the last
* bit of encoded data. The stream is allocated in @a pool.
*/
svn_stream_t *
svn_base64_encode(svn_stream_t *output,
apr_pool_t *pool);
/** Return a writable generic stream which will decode base64-encoded
* data and write the decoded data to @a output. The stream is allocated
* in @a pool.
*/
svn_stream_t *
svn_base64_decode(svn_stream_t *output,
apr_pool_t *pool);
/** Encode an @c svn_stringbuf_t into base64.
*
* A simple interface for encoding base64 data assuming we have all of
* it present at once. If @a break_lines is true, newlines will be
* inserted periodically; otherwise the string will only consist of
* base64 encoding characters. The returned string will be allocated
* from @a pool.
*
* @since New in 1.6.
*/
const svn_string_t *
svn_base64_encode_string2(const svn_string_t *str,
svn_boolean_t break_lines,
apr_pool_t *pool);
/**
* Same as svn_base64_encode_string2, but with @a break_lines always
* TRUE.
*
* @deprecated Provided for backward compatibility with the 1.5 API.
*/
SVN_DEPRECATED
const svn_string_t *
svn_base64_encode_string(const svn_string_t *str,
apr_pool_t *pool);
/** Decode an @c svn_stringbuf_t from base64.
*
* A simple interface for decoding base64 data assuming we have all of
* it present at once. The returned string will be allocated from @c
* pool.
*
*/
const svn_string_t *
svn_base64_decode_string(const svn_string_t *str,
apr_pool_t *pool);
/** Return a base64-encoded checksum for finalized @a digest.
*
* @a digest contains @c APR_MD5_DIGESTSIZE bytes of finalized data.
* Allocate the returned checksum in @a pool.
*
* @deprecated Provided for backward compatibility with the 1.5 API.
*/
SVN_DEPRECATED
svn_stringbuf_t *
svn_base64_from_md5(unsigned char digest[],
apr_pool_t *pool);
/** @} end group: Base64 encoding/decoding functions */
#ifdef __cplusplus
}
#endif /* __cplusplus */
#endif /* SVN_BASE64_H */

View File

@ -0,0 +1,90 @@
/**
* @copyright
* ====================================================================
* Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements. See the NOTICE file
* distributed with this work for additional information
* regarding copyright ownership. The ASF licenses this file
* to you under the Apache License, Version 2.0 (the
* "License"); you may not use this file except in compliance
* with the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing,
* software distributed under the License is distributed on an
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
* KIND, either express or implied. See the License for the
* specific language governing permissions and limitations
* under the License.
* ====================================================================
* @endcopyright
*
* @file svn_cache_config.h
* @brief Configuration interface to internal Subversion caches.
*/
#ifndef SVN_CACHE_CONFIG_H
#define SVN_CACHE_CONFIG_H
#include <apr.h>
#include "svn_types.h"
#ifdef __cplusplus
extern "C" {
#endif /* __cplusplus */
/** @defgroup svn_fs_cache_config caching configuration
* @{
* @since New in 1.7. */
/** Cache resource settings. It controls what caches, in what size and
how they will be created. The settings apply for the whole process.
@since New in 1.7.
*/
typedef struct svn_cache_config_t
{
/** total cache size in bytes. Please note that this is only soft limit
to the total application memory usage and will be exceeded due to
temporary objects and other program state.
May be 0, resulting in default caching code being used. */
apr_uint64_t cache_size;
/** maximum number of files kept open */
apr_size_t file_handle_count;
/** is this application guaranteed to be single-threaded? */
svn_boolean_t single_threaded;
} svn_cache_config_t;
/** Get the current cache configuration. If it has not been set,
this function will return the default settings.
@since New in 1.7.
*/
const svn_cache_config_t *
svn_cache_config_get(void);
/** Set the cache configuration. Please note that it may not change
the actual configuration *in use*. Therefore, call it before reading
data from any repo and call it only once.
This function is not thread-safe. Therefore, it should be called
from the processes' initialization code only.
@since New in 1.7.
*/
void
svn_cache_config_set(const svn_cache_config_t *settings);
/** @} */
/** @} */
#ifdef __cplusplus
}
#endif /* __cplusplus */
#endif /* SVN_CACHE_CONFIG_H */

View File

@ -0,0 +1,278 @@
/**
* @copyright
* ====================================================================
* Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements. See the NOTICE file
* distributed with this work for additional information
* regarding copyright ownership. The ASF licenses this file
* to you under the Apache License, Version 2.0 (the
* "License"); you may not use this file except in compliance
* with the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing,
* software distributed under the License is distributed on an
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
* KIND, either express or implied. See the License for the
* specific language governing permissions and limitations
* under the License.
* ====================================================================
* @endcopyright
*
* @file svn_checksum.h
* @brief Subversion checksum routines
*/
#ifndef SVN_CHECKSUM_H
#define SVN_CHECKSUM_H
#include <apr.h> /* for apr_size_t */
#include <apr_pools.h> /* for apr_pool_t */
#include "svn_types.h" /* for svn_boolean_t, svn_error_t */
#ifdef __cplusplus
extern "C" {
#endif /* __cplusplus */
/**
* Various types of checksums.
*
* @since New in 1.6.
*/
typedef enum svn_checksum_kind_t
{
/** The checksum is (or should be set to) an MD5 checksum. */
svn_checksum_md5,
/** The checksum is (or should be set to) a SHA1 checksum. */
svn_checksum_sha1
} svn_checksum_kind_t;
/**
* A generic checksum representation.
*
* @since New in 1.6.
*/
typedef struct svn_checksum_t
{
/** The bytes of the checksum. */
const unsigned char *digest;
/** The type of the checksum. This should never be changed by consumers
of the APIs. */
svn_checksum_kind_t kind;
} svn_checksum_t;
/**
* Opaque type for creating checksums of data.
*/
typedef struct svn_checksum_ctx_t svn_checksum_ctx_t;
/** Return a new checksum structure of type @a kind, initialized to the all-
* zeros value, allocated in @a pool.
*
* @since New in 1.6.
*/
svn_checksum_t *
svn_checksum_create(svn_checksum_kind_t kind,
apr_pool_t *pool);
/** Set @a checksum->digest to all zeros, which, by convention, matches
* all other checksums.
*
* @since New in 1.6.
*/
svn_error_t *
svn_checksum_clear(svn_checksum_t *checksum);
/** Compare checksums @a checksum1 and @a checksum2. If their kinds do not
* match or if neither is all zeros, and their content does not match, then
* return FALSE; else return TRUE.
*
* @since New in 1.6.
*/
svn_boolean_t
svn_checksum_match(const svn_checksum_t *checksum1,
const svn_checksum_t *checksum2);
/**
* Return a deep copy of @a checksum, allocated in @a pool. If @a
* checksum is NULL then NULL is returned.
*
* @since New in 1.6.
*/
svn_checksum_t *
svn_checksum_dup(const svn_checksum_t *checksum,
apr_pool_t *pool);
/** Return the hex representation of @a checksum, allocating the string
* in @a pool.
*
* @since New in 1.6.
*/
const char *
svn_checksum_to_cstring_display(const svn_checksum_t *checksum,
apr_pool_t *pool);
/** Return the hex representation of @a checksum, allocating the
* string in @a pool. If @a checksum->digest is all zeros (that is,
* 0, not '0') then return NULL. In 1.7+, @a checksum may be NULL
* and NULL will be returned in that case.
*
* @since New in 1.6.
* @note Passing NULL for @a checksum in 1.6 will cause a segfault.
*/
const char *
svn_checksum_to_cstring(const svn_checksum_t *checksum,
apr_pool_t *pool);
/** Return a serialized representation of @a checksum, allocated in
* @a result_pool. Temporary allocations are performed in @a scratch_pool.
*
* Note that @a checksum may not be NULL.
*
* @since New in 1.7.
*/
const char *
svn_checksum_serialize(const svn_checksum_t *checksum,
apr_pool_t *result_pool,
apr_pool_t *scratch_pool);
/** Return @a checksum from the serialized format at @a data. The checksum
* will be allocated in @a result_pool, with any temporary allocations
* performed in @a scratch_pool.
*
* @since New in 1.7.
*/
svn_error_t *
svn_checksum_deserialize(const svn_checksum_t **checksum,
const char *data,
apr_pool_t *result_pool,
apr_pool_t *scratch_pool);
/** Parse the hex representation @a hex of a checksum of kind @a kind and
* set @a *checksum to the result, allocating in @a pool.
*
* If @a hex is @c NULL or is the all-zeros checksum, then set @a *checksum
* to @c NULL.
*
* @since New in 1.6.
*/
svn_error_t *
svn_checksum_parse_hex(svn_checksum_t **checksum,
svn_checksum_kind_t kind,
const char *hex,
apr_pool_t *pool);
/**
* Return in @a *checksum the checksum of type @a kind for the bytes beginning
* at @a data, and going for @a len. @a *checksum is allocated in @a pool.
*
* @since New in 1.6.
*/
svn_error_t *
svn_checksum(svn_checksum_t **checksum,
svn_checksum_kind_t kind,
const void *data,
apr_size_t len,
apr_pool_t *pool);
/**
* Return in @a pool a newly allocated checksum populated with the checksum
* of type @a kind for the empty string.
*
* @since New in 1.6.
*/
svn_checksum_t *
svn_checksum_empty_checksum(svn_checksum_kind_t kind,
apr_pool_t *pool);
/**
* Create a new @c svn_checksum_ctx_t structure, allocated from @a pool for
* calculating checksums of type @a kind. @see svn_checksum_final()
*
* @since New in 1.6.
*/
svn_checksum_ctx_t *
svn_checksum_ctx_create(svn_checksum_kind_t kind,
apr_pool_t *pool);
/**
* Update the checksum represented by @a ctx, with @a len bytes starting at
* @a data.
*
* @since New in 1.6.
*/
svn_error_t *
svn_checksum_update(svn_checksum_ctx_t *ctx,
const void *data,
apr_size_t len);
/**
* Finalize the checksum used when creating @a ctx, and put the resultant
* checksum in @a *checksum, allocated in @a pool.
*
* @since New in 1.6.
*/
svn_error_t *
svn_checksum_final(svn_checksum_t **checksum,
const svn_checksum_ctx_t *ctx,
apr_pool_t *pool);
/**
* Return the digest size of @a checksum.
*
* @since New in 1.6.
*/
apr_size_t
svn_checksum_size(const svn_checksum_t *checksum);
/**
* Return @c TRUE iff @a checksum matches the checksum for the empty
* string.
*
* @since New in 1.8.
*/
svn_boolean_t
svn_checksum_is_empty_checksum(svn_checksum_t *checksum);
/**
* Return an error of type #SVN_ERR_CHECKSUM_MISMATCH for @a actual and
* @a expected checksums which do not match. Use @a fmt, and the following
* parameters to populate the error message.
*
* @note This function does not actually check for the mismatch, it just
* constructs the error.
*
* @a scratch_pool is used for temporary allocations; the returned error
* will be allocated in its own pool (as is typical).
*
* @since New in 1.7.
*/
svn_error_t *
svn_checksum_mismatch_err(const svn_checksum_t *expected,
const svn_checksum_t *actual,
apr_pool_t *scratch_pool,
const char *fmt,
...)
__attribute__ ((format(printf, 4, 5)));
#ifdef __cplusplus
}
#endif /* __cplusplus */
#endif /* SVN_CHECKSUM_H */

File diff suppressed because it is too large Load Diff

View File

@ -0,0 +1,376 @@
/**
* @copyright
* ====================================================================
* Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements. See the NOTICE file
* distributed with this work for additional information
* regarding copyright ownership. The ASF licenses this file
* to you under the Apache License, Version 2.0 (the
* "License"); you may not use this file except in compliance
* with the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing,
* software distributed under the License is distributed on an
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
* KIND, either express or implied. See the License for the
* specific language governing permissions and limitations
* under the License.
* ====================================================================
* @endcopyright
*
* @file svn_cmdline.h
* @brief Support functions for command line programs
*/
#ifndef SVN_CMDLINE_H
#define SVN_CMDLINE_H
#include <apr_pools.h>
#include <apr_getopt.h>
#ifndef DOXYGEN_SHOULD_SKIP_THIS
#define APR_WANT_STDIO
#endif
#include <apr_want.h>
#include "svn_types.h"
#include "svn_auth.h"
#include "svn_config.h"
#ifdef __cplusplus
extern "C" {
#endif /* __cplusplus */
/** Set up the locale for character conversion, and initialize APR.
* If @a error_stream is non-NULL, print error messages to the stream,
* using @a progname as the program name. Attempt to set @c stdout to
* line-buffered mode, and @a error_stream to unbuffered mode. Return
* @c EXIT_SUCCESS if successful, otherwise @c EXIT_FAILURE.
*
* @note This function should be called exactly once at program startup,
* before calling any other APR or Subversion functions.
*/
int
svn_cmdline_init(const char *progname,
FILE *error_stream);
/** Set @a *dest to an output-encoded C string from UTF-8 C string @a
* src; allocate @a *dest in @a pool.
*/
svn_error_t *
svn_cmdline_cstring_from_utf8(const char **dest,
const char *src,
apr_pool_t *pool);
/** Like svn_utf_cstring_from_utf8_fuzzy(), but converts to an
* output-encoded C string. */
const char *
svn_cmdline_cstring_from_utf8_fuzzy(const char *src,
apr_pool_t *pool);
/** Set @a *dest to a UTF-8-encoded C string from input-encoded C
* string @a src; allocate @a *dest in @a pool.
*/
svn_error_t *
svn_cmdline_cstring_to_utf8(const char **dest,
const char *src,
apr_pool_t *pool);
/** Set @a *dest to an output-encoded natively-formatted path string
* from canonical path @a src; allocate @a *dest in @a pool.
*/
svn_error_t *
svn_cmdline_path_local_style_from_utf8(const char **dest,
const char *src,
apr_pool_t *pool);
/** Write to stdout, using a printf-like format string @a fmt, passed
* through apr_pvsprintf(). All string arguments are in UTF-8; the output
* is converted to the output encoding. Use @a pool for temporary
* allocation.
*
* @since New in 1.1.
*/
svn_error_t *
svn_cmdline_printf(apr_pool_t *pool,
const char *fmt,
...)
__attribute__((format(printf, 2, 3)));
/** Write to the stdio @a stream, using a printf-like format string @a fmt,
* passed through apr_pvsprintf(). All string arguments are in UTF-8;
* the output is converted to the output encoding. Use @a pool for
* temporary allocation.
*
* @since New in 1.1.
*/
svn_error_t *
svn_cmdline_fprintf(FILE *stream,
apr_pool_t *pool,
const char *fmt,
...)
__attribute__((format(printf, 3, 4)));
/** Output the @a string to the stdio @a stream, converting from UTF-8
* to the output encoding. Use @a pool for temporary allocation.
*
* @since New in 1.1.
*/
svn_error_t *
svn_cmdline_fputs(const char *string,
FILE *stream,
apr_pool_t *pool);
/** Flush output buffers of the stdio @a stream, returning an error if that
* fails. This is just a wrapper for the standard fflush() function for
* consistent error handling.
*
* @since New in 1.1.
*/
svn_error_t *
svn_cmdline_fflush(FILE *stream);
/** Return the name of the output encoding allocated in @a pool, or @c
* APR_LOCALE_CHARSET if the output encoding is the same as the locale
* encoding.
*
* @since New in 1.3.
*/
const char *
svn_cmdline_output_encoding(apr_pool_t *pool);
/** Handle @a error in preparation for immediate exit from a
* command-line client. Specifically:
*
* Call svn_handle_error2(@a error, stderr, FALSE, @a prefix), clear
* @a error, destroy @a pool iff it is non-NULL, and return EXIT_FAILURE.
*
* @since New in 1.3.
*/
int
svn_cmdline_handle_exit_error(svn_error_t *error,
apr_pool_t *pool,
const char *prefix);
/** A prompt function/baton pair, and the path to the configuration
* directory. To be passed as the baton argument to the
* @c svn_cmdline_*_prompt functions.
*
* @since New in 1.6.
*/
typedef struct svn_cmdline_prompt_baton2_t {
svn_cancel_func_t cancel_func;
void *cancel_baton;
const char *config_dir;
} svn_cmdline_prompt_baton2_t;
/** Like svn_cmdline_prompt_baton2_t, but without the path to the
* configuration directory.
*
* @since New in 1.4.
* @deprecated Provided for backward compatibility with the 1.5 API.
*/
typedef struct svn_cmdline_prompt_baton_t {
svn_cancel_func_t cancel_func;
void *cancel_baton;
} svn_cmdline_prompt_baton_t;
/** Prompt the user for input, using @a prompt_str for the prompt and
* @a baton (which may be @c NULL) for cancellation, and returning the
* user's response in @a result, allocated in @a pool.
*
* @since New in 1.5.
*/
svn_error_t *
svn_cmdline_prompt_user2(const char **result,
const char *prompt_str,
svn_cmdline_prompt_baton_t *baton,
apr_pool_t *pool);
/** Similar to svn_cmdline_prompt_user2, but without cancellation
* support.
*
* @deprecated Provided for backward compatibility with the 1.4 API.
*/
SVN_DEPRECATED
svn_error_t *
svn_cmdline_prompt_user(const char **result,
const char *prompt_str,
apr_pool_t *pool);
/** An implementation of @c svn_auth_simple_prompt_func_t that prompts
* the user for keyboard input on the command line.
*
* @since New in 1.4.
*
* Expects a @c svn_cmdline_prompt_baton_t to be passed as @a baton.
*/
svn_error_t *
svn_cmdline_auth_simple_prompt(svn_auth_cred_simple_t **cred_p,
void *baton,
const char *realm,
const char *username,
svn_boolean_t may_save,
apr_pool_t *pool);
/** An implementation of @c svn_auth_username_prompt_func_t that prompts
* the user for their username via the command line.
*
* @since New in 1.4.
*
* Expects a @c svn_cmdline_prompt_baton_t to be passed as @a baton.
*/
svn_error_t *
svn_cmdline_auth_username_prompt(svn_auth_cred_username_t **cred_p,
void *baton,
const char *realm,
svn_boolean_t may_save,
apr_pool_t *pool);
/** An implementation of @c svn_auth_ssl_server_trust_prompt_func_t that
* asks the user if they trust a specific ssl server via the command line.
*
* @since New in 1.4.
*
* Expects a @c svn_cmdline_prompt_baton_t to be passed as @a baton.
*/
svn_error_t *
svn_cmdline_auth_ssl_server_trust_prompt(
svn_auth_cred_ssl_server_trust_t **cred_p,
void *baton,
const char *realm,
apr_uint32_t failures,
const svn_auth_ssl_server_cert_info_t *cert_info,
svn_boolean_t may_save,
apr_pool_t *pool);
/** An implementation of @c svn_auth_ssl_client_cert_prompt_func_t that
* prompts the user for the filename of their SSL client certificate via
* the command line.
*
* Records absolute path of the SSL client certificate file.
*
* @since New in 1.4.
*
* Expects a @c svn_cmdline_prompt_baton_t to be passed as @a baton.
*/
svn_error_t *
svn_cmdline_auth_ssl_client_cert_prompt(
svn_auth_cred_ssl_client_cert_t **cred_p,
void *baton,
const char *realm,
svn_boolean_t may_save,
apr_pool_t *pool);
/** An implementation of @c svn_auth_ssl_client_cert_pw_prompt_func_t that
* prompts the user for their SSL certificate password via the command line.
*
* @since New in 1.4.
*
* Expects a @c svn_cmdline_prompt_baton_t to be passed as @a baton.
*/
svn_error_t *
svn_cmdline_auth_ssl_client_cert_pw_prompt(
svn_auth_cred_ssl_client_cert_pw_t **cred_p,
void *baton,
const char *realm,
svn_boolean_t may_save,
apr_pool_t *pool);
/** An implementation of @c svn_auth_plaintext_prompt_func_t that
* prompts the user whether storing unencrypted passwords to disk is OK.
*
* Expects a @c svn_cmdline_prompt_baton2_t to be passed as @a baton.
*
* @since New in 1.6.
*/
svn_error_t *
svn_cmdline_auth_plaintext_prompt(svn_boolean_t *may_save_plaintext,
const char *realmstring,
void *baton,
apr_pool_t *pool);
/** An implementation of @c svn_auth_plaintext_passphrase_prompt_func_t that
* prompts the user whether storing unencrypted passphrase to disk is OK.
*
* Expects a @c svn_cmdline_prompt_baton2_t to be passed as @a baton.
*
* @since New in 1.6.
*/
svn_error_t *
svn_cmdline_auth_plaintext_passphrase_prompt(svn_boolean_t *may_save_plaintext,
const char *realmstring,
void *baton,
apr_pool_t *pool);
/** Set @a *ab to an authentication baton allocated from @a pool and
* initialized with the standard set of authentication providers used
* by the command line client.
*
* @a non_interactive, @a username, @a password, @a config_dir,
* @a no_auth_cache, and @a trust_server_cert are the values of the
* command line options of the corresponding names.
*
* @a cfg is the @c SVN_CONFIG_CATEGORY_CONFIG configuration, and
* @a cancel_func and @a cancel_baton control the cancellation of the
* prompting providers that are initialized.
*
* Use @a pool for all allocations.
*
* @since New in 1.6.
*/
svn_error_t *
svn_cmdline_create_auth_baton(svn_auth_baton_t **ab,
svn_boolean_t non_interactive,
const char *username,
const char *password,
const char *config_dir,
svn_boolean_t no_auth_cache,
svn_boolean_t trust_server_cert,
svn_config_t *cfg,
svn_cancel_func_t cancel_func,
void *cancel_baton,
apr_pool_t *pool);
/** Similar to svn_cmdline_create_auth_baton(), but with
* @a trust_server_cert always set to false.
*
* @since New in 1.4.
* @deprecated Provided for backward compatibility with the 1.5 API.
* Use svn_cmdline_create_auth_baton() instead.
*
* @note This deprecation does not follow the usual pattern of putting
* a new number on end of the function's name. Instead, the new
* function name is distinguished from the old by a grammatical
* improvement: the verb "create" instead of the noun "setup".
*/
SVN_DEPRECATED
svn_error_t *
svn_cmdline_setup_auth_baton(svn_auth_baton_t **ab,
svn_boolean_t non_interactive,
const char *username,
const char *password,
const char *config_dir,
svn_boolean_t no_auth_cache,
svn_config_t *cfg,
svn_cancel_func_t cancel_func,
void *cancel_baton,
apr_pool_t *pool);
#ifdef __cplusplus
}
#endif /* __cplusplus */
#endif /* SVN_CMDLINE_H */

View File

@ -0,0 +1,104 @@
/**
* @copyright
* ====================================================================
* Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements. See the NOTICE file
* distributed with this work for additional information
* regarding copyright ownership. The ASF licenses this file
* to you under the Apache License, Version 2.0 (the
* "License"); you may not use this file except in compliance
* with the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing,
* software distributed under the License is distributed on an
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
* KIND, either express or implied. See the License for the
* specific language governing permissions and limitations
* under the License.
* ====================================================================
* @endcopyright
*
* @file svn_compat.h
* @brief Utilities to help applications provide backwards-compatibility
*/
#ifndef SVN_COMPAT_H
#define SVN_COMPAT_H
#include <apr_pools.h>
#include <apr_hash.h>
#include <apr_tables.h>
#include "svn_types.h"
#ifdef __cplusplus
extern "C" {
#endif /* __cplusplus */
/** Return, in @a *callback2 and @a *callback2_baton a function/baton that
* will call @a callback/@a callback_baton, allocating the @a *callback2_baton
* in @a pool.
*
* @note This is used by compatibility wrappers, which exist in more than
* Subversion core library.
*
* @since New in 1.4.
*/
void
svn_compat_wrap_commit_callback(svn_commit_callback2_t *callback2,
void **callback2_baton,
svn_commit_callback_t callback,
void *callback_baton,
apr_pool_t *pool);
/** Clear svn:author, svn:date, and svn:log from @a revprops if not NULL.
* Use this if you must handle these three properties separately for
* compatibility reasons.
*
* @since New in 1.5.
*/
void
svn_compat_log_revprops_clear(apr_hash_t *revprops);
/** Return a list to pass to post-1.5 log-retrieval functions in order to
* retrieve the pre-1.5 set of revprops: svn:author, svn:date, and svn:log.
*
* @since New in 1.5.
*/
apr_array_header_t *
svn_compat_log_revprops_in(apr_pool_t *pool);
/** Return, in @a **author, @a **date, and @a **message, the values of the
* svn:author, svn:date, and svn:log revprops from @a revprops. If @a
* revprops is NULL, all return values are NULL. Any return value may be
* NULL if the corresponding property is not set in @a revprops.
*
* @since New in 1.5.
*/
void
svn_compat_log_revprops_out(const char **author, const char **date,
const char **message, apr_hash_t *revprops);
/** Return, in @a *receiver2 and @a *receiver2_baton a function/baton that
* will call @a receiver/@a receiver_baton, allocating the @a *receiver2_baton
* in @a pool.
*
* @note This is used by compatibility wrappers, which exist in more than
* Subversion core library.
*
* @since New in 1.5.
*/
void
svn_compat_wrap_log_receiver(svn_log_entry_receiver_t *receiver2,
void **receiver2_baton,
svn_log_message_receiver_t receiver,
void *receiver_baton,
apr_pool_t *pool);
#ifdef __cplusplus
}
#endif /* __cplusplus */
#endif /* SVN_COMPAT_H */

View File

@ -0,0 +1,808 @@
/**
* @copyright
* ====================================================================
* Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements. See the NOTICE file
* distributed with this work for additional information
* regarding copyright ownership. The ASF licenses this file
* to you under the Apache License, Version 2.0 (the
* "License"); you may not use this file except in compliance
* with the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing,
* software distributed under the License is distributed on an
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
* KIND, either express or implied. See the License for the
* specific language governing permissions and limitations
* under the License.
* ====================================================================
* @endcopyright
*
* @file svn_config.h
* @brief Accessing SVN configuration files.
*/
#ifndef SVN_CONFIG_H
#define SVN_CONFIG_H
#include <apr.h> /* for apr_int64_t */
#include <apr_pools.h> /* for apr_pool_t */
#include <apr_hash.h> /* for apr_hash_t */
#include "svn_types.h"
#include "svn_io.h"
#ifdef __cplusplus
extern "C" {
#endif /* __cplusplus */
/**************************************************************************
*** ***
*** For a description of the SVN configuration file syntax, see ***
*** your ~/.subversion/README, which is written out automatically by ***
*** svn_config_ensure(). ***
*** ***
**************************************************************************/
/** Opaque structure describing a set of configuration options. */
typedef struct svn_config_t svn_config_t;
/*** Configuration Defines ***/
/**
* @name Client configuration files strings
* Strings for the names of files, sections, and options in the
* client configuration files.
* @{
*/
/* This list of #defines is intentionally presented as a nested list
that matches the in-config hierarchy. */
#define SVN_CONFIG_CATEGORY_SERVERS "servers"
#define SVN_CONFIG_SECTION_GROUPS "groups"
#define SVN_CONFIG_SECTION_GLOBAL "global"
#define SVN_CONFIG_OPTION_HTTP_PROXY_HOST "http-proxy-host"
#define SVN_CONFIG_OPTION_HTTP_PROXY_PORT "http-proxy-port"
#define SVN_CONFIG_OPTION_HTTP_PROXY_USERNAME "http-proxy-username"
#define SVN_CONFIG_OPTION_HTTP_PROXY_PASSWORD "http-proxy-password"
#define SVN_CONFIG_OPTION_HTTP_PROXY_EXCEPTIONS "http-proxy-exceptions"
#define SVN_CONFIG_OPTION_HTTP_TIMEOUT "http-timeout"
#define SVN_CONFIG_OPTION_HTTP_COMPRESSION "http-compression"
#define SVN_CONFIG_OPTION_NEON_DEBUG_MASK "neon-debug-mask"
#define SVN_CONFIG_OPTION_HTTP_AUTH_TYPES "http-auth-types"
#define SVN_CONFIG_OPTION_SSL_AUTHORITY_FILES "ssl-authority-files"
#define SVN_CONFIG_OPTION_SSL_TRUST_DEFAULT_CA "ssl-trust-default-ca"
#define SVN_CONFIG_OPTION_SSL_CLIENT_CERT_FILE "ssl-client-cert-file"
#define SVN_CONFIG_OPTION_SSL_CLIENT_CERT_PASSWORD "ssl-client-cert-password"
#define SVN_CONFIG_OPTION_SSL_PKCS11_PROVIDER "ssl-pkcs11-provider"
#define SVN_CONFIG_OPTION_HTTP_LIBRARY "http-library"
#define SVN_CONFIG_OPTION_STORE_PASSWORDS "store-passwords"
#define SVN_CONFIG_OPTION_STORE_PLAINTEXT_PASSWORDS "store-plaintext-passwords"
#define SVN_CONFIG_OPTION_STORE_AUTH_CREDS "store-auth-creds"
#define SVN_CONFIG_OPTION_STORE_SSL_CLIENT_CERT_PP "store-ssl-client-cert-pp"
#define SVN_CONFIG_OPTION_STORE_SSL_CLIENT_CERT_PP_PLAINTEXT \
"store-ssl-client-cert-pp-plaintext"
#define SVN_CONFIG_OPTION_USERNAME "username"
/** @since New in 1.8. */
#define SVN_CONFIG_OPTION_HTTP_BULK_UPDATES "http-bulk-updates"
/** @since New in 1.8. */
#define SVN_CONFIG_OPTION_HTTP_MAX_CONNECTIONS "http-max-connections"
#define SVN_CONFIG_CATEGORY_CONFIG "config"
#define SVN_CONFIG_SECTION_AUTH "auth"
#define SVN_CONFIG_OPTION_PASSWORD_STORES "password-stores"
#define SVN_CONFIG_OPTION_KWALLET_WALLET "kwallet-wallet"
#define SVN_CONFIG_OPTION_KWALLET_SVN_APPLICATION_NAME_WITH_PID "kwallet-svn-application-name-with-pid"
/** @since New in 1.8. */
#define SVN_CONFIG_OPTION_SSL_CLIENT_CERT_FILE_PROMPT "ssl-client-cert-file-prompt"
/* The majority of options of the "auth" section
* has been moved to SVN_CONFIG_CATEGORY_SERVERS. */
#define SVN_CONFIG_SECTION_HELPERS "helpers"
#define SVN_CONFIG_OPTION_EDITOR_CMD "editor-cmd"
#define SVN_CONFIG_OPTION_DIFF_CMD "diff-cmd"
/** @since New in 1.7. */
#define SVN_CONFIG_OPTION_DIFF_EXTENSIONS "diff-extensions"
#define SVN_CONFIG_OPTION_DIFF3_CMD "diff3-cmd"
#define SVN_CONFIG_OPTION_DIFF3_HAS_PROGRAM_ARG "diff3-has-program-arg"
#define SVN_CONFIG_OPTION_MERGE_TOOL_CMD "merge-tool-cmd"
#define SVN_CONFIG_SECTION_MISCELLANY "miscellany"
#define SVN_CONFIG_OPTION_GLOBAL_IGNORES "global-ignores"
#define SVN_CONFIG_OPTION_LOG_ENCODING "log-encoding"
#define SVN_CONFIG_OPTION_USE_COMMIT_TIMES "use-commit-times"
/** @deprecated Not used by Subversion since 2003/r847039 (well before 1.0) */
#define SVN_CONFIG_OPTION_TEMPLATE_ROOT "template-root"
#define SVN_CONFIG_OPTION_ENABLE_AUTO_PROPS "enable-auto-props"
#define SVN_CONFIG_OPTION_NO_UNLOCK "no-unlock"
#define SVN_CONFIG_OPTION_MIMETYPES_FILE "mime-types-file"
#define SVN_CONFIG_OPTION_PRESERVED_CF_EXTS "preserved-conflict-file-exts"
#define SVN_CONFIG_OPTION_INTERACTIVE_CONFLICTS "interactive-conflicts"
#define SVN_CONFIG_OPTION_MEMORY_CACHE_SIZE "memory-cache-size"
#define SVN_CONFIG_SECTION_TUNNELS "tunnels"
#define SVN_CONFIG_SECTION_AUTO_PROPS "auto-props"
/** @since New in 1.8. */
#define SVN_CONFIG_SECTION_WORKING_COPY "working-copy"
/** @since New in 1.8. */
#define SVN_CONFIG_OPTION_SQLITE_EXCLUSIVE "exclusive-locking"
/** @since New in 1.8. */
#define SVN_CONFIG_OPTION_SQLITE_EXCLUSIVE_CLIENTS "exclusive-locking-clients"
/** @} */
/** @name Repository conf directory configuration files strings
* Strings for the names of sections and options in the
* repository conf directory configuration files.
* @{
*/
/* For repository svnserve.conf files */
#define SVN_CONFIG_SECTION_GENERAL "general"
#define SVN_CONFIG_OPTION_ANON_ACCESS "anon-access"
#define SVN_CONFIG_OPTION_AUTH_ACCESS "auth-access"
#define SVN_CONFIG_OPTION_PASSWORD_DB "password-db"
#define SVN_CONFIG_OPTION_REALM "realm"
#define SVN_CONFIG_OPTION_AUTHZ_DB "authz-db"
/** @since New in 1.8. */
#define SVN_CONFIG_OPTION_GROUPS_DB "groups-db"
/** @since New in 1.7. */
#define SVN_CONFIG_OPTION_FORCE_USERNAME_CASE "force-username-case"
/** @since New in 1.8. */
#define SVN_CONFIG_OPTION_HOOKS_ENV "hooks-env"
#define SVN_CONFIG_SECTION_SASL "sasl"
#define SVN_CONFIG_OPTION_USE_SASL "use-sasl"
#define SVN_CONFIG_OPTION_MIN_SSF "min-encryption"
#define SVN_CONFIG_OPTION_MAX_SSF "max-encryption"
/* For repository password database */
#define SVN_CONFIG_SECTION_USERS "users"
/** @} */
/*** Configuration Default Values ***/
/* '*' matches leading dots, e.g. '*.rej' matches '.foo.rej'. */
/* We want this to be printed on two lines in the generated config file,
* but we don't want the # character to end up in the variable.
*/
#define SVN_CONFIG__DEFAULT_GLOBAL_IGNORES_LINE_1 \
"*.o *.lo *.la *.al .libs *.so *.so.[0-9]* *.a *.pyc *.pyo __pycache__"
#define SVN_CONFIG__DEFAULT_GLOBAL_IGNORES_LINE_2 \
"*.rej *~ #*# .#* .*.swp .DS_Store"
#define SVN_CONFIG_DEFAULT_GLOBAL_IGNORES \
SVN_CONFIG__DEFAULT_GLOBAL_IGNORES_LINE_1 " " \
SVN_CONFIG__DEFAULT_GLOBAL_IGNORES_LINE_2
#define SVN_CONFIG_TRUE "TRUE"
#define SVN_CONFIG_FALSE "FALSE"
#define SVN_CONFIG_ASK "ASK"
/* Default values for some options. Should be passed as default values
* to svn_config_get and friends, instead of hard-coding the defaults in
* multiple places. */
#define SVN_CONFIG_DEFAULT_OPTION_STORE_PASSWORDS TRUE
#define SVN_CONFIG_DEFAULT_OPTION_STORE_PLAINTEXT_PASSWORDS SVN_CONFIG_ASK
#define SVN_CONFIG_DEFAULT_OPTION_STORE_AUTH_CREDS TRUE
#define SVN_CONFIG_DEFAULT_OPTION_STORE_SSL_CLIENT_CERT_PP TRUE
#define SVN_CONFIG_DEFAULT_OPTION_STORE_SSL_CLIENT_CERT_PP_PLAINTEXT \
SVN_CONFIG_ASK
#define SVN_CONFIG_DEFAULT_OPTION_HTTP_MAX_CONNECTIONS 4
/** Read configuration information from the standard sources and merge it
* into the hash @a *cfg_hash. If @a config_dir is not NULL it specifies a
* directory from which to read the configuration files, overriding all
* other sources. Otherwise, first read any system-wide configurations
* (from a file or from the registry), then merge in personal
* configurations (again from file or registry). The hash and all its data
* are allocated in @a pool.
*
* @a *cfg_hash is a hash whose keys are @c const char * configuration
* categories (@c SVN_CONFIG_CATEGORY_SERVERS,
* @c SVN_CONFIG_CATEGORY_CONFIG, etc.) and whose values are the @c
* svn_config_t * items representing the configuration values for that
* category.
*/
svn_error_t *
svn_config_get_config(apr_hash_t **cfg_hash,
const char *config_dir,
apr_pool_t *pool);
/** Set @a *cfgp to an empty @c svn_config_t structure,
* allocated in @a result_pool.
*
* Pass TRUE to @a section_names_case_sensitive if
* section names are to be populated case sensitively.
*
* Pass TRUE to @a option_names_case_sensitive if
* option names are to be populated case sensitively.
*
* @since New in 1.8.
*/
svn_error_t *
svn_config_create2(svn_config_t **cfgp,
svn_boolean_t section_names_case_sensitive,
svn_boolean_t option_names_case_sensitive,
apr_pool_t *result_pool);
/** Similar to svn_config_create2, but always passes @c FALSE to
* @a option_names_case_sensitive.
*
* @since New in 1.7.
* @deprecated Provided for backward compatibility with 1.7 API.
*/
SVN_DEPRECATED
svn_error_t *
svn_config_create(svn_config_t **cfgp,
svn_boolean_t section_names_case_sensitive,
apr_pool_t *result_pool);
/** Read configuration data from @a file (a file or registry path) into
* @a *cfgp, allocated in @a pool.
*
* If @a file does not exist, then if @a must_exist, return an error,
* otherwise return an empty @c svn_config_t.
*
* If @a section_names_case_sensitive is @c TRUE, populate section name hashes
* case sensitively, except for the @c "DEFAULT" section.
*
* If @a option_names_case_sensitive is @c TRUE, populate option name hashes
* case sensitively.
*
* @since New in 1.8.
*/
svn_error_t *
svn_config_read3(svn_config_t **cfgp,
const char *file,
svn_boolean_t must_exist,
svn_boolean_t section_names_case_sensitive,
svn_boolean_t option_names_case_sensitive,
apr_pool_t *result_pool);
/** Similar to svn_config_read3, but always passes @c FALSE to
* @a option_names_case_sensitive.
*
* @since New in 1.7.
* @deprecated Provided for backward compatibility with 1.7 API.
*/
SVN_DEPRECATED
svn_error_t *
svn_config_read2(svn_config_t **cfgp,
const char *file,
svn_boolean_t must_exist,
svn_boolean_t section_names_case_sensitive,
apr_pool_t *result_pool);
/** Similar to svn_config_read2, but always passes @c FALSE to
* @a section_names_case_sensitive.
*
* @deprecated Provided for backward compatibility with 1.6 API.
*/
SVN_DEPRECATED
svn_error_t *
svn_config_read(svn_config_t **cfgp,
const char *file,
svn_boolean_t must_exist,
apr_pool_t *result_pool);
/** Read configuration data from @a stream into @a *cfgp, allocated in
* @a result_pool.
*
* If @a section_names_case_sensitive is @c TRUE, populate section name hashes
* case sensitively, except for the @c "DEFAULT" section.
*
* If @a option_names_case_sensitive is @c TRUE, populate option name hashes
* case sensitively.
*
* @since New in 1.8.
*/
svn_error_t *
svn_config_parse(svn_config_t **cfgp,
svn_stream_t *stream,
svn_boolean_t section_names_case_sensitive,
svn_boolean_t option_names_case_sensitive,
apr_pool_t *result_pool);
/** Like svn_config_read(), but merges the configuration data from @a file
* (a file or registry path) into @a *cfg, which was previously returned
* from svn_config_read(). This function invalidates all value
* expansions in @a cfg, so that the next svn_config_get() takes the
* modifications into account.
*/
svn_error_t *
svn_config_merge(svn_config_t *cfg,
const char *file,
svn_boolean_t must_exist);
/** Find the value of a (@a section, @a option) pair in @a cfg, set @a
* *valuep to the value.
*
* If @a cfg is @c NULL, just sets @a *valuep to @a default_value. If
* the value does not exist, expand and return @a default_value. @a
* default_value can be NULL.
*
* The returned value will be valid at least until the next call to
* svn_config_get(), or for the lifetime of @a default_value. It is
* safest to consume the returned value immediately.
*
* This function may change @a cfg by expanding option values.
*/
void
svn_config_get(svn_config_t *cfg,
const char **valuep,
const char *section,
const char *option,
const char *default_value);
/** Add or replace the value of a (@a section, @a option) pair in @a cfg with
* @a value.
*
* This function invalidates all value expansions in @a cfg.
*
* To remove an option, pass NULL for the @a value.
*/
void
svn_config_set(svn_config_t *cfg,
const char *section,
const char *option,
const char *value);
/** Like svn_config_get(), but for boolean values.
*
* Parses the option as a boolean value. The recognized representations
* are 'TRUE'/'FALSE', 'yes'/'no', 'on'/'off', '1'/'0'; case does not
* matter. Returns an error if the option doesn't contain a known string.
*/
svn_error_t *
svn_config_get_bool(svn_config_t *cfg,
svn_boolean_t *valuep,
const char *section,
const char *option,
svn_boolean_t default_value);
/** Like svn_config_set(), but for boolean values.
*
* Sets the option to 'TRUE'/'FALSE', depending on @a value.
*/
void
svn_config_set_bool(svn_config_t *cfg,
const char *section,
const char *option,
svn_boolean_t value);
/** Like svn_config_get(), but for 64-bit signed integers.
*
* Parses the @a option in @a section of @a cfg as an integer value,
* setting @a *valuep to the result. If the option is not found, sets
* @a *valuep to @a default_value. If the option is found but cannot
* be converted to an integer, returns an error.
*
* @since New in 1.8.
*/
svn_error_t *
svn_config_get_int64(svn_config_t *cfg,
apr_int64_t *valuep,
const char *section,
const char *option,
apr_int64_t default_value);
/** Like svn_config_set(), but for 64-bit signed integers.
*
* Sets the value of @a option in @a section of @a cfg to the signed
* decimal @a value.
*
* @since New in 1.8.
*/
void
svn_config_set_int64(svn_config_t *cfg,
const char *section,
const char *option,
apr_int64_t value);
/** Like svn_config_get(), but only for yes/no/ask values.
*
* Parse @a option in @a section and set @a *valuep to one of
* SVN_CONFIG_TRUE, SVN_CONFIG_FALSE, or SVN_CONFIG_ASK. If there is
* no setting for @a option, then parse @a default_value and set
* @a *valuep accordingly. If @a default_value is NULL, the result is
* undefined, and may be an error; we recommend that you pass one of
* SVN_CONFIG_TRUE, SVN_CONFIG_FALSE, or SVN_CONFIG_ASK for @a default value.
*
* Valid representations are (at least) "true"/"false", "yes"/"no",
* "on"/"off", "1"/"0", and "ask"; they are case-insensitive. Return
* an SVN_ERR_BAD_CONFIG_VALUE error if either @a default_value or
* @a option's value is not a valid representation.
*
* @since New in 1.6.
*/
svn_error_t *
svn_config_get_yes_no_ask(svn_config_t *cfg,
const char **valuep,
const char *section,
const char *option,
const char* default_value);
/** Like svn_config_get_bool(), but for tristate values.
*
* Set @a *valuep to #svn_tristate_true, #svn_tristate_false, or
* #svn_tristate_unknown, depending on the value of @a option in @a
* section of @a cfg. True and false values are the same as for
* svn_config_get_bool(); @a unknown_value specifies the option value
* allowed for third state (#svn_tristate_unknown).
*
* Use @a default_value as the default value if @a option cannot be
* found.
*
* @since New in 1.8.
*/
svn_error_t *
svn_config_get_tristate(svn_config_t *cfg,
svn_tristate_t *valuep,
const char *section,
const char *option,
const char *unknown_value,
svn_tristate_t default_value);
/** Similar to @c svn_config_section_enumerator2_t, but is not
* provided with a memory pool argument.
*
* See svn_config_enumerate_sections() for the details of this type.
*
* @deprecated Provided for backwards compatibility with the 1.2 API.
*/
typedef svn_boolean_t (*svn_config_section_enumerator_t)(const char *name,
void *baton);
/** Similar to svn_config_enumerate_sections2(), but uses a memory pool of
* @a cfg instead of one that is explicitly provided.
*
* @deprecated Provided for backwards compatibility with the 1.2 API.
*/
SVN_DEPRECATED
int
svn_config_enumerate_sections(svn_config_t *cfg,
svn_config_section_enumerator_t callback,
void *baton);
/** A callback function used in enumerating config sections.
*
* See svn_config_enumerate_sections2() for the details of this type.
*
* @since New in 1.3.
*/
typedef svn_boolean_t (*svn_config_section_enumerator2_t)(const char *name,
void *baton,
apr_pool_t *pool);
/** Enumerate the sections, passing @a baton and the current section's name
* to @a callback. Continue the enumeration if @a callback returns @c TRUE.
* Return the number of times @a callback was called.
*
* ### See kff's comment to svn_config_enumerate2(). It applies to this
* function, too. ###
*
* @a callback's @a name parameter is only valid for the duration of the call.
*
* @since New in 1.3.
*/
int
svn_config_enumerate_sections2(svn_config_t *cfg,
svn_config_section_enumerator2_t callback,
void *baton, apr_pool_t *pool);
/** Similar to @c svn_config_enumerator2_t, but is not
* provided with a memory pool argument.
* See svn_config_enumerate() for the details of this type.
*
* @deprecated Provided for backwards compatibility with the 1.2 API.
*/
typedef svn_boolean_t (*svn_config_enumerator_t)(const char *name,
const char *value,
void *baton);
/** Similar to svn_config_enumerate2(), but uses a memory pool of
* @a cfg instead of one that is explicitly provided.
*
* @deprecated Provided for backwards compatibility with the 1.2 API.
*/
SVN_DEPRECATED
int
svn_config_enumerate(svn_config_t *cfg,
const char *section,
svn_config_enumerator_t callback,
void *baton);
/** A callback function used in enumerating config options.
*
* See svn_config_enumerate2() for the details of this type.
*
* @since New in 1.3.
*/
typedef svn_boolean_t (*svn_config_enumerator2_t)(const char *name,
const char *value,
void *baton,
apr_pool_t *pool);
/** Enumerate the options in @a section, passing @a baton and the current
* option's name and value to @a callback. Continue the enumeration if
* @a callback returns @c TRUE. Return the number of times @a callback
* was called.
*
* ### kff asks: A more usual interface is to continue enumerating
* while @a callback does not return error, and if @a callback does
* return error, to return the same error (or a wrapping of it)
* from svn_config_enumerate(). What's the use case for
* svn_config_enumerate()? Is it more likely to need to break out
* of an enumeration early, with no error, than an invocation of
* @a callback is likely to need to return an error? ###
*
* @a callback's @a name and @a value parameters are only valid for the
* duration of the call.
*
* @since New in 1.3.
*/
int
svn_config_enumerate2(svn_config_t *cfg,
const char *section,
svn_config_enumerator2_t callback,
void *baton,
apr_pool_t *pool);
/**
* Return @c TRUE if @a section exists in @a cfg, @c FALSE otherwise.
*
* @since New in 1.4.
*/
svn_boolean_t
svn_config_has_section(svn_config_t *cfg,
const char *section);
/** Enumerate the group @a master_section in @a cfg. Each variable
* value is interpreted as a list of glob patterns (separated by comma
* and optional whitespace). Return the name of the first variable
* whose value matches @a key, or @c NULL if no variable matches.
*/
const char *
svn_config_find_group(svn_config_t *cfg,
const char *key,
const char *master_section,
apr_pool_t *pool);
/** Retrieve value corresponding to @a option_name in @a cfg, or
* return @a default_value if none is found.
*
* The config will first be checked for a default.
* If @a server_group is not @c NULL, the config will also be checked
* for an override in a server group,
*
*/
const char *
svn_config_get_server_setting(svn_config_t *cfg,
const char* server_group,
const char* option_name,
const char* default_value);
/** Retrieve value into @a result_value corresponding to @a option_name for a
* given @a server_group in @a cfg, or return @a default_value if none is
* found.
*
* The config will first be checked for a default, then will be checked for
* an override in a server group. If the value found is not a valid integer,
* a @c svn_error_t* will be returned.
*/
svn_error_t *
svn_config_get_server_setting_int(svn_config_t *cfg,
const char *server_group,
const char *option_name,
apr_int64_t default_value,
apr_int64_t *result_value,
apr_pool_t *pool);
/** Set @a *valuep according to @a option_name for a given
* @a server_group in @a cfg, or set to @a default_value if no value is
* specified.
*
* Check first a default, then for an override in a server group. If
* a value is found but is not a valid boolean, return an
* SVN_ERR_BAD_CONFIG_VALUE error.
*
* @since New in 1.6.
*/
svn_error_t *
svn_config_get_server_setting_bool(svn_config_t *cfg,
svn_boolean_t *valuep,
const char *server_group,
const char *option_name,
svn_boolean_t default_value);
/** Try to ensure that the user's ~/.subversion/ area exists, and create
* no-op template files for any absent config files. Use @a pool for any
* temporary allocation. If @a config_dir is not @c NULL it specifies a
* directory from which to read the config overriding all other sources.
*
* Don't error if something exists but is the wrong kind (for example,
* ~/.subversion exists but is a file, or ~/.subversion/servers exists
* but is a directory).
*
* Also don't error if trying to create something and failing -- it's
* okay for the config area or its contents not to be created.
* However, if creating a config template file succeeds, return an
* error if unable to initialize its contents.
*/
svn_error_t *
svn_config_ensure(const char *config_dir,
apr_pool_t *pool);
/** Accessing cached authentication data in the user config area.
*
* @defgroup cached_authentication_data Cached authentication data
* @{
*/
/** A hash-key pointing to a realmstring. Every file containing
* authentication data should have this key.
*/
#define SVN_CONFIG_REALMSTRING_KEY "svn:realmstring"
/** Use @a cred_kind and @a realmstring to locate a file within the
* ~/.subversion/auth/ area. If the file exists, initialize @a *hash
* and load the file contents into the hash, using @a pool. If the
* file doesn't exist, set @a *hash to NULL.
*
* If @a config_dir is not NULL it specifies a directory from which to
* read the config overriding all other sources.
*
* Besides containing the original credential fields, the hash will
* also contain @c SVN_CONFIG_REALMSTRING_KEY. The caller can examine
* this value as a sanity-check that the correct file was loaded.
*
* The hashtable will contain <tt>const char *</tt> keys and
* <tt>svn_string_t *</tt> values.
*/
svn_error_t *
svn_config_read_auth_data(apr_hash_t **hash,
const char *cred_kind,
const char *realmstring,
const char *config_dir,
apr_pool_t *pool);
/** Use @a cred_kind and @a realmstring to create or overwrite a file
* within the ~/.subversion/auth/ area. Write the contents of @a hash into
* the file. If @a config_dir is not NULL it specifies a directory to read
* the config overriding all other sources.
*
* Also, add @a realmstring to the file, with key @c
* SVN_CONFIG_REALMSTRING_KEY. This allows programs (or users) to
* verify exactly which set credentials live within the file.
*
* The hashtable must contain <tt>const char *</tt> keys and
* <tt>svn_string_t *</tt> values.
*/
svn_error_t *
svn_config_write_auth_data(apr_hash_t *hash,
const char *cred_kind,
const char *realmstring,
const char *config_dir,
apr_pool_t *pool);
/** Callback for svn_config_walk_auth_data().
*
* Called for each credential walked by that function (and able to be
* fully purged) to allow perusal and selective removal of credentials.
*
* @a cred_kind and @a realmstring specify the key of the credential.
* @a hash contains the hash data associated with the record.
*
* Before returning set @a *delete_cred to TRUE to remove the credential from
* the cache; leave @a *delete_cred unchanged or set it to FALSE to keep the
* credential.
*
* Implementations may return #SVN_ERR_CEASE_INVOCATION to indicate
* that the callback should not be called again. Note that when that
* error is returned, the value of @a delete_cred will still be
* honored and action taken if necessary. (For other returned errors,
* @a delete_cred is ignored by svn_config_walk_auth_data().)
*
* @since New in 1.8.
*/
typedef svn_error_t *
(*svn_config_auth_walk_func_t)(svn_boolean_t *delete_cred,
void *cleanup_baton,
const char *cred_kind,
const char *realmstring,
apr_hash_t *hash,
apr_pool_t *scratch_pool);
/** Call @a walk_func with @a walk_baton and information describing
* each credential cached within the Subversion auth store located
* under @a config_dir. If the callback sets its delete_cred return
* flag, delete the associated credential.
*
* @note Removing credentials from the config-based disk store will
* not purge them from any open svn_auth_baton_t instance. Consider
* using svn_auth_forget_credentials() -- from the @a cleanup_func,
* even -- for this purpose.
*
* @note Removing credentials from the config-based disk store will
* not also remove any related credentials from third-party password
* stores. (Implementations of @a walk_func which delete credentials
* may wish to consult the "passtype" element of @a hash, if any, to
* see if a third-party store -- such as "gnome-keyring" or "kwallet"
* is being used to hold the most sensitive portion of the credentials
* for this @a cred_kind and @a realmstring.)
*
* @see svn_auth_forget_credentials()
*
* @since New in 1.8.
*/
svn_error_t *
svn_config_walk_auth_data(const char *config_dir,
svn_config_auth_walk_func_t walk_func,
void *walk_baton,
apr_pool_t *scratch_pool);
/** Put the absolute path to the user's configuration directory,
* or to a file within that directory, into @a *path.
*
* If @a config_dir is not NULL, it must point to an alternative
* config directory location. If it is NULL, the default location
* is used. If @a fname is not NULL, it must specify the last
* component of the path to be returned. This can be used to create
* a path to any file in the configuration directory.
*
* Do all allocations in @a pool.
*
* Hint:
* To get the user configuration file, pass @c SVN_CONFIG_CATEGORY_CONFIG
* for @a fname. To get the servers configuration file, pass
* @c SVN_CONFIG_CATEGORY_SERVERS for @a fname.
*
* @since New in 1.6.
*/
svn_error_t *
svn_config_get_user_config_path(const char **path,
const char *config_dir,
const char *fname,
apr_pool_t *pool);
/** Create a deep copy of the config object @a src and return
* it in @a cfgp, allocating the memory in @a pool.
*
* @since New in 1.8.
*/
svn_error_t *
svn_config_dup(svn_config_t **cfgp,
svn_config_t *src,
apr_pool_t *pool);
/** Create a deep copy of the config hash @a src_hash and return
* it in @a cfg_hash, allocating the memory in @a pool.
*
* @since New in 1.8.
*/
svn_error_t *
svn_config_copy_config(apr_hash_t **cfg_hash,
apr_hash_t *src_hash,
apr_pool_t *pool);
/** @} */
#ifdef __cplusplus
}
#endif /* __cplusplus */
#endif /* SVN_CONFIG_H */

View File

@ -0,0 +1,196 @@
/**
* @copyright
* ====================================================================
* Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements. See the NOTICE file
* distributed with this work for additional information
* regarding copyright ownership. The ASF licenses this file
* to you under the Apache License, Version 2.0 (the
* "License"); you may not use this file except in compliance
* with the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing,
* software distributed under the License is distributed on an
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
* KIND, either express or implied. See the License for the
* specific language governing permissions and limitations
* under the License.
* ====================================================================
* @endcopyright
*
* @file svn_ctype.h
* @brief Character classification routines
* @since New in 1.2.
*/
#ifndef SVN_CTYPE_H
#define SVN_CTYPE_H
#include <apr.h>
#ifdef __cplusplus
extern "C" {
#endif /* __cplusplus */
/** Table of flags for character classification. */
extern const apr_uint32_t *const svn_ctype_table;
/** Check if @a c is in the character class described by @a flags.
* The @a flags is a bitwise-or combination of @c SVN_CTYPE_*
* constants. Uses #svn_ctype_table.
*/
#define svn_ctype_test(c, flags) \
(0 != (svn_ctype_table[(unsigned char)(c)] & (flags)))
/**
* @defgroup ctype_basic Basic character classification - 7-bit ASCII only
* @{
*/
/* Basic character classes */
#define SVN_CTYPE_CNTRL 0x0001 /**< Control character */
#define SVN_CTYPE_SPACE 0x0002 /**< Whitespace */
#define SVN_CTYPE_DIGIT 0x0004 /**< Decimal digit */
#define SVN_CTYPE_UPPER 0x0008 /**< Uppercase letter */
#define SVN_CTYPE_LOWER 0x0010 /**< Lowercase letter */
#define SVN_CTYPE_PUNCT 0x0020 /**< Punctuation mark */
#define SVN_CTYPE_XALPHA 0x0040 /**< Hexadecimal digits A to F */
#define SVN_CTYPE_ASCII 0x0080 /**< ASCII subset*/
/* Derived character classes */
/** ASCII letter */
#define SVN_CTYPE_ALPHA (SVN_CTYPE_LOWER | SVN_CTYPE_UPPER)
/** ASCII letter or decimal digit */
#define SVN_CTYPE_ALNUM (SVN_CTYPE_ALPHA | SVN_CTYPE_DIGIT)
/** ASCII hexadecimal digit */
#define SVN_CTYPE_XDIGIT (SVN_CTYPE_DIGIT | SVN_CTYPE_XALPHA)
/** Printable ASCII except space */
#define SVN_CTYPE_GRAPH (SVN_CTYPE_PUNCT | SVN_CTYPE_ALNUM)
/** All printable ASCII */
#define SVN_CTYPE_PRINT (SVN_CTYPE_GRAPH | SVN_CTYPE_SPACE)
/** Check if @a c is an ASCII control character. */
#define svn_ctype_iscntrl(c) svn_ctype_test((c), SVN_CTYPE_CNTRL)
/** Check if @a c is an ASCII whitespace character. */
#define svn_ctype_isspace(c) svn_ctype_test((c), SVN_CTYPE_SPACE)
/** Check if @a c is an ASCII digit. */
#define svn_ctype_isdigit(c) svn_ctype_test((c), SVN_CTYPE_DIGIT)
/** Check if @a c is an ASCII uppercase letter. */
#define svn_ctype_isupper(c) svn_ctype_test((c), SVN_CTYPE_UPPER)
/** Check if @a c is an ASCII lowercase letter. */
#define svn_ctype_islower(c) svn_ctype_test((c), SVN_CTYPE_LOWER)
/** Check if @a c is an ASCII punctuation mark. */
#define svn_ctype_ispunct(c) svn_ctype_test((c), SVN_CTYPE_PUNCT)
/** Check if @a c is an ASCII character. */
#define svn_ctype_isascii(c) svn_ctype_test((c), SVN_CTYPE_ASCII)
/** Check if @a c is an ASCII letter. */
#define svn_ctype_isalpha(c) svn_ctype_test((c), SVN_CTYPE_ALPHA)
/** Check if @a c is an ASCII letter or decimal digit. */
#define svn_ctype_isalnum(c) svn_ctype_test((c), SVN_CTYPE_ALNUM)
/** Check if @a c is an ASCII hexadecimal digit. */
#define svn_ctype_isxdigit(c) svn_ctype_test((c), SVN_CTYPE_XDIGIT)
/** Check if @a c is an ASCII graphical (visible printable) character. */
#define svn_ctype_isgraph(c) svn_ctype_test((c), SVN_CTYPE_GRAPH)
/** Check if @a c is an ASCII printable character. */
#define svn_ctype_isprint(c) svn_ctype_test((c), SVN_CTYPE_PRINT)
/** @} */
/**
* @defgroup ctype_extra Extended character classification
* @{
*/
/* Basic extended character classes */
#define SVN_CTYPE_UTF8LEAD 0x0100 /**< UTF-8 multibyte lead byte */
#define SVN_CTYPE_UTF8CONT 0x0200 /**< UTF-8 multibyte non-lead byte */
/* ### TBD
#define SVN_CTYPE_XMLNAME 0x0400
#define SVN_CTYPE_URISAFE 0x0800
*/
/* Derived extended character classes */
/** Part of a UTF-8 multibyte character. */
#define SVN_CTYPE_UTF8MBC (SVN_CTYPE_UTF8LEAD | SVN_CTYPE_UTF8CONT)
/** All valid UTF-8 bytes. */
#define SVN_CTYPE_UTF8 (SVN_CTYPE_ASCII | SVN_CTYPE_UTF8MBC)
/** Check if @a c is a UTF-8 multibyte lead byte. */
#define svn_ctype_isutf8lead(c) svn_ctype_test((c), SVN_CTYPE_UTF8LEAD)
/** Check if @a c is a UTF-8 multibyte continuation (non-lead) byte. */
#define svn_ctype_isutf8cont(c) svn_ctype_test((c), SVN_CTYLE_UTF8CONT)
/** Check if @a c is part of a UTF-8 multibyte character. */
#define svn_ctype_isutf8mbc(c) svn_ctype_test((c), SVN_CTYPE_UTF8MBC)
/** Check if @a c is valid in UTF-8. */
#define svn_ctype_isutf8(c) svn_ctype_test((c), SVN_CTYPE_UTF8)
/** @} */
/**
* @defgroup ctype_ascii ASCII character value constants
* @{
*/
#define SVN_CTYPE_ASCII_MINUS 45 /**< ASCII value of '-' */
#define SVN_CTYPE_ASCII_DOT 46 /**< ASCII value of '.' */
#define SVN_CTYPE_ASCII_COLON 58 /**< ASCII value of ':' */
#define SVN_CTYPE_ASCII_UNDERSCORE 95 /**< ASCII value of '_' */
#define SVN_CTYPE_ASCII_TAB 9 /**< ASCII value of a tab */
#define SVN_CTYPE_ASCII_LINEFEED 10 /**< ASCII value of a line feed */
#define SVN_CTYPE_ASCII_CARRIAGERETURN 13
/**< ASCII value of a carriage return */
#define SVN_CTYPE_ASCII_DELETE 127
/**< ASCII value of a delete character */
/** @} */
/**
* @defgroup ctype_case ASCII-subset case folding
* @{
*/
/**
* Compare two characters @a a and @a b, treating case-equivalent
* unaccented Latin (ASCII subset) letters as equal.
*
* Returns in integer greater than, equal to, or less than 0,
* according to whether @a a is considered greater than, equal to,
* or less than @a b.
*
* @since New in 1.5.
*/
int
svn_ctype_casecmp(int a,
int b);
/** @} */
#ifdef __cplusplus
}
#endif /* __cplusplus */
#endif /* SVN_CTYPE_H */

View File

@ -0,0 +1,398 @@
/**
* @copyright
* ====================================================================
* Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements. See the NOTICE file
* distributed with this work for additional information
* regarding copyright ownership. The ASF licenses this file
* to you under the Apache License, Version 2.0 (the
* "License"); you may not use this file except in compliance
* with the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing,
* software distributed under the License is distributed on an
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
* KIND, either express or implied. See the License for the
* specific language governing permissions and limitations
* under the License.
* ====================================================================
* @endcopyright
*
* @file svn_dav.h
* @brief Code related to WebDAV/DeltaV usage in Subversion.
*/
#ifndef SVN_DAV_H
#define SVN_DAV_H
#ifdef __cplusplus
extern "C" {
#endif /* __cplusplus */
/** This is the MIME type that Subversion uses for its "svndiff" format.
*
* This is an application type, for the "svn" vendor. The specific subtype
* is "svndiff".
*/
#define SVN_SVNDIFF_MIME_TYPE "application/vnd.svn-svndiff"
/** This is the MIME type that Subversion users for its "skel" format.
*
* This is an application type, for the "svn" vendor. The specific subtype
* is "skel".
* @since New in 1.7.
*/
#define SVN_SKEL_MIME_TYPE "application/vnd.svn-skel"
/** This header is *TEMPORARILY* used to transmit the delta base to the
* server. It contains a version resource URL for what is on the client.
*
* @note The HTTP delta draft recommends an If-None-Match header
* holding an entity tag corresponding to the base copy that the
* client has. In Subversion, it is much more natural to use a version
* URL to specify that base. We'd like, then, to use the If: header
* to specify the URL. Unfortunately, mod_dav sees all "State-token"
* items as lock tokens. So we'll use this custom header until mod_dav
* and other backend APIs are taught to be less rigid, at which time
* we can switch to using an If: header to report our base version.
*/
#define SVN_DAV_DELTA_BASE_HEADER "X-SVN-VR-Base"
/** This header is used when an svn client wants to trigger specific
* svn server behaviors. Normal WebDAV or DeltaV clients won't use it.
*/
#define SVN_DAV_OPTIONS_HEADER "X-SVN-Options"
/**
* @name options-header defines
* Specific options that can appear in the options-header:
* @{
*/
#define SVN_DAV_OPTION_NO_MERGE_RESPONSE "no-merge-response"
#define SVN_DAV_OPTION_LOCK_BREAK "lock-break"
#define SVN_DAV_OPTION_LOCK_STEAL "lock-steal"
#define SVN_DAV_OPTION_RELEASE_LOCKS "release-locks"
#define SVN_DAV_OPTION_KEEP_LOCKS "keep-locks"
/** @} */
/** This header is used when an svn client wants to tell mod_dav_svn
* exactly what revision of a resource it thinks it's operating on.
* (For example, an svn server can use it to validate a DELETE request.)
* Normal WebDAV or DeltaV clients won't use it.
*/
#define SVN_DAV_VERSION_NAME_HEADER "X-SVN-Version-Name"
/** A header generated by mod_dav_svn whenever it responds
successfully to a LOCK request. Only svn clients will notice it,
and use it to fill in svn_lock_t->creation_date. */
#define SVN_DAV_CREATIONDATE_HEADER "X-SVN-Creation-Date"
/** A header generated by mod_dav_svn whenever it responds
successfully to a PROPFIND for the 'DAV:lockdiscovery' property.
Only svn clients will notice it, and use it to fill in
svn_lock_t->owner. (Remember that the DAV:owner field maps to
svn_lock_t->comment, and that there is no analogue in the DAV
universe of svn_lock_t->owner.) */
#define SVN_DAV_LOCK_OWNER_HEADER "X-SVN-Lock-Owner"
/** Assuming the OPTIONS was performed against a resource within a
* Subversion repository, then this header indicates the youngest
* revision in the repository.
* @since New in 1.7. */
#define SVN_DAV_YOUNGEST_REV_HEADER "SVN-Youngest-Rev"
/** Assuming the OPTIONS was performed against a resource within a
* Subversion repository, then this header indicates the UUID of the
* repository.
* @since New in 1.7. */
#define SVN_DAV_REPOS_UUID_HEADER "SVN-Repository-UUID"
/** Presence of this in a DAV header in an OPTIONS response indicates
* that the server speaks HTTP protocol v2. This header provides an
* opaque URI that the client should send all custom REPORT requests
* against.
* @since New in 1.7. */
#define SVN_DAV_ME_RESOURCE_HEADER "SVN-Me-Resource"
/** This header provides the repository root URI, suitable for use in
* calculating the relative paths of other public URIs for this
* repository into . (HTTP protocol v2 only)
* @since New in 1.7. */
#define SVN_DAV_ROOT_URI_HEADER "SVN-Repository-Root"
/** This header provides an opaque URI that the client can append a
* revision to, to construct a 'revision URL'. This allows direct
* read/write access to revprops via PROPFIND or PROPPATCH, and is
* similar to libsvn_fs's revision objects (as distinct from "revision
* roots"). (HTTP protocol v2 only)
* @since New in 1.7. */
#define SVN_DAV_REV_STUB_HEADER "SVN-Rev-Stub"
/** This header provides an opaque URI that the client can append
* PEGREV/PATH to, in order to construct URIs of pegged objects in the
* repository, similar to the use of a "revision root" in the
* libsvn_fs API. (HTTP protocol v2 only)
* @since New in 1.7. */
#define SVN_DAV_REV_ROOT_STUB_HEADER "SVN-Rev-Root-Stub"
/** This header provides an opaque URI which represents a Subversion
* transaction (revision-in-progress) object. It is suitable for use
* in fetching and modifying transaction properties as part of a
* commit process, similar to the svn_fs_txn_t object (as distinct
* from a "txn root"). (HTTP protocol v2 only)
* @since New in 1.7. */
#define SVN_DAV_TXN_STUB_HEADER "SVN-Txn-Stub"
/** Companion to @c SVN_DAV_TXN_STUB_HEADER, used when a POST request
* returns @c SVN_DAV_VTXN_NAME_HEADER in response to a client
* supplied name. (HTTP protocol v2 only)
* @since New in 1.7. */
#define SVN_DAV_VTXN_STUB_HEADER "SVN-VTxn-Stub"
/** This header provides an opaque URI which represents the root
* directory of a Subversion transaction (revision-in-progress),
* similar to the concept of a "txn root" in the libsvn_fs API. The
* client can append additional path segments to it to access items
* deeper in the transaction tree as part of a commit process. (HTTP
* protocol v2 only)
* @since New in 1.7. */
#define SVN_DAV_TXN_ROOT_STUB_HEADER "SVN-Txn-Root-Stub"
/** Companion to @c SVN_DAV_TXN_ROOT_STUB_HEADER, used when a POST
* request returns @c SVN_DAV_VTXN_NAME_HEADER in response to a
* client supplied name. (HTTP protocol v2 only)
* @since New in 1.7. */
#define SVN_DAV_VTXN_ROOT_STUB_HEADER "SVN-VTxn-Root-Stub"
/** This header is used in the POST response to tell the client the
* name of the Subversion transaction created by the request. It can
* then be appended to the transaction stub and transaction root stub
* for access to the properties and paths, respectively, of the named
* transaction. (HTTP protocol v2 only)
* @since New in 1.7. */
#define SVN_DAV_TXN_NAME_HEADER "SVN-Txn-Name"
/** This header is used in the POST request, to pass a client supplied
* alternative transaction name to the server, and in the POST
* response, to tell the client that the alternative transaction
* resource names should be used. (HTTP protocol v2 only)
* @since New in 1.7. */
#define SVN_DAV_VTXN_NAME_HEADER "SVN-VTxn-Name"
/** This header is used in the OPTIONS response to identify named
* skel-based POST request types which the server is prepared to
* handle. (HTTP protocol v2 only)
* @since New in 1.8. */
#define SVN_DAV_SUPPORTED_POSTS_HEADER "SVN-Supported-Posts"
/** This header is used in the OPTIONS response to indicate if the server
* wants bulk update requests (Prefer) or only accepts skelta requests (Off).
* If this value is On both options are allowed.
* @since New in 1.8. */
#define SVN_DAV_ALLOW_BULK_UPDATES "SVN-Allow-Bulk-Updates"
/** Assuming the request target is a Subversion repository resource,
* this header is returned in the OPTIONS response to indicate whether
* the repository supports the merge tracking feature ("yes") or not
* ("no").
* @since New in 1.8. */
#define SVN_DAV_REPOSITORY_MERGEINFO "SVN-Repository-MergeInfo"
/**
* @name Fulltext MD5 headers
*
* These headers are for client and server to verify that the base
* and the result of a change transmission are the same on both
* sides, regardless of what transformations (svndiff deltification,
* gzipping, etc) the data may have gone through in between.
*
* The result md5 is always used whenever file contents are
* transferred, because every transmission has a resulting text.
*
* The base md5 is used to verify the base text against which svndiff
* data is being applied. Note that even for svndiff transmissions,
* base verification is not strictly necessary (and may therefore be
* unimplemented), as any error will be caught by the verification of
* the final result. However, if the problem is that the base text is
* corrupt, the error will be caught earlier if the base md5 is used.
*
* Normal WebDAV or DeltaV clients don't use these.
* @{
*/
#define SVN_DAV_BASE_FULLTEXT_MD5_HEADER "X-SVN-Base-Fulltext-MD5"
#define SVN_DAV_RESULT_FULLTEXT_MD5_HEADER "X-SVN-Result-Fulltext-MD5"
/** @} */
/* ### should add strings for the various XML elements in the reports
### and things. also the custom prop names. etc.
*/
/** The svn-specific object that is placed within a <D:error> response.
*
* @defgroup svn_dav_error Errors in svn_dav
* @{ */
/** The error object's namespace */
#define SVN_DAV_ERROR_NAMESPACE "svn:"
/** The error object's tag */
#define SVN_DAV_ERROR_TAG "error"
/** @} */
/** General property (xml) namespaces that will be used by both ra_dav
* and mod_dav_svn for marshalling properties.
*
* @defgroup svn_dav_property_xml_namespaces DAV property namespaces
* @{
*/
/** A property stored in the fs and wc, begins with 'svn:', and is
* interpreted either by client or server.
*/
#define SVN_DAV_PROP_NS_SVN "http://subversion.tigris.org/xmlns/svn/"
/** A property stored in the fs and wc, but totally ignored by svn
* client and server.
*
* A property simply invented by the users.
*/
#define SVN_DAV_PROP_NS_CUSTOM "http://subversion.tigris.org/xmlns/custom/"
/** A property purely generated and consumed by the network layer, not
* seen by either fs or wc.
*/
#define SVN_DAV_PROP_NS_DAV "http://subversion.tigris.org/xmlns/dav/"
/**
* @name Custom (extension) values for the DAV header.
* Note that although these share the SVN_DAV_PROP_NS_DAV namespace
* prefix, they are not properties; they are header values.
* @{
*/
/* ##################################################################
*
* WARNING: At least some versions of Microsoft's Web Folders
* WebDAV client implementation are unable to handle
* DAV: headers with values longer than 63 characters,
* so please keep these strings within that limit.
*
* ##################################################################
*/
/** Presence of this in a DAV header in an OPTIONS request or response
* indicates that the transmitter supports @c svn_depth_t.
*
* @since New in 1.5.
*/
#define SVN_DAV_NS_DAV_SVN_DEPTH\
SVN_DAV_PROP_NS_DAV "svn/depth"
/** Presence of this in a DAV header in an OPTIONS request or response
* indicates that the server knows how to handle merge-tracking
* information.
*
* Note that this says nothing about whether the repository can handle
* mergeinfo, only whether the server does. For more information, see
* mod_dav_svn/version.c:get_vsn_options().
*
* @since New in 1.5.
*/
#define SVN_DAV_NS_DAV_SVN_MERGEINFO\
SVN_DAV_PROP_NS_DAV "svn/mergeinfo"
/** Presence of this in a DAV header in an OPTIONS response indicates
* that the transmitter (in this case, the server) knows how to send
* custom revprops in log responses.
*
* @since New in 1.5.
*/
#define SVN_DAV_NS_DAV_SVN_LOG_REVPROPS\
SVN_DAV_PROP_NS_DAV "svn/log-revprops"
/** Presence of this in a DAV header in an OPTIONS response indicates
* that the transmitter (in this case, the server) knows how to handle
* a replay of a directory in the repository (not root).
*
* @since New in 1.5.
*/
#define SVN_DAV_NS_DAV_SVN_PARTIAL_REPLAY\
SVN_DAV_PROP_NS_DAV "svn/partial-replay"
/** Presence of this in a DAV header in an OPTIONS response indicates
* that the transmitter (in this case, the server) knows how to enforce
* old-value atomicity in PROPPATCH (for editing revprops).
*
* @since New in 1.7.
*/
#define SVN_DAV_NS_DAV_SVN_ATOMIC_REVPROPS\
SVN_DAV_PROP_NS_DAV "svn/atomic-revprops"
/** Presence of this in a DAV header in an OPTIONS response indicates
* that the transmitter (in this case, the server) knows how to get
* inherited properties.
*
* @since New in 1.8.
*/
#define SVN_DAV_NS_DAV_SVN_INHERITED_PROPS\
SVN_DAV_PROP_NS_DAV "svn/inherited-props"
/** Presence of this in a DAV header in an OPTIONS response indicates
* that the transmitter (in this case, the server) knows how to
* properly handle ephemeral (that is, deleted-just-before-commit) FS
* transaction properties.
*
* @since New in 1.8.
*/
#define SVN_DAV_NS_DAV_SVN_EPHEMERAL_TXNPROPS\
SVN_DAV_PROP_NS_DAV "svn/ephemeral-txnprops"
/** Presence of this in a DAV header in an OPTIONS response indicates
* that the transmitter (in this case, the server) supports serving
* properties inline in update editor when 'send-all' is 'false'.
*
* @since New in 1.8.
*/
#define SVN_DAV_NS_DAV_SVN_INLINE_PROPS\
SVN_DAV_PROP_NS_DAV "svn/inline-props"
/** Presence of this in a DAV header in an OPTIONS response indicates
* that the transmitter (in this case, the server) knows how to handle
* a replay of a revision resource. Transmitters must be
* HTTP-v2-enabled to support this feature.
*
* @since New in 1.8.
*/
#define SVN_DAV_NS_DAV_SVN_REPLAY_REV_RESOURCE\
SVN_DAV_PROP_NS_DAV "svn/replay-rev-resource"
/** Presence of this in a DAV header in an OPTIONS response indicates
* that the transmitter (in this case, the server) knows how to handle
* a reversed fetch of file versions.
*
* @since New in 1.8.
*/
#define SVN_DAV_NS_DAV_SVN_REVERSE_FILE_REVS\
SVN_DAV_PROP_NS_DAV "svn/reverse-file-revs"
/** @} */
/** @} */
#ifdef __cplusplus
}
#endif /* __cplusplus */
#endif /* SVN_DAV_H */

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

View File

@ -0,0 +1,805 @@
/**
* @copyright
* ====================================================================
* Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements. See the NOTICE file
* distributed with this work for additional information
* regarding copyright ownership. The ASF licenses this file
* to you under the Apache License, Version 2.0 (the
* "License"); you may not use this file except in compliance
* with the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing,
* software distributed under the License is distributed on an
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
* KIND, either express or implied. See the License for the
* specific language governing permissions and limitations
* under the License.
* ====================================================================
* @endcopyright
*
* @file svn_dirent_uri.h
* @brief A library to manipulate URIs, relative paths and directory entries.
*
* This library makes a clear distinction between several path formats:
*
* - a dirent is a path on (local) disc or a UNC path (Windows) in
* either relative or absolute format.
* Examples:
* "/foo/bar", "X:/temp", "//server/share", "A:/" (Windows only), ""
* But not:
* "http://server"
*
* - a uri, for our purposes, is a percent-encoded, absolute path
* (URI) that starts with a schema definition. In practice, these
* tend to look like URLs, but never carry query strings.
* Examples:
* "http://server", "file:///path/to/repos",
* "svn+ssh://user@host:123/My%20Stuff/file.doc"
* But not:
* "file", "dir/file", "A:/dir", "/My%20Stuff/file.doc", ""
*
* - a relative path (relpath) is an unrooted path that can be joined
* to any other relative path, uri or dirent. A relative path is
* never rooted/prefixed by a '/'.
* Examples:
* "file", "dir/file", "dir/subdir/../file", ""
* But not:
* "/file", "http://server/file"
*
* This distinction is needed because on Windows we have to handle some
* dirents and URIs differently. Since it's not possible to determine from
* the path string if it's a dirent or a URI, it's up to the API user to
* make this choice. See also issue #2028.
*
* All incoming and outgoing paths are non-NULL unless otherwise documented.
*
* All of these functions expect paths passed into them to be in canonical
* form, except:
*
* - @c svn_dirent_canonicalize()
* - @c svn_dirent_is_canonical()
* - @c svn_dirent_internal_style()
* - @c svn_relpath_canonicalize()
* - @c svn_relpath_is_canonical()
* - @c svn_relpath__internal_style()
* - @c svn_uri_canonicalize()
* - @c svn_uri_is_canonical()
*
* The Subversion codebase also recognizes some other classes of path:
*
* - A Subversion filesystem path (fspath) -- otherwise known as a
* path within a repository -- is a path relative to the root of
* the repository filesystem, that starts with a slash ("/"). The
* rules for a fspath are the same as for a relpath except for the
* leading '/'. A fspath never ends with '/' except when the whole
* path is just '/'. The fspath API is private (see
* private/svn_fspath.h).
*
* - A URL path (urlpath) is just the path part of a URL (the part
* that follows the schema, username, hostname, and port). These
* are also like relpaths, except that they have a leading slash
* (like fspaths) and are URI-encoded. The urlpath API is also
* private (see private/svn_fspath.h)
* Example:
* "/svn/repos/trunk/README",
* "/svn/repos/!svn/bc/45/file%20with%20spaces.txt"
*
* So, which path API is appropriate for your use-case?
*
* - If your path refers to a local file, directory, symlink, etc. of
* the sort that you can examine and operate on with other software
* on your computer, it's a dirent.
*
* - If your path is a full URL -- with a schema, hostname (maybe),
* and path portion -- it's a uri.
*
* - If your path is relative, and is somewhat ambiguous unless it's
* joined to some other more explicit (possible absolute) base
* (such as a dirent or URL), it's a relpath.
*
* - If your path is the virtual path of a versioned object inside a
* Subversion repository, it could be one of two different types of
* paths. We'd prefer to use relpaths (relative to the root
* directory of the virtual repository filesystem) for that stuff,
* but some legacy code uses fspaths. You'll need to figure out if
* your code expects repository paths to have a leading '/' or not.
* If so, they are fspaths; otherwise they are relpaths.
*
* - If your path refers only to the path part of URL -- as if
* someone hacked off the initial schema and hostname portion --
* it's a urlpath. To date, the ra_dav modules are the only ones
* within Subversion that make use of urlpaths, and this is because
* WebDAV makes heavy use of that form of path specification.
*
* When translating between local paths (dirents) and uris code should
* always go via the relative path format, perhaps by truncating a
* parent portion from a path with svn_*_skip_ancestor(), or by
* converting portions to basenames and then joining to existing
* paths.
*
* SECURITY WARNING: If a path that is received from an untrusted
* source -- such as from the network -- is converted to a dirent it
* should be tested with svn_dirent_is_under_root() before you can
* assume the path to be a safe local path.
*
* MEMORY ALLOCATION: A function documented as allocating the result
* in a pool may instead return a static string such as "." or "". If
* the result is equal to an input, it will duplicate the input.
*/
#ifndef SVN_DIRENT_URI_H
#define SVN_DIRENT_URI_H
#include <apr.h>
#include <apr_pools.h>
#include <apr_tables.h>
#include "svn_types.h"
#ifdef __cplusplus
extern "C" {
#endif /* __cplusplus */
/** Convert @a dirent from the local style to the canonical internal style.
* "Local style" means native path separators and "." for the empty path.
*
* Allocate the result in @a result_pool.
*
* @since New in 1.6.
*/
const char *
svn_dirent_internal_style(const char *dirent,
apr_pool_t *result_pool);
/** Convert @a dirent from the internal style to the local style.
* "Local style" means native path separators and "." for the empty path.
* If the input is not canonical, the output may not be canonical.
*
* Allocate the result in @a result_pool.
*
* @since New in 1.6.
*/
const char *
svn_dirent_local_style(const char *dirent,
apr_pool_t *result_pool);
/** Convert @a relpath from the local style to the canonical internal style.
* "Local style" means native path separators and "." for the empty path.
*
* Allocate the result in @a result_pool.
*
* @since New in 1.7.
*/
const char *
svn_relpath__internal_style(const char *relpath,
apr_pool_t *result_pool);
/** Join a base dirent (@a base) with a component (@a component).
*
* If either @a base or @a component is the empty string, then the other
* argument will be copied and returned. If both are the empty string then
* empty string is returned.
*
* If the @a component is an absolute dirent, then it is copied and returned.
* The platform specific rules for joining paths are used to join the components.
*
* This function is NOT appropriate for native (local) file
* dirents. Only for "internal" canonicalized dirents, since it uses '/'
* for the separator.
*
* Allocate the result in @a result_pool.
*
* @since New in 1.6.
*/
char *
svn_dirent_join(const char *base,
const char *component,
apr_pool_t *result_pool);
/** Join multiple components onto a @a base dirent. The components are
* terminated by a @c NULL.
*
* If any component is the empty string, it will be ignored.
*
* If any component is an absolute dirent, then it resets the base and
* further components will be appended to it.
*
* See svn_dirent_join() for further notes about joining dirents.
*
* Allocate the result in @a result_pool.
*
* @since New in 1.6.
*/
char *
svn_dirent_join_many(apr_pool_t *result_pool,
const char *base,
...);
/** Join a base relpath (@a base) with a component (@a component).
* @a component need not be a single component.
*
* If either @a base or @a component is the empty path, then the other
* argument will be copied and returned. If both are the empty path the
* empty path is returned.
*
* Allocate the result in @a result_pool.
*
* @since New in 1.7.
*/
char *
svn_relpath_join(const char *base,
const char *component,
apr_pool_t *result_pool);
/** Gets the name of the specified canonicalized @a dirent as it is known
* within its parent directory. If the @a dirent is root, return "". The
* returned value will not have slashes in it.
*
* Example: svn_dirent_basename("/foo/bar") -> "bar"
*
* If @a result_pool is NULL, return a pointer to the basename in @a dirent,
* otherwise allocate the result in @a result_pool.
*
* @note If an empty string is passed, then an empty string will be returned.
*
* @since New in 1.7.
*/
const char *
svn_dirent_basename(const char *dirent,
apr_pool_t *result_pool);
/** Get the dirname of the specified canonicalized @a dirent, defined as
* the dirent with its basename removed.
*
* If @a dirent is root ("/", "X:/", "//server/share/") or "", it is returned
* unchanged.
*
* Allocate the result in @a result_pool.
*
* @since New in 1.6.
*/
char *
svn_dirent_dirname(const char *dirent,
apr_pool_t *result_pool);
/** Divide the canonicalized @a dirent into @a *dirpath and @a *base_name.
*
* If @a dirpath or @a base_name is NULL, then don't set that one.
*
* Either @a dirpath or @a base_name may be @a dirent's own address, but they
* may not both be the same address, or the results are undefined.
*
* If @a dirent has two or more components, the separator between @a dirpath
* and @a base_name is not included in either of the new names.
*
* Examples:
* - <pre>"/foo/bar/baz" ==> "/foo/bar" and "baz"</pre>
* - <pre>"/bar" ==> "/" and "bar"</pre>
* - <pre>"/" ==> "/" and ""</pre>
* - <pre>"bar" ==> "" and "bar"</pre>
* - <pre>"" ==> "" and ""</pre>
* Windows: - <pre>"X:/" ==> "X:/" and ""</pre>
* - <pre>"X:/foo" ==> "X:/" and "foo"</pre>
* - <pre>"X:foo" ==> "X:" and "foo"</pre>
* Posix: - <pre>"X:foo" ==> "" and "X:foo"</pre>
*
* Allocate the results in @a result_pool.
*
* @since New in 1.7.
*/
void
svn_dirent_split(const char **dirpath,
const char **base_name,
const char *dirent,
apr_pool_t *result_pool);
/** Divide the canonicalized @a relpath into @a *dirpath and @a *base_name.
*
* If @a dirpath or @a base_name is NULL, then don't set that one.
*
* Either @a dirpath or @a base_name may be @a relpaths's own address, but
* they may not both be the same address, or the results are undefined.
*
* If @a relpath has two or more components, the separator between @a dirpath
* and @a base_name is not included in either of the new names.
*
* examples:
* - <pre>"foo/bar/baz" ==> "foo/bar" and "baz"</pre>
* - <pre>"bar" ==> "" and "bar"</pre>
* - <pre>"" ==> "" and ""</pre>
*
* Allocate the results in @a result_pool.
*
* @since New in 1.7.
*/
void
svn_relpath_split(const char **dirpath,
const char **base_name,
const char *relpath,
apr_pool_t *result_pool);
/** Get the basename of the specified canonicalized @a relpath. The
* basename is defined as the last component of the relpath. If the @a
* relpath has only one component then that is returned. The returned
* value will have no slashes in it.
*
* Example: svn_relpath_basename("/trunk/foo/bar") -> "bar"
*
* If @a result_pool is NULL, return a pointer to the basename in @a relpath,
* otherwise allocate the result in @a result_pool.
*
* @note If an empty string is passed, then an empty string will be returned.
*
* @since New in 1.7.
*/
const char *
svn_relpath_basename(const char *relpath,
apr_pool_t *result_pool);
/** Get the dirname of the specified canonicalized @a relpath, defined as
* the relpath with its basename removed.
*
* If @a relpath is empty, "" is returned.
*
* Allocate the result in @a result_pool.
*
* @since New in 1.7.
*/
char *
svn_relpath_dirname(const char *relpath,
apr_pool_t *result_pool);
/** Divide the canonicalized @a uri into a uri @a *dirpath and a
* (URI-decoded) relpath @a *base_name.
*
* If @a dirpath or @a base_name is NULL, then don't set that one.
*
* Either @a dirpath or @a base_name may be @a uri's own address, but they
* may not both be the same address, or the results are undefined.
*
* If @a uri has two or more components, the separator between @a dirpath
* and @a base_name is not included in either of the new names.
*
* Examples:
* - <pre>"http://server/foo/bar" ==> "http://server/foo" and "bar"</pre>
*
* Allocate the result in @a result_pool.
*
* @since New in 1.7.
*/
void
svn_uri_split(const char **dirpath,
const char **base_name,
const char *uri,
apr_pool_t *result_pool);
/** Get the (URI-decoded) basename of the specified canonicalized @a
* uri. The basename is defined as the last component of the uri. If
* the @a uri is root, return "". The returned value will have no
* slashes in it.
*
* Example: svn_uri_basename("http://server/foo/bar") -> "bar"
*
* Allocate the result in @a result_pool.
*
* @since New in 1.7.
*/
const char *
svn_uri_basename(const char *uri,
apr_pool_t *result_pool);
/** Get the dirname of the specified canonicalized @a uri, defined as
* the uri with its basename removed.
*
* If @a uri is root (e.g. "http://server"), it is returned
* unchanged.
*
* Allocate the result in @a result_pool.
*
* @since New in 1.7.
*/
char *
svn_uri_dirname(const char *uri,
apr_pool_t *result_pool);
/** Return TRUE if @a dirent is considered absolute on the platform at
* hand. E.g. '/foo' on Posix platforms or 'X:/foo', '//server/share/foo'
* on Windows.
*
* @since New in 1.6.
*/
svn_boolean_t
svn_dirent_is_absolute(const char *dirent);
/** Return TRUE if @a dirent is considered a root directory on the platform
* at hand.
* E.g.:
* On Posix: '/'
* On Windows: '/', 'X:/', '//server/share', 'X:'
*
* Note that on Windows '/' and 'X:' are roots, but paths starting with this
* root are not absolute.
*
* @since New in 1.5.
*/
svn_boolean_t
svn_dirent_is_root(const char *dirent,
apr_size_t len);
/** Return TRUE if @a uri is a root URL (e.g., "http://server").
*
* @since New in 1.7
*/
svn_boolean_t
svn_uri_is_root(const char *uri,
apr_size_t len);
/** Return a new dirent like @a dirent, but transformed such that some types
* of dirent specification redundancies are removed.
*
* This involves:
* - collapsing redundant "/./" elements
* - removing multiple adjacent separator characters
* - removing trailing separator characters
* - converting the server name of a UNC path to lower case (on Windows)
* - converting a drive letter to upper case (on Windows)
*
* and possibly other semantically inoperative transformations.
*
* Allocate the result in @a result_pool.
*
* @since New in 1.6.
*/
const char *
svn_dirent_canonicalize(const char *dirent,
apr_pool_t *result_pool);
/** Return a new relpath like @a relpath, but transformed such that some types
* of relpath specification redundancies are removed.
*
* This involves:
* - collapsing redundant "/./" elements
* - removing multiple adjacent separator characters
* - removing trailing separator characters
*
* and possibly other semantically inoperative transformations.
*
* Allocate the result in @a result_pool.
*
* @since New in 1.7.
*/
const char *
svn_relpath_canonicalize(const char *relpath,
apr_pool_t *result_pool);
/** Return a new uri like @a uri, but transformed such that some types
* of uri specification redundancies are removed.
*
* This involves:
* - collapsing redundant "/./" elements
* - removing multiple adjacent separator characters
* - removing trailing separator characters
* - normalizing the escaping of the path component by unescaping
* characters that don't need escaping and escaping characters that do
* need escaping but weren't
* - removing the port number if it is the default port number (80 for
* http, 443 for https, 3690 for svn)
*
* and possibly other semantically inoperative transformations.
*
* Allocate the result in @a result_pool.
*
* @since New in 1.7.
*/
const char *
svn_uri_canonicalize(const char *uri,
apr_pool_t *result_pool);
/** Return @c TRUE iff @a dirent is canonical.
*
* Use @a scratch_pool for temporary allocations.
*
* @note The test for canonicalization is currently defined as
* "looks exactly the same as @c svn_dirent_canonicalize() would make
* it look".
*
* @see svn_dirent_canonicalize()
* @since New in 1.6.
*/
svn_boolean_t
svn_dirent_is_canonical(const char *dirent,
apr_pool_t *scratch_pool);
/** Return @c TRUE iff @a relpath is canonical.
*
* @see svn_relpath_canonicalize()
* @since New in 1.7.
*/
svn_boolean_t
svn_relpath_is_canonical(const char *relpath);
/** Return @c TRUE iff @a uri is canonical.
*
* Use @a scratch_pool for temporary allocations.
*
* @see svn_uri_canonicalize()
* @since New in 1.7.
*/
svn_boolean_t
svn_uri_is_canonical(const char *uri,
apr_pool_t *scratch_pool);
/** Return the longest common dirent shared by two canonicalized dirents,
* @a dirent1 and @a dirent2. If there's no common ancestor, return the
* empty path.
*
* Allocate the result in @a result_pool.
*
* @since New in 1.6.
*/
char *
svn_dirent_get_longest_ancestor(const char *dirent1,
const char *dirent2,
apr_pool_t *result_pool);
/** Return the longest common path shared by two relative paths,
* @a relpath1 and @a relpath2. If there's no common ancestor, return the
* empty path.
*
* Allocate the result in @a result_pool.
*
* @since New in 1.7.
*/
char *
svn_relpath_get_longest_ancestor(const char *relpath1,
const char *relpath2,
apr_pool_t *result_pool);
/** Return the longest common path shared by two canonicalized uris,
* @a uri1 and @a uri2. If there's no common ancestor, return the
* empty path. In order for two URLs to have a common ancestor, they
* must (a) have the same protocol (since two URLs with the same path
* but different protocols may point at completely different
* resources), and (b) share a common ancestor in their path
* component, i.e. 'protocol://' is not a sufficient ancestor.
*
* Allocate the result in @a result_pool.
*
* @since New in 1.7.
*/
char *
svn_uri_get_longest_ancestor(const char *uri1,
const char *uri2,
apr_pool_t *result_pool);
/** Convert @a relative canonicalized dirent to an absolute dirent and
* return the results in @a *pabsolute.
* Raise SVN_ERR_BAD_FILENAME if the absolute dirent cannot be determined.
*
* Allocate the result in @a result_pool.
*
* @since New in 1.6.
*/
svn_error_t *
svn_dirent_get_absolute(const char **pabsolute,
const char *relative,
apr_pool_t *result_pool);
/** Similar to svn_dirent_skip_ancestor(), except that if @a child_dirent is
* the same as @a parent_dirent, it is not considered a child, so the result
* is @c NULL; an empty string is never returned.
*
* If @a result_pool is NULL, return a pointer into @a child_dirent, otherwise
* allocate the result in @a result_pool.
*
* ### TODO: Deprecate, as the semantics are trivially
* obtainable from *_skip_ancestor().
*
* @since New in 1.6.
*/
const char *
svn_dirent_is_child(const char *parent_dirent,
const char *child_dirent,
apr_pool_t *result_pool);
/** Return TRUE if @a parent_dirent is an ancestor of @a child_dirent or
* the dirents are equal, and FALSE otherwise.
*
* ### TODO: Deprecate, as the semantics are trivially
* obtainable from *_skip_ancestor().
*
* @since New in 1.6.
*/
svn_boolean_t
svn_dirent_is_ancestor(const char *parent_dirent,
const char *child_dirent);
/** Return TRUE if @a parent_uri is an ancestor of @a child_uri or
* the uris are equal, and FALSE otherwise.
*/
svn_boolean_t
svn_uri__is_ancestor(const char *parent_uri,
const char *child_uri);
/** Return the relative path part of @a child_dirent that is below
* @a parent_dirent, or just "" if @a parent_dirent is equal to
* @a child_dirent. If @a child_dirent is not below or equal to
* @a parent_dirent, return NULL.
*
* If one of @a parent_dirent and @a child_dirent is absolute and
* the other relative, return NULL.
*
* @since New in 1.7.
*/
const char *
svn_dirent_skip_ancestor(const char *parent_dirent,
const char *child_dirent);
/** Return the relative path part of @a child_relpath that is below
* @a parent_relpath, or just "" if @a parent_relpath is equal to
* @a child_relpath. If @a child_relpath is not below or equal to
* @a parent_relpath, return NULL.
*
* @since New in 1.7.
*/
const char *
svn_relpath_skip_ancestor(const char *parent_relpath,
const char *child_relpath);
/** Return the URI-decoded relative path of @a child_uri that is below
* @a parent_uri, or just "" if @a parent_uri is equal to @a child_uri. If
* @a child_uri is not below or equal to @a parent_uri, return NULL.
*
* Allocate the result in @a result_pool.
*
* @since New in 1.7.
*/
const char *
svn_uri_skip_ancestor(const char *parent_uri,
const char *child_uri,
apr_pool_t *result_pool);
/** Find the common prefix of the canonicalized dirents in @a targets
* (an array of <tt>const char *</tt>'s), and remove redundant dirents if @a
* remove_redundancies is TRUE.
*
* - Set @a *pcommon to the absolute dirent of the dirent common to
* all of the targets. If the targets have no common prefix (e.g.
* "C:/file" and "D:/file" on Windows), set @a *pcommon to the empty
* string.
*
* - If @a pcondensed_targets is non-NULL, set @a *pcondensed_targets
* to an array of targets relative to @a *pcommon, and if
* @a remove_redundancies is TRUE, omit any dirents that are
* descendants of another dirent in @a targets. If *pcommon
* is empty, @a *pcondensed_targets will contain absolute dirents;
* redundancies can still be removed. If @a pcondensed_targets is NULL,
* leave it alone.
*
* Else if there is exactly one target, then
*
* - Set @a *pcommon to that target, and
*
* - If @a pcondensed_targets is non-NULL, set @a *pcondensed_targets
* to an array containing zero elements. Else if
* @a pcondensed_targets is NULL, leave it alone.
*
* If there are no items in @a targets, set @a *pcommon and (if
* applicable) @a *pcondensed_targets to @c NULL.
*
* Allocate the results in @a result_pool. Use @a scratch_pool for
* temporary allocations.
*
* @since New in 1.7.
*/
svn_error_t *
svn_dirent_condense_targets(const char **pcommon,
apr_array_header_t **pcondensed_targets,
const apr_array_header_t *targets,
svn_boolean_t remove_redundancies,
apr_pool_t *result_pool,
apr_pool_t *scratch_pool);
/** Find the common prefix of the canonicalized uris in @a targets
* (an array of <tt>const char *</tt>'s), and remove redundant uris if @a
* remove_redundancies is TRUE.
*
* - Set @a *pcommon to the common base uri of all of the targets.
* If the targets have no common prefix (e.g. "http://srv1/file"
* and "http://srv2/file"), set @a *pcommon to the empty
* string.
*
* - If @a pcondensed_targets is non-NULL, set @a *pcondensed_targets
* to an array of URI-decoded targets relative to @a *pcommon, and
* if @a remove_redundancies is TRUE, omit any uris that are
* descendants of another uri in @a targets. If *pcommon is
* empty, @a *pcondensed_targets will contain absolute uris;
* redundancies can still be removed. If @a pcondensed_targets is
* NULL, leave it alone.
*
* Else if there is exactly one target, then
*
* - Set @a *pcommon to that target, and
*
* - If @a pcondensed_targets is non-NULL, set @a *pcondensed_targets
* to an array containing zero elements. Else if
* @a pcondensed_targets is NULL, leave it alone.
*
* If there are no items in @a targets, set @a *pcommon and (if
* applicable) @a *pcondensed_targets to @c NULL.
*
* Allocate the results in @a result_pool. Use @a scratch_pool for
* temporary allocations.
*
* @since New in 1.7.
*/
svn_error_t *
svn_uri_condense_targets(const char **pcommon,
apr_array_header_t **pcondensed_targets,
const apr_array_header_t *targets,
svn_boolean_t remove_redundancies,
apr_pool_t *result_pool,
apr_pool_t *scratch_pool);
/** Join @a path onto @a base_path, checking that @a path does not attempt
* to traverse above @a base_path. If @a path or any ".." component within
* it resolves to a path above @a base_path, or if @a path is an absolute
* path, then set @a *under_root to @c FALSE. Otherwise, set @a *under_root
* to @c TRUE and, if @a result_path is not @c NULL, set @a *result_path to
* the resulting path.
*
* @a path need not be canonical. @a base_path must be canonical and
* @a *result_path will be canonical.
*
* Allocate the result in @a result_pool.
*
* @note Use of this function is strongly encouraged. Do not roll your own.
* (http://cve.mitre.org/cgi-bin/cvename.cgi?name=2007-3846)
*
* @since New in 1.7.
*/
svn_error_t *
svn_dirent_is_under_root(svn_boolean_t *under_root,
const char **result_path,
const char *base_path,
const char *path,
apr_pool_t *result_pool);
/** Set @a *dirent to the path corresponding to the file:// URL @a url, using
* the platform-specific file:// rules.
*
* Allocate the result in @a result_pool.
*
* @since New in 1.7.
*/
svn_error_t *
svn_uri_get_dirent_from_file_url(const char **dirent,
const char *url,
apr_pool_t *result_pool);
/** Set @a *url to a file:// URL, corresponding to @a dirent using the
* platform specific dirent and file:// rules.
*
* Allocate the result in @a result_pool.
*
* @since New in 1.7.
*/
svn_error_t *
svn_uri_get_file_url_from_dirent(const char **url,
const char *dirent,
apr_pool_t *result_pool);
#ifdef __cplusplus
}
#endif /* __cplusplus */
#endif /* SVN_DIRENT_URI_H */

View File

@ -0,0 +1,99 @@
/**
* @copyright
* ====================================================================
* Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements. See the NOTICE file
* distributed with this work for additional information
* regarding copyright ownership. The ASF licenses this file
* to you under the Apache License, Version 2.0 (the
* "License"); you may not use this file except in compliance
* with the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing,
* software distributed under the License is distributed on an
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
* KIND, either express or implied. See the License for the
* specific language governing permissions and limitations
* under the License.
* ====================================================================
* @endcopyright
*
* @file svn_dso.h
* @brief DSO loading routines
*/
#ifndef SVN_DSO_H
#define SVN_DSO_H
#include <apr_dso.h>
#include "svn_types.h"
#ifdef __cplusplus
extern "C" {
#endif /* __cplusplus */
/**
* Initialize the DSO loading routines.
*
* @note This should be called prior to the creation of any pool that
* is passed to a function that comes from a DSO, otherwise you
* risk having the DSO unloaded before all pool cleanup callbacks
* that live in the DSO have been executed. If it is not called
* prior to @c svn_dso_load being used for the first time there
* will be a best effort attempt made to initialize the subsystem,
* but it will not be entirely thread safe and it risks running
* into the previously mentioned problems with DSO unloading and
* pool cleanup callbacks.
*
* Returns svn_error_t object with corresponding apr_err returned by
* underlying calls. In case of no error returns @c SVN_NO_ERROR.
*
* @since New in 1.6.
*/
svn_error_t *
svn_dso_initialize2(void);
/** The same as svn_dso_initialize2(), except that if there is an error this
* calls abort() instead of returning the error.
*
* @deprecated Provided for backwards compatibility with the 1.5 API.
*
* @since New in 1.4.
*/
SVN_DEPRECATED
void
svn_dso_initialize(void);
#if APR_HAS_DSO
/**
* Attempt to load @a libname, returning it in @a *dso.
*
* If @a libname cannot be loaded set @a *dso to NULL and return
* @c SVN_NO_ERROR.
*
* @note Due to pool lifetime issues DSOs are all loaded into a global
* pool, so you must be certain that there is a bounded number of
* them that will ever be loaded by the system, otherwise you will
* leak memory.
*
* @since New in 1.4.
*/
svn_error_t *
svn_dso_load(apr_dso_handle_t **dso,
const char *libname);
#endif /* APR_HAS_DSO */
#ifdef __cplusplus
}
#endif /* __cplusplus */
#endif /* SVN_DSO_H */

View File

@ -0,0 +1,662 @@
/**
* @copyright
* ====================================================================
* Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements. See the NOTICE file
* distributed with this work for additional information
* regarding copyright ownership. The ASF licenses this file
* to you under the Apache License, Version 2.0 (the
* "License"); you may not use this file except in compliance
* with the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing,
* software distributed under the License is distributed on an
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
* KIND, either express or implied. See the License for the
* specific language governing permissions and limitations
* under the License.
* ====================================================================
* @endcopyright
*
* @file svn_error.h
* @brief Common exception handling for Subversion.
*/
#ifndef SVN_ERROR_H
#define SVN_ERROR_H
#include <apr.h> /* for apr_size_t */
#include <apr_errno.h> /* APR's error system */
#include <apr_pools.h> /* for apr_pool_t */
#ifndef DOXYGEN_SHOULD_SKIP_THIS
#define APR_WANT_STDIO
#endif
#include <apr_want.h> /* for FILE* */
#include "svn_types.h"
#ifdef __cplusplus
extern "C" {
#endif /* __cplusplus */
/* For the Subversion developers, this #define turns on extended "stack
traces" of any errors that get thrown. See the SVN_ERR() macro. */
#ifdef SVN_DEBUG
#define SVN_ERR__TRACING
#endif
/** the best kind of (@c svn_error_t *) ! */
#define SVN_NO_ERROR 0
/* The actual error codes are kept in a separate file; see comments
there for the reasons why. */
#include "svn_error_codes.h"
/** Put an English description of @a statcode into @a buf and return @a buf,
* NULL-terminated. @a statcode is either an svn error or apr error.
*/
char *
svn_strerror(apr_status_t statcode,
char *buf,
apr_size_t bufsize);
/**
* Return the symbolic name of an error code. If the error code
* is in svn_error_codes.h, return the name of the macro as a string.
* If the error number is not recognised, return @c NULL.
*
* An error number may not be recognised because it was defined in a future
* version of Subversion (e.g., a 1.9.x server may transmit a defined-in-1.9.0
* error number to a 1.8.x client).
*
* An error number may be recognised @em incorrectly if the @c apr_status_t
* value originates in another library (such as libserf) which also uses APR.
* (This is a theoretical concern only: the @c apr_err member of #svn_error_t
* should never contain a "foreign" @c apr_status_t value, and
* in any case Subversion and Serf use non-overlapping subsets of the
* @c APR_OS_START_USERERR range.)
*
* Support for error codes returned by APR itself (i.e., not in the
* @c APR_OS_START_USERERR range, as defined in apr_errno.h) may be implemented
* in the future.
*
* @note In rare cases, a single numeric code has more than one symbolic name.
* (For example, #SVN_ERR_WC_NOT_DIRECTORY and #SVN_ERR_WC_NOT_WORKING_COPY).
* In those cases, it is not guaranteed which symbolic name is returned.
*
* @since New in 1.8.
*/
const char *
svn_error_symbolic_name(apr_status_t statcode);
/** If @a err has a custom error message, return that, otherwise
* store the generic error string associated with @a err->apr_err into
* @a buf (terminating with NULL) and return @a buf.
*
* @since New in 1.4.
*
* @note @a buf and @a bufsize are provided in the interface so that
* this function is thread-safe and yet does no allocation.
*/
const char *svn_err_best_message(svn_error_t *err,
char *buf,
apr_size_t bufsize);
/** SVN error creation and destruction.
*
* @defgroup svn_error_error_creation_destroy Error creation and destruction
* @{
*/
/** Create a nested exception structure.
*
* Input: an APR or SVN custom error code,
* a "child" error to wrap,
* a specific message
*
* Returns: a new error structure (containing the old one).
*
* @note Errors are always allocated in a subpool of the global pool,
* since an error's lifetime is generally not related to the
* lifetime of any convenient pool. Errors must be freed
* with svn_error_clear(). The specific message should be @c NULL
* if there is nothing to add to the general message associated
* with the error code.
*
* If creating the "bottommost" error in a chain, pass @c NULL for
* the child argument.
*/
svn_error_t *
svn_error_create(apr_status_t apr_err,
svn_error_t *child,
const char *message);
/** Create an error structure with the given @a apr_err and @a child,
* with a printf-style error message produced by passing @a fmt, using
* apr_psprintf().
*/
svn_error_t *
svn_error_createf(apr_status_t apr_err,
svn_error_t *child,
const char *fmt,
...)
__attribute__ ((format(printf, 3, 4)));
/** Wrap a @a status from an APR function. If @a fmt is NULL, this is
* equivalent to svn_error_create(status,NULL,NULL). Otherwise,
* the error message is constructed by formatting @a fmt and the
* following arguments according to apr_psprintf(), and then
* appending ": " and the error message corresponding to @a status.
* (If UTF-8 translation of the APR error message fails, the ": " and
* APR error are not appended to the error message.)
*/
svn_error_t *
svn_error_wrap_apr(apr_status_t status,
const char *fmt,
...)
__attribute__((format(printf, 2, 3)));
/** A quick n' easy way to create a wrapped exception with your own
* message, before throwing it up the stack. (It uses all of the
* @a child's fields.)
*/
svn_error_t *
svn_error_quick_wrap(svn_error_t *child,
const char *new_msg);
/** Compose two errors, returning the composition as a brand new error
* and consuming the original errors. Either or both of @a err1 and
* @a err2 may be @c SVN_NO_ERROR. If both are not @c SVN_NO_ERROR,
* @a err2 will follow @a err1 in the chain of the returned error.
*
* Either @a err1 or @a err2 can be functions that return svn_error_t*
* but if both are functions they can be evaluated in either order as
* per the C language rules.
*
* @since New in 1.6.
*/
svn_error_t *
svn_error_compose_create(svn_error_t *err1,
svn_error_t *err2);
/** Add @a new_err to the end of @a chain's chain of errors. The @a new_err
* chain will be copied into @a chain's pool and destroyed, so @a new_err
* itself becomes invalid after this function.
*
* Either @a chain or @a new_err can be functions that return svn_error_t*
* but if both are functions they can be evaluated in either order as
* per the C language rules.
*/
void
svn_error_compose(svn_error_t *chain,
svn_error_t *new_err);
/** Return the root cause of @a err by finding the last error in its
* chain (e.g. it or its children). @a err may be @c SVN_NO_ERROR, in
* which case @c SVN_NO_ERROR is returned.
*
* @since New in 1.5.
*/
svn_error_t *
svn_error_root_cause(svn_error_t *err);
/** Return the first error in @a err's chain that has an error code @a
* apr_err or #SVN_NO_ERROR if there is no error with that code. The
* returned error should @em not be cleared as it shares memory with @a err.
*
* If @a err is #SVN_NO_ERROR, return #SVN_NO_ERROR.
*
* @since New in 1.7.
*/
svn_error_t *
svn_error_find_cause(svn_error_t *err, apr_status_t apr_err);
/** Create a new error that is a deep copy of @a err and return it.
*
* @since New in 1.2.
*/
svn_error_t *
svn_error_dup(svn_error_t *err);
/** Free the memory used by @a error, as well as all ancestors and
* descendants of @a error.
*
* Unlike other Subversion objects, errors are managed explicitly; you
* MUST clear an error if you are ignoring it, or you are leaking memory.
* For convenience, @a error may be @c NULL, in which case this function does
* nothing; thus, svn_error_clear(svn_foo(...)) works as an idiom to
* ignore errors.
*/
void
svn_error_clear(svn_error_t *error);
#if defined(SVN_ERR__TRACING)
/** Set the error location for debug mode. */
void
svn_error__locate(const char *file,
long line);
/* Wrapper macros to collect file and line information */
#define svn_error_create \
(svn_error__locate(__FILE__,__LINE__), (svn_error_create))
#define svn_error_createf \
(svn_error__locate(__FILE__,__LINE__), (svn_error_createf))
#define svn_error_wrap_apr \
(svn_error__locate(__FILE__,__LINE__), (svn_error_wrap_apr))
#define svn_error_quick_wrap \
(svn_error__locate(__FILE__,__LINE__), (svn_error_quick_wrap))
#endif
/**
* Very basic default error handler: print out error stack @a error to the
* stdio stream @a stream, with each error prefixed by @a prefix; quit and
* clear @a error iff the @a fatal flag is set. Allocations are performed
* in the @a error's pool.
*
* If you're not sure what prefix to pass, just pass "svn: ". That's
* what code that used to call svn_handle_error() and now calls
* svn_handle_error2() does.
*
* @since New in 1.2.
*/
void
svn_handle_error2(svn_error_t *error,
FILE *stream,
svn_boolean_t fatal,
const char *prefix);
/** Like svn_handle_error2() but with @c prefix set to "svn: "
*
* @deprecated Provided for backward compatibility with the 1.1 API.
*/
SVN_DEPRECATED
void
svn_handle_error(svn_error_t *error,
FILE *stream,
svn_boolean_t fatal);
/**
* Very basic default warning handler: print out the error @a error to the
* stdio stream @a stream, prefixed by @a prefix. Allocations are
* performed in the error's pool.
*
* @a error may not be @c NULL.
*
* @since New in 1.2.
*/
void
svn_handle_warning2(FILE *stream,
svn_error_t *error,
const char *prefix);
/** Like svn_handle_warning2() but with @c prefix set to "svn: "
*
* @deprecated Provided for backward compatibility with the 1.1 API.
*/
SVN_DEPRECATED
void
svn_handle_warning(FILE *stream,
svn_error_t *error);
/** A statement macro for checking error values.
*
* Evaluate @a expr. If it yields an error, return that error from the
* current function. Otherwise, continue.
*
* The <tt>do { ... } while (0)</tt> wrapper has no semantic effect,
* but it makes this macro syntactically equivalent to the expression
* statement it resembles. Without it, statements like
*
* @code
* if (a)
* SVN_ERR(some operation);
* else
* foo;
* @endcode
*
* would not mean what they appear to.
*/
#define SVN_ERR(expr) \
do { \
svn_error_t *svn_err__temp = (expr); \
if (svn_err__temp) \
return svn_error_trace(svn_err__temp); \
} while (0)
/**
* A macro for wrapping an error in a source-location trace message.
*
* This macro can be used when directly returning an already created
* error (when not using SVN_ERR, svn_error_create(), etc.) to ensure
* that the call stack is recorded correctly.
*
* @since New in 1.7.
*/
#ifdef SVN_ERR__TRACING
svn_error_t *
svn_error__trace(const char *file, long line, svn_error_t *err);
#define svn_error_trace(expr) svn_error__trace(__FILE__, __LINE__, (expr))
#else
#define svn_error_trace(expr) (expr)
#endif
/**
* Returns an error chain that is based on @a err's error chain but
* does not include any error tracing placeholders. @a err is not
* modified, except for any allocations using its pool.
*
* The returned error chain is allocated from @a err's pool and shares
* its message and source filename character arrays. The returned
* error chain should *not* be cleared because it is not a fully
* fledged error chain, only clearing @a err should be done to clear
* the returned error chain. If @a err is cleared, then the returned
* error chain is unusable.
*
* @a err can be #SVN_NO_ERROR. If @a err is not #SVN_NO_ERROR, then
* the last link in the error chain must be a non-tracing error, i.e,
* a real error.
*
* @since New in 1.7.
*/
svn_error_t *svn_error_purge_tracing(svn_error_t *err);
/** A statement macro, very similar to @c SVN_ERR.
*
* This macro will wrap the error with the specified text before
* returning the error.
*/
#define SVN_ERR_W(expr, wrap_msg) \
do { \
svn_error_t *svn_err__temp = (expr); \
if (svn_err__temp) \
return svn_error_quick_wrap(svn_err__temp, wrap_msg); \
} while (0)
/** A statement macro, similar to @c SVN_ERR, but returns an integer.
*
* Evaluate @a expr. If it yields an error, handle that error and
* return @c EXIT_FAILURE.
*/
#define SVN_INT_ERR(expr) \
do { \
svn_error_t *svn_err__temp = (expr); \
if (svn_err__temp) { \
svn_handle_error2(svn_err__temp, stderr, FALSE, "svn: "); \
svn_error_clear(svn_err__temp); \
return EXIT_FAILURE; } \
} while (0)
/** @} */
/** Error groups
*
* @defgroup svn_error_error_groups Error groups
* @{
*/
/**
* Return TRUE if @a err is an error specifically related to locking a
* path in the repository, FALSE otherwise.
*
* SVN_ERR_FS_OUT_OF_DATE and SVN_ERR_FS_NOT_FOUND are in here because it's a
* non-fatal error that can be thrown when attempting to lock an item.
*
* @since New in 1.2.
*/
#define SVN_ERR_IS_LOCK_ERROR(err) \
(err->apr_err == SVN_ERR_FS_PATH_ALREADY_LOCKED || \
err->apr_err == SVN_ERR_FS_NOT_FOUND || \
err->apr_err == SVN_ERR_FS_OUT_OF_DATE || \
err->apr_err == SVN_ERR_FS_BAD_LOCK_TOKEN)
/**
* Return TRUE if @a err is an error specifically related to unlocking
* a path in the repository, FALSE otherwise.
*
* @since New in 1.2.
*/
#define SVN_ERR_IS_UNLOCK_ERROR(err) \
(err->apr_err == SVN_ERR_FS_PATH_NOT_LOCKED || \
err->apr_err == SVN_ERR_FS_BAD_LOCK_TOKEN || \
err->apr_err == SVN_ERR_FS_LOCK_OWNER_MISMATCH || \
err->apr_err == SVN_ERR_FS_NO_SUCH_LOCK || \
err->apr_err == SVN_ERR_RA_NOT_LOCKED || \
err->apr_err == SVN_ERR_FS_LOCK_EXPIRED)
/** Evaluates to @c TRUE iff @a apr_err (of type apr_status_t) is in the given
* @a category, which should be one of the @c SVN_ERR_*_CATEGORY_START
* constants.
*
* @since New in 1.7.
*/
#define SVN_ERROR_IN_CATEGORY(apr_err, category) \
((category) == ((apr_err) / SVN_ERR_CATEGORY_SIZE) * SVN_ERR_CATEGORY_SIZE)
/** @} */
/** Internal malfunctions and assertions
*
* @defgroup svn_error_malfunction_assertion Malfunctions and assertions
* @{
*/
/** Report that an internal malfunction has occurred, and possibly terminate
* the program.
*
* Act as determined by the current "malfunction handler" which may have
* been specified by a call to svn_error_set_malfunction_handler() or else
* is the default handler as specified in that function's documentation. If
* the malfunction handler returns, then cause the function using this macro
* to return the error object that it generated.
*
* @note The intended use of this macro is where execution reaches a point
* that cannot possibly be reached unless there is a bug in the program.
*
* @since New in 1.6.
*/
#define SVN_ERR_MALFUNCTION() \
do { \
return svn_error_trace(svn_error__malfunction( \
TRUE, __FILE__, __LINE__, NULL)); \
} while (0)
/** Similar to SVN_ERR_MALFUNCTION(), but without the option of returning
* an error to the calling function.
*
* If possible you should use SVN_ERR_MALFUNCTION() instead.
*
* @since New in 1.6.
*/
#define SVN_ERR_MALFUNCTION_NO_RETURN() \
do { \
svn_error__malfunction(FALSE, __FILE__, __LINE__, NULL); \
abort(); \
} while (1)
/** Like SVN_ERR_ASSERT(), but append ERR to the returned error chain.
*
* If EXPR is false, return a malfunction error whose chain includes ERR.
* If EXPR is true, do nothing. (In particular, this does not clear ERR.)
*
* Types: (svn_boolean_t expr, svn_error_t *err)
*
* @since New in 1.8.
*/
#ifdef __clang_analyzer__
#include <assert.h>
/* Just ignore ERR. If the assert triggers, it'll be our least concern. */
#define SVN_ERR_ASSERT_E(expr, err) assert((expr))
#else
#define SVN_ERR_ASSERT_E(expr, err) \
do { \
if (!(expr)) { \
return svn_error_compose_create( \
svn_error__malfunction(TRUE, __FILE__, __LINE__, #expr), \
(err)); \
} \
} while (0)
#endif
/** Check that a condition is true: if not, report an error and possibly
* terminate the program.
*
* If the Boolean expression @a expr is true, do nothing. Otherwise,
* act as determined by the current "malfunction handler" which may have
* been specified by a call to svn_error_set_malfunction_handler() or else
* is the default handler as specified in that function's documentation. If
* the malfunction handler returns, then cause the function using this macro
* to return the error object that it generated.
*
* @note The intended use of this macro is to check a condition that cannot
* possibly be false unless there is a bug in the program.
*
* @note The condition to be checked should not be computationally expensive
* if it is reached often, as, unlike traditional "assert" statements, the
* evaluation of this expression is not compiled out in release-mode builds.
*
* @since New in 1.6.
*
* @see SVN_ERR_ASSERT_E()
*/
#ifdef __clang_analyzer__
#include <assert.h>
#define SVN_ERR_ASSERT(expr) assert((expr))
#else
#define SVN_ERR_ASSERT(expr) \
do { \
if (!(expr)) \
SVN_ERR(svn_error__malfunction(TRUE, __FILE__, __LINE__, #expr)); \
} while (0)
#endif
/** Similar to SVN_ERR_ASSERT(), but without the option of returning
* an error to the calling function.
*
* If possible you should use SVN_ERR_ASSERT() instead.
*
* @since New in 1.6.
*/
#define SVN_ERR_ASSERT_NO_RETURN(expr) \
do { \
if (!(expr)) { \
svn_error__malfunction(FALSE, __FILE__, __LINE__, #expr); \
abort(); \
} \
} while (0)
/** Report a "Not implemented" malfunction. Internal use only. */
#define SVN__NOT_IMPLEMENTED() \
return svn_error__malfunction(TRUE, __FILE__, __LINE__, "Not implemented.")
/** A helper function for the macros that report malfunctions. Handle a
* malfunction by calling the current "malfunction handler" which may have
* been specified by a call to svn_error_set_malfunction_handler() or else
* is the default handler as specified in that function's documentation.
*
* Pass all of the parameters to the handler. The error occurred in the
* source file @a file at line @a line, and was an assertion failure of the
* expression @a expr, or, if @a expr is null, an unconditional error.
*
* If @a can_return is true, the handler can return an error object
* that is returned by the caller. If @a can_return is false the
* method should never return. (The caller will call abort())
*
* @since New in 1.6.
*/
svn_error_t *
svn_error__malfunction(svn_boolean_t can_return,
const char *file,
int line,
const char *expr);
/** A type of function that handles an assertion failure or other internal
* malfunction detected within the Subversion libraries.
*
* The error occurred in the source file @a file at line @a line, and was an
* assertion failure of the expression @a expr, or, if @a expr is null, an
* unconditional error.
*
* If @a can_return is false a function of this type must never return.
*
* If @a can_return is true a function of this type must do one of:
* - Return an error object describing the error, using an error code in
* the category SVN_ERR_MALFUNC_CATEGORY_START.
* - Never return.
*
* The function may alter its behaviour according to compile-time
* and run-time and even interactive conditions.
*
* @see SVN_ERROR_IN_CATEGORY()
*
* @since New in 1.6.
*/
typedef svn_error_t *(*svn_error_malfunction_handler_t)
(svn_boolean_t can_return, const char *file, int line, const char *expr);
/** Cause subsequent malfunctions to be handled by @a func.
* Return the handler that was previously in effect.
*
* @a func may not be null.
*
* @note The default handler is svn_error_abort_on_malfunction().
*
* @note This function must be called in a single-threaded context.
*
* @since New in 1.6.
*/
svn_error_malfunction_handler_t
svn_error_set_malfunction_handler(svn_error_malfunction_handler_t func);
/** Handle a malfunction by returning an error object that describes it.
*
* When @a can_return is false, abort()
*
* This function implements @c svn_error_malfunction_handler_t.
*
* @since New in 1.6.
*/
svn_error_t *
svn_error_raise_on_malfunction(svn_boolean_t can_return,
const char *file,
int line,
const char *expr);
/** Handle a malfunction by printing a message to stderr and aborting.
*
* This function implements @c svn_error_malfunction_handler_t.
*
* @since New in 1.6.
*/
svn_error_t *
svn_error_abort_on_malfunction(svn_boolean_t can_return,
const char *file,
int line,
const char *expr);
/** @} */
#ifdef __cplusplus
}
#endif /* __cplusplus */
#endif /* SVN_ERROR_H */

File diff suppressed because it is too large Load Diff

2530
subversion/include/svn_fs.h Normal file

File diff suppressed because it is too large Load Diff

View File

@ -0,0 +1,265 @@
/**
* @copyright
* ====================================================================
* Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements. See the NOTICE file
* distributed with this work for additional information
* regarding copyright ownership. The ASF licenses this file
* to you under the Apache License, Version 2.0 (the
* "License"); you may not use this file except in compliance
* with the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing,
* software distributed under the License is distributed on an
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
* KIND, either express or implied. See the License for the
* specific language governing permissions and limitations
* under the License.
* ====================================================================
* @endcopyright
*
* @file svn_hash.h
* @brief Dumping and reading hash tables to/from files.
*/
#ifndef SVN_HASH_H
#define SVN_HASH_H
#include <apr.h>
#include <apr_pools.h>
#include <apr_hash.h>
#include <apr_tables.h>
#include <apr_file_io.h> /* for apr_file_t */
#include "svn_types.h"
#include "svn_io.h" /* for svn_stream_t */
#ifdef __cplusplus
extern "C" {
#endif /* __cplusplus */
/** The longest the "K <number>" line can be in one of our hashdump files. */
#define SVN_KEYLINE_MAXLEN 100
/**
* @defgroup svn_hash_support Hash table serialization support
* @{
*/
/*----------------------------------------------------*/
/** Reading/writing hashtables to disk
*
* @defgroup svn_hash_read_write Reading and writing hashtables to disk
* @{
*/
/**
* The conventional terminator for hash dumps.
*
* @since New in 1.1.
*/
#define SVN_HASH_TERMINATOR "END"
/**
* Read a hash table from @a stream, storing the resultants names and
* values in @a hash. Use a @a pool for all allocations. @a hash will
* have <tt>const char *</tt> keys and <tt>svn_string_t *</tt> values.
* If @a terminator is NULL, expect the hash to be terminated by the
* end of the stream; otherwise, expect the hash to be terminated by a
* line containing @a terminator. Pass @c SVN_HASH_TERMINATOR to use
* the conventional terminator "END".
*
* @since New in 1.1.
*/
svn_error_t *
svn_hash_read2(apr_hash_t *hash,
svn_stream_t *stream,
const char *terminator,
apr_pool_t *pool);
/**
* Dump @a hash to @a stream. Use @a pool for all allocations. @a
* hash has <tt>const char *</tt> keys and <tt>svn_string_t *</tt>
* values. If @a terminator is not NULL, terminate the hash with a
* line containing @a terminator.
*
* @since New in 1.1.
*/
svn_error_t *
svn_hash_write2(apr_hash_t *hash,
svn_stream_t *stream,
const char *terminator,
apr_pool_t *pool);
/**
* Similar to svn_hash_read2(), but allows @a stream to contain
* deletion lines which remove entries from @a hash as well as adding
* to it.
*
* @since New in 1.1.
*/
svn_error_t *
svn_hash_read_incremental(apr_hash_t *hash,
svn_stream_t *stream,
const char *terminator,
apr_pool_t *pool);
/**
* Similar to svn_hash_write2(), but only writes out entries for
* keys which differ between @a hash and @a oldhash, and also writes
* out deletion lines for keys which are present in @a oldhash but not
* in @a hash.
*
* @since New in 1.1.
*/
svn_error_t *
svn_hash_write_incremental(apr_hash_t *hash,
apr_hash_t *oldhash,
svn_stream_t *stream,
const char *terminator,
apr_pool_t *pool);
/**
* This function behaves like svn_hash_read2(), but it only works
* on an apr_file_t input, empty files are accepted, and the hash is
* expected to be terminated with a line containing "END" or
* "PROPS-END".
*
* @deprecated Provided for backward compatibility with the 1.0 API.
*/
SVN_DEPRECATED
svn_error_t *
svn_hash_read(apr_hash_t *hash,
apr_file_t *srcfile,
apr_pool_t *pool);
/**
* This function behaves like svn_hash_write2(), but it only works
* on an apr_file_t output, and the terminator is always "END".
*
* @deprecated Provided for backward compatibility with the 1.0 API.
*/
SVN_DEPRECATED
svn_error_t *
svn_hash_write(apr_hash_t *hash,
apr_file_t *destfile,
apr_pool_t *pool);
/** @} */
/** Taking the "diff" of two hash tables.
*
* @defgroup svn_hash_diff Taking the diff of two hash tables.
* @{
*/
/** Hash key status indicator for svn_hash_diff_func_t. */
enum svn_hash_diff_key_status
{
/* Key is present in both hashes. */
svn_hash_diff_key_both,
/* Key is present in first hash only. */
svn_hash_diff_key_a,
/* Key is present in second hash only. */
svn_hash_diff_key_b
};
/** Function type for expressing a key's status between two hash tables. */
typedef svn_error_t *(*svn_hash_diff_func_t)
(const void *key, apr_ssize_t klen,
enum svn_hash_diff_key_status status,
void *baton);
/** Take the diff of two hashtables.
*
* For each key in the union of @a hash_a's and @a hash_b's keys, invoke
* @a diff_func exactly once, passing the key, the key's length, an enum
* @c svn_hash_diff_key_status indicating which table(s) the key appears
* in, and @a diff_func_baton.
*
* Process all keys of @a hash_a first, then all remaining keys of @a hash_b.
*
* If @a diff_func returns error, return that error immediately, without
* applying @a diff_func to anything else.
*
* @a hash_a or @a hash_b or both may be NULL; treat a null table as though
* empty.
*
* Use @a pool for temporary allocation.
*/
svn_error_t *
svn_hash_diff(apr_hash_t *hash_a,
apr_hash_t *hash_b,
svn_hash_diff_func_t diff_func,
void *diff_func_baton,
apr_pool_t *pool);
/** @} */
/**
* @defgroup svn_hash_misc Miscellaneous hash APIs
* @{
*/
/**
* Return the keys to @a hash in @a *array. The keys are assumed to be
* (const char *). The keys are in no particular order.
*
* @a *array itself is allocated in @a pool; however, the keys are not
* copied from the hash.
*
* @since New in 1.5.
*/
svn_error_t *
svn_hash_keys(apr_array_header_t **array,
apr_hash_t *hash,
apr_pool_t *pool);
/**
* Set @a *hash to a new hash whose keys come from the items in @a keys
* (an array of <tt>const char *</tt> items), and whose values are
* match their corresponding key. Use @a pool for all allocations
* (including @a *hash, its keys, and its values).
*
* @since New in 1.5.
*/
svn_error_t *
svn_hash_from_cstring_keys(apr_hash_t **hash,
const apr_array_header_t *keys,
apr_pool_t *pool);
/** Shortcut for apr_hash_get() with a const char * key.
*
* @since New in 1.8.
*/
#define svn_hash_gets(ht, key) \
apr_hash_get(ht, key, APR_HASH_KEY_STRING)
/** Shortcut for apr_hash_set() with a const char * key.
*
* @since New in 1.8.
*/
#define svn_hash_sets(ht, key, val) \
apr_hash_set(ht, key, APR_HASH_KEY_STRING, val)
/** @} */
/** @} */
#ifdef __cplusplus
}
#endif /* __cplusplus */
#endif /* SVN_HASH_H */

2282
subversion/include/svn_io.h Normal file

File diff suppressed because it is too large Load Diff

View File

@ -0,0 +1,139 @@
/**
* @copyright
* ====================================================================
* Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements. See the NOTICE file
* distributed with this work for additional information
* regarding copyright ownership. The ASF licenses this file
* to you under the Apache License, Version 2.0 (the
* "License"); you may not use this file except in compliance
* with the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing,
* software distributed under the License is distributed on an
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
* KIND, either express or implied. See the License for the
* specific language governing permissions and limitations
* under the License.
* ====================================================================
* @endcopyright
*
* @file svn_iter.h
* @brief The Subversion Iteration drivers helper routines
*
*/
#ifndef SVN_ITER_H
#define SVN_ITER_H
#include <apr.h> /* for apr_ssize_t */
#include <apr_pools.h> /* for apr_pool_t */
#include <apr_hash.h> /* for apr_hash_t */
#include <apr_tables.h> /* for apr_array_header_t */
#include "svn_types.h"
#ifdef __cplusplus
extern "C" {
#endif /* __cplusplus */
/** Callback function for use with svn_iter_apr_hash().
* Use @a pool for temporary allocation, it's cleared between invocations.
*
* @a key, @a klen and @a val are the values normally retrieved with
* apr_hash_this().
*
* @a baton is the baton passed into svn_iter_apr_hash().
*
* @since New in 1.5.
*/
typedef svn_error_t *(*svn_iter_apr_hash_cb_t)(void *baton,
const void *key,
apr_ssize_t klen,
void *val, apr_pool_t *pool);
/** Iterate over the elements in @a hash, calling @a func for each one until
* there are no more elements or @a func returns an error.
*
* Uses @a pool for temporary allocations.
*
* If @a completed is not NULL, then on return - if @a func returns no
* errors - @a *completed will be set to @c TRUE.
*
* If @a func returns an error other than @c SVN_ERR_ITER_BREAK, that
* error is returned. When @a func returns @c SVN_ERR_ITER_BREAK,
* iteration is interrupted, but no error is returned and @a *completed is
* set to @c FALSE (even if this iteration was the last one).
*
* @since New in 1.5.
*/
svn_error_t *
svn_iter_apr_hash(svn_boolean_t *completed,
apr_hash_t *hash,
svn_iter_apr_hash_cb_t func,
void *baton,
apr_pool_t *pool);
/** Iteration callback used in conjuction with svn_iter_apr_array().
*
* Use @a pool for temporary allocation, it's cleared between invocations.
*
* @a baton is the baton passed to svn_iter_apr_array(). @a item
* is a pointer to the item written to the array with the APR_ARRAY_PUSH()
* macro.
*
* @since New in 1.5.
*/
typedef svn_error_t *(*svn_iter_apr_array_cb_t)(void *baton,
void *item,
apr_pool_t *pool);
/** Iterate over the elements in @a array calling @a func for each one until
* there are no more elements or @a func returns an error.
*
* Uses @a pool for temporary allocations.
*
* If @a completed is not NULL, then on return - if @a func returns no
* errors - @a *completed will be set to @c TRUE.
*
* If @a func returns an error other than @c SVN_ERR_ITER_BREAK, that
* error is returned. When @a func returns @c SVN_ERR_ITER_BREAK,
* iteration is interrupted, but no error is returned and @a *completed is
* set to @c FALSE (even if this iteration was the last one).
*
* @since New in 1.5.
*/
svn_error_t *
svn_iter_apr_array(svn_boolean_t *completed,
const apr_array_header_t *array,
svn_iter_apr_array_cb_t func,
void *baton,
apr_pool_t *pool);
/** Internal routine used by svn_iter_break() macro.
*/
svn_error_t *
svn_iter__break(void);
/** Helper macro to break looping in svn_iter_apr_array() and
* svn_iter_apr_hash() driven loops.
*
* @note The error is just a means of communicating between
* driver and callback. There is no need for it to exist
* past the lifetime of the iterpool.
*
* @since New in 1.5.
*/
#define svn_iter_break(pool) return svn_iter__break()
#ifdef __cplusplus
}
#endif /* __cplusplus */
#endif /* SVN_ITER_H */

View File

@ -0,0 +1,91 @@
/**
* @copyright
* ====================================================================
* Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements. See the NOTICE file
* distributed with this work for additional information
* regarding copyright ownership. The ASF licenses this file
* to you under the Apache License, Version 2.0 (the
* "License"); you may not use this file except in compliance
* with the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing,
* software distributed under the License is distributed on an
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
* KIND, either express or implied. See the License for the
* specific language governing permissions and limitations
* under the License.
* ====================================================================
* @endcopyright
*
* @file svn_md5.h
* @brief Converting and comparing MD5 checksums.
*/
#ifndef SVN_MD5_H
#define SVN_MD5_H
#include <apr_pools.h> /* for apr_pool_t */
#include "svn_types.h" /* for svn_boolean_t */
#ifdef __cplusplus
extern "C" {
#endif /* __cplusplus */
/**
* The MD5 digest for the empty string.
*
* @deprecated Provided for backward compatibility with the 1.5 API.
* */
SVN_DEPRECATED
const unsigned char *
svn_md5_empty_string_digest(void);
/**
* Return the hex representation of @a digest, which must be
* @c APR_MD5_DIGESTSIZE bytes long, allocating the string in @a pool.
*
* @deprecated Provided for backward compatibility with the 1.5 API.
*/
SVN_DEPRECATED
const char *
svn_md5_digest_to_cstring_display(const unsigned char digest[],
apr_pool_t *pool);
/**
* Return the hex representation of @a digest, which must be
* @c APR_MD5_DIGESTSIZE bytes long, allocating the string in @a pool.
* If @a digest is all zeros, then return NULL.
*
* @deprecated Provided for backward compatibility with the 1.5 API.
*/
SVN_DEPRECATED
const char *
svn_md5_digest_to_cstring(const unsigned char digest[],
apr_pool_t *pool);
/**
* Compare digests @a d1 and @a d2, each @c APR_MD5_DIGESTSIZE bytes long.
* If neither is all zeros, and they do not match, then return FALSE;
* else return TRUE.
*
* @deprecated Provided for backward compatibility with the 1.5 API.
*/
SVN_DEPRECATED
svn_boolean_t
svn_md5_digests_match(const unsigned char d1[],
const unsigned char d2[]);
#ifdef __cplusplus
}
#endif /* __cplusplus */
#endif /* SVN_MD5_H */

View File

@ -0,0 +1,612 @@
/**
* @copyright
* ====================================================================
* Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements. See the NOTICE file
* distributed with this work for additional information
* regarding copyright ownership. The ASF licenses this file
* to you under the Apache License, Version 2.0 (the
* "License"); you may not use this file except in compliance
* with the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing,
* software distributed under the License is distributed on an
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
* KIND, either express or implied. See the License for the
* specific language governing permissions and limitations
* under the License.
* ====================================================================
* @endcopyright
*
* @file svn_mergeinfo.h
* @brief mergeinfo handling and processing
*/
#ifndef SVN_MERGEINFO_H
#define SVN_MERGEINFO_H
#include <apr_pools.h>
#include <apr_tables.h> /* for apr_array_header_t */
#include <apr_hash.h>
#include "svn_types.h"
#include "svn_string.h" /* for svn_string_t */
#ifdef __cplusplus
extern "C" {
#endif /* __cplusplus */
/** Overview of the @c SVN_PROP_MERGEINFO property.
*
* Merge history is stored in the @c SVN_PROP_MERGEINFO property of files
* and directories. The @c SVN_PROP_MERGEINFO property on a path stores the
* complete list of changes merged to that path, either directly or via the
* path's parent, grand-parent, etc.. A path may have empty mergeinfo which
* means that nothing has been merged to that path or all previous merges
* to the path were reversed. Note that a path may have no mergeinfo, this
* is not the same as empty mergeinfo.
*
* Every path in a tree may have @c SVN_PROP_MERGEINFO set, but if the
* @c SVN_PROP_MERGEINFO for a path is equivalent to the
* @c SVN_PROP_MERGEINFO for its parent, then the @c SVN_PROP_MERGEINFO on
* the path will 'elide' (be removed) from the path as a post step to any
* merge. If a path's parent does not have any @c SVN_PROP_MERGEINFO set,
* the path's mergeinfo can elide to its nearest grand-parent,
* great-grand-parent, etc. that has equivalent @c SVN_PROP_MERGEINFO set
* on it.
*
* If a path has no @c SVN_PROP_MERGEINFO of its own, it inherits mergeinfo
* from its nearest parent that has @c SVN_PROP_MERGEINFO set. The
* exception to this is @c SVN_PROP_MERGEINFO with non-inheritable revision
* ranges. These non-inheritable ranges apply only to the path which they
* are set on.
*
* Due to Subversion's allowance for mixed revision working copies, both
* elision and inheritance within the working copy presume the path
* between a path and its nearest parent with mergeinfo is at the same
* working revision. If this is not the case then neither inheritance nor
* elision can occur.
*
* The value of the @c SVN_PROP_MERGEINFO property is either an empty string
* (representing empty mergeinfo) or a non-empty string consisting of
* a path, a colon, and comma separated revision list, containing one or more
* revision or revision ranges. Revision range start and end points are
* separated by "-". Revisions and revision ranges may have the optional
* @c SVN_MERGEINFO_NONINHERITABLE_STR suffix to signify a non-inheritable
* revision/revision range.
*
* @c SVN_PROP_MERGEINFO Value Grammar:
*
* Token Definition
* ----- ----------
* revisionrange REVISION1 "-" REVISION2
* revisioneelement (revisionrange | REVISION)"*"?
* rangelist revisioneelement (COMMA revisioneelement)*
* revisionline PATHNAME COLON rangelist
* top "" | (revisionline (NEWLINE revisionline))*
*
* The PATHNAME is the source of a merge and the rangelist the revision(s)
* merged to the path @c SVN_PROP_MERGEINFO is set on directly or indirectly
* via inheritance. PATHNAME must always exist at the specified rangelist
* and thus a single merge may result in multiple revisionlines if the source
* was renamed.
*
* Rangelists must be sorted from lowest to highest revision and cannot
* contain overlapping revisionlistelements. REVISION1 must be less than
* REVISION2. Consecutive single revisions that can be represented by a
* revisionrange are allowed however (e.g. '5,6,7,8,9-12' or '5-12' are
* both acceptable).
*/
/* Suffix for SVN_PROP_MERGEINFO revision ranges indicating a given
range is non-inheritable. */
#define SVN_MERGEINFO_NONINHERITABLE_STR "*"
/** Terminology for data structures that contain mergeinfo.
*
* Subversion commonly uses several data structures to represent
* mergeinfo in RAM:
*
* (a) Strings (@c svn_string_t *) containing "unparsed mergeinfo".
*
* (b) @c svn_rangelist_t, called a "rangelist". An array of non-
* overlapping merge ranges (@c svn_merge_range_t *), sorted as said by
* @c svn_sort_compare_ranges(). An empty range list is represented by
* an empty array. Unless specifically noted otherwise, all APIs require
* rangelists that describe only forward ranges, i.e. the range's start
* revision is less than its end revision.
*
* (c) @c svn_mergeinfo_t, called "mergeinfo". A hash mapping merge
* source paths (@c const char *, starting with slashes) to
* non-empty rangelist arrays. A @c NULL hash is used to represent
* no mergeinfo and an empty hash is used to represent empty
* mergeinfo.
*
* (d) @c svn_mergeinfo_catalog_t, called a "mergeinfo catalog". A hash
* mapping paths (@c const char *) to @c svn_mergeinfo_t.
*
* Both @c svn_mergeinfo_t and @c svn_mergeinfo_catalog_t are just
* typedefs for @c apr_hash_t *; there is no static type-checking, and
* you still use standard @c apr_hash_t functions to interact with
* them.
*
* Note that while the keys of mergeinfos are always absolute from the
* repository root, the keys of a catalog may be relative to something
* else, such as an RA session root.
*/
typedef apr_array_header_t svn_rangelist_t;
typedef apr_hash_t *svn_mergeinfo_t;
typedef apr_hash_t *svn_mergeinfo_catalog_t;
/** Parse the mergeinfo from @a input into @a *mergeinfo. If no
* mergeinfo is available, return an empty mergeinfo (never @c NULL).
* Perform temporary allocations in @a pool.
*
* If @a input is not a grammatically correct @c SVN_PROP_MERGEINFO
* property, contains overlapping revision ranges of differing
* inheritability, or revision ranges with a start revision greater
* than or equal to its end revision, or contains paths mapped to empty
* revision ranges, then return @c SVN_ERR_MERGEINFO_PARSE_ERROR.
* Unordered revision ranges are allowed, but will be sorted when
* placed into @a *mergeinfo. Overlapping revision ranges of the same
* inheritability are also allowed, but will be combined into a single
* range when placed into @a *mergeinfo.
*
* @a input may contain relative merge source paths, but these are
* converted to absolute paths in @a *mergeinfo.
*
* @since New in 1.5.
*/
svn_error_t *
svn_mergeinfo_parse(svn_mergeinfo_t *mergeinfo, const char *input,
apr_pool_t *pool);
/** Calculate the delta between two mergeinfos, @a mergefrom and @a mergeto
* (either or both of which may be @c NULL meaning an empty mergeinfo).
* Place the result in @a *deleted and @a *added (neither output argument
* may be @c NULL), both allocated in @a result_pool. The resulting
* @a *deleted and @a *added will not be null.
*
* @a consider_inheritance determines how the rangelists in the two
* hashes are compared for equality. If @a consider_inheritance is FALSE,
* then the start and end revisions of the @c svn_merge_range_t's being
* compared are the only factors considered when determining equality.
*
* e.g. '/trunk: 1,3-4*,5' == '/trunk: 1,3-5'
*
* If @a consider_inheritance is TRUE, then the inheritability of the
* @c svn_merge_range_t's is also considered and must be the same for two
* otherwise identical ranges to be judged equal.
*
* e.g. '/trunk: 1,3-4*,5' != '/trunk: 1,3-5'
* '/trunk: 1,3-4*,5' == '/trunk: 1,3-4*,5'
* '/trunk: 1,3-4,5' == '/trunk: 1,3-4,5'
*
* @since New in 1.8.
*/
svn_error_t *
svn_mergeinfo_diff2(svn_mergeinfo_t *deleted, svn_mergeinfo_t *added,
svn_mergeinfo_t mergefrom, svn_mergeinfo_t mergeto,
svn_boolean_t consider_inheritance,
apr_pool_t *result_pool,
apr_pool_t *scratch_pool);
/** Similar to svn_mergeinfo_diff2(), but users only one pool.
*
* @deprecated Provided for backward compatibility with the 1.7 API.
* @since New in 1.5.
*/
SVN_DEPRECATED
svn_error_t *
svn_mergeinfo_diff(svn_mergeinfo_t *deleted, svn_mergeinfo_t *added,
svn_mergeinfo_t mergefrom, svn_mergeinfo_t mergeto,
svn_boolean_t consider_inheritance,
apr_pool_t *pool);
/** Merge a shallow copy of one mergeinfo, @a changes, into another mergeinfo
* @a mergeinfo.
*
* Rangelists for merge source paths common to @a changes and @a mergeinfo may
* result in new rangelists; these are allocated in @a result_pool.
* Temporary allocations are made in @a scratch_pool.
*
* When intersecting rangelists for a path are merged, the inheritability of
* the resulting svn_merge_range_t depends on the inheritability of the
* operands. If two non-inheritable ranges are merged the result is always
* non-inheritable, in all other cases the resulting range is inheritable.
*
* e.g. '/A: 1,3-4' merged with '/A: 1,3,4*,5' --> '/A: 1,3-5'
* '/A: 1,3-4*' merged with '/A: 1,3,4*,5' --> '/A: 1,3,4*,5'
*
* @since New in 1.8.
*/
svn_error_t *
svn_mergeinfo_merge2(svn_mergeinfo_t mergeinfo,
svn_mergeinfo_t changes,
apr_pool_t *result_pool,
apr_pool_t *scratch_pool);
/** Like svn_mergeinfo_merge2, but uses only one pool.
*
* @deprecated Provided for backward compatibility with the 1.5 API.
*/
SVN_DEPRECATED
svn_error_t *
svn_mergeinfo_merge(svn_mergeinfo_t mergeinfo,
svn_mergeinfo_t changes,
apr_pool_t *pool);
/** Combine one mergeinfo catalog, @a changes_catalog, into another mergeinfo
* catalog @a mergeinfo_catalog. If both catalogs have mergeinfo for the same
* key, use svn_mergeinfo_merge() to combine the mergeinfos.
*
* Additions to @a mergeinfo_catalog are deep copies allocated in
* @a result_pool. Temporary allocations are made in @a scratch_pool.
*
* @since New in 1.7.
*/
svn_error_t *
svn_mergeinfo_catalog_merge(svn_mergeinfo_catalog_t mergeinfo_catalog,
svn_mergeinfo_catalog_t changes_catalog,
apr_pool_t *result_pool,
apr_pool_t *scratch_pool);
/** Like svn_mergeinfo_remove2, but always considers inheritance.
*
* @deprecated Provided for backward compatibility with the 1.6 API.
*/
SVN_DEPRECATED
svn_error_t *
svn_mergeinfo_remove(svn_mergeinfo_t *mergeinfo, svn_mergeinfo_t eraser,
svn_mergeinfo_t whiteboard, apr_pool_t *pool);
/** Removes @a eraser (the subtrahend) from @a whiteboard (the
* minuend), and places the resulting difference in @a *mergeinfo.
* Allocates @a *mergeinfo in @a result_pool. Temporary allocations
* will be performed in @a scratch_pool.
*
* @a consider_inheritance determines how to account for the inheritability
* of the two mergeinfo's ranges when calculating the range equivalence,
* as described for svn_mergeinfo_diff().
*
* @since New in 1.7.
*/
svn_error_t *
svn_mergeinfo_remove2(svn_mergeinfo_t *mergeinfo,
svn_mergeinfo_t eraser,
svn_mergeinfo_t whiteboard,
svn_boolean_t consider_inheritance,
apr_pool_t *result_pool,
apr_pool_t *scratch_pool);
/** Calculate the delta between two rangelists consisting of @c
* svn_merge_range_t * elements (sorted in ascending order), @a from
* and @a to, and place the result in @a *deleted and @a *added
* (neither output argument will ever be @c NULL).
*
* @a consider_inheritance determines how to account for the inheritability
* of the two rangelist's ranges when calculating the diff,
* as described for svn_mergeinfo_diff().
*
* @since New in 1.5.
*/
svn_error_t *
svn_rangelist_diff(svn_rangelist_t **deleted, svn_rangelist_t **added,
const svn_rangelist_t *from, const svn_rangelist_t *to,
svn_boolean_t consider_inheritance,
apr_pool_t *pool);
/** Merge two rangelists consisting of @c svn_merge_range_t *
* elements, @a rangelist and @a changes, placing the results in
* @a rangelist. New elements added to @a rangelist are allocated
* in @a result_pool. Either rangelist may be empty.
*
* When intersecting rangelists are merged, the inheritability of
* the resulting svn_merge_range_t depends on the inheritability of the
* operands: see svn_mergeinfo_merge().
*
* Note: @a rangelist and @a changes must be sorted as said by @c
* svn_sort_compare_ranges(). @a rangelist is guaranteed to remain
* in sorted order and be compacted to the minimal number of ranges
* needed to represent the merged result.
*
* If the original rangelist contains non-collapsed adjacent ranges,
* the final result is not guaranteed to be compacted either.
*
* Use @a scratch_pool for temporary allocations.
*
* @since New in 1.8.
*/
svn_error_t *
svn_rangelist_merge2(svn_rangelist_t *rangelist,
const svn_rangelist_t *changes,
apr_pool_t *result_pool,
apr_pool_t *scratch_pool);
/** Like svn_rangelist_merge2(), but with @a rangelist as an input/output
* argument. This function always allocates a new rangelist in @a pool and
* returns its result in @a *rangelist. It does not modify @a *rangelist
* in place. If not used carefully, this function can use up a lot of memory
* if called in a loop.
*
* It performs an extra adjacent range compaction round to make sure non
* collapsed input ranges are compacted in the result.
*
* @since New in 1.5.
* @deprecated Provided for backward compatibility with the 1.7 API.
*/
SVN_DEPRECATED
svn_error_t *
svn_rangelist_merge(svn_rangelist_t **rangelist,
const svn_rangelist_t *changes,
apr_pool_t *pool);
/** Removes @a eraser (the subtrahend) from @a whiteboard (the
* minuend), and places the resulting difference in @a output.
*
* Note: @a eraser and @a whiteboard must be sorted as said by @c
* svn_sort_compare_ranges(). @a output is guaranteed to be in sorted
* order.
*
* @a consider_inheritance determines how to account for the
* @c svn_merge_range_t inheritable field when comparing @a whiteboard's
* and @a *eraser's rangelists for equality. @see svn_mergeinfo_diff().
*
* @since New in 1.5.
*/
svn_error_t *
svn_rangelist_remove(svn_rangelist_t **output, const svn_rangelist_t *eraser,
const svn_rangelist_t *whiteboard,
svn_boolean_t consider_inheritance,
apr_pool_t *pool);
/** Find the intersection of two mergeinfos, @a mergeinfo1 and @a
* mergeinfo2, and place the result in @a *mergeinfo, which is (deeply)
* allocated in @a result_pool. Temporary allocations will be performed
* in @a scratch_pool.
*
* @a consider_inheritance determines how to account for the inheritability
* of the two mergeinfo's ranges when calculating the range equivalence,
* @see svn_rangelist_intersect().
*
* @since New in 1.7.
*/
svn_error_t *
svn_mergeinfo_intersect2(svn_mergeinfo_t *mergeinfo,
svn_mergeinfo_t mergeinfo1,
svn_mergeinfo_t mergeinfo2,
svn_boolean_t consider_inheritance,
apr_pool_t *result_pool,
apr_pool_t *scratch_pool);
/** Like svn_mergeinfo_intersect2, but always considers inheritance.
*
* @deprecated Provided for backward compatibility with the 1.6 API.
*/
SVN_DEPRECATED
svn_error_t *
svn_mergeinfo_intersect(svn_mergeinfo_t *mergeinfo,
svn_mergeinfo_t mergeinfo1,
svn_mergeinfo_t mergeinfo2,
apr_pool_t *pool);
/** Find the intersection of two rangelists consisting of @c
* svn_merge_range_t * elements, @a rangelist1 and @a rangelist2, and
* place the result in @a *rangelist (which is never @c NULL).
*
* @a consider_inheritance determines how to account for the inheritability
* of the two rangelist's ranges when calculating the intersection,
* @see svn_mergeinfo_diff(). If @a consider_inheritance is FALSE then
* ranges with different inheritance can intersect, but the resulting
* @a *rangelist is non-inheritable only if the corresponding ranges from
* both @a rangelist1 and @a rangelist2 are non-inheritable.
* If @a consider_inheritance is TRUE, then ranges with different
* inheritance can never intersect.
*
* Note: @a rangelist1 and @a rangelist2 must be sorted as said by @c
* svn_sort_compare_ranges(). @a *rangelist is guaranteed to be in sorted
* order.
* @since New in 1.5.
*/
svn_error_t *
svn_rangelist_intersect(svn_rangelist_t **rangelist,
const svn_rangelist_t *rangelist1,
const svn_rangelist_t *rangelist2,
svn_boolean_t consider_inheritance,
apr_pool_t *pool);
/** Reverse @a rangelist, and the @c start and @c end fields of each
* range in @a rangelist, in place.
*
* TODO(miapi): Is this really a valid function? Rangelists that
* aren't sorted, or rangelists containing reverse ranges, are
* generally not valid in mergeinfo code. Can we rewrite the two
* places where this is used?
*
* @since New in 1.5.
*/
svn_error_t *
svn_rangelist_reverse(svn_rangelist_t *rangelist, apr_pool_t *pool);
/** Take an array of svn_merge_range_t *'s in @a rangelist, and convert it
* back to a text format rangelist in @a output. If @a rangelist contains
* no elements, sets @a output to the empty string.
*
* @since New in 1.5.
*/
svn_error_t *
svn_rangelist_to_string(svn_string_t **output,
const svn_rangelist_t *rangelist,
apr_pool_t *pool);
/** Return a deep copy of @c svn_merge_range_t *'s in @a rangelist excluding
* all non-inheritable @c svn_merge_range_t if @a inheritable is TRUE or
* excluding all inheritable @c svn_merge_range_t otherwise. If @a start and
* @a end are valid revisions and @a start is less than or equal to @a end,
* then exclude only the non-inheritable revision ranges that intersect
* inclusively with the range defined by @a start and @a end. If
* @a rangelist contains no elements, return an empty array. Allocate the
* copy in @a result_pool, use @a scratch_pool for temporary allocations.
*
* @since New in 1.7.
*/
svn_error_t *
svn_rangelist_inheritable2(svn_rangelist_t **inheritable_rangelist,
const svn_rangelist_t *rangelist,
svn_revnum_t start,
svn_revnum_t end,
svn_boolean_t inheritable,
apr_pool_t *result_pool,
apr_pool_t *scratch_pool);
/** Like svn_rangelist_inheritable2, but always finds inheritable ranges.
*
* @since New in 1.5.
* @deprecated Provided for backward compatibility with the 1.6 API.
*/
SVN_DEPRECATED
svn_error_t *
svn_rangelist_inheritable(svn_rangelist_t **inheritable_rangelist,
const svn_rangelist_t *rangelist,
svn_revnum_t start,
svn_revnum_t end,
apr_pool_t *pool);
/** Return a deep copy of @a mergeinfo, excluding all non-inheritable
* @c svn_merge_range_t if @a inheritable is TRUE or excluding all
* inheritable @c svn_merge_range_t otherwise. If @a start and @a end
* are valid revisions and @a start is less than or equal to @a end,
* then exclude only the non-inheritable revisions that intersect
* inclusively with the range defined by @a start and @a end. If @a path
* is not NULL remove non-inheritable ranges only for @a path. If all
* ranges are removed for a given path then remove that path as well.
* If all paths are removed or @a rangelist is empty then set
* @a *inheritable_rangelist to an empty array. Allocate the copy in
* @a result_pool, use @a scratch_pool for temporary allocations.
*
* @since New in 1.7.
*/
svn_error_t *
svn_mergeinfo_inheritable2(svn_mergeinfo_t *inheritable_mergeinfo,
svn_mergeinfo_t mergeinfo,
const char *path,
svn_revnum_t start,
svn_revnum_t end,
svn_boolean_t inheritable,
apr_pool_t *result_pool,
apr_pool_t *scratch_pool);
/** Like svn_mergeinfo_inheritable2, but always finds inheritable mergeinfo.
*
* @since New in 1.5.
* @deprecated Provided for backward compatibility with the 1.6 API.
*/
SVN_DEPRECATED
svn_error_t *
svn_mergeinfo_inheritable(svn_mergeinfo_t *inheritable_mergeinfo,
svn_mergeinfo_t mergeinfo,
const char *path,
svn_revnum_t start,
svn_revnum_t end,
apr_pool_t *pool);
/** Take a mergeinfo in @a mergeinput, and convert it to unparsed
* mergeinfo. Set @a *output to the result, allocated in @a pool.
* If @a input contains no elements, set @a *output to the empty string.
*
* @a mergeinput may contain relative merge source paths, but these are
* converted to absolute paths in @a *output.
*
* @since New in 1.5.
*/
svn_error_t *
svn_mergeinfo_to_string(svn_string_t **output,
svn_mergeinfo_t mergeinput,
apr_pool_t *pool);
/** Take a hash of mergeinfo in @a mergeinfo, and sort the rangelists
* associated with each key (in place).
*
* TODO(miapi): mergeinfos should *always* be sorted. This should be
* a private function.
*
* @since New in 1.5
*/
svn_error_t *
svn_mergeinfo_sort(svn_mergeinfo_t mergeinfo, apr_pool_t *pool);
/** Return a deep copy of @a mergeinfo_catalog, allocated in @a pool.
*
* @since New in 1.6.
*/
svn_mergeinfo_catalog_t
svn_mergeinfo_catalog_dup(svn_mergeinfo_catalog_t mergeinfo_catalog,
apr_pool_t *pool);
/** Return a deep copy of @a mergeinfo, allocated in @a pool.
*
* @since New in 1.5.
*/
svn_mergeinfo_t
svn_mergeinfo_dup(svn_mergeinfo_t mergeinfo, apr_pool_t *pool);
/** Return a deep copy of @a rangelist, allocated in @a pool.
*
* @since New in 1.5.
*/
svn_rangelist_t *
svn_rangelist_dup(const svn_rangelist_t *rangelist, apr_pool_t *pool);
/**
* The three ways to request mergeinfo affecting a given path.
*
* @since New in 1.5.
*/
typedef enum svn_mergeinfo_inheritance_t
{
/** Explicit mergeinfo only. */
svn_mergeinfo_explicit,
/** Explicit mergeinfo, or if that doesn't exist, the inherited
mergeinfo from a target's nearest (path-wise, not history-wise)
ancestor. */
svn_mergeinfo_inherited,
/** Mergeinfo inherited from a target's nearest (path-wise, not
history-wise) ancestor, regardless of whether target has explicit
mergeinfo. */
svn_mergeinfo_nearest_ancestor
} svn_mergeinfo_inheritance_t;
/** Return a constant string expressing @a inherit as an English word,
* i.e., "explicit" (default), "inherited", or "nearest_ancestor".
* The string is not localized, as it may be used for client<->server
* communications.
*
* @since New in 1.5.
*/
const char *
svn_inheritance_to_word(svn_mergeinfo_inheritance_t inherit);
/** Return the appropriate @c svn_mergeinfo_inheritance_t for @a word.
* @a word is as returned from svn_inheritance_to_word(). Defaults to
* @c svn_mergeinfo_explicit.
*
* @since New in 1.5.
*/
svn_mergeinfo_inheritance_t
svn_inheritance_from_word(const char *word);
#ifdef __cplusplus
}
#endif /* __cplusplus */
#endif /* SVN_MERGEINFO_H */

View File

@ -0,0 +1,56 @@
/**
* @copyright
* ====================================================================
* Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements. See the NOTICE file
* distributed with this work for additional information
* regarding copyright ownership. The ASF licenses this file
* to you under the Apache License, Version 2.0 (the
* "License"); you may not use this file except in compliance
* with the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing,
* software distributed under the License is distributed on an
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
* KIND, either express or implied. See the License for the
* specific language governing permissions and limitations
* under the License.
* ====================================================================
* @endcopyright
*
* @file svn_nls.h
* @brief Support functions for NLS programs
*/
#ifndef SVN_NLS_H
#define SVN_NLS_H
#include "svn_types.h"
#ifdef __cplusplus
extern "C" {
#endif /* __cplusplus */
/** Set up the NLS.
* Return the error @c APR_EINVAL or @c APR_INCOMPLETE if an
* error occurs.
*
* @note This function is for bindings. You should usually
* use svn_cmdline_init() instead of calling this
* function directly. This function should be called
* after initializing APR.
*
* @since New in 1.3.
*/
svn_error_t *
svn_nls_init(void);
#ifdef __cplusplus
}
#endif /* __cplusplus */
#endif /* SVN_NLS_H */

View File

@ -0,0 +1,779 @@
/**
* @copyright
* ====================================================================
* Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements. See the NOTICE file
* distributed with this work for additional information
* regarding copyright ownership. The ASF licenses this file
* to you under the Apache License, Version 2.0 (the
* "License"); you may not use this file except in compliance
* with the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing,
* software distributed under the License is distributed on an
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
* KIND, either express or implied. See the License for the
* specific language governing permissions and limitations
* under the License.
* ====================================================================
* @endcopyright
*
* @file svn_opt.h
* @brief Option and argument parsing for Subversion command lines
*/
#ifndef SVN_OPTS_H
#define SVN_OPTS_H
#include <apr.h>
#include <apr_pools.h>
#include <apr_getopt.h>
#include <apr_tables.h>
#include <apr_hash.h>
#ifndef DOXYGEN_SHOULD_SKIP_THIS
#define APR_WANT_STDIO
#endif
#include <apr_want.h> /* for FILE* */
#include "svn_types.h"
#ifdef __cplusplus
extern "C" {
#endif /* __cplusplus */
/**
* All subcommand procedures in Subversion conform to this prototype.
*
* @a os is the apr option state after getopt processing has been run; in
* other words, it still contains the non-option arguments following
* the subcommand. See @a os->argv and @a os->ind.
*
* @a baton is anything you need it to be.
*
* @a pool is used for allocating errors, and for any other allocation
* unless the instance is explicitly documented to allocate from a
* pool in @a baton.
*/
typedef svn_error_t *(svn_opt_subcommand_t)(
apr_getopt_t *os, void *baton, apr_pool_t *pool);
/** The maximum number of aliases a subcommand can have. */
#define SVN_OPT_MAX_ALIASES 3
/** The maximum number of options that can be accepted by a subcommand. */
#define SVN_OPT_MAX_OPTIONS 50
/** Options that have no short option char should use an identifying
* integer equal to or greater than this.
*/
#define SVN_OPT_FIRST_LONGOPT_ID 256
/** One element of a subcommand dispatch table.
*
* @since New in 1.4.
*/
typedef struct svn_opt_subcommand_desc2_t
{
/** The full name of this command. */
const char *name;
/** The function this command invokes. */
svn_opt_subcommand_t *cmd_func;
/** A list of alias names for this command (e.g., 'up' for 'update'). */
const char *aliases[SVN_OPT_MAX_ALIASES];
/** A brief string describing this command, for usage messages. */
const char *help;
/** A list of options accepted by this command. Each value in the
* array is a unique enum (the 2nd field in apr_getopt_option_t)
*/
int valid_options[SVN_OPT_MAX_OPTIONS];
/** A list of option help descriptions, keyed by the option unique enum
* (the 2nd field in apr_getopt_option_t), which override the generic
* descriptions given in an apr_getopt_option_t on a per-subcommand basis.
*/
struct { int optch; const char *desc; } desc_overrides[SVN_OPT_MAX_OPTIONS];
} svn_opt_subcommand_desc2_t;
/** One element of a subcommand dispatch table.
*
* @deprecated Provided for backward compatibility with the 1.3 API.
*
* Like #svn_opt_subcommand_desc2_t but lacking the @c desc_overrides
* member.
*/
typedef struct svn_opt_subcommand_desc_t
{
/** The full name of this command. */
const char *name;
/** The function this command invokes. */
svn_opt_subcommand_t *cmd_func;
/** A list of alias names for this command (e.g., 'up' for 'update'). */
const char *aliases[SVN_OPT_MAX_ALIASES];
/** A brief string describing this command, for usage messages. */
const char *help;
/** A list of options accepted by this command. Each value in the
* array is a unique enum (the 2nd field in apr_getopt_option_t)
*/
int valid_options[SVN_OPT_MAX_OPTIONS];
} svn_opt_subcommand_desc_t;
/**
* Return the entry in @a table whose name matches @a cmd_name, or @c NULL if
* none. @a cmd_name may be an alias.
*
* @since New in 1.4.
*/
const svn_opt_subcommand_desc2_t *
svn_opt_get_canonical_subcommand2(const svn_opt_subcommand_desc2_t *table,
const char *cmd_name);
/**
* Return the entry in @a table whose name matches @a cmd_name, or @c NULL if
* none. @a cmd_name may be an alias.
*
* Same as svn_opt_get_canonical_subcommand2(), but acts on
* #svn_opt_subcommand_desc_t.
*
* @deprecated Provided for backward compatibility with the 1.3 API.
*/
SVN_DEPRECATED
const svn_opt_subcommand_desc_t *
svn_opt_get_canonical_subcommand(const svn_opt_subcommand_desc_t *table,
const char *cmd_name);
/**
* Return pointer to an @c apr_getopt_option_t for the option whose
* option code is @a code, or @c NULL if no match. @a option_table must end
* with an element whose every field is zero. If @a command is non-NULL,
* then return the subcommand-specific option description instead of the
* generic one, if a specific description is defined.
*
* The returned value may be statically allocated, or allocated in @a pool.
*
* @since New in 1.4.
*/
const apr_getopt_option_t *
svn_opt_get_option_from_code2(int code,
const apr_getopt_option_t *option_table,
const svn_opt_subcommand_desc2_t *command,
apr_pool_t *pool);
/**
* Return the first entry from @a option_table whose option code is @a code,
* or @c NULL if no match. @a option_table must end with an element whose
* every field is zero.
*
* @deprecated Provided for backward compatibility with the 1.3 API.
*/
SVN_DEPRECATED
const apr_getopt_option_t *
svn_opt_get_option_from_code(int code,
const apr_getopt_option_t *option_table);
/**
* Return @c TRUE iff subcommand @a command supports option @a
* option_code, else return @c FALSE. If @a global_options is
* non-NULL, it is a zero-terminated array, and all subcommands take
* the options listed in it.
*
* @since New in 1.5.
*/
svn_boolean_t
svn_opt_subcommand_takes_option3(const svn_opt_subcommand_desc2_t *command,
int option_code,
const int *global_options);
/**
* Same as svn_opt_subcommand_takes_option3(), but with @c NULL for @a
* global_options.
*
* @deprecated Provided for backward compatibility with the 1.4 API.
*/
SVN_DEPRECATED
svn_boolean_t
svn_opt_subcommand_takes_option2(const svn_opt_subcommand_desc2_t *command,
int option_code);
/**
* Return @c TRUE iff subcommand @a command supports option @a option_code,
* else return @c FALSE.
*
* Same as svn_opt_subcommand_takes_option2(), but acts on
* #svn_opt_subcommand_desc_t.
*
* @deprecated Provided for backward compatibility with the 1.3 API.
*/
SVN_DEPRECATED
svn_boolean_t
svn_opt_subcommand_takes_option(const svn_opt_subcommand_desc_t *command,
int option_code);
/**
* Print a generic (not command-specific) usage message to @a stream.
*
* ### @todo Why is @a stream a stdio file instead of an svn stream?
*
* If @a header is non-NULL, print @a header followed by a newline. Then
* loop over @a cmd_table printing the usage for each command (getting
* option usages from @a opt_table). Then if @a footer is non-NULL, print
* @a footer followed by a newline.
*
* Use @a pool for temporary allocation.
*
* @since New in 1.4.
*/
void
svn_opt_print_generic_help2(const char *header,
const svn_opt_subcommand_desc2_t *cmd_table,
const apr_getopt_option_t *opt_table,
const char *footer,
apr_pool_t *pool,
FILE *stream);
/**
* Same as svn_opt_print_generic_help2(), but acts on
* #svn_opt_subcommand_desc_t.
*
* @deprecated Provided for backward compatibility with the 1.3 API.
*/
SVN_DEPRECATED
void
svn_opt_print_generic_help(const char *header,
const svn_opt_subcommand_desc_t *cmd_table,
const apr_getopt_option_t *opt_table,
const char *footer,
apr_pool_t *pool,
FILE *stream);
/**
* Print an option @a opt nicely into a @a string allocated in @a pool.
* If @a doc is set, include the generic documentation string of @a opt,
* localized to the current locale if a translation is available.
*/
void
svn_opt_format_option(const char **string,
const apr_getopt_option_t *opt,
svn_boolean_t doc,
apr_pool_t *pool);
/**
* Get @a subcommand's usage from @a table, and print it to @c stdout.
* Obtain option usage from @a options_table. If not @c NULL, @a
* global_options is a zero-terminated list of global options. Use @a
* pool for temporary allocation. @a subcommand may be a canonical
* command name or an alias. ### @todo Why does this only print to
* @c stdout, whereas svn_opt_print_generic_help() gives us a choice?
*
* When printing the description of an option, if the same option code
* appears a second time in @a options_table with a different name, then
* use that second name as an alias for the first name. This additional
* behaviour is new in 1.7.
*
* @since New in 1.5.
*/
void
svn_opt_subcommand_help3(const char *subcommand,
const svn_opt_subcommand_desc2_t *table,
const apr_getopt_option_t *options_table,
const int *global_options,
apr_pool_t *pool);
/**
* Same as svn_opt_subcommand_help3(), but with @a global_options
* always NULL.
*
* @deprecated Provided for backward compatibility with the 1.4 API.
*/
SVN_DEPRECATED
void
svn_opt_subcommand_help2(const char *subcommand,
const svn_opt_subcommand_desc2_t *table,
const apr_getopt_option_t *options_table,
apr_pool_t *pool);
/**
* Same as svn_opt_subcommand_help2(), but acts on
* #svn_opt_subcommand_desc_t.
*
* @deprecated Provided for backward compatibility with the 1.3 API.
*/
SVN_DEPRECATED
void
svn_opt_subcommand_help(const char *subcommand,
const svn_opt_subcommand_desc_t *table,
const apr_getopt_option_t *options_table,
apr_pool_t *pool);
/* Parsing revision and date options. */
/**
* Various ways of specifying revisions.
*
* @note
* In contexts where local mods are relevant, the `working' kind
* refers to the uncommitted "working" revision, which may be modified
* with respect to its base revision. In other contexts, `working'
* should behave the same as `committed' or `current'.
*/
enum svn_opt_revision_kind {
/** No revision information given. */
svn_opt_revision_unspecified,
/** revision given as number */
svn_opt_revision_number,
/** revision given as date */
svn_opt_revision_date,
/** rev of most recent change */
svn_opt_revision_committed,
/** (rev of most recent change) - 1 */
svn_opt_revision_previous,
/** .svn/entries current revision */
svn_opt_revision_base,
/** current, plus local mods */
svn_opt_revision_working,
/** repository youngest */
svn_opt_revision_head
/* please update svn_opt__revision_to_string() when extending this enum */
};
/**
* A revision value, which can be specified as a number or a date.
*
* @note This union was formerly an anonymous inline type in
* @c svn_opt_revision_t, and was converted to a named type just to
* make things easier for SWIG.
*
* @since New in 1.3.
*/
typedef union svn_opt_revision_value_t
{
/** The revision number */
svn_revnum_t number;
/** the date of the revision */
apr_time_t date;
} svn_opt_revision_value_t;
/** A revision, specified in one of @c svn_opt_revision_kind ways. */
typedef struct svn_opt_revision_t
{
enum svn_opt_revision_kind kind; /**< See svn_opt_revision_kind */
svn_opt_revision_value_t value; /**< Extra data qualifying the @c kind */
} svn_opt_revision_t;
/** A revision range, specified in one of @c svn_opt_revision_kind ways. */
typedef struct svn_opt_revision_range_t
{
/** The first revision in the range */
svn_opt_revision_t start;
/** The last revision in the range */
svn_opt_revision_t end;
} svn_opt_revision_range_t;
/**
* Set @a *start_revision and/or @a *end_revision according to @a arg,
* where @a arg is "N" or "N:M", like so:
*
* - If @a arg is "N", set @a *start_revision to represent N, and
* leave @a *end_revision untouched.
*
* - If @a arg is "N:M", set @a *start_revision and @a *end_revision
* to represent N and M respectively.
*
* N and/or M may be one of the special revision descriptors
* recognized by revision_from_word(), or a date in curly braces.
*
* If @a arg is invalid, return -1; else return 0.
* It is invalid to omit a revision (as in, ":", "N:" or ":M").
*
* @note It is typical, though not required, for @a *start_revision and
* @a *end_revision to be @c svn_opt_revision_unspecified kind on entry.
*
* Use @a pool for temporary allocations.
*/
int
svn_opt_parse_revision(svn_opt_revision_t *start_revision,
svn_opt_revision_t *end_revision,
const char *arg,
apr_pool_t *pool);
/**
* Parse @a arg, where @a arg is "N" or "N:M", into a
* @c svn_opt_revision_range_t and push that onto @a opt_ranges.
*
* - If @a arg is "N", set the @c start field of the
* @c svn_opt_revision_range_t to represent N and the @c end field
* to @c svn_opt_revision_unspecified.
*
* - If @a arg is "N:M", set the @c start field of the
* @c svn_opt_revision_range_t to represent N and the @c end field
* to represent M.
*
* If @a arg is invalid, return -1; else return 0. It is invalid to omit
* a revision (as in, ":", "N:" or ":M").
*
* Use @a pool to allocate @c svn_opt_revision_range_t pushed to the array.
*
* @since New in 1.5.
*/
int
svn_opt_parse_revision_to_range(apr_array_header_t *opt_ranges,
const char *arg,
apr_pool_t *pool);
/**
* Resolve peg revisions and operational revisions in the following way:
*
* - If @a is_url is set and @a peg_rev->kind is
* @c svn_opt_revision_unspecified, @a peg_rev->kind defaults to
* @c svn_opt_revision_head.
*
* - If @a is_url is not set, and @a peg_rev->kind is
* @c svn_opt_revision_unspecified, @a peg_rev->kind defaults to
* @c svn_opt_revision_base.
*
* - If @a op_rev->kind is @c svn_opt_revision_unspecified, @a op_rev
* defaults to @a peg_rev.
*
* Both @a peg_rev and @a op_rev may be modified as a result of this
* function. @a is_url should be set if the path the revisions refer to is
* a url, and unset otherwise.
*
* If @a notice_local_mods is set, @c svn_opt_revision_working is used,
* instead of @c svn_opt_revision_base.
*
* Use @a pool for allocations.
*
* @since New in 1.5.
*/
svn_error_t *
svn_opt_resolve_revisions(svn_opt_revision_t *peg_rev,
svn_opt_revision_t *op_rev,
svn_boolean_t is_url,
svn_boolean_t notice_local_mods,
apr_pool_t *pool);
/* Parsing arguments. */
/**
* Pull remaining target arguments from @a os into @a *targets_p,
* converting them to UTF-8, followed by targets from @a known_targets
* (which might come from, for example, the "--targets" command line
* option), which are already in UTF-8.
*
* On each URL target, do some IRI-to-URI encoding and some
* auto-escaping. On each local path, canonicalize case and path
* separators.
*
* Allocate @a *targets_p and its elements in @a pool.
*
* If a path has the same name as a Subversion working copy
* administrative directory, return SVN_ERR_RESERVED_FILENAME_SPECIFIED;
* if multiple reserved paths are encountered, return a chain of
* errors, all of which are SVN_ERR_RESERVED_FILENAME_SPECIFIED. Do
* not return this type of error in a chain with any other type of
* error, and if this is the only type of error encountered, complete
* the operation before returning the error(s).
*
* @deprecated Provided for backward compatibility with the 1.5 API.
* @see svn_client_args_to_target_array()
*/
SVN_DEPRECATED
svn_error_t *
svn_opt_args_to_target_array3(apr_array_header_t **targets_p,
apr_getopt_t *os,
const apr_array_header_t *known_targets,
apr_pool_t *pool);
/**
* This is the same as svn_opt_args_to_target_array3() except that it
* silently ignores paths that have the same name as a working copy
* administrative directory.
*
* @since New in 1.2.
*
* @deprecated Provided for backward compatibility with the 1.4 API.
*/
SVN_DEPRECATED
svn_error_t *
svn_opt_args_to_target_array2(apr_array_header_t **targets_p,
apr_getopt_t *os,
const apr_array_header_t *known_targets,
apr_pool_t *pool);
/**
* The same as svn_opt_args_to_target_array2() except that, in
* addition, if @a extract_revisions is set, then look for trailing
* "@rev" syntax on the first two paths. If the first target in @a
* *targets_p ends in "@rev", replace it with a canonicalized version of
* the part before "@rev" and replace @a *start_revision with the value
* of "rev". If the second target in @a *targets_p ends in "@rev",
* replace it with a canonicalized version of the part before "@rev"
* and replace @a *end_revision with the value of "rev". Ignore
* revision specifiers on any further paths. "rev" can be any form of
* single revision specifier, as accepted by svn_opt_parse_revision().
*
* @deprecated Provided for backward compatibility with the 1.1 API.
*/
SVN_DEPRECATED
svn_error_t *
svn_opt_args_to_target_array(apr_array_header_t **targets_p,
apr_getopt_t *os,
const apr_array_header_t *known_targets,
svn_opt_revision_t *start_revision,
svn_opt_revision_t *end_revision,
svn_boolean_t extract_revisions,
apr_pool_t *pool);
/**
* Parse revprop key/value pair from @a revprop_spec (name[=value]) into
* @a revprops, making copies of both with @a pool. If @a revprops is
* @c NULL, allocate a new apr_hash_t in it. @a revprops maps
* const char * revprop names to svn_string_t * revprop values for use
* with svn_repos_get_commit_editor5 and other get_commit_editor APIs.
*
* @since New in 1.6.
*/
svn_error_t *
svn_opt_parse_revprop(apr_hash_t **revprops, const char *revprop_spec,
apr_pool_t *pool);
/**
* If no targets exist in @a *targets, add `.' as the lone target.
*
* (Some commands take an implicit "." string argument when invoked
* with no arguments. Those commands make use of this function to
* add "." to the target array if the user passes no args.)
*/
void
svn_opt_push_implicit_dot_target(apr_array_header_t *targets,
apr_pool_t *pool);
/**
* Parse @a num_args non-target arguments from the list of arguments in
* @a os->argv, return them as <tt>const char *</tt> in @a *args_p, without
* doing any UTF-8 conversion. Allocate @a *args_p and its values in @a pool.
*/
svn_error_t *
svn_opt_parse_num_args(apr_array_header_t **args_p,
apr_getopt_t *os,
int num_args,
apr_pool_t *pool);
/**
* Parse all remaining arguments from @a os->argv, return them as
* <tt>const char *</tt> in @a *args_p, without doing any UTF-8 conversion.
* Allocate @a *args_p and its values in @a pool.
*/
svn_error_t *
svn_opt_parse_all_args(apr_array_header_t **args_p,
apr_getopt_t *os,
apr_pool_t *pool);
/**
* Parse a working-copy path or URL in @a path, extracting any trailing
* revision specifier of the form "@rev" from the last component of
* the path.
*
* Some examples would be:
*
* - "foo/bar" -> "foo/bar", (unspecified)
* - "foo/bar@13" -> "foo/bar", (number, 13)
* - "foo/bar@HEAD" -> "foo/bar", (head)
* - "foo/bar@{1999-12-31}" -> "foo/bar", (date, 1999-12-31)
* - "http://a/b@27" -> "http://a/b", (number, 27)
* - "http://a/b@COMMITTED" -> "http://a/b", (committed) [*]
* - "http://a/b@{1999-12-31}" -> "http://a/b", (date, 1999-12-31)
* - "http://a/b@%7B1999-12-31%7D" -> "http://a/b", (date, 1999-12-31)
* - "foo/bar@1:2" -> error
* - "foo/bar@baz" -> error
* - "foo/bar@" -> "foo/bar", (unspecified)
* - "foo/@bar@" -> "foo/@bar", (unspecified)
* - "foo/bar/@13" -> "foo/bar/", (number, 13)
* - "foo/bar@@13" -> "foo/bar@", (number, 13)
* - "foo/@bar@HEAD" -> "foo/@bar", (head)
* - "foo@/bar" -> "foo@/bar", (unspecified)
* - "foo@HEAD/bar" -> "foo@HEAD/bar", (unspecified)
* - "@foo/bar" -> "@foo/bar", (unspecified)
* - "@foo/bar@" -> "@foo/bar", (unspecified)
*
* [*] Syntactically valid but probably not semantically useful.
*
* If a trailing revision specifier is found, parse it into @a *rev and
* put the rest of the path into @a *truepath, allocating from @a pool;
* or return an @c SVN_ERR_CL_ARG_PARSING_ERROR (with the effect on
* @a *truepath undefined) if the revision specifier is invalid.
* If no trailing revision specifier is found, set @a *truepath to
* @a path and @a rev->kind to @c svn_opt_revision_unspecified.
*
* This function does not require that @a path be in canonical form.
* No canonicalization is done and @a *truepath will only be in
* canonical form if @a path is in canonical form.
*
* @since New in 1.1.
*/
svn_error_t *
svn_opt_parse_path(svn_opt_revision_t *rev,
const char **truepath,
const char *path,
apr_pool_t *pool);
/**
* Central dispatcher function for various kinds of help message.
* Prints one of:
* * subcommand-specific help (svn_opt_subcommand_help)
* * generic help (svn_opt_print_generic_help)
* * version info
* * simple usage complaint: "Type '@a pgm_name help' for usage."
*
* If @a os is not @c NULL and it contains arguments, then try
* printing help for them as though they are subcommands, using @a
* cmd_table and @a option_table for option information. If not @c
* NULL, @a global_options is a zero-terminated array of options taken
* by all subcommands.
*
* Else, if @a print_version is TRUE, then print version info, in
* brief form if @a quiet is also TRUE; if @a quiet is FALSE, then if
* @a version_footer is non-NULL, print it following the version
* information. If @a verbose is TRUE, also print information about
* the running system and loaded shared libraries, where available.
*
* Else, if @a os is not @c NULL and does not contain arguments, print
* generic help, via svn_opt_print_generic_help2() with the @a header,
* @a cmd_table, @a option_table, and @a footer arguments.
*
* Else, when @a os is @c NULL, print the simple usage complaint.
*
* Use @a pool for temporary allocations.
*
* Notes: The reason this function handles both version printing and
* general usage help is that a confused user might put both the
* --version flag *and* subcommand arguments on a help command line.
* The logic for handling such a situation should be in one place.
*
* @since New in 1.8.
*/
svn_error_t *
svn_opt_print_help4(apr_getopt_t *os,
const char *pgm_name,
svn_boolean_t print_version,
svn_boolean_t quiet,
svn_boolean_t verbose,
const char *version_footer,
const char *header,
const svn_opt_subcommand_desc2_t *cmd_table,
const apr_getopt_option_t *option_table,
const int *global_options,
const char *footer,
apr_pool_t *pool);
/**
* Same as svn_opt_print_help4(), but with @a verbose always @c FALSE.
*
* @deprecated Provided for backward compatibility with the 1.7 API.
*/
SVN_DEPRECATED
svn_error_t *
svn_opt_print_help3(apr_getopt_t *os,
const char *pgm_name,
svn_boolean_t print_version,
svn_boolean_t quiet,
const char *version_footer,
const char *header,
const svn_opt_subcommand_desc2_t *cmd_table,
const apr_getopt_option_t *option_table,
const int *global_options,
const char *footer,
apr_pool_t *pool);
/**
* Same as svn_opt_print_help3(), but with @a global_options always @c
* NULL.
*
* @deprecated Provided for backward compatibility with the 1.4 API.
*/
SVN_DEPRECATED
svn_error_t *
svn_opt_print_help2(apr_getopt_t *os,
const char *pgm_name,
svn_boolean_t print_version,
svn_boolean_t quiet,
const char *version_footer,
const char *header,
const svn_opt_subcommand_desc2_t *cmd_table,
const apr_getopt_option_t *option_table,
const char *footer,
apr_pool_t *pool);
/**
* Same as svn_opt_print_help2(), but acts on #svn_opt_subcommand_desc_t.
*
* @deprecated Provided for backward compatibility with the 1.3 API.
*/
SVN_DEPRECATED
svn_error_t *
svn_opt_print_help(apr_getopt_t *os,
const char *pgm_name,
svn_boolean_t print_version,
svn_boolean_t quiet,
const char *version_footer,
const char *header,
const svn_opt_subcommand_desc_t *cmd_table,
const apr_getopt_option_t *option_table,
const char *footer,
apr_pool_t *pool);
#ifdef __cplusplus
}
#endif /* __cplusplus */
#endif /* SVN_OPTS_H */

View File

@ -0,0 +1,734 @@
/**
* @copyright
* ====================================================================
* Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements. See the NOTICE file
* distributed with this work for additional information
* regarding copyright ownership. The ASF licenses this file
* to you under the Apache License, Version 2.0 (the
* "License"); you may not use this file except in compliance
* with the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing,
* software distributed under the License is distributed on an
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
* KIND, either express or implied. See the License for the
* specific language governing permissions and limitations
* under the License.
* ====================================================================
* @endcopyright
*
* @file svn_path.h
* @brief A path manipulation library
*
* All incoming and outgoing paths are non-NULL and in UTF-8, unless
* otherwise documented.
*
* No result path ever ends with a separator, no matter whether the
* path is a file or directory, because we always canonicalize() it.
*
* Nearly all the @c svn_path_xxx functions expect paths passed into
* them to be in canonical form as defined by the Subversion path
* library itself. The only functions which do *not* have such
* expectations are:
*
* - @c svn_path_canonicalize()
* - @c svn_path_is_canonical()
* - @c svn_path_internal_style()
* - @c svn_path_uri_encode()
*
* For the most part, we mean what most anyone would mean when talking
* about canonical paths, but to be on the safe side, you must run
* your paths through @c svn_path_canonicalize() before passing them to
* other functions in this API.
*/
#ifndef SVN_PATH_H
#define SVN_PATH_H
#include <apr.h>
#include <apr_pools.h>
#include <apr_tables.h>
#include "svn_types.h"
#include "svn_string.h"
#include "svn_dirent_uri.h"
#ifdef __cplusplus
extern "C" {
#endif /* __cplusplus */
/** Convert @a path from the local style to the canonical internal style.
*
* @deprecated Provided for backward compatibility with the 1.6 API.
* New code should use svn_dirent_internal_style().
*/
SVN_DEPRECATED
const char *
svn_path_internal_style(const char *path, apr_pool_t *pool);
/** Convert @a path from the canonical internal style to the local style.
*
* @deprecated Provided for backward compatibility with the 1.6 API.
* New code should use svn_dirent_local_style().
*/
SVN_DEPRECATED
const char *
svn_path_local_style(const char *path, apr_pool_t *pool);
/** Join a base path (@a base) with a component (@a component), allocating
* the result in @a pool. @a component need not be a single component: it
* can be any path, absolute or relative to @a base.
*
* If either @a base or @a component is the empty path, then the other
* argument will be copied and returned. If both are the empty path the
* empty path is returned.
*
* If the @a component is an absolute path, then it is copied and returned.
* Exactly one slash character ('/') is used to join the components,
* accounting for any trailing slash in @a base.
*
* Note that the contents of @a base are not examined, so it is possible to
* use this function for constructing URLs, or for relative URLs or
* repository paths.
*
* This function is NOT appropriate for native (local) file
* paths. Only for "internal" canonicalized paths, since it uses '/'
* for the separator. Further, an absolute path (for @a component) is
* based on a leading '/' character. Thus, an "absolute URI" for the
* @a component won't be detected. An absolute URI can only be used
* for the base.
*
* @deprecated Provided for backward compatibility with the 1.6 API.
* New code should use svn_dirent_join(), svn_relpath_join() or
* svn_fspath__join().
*/
SVN_DEPRECATED
char *
svn_path_join(const char *base, const char *component, apr_pool_t *pool);
/** Join multiple components onto a @a base path, allocated in @a pool. The
* components are terminated by a @c NULL.
*
* If any component is the empty string, it will be ignored.
*
* If any component is an absolute path, then it resets the base and
* further components will be appended to it.
*
* This function does not support URLs.
*
* See svn_path_join() for further notes about joining paths.
*
* @deprecated Provided for backward compatibility with the 1.6 API.
* For new code, consider using svn_dirent_join_many() or a sequence of
* calls to one of the *_join() functions.
*/
SVN_DEPRECATED
char *
svn_path_join_many(apr_pool_t *pool, const char *base, ...);
/** Get the basename of the specified canonicalized @a path. The
* basename is defined as the last component of the path (ignoring any
* trailing slashes). If the @a path is root ("/"), then that is
* returned. Otherwise, the returned value will have no slashes in
* it.
*
* Example: svn_path_basename("/foo/bar") -> "bar"
*
* The returned basename will be allocated in @a pool.
*
* @note If an empty string is passed, then an empty string will be returned.
*
* @deprecated Provided for backward compatibility with the 1.6 API.
* New code should use svn_dirent_basename(), svn_uri_basename(),
* svn_relpath_basename() or svn_fspath__basename().
*/
SVN_DEPRECATED
char *
svn_path_basename(const char *path, apr_pool_t *pool);
/** Get the dirname of the specified canonicalized @a path, defined as
* the path with its basename removed. If @a path is root ("/"), it is
* returned unchanged.
*
* The returned dirname will be allocated in @a pool.
*
* @deprecated Provided for backward compatibility with the 1.6 API.
* New code should use svn_dirent_dirname(), svn_uri_dirname(),
* svn_relpath_dirname() or svn_fspath__dirname().
*/
SVN_DEPRECATED
char *
svn_path_dirname(const char *path, apr_pool_t *pool);
/** Split @a path into a root portion and an extension such that
* the root + the extension = the original path, and where the
* extension contains no period (.) characters. If not @c NULL, set
* @a *path_root to the root portion. If not @c NULL, set
* @a *path_ext to the extension (or "" if there is no extension
* found). Allocate both @a *path_root and @a *path_ext in @a pool.
*
* @since New in 1.5.
*/
void
svn_path_splitext(const char **path_root, const char **path_ext,
const char *path, apr_pool_t *pool);
/** Return the number of components in the canonicalized @a path.
*
* @since New in 1.1.
*/
apr_size_t
svn_path_component_count(const char *path);
/** Add a @a component (a NULL-terminated C-string) to the
* canonicalized @a path. @a component is allowed to contain
* directory separators.
*
* If @a path is non-empty, append the appropriate directory separator
* character, and then @a component. If @a path is empty, simply set it to
* @a component; don't add any separator character.
*
* If the result ends in a separator character, then remove the separator.
*/
void
svn_path_add_component(svn_stringbuf_t *path, const char *component);
/** Remove one component off the end of the canonicalized @a path. */
void
svn_path_remove_component(svn_stringbuf_t *path);
/** Remove @a n components off the end of the canonicalized @a path.
* Equivalent to calling svn_path_remove_component() @a n times.
*
* @since New in 1.1.
*/
void
svn_path_remove_components(svn_stringbuf_t *path, apr_size_t n);
/** Divide the canonicalized @a path into @a *dirpath and @a
* *base_name, allocated in @a pool.
*
* If @a dirpath or @a base_name is NULL, then don't set that one.
*
* Either @a dirpath or @a base_name may be @a path's own address, but they
* may not both be the same address, or the results are undefined.
*
* If @a path has two or more components, the separator between @a dirpath
* and @a base_name is not included in either of the new names.
*
* examples:
* - <pre>"/foo/bar/baz" ==> "/foo/bar" and "baz"</pre>
* - <pre>"/bar" ==> "/" and "bar"</pre>
* - <pre>"/" ==> "/" and "/"</pre>
* - <pre>"X:/" ==> "X:/" and "X:/"</pre>
* - <pre>"bar" ==> "" and "bar"</pre>
* - <pre>"" ==> "" and ""</pre>
*
* @deprecated Provided for backward compatibility with the 1.6 API.
* New code should use svn_dirent_split(), svn_uri_split(),
* svn_relpath_split() or svn_fspath__split().
*/
SVN_DEPRECATED
void
svn_path_split(const char *path,
const char **dirpath,
const char **base_name,
apr_pool_t *pool);
/** Return non-zero iff @a path is empty ("") or represents the current
* directory -- that is, if prepending it as a component to an existing
* path would result in no meaningful change.
*/
int
svn_path_is_empty(const char *path);
#ifndef SVN_DIRENT_URI_H
/* This declaration has been moved to svn_dirent_uri.h, and remains
here only for compatibility reasons. */
svn_boolean_t
svn_dirent_is_root(const char *dirent, apr_size_t len);
#endif /* SVN_DIRENT_URI_H */
/** Return a new path (or URL) like @a path, but transformed such that
* some types of path specification redundancies are removed.
*
* This involves collapsing redundant "/./" elements, removing
* multiple adjacent separator characters, removing trailing
* separator characters, and possibly other semantically inoperative
* transformations.
*
* Convert the scheme and hostname to lowercase (see issue #2475)
*
* The returned path may be statically allocated, equal to @a path, or
* allocated from @a pool.
*
* @deprecated Provided for backward compatibility with the 1.6 API.
* New code should use svn_dirent_canonicalize(), svn_uri_canonicalize(),
* svn_relpath_canonicalize() or svn_fspath__canonicalize().
*/
SVN_DEPRECATED
const char *
svn_path_canonicalize(const char *path, apr_pool_t *pool);
/** Return @c TRUE iff path is canonical. Use @a pool for temporary
* allocations.
*
* @since New in 1.5.
* @deprecated Provided for backward compatibility with the 1.6 API.
* New code should use svn_dirent_is_canonical(), svn_uri_is_canonical(),
* svn_relpath_is_canonical() or svn_fspath__is_canonical().
*/
SVN_DEPRECATED
svn_boolean_t
svn_path_is_canonical(const char *path, apr_pool_t *pool);
/** Return an integer greater than, equal to, or less than 0, according
* as @a path1 is greater than, equal to, or less than @a path2.
*
* This function works like strcmp() except that it orders children in
* subdirectories directly after their parents. This allows using the
* given ordering for a depth first walk.
*/
int
svn_path_compare_paths(const char *path1, const char *path2);
/** Return the longest common path shared by two canonicalized paths,
* @a path1 and @a path2. If there's no common ancestor, return the
* empty path.
*
* @a path1 and @a path2 may be URLs. In order for two URLs to have
* a common ancestor, they must (a) have the same protocol (since two URLs
* with the same path but different protocols may point at completely
* different resources), and (b) share a common ancestor in their path
* component, i.e. 'protocol://' is not a sufficient ancestor.
*
* @deprecated Provided for backward compatibility with the 1.6 API.
* New code should use svn_dirent_get_longest_ancestor(),
* svn_uri_get_longest_ancestor(), svn_relpath_get_longest_ancestor() or
* svn_fspath__get_longest_ancestor().
*/
SVN_DEPRECATED
char *
svn_path_get_longest_ancestor(const char *path1,
const char *path2,
apr_pool_t *pool);
/** Convert @a relative canonicalized path to an absolute path and
* return the results in @a *pabsolute, allocated in @a pool.
*
* @a relative may be a URL, in which case no attempt is made to convert it,
* and a copy of the URL is returned.
*
* @deprecated Provided for backward compatibility with the 1.6 API.
* New code should use svn_dirent_get_absolute() on a non-URL input.
*/
SVN_DEPRECATED
svn_error_t *
svn_path_get_absolute(const char **pabsolute,
const char *relative,
apr_pool_t *pool);
/** Return the path part of the canonicalized @a path in @a
* *pdirectory, and the file part in @a *pfile. If @a path is a
* directory, set @a *pdirectory to @a path, and @a *pfile to the
* empty string. If @a path does not exist it is treated as if it is
* a file, since directories do not normally vanish.
*
* @deprecated Provided for backward compatibility with the 1.6 API.
* New code should implement the required logic directly; no direct
* replacement is provided.
*/
SVN_DEPRECATED
svn_error_t *
svn_path_split_if_file(const char *path,
const char **pdirectory,
const char **pfile,
apr_pool_t *pool);
/** Find the common prefix of the canonicalized paths in @a targets
* (an array of <tt>const char *</tt>'s), and remove redundant paths if @a
* remove_redundancies is TRUE.
*
* - Set @a *pcommon to the absolute path of the path or URL common to
* all of the targets. If the targets have no common prefix, or
* are a mix of URLs and local paths, set @a *pcommon to the
* empty string.
*
* - If @a pcondensed_targets is non-NULL, set @a *pcondensed_targets
* to an array of targets relative to @a *pcommon, and if
* @a remove_redundancies is TRUE, omit any paths/URLs that are
* descendants of another path/URL in @a targets. If *pcommon
* is empty, @a *pcondensed_targets will contain full URLs and/or
* absolute paths; redundancies can still be removed (from both URLs
* and paths). If @a pcondensed_targets is NULL, leave it alone.
*
* Else if there is exactly one target, then
*
* - Set @a *pcommon to that target, and
*
* - If @a pcondensed_targets is non-NULL, set @a *pcondensed_targets
* to an array containing zero elements. Else if
* @a pcondensed_targets is NULL, leave it alone.
*
* If there are no items in @a targets, set @a *pcommon and (if
* applicable) @a *pcondensed_targets to @c NULL.
*
* @note There is no guarantee that @a *pcommon is within a working
* copy.
*
* @deprecated Provided for backward compatibility with the 1.6 API.
* New code should use svn_dirent_condense_targets() or
* svn_uri_condense_targets().
*/
SVN_DEPRECATED
svn_error_t *
svn_path_condense_targets(const char **pcommon,
apr_array_header_t **pcondensed_targets,
const apr_array_header_t *targets,
svn_boolean_t remove_redundancies,
apr_pool_t *pool);
/** Copy a list of canonicalized @a targets, one at a time, into @a
* pcondensed_targets, omitting any targets that are found earlier in
* the list, or whose ancestor is found earlier in the list. Ordering
* of targets in the original list is preserved in the condensed list
* of targets. Use @a pool for any allocations.
*
* How does this differ in functionality from svn_path_condense_targets()?
*
* Here's the short version:
*
* 1. Disclaimer: if you wish to debate the following, talk to Karl. :-)
* Order matters for updates because a multi-arg update is not
* atomic, and CVS users are used to, when doing 'cvs up targetA
* targetB' seeing targetA get updated, then targetB. I think the
* idea is that if you're in a time-sensitive or flaky-network
* situation, a user can say, "I really *need* to update
* wc/A/D/G/tau, but I might as well update my whole working copy if
* I can." So that user will do 'svn up wc/A/D/G/tau wc', and if
* something dies in the middles of the 'wc' update, at least the
* user has 'tau' up-to-date.
*
* 2. Also, we have this notion of an anchor and a target for updates
* (the anchor is where the update editor is rooted, the target is
* the actual thing we want to update). I needed a function that
* would NOT screw with my input paths so that I could tell the
* difference between someone being in A/D and saying 'svn up G' and
* being in A/D/G and saying 'svn up .' -- believe it or not, these
* two things don't mean the same thing. svn_path_condense_targets()
* plays with absolute paths (which is fine, so does
* svn_path_remove_redundancies()), but the difference is that it
* actually tweaks those targets to be relative to the "grandfather
* path" common to all the targets. Updates don't require a
* "grandfather path" at all, and even if it did, the whole
* conversion to an absolute path drops the crucial difference
* between saying "i'm in foo, update bar" and "i'm in foo/bar,
* update '.'"
*/
svn_error_t *
svn_path_remove_redundancies(apr_array_header_t **pcondensed_targets,
const apr_array_header_t *targets,
apr_pool_t *pool);
/** Decompose the canonicalized @a path into an array of <tt>const
* char *</tt> components, allocated in @a pool. If @a path is
* absolute, the first component will be a lone dir separator (the
* root directory).
*/
apr_array_header_t *
svn_path_decompose(const char *path, apr_pool_t *pool);
/** Join an array of <tt>const char *</tt> components into a '/'
* separated path, allocated in @a pool. The joined path is absolute if
* the first component is a lone dir separator.
*
* Calling svn_path_compose() on the output of svn_path_decompose()
* will return the exact same path.
*
* @since New in 1.5.
*/
const char *
svn_path_compose(const apr_array_header_t *components, apr_pool_t *pool);
/** Test that @a name is a single path component, that is:
* - not @c NULL or empty.
* - not a `/'-separated directory path
* - not empty or `..'
*/
svn_boolean_t
svn_path_is_single_path_component(const char *name);
/**
* Test to see if a backpath, i.e. '..', is present in @a path.
* If not, return @c FALSE.
* If so, return @c TRUE.
*
* @since New in 1.1.
*/
svn_boolean_t
svn_path_is_backpath_present(const char *path);
/**
* Test to see if a dotpath, i.e. '.', is present in @a path.
* If not, return @c FALSE.
* If so, return @c TRUE.
*
* @since New in 1.6.
*/
svn_boolean_t
svn_path_is_dotpath_present(const char *path);
/** Test if @a path2 is a child of @a path1.
* If not, return @c NULL.
* If so, return a copy of the remainder path, allocated in @a pool.
* (The remainder is the component which, added to @a path1, yields
* @a path2. The remainder does not begin with a dir separator.)
*
* Both paths must be in canonical form, and must either be absolute,
* or contain no ".." components.
*
* If @a path2 is the same as @a path1, it is not considered a child, so the
* result is @c NULL; an empty string is never returned.
*
* @note In 1.5 this function has been extended to allow a @c NULL @a pool
* in which case a pointer into @a path2 will be returned to
* identify the remainder path.
*
* @deprecated Provided for backward compatibility with the 1.6 API.
* For replacement functionality, see svn_dirent_skip_ancestor(),
* svn_dirent_is_child(), svn_uri_skip_ancestor(), and
* svn_relpath_skip_ancestor().
*/
SVN_DEPRECATED
const char *
svn_path_is_child(const char *path1, const char *path2, apr_pool_t *pool);
/** Return TRUE if @a path1 is an ancestor of @a path2 or the paths are equal
* and FALSE otherwise.
*
* @since New in 1.3.
*
* @deprecated Provided for backward compatibility with the 1.6 API.
* For replacement functionality, see svn_dirent_skip_ancestor(),
* svn_uri_skip_ancestor(), and svn_relpath_skip_ancestor().
*/
SVN_DEPRECATED
svn_boolean_t
svn_path_is_ancestor(const char *path1, const char *path2);
/**
* Check whether @a path is a valid Subversion path.
*
* A valid Subversion pathname is a UTF-8 string without control
* characters. "Valid" means Subversion can store the pathname in
* a repository. There may be other, OS-specific, limitations on
* what paths can be represented in a working copy.
*
* ASSUMPTION: @a path is a valid UTF-8 string. This function does
* not check UTF-8 validity.
*
* Return @c SVN_NO_ERROR if valid and @c SVN_ERR_FS_PATH_SYNTAX if
* invalid.
*
* @note Despite returning an @c SVN_ERR_FS_* error, this function has
* nothing to do with the versioned filesystem's concept of validity.
*
* @since New in 1.2.
*/
svn_error_t *
svn_path_check_valid(const char *path, apr_pool_t *pool);
/** URI/URL stuff
*
* @defgroup svn_path_uri_stuff URI/URL conversion
* @{
*/
/** Return TRUE iff @a path looks like a valid absolute URL. */
svn_boolean_t
svn_path_is_url(const char *path);
/** Return @c TRUE iff @a path is URI-safe, @c FALSE otherwise. */
svn_boolean_t
svn_path_is_uri_safe(const char *path);
/** Return a URI-encoded copy of @a path, allocated in @a pool. (@a
path can be an arbitrary UTF-8 string and does not have to be a
canonical path.) */
const char *
svn_path_uri_encode(const char *path, apr_pool_t *pool);
/** Return a URI-decoded copy of @a path, allocated in @a pool. */
const char *
svn_path_uri_decode(const char *path, apr_pool_t *pool);
/** Extend @a url by @a component, URI-encoding that @a component
* before adding it to the @a url; return the new @a url, allocated in
* @a pool. If @a component is @c NULL, just return a copy of @a url,
* allocated in @a pool.
*
* @a component need not be a single path segment, but if it contains
* multiple segments, they must be separated by '/'. @a component
* should not begin with '/', however; if it does, the behavior is
* undefined.
*
* @a url must be in canonical format; it may not have a trailing '/'.
*
* @note To add a component that is already URI-encoded, use
* <tt>svn_path_join(url, component, pool)</tt> instead.
*
* @note gstein suggests this for when @a component begins with '/':
*
* "replace the path entirely
* https://example.com:4444/base/path joined with /leading/slash,
* should return: https://example.com:4444/leading/slash
* per the RFCs on combining URIs"
*
* We may implement that someday, which is why leading '/' is
* merely undefined right now.
*
* @since New in 1.6.
*/
const char *
svn_path_url_add_component2(const char *url,
const char *component,
apr_pool_t *pool);
/** Like svn_path_url_add_component2(), but allows path components that
* end with a trailing '/'
*
* @deprecated Provided for backward compatibility with the 1.5 API.
*/
SVN_DEPRECATED
const char *
svn_path_url_add_component(const char *url,
const char *component,
apr_pool_t *pool);
/**
* Convert @a iri (Internationalized URI) to an URI.
* The return value may be the same as @a iri if it was already
* a URI. Else, allocate the return value in @a pool.
*
* @since New in 1.1.
*/
const char *
svn_path_uri_from_iri(const char *iri, apr_pool_t *pool);
/**
* URI-encode certain characters in @a uri that are not valid in an URI, but
* doesn't have any special meaning in @a uri at their positions. If no
* characters need escaping, just return @a uri.
*
* @note Currently, this function escapes <, >, ", space, {, }, |, \, ^, and `.
* This may be extended in the future to do context-dependent escaping.
*
* @since New in 1.1.
*/
const char *
svn_path_uri_autoescape(const char *uri, apr_pool_t *pool);
/** @} */
/** Charset conversion stuff
*
* @defgroup svn_path_charset_stuff Charset conversion
* @{
*/
/** Convert @a path_utf8 from UTF-8 to the internal encoding used by APR. */
svn_error_t *
svn_path_cstring_from_utf8(const char **path_apr,
const char *path_utf8,
apr_pool_t *pool);
/** Convert @a path_apr from the internal encoding used by APR to UTF-8. */
svn_error_t *
svn_path_cstring_to_utf8(const char **path_utf8,
const char *path_apr,
apr_pool_t *pool);
/** @} */
/** Repository relative URLs
*
* @defgroup svn_path_repos_relative_urls Repository relative URLs
* @{
*/
/**
* Return @c TRUE iff @a path is a repository-relative URL: specifically
* that it starts with the characters "^/"
*
* @a path is in UTF-8 encoding.
*
* Does not check whether @a path is a properly URI-encoded, canonical, or
* valid in any other way.
*
* @since New in 1.8.
*/
svn_boolean_t
svn_path_is_repos_relative_url(const char *path);
/**
* Set @a absolute_url to the absolute URL represented by @a relative_url
* relative to @a repos_root_url, preserving any peg revision
* specifier present in @a relative_url. Allocate @a absolute_url
* from @a pool.
*
* @a relative_url is in repository-relative syntax: "^/[REL-URL][@PEG]"
*
* @a repos_root_url is the absolute URL of the repository root.
*
* All strings are in UTF-8 encoding.
*
* @a repos_root_url and @a relative_url do not have to be properly
* URI-encoded, canonical, or valid in any other way. The caller is
* expected to perform canonicalization on @a absolute_url after the
* call to the function.
*
* @since New in 1.8.
*/
svn_error_t *
svn_path_resolve_repos_relative_url(const char **absolute_url,
const char *relative_url,
const char *repos_root_url,
apr_pool_t *pool);
/* Return a copy of @a path, allocated from @a pool, for which control
* characters have been escaped using the form \NNN (where NNN is the
* octal representation of the byte's ordinal value).
*
* @since New in 1.8. */
const char *
svn_path_illegal_path_escape(const char *path, apr_pool_t *pool);
/** @} */
#ifdef __cplusplus
}
#endif /* __cplusplus */
#endif /* SVN_PATH_H */

View File

@ -0,0 +1,114 @@
/**
* @copyright
* ====================================================================
* Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements. See the NOTICE file
* distributed with this work for additional information
* regarding copyright ownership. The ASF licenses this file
* to you under the Apache License, Version 2.0 (the
* "License"); you may not use this file except in compliance
* with the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing,
* software distributed under the License is distributed on an
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
* KIND, either express or implied. See the License for the
* specific language governing permissions and limitations
* under the License.
* ====================================================================
* @endcopyright
*
* @file svn_pools.h
* @brief APR pool management for Subversion
*/
#ifndef SVN_POOLS_H
#define SVN_POOLS_H
#include "svn_types.h"
#ifdef __cplusplus
extern "C" {
#endif /* __cplusplus */
/* Wrappers around APR pools, so we get debugging. */
/** The recommended maximum amount of memory (4MB) to keep in an APR
* allocator on the free list, conveniently defined here to share
* between all our applications.
*/
#define SVN_ALLOCATOR_RECOMMENDED_MAX_FREE (4096 * 1024)
/** Wrapper around apr_pool_create_ex(), with a simpler interface.
* The return pool will have an abort function set, which will call
* abort() on OOM.
*/
apr_pool_t *
svn_pool_create_ex(apr_pool_t *parent_pool,
apr_allocator_t *allocator);
#ifndef DOXYGEN_SHOULD_SKIP_THIS
apr_pool_t *
svn_pool_create_ex_debug(apr_pool_t *parent_pool,
apr_allocator_t *allocator,
const char *file_line);
#if APR_POOL_DEBUG
#define svn_pool_create_ex(pool, allocator) \
svn_pool_create_ex_debug(pool, allocator, APR_POOL__FILE_LINE__)
#endif /* APR_POOL_DEBUG */
#endif /* DOXYGEN_SHOULD_SKIP_THIS */
/** Create a pool as a subpool of @a parent_pool */
#define svn_pool_create(parent_pool) svn_pool_create_ex(parent_pool, NULL)
/** Clear a @a pool destroying its children.
*
* This define for @c svn_pool_clear exists for completeness.
*/
#define svn_pool_clear apr_pool_clear
/** Destroy a @a pool and all of its children.
*
* This define for @c svn_pool_destroy exists for symmetry and
* completeness.
*/
#define svn_pool_destroy apr_pool_destroy
/** Return a new allocator. This function limits the unused memory in the
* new allocator to #SVN_ALLOCATOR_RECOMMENDED_MAX_FREE and ensures
* proper synchronization if the allocator is used by multiple threads.
*
* If your application uses multiple threads, creating a separate
* allocator for each of these threads may not be feasible. Set the
* @a thread_safe parameter to @c TRUE in that case; otherwise, set @a
* thread_safe to @c FALSE to maximize performance.
*
* @note Even if @a thread_safe is @c TRUE, pools themselves will
* still not be thread-safe and their access may require explicit
* serialization.
*
* To access the owner pool, which can also serve as the root pool for
* your sub-pools, call @c apr_allocator_get_owner().
*
* @since: New in 1.8
*/
apr_allocator_t *
svn_pool_create_allocator(svn_boolean_t thread_safe);
#ifdef __cplusplus
}
#endif /* __cplusplus */
#endif /* SVN_POOLS_H */

View File

@ -0,0 +1,714 @@
/**
* @copyright
* ====================================================================
* Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements. See the NOTICE file
* distributed with this work for additional information
* regarding copyright ownership. The ASF licenses this file
* to you under the Apache License, Version 2.0 (the
* "License"); you may not use this file except in compliance
* with the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing,
* software distributed under the License is distributed on an
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
* KIND, either express or implied. See the License for the
* specific language governing permissions and limitations
* under the License.
* ====================================================================
* @endcopyright
*
* @file svn_props.h
* @brief Subversion properties
*/
/* ==================================================================== */
#ifndef SVN_PROPS_H
#define SVN_PROPS_H
#include <apr_pools.h> /* for apr_pool_t */
#include <apr_tables.h> /* for apr_array_header_t */
#include <apr_hash.h> /* for apr_hash_t */
#include "svn_types.h" /* for svn_boolean_t, svn_error_t */
#include "svn_string.h" /* for svn_string_t */
#ifdef __cplusplus
extern "C" {
#endif /* __cplusplus */
/**
* @defgroup svn_props_support Properties management utilities
* @{
*/
/** A general in-memory representation of a single property. Most of
* the time, property lists will be stored completely in hashes. But
* sometimes it's useful to have an "ordered" collection of
* properties, in which case we use an array of these structures.
*
* Also: sometimes we want a list that represents a set of property
* *changes*, and in this case, an @c apr_hash_t won't work -- there's no
* way to represent a property deletion, because we can't store a @c NULL
* value in a hash. So instead, we use these structures.
*/
typedef struct svn_prop_t
{
const char *name; /**< Property name */
const svn_string_t *value; /**< Property value */
} svn_prop_t;
/**
* Return a duplicate of @a prop, allocated in @a pool. No part of the new
* structure will be shared with @a prop.
*
* @since New in 1.3.
*/
svn_prop_t *
svn_prop_dup(const svn_prop_t *prop,
apr_pool_t *pool);
/**
* Duplicate an @a array of svn_prop_t items using @a pool.
*
* @since New in 1.3.
*/
apr_array_header_t *
svn_prop_array_dup(const apr_array_header_t *array,
apr_pool_t *pool);
/** A structure to represent inherited properties.
*
* @since New in 1.8.
*/
typedef struct svn_prop_inherited_item_t
{
/** The absolute working copy path, relative filesystem path, or URL
* from which the properties in @a prop_hash are inherited. (For
* details about which path specification format is in use for a
* particular instance of this structure, consult the documentation
* for the API which produced it.) */
const char *path_or_url;
/** A hash of (<tt>const char *</tt>) inherited property names, and
* (<tt>svn_string_t *</tt>) property values. */
apr_hash_t *prop_hash;
} svn_prop_inherited_item_t;
/**
* Given a hash (keys <tt>const char *</tt> and values <tt>const
* svn_string_t</tt>) of properties, returns an array of svn_prop_t
* items using @a pool.
*
* @since New in 1.5.
*/
apr_array_header_t *
svn_prop_hash_to_array(const apr_hash_t *hash,
apr_pool_t *pool);
/**
* Given an array of svn_prop_t items, return a hash mapping const char *
* property names to const svn_string_t * values.
*
* @warning The behaviour on #svn_prop_t objects with a @c NULL @c
* svn_prop_t.value member is undefined.
*
* @since New in 1.7.
*/
apr_hash_t *
svn_prop_array_to_hash(const apr_array_header_t *properties,
apr_pool_t *result);
/**
* Creates a deep copy of @a hash (keys <tt>const char *</tt> and
* values <tt>const svn_string_t *</tt>) in @a pool.
*
* @since New in 1.6.
*/
apr_hash_t *
svn_prop_hash_dup(const apr_hash_t *hash,
apr_pool_t *pool);
/**
* Return the value of property @a prop_name as it is in @a properties,
* with values <tt>const svn_string_t</tt>. If @a prop_name is not
* in @a properties or @a properties is NULL, return NULL.
*
* @since New in 1.7.
*/
const char *
svn_prop_get_value(const apr_hash_t *properties,
const char *prop_name);
/**
* Subversion distinguishes among several kinds of properties,
* particularly on the client-side. There is no "unknown" kind; if
* there's nothing special about a property name, the default category
* is @c svn_prop_regular_kind.
*/
typedef enum svn_prop_kind
{
/** In .svn/entries, i.e., author, date, etc. */
svn_prop_entry_kind,
/** Client-side only, stored by specific RA layer. */
svn_prop_wc_kind,
/** Seen if user does "svn proplist"; note that this includes some "svn:"
* props and all user props, i.e. ones stored in the repository fs.
*/
svn_prop_regular_kind
} svn_prop_kind_t;
/** Return the property kind of a property named @a prop_name.
*
* @since New in 1.8.
*/
svn_prop_kind_t
svn_property_kind2(const char *prop_name);
/** Return the prop kind of a property named @a prop_name, and
* (if @a prefix_len is non-@c NULL) set @a *prefix_len to the length of
* the prefix of @a prop_name that was sufficient to distinguish its kind.
*
* @deprecated Provided for backward compatibility with the 1.7 API.
*/
SVN_DEPRECATED
svn_prop_kind_t
svn_property_kind(int *prefix_len,
const char *prop_name);
/** Return @c TRUE iff @a prop_name represents the name of a Subversion
* property. That is, any property name in Subversion's name space for
* versioned or unversioned properties, regardless whether the particular
* property name is recognized.
*/
svn_boolean_t
svn_prop_is_svn_prop(const char *prop_name);
/** Return @c TRUE iff @a props has at least one property whose name
* represents the name of a Subversion property, in the sense of
* svn_prop_is_svn_prop().
*
* @since New in 1.5.
*/
svn_boolean_t
svn_prop_has_svn_prop(const apr_hash_t *props,
apr_pool_t *pool);
/** Return @c TRUE iff @a prop_name is a Subversion property whose
* value is interpreted as a boolean.
*
* @since New in 1.5.
*/
svn_boolean_t
svn_prop_is_boolean(const char *prop_name);
/** Return @c TRUE iff @a prop_name is in the "svn:" name space and is a
* known revision property ("svn:log" or "svn:date", e.g.).
*
* This will return @c FALSE for any property name that is not known by this
* version of the library, even though the name may be known to other (for
* example, later) Subversion software.
*
* @since New in 1.8.
*/
svn_boolean_t
svn_prop_is_known_svn_rev_prop(const char *prop_name);
/** Return @c TRUE iff @a prop_name is in the "svn:" name space and is a
* known versioned property that is allowed on a file and/or on a
* directory ("svn:eol-style", "svn:ignore", or "svn:mergeinfo", e.g.).
*
* This will return @c FALSE for any property name that is not known
* by this version of the library, even though the name may be known
* to other (for example, later) Subversion software.
*
* @since New in 1.8.
*/
svn_boolean_t
svn_prop_is_known_svn_node_prop(const char *prop_name);
/** Return @c TRUE iff @a prop_name is in the "svn:" name space and is
* a known versioned property that is allowed on a file
* ("svn:eol-style" or "svn:mergeinfo", e.g.).
*
* This will return @c FALSE for any property name that is not known
* by this version of the library, even though the name may be known
* to other (for example, later) Subversion software.
*
* @since New in 1.8.
*/
svn_boolean_t
svn_prop_is_known_svn_file_prop(const char *prop_name);
/** Return @c TRUE iff @a prop_name is in the "svn:" name space and is
* a known versioned property that is allowed on a directory
* ("svn:ignore" or "svn:mergeinfo", e.g.).
*
* This will return @c FALSE for any property name that is not known
* by this version of the library, even though the name may be known
* to other (for example, later) Subversion software.
*
* @since New in 1.8.
*/
svn_boolean_t
svn_prop_is_known_svn_dir_prop(const char *prop_name);
/** If @a prop_name requires that its value be stored as UTF8/LF in the
* repository, then return @c TRUE. Else return @c FALSE. This is for
* users of libsvn_client or libsvn_fs, since it their responsibility
* to do this translation in both directions. (See
* svn_subst_translate_string()/svn_subst_detranslate_string() for
* help with this task.)
*/
svn_boolean_t
svn_prop_needs_translation(const char *prop_name);
/** Given a @a proplist array of @c svn_prop_t structures, allocate
* three new arrays in @a pool. Categorize each property and then
* create new @c svn_prop_t structures in the proper lists. Each new
* @c svn_prop_t structure's fields will point to the same data within
* @a proplist's structures.
*
* Callers may pass NULL for each of the property lists in which they
* are uninterested. If no props exist in a certain category, and the
* property list argument for that category is non-NULL, then that
* array will come back with <tt>->nelts == 0</tt>.
*/
svn_error_t *
svn_categorize_props(const apr_array_header_t *proplist,
apr_array_header_t **entry_props,
apr_array_header_t **wc_props,
apr_array_header_t **regular_props,
apr_pool_t *pool);
/** Given two property hashes (<tt>const char *name</tt> -> <tt>const
* svn_string_t *value</tt>), deduce the differences between them (from
* @a source_props -> @c target_props). Set @a propdiffs to a new array of
* @c svn_prop_t structures, with one entry for each property that differs,
* including properties that exist in @a source_props or @a target_props but
* not both. The @c value field of each entry is that property's value from
* @a target_props or NULL if that property only exists in @a source_props.
*
* Allocate the array from @a pool. Allocate the contents of the array from
* @a pool or by reference to the storage of the input hashes or both.
*
* For note, here's a quick little table describing the logic of this
* routine:
*
* @verbatim
source_props target_props event
------------ ------------ -----
value = foo value = NULL Deletion occurred.
value = foo value = bar Set occurred (modification)
value = NULL value = baz Set occurred (creation) @endverbatim
*/
svn_error_t *
svn_prop_diffs(apr_array_header_t **propdiffs,
const apr_hash_t *target_props,
const apr_hash_t *source_props,
apr_pool_t *pool);
/**
* Return @c TRUE iff @a prop_name is a valid property name.
*
* For now, "valid" means the ASCII subset of an XML "Name".
* XML "Name" is defined at http://www.w3.org/TR/REC-xml#sec-common-syn
*
* @since New in 1.5.
*/
svn_boolean_t
svn_prop_name_is_valid(const char *prop_name);
/* Defines for reserved ("svn:") property names. */
/** All Subversion property names start with this. */
#define SVN_PROP_PREFIX "svn:"
/** Visible properties
*
* These are regular properties that are attached to ordinary files
* and dirs, and are visible (and tweakable) by svn client programs
* and users. Adding these properties causes specific effects.
*
* @note the values of these properties are always UTF8-encoded with
* LF line-endings. It is the burden of svn library users to enforce
* this. Use svn_prop_needs_translation() to discover if a
* certain property needs translation, and you can use
* svn_subst_translate_string()/svn_subst_detranslate_string()
* to do the translation.
*
* @defgroup svn_prop_visible_props Visible properties
* @{
*/
/** Properties whose values are interpreted as booleans (such as
* svn:executable, svn:needs_lock, and svn:special) always fold their
* value to this.
*
* @since New in 1.5.
*/
#define SVN_PROP_BOOLEAN_TRUE "*"
/** The mime-type of a given file. */
#define SVN_PROP_MIME_TYPE SVN_PROP_PREFIX "mime-type"
/** The ignore patterns for a given directory. */
#define SVN_PROP_IGNORE SVN_PROP_PREFIX "ignore"
/** The line ending style for a given file. */
#define SVN_PROP_EOL_STYLE SVN_PROP_PREFIX "eol-style"
/** The "activated" keywords (for keyword substitution) for a given file. */
#define SVN_PROP_KEYWORDS SVN_PROP_PREFIX "keywords"
/** Set to either TRUE or FALSE if we want a file to be executable or not. */
#define SVN_PROP_EXECUTABLE SVN_PROP_PREFIX "executable"
/** The value to force the executable property to when set.
*
* @deprecated Provided for backward compatibility with the 1.4 API.
* Use @c SVN_PROP_BOOLEAN_TRUE instead.
*/
#define SVN_PROP_EXECUTABLE_VALUE SVN_PROP_BOOLEAN_TRUE
/** Set to TRUE ('*') if we want a file to be set to read-only when
* not locked. FALSE is indicated by deleting the property. */
#define SVN_PROP_NEEDS_LOCK SVN_PROP_PREFIX "needs-lock"
/** The value to force the needs-lock property to when set.
*
* @deprecated Provided for backward compatibility with the 1.4 API.
* Use @c SVN_PROP_BOOLEAN_TRUE instead.
*/
#define SVN_PROP_NEEDS_LOCK_VALUE SVN_PROP_BOOLEAN_TRUE
/** Set if the file should be treated as a special file. */
#define SVN_PROP_SPECIAL SVN_PROP_PREFIX "special"
/** The value to force the special property to when set.
*
* @deprecated Provided for backward compatibility with the 1.4 API.
* Use @c SVN_PROP_BOOLEAN_TRUE instead.
*/
#define SVN_PROP_SPECIAL_VALUE SVN_PROP_BOOLEAN_TRUE
/** Describes external items to check out into this directory.
*
* The format is a series of lines, each in the following format:
* [-r REV] URL[@PEG] LOCALPATH
* LOCALPATH is relative to the directory having this property.
* REV pins the external to revision REV.
* URL may be a full URL or a relative URL starting with one of:
* ../ to the parent directory of the extracted external
* ^/ to the repository root
* / to the server root
* // to the URL scheme
* The following format is supported for interoperability with
* Subversion 1.4 and earlier clients:
* LOCALPATH [-r PEG] URL
* The ambiguous format 'relative_path relative_path' is taken as
* 'relative_url relative_path' with peg revision support.
* Lines starting with a '#' character are ignored.
*/
#define SVN_PROP_EXTERNALS SVN_PROP_PREFIX "externals"
/** Merge info property used to record a resource's merge history.
*
* The format is a series of lines containing merge paths and revision
* ranges, such as:
*
* @verbatim
/trunk: 1-6,9,37-38
/trunk/foo: 10 @endverbatim
*/
#define SVN_PROP_MERGEINFO SVN_PROP_PREFIX "mergeinfo"
/** Property used to record inheritable configuration auto-props. */
#define SVN_PROP_INHERITABLE_AUTO_PROPS SVN_PROP_PREFIX "auto-props"
/** Property used to record inheritable configuration ignores. */
#define SVN_PROP_INHERITABLE_IGNORES SVN_PROP_PREFIX "global-ignores"
/** Meta-data properties.
*
* The following properties are used for storing meta-data about
* individual entries in the meta-data branches of subversion,
* see issue #1256 or browseable at
* http://svn.apache.org/viewvc/subversion/branches/meta-data-versioning/ .
* Furthermore @c svntar (http://svn.borg.ch/svntar/) and @c FSVS
* (http://fsvs.tigris.org/) use these, too.
*
* Please note that these formats are very UNIX-centric currently;
* a bit of discussion about Windows can be read at
* http://article.gmane.org/gmane.comp.version-control.subversion.devel/103991
*
* @defgroup svn_prop_meta_data Meta-data properties
* @{ */
/** The files' last modification time.
* This is stored as string in the form @c "2008-08-07T07:38:51.008782Z", to
* be converted by the functions @c svn_time_to_cstring() and
* @c svn_time_from_cstring(). */
#define SVN_PROP_TEXT_TIME SVN_PROP_PREFIX "text-time"
/** The files' owner.
* Stored as numeric ID, optionally followed by whitespace and the string:
* @c "1000 pmarek". Parsers @b should accept any number of whitespace,
* and writers @b should put exactly a single space. */
#define SVN_PROP_OWNER SVN_PROP_PREFIX "owner"
/** The files' group.
* The same format as for @c SVN_PROP_OWNER, the owner-property. */
#define SVN_PROP_GROUP SVN_PROP_PREFIX "group"
/** The files' unix-mode.
* Stored in octal, with a leading @c 0; may have 5 digits if any of @c setuid,
* @c setgid or @c sticky are set; an example is @c "0644". */
#define SVN_PROP_UNIX_MODE SVN_PROP_PREFIX "unix-mode"
/** @} */ /* Meta-data properties */
/**
* This is a list of all user-visible and -settable versioned node
* properties.
*
* @since New in 1.8.
*/
#define SVN_PROP_NODE_ALL_PROPS SVN_PROP_MIME_TYPE, \
SVN_PROP_IGNORE, \
SVN_PROP_EOL_STYLE, \
SVN_PROP_KEYWORDS, \
SVN_PROP_EXECUTABLE, \
SVN_PROP_NEEDS_LOCK, \
SVN_PROP_SPECIAL, \
SVN_PROP_EXTERNALS, \
SVN_PROP_MERGEINFO, \
SVN_PROP_INHERITABLE_AUTO_PROPS, \
SVN_PROP_INHERITABLE_IGNORES, \
\
SVN_PROP_TEXT_TIME, \
SVN_PROP_OWNER, \
SVN_PROP_GROUP, \
SVN_PROP_UNIX_MODE,
/** @} */
/** WC props are props that are invisible to users: they're generated
* by an RA layer, and stored in secret parts of .svn/.
*
* @defgroup svn_prop_invisible_props Invisible properties
* @{
*/
/** The property name *prefix* that makes a property a "WC property".
*
* For example, WebDAV RA implementations might store a versioned-resource
* url as a WC prop like this:
*
* <pre reason="Should use 'verbatim' instead, but Doxygen v1.6.1 & v1.7.1
* then doesn't recognize the #define; presumably a bug.">
name = svn:wc:dav_url
val = http://www.example.com/repos/452348/e.289 </pre>
*
* The client will try to protect WC props by warning users against
* changing them. The client will also send them back to the RA layer
* when committing.
*/
#define SVN_PROP_WC_PREFIX SVN_PROP_PREFIX "wc:"
/** Another type of non-user-visible property. "Entry properties" are
* stored as fields with the administrative 'entries' file.
*/
#define SVN_PROP_ENTRY_PREFIX SVN_PROP_PREFIX "entry:"
/** The revision this entry was last committed to on. */
#define SVN_PROP_ENTRY_COMMITTED_REV SVN_PROP_ENTRY_PREFIX "committed-rev"
/** The date this entry was last committed to on. */
#define SVN_PROP_ENTRY_COMMITTED_DATE SVN_PROP_ENTRY_PREFIX "committed-date"
/** The author who last committed to this entry. */
#define SVN_PROP_ENTRY_LAST_AUTHOR SVN_PROP_ENTRY_PREFIX "last-author"
/** The UUID of this entry's repository. */
#define SVN_PROP_ENTRY_UUID SVN_PROP_ENTRY_PREFIX "uuid"
/** The lock token for this entry.
* @since New in 1.2. */
#define SVN_PROP_ENTRY_LOCK_TOKEN SVN_PROP_ENTRY_PREFIX "lock-token"
/** When custom, user-defined properties are passed over the wire, they will
* have this prefix added to their name.
*/
#define SVN_PROP_CUSTOM_PREFIX SVN_PROP_PREFIX "custom:"
/** @} */
/**
* These are reserved properties attached to a "revision" object in
* the repository filesystem. They can be queried by using
* svn_fs_revision_prop().
*
* @defgroup svn_props_revision_props Revision properties
* @{
*/
/** The fs revision property that stores a commit's author. */
#define SVN_PROP_REVISION_AUTHOR SVN_PROP_PREFIX "author"
/** The fs revision property that stores a commit's log message. */
#define SVN_PROP_REVISION_LOG SVN_PROP_PREFIX "log"
/** The fs revision property that stores a commit's date. */
#define SVN_PROP_REVISION_DATE SVN_PROP_PREFIX "date"
/** The fs revision property that stores a commit's "original" date.
*
* The svn:date property must be monotonically increasing, along with
* the revision number. In certain scenarios, this may pose a problem
* when the revision represents a commit that occurred at a time which
* does not fit within the sequencing required for svn:date. This can
* happen, for instance, when the revision represents a commit to a
* foreign version control system, or possibly when two Subversion
* repositories are combined. This property can be used to record the
* TRUE, original date of the commit.
*/
#define SVN_PROP_REVISION_ORIG_DATE SVN_PROP_PREFIX "original-date"
/** The presence of this fs revision property indicates that the
* revision was automatically generated by the mod_dav_svn
* autoversioning feature. The value is irrelevant.
*/
#define SVN_PROP_REVISION_AUTOVERSIONED SVN_PROP_PREFIX "autoversioned"
/* More reserved revision props in the 'svn:' namespace, used by the
svnsync tool: */
/** Prefix for all svnsync custom properties.
* @since New in 1.4.
*/
#define SVNSYNC_PROP_PREFIX SVN_PROP_PREFIX "sync-"
/* The following revision properties are set on revision 0 of
* destination repositories by svnsync:
*/
/** Used to enforce mutually exclusive destination repository access.
* @since New in 1.4.
*/
#define SVNSYNC_PROP_LOCK SVNSYNC_PROP_PREFIX "lock"
/** Identifies the repository's source URL.
* @since New in 1.4.
*/
#define SVNSYNC_PROP_FROM_URL SVNSYNC_PROP_PREFIX "from-url"
/** Identifies the repository's source UUID.
* @since New in 1.4.
*/
#define SVNSYNC_PROP_FROM_UUID SVNSYNC_PROP_PREFIX "from-uuid"
/** Identifies the last completely mirrored revision.
* @since New in 1.4.
*/
#define SVNSYNC_PROP_LAST_MERGED_REV SVNSYNC_PROP_PREFIX "last-merged-rev"
/** Identifies the revision currently being copied.
* @since New in 1.4.
*/
#define SVNSYNC_PROP_CURRENTLY_COPYING SVNSYNC_PROP_PREFIX "currently-copying"
/**
* This is a list of all revision properties.
*/
#define SVN_PROP_REVISION_ALL_PROPS SVN_PROP_REVISION_AUTHOR, \
SVN_PROP_REVISION_LOG, \
SVN_PROP_REVISION_DATE, \
SVN_PROP_REVISION_AUTOVERSIONED, \
SVN_PROP_REVISION_ORIG_DATE, \
SVNSYNC_PROP_LOCK, \
SVNSYNC_PROP_FROM_URL, \
SVNSYNC_PROP_FROM_UUID, \
SVNSYNC_PROP_LAST_MERGED_REV, \
SVNSYNC_PROP_CURRENTLY_COPYING,
/** @} */
/**
* These are reserved properties attached to a "transaction" object in
* the repository filesystem in advance of the pre-commit hook script
* running on the server, but then automatically removed from the
* transaction before its promotion to a new revision.
*
* @defgroup svn_props_ephemeral_txnprops Ephemeral transaction properties
* @{
*/
/** The prefix used for all (ephemeral) transaction properties.
*
* @since New in 1.8.
*/
#define SVN_PROP_TXN_PREFIX SVN_PROP_PREFIX "txn-"
/** Identifies the client version compability level. For clients
* compiled against Subversion libraries, this is @c SVN_VER_NUMBER.
* Third-party implementations are advised to use similar formatting
* for values of this property.
*
* @since New in 1.8.
*/
#define SVN_PROP_TXN_CLIENT_COMPAT_VERSION \
SVN_PROP_TXN_PREFIX "client-compat-version"
/** Identifies the client's user agent string, if any.
*
* @since New in 1.8.
*/
#define SVN_PROP_TXN_USER_AGENT \
SVN_PROP_TXN_PREFIX "user-agent"
/** The prefix reserved for copies of (ephemeral) transaction
* properties designed to outlive the transaction. Administrators may
* choose to, in their pre-commit hook scripts, copy the values of one
* or more properties named @c SVN_PROP_TXN_PREFIX + "something"
* to new properties named @c SVN_PROP_REVISION_PREFIX + "something",
* allowing that information to survive the commit-time removal of
* ephemeral transaction properties.
*
* @since New in 1.8.
*/
#define SVN_PROP_REVISION_PREFIX SVN_PROP_PREFIX "revision-"
/** @} */
/** @} */
#ifdef __cplusplus
}
#endif /* __cplusplus */
#endif /* SVN_PROPS_H */

View File

@ -0,0 +1,77 @@
/**
* @copyright
* ====================================================================
* Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements. See the NOTICE file
* distributed with this work for additional information
* regarding copyright ownership. The ASF licenses this file
* to you under the Apache License, Version 2.0 (the
* "License"); you may not use this file except in compliance
* with the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing,
* software distributed under the License is distributed on an
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
* KIND, either express or implied. See the License for the
* specific language governing permissions and limitations
* under the License.
* ====================================================================
* @endcopyright
*
* @file svn_quoprint.h
* @brief quoted-printable encoding and decoding functions.
*/
#ifndef SVN_QUOPRINT_H
#define SVN_QUOPRINT_H
#include <apr_pools.h>
#include "svn_string.h" /* for svn_strinbuf_t */
#include "svn_io.h" /* for svn_stream_t */
#ifdef __cplusplus
extern "C" {
#endif /* __cplusplus */
/** Return a writable generic stream which will encode binary data in
* quoted-printable format and write the encoded data to @a output. Be
* sure to close the stream when done writing in order to squeeze out
* the last bit of encoded data.
*/
svn_stream_t *
svn_quoprint_encode(svn_stream_t *output,
apr_pool_t *pool);
/** Return a writable generic stream which will decode binary data in
* quoted-printable format and write the decoded data to @a output. Be
* sure to close the stream when done writing in order to squeeze out
* the last bit of encoded data.
*/
svn_stream_t *
svn_quoprint_decode(svn_stream_t *output,
apr_pool_t *pool);
/** Simpler interface for encoding quoted-printable data assuming we have all
* of it present at once. The returned string will be allocated from @a pool.
*/
svn_stringbuf_t *
svn_quoprint_encode_string(const svn_stringbuf_t *str,
apr_pool_t *pool);
/** Simpler interface for decoding quoted-printable data assuming we have all
* of it present at once. The returned string will be allocated from @a pool.
*/
svn_stringbuf_t *
svn_quoprint_decode_string(const svn_stringbuf_t *str,
apr_pool_t *pool);
#ifdef __cplusplus
}
#endif /* __cplusplus */
#endif /* SVN_QUOPRINT_H */

2468
subversion/include/svn_ra.h Normal file

File diff suppressed because it is too large Load Diff

View File

@ -0,0 +1,668 @@
/**
* @copyright
* ====================================================================
* Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements. See the NOTICE file
* distributed with this work for additional information
* regarding copyright ownership. The ASF licenses this file
* to you under the Apache License, Version 2.0 (the
* "License"); you may not use this file except in compliance
* with the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing,
* software distributed under the License is distributed on an
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
* KIND, either express or implied. See the License for the
* specific language governing permissions and limitations
* under the License.
* ====================================================================
* @endcopyright
*
* @file svn_ra_svn.h
* @brief libsvn_ra_svn functions used by the server
*/
#ifndef SVN_RA_SVN_H
#define SVN_RA_SVN_H
#include <apr.h>
#include <apr_pools.h>
#include <apr_hash.h>
#include <apr_tables.h>
#include <apr_file_io.h> /* for apr_file_t */
#include <apr_network_io.h> /* for apr_socket_t */
#include "svn_types.h"
#include "svn_string.h"
#include "svn_config.h"
#include "svn_delta.h"
#ifdef __cplusplus
extern "C" {
#endif /* __cplusplus */
/** The well-known svn port number. */
#define SVN_RA_SVN_PORT 3690
/** Currently-defined capabilities. */
#define SVN_RA_SVN_CAP_EDIT_PIPELINE "edit-pipeline"
#define SVN_RA_SVN_CAP_SVNDIFF1 "svndiff1"
#define SVN_RA_SVN_CAP_ABSENT_ENTRIES "absent-entries"
/* maps to SVN_RA_CAPABILITY_COMMIT_REVPROPS: */
#define SVN_RA_SVN_CAP_COMMIT_REVPROPS "commit-revprops"
/* maps to SVN_RA_CAPABILITY_MERGEINFO: */
#define SVN_RA_SVN_CAP_MERGEINFO "mergeinfo"
/* maps to SVN_RA_CAPABILITY_DEPTH: */
#define SVN_RA_SVN_CAP_DEPTH "depth"
/* maps to SVN_RA_CAPABILITY_LOG_REVPROPS */
#define SVN_RA_SVN_CAP_LOG_REVPROPS "log-revprops"
/* maps to SVN_RA_CAPABILITY_PARTIAL_REPLAY */
#define SVN_RA_SVN_CAP_PARTIAL_REPLAY "partial-replay"
/* maps to SVN_RA_CAPABILITY_ATOMIC_REVPROPS */
#define SVN_RA_SVN_CAP_ATOMIC_REVPROPS "atomic-revprops"
/* maps to SVN_RA_CAPABILITY_INHERITED_PROPERTIES: */
#define SVN_RA_SVN_CAP_INHERITED_PROPS "inherited-props"
/* maps to SVN_RA_CAPABILITY_EPHEMERAL_TXNPROPS */
#define SVN_RA_SVN_CAP_EPHEMERAL_TXNPROPS "ephemeral-txnprops"
/* maps to SVN_RA_CAPABILITY_GET_FILE_REVS_REVERSE */
#define SVN_RA_SVN_CAP_GET_FILE_REVS_REVERSE "file-revs-reverse"
/** ra_svn passes @c svn_dirent_t fields over the wire as a list of
* words, these are the values used to represent each field.
*
* @defgroup ra_svn_dirent_fields Definitions of ra_svn dirent fields
* @{
*/
/** The ra_svn way of saying @c SVN_DIRENT_KIND. */
#define SVN_RA_SVN_DIRENT_KIND "kind"
/** The ra_svn way of saying @c SVN_DIRENT_SIZE. */
#define SVN_RA_SVN_DIRENT_SIZE "size"
/** The ra_svn way of saying @c SVN_DIRENT_HAS_PROPS. */
#define SVN_RA_SVN_DIRENT_HAS_PROPS "has-props"
/** The ra_svn way of saying @c SVN_DIRENT_CREATED_REV. */
#define SVN_RA_SVN_DIRENT_CREATED_REV "created-rev"
/** The ra_svn way of saying @c SVN_DIRENT_TIME. */
#define SVN_RA_SVN_DIRENT_TIME "time"
/** The ra_svn way of saying @c SVN_DIRENT_LAST_AUTHOR. */
#define SVN_RA_SVN_DIRENT_LAST_AUTHOR "last-author"
/** @} */
/** A value used to indicate an optional number element in a tuple that was
* not received.
*/
#define SVN_RA_SVN_UNSPECIFIED_NUMBER ~((apr_uint64_t) 0)
/** A specialized form of @c SVN_ERR to deal with errors which occur in an
* svn_ra_svn_command_handler().
*
* An error returned with this macro will be passed back to the other side
* of the connection. Use this macro when performing the requested operation;
* use the regular @c SVN_ERR when performing I/O with the client.
*/
#define SVN_CMD_ERR(expr) \
do { \
svn_error_t *svn_err__temp = (expr); \
if (svn_err__temp) \
return svn_error_create(SVN_ERR_RA_SVN_CMD_ERR, \
svn_err__temp, NULL); \
} while (0)
/** an ra_svn connection. */
typedef struct svn_ra_svn_conn_st svn_ra_svn_conn_t;
/** Command handler, used by svn_ra_svn_handle_commands(). */
typedef svn_error_t *(*svn_ra_svn_command_handler)(svn_ra_svn_conn_t *conn,
apr_pool_t *pool,
apr_array_header_t *params,
void *baton);
/** Command table, used by svn_ra_svn_handle_commands().
*/
typedef struct svn_ra_svn_cmd_entry_t
{
/** Name of the command */
const char *cmdname;
/** Handler for the command */
svn_ra_svn_command_handler handler;
/** Termination flag. If set, command-handling will cease after
* command is processed. */
svn_boolean_t terminate;
} svn_ra_svn_cmd_entry_t;
/** Memory representation of an on-the-wire data item. */
typedef struct svn_ra_svn_item_t
{
/** Variant indicator. */
enum {
SVN_RA_SVN_NUMBER,
SVN_RA_SVN_STRING,
SVN_RA_SVN_WORD,
SVN_RA_SVN_LIST
} kind;
/** Variant data. */
union {
apr_uint64_t number;
svn_string_t *string;
const char *word;
/** Contains @c svn_ra_svn_item_t's. */
apr_array_header_t *list;
} u;
} svn_ra_svn_item_t;
typedef svn_error_t *(*svn_ra_svn_edit_callback)(void *baton);
/** Initialize a connection structure for the given socket or
* input/output files.
*
* Either @a sock or @a in_file/@a out_file must be set, not both.
* @a compression_level specifies the desired network data compression
* level (zlib) from 0 (no compression) to 9 (best but slowest).
*
* If @a zero_copy_limit is not 0, cached file contents smaller than the
* given limit may be sent directly to the network socket. Otherwise,
* it will be copied into a temporary buffer before being forwarded to
* the network stack. Since the zero-copy code path has to enforce strict
* time-outs, the receiver must be able to process @a zero_copy_limit
* bytes within one second. Even temporary failure to do so may cause
* the server to cancel the respective operation with a time-out error.
*
* To reduce the overhead of checking for cancellation requests from the
* data receiver, set @a error_check_interval to some non-zero value.
* It defines the number of bytes that must have been sent since the last
* check before the next check will be made.
*
* Allocate the result in @a pool.
*
* @since New in 1.8
*/
svn_ra_svn_conn_t *svn_ra_svn_create_conn3(apr_socket_t *sock,
apr_file_t *in_file,
apr_file_t *out_file,
int compression_level,
apr_size_t zero_copy_limit,
apr_size_t error_check_interval,
apr_pool_t *pool);
/** Similar to svn_ra_svn_create_conn3() but disables the zero copy code
* path and sets the error checking interval to 0.
*
* @since New in 1.7.
*
* @deprecated Provided for backward compatibility with the 1.7 API.
*/
SVN_DEPRECATED
svn_ra_svn_conn_t *
svn_ra_svn_create_conn2(apr_socket_t *sock,
apr_file_t *in_file,
apr_file_t *out_file,
int compression_level,
apr_pool_t *pool);
/** Similar to svn_ra_svn_create_conn2() but uses the default
* compression level (#SVN_DELTA_COMPRESSION_LEVEL_DEFAULT) for network
* transmissions.
*
* @deprecated Provided for backward compatibility with the 1.6 API.
*/
SVN_DEPRECATED
svn_ra_svn_conn_t *
svn_ra_svn_create_conn(apr_socket_t *sock,
apr_file_t *in_file,
apr_file_t *out_file,
apr_pool_t *pool);
/** Add the capabilities in @a list to @a conn's capabilities.
* @a list contains svn_ra_svn_item_t entries (which should be of type
* SVN_RA_SVN_WORD; a malformed data error will result if any are not).
*
* This is idempotent: if a given capability was already set for
* @a conn, it remains set.
*/
svn_error_t *
svn_ra_svn_set_capabilities(svn_ra_svn_conn_t *conn,
const apr_array_header_t *list);
/** Return @c TRUE if @a conn has the capability @a capability, or
* @c FALSE if it does not. */
svn_boolean_t
svn_ra_svn_has_capability(svn_ra_svn_conn_t *conn,
const char *capability);
/** Return the data compression level to use for network transmissions.
*
* @since New in 1.7.
*/
int
svn_ra_svn_compression_level(svn_ra_svn_conn_t *conn);
/** Return the zero-copy data block limit to use for network
* transmissions.
*
* @see http://en.wikipedia.org/wiki/Zero-copy
*
* @since New in 1.8.
*/
apr_size_t
svn_ra_svn_zero_copy_limit(svn_ra_svn_conn_t *conn);
/** Returns the remote address of the connection as a string, if known,
* or NULL if inapplicable. */
const char *
svn_ra_svn_conn_remote_host(svn_ra_svn_conn_t *conn);
/** Set @a *editor and @a *edit_baton to an editor which will pass editing
* operations over the network, using @a conn and @a pool.
*
* Upon successful completion of the edit, the editor will invoke @a callback
* with @a callback_baton as an argument.
*/
void
svn_ra_svn_get_editor(const svn_delta_editor_t **editor,
void **edit_baton,
svn_ra_svn_conn_t *conn,
apr_pool_t *pool,
svn_ra_svn_edit_callback callback,
void *callback_baton);
/** Receive edit commands over the network and use them to drive @a editor
* with @a edit_baton. On return, @a *aborted will be set if the edit was
* aborted. The drive can be terminated with a finish-replay command only
* if @a for_replay is TRUE.
*
* @since New in 1.4.
*/
svn_error_t *
svn_ra_svn_drive_editor2(svn_ra_svn_conn_t *conn,
apr_pool_t *pool,
const svn_delta_editor_t *editor,
void *edit_baton,
svn_boolean_t *aborted,
svn_boolean_t for_replay);
/** Like svn_ra_svn_drive_editor2, but with @a for_replay always FALSE.
*
* @deprecated Provided for backward compatibility with the 1.3 API.
*/
SVN_DEPRECATED
svn_error_t *
svn_ra_svn_drive_editor(svn_ra_svn_conn_t *conn,
apr_pool_t *pool,
const svn_delta_editor_t *editor,
void *edit_baton,
svn_boolean_t *aborted);
/** This function is only intended for use by svnserve.
*
* Perform CRAM-MD5 password authentication. On success, return
* SVN_NO_ERROR with *user set to the username and *success set to
* TRUE. On an error which can be reported to the client, report the
* error and return SVN_NO_ERROR with *success set to FALSE. On
* communications failure, return an error.
*/
svn_error_t *
svn_ra_svn_cram_server(svn_ra_svn_conn_t *conn,
apr_pool_t *pool,
svn_config_t *pwdb,
const char **user,
svn_boolean_t *success);
/**
* Get libsvn_ra_svn version information.
* @since New in 1.1.
*/
const svn_version_t *
svn_ra_svn_version(void);
/**
* @defgroup ra_svn_deprecated ra_svn low-level functions
* @{
*/
/** Write a number over the net.
*
* Writes will be buffered until the next read or flush.
*
* @deprecated Provided for backward compatibility with the 1.7 API.
* RA_SVN low-level functions are no longer considered public.
*/
SVN_DEPRECATED
svn_error_t *
svn_ra_svn_write_number(svn_ra_svn_conn_t *conn,
apr_pool_t *pool,
apr_uint64_t number);
/** Write a string over the net.
*
* Writes will be buffered until the next read or flush.
*
* @deprecated Provided for backward compatibility with the 1.7 API.
* RA_SVN low-level functions are no longer considered public.
*/
SVN_DEPRECATED
svn_error_t *
svn_ra_svn_write_string(svn_ra_svn_conn_t *conn,
apr_pool_t *pool,
const svn_string_t *str);
/** Write a cstring over the net.
*
* Writes will be buffered until the next read or flush.
*
* @deprecated Provided for backward compatibility with the 1.7 API.
* RA_SVN low-level functions are no longer considered public.
*/
SVN_DEPRECATED
svn_error_t *
svn_ra_svn_write_cstring(svn_ra_svn_conn_t *conn,
apr_pool_t *pool,
const char *s);
/** Write a word over the net.
*
* Writes will be buffered until the next read or flush.
*
* @deprecated Provided for backward compatibility with the 1.7 API.
* RA_SVN low-level functions are no longer considered public.
*/
SVN_DEPRECATED
svn_error_t *
svn_ra_svn_write_word(svn_ra_svn_conn_t *conn,
apr_pool_t *pool,
const char *word);
/** Write a list of properties over the net. @a props is allowed to be NULL,
* in which case an empty list will be written out.
*
* @since New in 1.5.
*
* @deprecated Provided for backward compatibility with the 1.7 API.
* RA_SVN low-level functions are no longer considered public.
*/
SVN_DEPRECATED
svn_error_t *
svn_ra_svn_write_proplist(svn_ra_svn_conn_t *conn,
apr_pool_t *pool,
apr_hash_t *props);
/** Begin a list. Writes will be buffered until the next read or flush.
*
* @deprecated Provided for backward compatibility with the 1.7 API.
* RA_SVN low-level functions are no longer considered public.
*/
SVN_DEPRECATED
svn_error_t *
svn_ra_svn_start_list(svn_ra_svn_conn_t *conn,
apr_pool_t *pool);
/** End a list. Writes will be buffered until the next read or flush.
*
* @deprecated Provided for backward compatibility with the 1.7 API.
* RA_SVN low-level functions are no longer considered public.
*/
SVN_DEPRECATED
svn_error_t *
svn_ra_svn_end_list(svn_ra_svn_conn_t *conn,
apr_pool_t *pool);
/** Flush the write buffer.
*
* Normally this shouldn't be necessary, since the write buffer is flushed
* when a read is attempted.
*
* @deprecated Provided for backward compatibility with the 1.7 API.
* RA_SVN low-level functions are no longer considered public.
*/
SVN_DEPRECATED
svn_error_t *
svn_ra_svn_flush(svn_ra_svn_conn_t *conn,
apr_pool_t *pool);
/** Write a tuple, using a printf-like interface.
*
* The format string @a fmt may contain:
*
*@verbatim
Spec Argument type Item type
---- -------------------- ---------
n apr_uint64_t Number
r svn_revnum_t Number
s const svn_string_t * String
c const char * String
w const char * Word
b svn_boolean_t Word ("true" or "false")
( Begin tuple
) End tuple
? Remaining elements optional
! (at beginning or end) Suppress opening or closing of tuple
@endverbatim
*
* Inside the optional part of a tuple, 'r' values may be @c
* SVN_INVALID_REVNUM, 'n' values may be
* SVN_RA_SVN_UNSPECIFIED_NUMBER, and 's', 'c', and 'w' values may be
* @c NULL; in these cases no data will be written. 'b' and '(' may
* not appear in the optional part of a tuple. Either all or none of
* the optional values should be valid.
*
* (If we ever have a need for an optional boolean value, we should
* invent a 'B' specifier which stores a boolean into an int, using -1
* for unspecified. Right now there is no need for such a thing.)
*
* Use the '!' format specifier to write partial tuples when you have
* to transmit an array or other unusual data. For example, to write
* a tuple containing a revision, an array of words, and a boolean:
* @code
SVN_ERR(svn_ra_svn_write_tuple(conn, pool, "r(!", rev));
for (i = 0; i < n; i++)
SVN_ERR(svn_ra_svn_write_word(conn, pool, words[i]));
SVN_ERR(svn_ra_svn_write_tuple(conn, pool, "!)b", flag)); @endcode
*
* @deprecated Provided for backward compatibility with the 1.7 API.
* RA_SVN low-level functions are no longer considered public.
*/
SVN_DEPRECATED
svn_error_t *
svn_ra_svn_write_tuple(svn_ra_svn_conn_t *conn,
apr_pool_t *pool,
const char *fmt, ...);
/** Read an item from the network into @a *item.
*
* @deprecated Provided for backward compatibility with the 1.7 API.
* RA_SVN low-level functions are no longer considered public.
*/
SVN_DEPRECATED
svn_error_t *
svn_ra_svn_read_item(svn_ra_svn_conn_t *conn,
apr_pool_t *pool,
svn_ra_svn_item_t **item);
/** Scan data on @a conn until we find something which looks like the
* beginning of an svn server greeting (an open paren followed by a
* whitespace character). This function is appropriate for beginning
* a client connection opened in tunnel mode, since people's dotfiles
* sometimes write output to stdout. It may only be called at the
* beginning of a client connection.
*
* @deprecated Provided for backward compatibility with the 1.7 API.
* RA_SVN low-level functions are no longer considered public.
*/
SVN_DEPRECATED
svn_error_t *
svn_ra_svn_skip_leading_garbage(svn_ra_svn_conn_t *conn,
apr_pool_t *pool);
/** Parse an array of @c svn_sort__item_t structures as a tuple, using a
* printf-like interface. The format string @a fmt may contain:
*
*@verbatim
Spec Argument type Item type
---- -------------------- ---------
n apr_uint64_t * Number
r svn_revnum_t * Number
s svn_string_t ** String
c const char ** String
w const char ** Word
b svn_boolean_t * Word ("true" or "false")
B apr_uint64_t * Word ("true" or "false")
l apr_array_header_t ** List
( Begin tuple
) End tuple
? Tuple is allowed to end here
@endverbatim
*
* Note that a tuple is only allowed to end precisely at a '?', or at
* the end of the specification. So if @a fmt is "c?cc" and @a list
* contains two elements, an error will result.
*
* 'B' is similar to 'b', but may be used in the optional tuple specification.
* It returns TRUE, FALSE, or SVN_RA_SVN_UNSPECIFIED_NUMBER.
*
* If an optional part of a tuple contains no data, 'r' values will be
* set to @c SVN_INVALID_REVNUM, 'n' and 'B' values will be set to
* SVN_RA_SVN_UNSPECIFIED_NUMBER, and 's', 'c', 'w', and 'l' values
* will be set to @c NULL. 'b' may not appear inside an optional
* tuple specification; use 'B' instead.
*
* @deprecated Provided for backward compatibility with the 1.7 API.
* RA_SVN low-level functions are no longer considered public.
*/
SVN_DEPRECATED
svn_error_t *
svn_ra_svn_parse_tuple(const apr_array_header_t *list,
apr_pool_t *pool,
const char *fmt, ...);
/** Read a tuple from the network and parse it as a tuple, using the
* format string notation from svn_ra_svn_parse_tuple().
*
* @deprecated Provided for backward compatibility with the 1.7 API.
* RA_SVN low-level functions are no longer considered public.
*/
SVN_DEPRECATED
svn_error_t *
svn_ra_svn_read_tuple(svn_ra_svn_conn_t *conn,
apr_pool_t *pool,
const char *fmt, ...);
/** Parse an array of @c svn_ra_svn_item_t structures as a list of
* properties, storing the properties in a hash table.
*
* @since New in 1.5.
*
* @deprecated Provided for backward compatibility with the 1.7 API.
* RA_SVN low-level functions are no longer considered public.
*/
SVN_DEPRECATED
svn_error_t *
svn_ra_svn_parse_proplist(const apr_array_header_t *list,
apr_pool_t *pool,
apr_hash_t **props);
/** Read a command response from the network and parse it as a tuple, using
* the format string notation from svn_ra_svn_parse_tuple().
*
* @deprecated Provided for backward compatibility with the 1.7 API.
* RA_SVN low-level functions are no longer considered public.
*/
SVN_DEPRECATED
svn_error_t *
svn_ra_svn_read_cmd_response(svn_ra_svn_conn_t *conn,
apr_pool_t *pool,
const char *fmt, ...);
/** Accept commands over the network and handle them according to @a
* commands. Command handlers will be passed @a conn, a subpool of @a
* pool (cleared after each command is handled), the parameters of the
* command, and @a baton. Commands will be accepted until a
* terminating command is received (a command with "terminate" set in
* the command table). If a command handler returns an error wrapped
* in SVN_RA_SVN_CMD_ERR (see the @c SVN_CMD_ERR macro), the error
* will be reported to the other side of the connection and the
* command loop will continue; any other kind of error (typically a
* network or protocol error) is passed through to the caller.
*
* @since New in 1.6.
*
* @deprecated Provided for backward compatibility with the 1.7 API.
* RA_SVN low-level functions are no longer considered public.
*/
SVN_DEPRECATED
svn_error_t *
svn_ra_svn_handle_commands2(svn_ra_svn_conn_t *conn,
apr_pool_t *pool,
const svn_ra_svn_cmd_entry_t *commands,
void *baton,
svn_boolean_t error_on_disconnect);
/** Similar to svn_ra_svn_handle_commands2 but @a error_on_disconnect
* is always @c FALSE.
*
* @deprecated Provided for backward compatibility with the 1.5 API.
*/
SVN_DEPRECATED
svn_error_t *
svn_ra_svn_handle_commands(svn_ra_svn_conn_t *conn,
apr_pool_t *pool,
const svn_ra_svn_cmd_entry_t *commands,
void *baton);
/** Write a command over the network, using the same format string notation
* as svn_ra_svn_write_tuple().
*
* @deprecated Provided for backward compatibility with the 1.7 API.
* RA_SVN low-level functions are no longer considered public.
*/
SVN_DEPRECATED
svn_error_t *
svn_ra_svn_write_cmd(svn_ra_svn_conn_t *conn,
apr_pool_t *pool,
const char *cmdname,
const char *fmt, ...);
/** Write a successful command response over the network, using the
* same format string notation as svn_ra_svn_write_tuple(). Do not use
* partial tuples with this function; if you need to use partial
* tuples, just write out the "success" and argument tuple by hand.
*
* @deprecated Provided for backward compatibility with the 1.7 API.
* RA_SVN low-level functions are no longer considered public.
*/
SVN_DEPRECATED
svn_error_t *
svn_ra_svn_write_cmd_response(svn_ra_svn_conn_t *conn,
apr_pool_t *pool,
const char *fmt, ...);
/** Write an unsuccessful command response over the network.
*
* @deprecated Provided for backward compatibility with the 1.7 API.
* RA_SVN low-level functions are no longer considered public.
*/
SVN_DEPRECATED
svn_error_t *
svn_ra_svn_write_cmd_failure(svn_ra_svn_conn_t *conn,
apr_pool_t *pool,
svn_error_t *err);
/**
* @}
*/
#ifdef __cplusplus
}
#endif /* __cplusplus */
#endif /* SVN_RA_SVN_H */

File diff suppressed because it is too large Load Diff

View File

@ -0,0 +1,223 @@
/**
* @copyright
* ====================================================================
* Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements. See the NOTICE file
* distributed with this work for additional information
* regarding copyright ownership. The ASF licenses this file
* to you under the Apache License, Version 2.0 (the
* "License"); you may not use this file except in compliance
* with the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing,
* software distributed under the License is distributed on an
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
* KIND, either express or implied. See the License for the
* specific language governing permissions and limitations
* under the License.
* ====================================================================
* @endcopyright
*
* @file svn_sorts.h
* @brief all sorts of sorts.
*/
#ifndef SVN_SORTS_H
#define SVN_SORTS_H
#include <apr.h> /* for apr_ssize_t */
#include <apr_pools.h> /* for apr_pool_t */
#include <apr_tables.h> /* for apr_array_header_t */
#include <apr_hash.h> /* for apr_hash_t */
/* Define a MAX macro if we don't already have one */
#ifndef MAX
#define MAX(a, b) ((a) < (b) ? (b) : (a))
#endif
/* Define a MIN macro if we don't already have one */
#ifndef MIN
#define MIN(a, b) ((a) < (b) ? (a) : (b))
#endif
#ifdef __cplusplus
extern "C" {
#endif /* __cplusplus */
/** This structure is used to hold a key/value from a hash table.
* @note Private. For use by Subversion's own code only. See issue #1644.
*/
typedef struct svn_sort__item_t {
/** pointer to the key */
const void *key;
/** size of the key */
apr_ssize_t klen;
/** pointer to the value */
void *value;
} svn_sort__item_t;
/** Compare two @c svn_sort__item_t's, returning an integer greater than,
* equal to, or less than 0, according to whether the key of @a a is
* greater than, equal to, or less than the key of @a b as determined
* by comparing them with svn_path_compare_paths().
*
* The key strings must be NULL-terminated, even though klen does not
* include the terminator.
*
* This is useful for converting a hash into a sorted
* @c apr_array_header_t. For example, to convert hash @a hsh to a sorted
* array, do this:
*
* @code
apr_array_header_t *array;
array = svn_sort__hash(hsh, svn_sort_compare_items_as_paths, pool);
@endcode
*
* This function works like svn_sort_compare_items_lexically() except that it
* orders children in subdirectories directly after their parents. This allows
* using the given ordering for a depth first walk, but at a performance
* penalty. Code that doesn't need this special behavior for children, e.g. when
* sorting files at a single directory level should use
* svn_sort_compare_items_lexically() instead.
*/
int
svn_sort_compare_items_as_paths(const svn_sort__item_t *a,
const svn_sort__item_t *b);
/** Compare two @c svn_sort__item_t's, returning an integer greater than,
* equal to, or less than 0, according as @a a is greater than, equal to,
* or less than @a b according to a lexical key comparison. The keys are
* not required to be zero-terminated.
*/
int
svn_sort_compare_items_lexically(const svn_sort__item_t *a,
const svn_sort__item_t *b);
/** Compare two @c svn_revnum_t's, returning an integer greater than, equal
* to, or less than 0, according as @a b is greater than, equal to, or less
* than @a a. Note that this sorts newest revision to oldest (IOW, descending
* order).
*
* This function is compatible for use with qsort().
*
* This is useful for converting an array of revisions into a sorted
* @c apr_array_header_t. You are responsible for detecting, preventing or
* removing duplicates.
*/
int
svn_sort_compare_revisions(const void *a,
const void *b);
/**
* Compare two @c const char * paths, @a *a and @a *b, returning an
* integer greater than, equal to, or less than 0, using the same
* comparison rules as are used by svn_path_compare_paths().
*
* This function is compatible for use with qsort().
*
* @since New in 1.1.
*/
int
svn_sort_compare_paths(const void *a,
const void *b);
/**
* Compare two @c svn_merge_range_t *'s, @a *a and @a *b, returning an
* integer greater than, equal to, or less than 0 if the first range is
* greater than, equal to, or less than, the second range.
*
* Both @c svn_merge_range_t *'s must describe forward merge ranges.
*
* If @a *a and @a *b intersect then the range with the lower start revision
* is considered the lesser range. If the ranges' start revisions are
* equal then the range with the lower end revision is considered the
* lesser range.
*
* @since New in 1.5
*/
int
svn_sort_compare_ranges(const void *a,
const void *b);
/** Sort @a ht according to its keys, return an @c apr_array_header_t
* containing @c svn_sort__item_t structures holding those keys and values
* (i.e. for each @c svn_sort__item_t @a item in the returned array,
* @a item->key and @a item->size are the hash key, and @a item->value points to
* the hash value).
*
* Storage is shared with the original hash, not copied.
*
* @a comparison_func should take two @c svn_sort__item_t's and return an
* integer greater than, equal to, or less than 0, according as the first item
* is greater than, equal to, or less than the second.
*
* @note Private. For use by Subversion's own code only. See issue #1644.
*
* @note This function and the @c svn_sort__item_t should go over to APR.
*/
apr_array_header_t *
svn_sort__hash(apr_hash_t *ht,
int (*comparison_func)(const svn_sort__item_t *,
const svn_sort__item_t *),
apr_pool_t *pool);
/* Return the lowest index at which the element @a *key should be inserted into
* the array @a array, according to the ordering defined by @a compare_func.
* The array must already be sorted in the ordering defined by @a compare_func.
* @a compare_func is defined as for the C stdlib function bsearch().
*
* @note Private. For use by Subversion's own code only.
*/
int
svn_sort__bsearch_lower_bound(const void *key,
const apr_array_header_t *array,
int (*compare_func)(const void *, const void *));
/* Insert a shallow copy of @a *new_element into the array @a array at the index
* @a insert_index, growing the array and shuffling existing elements along to
* make room.
*
* @note Private. For use by Subversion's own code only.
*/
void
svn_sort__array_insert(const void *new_element,
apr_array_header_t *array,
int insert_index);
/* Remove @a elements_to_delete elements starting at @a delete_index from the
* array @a arr. If @a delete_index is not a valid element of @a arr,
* @a elements_to_delete is not greater than zero, or
* @a delete_index + @a elements_to_delete is greater than @a arr->nelts,
* then do nothing.
*
* @note Private. For use by Subversion's own code only.
*/
void
svn_sort__array_delete(apr_array_header_t *arr,
int delete_index,
int elements_to_delete);
/* Reverse the order of elements in @a array, in place.
*
* @note Private. For use by Subversion's own code only.
*/
void
svn_sort__array_reverse(apr_array_header_t *array,
apr_pool_t *scratch_pool);
#ifdef __cplusplus
}
#endif /* __cplusplus */
#endif /* SVN_SORTS_H */

View File

@ -0,0 +1,577 @@
/**
* @copyright
* ====================================================================
* Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements. See the NOTICE file
* distributed with this work for additional information
* regarding copyright ownership. The ASF licenses this file
* to you under the Apache License, Version 2.0 (the
* "License"); you may not use this file except in compliance
* with the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing,
* software distributed under the License is distributed on an
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
* KIND, either express or implied. See the License for the
* specific language governing permissions and limitations
* under the License.
* ====================================================================
* @endcopyright
*
* @file svn_string.h
* @brief Counted-length strings for Subversion, plus some C string goodies.
*
* There are two string datatypes: @c svn_string_t and @c svn_stringbuf_t.
* The former is a simple pointer/length pair useful for passing around
* strings (or arbitrary bytes) with a counted length. @c svn_stringbuf_t is
* buffered to enable efficient appending of strings without an allocation
* and copy for each append operation.
*
* @c svn_string_t contains a <tt>const char *</tt> for its data, so it is
* most appropriate for constant data and for functions which expect constant,
* counted data. Functions should generally use <tt>const @c svn_string_t
* *</tt> as their parameter to indicate they are expecting a constant,
* counted string.
*
* @c svn_stringbuf_t uses a plain <tt>char *</tt> for its data, so it is
* most appropriate for modifiable data.
*
* <h3>Invariants</h3>
*
* 1. Null termination:
*
* Both structures maintain a significant invariant:
*
* <tt>s->data[s->len] == '\\0'</tt>
*
* The functions defined within this header file will maintain
* the invariant (which does imply that memory is
* allocated/defined as @c len+1 bytes). If code outside of the
* @c svn_string.h functions manually builds these structures,
* then they must enforce this invariant.
*
* Note that an @c svn_string(buf)_t may contain binary data,
* which means that strlen(s->data) does not have to equal @c
* s->len. The null terminator is provided to make it easier to
* pass @c s->data to C string interfaces.
*
*
* 2. Non-NULL input:
*
* All the functions assume their input data pointer is non-NULL,
* unless otherwise documented, and may seg fault if passed
* NULL. The input data may *contain* null bytes, of course, just
* the data pointer itself must not be NULL.
*
* <h3>Memory allocation</h3>
*
* All the functions make a deep copy of all input data, and never store
* a pointer to the original input data.
*/
#ifndef SVN_STRING_H
#define SVN_STRING_H
#include <apr.h> /* for apr_size_t */
#include <apr_pools.h> /* for apr_pool_t */
#include <apr_tables.h> /* for apr_array_header_t */
#include "svn_types.h" /* for svn_boolean_t, svn_error_t */
#ifdef __cplusplus
extern "C" {
#endif /* __cplusplus */
/**
* @defgroup svn_string String handling
* @{
*/
/** A simple counted string. */
typedef struct svn_string_t
{
const char *data; /**< pointer to the bytestring */
apr_size_t len; /**< length of bytestring */
} svn_string_t;
/** A buffered string, capable of appending without an allocation and copy
* for each append. */
typedef struct svn_stringbuf_t
{
/** a pool from which this string was originally allocated, and is not
* necessarily specific to this string. This is used only for allocating
* more memory from when the string needs to grow.
*/
apr_pool_t *pool;
/** pointer to the bytestring */
char *data;
/** length of bytestring */
apr_size_t len;
/** total size of buffer allocated */
apr_size_t blocksize;
} svn_stringbuf_t;
/**
* @defgroup svn_string_svn_string_t svn_string_t functions
* @{
*/
/** Create a new string copied from the null-terminated C string @a cstring.
*/
svn_string_t *
svn_string_create(const char *cstring, apr_pool_t *pool);
/** Create a new, empty string.
*
* @since New in 1.8.
*/
svn_string_t *
svn_string_create_empty(apr_pool_t *pool);
/** Create a new string copied from a generic string of bytes, @a bytes, of
* length @a size bytes. @a bytes is NOT assumed to be null-terminated, but
* the new string will be.
*/
svn_string_t *
svn_string_ncreate(const char *bytes, apr_size_t size, apr_pool_t *pool);
/** Create a new string copied from the stringbuf @a strbuf.
*/
svn_string_t *
svn_string_create_from_buf(const svn_stringbuf_t *strbuf, apr_pool_t *pool);
/** Create a new string by printf-style formatting using @a fmt and the
* variable arguments, which are as appropriate for apr_psprintf().
*/
svn_string_t *
svn_string_createf(apr_pool_t *pool, const char *fmt, ...)
__attribute__((format(printf, 2, 3)));
/** Create a new string by printf-style formatting using @c fmt and @a ap.
* This is the same as svn_string_createf() except for the different
* way of passing the variable arguments.
*/
svn_string_t *
svn_string_createv(apr_pool_t *pool, const char *fmt, va_list ap)
__attribute__((format(printf, 2, 0)));
/** Return TRUE if @a str is empty (has length zero). */
svn_boolean_t
svn_string_isempty(const svn_string_t *str);
/** Return a duplicate of @a original_string. */
svn_string_t *
svn_string_dup(const svn_string_t *original_string, apr_pool_t *pool);
/** Return @c TRUE iff @a str1 and @a str2 have identical length and data. */
svn_boolean_t
svn_string_compare(const svn_string_t *str1, const svn_string_t *str2);
/** Return offset of first non-whitespace character in @a str, or return
* @a str->len if none.
*/
apr_size_t
svn_string_first_non_whitespace(const svn_string_t *str);
/** Return position of last occurrence of @a ch in @a str, or return
* @a str->len if no occurrence.
*/
apr_size_t
svn_string_find_char_backward(const svn_string_t *str, char ch);
/** @} */
/**
* @defgroup svn_string_svn_stringbuf_t svn_stringbuf_t functions
* @{
*/
/** Create a new stringbuf copied from the null-terminated C string
* @a cstring.
*/
svn_stringbuf_t *
svn_stringbuf_create(const char *cstring, apr_pool_t *pool);
/** Create a new stringbuf copied from the generic string of bytes, @a bytes,
* of length @a size bytes. @a bytes is NOT assumed to be null-terminated,
* but the new stringbuf will be.
*/
svn_stringbuf_t *
svn_stringbuf_ncreate(const char *bytes, apr_size_t size, apr_pool_t *pool);
/** Create a new, empty stringbuf.
*
* @since New in 1.8.
*/
svn_stringbuf_t *
svn_stringbuf_create_empty(apr_pool_t *pool);
/** Create a new, empty stringbuf with at least @a minimum_size bytes of
* space available in the memory block.
*
* The allocated string buffer will be at least one byte larger than
* @a minimum_size to account for a final '\\0'.
*
* @since New in 1.6.
*/
svn_stringbuf_t *
svn_stringbuf_create_ensure(apr_size_t minimum_size, apr_pool_t *pool);
/** Create a new stringbuf copied from the string @a str.
*/
svn_stringbuf_t *
svn_stringbuf_create_from_string(const svn_string_t *str, apr_pool_t *pool);
/** Create a new stringbuf by printf-style formatting using @a fmt and the
* variable arguments, which are as appropriate for apr_psprintf().
*/
svn_stringbuf_t *
svn_stringbuf_createf(apr_pool_t *pool, const char *fmt, ...)
__attribute__((format(printf, 2, 3)));
/** Create a new stringbuf by printf-style formatting using @c fmt and @a ap.
* This is the same as svn_stringbuf_createf() except for the different
* way of passing the variable arguments.
*/
svn_stringbuf_t *
svn_stringbuf_createv(apr_pool_t *pool, const char *fmt, va_list ap)
__attribute__((format(printf, 2, 0)));
/** Make sure that @a str has at least @a minimum_size
* bytes of space available in the memory block.
*
* The allocated string buffer will be at least one byte larger than
* @a minimum_size to account for a final '\\0'.
*
* @note: Before Subversion 1.8 this function did not ensure space for
* one byte more than @a minimum_size. If compatibility with pre-1.8
* behaviour is required callers must assume space for only
* @a minimum_size-1 data bytes plus a final '\\0'.
*/
void
svn_stringbuf_ensure(svn_stringbuf_t *str, apr_size_t minimum_size);
/** Set @a str to a copy of the null-terminated C string @a value. */
void
svn_stringbuf_set(svn_stringbuf_t *str, const char *value);
/** Set @a str to empty (zero length). */
void
svn_stringbuf_setempty(svn_stringbuf_t *str);
/** Return @c TRUE if @a str is empty (has length zero). */
svn_boolean_t
svn_stringbuf_isempty(const svn_stringbuf_t *str);
/** Chop @a nbytes bytes off end of @a str, but not more than @a str->len. */
void
svn_stringbuf_chop(svn_stringbuf_t *str, apr_size_t nbytes);
/** Fill @a str with character @a c. */
void
svn_stringbuf_fillchar(svn_stringbuf_t *str, unsigned char c);
/** Append the single character @a byte onto @a targetstr.
*
* This is an optimized version of svn_stringbuf_appendbytes()
* that is much faster to call and execute. Gains vary with the ABI.
* The advantages extend beyond the actual call because the reduced
* register pressure allows for more optimization within the caller.
*
* reallocs if necessary. @a targetstr is affected, nothing else is.
* @since New in 1.7.
*/
void
svn_stringbuf_appendbyte(svn_stringbuf_t *targetstr,
char byte);
/** Append an array of bytes onto @a targetstr.
*
* reallocs if necessary. @a targetstr is affected, nothing else is.
*/
void
svn_stringbuf_appendbytes(svn_stringbuf_t *targetstr,
const char *bytes,
apr_size_t count);
/** Append the stringbuf @c appendstr onto @a targetstr.
*
* reallocs if necessary. @a targetstr is affected, nothing else is.
*/
void
svn_stringbuf_appendstr(svn_stringbuf_t *targetstr,
const svn_stringbuf_t *appendstr);
/** Append the C string @a cstr onto @a targetstr.
*
* reallocs if necessary. @a targetstr is affected, nothing else is.
*/
void
svn_stringbuf_appendcstr(svn_stringbuf_t *targetstr,
const char *cstr);
/** Read @a count bytes from @a bytes and insert them into @a str at
* position @a pos and following. The resulting string will be
* @c count+str->len bytes long. If @c pos is larger or equal to the
* number of bytes currently used in @a str, simply append @a bytes.
*
* Reallocs if necessary. @a str is affected, nothing else is.
*
* @note The inserted string may be a sub-range if @a str.
*
* @since New in 1.8.
*/
void
svn_stringbuf_insert(svn_stringbuf_t *str,
apr_size_t pos,
const char *bytes,
apr_size_t count);
/** Removes @a count bytes from @a str, starting at position @a pos.
* If that range exceeds the current string data, @a str gets truncated
* at @a pos. If the latter is larger or equal to @c str->pos, this will
* be a no-op. Otherwise, the resulting string will be @c str->len-count
* bytes long.
*
* @since New in 1.8.
*/
void
svn_stringbuf_remove(svn_stringbuf_t *str,
apr_size_t pos,
apr_size_t count);
/** Replace in @a str the substring which starts at @a pos and is @a
* old_count bytes long with a new substring @a bytes (which is @a
* new_count bytes long).
*
* This is faster but functionally equivalent to the following sequence:
* @code
svn_stringbuf_remove(str, pos, old_count);
svn_stringbuf_insert(str, pos, bytes, new_count);
* @endcode
*
* @since New in 1.8.
*/
void
svn_stringbuf_replace(svn_stringbuf_t *str,
apr_size_t pos,
apr_size_t old_count,
const char *bytes,
apr_size_t new_count);
/** Return a duplicate of @a original_string. */
svn_stringbuf_t *
svn_stringbuf_dup(const svn_stringbuf_t *original_string, apr_pool_t *pool);
/** Return @c TRUE iff @a str1 and @a str2 have identical length and data. */
svn_boolean_t
svn_stringbuf_compare(const svn_stringbuf_t *str1,
const svn_stringbuf_t *str2);
/** Return offset of first non-whitespace character in @a str, or return
* @a str->len if none.
*/
apr_size_t
svn_stringbuf_first_non_whitespace(const svn_stringbuf_t *str);
/** Strip whitespace from both sides of @a str (modified in place). */
void
svn_stringbuf_strip_whitespace(svn_stringbuf_t *str);
/** Return position of last occurrence of @a ch in @a str, or return
* @a str->len if no occurrence.
*/
apr_size_t
svn_stringbuf_find_char_backward(const svn_stringbuf_t *str, char ch);
/** Return @c TRUE iff @a str1 and @a str2 have identical length and data. */
svn_boolean_t
svn_string_compare_stringbuf(const svn_string_t *str1,
const svn_stringbuf_t *str2);
/** @} */
/**
* @defgroup svn_string_cstrings C string functions
* @{
*/
/** Divide @a input into substrings along @a sep_chars boundaries, return an
* array of copies of those substrings (plain const char*), allocating both
* the array and the copies in @a pool.
*
* None of the elements added to the array contain any of the
* characters in @a sep_chars, and none of the new elements are empty
* (thus, it is possible that the returned array will have length
* zero).
*
* If @a chop_whitespace is TRUE, then remove leading and trailing
* whitespace from the returned strings.
*/
apr_array_header_t *
svn_cstring_split(const char *input,
const char *sep_chars,
svn_boolean_t chop_whitespace,
apr_pool_t *pool);
/** Like svn_cstring_split(), but append to existing @a array instead of
* creating a new one. Allocate the copied substrings in @a pool
* (i.e., caller decides whether or not to pass @a array->pool as @a pool).
*/
void
svn_cstring_split_append(apr_array_header_t *array,
const char *input,
const char *sep_chars,
svn_boolean_t chop_whitespace,
apr_pool_t *pool);
/** Return @c TRUE iff @a str matches any of the elements of @a list, a list
* of zero or more glob patterns.
*/
svn_boolean_t
svn_cstring_match_glob_list(const char *str, const apr_array_header_t *list);
/** Return @c TRUE iff @a str exactly matches any of the elements of @a list.
*
* @since new in 1.7
*/
svn_boolean_t
svn_cstring_match_list(const char *str, const apr_array_header_t *list);
/**
* Get the next token from @a *str interpreting any char from @a sep as a
* token separator. Separators at the beginning of @a str will be skipped.
* Returns a pointer to the beginning of the first token in @a *str or NULL
* if no token is left. Modifies @a str such that the next call will return
* the next token.
*
* @note The content of @a *str may be modified by this function.
*
* @since New in 1.8.
*/
char *
svn_cstring_tokenize(const char *sep, char **str);
/**
* Return the number of line breaks in @a msg, allowing any kind of newline
* termination (CR, LF, CRLF, or LFCR), even inconsistent.
*
* @since New in 1.2.
*/
int
svn_cstring_count_newlines(const char *msg);
/**
* Return a cstring which is the concatenation of @a strings (an array
* of char *) each followed by @a separator (that is, @a separator
* will also end the resulting string). Allocate the result in @a pool.
* If @a strings is empty, then return the empty string.
*
* @since New in 1.2.
*/
char *
svn_cstring_join(const apr_array_header_t *strings,
const char *separator,
apr_pool_t *pool);
/**
* Compare two strings @a atr1 and @a atr2, treating case-equivalent
* unaccented Latin (ASCII subset) letters as equal.
*
* Returns in integer greater than, equal to, or less than 0,
* according to whether @a str1 is considered greater than, equal to,
* or less than @a str2.
*
* @since New in 1.5.
*/
int
svn_cstring_casecmp(const char *str1, const char *str2);
/**
* Parse the C string @a str into a 64 bit number, and return it in @a *n.
* Assume that the number is represented in base @a base.
* Raise an error if conversion fails (e.g. due to overflow), or if the
* converted number is smaller than @a minval or larger than @a maxval.
*
* @since New in 1.7.
*/
svn_error_t *
svn_cstring_strtoi64(apr_int64_t *n, const char *str,
apr_int64_t minval, apr_int64_t maxval,
int base);
/**
* Parse the C string @a str into a 64 bit number, and return it in @a *n.
* Assume that the number is represented in base 10.
* Raise an error if conversion fails (e.g. due to overflow).
*
* @since New in 1.7.
*/
svn_error_t *
svn_cstring_atoi64(apr_int64_t *n, const char *str);
/**
* Parse the C string @a str into a 32 bit number, and return it in @a *n.
* Assume that the number is represented in base 10.
* Raise an error if conversion fails (e.g. due to overflow).
*
* @since New in 1.7.
*/
svn_error_t *
svn_cstring_atoi(int *n, const char *str);
/**
* Parse the C string @a str into an unsigned 64 bit number, and return
* it in @a *n. Assume that the number is represented in base @a base.
* Raise an error if conversion fails (e.g. due to overflow), or if the
* converted number is smaller than @a minval or larger than @a maxval.
*
* @since New in 1.7.
*/
svn_error_t *
svn_cstring_strtoui64(apr_uint64_t *n, const char *str,
apr_uint64_t minval, apr_uint64_t maxval,
int base);
/**
* Parse the C string @a str into an unsigned 64 bit number, and return
* it in @a *n. Assume that the number is represented in base 10.
* Raise an error if conversion fails (e.g. due to overflow).
*
* @since New in 1.7.
*/
svn_error_t *
svn_cstring_atoui64(apr_uint64_t *n, const char *str);
/**
* Parse the C string @a str into an unsigned 32 bit number, and return
* it in @a *n. Assume that the number is represented in base 10.
* Raise an error if conversion fails (e.g. due to overflow).
*
* @since New in 1.7.
*/
svn_error_t *
svn_cstring_atoui(unsigned int *n, const char *str);
/** @} */
/** @} */
#ifdef __cplusplus
}
#endif /* __cplusplus */
#endif /* SVN_STRING_H */

View File

@ -0,0 +1,708 @@
/**
* @copyright
* ====================================================================
* Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements. See the NOTICE file
* distributed with this work for additional information
* regarding copyright ownership. The ASF licenses this file
* to you under the Apache License, Version 2.0 (the
* "License"); you may not use this file except in compliance
* with the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing,
* software distributed under the License is distributed on an
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
* KIND, either express or implied. See the License for the
* specific language governing permissions and limitations
* under the License.
* ====================================================================
* @endcopyright
*
* @file svn_subst.h
* @brief Data substitution (keywords and EOL style)
*/
#ifndef SVN_SUBST_H
#define SVN_SUBST_H
#include <apr_pools.h>
#include <apr_hash.h>
#include <apr_time.h>
#include "svn_types.h"
#include "svn_string.h"
#include "svn_io.h"
#ifdef __cplusplus
extern "C" {
#endif /* __cplusplus */
/* EOL conversion and keyword expansion. */
/** The EOL used in the Repository for "native" files */
#define SVN_SUBST_NATIVE_EOL_STR "\n"
/** Valid states for 'svn:eol-style' property.
*
* Property nonexistence is equivalent to 'none'.
*/
typedef enum svn_subst_eol_style
{
/** An unrecognized style */
svn_subst_eol_style_unknown,
/** EOL translation is "off" or ignored value */
svn_subst_eol_style_none,
/** Translation is set to client's native eol */
svn_subst_eol_style_native,
/** Translation is set to one of LF, CR, CRLF */
svn_subst_eol_style_fixed
} svn_subst_eol_style_t;
/** Set @a *style to the appropriate @c svn_subst_eol_style_t and @a *eol to
* the appropriate cstring for a given svn:eol-style property value.
*
* Set @a *eol to
*
* - @c NULL for @c svn_subst_eol_style_none, or
*
* - a NULL-terminated C string containing the native eol marker
* for this platform, for @c svn_subst_eol_style_native, or
*
* - a NULL-terminated C string containing the eol marker indicated
* by the property value, for @c svn_subst_eol_style_fixed.
*
* If @a *style is NULL, it is ignored.
*/
void
svn_subst_eol_style_from_value(svn_subst_eol_style_t *style,
const char **eol,
const char *value);
/** Indicates whether the working copy and normalized versions of a file
* with the given the parameters differ. If @a force_eol_check is TRUE,
* the routine also accounts for all translations required due to repairing
* fixed eol styles.
*
* @since New in 1.4
*
*/
svn_boolean_t
svn_subst_translation_required(svn_subst_eol_style_t style,
const char *eol,
apr_hash_t *keywords,
svn_boolean_t special,
svn_boolean_t force_eol_check);
/** Values used in keyword expansion.
*
* @deprecated Provided for backward compatibility with the 1.2 API.
*/
typedef struct svn_subst_keywords_t
{
/**
* @name svn_subst_keywords_t fields
* String expansion of the like-named keyword, or NULL if the keyword
* was not selected in the svn:keywords property.
* @{
*/
const svn_string_t *revision;
const svn_string_t *date;
const svn_string_t *author;
const svn_string_t *url;
const svn_string_t *id;
/** @} */
} svn_subst_keywords_t;
/**
* Set @a *kw to a new keywords hash filled with the appropriate contents
* given a @a keywords_string (the contents of the svn:keywords
* property for the file in question), the revision @a rev, the @a url,
* the @a date the file was committed on, the @a author of the last
* commit, and the URL of the repository root @a repos_root_url.
*
* Custom keywords defined in svn:keywords properties are expanded
* using the provided parameters and in accordance with the following
* format substitutions in the @a keywords_string:
* %a - The author.
* %b - The basename of the URL.
* %d - Short format of the date.
* %D - Long format of the date.
* %P - The file's path, relative to the repository root URL.
* %r - The revision.
* %R - The URL to the root of the repository.
* %u - The URL of the file.
* %_ - A space (keyword definitions cannot contain a literal space).
* %% - A literal '%'.
* %H - Equivalent to %P%_%r%_%d%_%a.
* %I - Equivalent to %b%_%r%_%d%_%a.
*
* Custom keywords are defined by appending '=' to the keyword name, followed
* by a string containing any combination of the format substitutions.
*
* Any of the inputs @a rev, @a url, @a date, @a author, and @a repos_root_url
* can be @c NULL, or @c 0 for @a date, to indicate that the information is
* not present. Each piece of information that is not present expands to the
* empty string wherever it appears in an expanded keyword value. (This can
* result in multiple adjacent spaces in the expansion of a multi-valued
* keyword such as "Id".)
*
* Hash keys are of type <tt>const char *</tt>.
* Hash values are of type <tt>svn_string_t *</tt>.
*
* All memory is allocated out of @a pool.
*
* @since New in 1.8.
*/
svn_error_t *
svn_subst_build_keywords3(apr_hash_t **kw,
const char *keywords_string,
const char *rev,
const char *url,
const char *repos_root_url,
apr_time_t date,
const char *author,
apr_pool_t *pool);
/** Similar to svn_subst_build_keywords3() except that it does not accept
* the @a repos_root_url parameter and hence supports less substitutions,
* and also does not support custom keyword definitions.
*
* @since New in 1.3.
* @deprecated Provided for backward compatibility with the 1.7 API.
*/
SVN_DEPRECATED
svn_error_t *
svn_subst_build_keywords2(apr_hash_t **kw,
const char *keywords_string,
const char *rev,
const char *url,
apr_time_t date,
const char *author,
apr_pool_t *pool);
/** Similar to svn_subst_build_keywords2() except that it populates
* an existing structure @a *kw instead of creating a keywords hash.
*
* @deprecated Provided for backward compatibility with the 1.2 API.
*/
SVN_DEPRECATED
svn_error_t *
svn_subst_build_keywords(svn_subst_keywords_t *kw,
const char *keywords_string,
const char *rev,
const char *url,
apr_time_t date,
const char *author,
apr_pool_t *pool);
/** Return @c TRUE if @a a and @a b do not hold the same keywords.
*
* @a a and @a b are hashes of the form produced by
* svn_subst_build_keywords2().
*
* @since New in 1.3.
*
* If @a compare_values is @c TRUE, "same" means that the @a a and @a b
* contain exactly the same set of keywords, and the values of corresponding
* keywords match as well. Else if @a compare_values is @c FALSE, then
* "same" merely means that @a a and @a b hold the same set of keywords,
* although those keywords' values might differ.
*
* @a a and/or @a b may be @c NULL; for purposes of comparison, @c NULL is
* equivalent to holding no keywords.
*/
svn_boolean_t
svn_subst_keywords_differ2(apr_hash_t *a,
apr_hash_t *b,
svn_boolean_t compare_values,
apr_pool_t *pool);
/** Similar to svn_subst_keywords_differ2() except that it compares
* two @c svn_subst_keywords_t structs instead of keyword hashes.
*
* @deprecated Provided for backward compatibility with the 1.2 API.
*/
SVN_DEPRECATED
svn_boolean_t
svn_subst_keywords_differ(const svn_subst_keywords_t *a,
const svn_subst_keywords_t *b,
svn_boolean_t compare_values);
/**
* Copy and translate the data in @a src_stream into @a dst_stream. It is
* assumed that @a src_stream is a readable stream and @a dst_stream is a
* writable stream.
*
* If @a eol_str is non-@c NULL, replace whatever bytestring @a src_stream
* uses to denote line endings with @a eol_str in the output. If
* @a src_stream has an inconsistent line ending style, then: if @a repair
* is @c FALSE, return @c SVN_ERR_IO_INCONSISTENT_EOL, else if @a repair is
* @c TRUE, convert any line ending in @a src_stream to @a eol_str in
* @a dst_stream. Recognized line endings are: "\n", "\r", and "\r\n".
*
* See svn_subst_stream_translated() for details of the keyword substitution
* which is controlled by the @a expand and @a keywords parameters.
*
* Note that a translation request is *required*: one of @a eol_str or
* @a keywords must be non-@c NULL.
*
* Notes:
*
* See svn_wc__get_keywords() and svn_wc__get_eol_style() for a
* convenient way to get @a eol_str and @a keywords if in libsvn_wc.
*
* @since New in 1.3.
*
* @deprecated Provided for backward compatibility with the 1.5 API.
* Callers should use svn_subst_stream_translated() instead.
*/
SVN_DEPRECATED
svn_error_t *
svn_subst_translate_stream3(svn_stream_t *src_stream,
svn_stream_t *dst_stream,
const char *eol_str,
svn_boolean_t repair,
apr_hash_t *keywords,
svn_boolean_t expand,
apr_pool_t *scratch_pool);
/** Similar to svn_subst_translate_stream3() except relies upon a
* @c svn_subst_keywords_t struct instead of a hash for the keywords.
*
* @deprecated Provided for backward compatibility with the 1.2 API.
*/
SVN_DEPRECATED
svn_error_t *
svn_subst_translate_stream2(svn_stream_t *src_stream,
svn_stream_t *dst_stream,
const char *eol_str,
svn_boolean_t repair,
const svn_subst_keywords_t *keywords,
svn_boolean_t expand,
apr_pool_t *scratch_pool);
/**
* Same as svn_subst_translate_stream2(), but does not take a @a pool
* argument, instead creates a temporary subpool of the global pool, and
* destroys it before returning.
*
* @deprecated Provided for backward compatibility with the 1.1 API.
*/
SVN_DEPRECATED
svn_error_t *
svn_subst_translate_stream(svn_stream_t *src_stream,
svn_stream_t *dst_stream,
const char *eol_str,
svn_boolean_t repair,
const svn_subst_keywords_t *keywords,
svn_boolean_t expand);
/** Return a stream which performs eol translation and keyword
* expansion when read from or written to. The stream @a stream
* is used to read and write all data.
*
* Make sure you call svn_stream_close() on the returned stream to
* ensure all data is flushed and cleaned up (this will also close
* the provided @a stream).
*
* Read operations from and write operations to the stream
* perform the same operation: if @a expand is @c FALSE, both
* contract keywords. One stream supports both read and write
* operations. Reads and writes may be mixed.
*
* If @a eol_str is non-@c NULL, replace whatever bytestring the input uses
* to denote line endings with @a eol_str in the output. If the input has
* an inconsistent line ending style, then: if @a repair is @c FALSE, then a
* subsequent read, write or other operation on the stream will return
* @c SVN_ERR_IO_INCONSISTENT_EOL when the inconsistency is detected, else
* if @a repair is @c TRUE, convert any line ending to @a eol_str.
* Recognized line endings are: "\n", "\r", and "\r\n".
*
* Expand and contract keywords using the contents of @a keywords as the
* new values. If @a expand is @c TRUE, expand contracted keywords and
* re-expand expanded keywords. If @a expand is @c FALSE, contract expanded
* keywords and ignore contracted ones. Keywords not found in the hash are
* ignored (not contracted or expanded). If the @a keywords hash
* itself is @c NULL, keyword substitution will be altogether ignored.
*
* Detect only keywords that are no longer than @c SVN_KEYWORD_MAX_LEN
* bytes, including the delimiters and the keyword itself.
*
* Recommendation: if @a expand is FALSE, then you don't care about the
* keyword values, so use empty strings as non-NULL signifiers when you
* build the keywords hash.
*
* The stream returned is allocated in @a result_pool.
*
* If the inner stream implements resetting via svn_stream_reset(),
* or marking and seeking via svn_stream_mark() and svn_stream_seek(),
* the translated stream will too.
*
* @since New in 1.4.
*/
svn_stream_t *
svn_subst_stream_translated(svn_stream_t *stream,
const char *eol_str,
svn_boolean_t repair,
apr_hash_t *keywords,
svn_boolean_t expand,
apr_pool_t *result_pool);
/** Set @a *stream to a stream which performs eol translation and keyword
* expansion when read from or written to. The stream @a source
* is used to read and write all data. Make sure you call
* svn_stream_close() on @a stream to make sure all data are flushed
* and cleaned up.
*
* When @a stream is closed, then @a source will be closed.
*
* Read and write operations perform the same transformation:
* all data is translated to normal form.
*
* @see svn_subst_translate_to_normal_form()
*
* @since New in 1.5.
* @deprecated Provided for backward compatibility with the 1.5 API.
*/
SVN_DEPRECATED
svn_error_t *
svn_subst_stream_translated_to_normal_form(svn_stream_t **stream,
svn_stream_t *source,
svn_subst_eol_style_t eol_style,
const char *eol_str,
svn_boolean_t always_repair_eols,
apr_hash_t *keywords,
apr_pool_t *pool);
/** Set @a *stream to a readable stream containing the "normal form"
* of the special file located at @a path. The stream will be allocated
* in @a result_pool, and any temporary allocations will be made in
* @a scratch_pool.
*
* If the file at @a path is in fact a regular file, just read its content,
* which should be in the "normal form" for a special file. This enables
* special files to be written and read on platforms that do not treat them
* as special.
*
* @since New in 1.6.
*/
svn_error_t *
svn_subst_read_specialfile(svn_stream_t **stream,
const char *path,
apr_pool_t *result_pool,
apr_pool_t *scratch_pool);
/** Set @a *stream to a writable stream that accepts content in
* the "normal form" for a special file, to be located at @a path, and
* will create that file when the stream is closed. The stream will be
* allocated in @a result_pool, and any temporary allocations will be
* made in @a scratch_pool.
*
* If the platform does not support the semantics of the special file, write
* a regular file containing the "normal form" text. This enables special
* files to be written and read on platforms that do not treat them as
* special.
*
* Note: the target file is created in a temporary location, then renamed
* into position, so the creation can be considered "atomic".
*
* @since New in 1.6.
*/
svn_error_t *
svn_subst_create_specialfile(svn_stream_t **stream,
const char *path,
apr_pool_t *result_pool,
apr_pool_t *scratch_pool);
/** Set @a *stream to a stream which translates the special file at @a path
* to the internal representation for special files when read from. When
* written to, it does the reverse: creating a special file when the
* stream is closed.
*
* @since New in 1.5.
*
* @deprecated Provided for backward compatibility with the 1.5 API.
* Callers should use svn_subst_read_specialfile or
* svn_subst_create_specialfile as appropriate.
*/
SVN_DEPRECATED
svn_error_t *
svn_subst_stream_from_specialfile(svn_stream_t **stream,
const char *path,
apr_pool_t *pool);
/**
* Copy the contents of file-path @a src to file-path @a dst atomically,
* either creating @a dst or overwriting @a dst if it exists, possibly
* performing line ending and keyword translations.
*
* The parameters @a *eol_str, @a repair, @a *keywords and @a expand are
* defined the same as in svn_subst_translate_stream3().
*
* In addition, it will create a special file from normal form or
* translate one to normal form if @a special is @c TRUE.
*
* If anything goes wrong during the copy, attempt to delete @a dst (if
* it exists).
*
* If @a eol_str and @a keywords are @c NULL, behavior is just a byte-for-byte
* copy.
*
* @a cancel_func and @a cancel_baton will be called (if not NULL)
* periodically to check for cancellation.
*
* @since New in 1.7.
*/
svn_error_t *
svn_subst_copy_and_translate4(const char *src,
const char *dst,
const char *eol_str,
svn_boolean_t repair,
apr_hash_t *keywords,
svn_boolean_t expand,
svn_boolean_t special,
svn_cancel_func_t cancel_func,
void *cancel_baton,
apr_pool_t *pool);
/**
* Similar to svn_subst_copy_and_translate4() but without a cancellation
* function and baton.
*
* @since New in 1.3.
* @deprecated Provided for backward compatibility with the 1.6 API.
*/
SVN_DEPRECATED
svn_error_t *
svn_subst_copy_and_translate3(const char *src,
const char *dst,
const char *eol_str,
svn_boolean_t repair,
apr_hash_t *keywords,
svn_boolean_t expand,
svn_boolean_t special,
apr_pool_t *pool);
/**
* Similar to svn_subst_copy_and_translate3() except that @a keywords is a
* @c svn_subst_keywords_t struct instead of a keywords hash.
*
* @deprecated Provided for backward compatibility with the 1.2 API.
* @since New in 1.1.
*/
SVN_DEPRECATED
svn_error_t *
svn_subst_copy_and_translate2(const char *src,
const char *dst,
const char *eol_str,
svn_boolean_t repair,
const svn_subst_keywords_t *keywords,
svn_boolean_t expand,
svn_boolean_t special,
apr_pool_t *pool);
/**
* Similar to svn_subst_copy_and_translate2() except that @a special is
* always set to @c FALSE.
*
* @deprecated Provided for backward compatibility with the 1.0 API.
*/
SVN_DEPRECATED
svn_error_t *
svn_subst_copy_and_translate(const char *src,
const char *dst,
const char *eol_str,
svn_boolean_t repair,
const svn_subst_keywords_t *keywords,
svn_boolean_t expand,
apr_pool_t *pool);
/**
* Set @a *dst to a copy of the string @a src, possibly performing line
* ending and keyword translations.
*
* This is a variant of svn_subst_translate_stream3() that operates on
* cstrings. @see svn_subst_stream_translated() for details of the
* translation and of @a eol_str, @a repair, @a keywords and @a expand.
*
* If @a eol_str and @a keywords are @c NULL, behavior is just a byte-for-byte
* copy.
*
* Allocate @a *dst in @a pool.
*
* @since New in 1.3.
*/
svn_error_t *
svn_subst_translate_cstring2(const char *src,
const char **dst,
const char *eol_str,
svn_boolean_t repair,
apr_hash_t *keywords,
svn_boolean_t expand,
apr_pool_t *pool);
/**
* Similar to svn_subst_translate_cstring2() except that @a keywords is a
* @c svn_subst_keywords_t struct instead of a keywords hash.
*
* @deprecated Provided for backward compatibility with the 1.2 API.
*/
SVN_DEPRECATED
svn_error_t *
svn_subst_translate_cstring(const char *src,
const char **dst,
const char *eol_str,
svn_boolean_t repair,
const svn_subst_keywords_t *keywords,
svn_boolean_t expand,
apr_pool_t *pool);
/**
* Translate the file @a src in working copy form to a file @a dst in
* normal form.
*
* The values specified for @a eol_style, @a *eol_str, @a keywords and
* @a special, should be the ones used to translate the file to its
* working copy form. Usually, these are the values specified by the
* user in the files' properties.
*
* Inconsistent line endings in the file will be automatically repaired
* (made consistent) for some eol styles. For all others, an error is
* returned. By setting @a always_repair_eols to @c TRUE, eols will be
* made consistent even for those styles which don't have it by default.
*
* @note To translate a file FROM normal form, use
* svn_subst_copy_and_translate3().
*
* @since New in 1.4
* @deprecated Provided for backward compatibility with the 1.5 API
*/
SVN_DEPRECATED
svn_error_t *
svn_subst_translate_to_normal_form(const char *src,
const char *dst,
svn_subst_eol_style_t eol_style,
const char *eol_str,
svn_boolean_t always_repair_eols,
apr_hash_t *keywords,
svn_boolean_t special,
apr_pool_t *pool);
/**
* Set @a *stream_p to a stream that detranslates the file @a src from
* working copy form to normal form, allocated in @a pool.
*
* The values specified for @a eol_style, @a *eol_str, @a keywords and
* @a special, should be the ones used to translate the file to its
* working copy form. Usually, these are the values specified by the
* user in the files' properties.
*
* Inconsistent line endings in the file will be automatically repaired
* (made consistent) for some eol styles. For all others, an error is
* returned. By setting @a always_repair_eols to @c TRUE, eols will be
* made consistent even for those styles which don't have it by default.
*
* @since New in 1.4.
*
* @deprecated Provided for backward compatibility with the 1.5 API.
* Use svn_subst_stream_from_specialfile if the source is special;
* otherwise, use svn_subst_stream_translated_to_normal_form.
*/
SVN_DEPRECATED
svn_error_t *
svn_subst_stream_detranslated(svn_stream_t **stream_p,
const char *src,
svn_subst_eol_style_t eol_style,
const char *eol_str,
svn_boolean_t always_repair_eols,
apr_hash_t *keywords,
svn_boolean_t special,
apr_pool_t *pool);
/* EOL conversion and character encodings */
/** Translate the string @a value from character encoding @a encoding to
* UTF8, and also from its current line-ending style to LF line-endings. If
* @a encoding is @c NULL, translate from the system-default encoding.
*
* If @a translated_to_utf8 is not @c NULL, then set @a *translated_to_utf8
* to @c TRUE if at least one character of @a value in the source character
* encoding was translated to UTF-8, or to @c FALSE otherwise.
*
* If @a translated_line_endings is not @c NULL, then set @a
* *translated_line_endings to @c TRUE if at least one line ending was
* changed to LF, or to @c FALSE otherwise.
*
* If @a value has an inconsistent line ending style, then: if @a repair
* is @c FALSE, return @c SVN_ERR_IO_INCONSISTENT_EOL, else if @a repair is
* @c TRUE, convert any line ending in @a value to "\n" in
* @a *new_value. Recognized line endings are: "\n", "\r", and "\r\n".
*
* Set @a *new_value to the translated string, allocated in @a result_pool.
*
* @a scratch_pool is used for temporary allocations.
*
* @since New in 1.7.
*/
svn_error_t *
svn_subst_translate_string2(svn_string_t **new_value,
svn_boolean_t *translated_to_utf8,
svn_boolean_t *translated_line_endings,
const svn_string_t *value,
const char *encoding,
svn_boolean_t repair,
apr_pool_t *result_pool,
apr_pool_t *scratch_pool);
/** Similar to svn_subst_translate_string2(), except that the information about
* whether re-encoding or line ending translation were performed is discarded.
*
* @deprecated Provided for backward compatibility with the 1.6 API.
*/
SVN_DEPRECATED
svn_error_t *svn_subst_translate_string(svn_string_t **new_value,
const svn_string_t *value,
const char *encoding,
apr_pool_t *pool);
/** Translate the string @a value from UTF8 and LF line-endings into native
* character encoding and native line-endings. If @a for_output is TRUE,
* translate to the character encoding of the output locale, else to that of
* the default locale.
*
* Set @a *new_value to the translated string, allocated in @a pool.
*/
svn_error_t *svn_subst_detranslate_string(svn_string_t **new_value,
const svn_string_t *value,
svn_boolean_t for_output,
apr_pool_t *pool);
#ifdef __cplusplus
}
#endif /* __cplusplus */
#endif /* SVN_SUBST_H */

View File

@ -0,0 +1,94 @@
/**
* @copyright
* ====================================================================
* Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements. See the NOTICE file
* distributed with this work for additional information
* regarding copyright ownership. The ASF licenses this file
* to you under the Apache License, Version 2.0 (the
* "License"); you may not use this file except in compliance
* with the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing,
* software distributed under the License is distributed on an
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
* KIND, either express or implied. See the License for the
* specific language governing permissions and limitations
* under the License.
* ====================================================================
* @endcopyright
*
* @file svn_time.h
* @brief Time/date utilities
*/
#ifndef SVN_TIME_H
#define SVN_TIME_H
#include <apr_pools.h>
#include <apr_time.h>
#include "svn_error.h"
#ifdef __cplusplus
extern "C" {
#endif /* __cplusplus */
/** Convert @a when to a <tt>const char *</tt> representation allocated
* in @a pool. Use svn_time_from_cstring() for the reverse
* conversion.
*/
const char *
svn_time_to_cstring(apr_time_t when,
apr_pool_t *pool);
/** Convert @a data to an @c apr_time_t @a when.
* Use @a pool for temporary memory allocation.
*/
svn_error_t *
svn_time_from_cstring(apr_time_t *when,
const char *data,
apr_pool_t *pool);
/** Convert @a when to a <tt>const char *</tt> representation allocated
* in @a pool, suitable for human display in UTF8.
*/
const char *
svn_time_to_human_cstring(apr_time_t when,
apr_pool_t *pool);
/** Convert a human-readable date @a text into an @c apr_time_t, using
* @a now as the current time and storing the result in @a result.
* The local time zone will be used to compute the appropriate GMT
* offset if @a text contains a local time specification. Set @a
* matched to indicate whether or not @a text was parsed successfully.
* Perform any allocation in @a pool. Return an error iff an internal
* error (rather than a simple parse error) occurs.
*/
svn_error_t *
svn_parse_date(svn_boolean_t *matched,
apr_time_t *result,
const char *text,
apr_time_t now,
apr_pool_t *pool);
/** Sleep until the next second, to ensure that any files modified
* after we exit have a different timestamp than the one we recorded.
*
* @deprecated Provided for backward compatibility with the 1.5 API.
* Use svn_io_sleep_for_timestamps() instead.
*/
SVN_DEPRECATED
void
svn_sleep_for_timestamps(void);
#ifdef __cplusplus
}
#endif /* __cplusplus */
#endif /* SVN_TIME_H */

Some files were not shown because too many files have changed in this diff Show More