| 1 | {{{ |
| 2 | #!comment |
| 3 | #!div style="clear:both; display:block; width: 75%; margin:0 auto; background-color: lightyellow; border: 2pt solid; font-weight:bold; text-align: center; font-size:120%;" |
| 4 | This page is a draft! Please feel free to add additional problems or possible solutions. |
| 5 | }}} |
| 6 | |
| 7 | This page is intended to discuss changes required to make it possible to work on the MacPorts base and ports using git-svn. |
| 8 | |
| 9 | Most of this comes from [https://lists.macosforge.org/pipermail/macports-dev/2014-March/026151.html a mail on macports-dev from March, 2014]: |
| 10 | |
| 11 | == Getting the initial git svn clone == |
| 12 | |
| 13 | The Subversion repository is mirrored in three parts: |
| 14 | |
| 15 | ||=Subversion URL =||=Git URL =|| |
| 16 | || [http://svn.macports.org/repository/macports/trunk/ ^/trunk] || git://git.macports.org/macports/trunk.git || |
| 17 | || [http://svn.macports.org/repository/macports/contrib/ ^/contrib] || git://git.macports.org/macports/contrib.git || |
| 18 | || [http://svn.macports.org/repository/macports/users/ ^/users] || git://git.macports.org/macports/users.git || |
| 19 | |
| 20 | The (release) branches for base are not mirrored at all and you cannot work against them with git-svn unless you create your own mirror. The following will cover examples for trunk, but you can use them in the same way for the other mirrored directories. |
| 21 | |
| 22 | Getting your initial clone with git-svn: |
| 23 | {{{ |
| 24 | git clone git://git.macports.org/macports/trunk.git macports-trunk |
| 25 | cd macports-trunk |
| 26 | git svn init https://svn.macports.org/repository/macports/trunk --username=<username>@macports.org |
| 27 | git config svn-remote.svn.fetch :refs/remotes/origin/master |
| 28 | }}} |
| 29 | |
| 30 | Since the upstream repository is in Subversion, a `git pull` should create a linear history locally by defaulting to `git pull --rebase`: |
| 31 | {{{ |
| 32 | git config branch.master.rebase true |
| 33 | }}} |
| 34 | |
| 35 | |
| 36 | == Ignoring files with both svn:ignore and .gitignore == |
| 37 | |
| 38 | Git uses `.gitignore` instead of the `svn:ignore` property of Subversion. |
| 39 | |
| 40 | {{{ |
| 41 | git svn create-ignore |
| 42 | }}} |
| 43 | |
| 44 | This creates a `.gitignore` file in each directory that has an equivalent `svn:ignore` property. |
| 45 | |
| 46 | There is currently no way to synchronize changes to `.gitignore` to the `svn:ignore` properties. The preferred way should be to update `svn:ignore` and then re-generate the `.gitignore` files as shown above. Changes can be made directly on the Subversion repository with this command: |
| 47 | |
| 48 | {{{ |
| 49 | svn pe svn:ignore $(git svn info --url <PATH>) |
| 50 | }}} |
| 51 | |
| 52 | |
| 53 | == Known Problems == |
| 54 | |
| 55 | === No support for svn:keywords property === |
| 56 | |
| 57 | The `$Id$` keyword can no longer be used. |
| 58 | |
| 59 | === No support for svn:eol-style property === |
| 60 | |
| 61 | TODO: do we really need this? |
| 62 | |
| 63 | === Mapping author names === |
| 64 | |
| 65 | Git usually displays real names with email addresses instead of plain usernames. A file with that mapping can be used, but has to be generated from MacPortsDevelopers. |
| 66 | |
| 67 | {{{ |
| 68 | curl https://trac.macports.org/wiki/MacPortsDevelopers?format=txt | gawk -F'\\|\\|' \ |
| 69 | '/^\|\|[^=]\s*/ { |
| 70 | handle = gensub(/\[wiki:([a-z0-9._-]*)\]/, "\\1", 1, gensub(/\s/, "", "g", $2)); |
| 71 | email = handle "@macports.org"; |
| 72 | name = gensub(/^\s*|\s*$/, "", "g", $3); |
| 73 | if (!match(handle,"nomaintainer|openmaintainer|portmgr")) { |
| 74 | printf "%s = %s <%s>\n", email, name, email; |
| 75 | } |
| 76 | }' > AUTHORS.git-svn.txt |
| 77 | }}} |
| 78 | |
| 79 | TODO: This has to be applied when updating the Git mirror, as it will be hardcoded in the Git commit object? |