| 1 | About |
|---|
| 2 | ===== |
|---|
| 3 | |
|---|
| 4 | tailor.py is a tool to migrate changesets between CVS, Subversion, |
|---|
| 5 | darcs and monotone repositories. |
|---|
| 6 | |
|---|
| 7 | This script makes it easier to keep the upstream changes merged in |
|---|
| 8 | a branch of a product, storing needed information such as the upstream |
|---|
| 9 | URI and revision in special properties on the branched directory. |
|---|
| 10 | |
|---|
| 11 | The following ascii-art illustrates the usual scenario:: |
|---|
| 12 | |
|---|
| 13 | +------------+ +------------+ |
|---|
| 14 | +--------------+ | Immutable | | Working | |
|---|
| 15 | | Upstream CVS |-------->| darcs |----------->| darcs | |
|---|
| 16 | | repository | tailor | repository | darcs pull | repository | |
|---|
| 17 | +--------------+ +------------+ +------------+ |
|---|
| 18 | |^ |
|---|
| 19 | || |
|---|
| 20 | || |
|---|
| 21 | v| |
|---|
| 22 | User |
|---|
| 23 | |
|---|
| 24 | Ideally you should be able to swap and replace "CVS server" and "darcs |
|---|
| 25 | repository" with any combination of `CVS`, `Subversion` and `darcs`. |
|---|
| 26 | |
|---|
| 27 | |
|---|
| 28 | Installation |
|---|
| 29 | ============ |
|---|
| 30 | |
|---|
| 31 | tailor.py is written in Python, and thus Python must be installed on |
|---|
| 32 | your system to use it. It has been successfully used with Python 2.3 |
|---|
| 33 | and 2.4. |
|---|
| 34 | |
|---|
| 35 | Since it relays on external tools to do the real work such as `cvs`, |
|---|
| 36 | `darcs` and `svn`, they need to be installed as well, although only |
|---|
| 37 | those you will actually use. |
|---|
| 38 | |
|---|
| 39 | Make tailor.py executable:: |
|---|
| 40 | |
|---|
| 41 | $ chmod +x tailor.py |
|---|
| 42 | |
|---|
| 43 | You can either run tailor.py where it is currently located, or move it |
|---|
| 44 | along with the vcpx directory to a location in your PATH. |
|---|
| 45 | |
|---|
| 46 | There's even a standard setup.py that you may use to install the |
|---|
| 47 | script using Python conventional distutils. |
|---|
| 48 | |
|---|
| 49 | |
|---|
| 50 | Examples |
|---|
| 51 | ======== |
|---|
| 52 | |
|---|
| 53 | 1. Bootstrap a new tailored project, starting at upstream revision 10:: |
|---|
| 54 | |
|---|
| 55 | $ tailor.py -b -s svn -R http://svn.server/path/to/svnrepo \ |
|---|
| 56 | --module /Product/trunk -r 10 --subdir Product ~/darcs/MyProduct |
|---|
| 57 | |
|---|
| 58 | 2. Bootstrap a new product, fetching from CVS and storing under SVN: |
|---|
| 59 | this will create the directory "~/svnwc/cmfcore"; "~/svnwc" must be |
|---|
| 60 | already under SVN:: |
|---|
| 61 | |
|---|
| 62 | $ tailor.py --source-kind cvs --target-kind svn --bootstrap \ |
|---|
| 63 | --repository :pserver:cvs.zope.org:/cvs-repository \ |
|---|
| 64 | --module CMF/CMFCore ~/svnwc/cmfcore |
|---|
| 65 | |
|---|
| 66 | 3. Showing each command bootstrap a new DARCS repos in |
|---|
| 67 | "~/darcs/cmftopic" under which the upstream module will be |
|---|
| 68 | extracted as "CMFTopic" (ie, the last component of the module |
|---|
| 69 | name):: |
|---|
| 70 | |
|---|
| 71 | $ tailor.py -D -b -R :pserver:anonymous@cvs.zope.org:/cvs-repository/ \ |
|---|
| 72 | -m CMF/CMFTopic ~/darcs/cmftopic |
|---|
| 73 | |
|---|
| 74 | 4. Merge upstream changes since last update/bootstrap:: |
|---|
| 75 | |
|---|
| 76 | $ tailor.py ~/svnwc/MyProduct |
|---|
| 77 | |
|---|
| 78 | 5. Migrate a whole SVN repository, starting from the beginning:: |
|---|
| 79 | |
|---|
| 80 | $ tailor.py -b -s svn -R svn+ssh://caia/tmp/svn/repo --module / \ |
|---|
| 81 | --subdir testsvn --revision 1 testdir |
|---|
| 82 | |
|---|
| 83 | .. warning:: When using --revision with a SVN source repository, be |
|---|
| 84 | sure that the path your are tracking was there at that |
|---|
| 85 | revision, otherwise svn will exit with an error. |
|---|
| 86 | |
|---|
| 87 | |
|---|
| 88 | Resolving conflicts |
|---|
| 89 | =================== |
|---|
| 90 | |
|---|
| 91 | Should one of the replayed changes generate any conflict, tailor.py |
|---|
| 92 | will prompt the user to correct them. This is done after the upstream |
|---|
| 93 | patch has been applied and before the final commit on the target |
|---|
| 94 | system, so that manually tweaking the conflict can produce a clean |
|---|
| 95 | patch. |
|---|
| 96 | |
|---|
| 97 | |
|---|
| 98 | Shortcomings |
|---|
| 99 | ============ |
|---|
| 100 | |
|---|
| 101 | Tailor currently suffers of the following reported problems: |
|---|
| 102 | |
|---|
| 103 | a) It does not handle "empty" CVS checkouts, in other words you cannot |
|---|
| 104 | bootstrap a project that has nothing in its CVS upstream |
|---|
| 105 | repository, or from a point in time where this condition was true. |
|---|
| 106 | |
|---|
| 107 | b) It does not work under Windows (no, that's not a feature :-). Maybe |
|---|
| 108 | replacing the shwrap machinery with something built on top of |
|---|
| 109 | subprocess_ that seems able to hide Windows crazyness... |
|---|
| 110 | |
|---|
| 111 | This list will always be incomplete, but I'll do my best to keep it |
|---|
| 112 | short :-) |
|---|
| 113 | |
|---|
| 114 | .. _subprocess: http://www.lysator.liu.se/~astrand/popen5/ |
|---|
| 115 | |
|---|
| 116 | |
|---|
| 117 | Tailor's metadata |
|---|
| 118 | ================= |
|---|
| 119 | |
|---|
| 120 | To do its work, tailor needs some information about your source tree, |
|---|
| 121 | such as the upstream repository URL and the current revision of the |
|---|
| 122 | sources on your harddisk. |
|---|
| 123 | |
|---|
| 124 | In the simpler case, tailor keeps this information in a file called |
|---|
| 125 | `tailor.info`, one for each tailored project, that is a very simple |
|---|
| 126 | text document, with the following information, one per line: |
|---|
| 127 | |
|---|
| 128 | 1. Upstream repository kind (either "cvs", "darcs" or "svn) |
|---|
| 129 | 2. Target repository kind (the same as above) |
|---|
| 130 | 3. The name of the "module" that's been tailored |
|---|
| 131 | 4. The URL of the upstream repository (that may not be an URL, for cvs...) |
|---|
| 132 | 5. The current revision, from the upstream point of view, of the sources |
|---|
| 133 | 6. The subdirectory that contains the checked out upstream tree, |
|---|
| 134 | either that given with with the `--subdir` option or computed |
|---|
| 135 | taking the last part of the module name. |
|---|
| 136 | |
|---|
| 137 | This is everything tailor needs, to be able to keep going from where it |
|---|
| 138 | left last time. |
|---|
| 139 | |
|---|
| 140 | |
|---|
| 141 | Config file format |
|---|
| 142 | ------------------ |
|---|
| 143 | |
|---|
| 144 | When your project is composed by multiple upstream modules, it is |
|---|
| 145 | easier to collect such information in a single file. This is done by |
|---|
| 146 | specifying the `--configfile` option with a file name as argument. In |
|---|
| 147 | this case, tailor will read/write the above information from a |
|---|
| 148 | standard Python dictionary stored in the given file. |
|---|
| 149 | |
|---|
| 150 | The dictionary is keyed on the relative position of each project, and |
|---|
| 151 | each entry carries the same information described above. |
|---|
| 152 | |
|---|
| 153 | Here's an example config file entry:: |
|---|
| 154 | |
|---|
| 155 | {'plone/atcontenttypes': {'module': 'ATContentTypes', |
|---|
| 156 | 'source_kind': 'cvs', |
|---|
| 157 | 'subdir': 'ATContentTypes', |
|---|
| 158 | 'target_kind': 'darcs', |
|---|
| 159 | 'upstream_repos': ':ext:cvs.sourceforge.net:/cvsroot/collective', |
|---|
| 160 | 'upstream_revision': '2004-11-24 19:42:06 by ctheune'}} |
|---|
| 161 | |
|---|
| 162 | By convention, config files are named with the extension ".tailor", |
|---|
| 163 | but this is not enforced. |
|---|
| 164 | |
|---|
| 165 | In the example above, 'plone/atcontenttypes' is a directory where the |
|---|
| 166 | target source will be stored. The keys such 'module', 'source_kind', |
|---|
| 167 | etc correspond to options of the same name. |
|---|
| 168 | |
|---|
| 169 | When using a config file, tailor will perform its job on each project |
|---|
| 170 | contained in the dictionary. |
|---|
| 171 | |
|---|
| 172 | |
|---|
| 173 | Further help |
|---|
| 174 | ============ |
|---|
| 175 | |
|---|
| 176 | See the output of tailor.py -h for some further tips. There's also a |
|---|
| 177 | `wiki page`_ that may give you some other hints. |
|---|
| 178 | |
|---|
| 179 | .. _wiki page: |
|---|
| 180 | http://www.scannedinavian.org/DarcsWiki/Tailor |
|---|
| 181 | |
|---|
| 182 | I will be more than happy to answer any doubt, question or suggestion |
|---|
| 183 | you may have on it. I'm usually hanging as "lelit" on the IRC channel |
|---|
| 184 | devoted to darcs on the `freenode.net` network. Do not hesitate to |
|---|
| 185 | contact me either by email or chatting there. |
|---|
| 186 | |
|---|
| 187 | |
|---|
| 188 | Author |
|---|
| 189 | ====== |
|---|
| 190 | |
|---|
| 191 | Lele Gaifax <lele@nautilus.homeip.net> |
|---|
| 192 | |
|---|
| 193 | |
|---|
| 194 | Monotone support |
|---|
| 195 | ---------------- |
|---|
| 196 | |
|---|
| 197 | Monotone_ support was kindly contributed by `Markus Schiltknecht |
|---|
| 198 | <markus@bluegap.ch>`. Since I'm not currently using monotone (so |
|---|
| 199 | little time, so many VCSs...) I'm not in position to test it out |
|---|
| 200 | properly, but I'll do my best to keep it in sync, maybe with your |
|---|
| 201 | support :-) |
|---|
| 202 | |
|---|
| 203 | .. _monotone: http://www.venge.net/monotone/ |
|---|
| 204 | |
|---|
| 205 | |
|---|
| 206 | About this document |
|---|
| 207 | =================== |
|---|
| 208 | |
|---|
| 209 | This document and most of the internal documention use the |
|---|
| 210 | reStructuredText format so that it can be easily converted into other |
|---|
| 211 | formats, such as HTML. For more information about this, please see: |
|---|
| 212 | |
|---|
| 213 | http://docutils.sourceforge.net/rst.html |
|---|
| 214 | |
|---|
| 215 | |
|---|
| 216 | .. vim:ft=rest |
|---|
| 217 | .. Local Variables: |
|---|
| 218 | .. mode: rst |
|---|
| 219 | .. End: |
|---|