From: Olof-Joachim Frahm Date: Wed, 3 Aug 2016 10:39:31 +0000 (+0200) Subject: Add ABCL Git conversion post. X-Git-Url: http://repo.macrolet.net/gitweb/?a=commitdiff_plain;h=e75c63c3aa091b8ddaaf253fcb6f4ee1a5cbc5cf;p=blog.git Add ABCL Git conversion post. --- diff --git a/abcl-to-git.post b/abcl-to-git.post new file mode 100644 index 0000000..7d61390 --- /dev/null +++ b/abcl-to-git.post @@ -0,0 +1,94 @@ +;;;;; +title: Setting up an ABCL mirror from SVN to Git +date: 2016-08-03 12:03:02 +format: md +tags: git +;;;;; + +## Copies of copies + +As it so happens the ABCL main repository is held in Subversion, but since I'm +more productive with Git I usually use a conversion to Git via the `git-svn` +program. I've based my own copy off of [slryus' +one](https://github.com/slyrus/abcl), however I had to fetch and update my own +local copy since neither of us had done any fetching in quite some time. I'm +writing down some notes below to make sure I (or others) can repeat the process +in the future. + +First we need a copy of an existing Git conversion. + + git clone https://github.com/Ferada/abcl.git abcl-git + # or in case you have SSH access + git clone git@github.com:Ferada/abcl.git abcl-git + +The `master` branch should be a direct mirror of the SVN repository, i.e. only +have commits with `git-svn` annotations, like +`git-svn-id: http://abcl.org/svn/trunk/abcl@14851 1c010e3e-...`. + +Next we want to initialise the SVN remote and fetch the new commits. + + git svn init --prefix=abcl/ http://abcl.org/svn/trunk/abcl + git svn fetch -r 14791:14851 + +Note that the first revision in the `fetch` command is the last one in the Git +`master` branch and the other one is the current `HEAD` of the SVN repository. + +This process will take just a few moments, however while all the new commits +will be based off of the `master` branch in Git, the first commit will be a +duplicate and have more changes than the existing commit in `Git`. + + 2015-08-31 20:55 mevenson │ │ o │ │ │ ansi-test: reference new git repository + 2015-07-01 04:16 mevenson o─┴─│─┴─┴─┘ abcl-asdf: fix usage with local repository <<<< + 2015-07-01 04:16 mevenson │ I─┘ abcl-asdf: fix usage with local repository <<<< + 2015-06-30 18:42 mevenson o abcl-asdf: correct metadata + +The newly created first commit (14791 here) has lots of changes. + + .dir-locals.el + CHANGES + COPYING + MANUAL + README + abcl.asd + abcl.bat.in + ... + +While the second, pre-existing one, has way less (and is just showing the same +changes that are in the SVN commit). + + contrib/abcl-asdf/abcl-asdf.asd + contrib/abcl-asdf/abcl-asdf.lisp + contrib/abcl-asdf/maven-embedder.lisp + +To correct that and continue with a linear history I'm using the interactive +rebase command. + + git co -b test + git reset --hard abcl/git-svn + git rebase -i + +Copy the hash of the correct, smaller commit and replace the `pick ...` line +(at the top) that contains the duplicated commit with the one from the +cloned-from Git repository, then exit the editor. Once the rebase is done we +just need to update the ref for `git-svn`. + + git update-ref refs/remotes/abcl/git-svn test + +Note the syntax. If done correctly it will be updated in e.g. `tig`, if not +there'll be a *new* entry showing up in `git show-ref`. + +Lastly we want to rebase `master` to get the new commits. + + git co master + git co -D test + git rebase abcl/git-svn master + +Which will look somewhat like this: + + 2016-06-13 08:06 mevenson o [master] {abcl/git-svn} {github/master} doc: note changes for abcl-1.3.4 + 2016-05-16 23:05 mevenson o Update to asdf-3.1.7 + 2016-05-16 21:43 mevenson o Update to jna-4.2.2 + +And push the updates. + + git push origin master