How to set up subgit to mirror an svn repo that looks like a Windows Explorer hierarchy? - subgit

Being windows users, we created one svn repo with a hierarchy of folders. The bottom nodes contain the svn standard layout:
ProjectA/
ApplicationOne/
ModuleX/
trunk/
branches/
tags/
ApplicationTwo/
ModuleY/
trunk/
branches/
tags/
... and so on ad infinitum. The repo now contains around 100+ real svn projects with the trunk/branches/tags structure, but almost none of them at the top level.
How would I configure subgit to handle this?

SubGit can work in two different modes: local mirror mode and remote mirror mode. Below you can find a general overview of these modes and some recommendations for your particular case.
Local Mirror Mode
In this mode both Subversion and Git repositories reside on the same host, so SubGit has local access to both SVN and Git sides.
Below I've provided basic instructions. Please find detailed documentation and common pitfalls in SubGit 'Local Mode' Book.
Configuration
subgit configure <SVN_REPO>
SubGit version <VERSION> build #<BUILD_NUMBER>
Detecting paths eligible for translation... done.
Subversion to Git mapping has been configured:
/ProjectA/ApplicationOne/ModuleX : <SVN_REPO>/git/ProjectA/ApplicationOne/ModuleX.git
/ProjectA/ApplicationTwo/ModuleY : <SVN_REPO>/git/ProjectA/ApplicationTwo/ModuleY.git
...
CONFIGURATION SUCCESSFUL
...
This command tries to auto-detect repository layout and generate configuration file at <SVN_REPO>/conf/subgit.conf. It may take a while in case of big Subversion repository like yours.
Please make sure that auto-generated configuration file looks as follows, adjust it if necessary:
...
[git "ProjectA/ApplicationOne/ModuleX"]
translationRoot = /ProjectA/ApplicationOne/ModuleX
repository = git//ProjectA/ApplicationOne/ModuleX.git
pathEncoding = UTF-8
trunk = trunk:refs/heads/master
branches = branches/*:refs/heads/*
shelves = shelves/*:refs/shelves/*
tags = tags/*:refs/tags/*
...
Authors mapping
At this stage you have to create /conf/authors.txt file that maps existing SVN usernames to Git authors. Please refer to documentation for more details.
Installation
Finally you have to import your Subversion repository to Git and enable synchronization by running subgit install command:
subgit install repo
SubGit version <VERSION> build #<BUILD_NUMBER>
Subversion to Git mapping has been found:
/ProjectA/ApplicationOne/ModuleX : <SVN_REPO>/git/ProjectA/ApplicationOne/ModuleX.git
/ProjectA/ApplicationTwo/ModuleY : <SVN_REPO>/git/ProjectA/ApplicationTwo/ModuleY.git
...
Processing '/ProjectA/ApplicationOne/ModuleX'
Translating Subversion revisions to Git commits...
Processing '/ProjectA/ApplicationTwo/ModuleY'
Translating Subversion revisions to Git commits...
...
Subversion revisions translated: <REVISIONS_NUMBER>.
Total time: <TIME_SPENT> seconds.
INSTALLATION SUCCESSFUL
Git Server
When the installation is over and synchronization between Subversion and Git repositories is enabled, you can setup some Git server (or reuse existing Apache HTTP server). Please refer to documentation on that and see a couple of posts on this topic in our blog:
VisualSVN Server and SubGit
Gitolite and SubGit
Remote Mirror Mode
When using this mode one has to install SubGit into Git repository only and keep this repository synchronized with remote Subversion server hosted on a different machine.
Below you can find some basic instructions. Please refer to SubGit 'Remote Mode' Book for more details.
Configuration
In remote mirror mode SubGit does not try to auto-detect repository layout, so you have to run subgit configure --svn-url <SVN_URL> command for every module within Subversion repository:
subgit configure --svn-url <SVN_ROOT_URL>/ProjectA/ApplicationOne/ModuleX <GIT_ROOT_DIR>/ProjectA/ApplicationOne/ModuleX.git
SubGit version <VERSION> build #<BUILD_NUMBER>
Configuring writable Git mirror of remote Subversion repository:
Subversion repository URL : <SVN_ROOT_URL>/ProjectA/ApplicationOne/ModuleX
Git repository location : <GIT_ROOT_DIR>/ProjectA/ApplicationOne/ModuleX.git
CONFIGURATION SUCCESSFUL
...
As result SubGit generates configuration file <GIT_REPO>/subgit/config for every Git repository. For your case this configuration file should look as follows:
...
[svn]
url = <SVN_ROOT_URL>/ProjectA/ApplicationOne/ModuleX
trunk = trunk:refs/heads/master
branches = branches/*:refs/heads/*
tags = tags/*:refs/tags/*
shelves = shelves/*:refs/shelves/*
fetchInterval = 60
connectTimeout = 30
readTimeout = 60
keepGitCommitTime = false
auth = default
[auth "default"]
passwords = subgit/passwd
useDefaultSubversionConfigurationDirectory = false
subversionConfigurationDirectory = <SVN_CONFIG_DIR>
...
Authors mapping
At this stage you have to create /subgit/authors.txt file that maps existing SVN usernames to Git authors. Please refer to documentation for more details.
SVN credentials
In case you're not using file:// protocol you have to provide necessary credentials, so SubGit is able to authenticate against Subversion server. For more information on that please read corresponding chapter in SubGit Book.
We also recommend enabling pre-revprop-change hook on Subversion side which makes further installation and maintenance a bit easier, see SubGit Book.
Installation
Finally you have to import your Subversion repository to Git and enable synchronization by running subgit install command:
subgit install git
SubGit version <VERSION> build #<BUILD_NUMBER>
Translating Subversion revisions to Git commits...
Subversion revisions translated: <REVISIONS_NUMBER>.
Total time: <TIME_SPENT> seconds.
INSTALLATION SUCCESSFUL
This command also launches background process that polls SVN server and fetches new revisions when they appear there. Basically, that means that SubGit uses dedicated process for every Git repository. Sometimes it makes sense to avoid running such processes and use some job scheduler instead.
Git server
Those links I've provided above are relevant for remote mode as well.
However, if you're going to use Atlassian Stash for Git hosting, you can use SVN Mirror Plugin which is based on SubGit engine and provides some better experience with regards to UI and maintenance.
We have the following guideline which is based on our experience:
In case of many independent Subversion repositories, it's better to use SubGit in local mirror mode as it doesn't require SVN polling and maintaining additional process(es) for that.
In case of one giant Subversion repository with many modules, it's better to use remote mirror mode with file:// protocol and also adjust basic setup slightly.
It definitely doesn't make sense to run 100+ background processes in your case, instead we recommend installing additional post-commit SVN hook that checks what particular modules were modified by a given revision and then triggers synchronization for corresponding Git repositories.
If you have any other questions, feel free to ask us here at Stack Overflow, at our issue tracker or contact us via email: support#subgit.com.

Related

MariaDB version 10.5.9 unable to install

In my current workplace we are using MariaDB version 10.5.9 for our DB's and we are trying to reinstall this version for testing purposes on a separate container. However, seems anything from 10.5.9 below is failing with the follow error;
root#mdb-10-5:~# curl -LsS https://r.mariadb.com/downloads/mariadb_repo_setup | sudo bash -s -- --mariadb-server-version=mariadb-10.5.9
# [info] Checking for script prerequisites.
# [warning] Found existing file at /etc/apt/sources.list.d/mariadb.list. Moving to /etc/apt/sources.list.d/mariadb.list.old_5
# [error] MariaDB Server version 10.5.9 is not working.
# Please verify that the version is correct.
#
# The latest MariaDB Server versions are:
# 10.10.1 10.3.36 10.4.26 10.5.17 10.6.10 10.7.6 10.8.5 10.9.3
#
# More information on MariaDB releases is available at:
# https://mariadb.com/kb/en/release-notes/
When I try the same command with version 10.5.10, it works and downloads successfully.
I am using the following procedure, one of which is the MariaDB KB:
https://mariadb.com/kb/en/mariadb-package-repository-setup-and-usage/
https://www.dbi-services.com/blog/how-to-install-a-specific-version-of-mariadb/
Both guides use the same repo, and it is also the only thing that I have found specific when I search for information to install this particular version or MariaDB.
Can anyone offer any suggestions or have experienced similar problems?
We (MariaDB corporation) recently moved over our repositories to a content delivery network instead of using our own servers only. Unfortunately the new service does not have a full archive of older releases yet, the oldest 10.5 we have on there for example is 10.5.10.
I have filed an internal bug report / feature request about that already, but it is still pending.
Meanwhile you can "fix" this by first running the repo setup script with a supported version like 10.5.10, and then editing the repository file it created, replacing the version number with 10.5.9, and the host name dlm.mariadb.com with download.mariadb.com.
On Debian and Ubuntu the repository file would be /etc/apt/sources.list.d/mariadb.list, and you'd have to run apt-get update afterwards to pick up the repo change before installing packages.
On RHEL, CentOS, Rocky etc. the file is /etc/yum.repos.d/mariadb.repo and no further action is needed before installing actual packages.

Plesk Git Deploy not running "additional deployment actions"

Plesk Obsidian offers GIT deployment and we are trying to configure this to work similarly to our previous configuration on CPANEL (we recently upgraded from a shared account with CPANEL to a VPS with Plesk - Plesk so that we can use Docker later on).
Here are the details on exactly how we access the GIT configuration on our Plesk panel:
On Plesk Obsidian (Web Pro Edition / Reseller) we access the GIT configuration via:<br>
--> DOMAINS (left panel menu) <br>
--> locate desired domain and MANAGE IN CUSTOMER PANEL <br>
--> open the accordian drop-down for the domain <br>
--> Git (under DevTools)
--> (in Git, under DevTools) locate desired repo <br>
--> REPOSITORY SETTINGS link.
The folder structure on the VPS is not optimal, so we attempted to use the MANUAL DEPLOYMENT radio button, under the REPOSITORY SETTINGS link and configure some post-deployment actions - but nothing happens.
In the end, just to prove to ourselves that the manual deployment actions worked, we replaced everything we had tried with just this one line:
/usr/bin/touch ./work4me.pls
And then searched the file system to see if this file had been created, anywhere. No joy here either (we could not find the file).
Does anyone have any suggestions/ideas on what else to try?
Has anyone used this feature successfully (i.e. is it probably a configuration problem on our VPS)?
If the above touch command had worked, where should we be looking for the work4me.pls file?
You can use
touch ~/work4me.pls
This will create the file on the home directory. I have also tested with other commands as removing contents under a directory and copy them.
rm -r ~/folder/*
cp -a ~/source-folder/. ~/folder/
Hope this helps! 💪

How to import tags from multiple folders?

I successfully executed subgit import on large old repository.
Later i discovered, that there were two directories for tags: default tags and tag.
I tried to edit subgit config file according to advices in Does subgit support multiple 'branches' directories?
Currently i have tags configured the following way:'
tags = tags/*:refs/tags/*
tags = tag/*:refs/tags/tag/*
But now when i try to execute import command again, Subgit does nothing, like everything seems to be already up to date. What i did wrong or i need to run subgit import from scratch?
Indeed, you have to start importing from scratch. You can run
$ subgit configure --svn-url SVN_URL repo.git
Then edit repo.git/subgit/config to specify
tags = tags/*:refs/tags/*
tags = tag/*:refs/tags/tag/*
Then
$ subgit install repo.git
and finally
$ subgit uninstall repo.git
to stop continuous synchronization. You can also use "subgit import" command as a shortcut for "subgit install" + "subgit uninstall".
As a bonus you'll have all SVN revision numbers saved in refs/svn/map reference. To see revision numbers in "git log" output you can setup you Git clients as it is recommended in SubGit book or run the following command on the server:
$ git update-ref refs/notes/commits refs/svn/map

How do I install these Coda mode files hosted on github? (I followed the instructions but no joy)

The mode files for Coda.app (for syntax highlighting etc etc) hosted at rolling address come with these instructions. I enter the line in terminal and hit return but nothing seemed to get created. I was logged into github in Safari with my account. I haven't used github so I don't know much about it other that it's a web based version control system that all the cool kids use.
https://github.com/bobthecow/coda-modes#readme
readme:
Syntax modes for Coda and SubEthaEdit
A selection of syntax modes for for Coda (and SubEthaEdit) curated by bobthecow.
Installation
If you already have a folder at ~/Library/Application Support/Coda/Modes move it (or remove it if it's empty).
Check out this repository:
cd ~/Library/Application\ Support/Coda git clone --recursive git://github.com/bobthecow/coda-modes.git Modes
If you have additional syntax modes in your old Modes folder, copy them into this folder.
Restart Coda.
Just to be sure, those are supposed to be two command lines here:
cd ~/Library/Application\ Support/Coda
git clone --recursive git://github.com/bobthecow/coda-modes.git Modes
This should create a "Modes" directory within "~/Library/Application\ Support/Coda".
If the git address doesn't work, try the htts one:
git clone --recursive https://github.com/bobthecow/coda-modes.git Modes
Note that a git clone --recursive initializes all submodules within, using their default settings. This is equivalent to running git submodule update --init --recursive immediately after the clone is finished.

Hook to create/add a database dump file to repository on git pull

My aim is to minimize the steps needed to locally clone my website + database.
I have a central git repository on a webserver and a local clone. When I pull updates on my local machine, not only should I get the latest file versions from the remote repository but also should a script run on this webserver to dump the live database and additionally add it to the repository prior to delivering the pull.
My guess is that I need the following actions to happen on the remote machine when I fire git pull on the local machine prior to delivering the repository:
Create database dump file, e.g. dump.sql (by exectuting mysqldump)
Add dump.sql to repository
Commit dump.sql to repository
… and only then deliver the pull to the local machine.
What kind of git hook should I use for this?
I'd also appreciate any additional experience with such a scenario.
git help hooks lists the types of hooks and how they work, but there isn't a hook that you can use to do what you want (you'd need something like pre-upload that would be executed by git-upload-pack).
However, you could create a wrapper script around git-upload-pack on the server that performs the necessary actions and then executes the real git-upload-pack command:
find the git-upload-pack executable
rename it to git-upload-pack.real
create a new script called git-upload-pack somewhere in PATH that does the following:
use the arguments to find the Git repository
cd into the Git repository
if hooks/pre-upload exists and is an executable file:
run it
if the hook exited with a non-zero status:
print an error message to standard error
exit with a non-zero return value
run git-upload-pack.real with the original command-line arguments
create a hooks/pre-upload script in your Git repository that does whatever you want

Resources