[MacPorts] WorkingWithGitSVN added

MacPorts noreply at macports.org
Thu Oct 15 06:31:13 PDT 2015


Page "WorkingWithGitSVN" was added by raimue at macports.org
Content:
-------8<------8<------8<------8<------8<------8<------8<------8<--------
{{{
#!comment
#!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%;"
This page is a draft! Please feel free to add additional problems or possible solutions.
}}}

This page is intended to discuss changes required to make it possible to work on the MacPorts base and ports using git-svn.

Most of this comes from [https://lists.macosforge.org/pipermail/macports-dev/2014-March/026151.html a mail on macports-dev from March, 2014]:

== Getting the initial git svn clone ==

The Subversion repository is mirrored in three parts:

||=Subversion URL                                                  =||=Git URL                                    =||
|| [http://svn.macports.org/repository/macports/trunk/ ^/trunk]     || git://git.macports.org/macports/trunk.git   ||
|| [http://svn.macports.org/repository/macports/contrib/ ^/contrib] || git://git.macports.org/macports/contrib.git ||
|| [http://svn.macports.org/repository/macports/users/ ^/users]     || git://git.macports.org/macports/users.git   ||

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.

Getting your initial clone with git-svn:
{{{
git clone git://git.macports.org/macports/trunk.git macports-trunk
cd macports-trunk
git svn init https://svn.macports.org/repository/macports/trunk --username=<username>@macports.org
git config svn-remote.svn.fetch :refs/remotes/origin/master
}}}

Since the upstream repository is in Subversion, a `git pull` should create a linear history locally by defaulting to `git pull --rebase`:
{{{
git config branch.master.rebase true
}}}


== Ignoring files with both svn:ignore and .gitignore ==

Git uses `.gitignore` instead of the `svn:ignore` property of Subversion.

{{{
git svn create-ignore
}}}

This creates a `.gitignore` file in each directory that has an equivalent `svn:ignore` property.

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:

{{{
svn pe svn:ignore $(git svn info --url <PATH>)
}}}


== Known Problems ==

=== No support for svn:keywords property ===

The `$Id$` keyword can no longer be used.

=== No support for svn:eol-style property ===

TODO: do we really need this?

=== Mapping author names ===

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.

{{{
curl https://trac.macports.org/wiki/MacPortsDevelopers?format=txt | gawk -F'\\|\\|' \
'/^\|\|[^=]\s*/ { 
    handle = gensub(/\[wiki:([a-z0-9._-]*)\]/, "\\1", 1, gensub(/\s/, "", "g", $2));
    email = handle "@macports.org";
    name = gensub(/^\s*|\s*$/, "", "g", $3);
    if (!match(handle,"nomaintainer|openmaintainer|portmgr")) {
        printf "%s = %s <%s>\n", email, name, email;
    }
}' > AUTHORS.git-svn.txt
}}}

TODO: This has to be applied when updating the Git mirror, as it will be hardcoded in the Git commit object?
-------8<------8<------8<------8<------8<------8<------8<------8<--------

--
Page URL: <https://trac.macports.org/wiki/WorkingWithGitSVN>
MacPorts <https://www.macports.org/>
Ports system for OS X

This is an automated message. Someone added your email address to be
notified of changes on 'WorkingWithGitSVN' page.
If it was not you, please report to .


More information about the macports-changes mailing list