Author: stsp
Date: Tue Apr  1 11:51:43 2014
New Revision: 1583639

URL: http://svn.apache.org/r1583639
Log:
Create the ra-git branch: git repository access for Suversion

This allows Subversion clients to interact with git repositories,
paving the way towards better integration of both systems.

This code originated in a private git repository maintained by me and Carlos.
Due to popular demand we're now moving development of this library to
svn.apache.org. Since the Subversion project has finally been convinced
that git has the better backend[1], we hope to accelerate development of
the git repository access layer by joining forces on this project with
the other SVN and libgit2 developers.

[1] https://issues.apache.org/jira/browse/INFRA-7524

We hope to get libsvn_ra_git production ready in time for Subversion 1.9.0.

The long-term intention is that git will become the default repository
backend for Subversion 1.10 and later, lifting much of the burden of
backend development off the SVN team. BDB has already been deprecated in
1.8 because of this burden. Development of the FSFS successor FSX has been
slower than anticipated but FSX will stay as an optional backend in case
empirical data demonstrates that it outperforms git in large deployments.
But the default migration path for the current FSFS userbase will be git.

See the BRANCH-README for design and implementation notes and a list
of remaining TODO items.

Patch by: me
          Carlos Martín Nieto <cmn\ at \elego.de>

* BRANCH-README: New.

* Makefile.in,
  aclocal.m4,
  build/ac-macros/libgit2.m4,
  build.conf,
  configure.ac: Add libgit2 to the build system.

* subversion/include/svn_ra.h
  (svn_ra_get_wc_adm_subdir_func_t): New function which allows the RA
    layer to obtain the absolute path to the working copy admin area.
  (svn_ra_callbacks2_t): Add svn_ra_get_wc_adm_subdir_func_t.
  (svn_ra_git_init): Declare.

* subversion/libsvn_client/ra.c
  (get_wc_adm_subdir): Implementation of svn_ra_get_wc_adm_subdir_func_t.
  (svn_client__open_ra_session_internal): Hook up get_wc_adm_subdir.
  
* subversion/libsvn_ra/deprecated.c
  subversion/libsvn_ra/deprecated.h:
  (svn_ra_git__deprecated_init): New.

* subversion/libsvn_ra/ra_loader.c
  (git_schemes): New table of git URL schemes.
  (ra_lib_defn): Add ra_git.
  (+svn_ra_git_init): New.

* subversion/libsvn_ra/ra_loader.h
  (svn_ra_git__init): Declare.

* subversion/libsvn_ra_git/ra_git.h,
  subversion/libsvn_ra_git/ra_plugin.c,
  subversion/libsvn_ra_git/reporter.c: New files. WIP implementation of ra_git.

* tools/dev/unix-build/Makefile.svn: libgit2 support for my custom build script.

Added:
    subversion/branches/ra-git/   (props changed)
      - copied from r1583623, subversion/trunk/
    subversion/branches/ra-git/BRANCH-README   (with props)
    subversion/branches/ra-git/build/ac-macros/libgit2.m4   (with props)
    subversion/branches/ra-git/subversion/libsvn_ra_git/
    subversion/branches/ra-git/subversion/libsvn_ra_git/ra_git.h   (with props)
    subversion/branches/ra-git/subversion/libsvn_ra_git/ra_plugin.c   (with 
props)
    subversion/branches/ra-git/subversion/libsvn_ra_git/reporter.c   (with 
props)
Modified:
    subversion/branches/ra-git/Makefile.in
    subversion/branches/ra-git/aclocal.m4
    subversion/branches/ra-git/build.conf
    subversion/branches/ra-git/configure.ac
    subversion/branches/ra-git/subversion/include/svn_ra.h
    subversion/branches/ra-git/subversion/libsvn_client/ra.c
    subversion/branches/ra-git/subversion/libsvn_ra/deprecated.c
    subversion/branches/ra-git/subversion/libsvn_ra/deprecated.h
    subversion/branches/ra-git/subversion/libsvn_ra/ra_loader.c
    subversion/branches/ra-git/subversion/libsvn_ra/ra_loader.h
    subversion/branches/ra-git/tools/dev/unix-build/Makefile.svn

Propchange: subversion/branches/ra-git/
------------------------------------------------------------------------------
--- bugtraq:logregex (added)
+++ bugtraq:logregex Tue Apr  1 11:51:43 2014
@@ -0,0 +1,2 @@
+[Ii]ssues?:?(\s*(,|and)?\s*#\d+)+
+(\d+)

Propchange: subversion/branches/ra-git/
------------------------------------------------------------------------------
    bugtraq:url = http://subversion.tigris.org/issues/show_bug.cgi?id=%BUGID%

Propchange: subversion/branches/ra-git/
------------------------------------------------------------------------------
--- svn:ignore (added)
+++ svn:ignore Tue Apr  1 11:51:43 2014
@@ -0,0 +1,57 @@
+ChangeLog*
+Makefile
+config.cache
+config.log
+config.nice
+config.status
+configure
+libtool
+.gdb_history
+.swig_checked
+*.orig
+*.rej
+TAGS
+tags
+neon
+build-outputs.mk
+autogen-standalone.mk
+autom4te.cache
+gen-make.opts
+tests.log*
+fails.log*
+db4-win32
+db
+*.o
+*~
+.*~
+apr
+apr-util
+apr-iconv
+Release
+Debug
+ipch
+subversion_msvc.dsw
+subversion_msvc.ncb
+subversion_msvc.opt
+subversion_msvc.plg
+subversion_vcnet.sln
+subversion_vcnet.ncb
+subversion_vcnet.suo
+subversion_vcnet.v11.suo
+subversion_vcnet.sdf
+subversion_vcnet.opensdf
+mkmf.log
+.project
+.classpath
+.cdtproject
+.settings
+.cproject
+zlib
+sqlite-amalgamation
+serf
+gmock-fused
+.git
+.gitignore
+compile_commands.json
+.kdev4
+*.kdev4

Propchange: subversion/branches/ra-git/
------------------------------------------------------------------------------
--- svn:mergeinfo (added)
+++ svn:mergeinfo Tue Apr  1 11:51:43 2014
@@ -0,0 +1,82 @@
+/subversion/branches/1.5.x-r30215:870312
+/subversion/branches/1.7.x-fs-verify:1146708,1161180
+/subversion/branches/10Gb:1388102,1388163-1388190,1388195,1388202,1388205,1388211,1388276,1388362,1388375,1388394,1388636,1388639-1388640,1388643-1388644,1388654,1388720,1388789,1388795,1388801,1388805,1388807,1388810,1388816,1389044,1389276,1389289,1389662,1389867,1390017,1390209,1390216,1390407,1390409,1390414,1390419,1390955
+/subversion/branches/atomic-revprop:965046-1000689
+/subversion/branches/auto-props-sdc:1384106-1401643
+/subversion/branches/bdb-reverse-deltas:872050-872529
+/subversion/branches/cache-server:1458643-1476567
+/subversion/branches/diff-callbacks3:870059-870761
+/subversion/branches/diff-optimizations:1031270-1037352
+/subversion/branches/diff-optimizations-bytes:1037353-1067789
+/subversion/branches/dont-save-plaintext-passwords-by-default:870728-871118
+/subversion/branches/double-delete:870511-872970
+/subversion/branches/ev2-export:1325914,1332738,1413107
+/subversion/branches/explore-wc:875486,875493,875497,875507,875511,875514,875559,875580-875581,875584,875587,875611,875627,875647,875667-875668,875711-875712,875733-875734,875736,875744-875748,875751,875758,875782,875795-875796,875830,875836,875838,875842,875852,875855,875864,875870,875873,875880,875885-875888,875890,875897-875898,875905,875907-875909,875935,875943-875944,875946,875979,875982-875983,875985-875986,875990,875997
+/subversion/branches/file-externals:871779-873302
+/subversion/branches/fs-rep-sharing:869036-873803
+/subversion/branches/fsfs-format7:1426304,1430673,1433848,1438408,1438982,1441129,1442051,1442068,1442504,1442910,1443171,1443803,1444690,1444693,1444695,1445040,1445080,1446103,1451129,1453590,1454307,1460579,1461851,1461865,1462837,1462904,1463120,1467362,1467382,1469487,1471208,1477166,1478055,1481447,1489817,1489949,1490673-1490674,1491784,1493042,1498029,1498103,1498155,1500054,1507729-1507731,1507735-1507736
+/subversion/branches/fsfs-improvements:1499981-1547039
+/subversion/branches/fsfs-lock-many:1571740-1577217
+/subversion/branches/fsfs-pack:873717-874575
+/subversion/branches/fsx:1507845-1509914
+/subversion/branches/gnome-keyring:870558-871410
+/subversion/branches/gpg-agent-password-store:1005036-1150766
+/subversion/branches/gtest_addition:1452117-1502138
+/subversion/branches/http-protocol-v2:874395-876041
+/subversion/branches/in-memory-cache:869829-871452
+/subversion/branches/in-repo-authz:1414342-1424779
+/subversion/branches/inheritable-props:1297080-1395089
+/subversion/branches/integrate-cache-item-serialization:1068724-1068739
+/subversion/branches/integrate-cache-membuffer:998649-998852
+/subversion/branches/integrate-compression-level:1068651-1072287
+/subversion/branches/integrate-io-improvements:1068684-1072297
+/subversion/branches/integrate-is-cachable:1072568-1074082
+/subversion/branches/integrate-partial-getter:1072558-1076552
+/subversion/branches/integrate-readline-speedup:1072553-1072555
+/subversion/branches/integrate-stream-api-extensions:1068695-1072516
+/subversion/branches/integrate-string-improvements:1068251-1190617
+/subversion/branches/integrate-txdelta-caching:1072541-1078213
+/subversion/branches/issue-2779-dev:965496-984198
+/subversion/branches/issue-2843-dev:871432-874179
+/subversion/branches/issue-3000:871713,871716-871719,871721-871726,871728,871734
+/subversion/branches/issue-3067-deleted-subtrees:873375-874084
+/subversion/branches/issue-3148-dev:875193-875204
+/subversion/branches/issue-3220-dev:872210-872226
+/subversion/branches/issue-3242-dev:879653-896436
+/subversion/branches/issue-3334-dirs:875156-875867
+/subversion/branches/issue-3975:1152931-1160746
+/subversion/branches/issue-4116-dev:1424719-1425040
+/subversion/branches/issue-4194-dev:1410507-1414880
+/subversion/branches/javahl-ra:991978-1494640
+/subversion/branches/kwallet:870785-871314
+/subversion/branches/log-addressing:1509279-1546844
+/subversion/branches/log-g-performance:870941-871032
+/subversion/branches/merge-skips-obstructions:874525-874615
+/subversion/branches/multi-layer-moves:1239019-1300930
+/subversion/branches/nfc-nfd-aware-client:870276,870376
+/subversion/branches/node_pool:1304828-1305388
+/subversion/branches/performance:979193,980118,981087,981090,981189,981194,981287,981684,981827,982043,982355,983398,983406,983430,983474,983488,983490,983760,983764,983766,983770,984927,984973,984984,985014,985037,985046,985472,985477,985482,985487-985488,985493,985497,985500,985514,985601,985603,985606,985669,985673,985695,985697,986453,986465,986485,986491-986492,986517,986521,986605,986608,986817,986832,987865,987868-987869,987872,987886-987888,987893,988319,988898,990330,990533,990535-990537,990541,990568,990572,990574-990575,990600,990759,992899,992904,992911,993127,993141,994956,995478,995507,995603,998012,998858,999098,1001413,1001417,1004291,1022668,1022670,1022676,1022715,1022719,1025660,1025672,1027193,1027203,1027206,1027214,1027227,1028077,1028092,1028094,1028104,1028107,1028111,1028354,1029038,1029042-1029043,1029054-1029055,1029062-1029063,1029078,1029080,1029090,1029092-1029093,1029111,1029151,1029158,1029229-1029230,1029232,1029335-1029336,1029339-1029340,1029342,10
 
29344,1030763,1030827,1031203,1031235,1032285,1032333,1033040,1033057,1033294,1035869,1035882,1039511,1043705,1053735,1056015,1066452,1067683,1067697-1078365
+/subversion/branches/py-tests-as-modules:956579-1033052
+/subversion/branches/ra_serf-digest-authn:875693-876404
+/subversion/branches/reintegrate-improvements:873853-874164
+/subversion/branches/revprop-cache:1298521-1326293
+/subversion/branches/revprop-packing:1143907,1143971,1143997,1144017,1144499,1144568,1146145
+/subversion/branches/subtree-mergeinfo:876734-878766
+/subversion/branches/svn-mergeinfo-enhancements:870119-870195,870197-870288
+/subversion/branches/svn-patch-improvements:918519-934609
+/subversion/branches/svn_mutex:1141683-1182099
+/subversion/branches/svnpatch-diff:865738-876477
+/subversion/branches/svnraisetc:874709-875149
+/subversion/branches/svnserve-logging:869828-870893
+/subversion/branches/tc-issue-3334:874697-874773
+/subversion/branches/tc-merge-notify:874017-874062
+/subversion/branches/tc-resolve:874191-874239
+/subversion/branches/tc_url_rev:874351-874483
+/subversion/branches/tree-conflicts:868291-873154
+/subversion/branches/tree-conflicts-notify:873926-874008
+/subversion/branches/tristate-chunked-request:1502394-1502681
+/subversion/branches/tweak-build-take-two:1424288-1425049,1425051-1425613
+/subversion/branches/uris-as-urls:1060426-1064427
+/subversion/branches/verify-at-commit:1462039-1462408
+/subversion/branches/verify-keep-going:1439280-1546110
+/subversion/branches/wc-collate-path:1402685-1480384

Propchange: subversion/branches/ra-git/
------------------------------------------------------------------------------
    tsvn:logwidthmarker = 78

Added: subversion/branches/ra-git/BRANCH-README
URL: 
http://svn.apache.org/viewvc/subversion/branches/ra-git/BRANCH-README?rev=1583639&view=auto
==============================================================================
--- subversion/branches/ra-git/BRANCH-README (added)
+++ subversion/branches/ra-git/BRANCH-README Tue Apr  1 11:51:43 2014
@@ -0,0 +1,112 @@
+This branch implements Git repository access for Subversion.
+The implementation is a new RA module called libsvn_ra_git.
+
+$Id$
+
+= Design =
+
+Git repository are accessed via the following URL schemes:
+
+  git://          native git protocol
+  git+file://     local git repository
+  git+http://     git protocol via http
+  git+https://    git protocol via https
+
+All git operations are performed with libgit2.
+See http://libgit2.github.com/
+
+A bare git repository is stored in .svn/git. The svn working copy
+acts like the git working tree. For commands which don't use a 
+working copy (e.g. svn info URL) the git repository is stored
+at a temporary location.
+
+svn follows the linear history of the git branch it mirrors.
+That means svn only sees the first parent of every git commit.
+
+All commits along this linear history are mapped to Subversion
+revision numbers. When the svn client asks for a path at a specific
+revision, the git RA layer returns the object at the same path in
+the corresponding git commit.
+
+Commits are made to the local git repository with a subsequent
+attempt to push to the git repository's remote (i.e. the repository
+the initial clone was made from). If this push fails, a hard reset
+is performed to undo the local commit, and new objects are fetched
+from the remote. The svn client must then run an update to merge the
+newly fetched objects and try again.
+
+= Status =
+
+The following subcommands work with git repositories:
+
+   blame (praise, annotate, ann)
+   cat
+   checkout (co)
+   export
+   diff (di)
+   info
+   list (ls)
+   log
+   status (stat, st)
+   switch (sw)
+   update (up)
+   relocate
+   youngest
+
+One limitation of checkout/export is that they currently expect
+to get a branch called 'master'. This should be made configurable.
+Unfortunately, there is no standard representation of branch names
+in git URLs. Some people use # as a separator in a URL:
+  git://git.example.com/myrepository#master
+We could either implement this scheme, or add a --branch option
+to checkout/export for this purpose.
+
+The following still need to be implemented:
+
+   commit (ci)
+   copy (cp)
+   delete (del, remove, rm)
+   import
+   mkdir
+   move (mv, rename, ren)
+
+The following still need to be implemented (but I'm not yet sure how);
+
+   propdel (pdel, pd)
+   propedit (pedit, pe)
+   propget (pget, pg)
+   proplist (plist, pl)
+   propset (pset, ps)
+
+The following will not be implemented:
+
+   lock
+   merge
+   mergeinfo
+   unlock
+
+Lock/unlock are not needed in a distributed system like git.
+
+Implementing merge support is just a lot of work for no gain.
+The native merge capabilities of git far exceed those of svn anyway.
+Users can simply use a native git client to merge branches.
+Subversion's mergeinfo cannot accurately represent the commit DAG
+of a git repository.
+
+The following are working-copy only and thus don't use the RA layer:
+
+   patch
+   resolve
+   resolved
+   revert
+   upgrade
+
+= Other TODO items =
+
+- Progress output for git operations (currently only visible in debug builds)
+- Map libgit2 error codes to svn error codes
+- Make libgit2 support optional at build time (it's LGPL licensed)
+- Support git+ssh:// (requires libssh support in ligit2)
+- Test suite integration (so "make check" can be run with ra_git)
+- Documentation updates
+- Look for git subcommands which would be worth adding to 'svn'

Propchange: subversion/branches/ra-git/BRANCH-README
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: subversion/branches/ra-git/BRANCH-README
------------------------------------------------------------------------------
    svn:keywords = Id

Modified: subversion/branches/ra-git/Makefile.in
URL: 
http://svn.apache.org/viewvc/subversion/branches/ra-git/Makefile.in?rev=1583639&r1=1583623&r2=1583639&view=diff
==============================================================================
--- subversion/branches/ra-git/Makefile.in (original)
+++ subversion/branches/ra-git/Makefile.in Tue Apr  1 11:51:43 2014
@@ -54,6 +54,7 @@ SVN_SERF_LIBS = @SVN_SERF_LIBS@
 SVN_SQLITE_LIBS = @SVN_SQLITE_LIBS@
 SVN_XML_LIBS = @SVN_XML_LIBS@
 SVN_ZLIB_LIBS = @SVN_ZLIB_LIBS@
+SVN_LIBGIT2_LIBS = @SVN_LIBGIT2_LIBS@
 
 LIBS = @LIBS@
 
@@ -127,7 +128,7 @@ INCLUDES = -I$(top_srcdir)/subversion/in
            @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@
+           @SVN_XML_INCLUDES@ @SVN_ZLIB_INCLUDES@ @SVN_LIBGIT2_INCLUDES@
 
 APACHE_INCLUDES = @APACHE_INCLUDES@
 APACHE_LIBEXECDIR = $(DESTDIR)@APACHE_LIBEXECDIR@
@@ -249,6 +250,7 @@ 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_ra_git_LDFLAGS = @libsvn_ra_git_LDFLAGS@
 libsvn_repos_LDFLAGS = @libsvn_repos_LDFLAGS@
 libsvn_subr_LDFLAGS = @libsvn_subr_LDFLAGS@
 libsvn_wc_LDFLAGS = @libsvn_wc_LDFLAGS@

Modified: subversion/branches/ra-git/aclocal.m4
URL: 
http://svn.apache.org/viewvc/subversion/branches/ra-git/aclocal.m4?rev=1583639&r1=1583623&r2=1583639&view=diff
==============================================================================
--- subversion/branches/ra-git/aclocal.m4 (original)
+++ subversion/branches/ra-git/aclocal.m4 Tue Apr  1 11:51:43 2014
@@ -46,6 +46,7 @@ sinclude(build/ac-macros/swig.m4)
 sinclude(build/ac-macros/zlib.m4)
 sinclude(build/ac-macros/kwallet.m4)
 sinclude(build/ac-macros/macosx.m4)
+sinclude(build/ac-macros/libgit2.m4)
 
 # Include the libtool macros
 sinclude(build/libtool.m4)

Modified: subversion/branches/ra-git/build.conf
URL: 
http://svn.apache.org/viewvc/subversion/branches/ra-git/build.conf?rev=1583639&r1=1583623&r2=1583639&view=diff
==============================================================================
--- subversion/branches/ra-git/build.conf (original)
+++ subversion/branches/ra-git/build.conf Tue Apr  1 11:51:43 2014
@@ -348,6 +348,15 @@ install = ramod-lib
 libs = libsvn_repos libsvn_fs libsvn_delta libsvn_subr apriconv apr
 msvc-static = yes
 
+# Accessing git repositories
+[libsvn_ra_git]
+description = Subversion Git Repository Access Library
+type = ra-module
+path = subversion/libsvn_ra_git
+install = ramod-lib
+libs = libsvn_subr apriconv apr libgit2
+msvc-static = yes
+
 # Routines built on top of libsvn_fs
 [libsvn_repos]
 description = Subversion Repository Library
@@ -1392,6 +1401,10 @@ external-lib = $(SVN_SQLITE_LIBS)
 pkg-config = sqlite3
 pkg-config-private = yes
 
+[libgit2]
+type = lib
+external-lib = $(SVN_LIBGIT2_LIBS)
+
 [xml]
 type = lib
 external-lib = $(SVN_XML_LIBS)

Added: subversion/branches/ra-git/build/ac-macros/libgit2.m4
URL: 
http://svn.apache.org/viewvc/subversion/branches/ra-git/build/ac-macros/libgit2.m4?rev=1583639&view=auto
==============================================================================
--- subversion/branches/ra-git/build/ac-macros/libgit2.m4 (added)
+++ subversion/branches/ra-git/build/ac-macros/libgit2.m4 Tue Apr  1 11:51:43 
2014
@@ -0,0 +1,64 @@
+dnl ===================================================================
+dnl   Licensed to the Apache Software Foundation (ASF) under one
+dnl   or more contributor license agreements.  See the NOTICE file
+dnl   distributed with this work for additional information
+dnl   regarding copyright ownership.  The ASF licenses this file
+dnl   to you under the Apache License, Version 2.0 (the
+dnl   "License"); you may not use this file except in compliance
+dnl   with the License.  You may obtain a copy of the License at
+dnl
+dnl     http://www.apache.org/licenses/LICENSE-2.0
+dnl
+dnl   Unless required by applicable law or agreed to in writing,
+dnl   software distributed under the License is distributed on an
+dnl   "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+dnl   KIND, either express or implied.  See the License for the
+dnl   specific language governing permissions and limitations
+dnl   under the License.
+dnl ===================================================================
+dnl
+dnl  SVN_LIB_GIT2
+dnl
+dnl  Check configure options and assign variables related to
+dnl  the libgit2 library.
+dnl
+
+AC_DEFUN(SVN_LIB_GIT2,
+[
+  libgit2_found=no
+
+  AC_ARG_WITH(libgit2,AS_HELP_STRING([--with-libgit2=PREFIX],
+                                  [libgit2 library]),
+  [
+    if test "$withval" = "no" ; then
+      AC_MSG_ERROR([cannot compile without libgit2.])
+    else
+      AC_MSG_NOTICE([libgit2 library configuration])
+      libgit2_prefix=$withval
+      save_cppflags="$CPPFLAGS"
+      CPPFLAGS="$CPPFLAGS -I$libgit2_prefix/include"
+      AC_CHECK_HEADERS(git2.h,[
+        save_ldflags="$LDFLAGS"
+        LDFLAGS="$LDFLAGS -L$libgit2_prefix/lib"
+        AC_CHECK_LIB(git2, git_libgit2_version, [libgit2_found="yes"])
+        LDFLAGS="$save_ldflags"
+      ])
+      CPPFLAGS="$save_cppflags"
+    fi
+  ],
+  [ ])
+
+  if test "$libgit2_found" = "no"; then
+    AC_MSG_ERROR([subversion requires libgit2])
+  fi
+
+  if test "$libgit2_found" = "yes"; then
+    SVN_LIBGIT2_INCLUDES="-I$libgit2_prefix/include"
+    LDFLAGS="$LDFLAGS `SVN_REMOVE_STANDARD_LIB_DIRS(-L$libgit2_prefix/lib)`"
+  fi
+
+  SVN_LIBGIT2_LIBS="-lgit2"
+
+  AC_SUBST(SVN_LIBGIT2_INCLUDES)
+  AC_SUBST(SVN_LIBGIT2_LIBS)
+])

Propchange: subversion/branches/ra-git/build/ac-macros/libgit2.m4
------------------------------------------------------------------------------
    svn:eol-style = native

Modified: subversion/branches/ra-git/configure.ac
URL: 
http://svn.apache.org/viewvc/subversion/branches/ra-git/configure.ac?rev=1583639&r1=1583623&r2=1583639&view=diff
==============================================================================
--- subversion/branches/ra-git/configure.ac (original)
+++ subversion/branches/ra-git/configure.ac Tue Apr  1 11:51:43 2014
@@ -1023,6 +1023,7 @@ AC_SUBST([libsvn_ra_LDFLAGS])
 AC_SUBST([libsvn_ra_local_LDFLAGS])
 AC_SUBST([libsvn_ra_serf_LDFLAGS])
 AC_SUBST([libsvn_ra_svn_LDFLAGS])
+AC_SUBST([libsvn_ra_git_LDFLAGS])
 AC_SUBST([libsvn_repos_LDFLAGS])
 AC_SUBST([libsvn_subr_LDFLAGS])
 AC_SUBST([libsvn_wc_LDFLAGS])
@@ -1214,6 +1215,8 @@ AS_HELP_STRING([--with-editor=PATH],
 
 SVN_LIB_Z
 
+SVN_LIB_GIT2
+
 MOD_ACTIVATION=""
 AC_ARG_ENABLE(mod-activation,
 AS_HELP_STRING([--enable-mod-activation],
@@ -1395,6 +1398,13 @@ if test "$svn_enable_shared" = "no" || t
     svn_ra_lib_link="$svn_ra_lib_link \$(RA_SERF_LINK)"
   fi
 
+  # TODO: make libgit2 support optional?
+  AC_DEFINE(SVN_LIBSVN_CLIENT_LINKS_RA_GIT, 1,
+        [Defined if libsvn_client should link against libsvn_ra_git])
+  svn_ra_lib_deps="$svn_ra_lib_deps \$(RA_GIT_DEPS)"
+  svn_ra_lib_install_deps="$svn_ra_lib_install_deps install-ramod-lib"
+  svn_ra_lib_link="$svn_ra_lib_link \$(RA_GIT_LINK)"
+
   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

Modified: subversion/branches/ra-git/subversion/include/svn_ra.h
URL: 
http://svn.apache.org/viewvc/subversion/branches/ra-git/subversion/include/svn_ra.h?rev=1583639&r1=1583623&r2=1583639&view=diff
==============================================================================
--- subversion/branches/ra-git/subversion/include/svn_ra.h (original)
+++ subversion/branches/ra-git/subversion/include/svn_ra.h Tue Apr  1 11:51:43 
2014
@@ -133,6 +133,23 @@ typedef svn_error_t *
                                  const svn_checksum_t *checksum,
                                  apr_pool_t *pool);
 
+/** This is a function type which allows the RA layer to use a persistent
+ * directory with the specified @a basename within the working copy meta data 
area.
+ * This directory can be used by the RA-layer to store arbitrary data 
associated
+ * with the current working copy.
+ * 
+ * The absolute path to the directory is returned in @a *local_abspath.
+ *
+ * The directory is created if it does exist yet.
+ *
+ * @since New in 1.9.
+ */
+typedef svn_error_t *
+(*svn_ra_get_wc_adm_subdir_func_t)(void *baton,
+                                   const char **local_abspath,
+                                   const char *basename,
+                                   apr_pool_t *result_pool,
+                                   apr_pool_t *scratch_pool);
 
 /** A function type for retrieving the youngest revision from a repos.
  * @deprecated Provided for backward compatibility with the 1.8 API.
@@ -596,6 +613,11 @@ typedef struct svn_ra_callbacks2_t
    */
   svn_ra_get_wc_contents_func_t get_wc_contents;
 
+  /** Working copy adm subdir fetching function.
+   * @since New in 1.9.
+   */
+  svn_ra_get_wc_adm_subdir_func_t get_wc_adm_subdir;
+
   /** Check-tunnel callback
    *
    * If not @c NULL, and open_tunnel_func is also not @c NULL, this
@@ -2577,6 +2599,16 @@ svn_ra_serf_init(int abi_version,
                  apr_pool_t *pool,
                  apr_hash_t *hash);
 
+/** Initialize libsvn_ra_git.
+ *
+ * @since New in 1.9.
+ * @deprecated Provided for backward compatibility with the 1.1 API. */
+SVN_DEPRECATED
+svn_error_t *
+svn_ra_git_init(int abi_version,
+                apr_pool_t *pool,
+                apr_hash_t *hash);
+
 
 /**
  * Initialize the compatibility wrapper, using @a pool for any allocations.

Modified: subversion/branches/ra-git/subversion/libsvn_client/ra.c
URL: 
http://svn.apache.org/viewvc/subversion/branches/ra-git/subversion/libsvn_client/ra.c?rev=1583639&r1=1583623&r2=1583639&view=diff
==============================================================================
--- subversion/branches/ra-git/subversion/libsvn_client/ra.c (original)
+++ subversion/branches/ra-git/subversion/libsvn_client/ra.c Tue Apr  1 
11:51:43 2014
@@ -271,6 +271,34 @@ get_wc_contents(void *baton,
                                                        pool, pool));
 }
 
+/* This implements the `svn_ra_get_wc_adm_subdir_func_t' interface. */
+static svn_error_t *
+get_wc_adm_subdir(void *baton,
+                  const char **local_abspath,
+                  const char *basename,
+                  apr_pool_t *result_pool,
+                  apr_pool_t *scratch_pool)
+{
+  callback_baton_t *cb = baton;
+  svn_node_kind_t kind;
+
+  *local_abspath = svn_dirent_join_many(result_pool, cb->wcroot_abspath,
+                                        svn_wc_get_adm_dir(scratch_pool),
+                                        basename, SVN_VA_NULL);
+
+  SVN_ERR(svn_io_check_path(*local_abspath, &kind, scratch_pool));
+  if (kind == svn_node_none)
+    {
+      SVN_ERR(svn_io_make_dir_recursively(*local_abspath, scratch_pool));
+      return SVN_NO_ERROR;
+    }
+  else if (kind == svn_node_dir)
+    return SVN_NO_ERROR;
+
+  return svn_error_createf(SVN_ERR_FS_ALREADY_EXISTS, NULL,
+                           _("'%s' already exists and is not a directory"),
+                           svn_dirent_local_style(*local_abspath, 
scratch_pool));
+}
 
 static svn_error_t *
 cancel_callback(void *baton)
@@ -350,7 +378,10 @@ svn_client__open_ra_session_internal(svn
   cbtable->cancel_func = ctx->cancel_func ? cancel_callback : NULL;
   cbtable->get_client_string = get_client_string;
   if (base_dir_abspath)
-    cbtable->get_wc_contents = get_wc_contents;
+    {
+      cbtable->get_wc_contents = get_wc_contents;
+      cbtable->get_wc_adm_subdir = get_wc_adm_subdir;
+    }
   cbtable->check_tunnel_func = ctx->check_tunnel_func;
   cbtable->open_tunnel_func = ctx->open_tunnel_func;
   cbtable->tunnel_baton = ctx->tunnel_baton;

Modified: subversion/branches/ra-git/subversion/libsvn_ra/deprecated.c
URL: 
http://svn.apache.org/viewvc/subversion/branches/ra-git/subversion/libsvn_ra/deprecated.c?rev=1583639&r1=1583623&r2=1583639&view=diff
==============================================================================
--- subversion/branches/ra-git/subversion/libsvn_ra/deprecated.c (original)
+++ subversion/branches/ra-git/subversion/libsvn_ra/deprecated.c Tue Apr  1 
11:51:43 2014
@@ -526,3 +526,11 @@ svn_ra_serf__deprecated_init(int abi_ver
 {
   return svn_error_trace(svn_ra_serf_init(abi_version, pool, hash));
 }
+
+svn_error_t *
+svn_ra_git__deprecated_init(int abi_version,
+                             apr_pool_t *pool,
+                             apr_hash_t *hash)
+{
+  return svn_error_trace(svn_ra_git_init(abi_version, pool, hash));
+}

Modified: subversion/branches/ra-git/subversion/libsvn_ra/deprecated.h
URL: 
http://svn.apache.org/viewvc/subversion/branches/ra-git/subversion/libsvn_ra/deprecated.h?rev=1583639&r1=1583623&r2=1583639&view=diff
==============================================================================
--- subversion/branches/ra-git/subversion/libsvn_ra/deprecated.h (original)
+++ subversion/branches/ra-git/subversion/libsvn_ra/deprecated.h Tue Apr  1 
11:51:43 2014
@@ -53,6 +53,12 @@ svn_ra_serf__deprecated_init(int abi_ver
                              apr_pool_t *pool,
                              apr_hash_t *hash);
 
+/* Non-deprecated wrapper around svn_ra_git_init. */
+svn_error_t *
+svn_ra_git__deprecated_init(int abi_version,
+                            apr_pool_t *pool,
+                            apr_hash_t *hash);
+
 #ifdef __cplusplus
 }
 #endif

Modified: subversion/branches/ra-git/subversion/libsvn_ra/ra_loader.c
URL: 
http://svn.apache.org/viewvc/subversion/branches/ra-git/subversion/libsvn_ra/ra_loader.c?rev=1583639&r1=1583623&r2=1583639&view=diff
==============================================================================
--- subversion/branches/ra-git/subversion/libsvn_ra/ra_loader.c (original)
+++ subversion/branches/ra-git/subversion/libsvn_ra/ra_loader.c Tue Apr  1 
11:51:43 2014
@@ -66,6 +66,7 @@
 static const char * const dav_schemes[] = { "http", "https", NULL };
 static const char * const svn_schemes[] = { "svn", NULL };
 static const char * const local_schemes[] = { "file", NULL };
+static const char * const git_schemes[] = { "git", NULL };
 
 static const struct ra_lib_defn {
   /* the name of this RA library (e.g. "neon" or "local") */
@@ -102,6 +103,14 @@ static const struct ra_lib_defn {
     svn_ra_serf__deprecated_init
 #endif
   },
+  {
+    "git",
+    git_schemes,
+#ifdef SVN_LIBSVN_CLIENT_LINKS_RA_GIT
+    svn_ra_git__init,
+    svn_ra_git__deprecated_init,
+#endif
+  },
 
   /* ADD NEW RA IMPLEMENTATIONS HERE (as they're written) */
 
@@ -1720,3 +1729,13 @@ svn_ra_serf_init(int abi_version,
   return svn_error_create(SVN_ERR_RA_NOT_IMPLEMENTED, NULL, NULL);
 }
 #endif /* ! SVN_LIBSVN_CLIENT_LINKS_RA_SERF */
+
+#ifndef SVN_LIBSVN_CLIENT_LINKS_RA_GIT
+svn_error_t *
+svn_ra_git_init(int abi_version,
+                 apr_pool_t *pool,
+                 apr_hash_t *hash)
+{
+  return svn_error_create(SVN_ERR_RA_NOT_IMPLEMENTED, NULL, NULL);
+}
+#endif /* ! SVN_LIBSVN_CLIENT_LINKS_RA_GIT */

Modified: subversion/branches/ra-git/subversion/libsvn_ra/ra_loader.h
URL: 
http://svn.apache.org/viewvc/subversion/branches/ra-git/subversion/libsvn_ra/ra_loader.h?rev=1583639&r1=1583623&r2=1583639&view=diff
==============================================================================
--- subversion/branches/ra-git/subversion/libsvn_ra/ra_loader.h (original)
+++ subversion/branches/ra-git/subversion/libsvn_ra/ra_loader.h Tue Apr  1 
11:51:43 2014
@@ -390,7 +390,9 @@ svn_error_t *svn_ra_svn__init(const svn_
 svn_error_t *svn_ra_serf__init(const svn_version_t *loader_version,
                                const svn_ra__vtable_t **vtable,
                                apr_pool_t *pool);
-
+svn_error_t *svn_ra_git__init(const svn_version_t *loader_version,
+                              const svn_ra__vtable_t **vtable,
+                              apr_pool_t *pool);
 
 
 /*** Compat Functions ***/

Added: subversion/branches/ra-git/subversion/libsvn_ra_git/ra_git.h
URL: 
http://svn.apache.org/viewvc/subversion/branches/ra-git/subversion/libsvn_ra_git/ra_git.h?rev=1583639&view=auto
==============================================================================
--- subversion/branches/ra-git/subversion/libsvn_ra_git/ra_git.h (added)
+++ subversion/branches/ra-git/subversion/libsvn_ra_git/ra_git.h Tue Apr  1 
11:51:43 2014
@@ -0,0 +1,111 @@
+/*
+ * ra_git.h : shared internal declarations for ra_git 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 SVN_LIBSVN_RA_GIT_H
+#define SVN_LIBSVN_RA_GIT_H
+
+/* We compile in C89 mode, so the 'inline' keyword used by libgit2 isn't 
supported. */
+#define inline APR_INLINE
+
+#include <git2.h>
+
+svn_error_t *
+svn_ra_git__wrap_git_error(void);
+
+svn_error_t *
+svn_ra_git__check_path(svn_node_kind_t *kind, git_tree *tree, const char 
*path);
+
+apr_hash_t *
+svn_ra_git__make_revprops_hash(git_commit *commit, apr_pool_t *pool);
+
+svn_error_t *
+svn_ra_git__find_last_changed(svn_revnum_t *last_changed,
+                              apr_hash_t *revmap,
+                              const char *path,
+                              svn_revnum_t pegrev,
+                              git_repository *repos,
+                              apr_pool_t *pool);
+
+/* Git repositories don't have a UUID so a static UUID is as good as any. */
+#define RA_GIT_UUID "a62d4ba0-b83e-11e3-8621-8f162a3365eb"
+
+/* ---------------------------------------------------------------*/
+
+/* Reporting the state of a working copy, for updates. */
+
+/* Like svn_repos_begin_report3() but for git repositories. */
+svn_error_t *
+svn_ra_git__reporter_begin_report(void **report_baton,
+                                  svn_revnum_t revnum,
+                                  git_repository *repos,
+                                  apr_hash_t *revmap,
+                                  const char *fs_base,
+                                  const char *target,
+                                  const char *tgt_path,
+                                  svn_boolean_t text_deltas,
+                                  svn_depth_t depth,
+                                  svn_boolean_t ignore_ancestry,
+                                  svn_boolean_t send_copyfrom_args,
+                                  const svn_delta_editor_t *editor,
+                                  void *edit_baton,
+                                  apr_size_t zero_copy_limit,
+                                  apr_pool_t *pool);
+
+/* Like svn_repos_set_path3() but for git repositories. */
+svn_error_t *
+svn_ra_git__reporter_set_path(void *report_baton,
+                              const char *path,
+                              svn_revnum_t revision,
+                              svn_depth_t depth,
+                              svn_boolean_t start_empty,
+                              const char *lock_token,
+                              apr_pool_t *pool);
+
+/* Like svn_repos_link_path3() but for git repositories. */
+svn_error_t *
+svn_ra_git__reporter_link_path(void *report_baton,
+                               const char *path,
+                               const char *link_path,
+                               svn_revnum_t revision,
+                               svn_depth_t depth,
+                               svn_boolean_t start_empty,
+                               const char *lock_token,
+                               apr_pool_t *pool);
+
+/* Like svn_repos_delete_path() but for git repositories. */
+svn_error_t *
+svn_ra_git__reporter_delete_path(void *report_baton,
+                                 const char *path,
+                                 apr_pool_t *pool);
+
+/* Like svn_repos_finish_report() but for git repositories. */
+svn_error_t *
+svn_ra_git__reporter_finish_report(void *report_baton,
+                                   apr_pool_t *pool);
+
+/* Like svn_repos_finish_report() but for git repositories. */
+svn_error_t *
+svn_ra_git__reporter_abort_report(void *report_baton,
+                                  apr_pool_t *pool);
+
+#endif /* SVN_LIBSVN_RA_GIT_H */

Propchange: subversion/branches/ra-git/subversion/libsvn_ra_git/ra_git.h
------------------------------------------------------------------------------
    svn:eol-style = native


Reply via email to