| 1 | = Developer repositories |
| 2 | |
| 3 | In addition to the official TracRepositories targeted for distributing the code to users, we have several local "devs" repositories for staging the work in progress and preparing the various proposals. |
| 4 | |
| 5 | Use a branch in a git repository or a branch or a bookmark in a Mercurial repository as an alternative to a patch, at your convenience. |
| 6 | |
| 7 | It's also possible to create such repositories at Github or Bitbucket by cloning the official mirrors, but the extra advantage offered to TracTeam members of using a local repository is to have closer integration with this Trac, browsing the repositories, referring to the commits and seeing them in the timeline. |
| 8 | |
| 9 | == Mercurial repositories #hg |
| 10 | |
| 11 | See the list in https://hg.edgewall.org/trac. |
| 12 | |
| 13 | |
| 14 | == Git repositories #git |
| 15 | |
| 16 | In the following instructions, replace `$user` with your actual user account on `edgewall.org`. |
| 17 | |
| 18 | There are various ways to organize your working repositories, so the following is only an example setup. |
| 19 | |
| 20 | === Your repository as the `origin`, the Subversion mirror as `mirror` |
| 21 | |
| 22 | First you need to clone your repository (let's call the local repository `$user` as well): |
| 23 | {{{ |
| 24 | $ git clone http://svn.edgewall.org/git/trac/devs/$user $user |
| 25 | $ cd $user |
| 26 | }}} |
| 27 | |
| 28 | After the clone, you'll see the following branches: |
| 29 | {{{ |
| 30 | $ git branch --all |
| 31 | * trunk |
| 32 | remotes/origin/0.12-stable |
| 33 | remotes/origin/HEAD -> origin/trunk |
| 34 | remotes/origin/trunk |
| 35 | }}} |
| 36 | Note that the lack of a `master` branch serves as a reminder that we're not working in a "primary" repository, but only in a mirror of a Subversion repository. |
| 37 | |
| 38 | Speaking of which, we need to make it easy to retrieve the changes coming from upstream. For that, we add a remote that we will call `mirror`: |
| 39 | {{{ |
| 40 | $ git remote add mirror http://svn.edgewall.org/git/trac/mirror |
| 41 | }}} |
| 42 | (use that URL directly from e.o, or use one of the github ones) |
| 43 | |
| 44 | We also would like to fetch from this remote instead of the origin for the local branch `trunk`, so we need to replace `origin` by `mirror`: |
| 45 | {{{ |
| 46 | $ git branch --set-upstream -f trunk mirror |
| 47 | Branch trunk set up to track remote branch trunk from mirror. |
| 48 | }}} |
| 49 | |
| 50 | If you'd like to get a `0.12-stable` branch for tracking `mirror/0.12-stable`, simply do: |
| 51 | {{{ |
| 52 | $ git branch 0.12-stable mirror/0.12-stable |
| 53 | Branch 0.12-stable set up to track remote branch 0.12-stable from mirror. |
| 54 | }}} |
| 55 | |
| 56 | Once this is done, for either of these, getting the changes from svn is a simple matter of going back to the branch in question and doing a pull, e.g. |
| 57 | {{{ |
| 58 | $ git checkout trunk |
| 59 | $ git pull --ff-only |
| 60 | }}} |
| 61 | |
| 62 | Of course, you should not directly work on such a `trunk` branch, but rather use it as the base for creating topic branches (IOW, `git pull --ff-only` should always succeed). |
| 63 | |
| 64 | For example: |
| 65 | {{{ |
| 66 | $ git checkout -b ticketXYZ trunk |
| 67 | }}} |
| 68 | |
| 69 | Whenever you want to publish such a topic branch, you push it to your repository. The push URL must use `https`, so be sure to do this once: |
| 70 | {{{ |
| 71 | $ git remote set-url origin --push https://$user@svn.edgewall.org/git/trac/devs/$user |
| 72 | }}} |
| 73 | |
| 74 | |
| 75 | Then, you can add the repositories from other developers in as many remotes as needed, e.g. |
| 76 | {{{ |
| 77 | $ git remote add cboos http://svn.edgewall.org/git/trac/devs/cboos |
| 78 | $ git remote add jomae http://svn.edgewall.org/git/trac/devs/jomae |
| 79 | }}} |
| 80 | |
| 81 | In the end, the `.git/config` of such a repository will look like this: |
| 82 | {{{#!ini |
| 83 | [core] |
| 84 | repositoryformatversion = 0 |
| 85 | filemode = false |
| 86 | bare = false |
| 87 | logallrefupdates = true |
| 88 | symlinks = false |
| 89 | ignorecase = true |
| 90 | hideDotFiles = dotGitOnly |
| 91 | [remote "origin"] |
| 92 | fetch = +refs/heads/*:refs/remotes/origin/* |
| 93 | url = http://svn.edgewall.org/git/trac/devs/jonas |
| 94 | pushurl = https://jonas@svn.edgewall.org/git/trac/devs/jonas |
| 95 | [branch "trunk"] |
| 96 | remote = mirror |
| 97 | merge = refs/heads/trunk |
| 98 | [remote "mirror"] |
| 99 | url = http://svn.edgewall.org/git/trac/mirror |
| 100 | fetch = +refs/heads/*:refs/remotes/mirror/* |
| 101 | [branch "0.12-stable"] |
| 102 | remote = mirror |
| 103 | merge = refs/heads/0.12-stable |
| 104 | [remote "cboos"] |
| 105 | url = http://svn.edgewall.org/git/trac/devs/cboos |
| 106 | fetch = +refs/heads/*:refs/remotes/cboos/* |
| 107 | [remote "jomae"] |
| 108 | url = http://svn.edgewall.org/git/trac/devs/jomae |
| 109 | fetch = +refs/heads/*:refs/remotes/jomae/* |
| 110 | }}} |