Return-Path: X-Original-To: apmail-subversion-commits-archive@minotaur.apache.org Delivered-To: apmail-subversion-commits-archive@minotaur.apache.org Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by minotaur.apache.org (Postfix) with SMTP id 58A3418801 for ; Wed, 2 Dec 2015 14:03:38 +0000 (UTC) Received: (qmail 12947 invoked by uid 500); 2 Dec 2015 14:03:38 -0000 Delivered-To: apmail-subversion-commits-archive@subversion.apache.org Received: (qmail 12910 invoked by uid 500); 2 Dec 2015 14:03:38 -0000 Mailing-List: contact commits-help@subversion.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: dev@subversion.apache.org Delivered-To: mailing list commits@subversion.apache.org Received: (qmail 12900 invoked by uid 99); 2 Dec 2015 14:03:38 -0000 Received: from Unknown (HELO spamd1-us-west.apache.org) (209.188.14.142) by apache.org (qpsmtpd/0.29) with ESMTP; Wed, 02 Dec 2015 14:03:38 +0000 Received: from localhost (localhost [127.0.0.1]) by spamd1-us-west.apache.org (ASF Mail Server at spamd1-us-west.apache.org) with ESMTP id C6B6AC71AF for ; Wed, 2 Dec 2015 14:03:37 +0000 (UTC) X-Virus-Scanned: Debian amavisd-new at spamd1-us-west.apache.org X-Spam-Flag: NO X-Spam-Score: 1.79 X-Spam-Level: * X-Spam-Status: No, score=1.79 tagged_above=-999 required=6.31 tests=[KAM_ASCII_DIVIDERS=0.8, KAM_LAZY_DOMAIN_SECURITY=1, T_RP_MATCHES_RCVD=-0.01] autolearn=disabled Received: from mx1-eu-west.apache.org ([10.40.0.8]) by localhost (spamd1-us-west.apache.org [10.40.0.7]) (amavisd-new, port 10024) with ESMTP id 1sG-86b04GQ4 for ; Wed, 2 Dec 2015 14:03:34 +0000 (UTC) Received: from mailrelay1-us-west.apache.org (mailrelay1-us-west.apache.org [209.188.14.139]) by mx1-eu-west.apache.org (ASF Mail Server at mx1-eu-west.apache.org) with ESMTP id C83BB20512 for ; Wed, 2 Dec 2015 14:03:33 +0000 (UTC) Received: from svn01-us-west.apache.org (svn.apache.org [10.41.0.6]) by mailrelay1-us-west.apache.org (ASF Mail Server at mailrelay1-us-west.apache.org) with ESMTP id 8F4A0E0280 for ; Wed, 2 Dec 2015 14:03:32 +0000 (UTC) Received: from svn01-us-west.apache.org (localhost [127.0.0.1]) by svn01-us-west.apache.org (ASF Mail Server at svn01-us-west.apache.org) with ESMTP id 59E1F3A01D9 for ; Wed, 2 Dec 2015 14:03:32 +0000 (UTC) Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Subject: svn commit: r1717630 - in /subversion/branches/ra-git/subversion/libsvn_fs_git: fs_git.h fsgit-queries.sql git-revroot.c gitdb.c revmap.c Date: Wed, 02 Dec 2015 14:03:32 -0000 To: commits@subversion.apache.org From: rhuijben@apache.org X-Mailer: svnmailer-1.0.9 Message-Id: <20151202140332.59E1F3A01D9@svn01-us-west.apache.org> Author: rhuijben Date: Wed Dec 2 14:03:31 2015 New Revision: 1717630 URL: http://svn.apache.org/viewvc?rev=1717630&view=rev Log: On the ra-git branch: store tagnames in the database, to allow fully mapping them in the Subversion filesystem. * subversion/libsvn_fs_git/fsgit-queries.sql (STMT_SELECT_TAG, STMT_INSERT_TAG): New statement. * subversion/libsvn_fs_git/fs_git.h (svn_fs_git__db_tag_create): New function. * subversion/libsvn_fs_git/git-revroot.c (svn_fs_git__revision_root): Handle non-commit revisions properly. * subversion/libsvn_fs_git/gitdb.c (db_tag_create, svn_fs_git__db_tag_create): New function. * subversion/libsvn_fs_git/revmap.c (revmap_update_tag): Create tags in db. Modified: subversion/branches/ra-git/subversion/libsvn_fs_git/fs_git.h subversion/branches/ra-git/subversion/libsvn_fs_git/fsgit-queries.sql subversion/branches/ra-git/subversion/libsvn_fs_git/git-revroot.c subversion/branches/ra-git/subversion/libsvn_fs_git/gitdb.c subversion/branches/ra-git/subversion/libsvn_fs_git/revmap.c Modified: subversion/branches/ra-git/subversion/libsvn_fs_git/fs_git.h URL: http://svn.apache.org/viewvc/subversion/branches/ra-git/subversion/libsvn_fs_git/fs_git.h?rev=1717630&r1=1717629&r2=1717630&view=diff ============================================================================== --- subversion/branches/ra-git/subversion/libsvn_fs_git/fs_git.h (original) +++ subversion/branches/ra-git/subversion/libsvn_fs_git/fs_git.h Wed Dec 2 14:03:31 2015 @@ -143,6 +143,14 @@ svn_fs_git__db_find_branch(const char ** apr_pool_t *scratch_pool); svn_error_t * +svn_fs_git__db_tag_create(svn_revnum_t *tag_rev, + svn_fs_t *fs, + const char *relpath, + svn_revnum_t youngest_rev, + svn_revnum_t from_rev, + apr_pool_t *scratch_pool); + +svn_error_t * svn_fs_git__db_set_uuid(svn_fs_t *fs, const char *uuid, apr_pool_t *scratch_pool); Modified: subversion/branches/ra-git/subversion/libsvn_fs_git/fsgit-queries.sql URL: http://svn.apache.org/viewvc/subversion/branches/ra-git/subversion/libsvn_fs_git/fsgit-queries.sql?rev=1717630&r1=1717629&r2=1717630&view=diff ============================================================================== --- subversion/branches/ra-git/subversion/libsvn_fs_git/fsgit-queries.sql (original) +++ subversion/branches/ra-git/subversion/libsvn_fs_git/fsgit-queries.sql Wed Dec 2 14:03:31 2015 @@ -83,6 +83,12 @@ WHERE relpath = ?1 AND revnum <= ?2 ORDER BY relpath DESC, revnum DESC LIMIT 1 +-- STMT_SELECT_TAG +SELECT revnum, from_rev, relpath FROM TAGMAP where relpath = ?1 + +-- STMT_INSERT_TAG +INSERT INTO TAGMAP (revnum, from_rev, relpath) VALUES (?1, ?2, ?3) + /* Grab all the statements related to the schema. */ -- include: fsgit-metadata Modified: subversion/branches/ra-git/subversion/libsvn_fs_git/git-revroot.c URL: http://svn.apache.org/viewvc/subversion/branches/ra-git/subversion/libsvn_fs_git/git-revroot.c?rev=1717630&r1=1717629&r2=1717630&view=diff ============================================================================== --- subversion/branches/ra-git/subversion/libsvn_fs_git/git-revroot.c (original) +++ subversion/branches/ra-git/subversion/libsvn_fs_git/git-revroot.c Wed Dec 2 14:03:31 2015 @@ -1344,7 +1344,8 @@ svn_fs_git__revision_root(svn_fs_root_t SVN_ERR(svn_fs_git__db_fetch_oid(&fgr->exact, &oid, &fgr->rev_path, fs, rev, pool, pool)); - SVN_ERR(find_commit(&fgr->commit, root, oid, pool)); + if (oid) + SVN_ERR(find_commit(&fgr->commit, root, oid, pool)); } *root_p = root; Modified: subversion/branches/ra-git/subversion/libsvn_fs_git/gitdb.c URL: http://svn.apache.org/viewvc/subversion/branches/ra-git/subversion/libsvn_fs_git/gitdb.c?rev=1717630&r1=1717629&r2=1717630&view=diff ============================================================================== --- subversion/branches/ra-git/subversion/libsvn_fs_git/gitdb.c (original) +++ subversion/branches/ra-git/subversion/libsvn_fs_git/gitdb.c Wed Dec 2 14:03:31 2015 @@ -341,6 +341,59 @@ svn_fs_git__db_find_branch(const char ** return SVN_NO_ERROR; } +static svn_error_t * +db_tag_create(svn_revnum_t *tag_rev, + svn_fs_t *fs, + const char *relpath, + svn_revnum_t youngest_rev, + svn_revnum_t from_rev, + apr_pool_t *scratch_pool) +{ + svn_fs_git_fs_t *fgf = fs->fsap_data; + svn_sqlite__stmt_t *stmt; + svn_boolean_t got_row; + + SVN_ERR(svn_sqlite__get_statement(&stmt, fgf->sdb, + STMT_SELECT_TAG)); + SVN_ERR(svn_sqlite__bind_text(stmt, 1, relpath)); + SVN_ERR(svn_sqlite__step(&got_row, stmt)); + if (got_row) + { + *tag_rev = svn_sqlite__column_revnum(stmt, 0); + } + SVN_ERR(svn_sqlite__reset(stmt)); + if (got_row) + return SVN_NO_ERROR; + + SVN_ERR(svn_sqlite__get_statement(&stmt, fgf->sdb, + STMT_INSERT_TAG)); + SVN_ERR(svn_sqlite__bind_revnum(stmt, 1, ++youngest_rev)); + SVN_ERR(svn_sqlite__bind_revnum(stmt, 2, from_rev)); + SVN_ERR(svn_sqlite__bind_text(stmt, 3, relpath)); + SVN_ERR(svn_sqlite__update(NULL, stmt)); + + *tag_rev = youngest_rev; + + return SVN_NO_ERROR; +} + +svn_error_t * +svn_fs_git__db_tag_create(svn_revnum_t *tag_rev, + svn_fs_t *fs, + const char *relpath, + svn_revnum_t youngest_rev, + svn_revnum_t from_rev, + apr_pool_t *scratch_pool) +{ + svn_fs_git_fs_t *fgf = fs->fsap_data; + + SVN_SQLITE__WITH_LOCK(db_tag_create(tag_rev, fs, relpath, + youngest_rev, from_rev, + scratch_pool), + fgf->sdb); + + return SVN_NO_ERROR; +} svn_error_t * svn_fs_git__db_open(svn_fs_t *fs, Modified: subversion/branches/ra-git/subversion/libsvn_fs_git/revmap.c URL: http://svn.apache.org/viewvc/subversion/branches/ra-git/subversion/libsvn_fs_git/revmap.c?rev=1717630&r1=1717629&r2=1717630&view=diff ============================================================================== --- subversion/branches/ra-git/subversion/libsvn_fs_git/revmap.c (original) +++ subversion/branches/ra-git/subversion/libsvn_fs_git/revmap.c Wed Dec 2 14:03:31 2015 @@ -134,7 +134,6 @@ revmap_update_tag(svn_fs_t *fs, } GIT2_ERR(git_object_lookup(&obj, fgf->repos, oid, GIT_OBJ_ANY)); - if (git_object_type(obj) != GIT_OBJ_COMMIT) { git_object *commit; @@ -187,6 +186,18 @@ revmap_update_tag(svn_fs_t *fs, } } + { + svn_revnum_t tag_rev; + + SVN_ERR(svn_fs_git__db_tag_create(&tag_rev, + fs, svn_relpath_join("tags", tagname, + scratch_pool), + *latest_rev, rev, scratch_pool)); + + if (tag_rev > *latest_rev) + *latest_rev = tag_rev; + } + return SVN_NO_ERROR; }