Add ABCL disassembler post.
[blog.git] / abcl-to-git.post
1 ;;;;;
2 title: Setting up an ABCL mirror from SVN to Git
3 date: 2016-08-03 12:03:02
4 format: md
5 tags: git
6 ;;;;;
7
8 ## Copies of copies
9
10 As it so happens the ABCL main repository is held in Subversion, but since I'm
11 more productive with Git I usually use a conversion to Git via the `git-svn`
12 program.  I've based my own copy off of [slryus'
13 one](https://github.com/slyrus/abcl), however I had to fetch and update my own
14 local copy since neither of us had done any fetching in quite some time.  I'm
15 writing down some notes below to make sure I (or others) can repeat the process
16 in the future.
17
18 First we need a copy of an existing Git conversion.
19
20     git clone https://github.com/Ferada/abcl.git abcl-git
21     # or in case you have SSH access
22     git clone git@github.com:Ferada/abcl.git abcl-git
23
24 The `master` branch should be a direct mirror of the SVN repository, i.e. only
25 have commits with `git-svn` annotations, like
26 `git-svn-id: http://abcl.org/svn/trunk/abcl@14851 1c010e3e-...`.
27
28 Next we want to initialise the SVN remote and fetch the new commits.
29
30     git svn init --prefix=abcl/ http://abcl.org/svn/trunk/abcl
31     git svn fetch -r 14791:14851
32
33 Note that the first revision in the `fetch` command is the last one in the Git
34 `master` branch and the other one is the current `HEAD` of the SVN repository.
35
36 This process will take just a few moments, however while all the new commits
37 will be based off of the `master` branch in Git, the first commit will be a
38 duplicate and have more changes than the existing commit in `Git`.
39
40     2015-08-31 20:55 mevenson           │ │ o │ │ │ ansi-test: reference new git repository
41     2015-07-01 04:16 mevenson           o─┴─│─┴─┴─┘ abcl-asdf: fix usage with local repository   <<<<
42     2015-07-01 04:16 mevenson           │ I─┘ abcl-asdf: fix usage with local repository         <<<<
43     2015-06-30 18:42 mevenson           o abcl-asdf: correct metadata
44
45 The newly created first commit (14791 here) has lots of changes.
46
47     .dir-locals.el
48     CHANGES
49     COPYING
50     MANUAL
51     README
52     abcl.asd
53     abcl.bat.in
54     ...
55
56 While the second, pre-existing one, has way less (and is just showing the same
57 changes that are in the SVN commit).
58
59     contrib/abcl-asdf/abcl-asdf.asd
60     contrib/abcl-asdf/abcl-asdf.lisp
61     contrib/abcl-asdf/maven-embedder.lisp
62
63 To correct that and continue with a linear history I'm using the interactive
64 rebase command.
65
66     git co -b test
67     git reset --hard abcl/git-svn
68     git rebase -i <commit _before_ the duplicated one>
69
70 Copy the hash of the correct, smaller commit and replace the `pick ...` line
71 (at the top) that contains the duplicated commit with the one from the
72 cloned-from Git repository, then exit the editor.  Once the rebase is done we
73 just need to update the ref for `git-svn`.
74
75     git update-ref refs/remotes/abcl/git-svn test
76
77 Note the syntax.  If done correctly it will be updated in e.g. `tig`, if not
78 there'll be a *new* entry showing up in `git show-ref`.
79
80 Lastly we want to rebase `master` to get the new commits.
81
82     git co master
83     git co -D test
84     git rebase abcl/git-svn master
85
86 Which will look somewhat like this:
87
88     2016-06-13 08:06 mevenson           o [master] {abcl/git-svn} {github/master} doc: note changes for abcl-1.3.4
89     2016-05-16 23:05 mevenson           o Update to asdf-3.1.7
90     2016-05-16 21:43 mevenson           o Update to jna-4.2.2
91
92 And push the updates.
93
94     git push origin master