| 1 | About |
|---|
| 2 | ===== |
|---|
| 3 | |
|---|
| 4 | Tailor is a tool to migrate changesets between CVS, Subversion_, |
|---|
| 5 | darcs_, monotone_, Codeville_ and `Baazar-NG`_ [#]_ 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 the supported systems. |
|---|
| 26 | |
|---|
| 27 | A more convoluted setup shows how brave people are using it to get a |
|---|
| 28 | two way sync:: |
|---|
| 29 | |
|---|
| 30 | +----------+ +--------+ +--------+ +---------+ |
|---|
| 31 | | | -----> | hybrid | darcs | | ----> | my | |
|---|
| 32 | | upstream | tailor | CVS | -----> | master | darcs | working | |
|---|
| 33 | | CVS | <----- | darcs | <----- | darcs | <---- | darcs | |
|---|
| 34 | | | | sync | tailor | | | | |
|---|
| 35 | +----------+ +--------+ +--------+ +---------+ |
|---|
| 36 | (cron) (cron) |
|---|
| 37 | |
|---|
| 38 | |
|---|
| 39 | .. [#] Monotone, Codeville and Baazar-NG systems may be used only as |
|---|
| 40 | the `target` backend, since the `source` support isn't |
|---|
| 41 | coded yet. |
|---|
| 42 | |
|---|
| 43 | .. _subversion: http://subversion.tigris.org/ |
|---|
| 44 | .. _darcs: http://www.darcs.net/ |
|---|
| 45 | .. _codeville: http://www.codeville.org/ |
|---|
| 46 | .. _baazar-ng: http://www.bazaar-ng.org/ |
|---|
| 47 | |
|---|
| 48 | |
|---|
| 49 | Installation |
|---|
| 50 | ============ |
|---|
| 51 | |
|---|
| 52 | tailor.py is written in Python, and thus Python must be installed on |
|---|
| 53 | your system to use it. It has been successfully used with Python 2.3 |
|---|
| 54 | and 2.4. |
|---|
| 55 | |
|---|
| 56 | Since it relays on external tools to do the real work such as `cvs`, |
|---|
| 57 | `darcs` and `svn`, they need to be installed as well, although only |
|---|
| 58 | those you will actually use. |
|---|
| 59 | |
|---|
| 60 | Make tailor.py executable:: |
|---|
| 61 | |
|---|
| 62 | $ chmod +x tailor.py |
|---|
| 63 | |
|---|
| 64 | You can either run tailor.py where it is currently located, or move it |
|---|
| 65 | along with the vcpx directory to a location in your PATH. |
|---|
| 66 | |
|---|
| 67 | There's even a standard setup.py that you may use to install the |
|---|
| 68 | script using Python conventional distutils. |
|---|
| 69 | |
|---|
| 70 | |
|---|
| 71 | Examples |
|---|
| 72 | ======== |
|---|
| 73 | |
|---|
| 74 | 1. Bootstrap a new tailored project, starting at upstream revision 10:: |
|---|
| 75 | |
|---|
| 76 | $ tailor.py -b -s svn -R http://svn.server/path/to/svnrepo \ |
|---|
| 77 | --module /Product/trunk -r 10 --subdir Product ~/darcs/MyProduct |
|---|
| 78 | |
|---|
| 79 | 2. Bootstrap a new product, fetching from CVS and storing under SVN: |
|---|
| 80 | this will create the directory "~/svnwc/cmfcore"; "~/svnwc" must be |
|---|
| 81 | already under SVN:: |
|---|
| 82 | |
|---|
| 83 | $ tailor.py --source-kind cvs --target-kind svn --bootstrap \ |
|---|
| 84 | --repository :pserver:cvs.zope.org:/cvs-repository \ |
|---|
| 85 | --module CMF/CMFCore ~/svnwc/cmfcore |
|---|
| 86 | |
|---|
| 87 | 3. Showing each command bootstrap a new DARCS repos in |
|---|
| 88 | "~/darcs/cmftopic" under which the upstream module will be |
|---|
| 89 | extracted as "CMFTopic" (ie, the last component of the module |
|---|
| 90 | name):: |
|---|
| 91 | |
|---|
| 92 | $ tailor.py -D -b -R :pserver:anonymous@cvs.zope.org:/cvs-repository/ \ |
|---|
| 93 | -m CMF/CMFTopic ~/darcs/cmftopic |
|---|
| 94 | |
|---|
| 95 | 4. Merge upstream changes since last update/bootstrap:: |
|---|
| 96 | |
|---|
| 97 | $ tailor.py ~/svnwc/MyProduct |
|---|
| 98 | |
|---|
| 99 | 5. Migrate a whole SVN repository, starting from the beginning:: |
|---|
| 100 | |
|---|
| 101 | $ tailor.py -b -s svn -R svn+ssh://caia/tmp/svn/repo --module / \ |
|---|
| 102 | --subdir testsvn --revision 1 testdir |
|---|
| 103 | |
|---|
| 104 | .. warning:: When using --revision with a SVN source repository, be |
|---|
| 105 | sure that the path your are tracking was there at that |
|---|
| 106 | revision, otherwise svn will exit with an error. |
|---|
| 107 | |
|---|
| 108 | 6. Bootstrap from a CVS branch, starting from a given point in time:: |
|---|
| 109 | |
|---|
| 110 | $ tailor.py -b -s cvs -R :pserver:anonymous@server.org:/cvsroot/ \ |
|---|
| 111 | --revision 'unstable-branch 2001-12-25 23:26:48 UTC' \ |
|---|
| 112 | --module something new-darcs-repository |
|---|
| 113 | |
|---|
| 114 | |
|---|
| 115 | Resolving conflicts |
|---|
| 116 | =================== |
|---|
| 117 | |
|---|
| 118 | Should one of the replayed changes generate any conflict, tailor.py |
|---|
| 119 | will prompt the user to correct them. This is done after the upstream |
|---|
| 120 | patch has been applied and before the final commit on the target |
|---|
| 121 | system, so that manually tweaking the conflict can produce a clean |
|---|
| 122 | patch. |
|---|
| 123 | |
|---|
| 124 | |
|---|
| 125 | Shortcomings |
|---|
| 126 | ============ |
|---|
| 127 | |
|---|
| 128 | Tailor currently suffers of the following reported problems: |
|---|
| 129 | |
|---|
| 130 | a) It does not handle "empty" CVS checkouts, in other words you cannot |
|---|
| 131 | bootstrap a project that has nothing in its CVS upstream |
|---|
| 132 | repository, or from a point in time where this condition was true. |
|---|
| 133 | |
|---|
| 134 | b) It does not work under Windows (no, that's not a feature :-). Maybe |
|---|
| 135 | replacing the shwrap machinery with something built on top of |
|---|
| 136 | subprocess_ that seems able to hide Windows crazyness... |
|---|
| 137 | |
|---|
| 138 | c) Monotone, Codeville and Baazar-NG are (currently) only supported as |
|---|
| 139 | *target* |
|---|
| 140 | |
|---|
| 141 | d) Specifying ``--subdir .`` may not work, in particular when dealing |
|---|
| 142 | with remote CVS repositories (it does when the CVS repository is |
|---|
| 143 | on local machine). |
|---|
| 144 | |
|---|
| 145 | This list will always be incomplete, but I'll do my best to keep it |
|---|
| 146 | short :-) |
|---|
| 147 | |
|---|
| 148 | .. _subprocess: http://www.lysator.liu.se/~astrand/popen5/ |
|---|
| 149 | |
|---|
| 150 | |
|---|
| 151 | Tailor's metadata |
|---|
| 152 | ================= |
|---|
| 153 | |
|---|
| 154 | To do its work, tailor needs some information about your source tree, |
|---|
| 155 | such as the upstream repository URL and the current revision of the |
|---|
| 156 | sources on your harddisk. |
|---|
| 157 | |
|---|
| 158 | In the simpler case, tailor keeps this information in a file called |
|---|
| 159 | `tailor.info`, one for each tailored project, that is a very simple |
|---|
| 160 | text document, with the following information, one per line: |
|---|
| 161 | |
|---|
| 162 | 1. Upstream repository kind (either "cvs", "darcs" or "svn) |
|---|
| 163 | 2. Target repository kind (the same as above) |
|---|
| 164 | 3. The name of the "module" that's been tailored |
|---|
| 165 | 4. The URL of the upstream repository (that may not be an URL, for cvs...) |
|---|
| 166 | 5. The current revision, from the upstream point of view, of the sources |
|---|
| 167 | 6. The subdirectory that contains the checked out upstream tree, |
|---|
| 168 | either that given with with the `--subdir` option or computed |
|---|
| 169 | taking the last part of the module name. |
|---|
| 170 | |
|---|
| 171 | This is everything tailor needs, to be able to keep going from where it |
|---|
| 172 | left last time. |
|---|
| 173 | |
|---|
| 174 | |
|---|
| 175 | Config file format |
|---|
| 176 | ------------------ |
|---|
| 177 | |
|---|
| 178 | When your project is composed by multiple upstream modules, it is |
|---|
| 179 | easier to collect such information in a single file. This is done by |
|---|
| 180 | specifying the `--configfile` option with a file name as argument. In |
|---|
| 181 | this case, tailor will read/write the above information from a |
|---|
| 182 | standard Python dictionary stored in the given file. |
|---|
| 183 | |
|---|
| 184 | The dictionary is keyed on the relative position of each project, and |
|---|
| 185 | each entry carries the same information described above. |
|---|
| 186 | |
|---|
| 187 | Here's an example config file entry:: |
|---|
| 188 | |
|---|
| 189 | {'plone/atcontenttypes': {'module': 'ATContentTypes', |
|---|
| 190 | 'source_kind': 'cvs', |
|---|
| 191 | 'subdir': 'ATContentTypes', |
|---|
| 192 | 'target_kind': 'darcs', |
|---|
| 193 | 'upstream_repos': ':ext:cvs.sourceforge.net:/cvsroot/collective', |
|---|
| 194 | 'upstream_revision': '2004-11-24 19:42:06 by ctheune'}} |
|---|
| 195 | |
|---|
| 196 | By convention, config files are named with the extension ".tailor", |
|---|
| 197 | but this is not enforced. |
|---|
| 198 | |
|---|
| 199 | In the example above, 'plone/atcontenttypes' is a directory where the |
|---|
| 200 | target source will be stored. The keys such 'module', 'source_kind', |
|---|
| 201 | etc correspond to options of the same name. |
|---|
| 202 | |
|---|
| 203 | When using a config file, tailor will perform its job on each project |
|---|
| 204 | contained in the dictionary. |
|---|
| 205 | |
|---|
| 206 | |
|---|
| 207 | Interactive sessions |
|---|
| 208 | -------------------- |
|---|
| 209 | |
|---|
| 210 | Tailor offers an alternative way of driving its activity by using an |
|---|
| 211 | interactive session, bringing the configuration more similar to a |
|---|
| 212 | script. |
|---|
| 213 | |
|---|
| 214 | Although this is still a work-in-progress, it's quickly becoming my |
|---|
| 215 | preferred usage, as its functionality cover the underlying tailor |
|---|
| 216 | features. |
|---|
| 217 | |
|---|
| 218 | For example, this is the script I'm using to test it:: |
|---|
| 219 | |
|---|
| 220 | cd /tmp/p/wc |
|---|
| 221 | state_file tailor.state |
|---|
| 222 | source_kind darcs |
|---|
| 223 | target_kind svn |
|---|
| 224 | source_repository /home/lele/WiP/cvsync |
|---|
| 225 | sub_directory cvsync |
|---|
| 226 | |
|---|
| 227 | that, as you can see, specifies the context needed by tailor to do its |
|---|
| 228 | work. With the following command line:: |
|---|
| 229 | |
|---|
| 230 | $ tailor.py --verbose --interactive tailor.cmds |
|---|
| 231 | Welcome to the Tailor interactive session: you can issue several commands |
|---|
| 232 | with the usual `readline` facilities. With "help" you'll get a list of |
|---|
| 233 | available commands. |
|---|
| 234 | |
|---|
| 235 | Current directory: /tmp/p/wc |
|---|
| 236 | Current state file: /tmp/p/wc/tailor.state |
|---|
| 237 | Current source kind: darcs |
|---|
| 238 | Current target kind: svn |
|---|
| 239 | Current source repository: /home/lele/WiP/cvsync |
|---|
| 240 | Sub directory: cvsync |
|---|
| 241 | tailor $ help |
|---|
| 242 | |
|---|
| 243 | Documented commands (type help <topic>): |
|---|
| 244 | ======================================== |
|---|
| 245 | EOF get_changes source_module target_module |
|---|
| 246 | bootstrap logfile source_repository target_repository |
|---|
| 247 | cd save state_file |
|---|
| 248 | current_directory show_changes sub_directory |
|---|
| 249 | exit source_kind target_kind |
|---|
| 250 | |
|---|
| 251 | Undocumented commands: |
|---|
| 252 | ====================== |
|---|
| 253 | help |
|---|
| 254 | |
|---|
| 255 | tailor $ help bootstrap |
|---|
| 256 | |
|---|
| 257 | Checkout the initial upstream revision, by default HEAD (or |
|---|
| 258 | specified by argument), then import the subtree into the |
|---|
| 259 | target repository. |
|---|
| 260 | |
|---|
| 261 | |
|---|
| 262 | Further help |
|---|
| 263 | ============ |
|---|
| 264 | |
|---|
| 265 | See the output of ``tailor.py -h`` for some further tips. There's |
|---|
| 266 | also a `wiki page`_ that may give you some other hints. The |
|---|
| 267 | development of Tailor is mainly driven by user requests at this point, |
|---|
| 268 | and the preferred comunication media is the dedicated `mailing list`_ |
|---|
| 269 | [#]_. |
|---|
| 270 | |
|---|
| 271 | .. _wiki page: |
|---|
| 272 | http://www.darcs.net/DarcsWiki/Tailor |
|---|
| 273 | |
|---|
| 274 | .. _mailing list: |
|---|
| 275 | http://lists.zooko.com/mailman/listinfo/tailor |
|---|
| 276 | |
|---|
| 277 | I will be more than happy to answer any doubt, question or suggestion |
|---|
| 278 | you may have on it. I'm usually hanging as "lelit" on the IRC channel |
|---|
| 279 | devoted to darcs on the `freenode.net` network. Do not hesitate to |
|---|
| 280 | contact me either by email or chatting there. |
|---|
| 281 | |
|---|
| 282 | .. [#] I wish to say a big `Thank you` to `Zooko <zooko@zooko.com>`_, |
|---|
| 283 | for hosting the ML and for supporting Tailor in several ways, |
|---|
| 284 | from suggestions to bug reporting and fixing. |
|---|
| 285 | |
|---|
| 286 | |
|---|
| 287 | Author |
|---|
| 288 | ====== |
|---|
| 289 | |
|---|
| 290 | Lele Gaifax <lele@nautilus.homeip.net> |
|---|
| 291 | |
|---|
| 292 | |
|---|
| 293 | Monotone support |
|---|
| 294 | ---------------- |
|---|
| 295 | |
|---|
| 296 | Monotone_ support was kindly contributed by `Markus Schiltknecht |
|---|
| 297 | <markus@bluegap.ch>`_ and further developed by `rghetta |
|---|
| 298 | <birrachiara@tin.it>`_. Since I'm not currently using monotone (so |
|---|
| 299 | little time, so many VCSs...) I'm not in position to test it out |
|---|
| 300 | properly, but I'll do my best to keep it in sync, maybe with your |
|---|
| 301 | support :-) |
|---|
| 302 | |
|---|
| 303 | .. _monotone: http://www.venge.net/monotone/ |
|---|
| 304 | |
|---|
| 305 | |
|---|
| 306 | License |
|---|
| 307 | ======= |
|---|
| 308 | |
|---|
| 309 | Tailor is distribuited under the `GNU General Public License`__. |
|---|
| 310 | |
|---|
| 311 | __ http://www.fsf.org/licensing/licenses/gpl.html |
|---|
| 312 | |
|---|
| 313 | |
|---|
| 314 | About this document |
|---|
| 315 | =================== |
|---|
| 316 | |
|---|
| 317 | This document and most of the internal documention use the |
|---|
| 318 | reStructuredText format so that it can be easily converted into other |
|---|
| 319 | formats, such as HTML. For more information about this, please see: |
|---|
| 320 | |
|---|
| 321 | http://docutils.sourceforge.net/rst.html |
|---|
| 322 | |
|---|
| 323 | |
|---|
| 324 | .. vim:ft=rest |
|---|
| 325 | .. Local Variables: |
|---|
| 326 | .. mode: rst |
|---|
| 327 | .. End: |
|---|