subversion-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From rhuij...@apache.org
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 GMT
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;
 }
 



Mime
View raw message