| 1 | Tailor 1.0 |
|---|
| 2 | ########## |
|---|
| 3 | |
|---|
| 4 | About |
|---|
| 5 | ===== |
|---|
| 6 | |
|---|
| 7 | Tailor is a tool to migrate changesets between ArX_, `Bazaar-NG`_ |
|---|
| 8 | CVS_, Codeville_, Darcs_, Mercurial_, Monotone_, Tla_ and Subversion_ |
|---|
| 9 | [#]_ repositories. |
|---|
| 10 | |
|---|
| 11 | This script makes it easier to keep the upstream changes merged in |
|---|
| 12 | a branch of a product, storing needed information such as the upstream |
|---|
| 13 | URI and revision in special properties on the branched directory. |
|---|
| 14 | |
|---|
| 15 | The following ascii-art illustrates the usual scenario:: |
|---|
| 16 | |
|---|
| 17 | +------------+ +------------+ |
|---|
| 18 | +--------------+ | Immutable | | Working | |
|---|
| 19 | | Upstream CVS |-------->| darcs |----------->| darcs | |
|---|
| 20 | | repository | tailor | repository | darcs pull | repository | |
|---|
| 21 | +--------------+ +------------+ +------------+ |
|---|
| 22 | |^ |
|---|
| 23 | || |
|---|
| 24 | || |
|---|
| 25 | v| |
|---|
| 26 | User |
|---|
| 27 | |
|---|
| 28 | Ideally you should be able to swap and replace "CVS server" and "darcs |
|---|
| 29 | repository" with any combination of the supported systems. |
|---|
| 30 | |
|---|
| 31 | A more convoluted setup shows how brave people are using it to get a |
|---|
| 32 | two way sync:: |
|---|
| 33 | |
|---|
| 34 | +----------+ +--------+ +--------+ +---------+ |
|---|
| 35 | | | -----> | hybrid | darcs | | ----> | my | |
|---|
| 36 | | upstream | tailor | CVS | -----> | master | darcs | working | |
|---|
| 37 | | CVS | <----- | darcs | <----- | darcs | <---- | darcs | |
|---|
| 38 | | | | sync | tailor | | | | |
|---|
| 39 | +----------+ +--------+ +--------+ +---------+ |
|---|
| 40 | (cron) (cron) |
|---|
| 41 | |
|---|
| 42 | |
|---|
| 43 | .. [#] ArX, Monotone, Codeville, Mercurial and Baazar-NG systems may be |
|---|
| 44 | used only as the `target` backend, since the `source` support |
|---|
| 45 | isn't coded yet. Contributions on these backends will be very |
|---|
| 46 | appreciated, since I do not use them enough to figure out the |
|---|
| 47 | best way to get pending changes and build tailor ChangeSets out |
|---|
| 48 | of them. |
|---|
| 49 | |
|---|
| 50 | To the opposite, Tla is supported only as a source system. |
|---|
| 51 | |
|---|
| 52 | .. _arx: http://www.nongnu.org/arx/ |
|---|
| 53 | .. _bazaar-ng: http://www.bazaar-ng.org/ |
|---|
| 54 | .. _codeville: http://www.codeville.org/ |
|---|
| 55 | .. _cvs: http://www.nongnu.org/cvs/ |
|---|
| 56 | .. _darcs: http://www.darcs.net/ |
|---|
| 57 | .. _mercurial: http://www.selenic.com/mercurial/ |
|---|
| 58 | .. _monotone: http://www.venge.net/monotone/ |
|---|
| 59 | .. _subversion: http://subversion.tigris.org/ |
|---|
| 60 | .. _tla: http://www.gnuarch.org/arch/index.html |
|---|
| 61 | |
|---|
| 62 | |
|---|
| 63 | Installation |
|---|
| 64 | ============ |
|---|
| 65 | |
|---|
| 66 | tailor is written in Python, and thus Python must be installed on |
|---|
| 67 | your system to use it. It has been successfully used with Python 2.3 |
|---|
| 68 | and 2.4. |
|---|
| 69 | |
|---|
| 70 | Since it relies on external tools to do the real work such as `cvs`, |
|---|
| 71 | `darcs` [#]_ and `svn`, they need to be installed as well, although only |
|---|
| 72 | those you will actually use. |
|---|
| 73 | |
|---|
| 74 | Make tailor executable:: |
|---|
| 75 | |
|---|
| 76 | $ chmod +x tailor |
|---|
| 77 | |
|---|
| 78 | You can either run tailor where it is currently located, or move it |
|---|
| 79 | along with the vcpx directory to a location in your PATH. |
|---|
| 80 | |
|---|
| 81 | There's even a standard setup.py that you may use to install the |
|---|
| 82 | script using Python conventional distutils. |
|---|
| 83 | |
|---|
| 84 | .. [#] Darcs 1.0.2 is too old, 1.0.3 is good, 1.0.4 (the fourth |
|---|
| 85 | release candidate is under final testing) is recommended since |
|---|
| 86 | it's faster in most operations! |
|---|
| 87 | |
|---|
| 88 | |
|---|
| 89 | Testing |
|---|
| 90 | ======= |
|---|
| 91 | |
|---|
| 92 | You can run the test suite with the following command line:: |
|---|
| 93 | |
|---|
| 94 | $ tailor test -v |
|---|
| 95 | |
|---|
| 96 | that runs all the tests in sequence, or:: |
|---|
| 97 | |
|---|
| 98 | $ tailor test -v TailorTest |
|---|
| 99 | |
|---|
| 100 | to trigger just a subset of them. |
|---|
| 101 | |
|---|
| 102 | |
|---|
| 103 | Operation |
|---|
| 104 | ========= |
|---|
| 105 | |
|---|
| 106 | tailor needs now a configuration file that collects the various bits |
|---|
| 107 | of information it needs to do it's job. |
|---|
| 108 | |
|---|
| 109 | The simplest way of starting out a new configuration is by omitting |
|---|
| 110 | the --configfile command line option, and specifying the other as |
|---|
| 111 | needed plus --verbose: in this situation, tailor will print out an |
|---|
| 112 | equivalent configuration that you can redirect to a file, that you |
|---|
| 113 | later will pass as --configfile. |
|---|
| 114 | |
|---|
| 115 | |
|---|
| 116 | Examples |
|---|
| 117 | -------- |
|---|
| 118 | |
|---|
| 119 | 1. Bootstrap a new tailored project, starting at upstream revision 10 |
|---|
| 120 | |
|---|
| 121 | a. First create a config file:: |
|---|
| 122 | |
|---|
| 123 | $ tailor --verbose -s svn -R http://svn.server/path/to/svnrepo \ |
|---|
| 124 | --module /Product/trunk -r 10 --subdir Product \ |
|---|
| 125 | ~/darcs/MyProduct > myproject.tailor |
|---|
| 126 | |
|---|
| 127 | b. Modify it as you like (mostly adjusting root-directories and the |
|---|
| 128 | like):: |
|---|
| 129 | |
|---|
| 130 | $ emacs myproject.tailor |
|---|
| 131 | |
|---|
| 132 | c. Run tailor on it:: |
|---|
| 133 | |
|---|
| 134 | $ tailor --configfile myproject.tailor |
|---|
| 135 | |
|---|
| 136 | 2. Bootstrap a new product, fetching its whole CVS repository and |
|---|
| 137 | storing under SVN |
|---|
| 138 | |
|---|
| 139 | a. First create a config file:: |
|---|
| 140 | |
|---|
| 141 | $ tailor --verbose --source-kind cvs --target-kind svn \ |
|---|
| 142 | --repository :pserver:cvs.zope.org:/cvs-repository \ |
|---|
| 143 | --module CMF/CMFCore --revision INITIAL \ |
|---|
| 144 | --target-repository file:///some/where/svnrepo \ |
|---|
| 145 | --target-module / cmfcore > cmfcore.tailor |
|---|
| 146 | |
|---|
| 147 | b. Modify it as you like (mostly adjusting root-directories and the |
|---|
| 148 | like):: |
|---|
| 149 | |
|---|
| 150 | $ emacs myproject.tailor |
|---|
| 151 | |
|---|
| 152 | c. Run tailor on it once, to bootstrap the project:: |
|---|
| 153 | |
|---|
| 154 | $ tailor -D -v --configfile myproject.tailor |
|---|
| 155 | |
|---|
| 156 | If the target repository is on the local filesystem (ie, it |
|---|
| 157 | starts with ``file:///``) and it does not exist, tailor |
|---|
| 158 | creates a new empty Subversion repository at the specified |
|---|
| 159 | location. |
|---|
| 160 | |
|---|
| 161 | .. note:: Before step d) below, you may want to install an |
|---|
| 162 | appropriate hook in the repository to enable the |
|---|
| 163 | propset command to operate on unversioned properties, |
|---|
| 164 | as described in the `svn manual`__. Then you can |
|---|
| 165 | specify '--use-svn-propset' option, and tailor will |
|---|
| 166 | put the original author and timestamp in the proper |
|---|
| 167 | svn metadata instead of appending them to the changelog. |
|---|
| 168 | |
|---|
| 169 | Other than the annoying repository manual intervention, |
|---|
| 170 | this thread__ and this other__ explain why using |
|---|
| 171 | ``-r{DATE}`` may produce strange results with this setup. |
|---|
| 172 | |
|---|
| 173 | d. Run tailor again and again, to sync up with latest changes:: |
|---|
| 174 | |
|---|
| 175 | $ tailor -D -v --configfile myproject.tailor |
|---|
| 176 | |
|---|
| 177 | __ http://svnbook.red-bean.com/en/1.0/ch05s02.html#svn-ch-5-sect-2.1 |
|---|
| 178 | __ http://svn.haxx.se/users/archive-2005-07/0605.shtml |
|---|
| 179 | __ http://svn.haxx.se/users/archive-2005-03/0596.shtml |
|---|
| 180 | |
|---|
| 181 | |
|---|
| 182 | 3. Given the configuration file shown below in `Config file format`_, |
|---|
| 183 | the following command:: |
|---|
| 184 | |
|---|
| 185 | $ tailor --configfile example.tailor |
|---|
| 186 | |
|---|
| 187 | is equivalent to this one:: |
|---|
| 188 | |
|---|
| 189 | $ tailor --configfile example.tailor tailor |
|---|
| 190 | |
|---|
| 191 | in that they operate respectively on the default project(s) or |
|---|
| 192 | the ones specified on the command line (and in this case there |
|---|
| 193 | is just a single default project, tailor). |
|---|
| 194 | |
|---|
| 195 | This one instead:: |
|---|
| 196 | |
|---|
| 197 | $ tailor --configfile example.tailor tailor tailor-reverse |
|---|
| 198 | |
|---|
| 199 | operates on both projects. |
|---|
| 200 | |
|---|
| 201 | |
|---|
| 202 | CVS start-revision |
|---|
| 203 | ------------------ |
|---|
| 204 | |
|---|
| 205 | With CVS, you can specify a particular *point in time* specifying |
|---|
| 206 | a `start-revision` with a timestamp like ``2001-12-25 23:26:48 UTC``. |
|---|
| 207 | |
|---|
| 208 | To specify also a particular `branch`, prepend it before the |
|---|
| 209 | timestamp, as in ``unstable-branch 2001-12-25 23:26:48 UTC``. |
|---|
| 210 | |
|---|
| 211 | |
|---|
| 212 | Resolving conflicts |
|---|
| 213 | =================== |
|---|
| 214 | |
|---|
| 215 | Should one of the replayed changes generate any conflict, tailor |
|---|
| 216 | will prompt the user to correct them. This is done after the upstream |
|---|
| 217 | patch has been applied and before the final commit on the target |
|---|
| 218 | system, so that manually tweaking the conflict can produce a clean |
|---|
| 219 | patch. |
|---|
| 220 | |
|---|
| 221 | |
|---|
| 222 | Shortcomings |
|---|
| 223 | ============ |
|---|
| 224 | |
|---|
| 225 | Tailor currently suffers of the following reported problems: |
|---|
| 226 | |
|---|
| 227 | a) It does not handle "empty" CVS checkouts, in other words you cannot |
|---|
| 228 | bootstrap a project that has nothing in its CVS upstream |
|---|
| 229 | repository, or from a point in time where this condition was true. |
|---|
| 230 | |
|---|
| 231 | b) It's completely unsupported under Windows, evenif it now uses |
|---|
| 232 | 2.4's subprocess_ that seems able to hide Windows crazyness... |
|---|
| 233 | |
|---|
| 234 | c) ArX, Monotone, Codeville and Baazar-NG are (currently) only |
|---|
| 235 | supported as *target*; Tla only as *source*. |
|---|
| 236 | |
|---|
| 237 | d) Specifying ``--subdir .`` may not work, in particular when dealing |
|---|
| 238 | with remote CVS repositories (it does when the CVS repository is |
|---|
| 239 | on local machine). |
|---|
| 240 | |
|---|
| 241 | This list will always be incomplete, but I'll do my best to keep it |
|---|
| 242 | short :-) |
|---|
| 243 | |
|---|
| 244 | .. _subprocess: http://www.lysator.liu.se/~astrand/popen5/ |
|---|
| 245 | |
|---|
| 246 | |
|---|
| 247 | Config file format |
|---|
| 248 | ================== |
|---|
| 249 | |
|---|
| 250 | When your project is composed by multiple upstream modules, it is |
|---|
| 251 | easier to collect such information in a single file. This is done by |
|---|
| 252 | specifying the `--configfile` option with a file name as argument. In |
|---|
| 253 | this case, tailor will read the above information from a standard |
|---|
| 254 | Python ConfigParser file. |
|---|
| 255 | |
|---|
| 256 | For example:: |
|---|
| 257 | |
|---|
| 258 | [DEFAULT] |
|---|
| 259 | verbose = True |
|---|
| 260 | projects = tailor |
|---|
| 261 | |
|---|
| 262 | [tailor] |
|---|
| 263 | root = /tmp/n9 |
|---|
| 264 | source = darcs:tailor |
|---|
| 265 | target = svn:tailor |
|---|
| 266 | dont-refill-changelogs = True |
|---|
| 267 | state-file = tailor.state |
|---|
| 268 | |
|---|
| 269 | [tailor-reverse] |
|---|
| 270 | root = /tmp/n9 |
|---|
| 271 | source = svn:tailor |
|---|
| 272 | target = darcs:tailor |
|---|
| 273 | state-file = reverse.state |
|---|
| 274 | |
|---|
| 275 | [svn:tailor] |
|---|
| 276 | repository = file:///tmp/testtai |
|---|
| 277 | module = /project1 |
|---|
| 278 | |
|---|
| 279 | [darcs:tailor] |
|---|
| 280 | repository = ~/WiP/cvsync |
|---|
| 281 | |
|---|
| 282 | .. hint:: If you execute the examples above with ``--verbose --debug`` |
|---|
| 283 | **and without** ``--configfile``, tailor will write a |
|---|
| 284 | template config filled with the values specified by the |
|---|
| 285 | other options. You can redirect |
|---|
| 286 | |
|---|
| 287 | |
|---|
| 288 | Using a Python script as configuration file |
|---|
| 289 | ------------------------------------------- |
|---|
| 290 | |
|---|
| 291 | Instead of executing ``tailor --configfile project.tailor.conf`` |
|---|
| 292 | you can prepend the following signature to the config itself:: |
|---|
| 293 | |
|---|
| 294 | #!/usr/bin/env /path/to/tailor |
|---|
| 295 | |
|---|
| 296 | Giving execute mode to it will permit the launch of the tailor |
|---|
| 297 | process by running the config script directly:: |
|---|
| 298 | |
|---|
| 299 | $ ./project.tailor.conf |
|---|
| 300 | |
|---|
| 301 | When a config file is signed in this way [#]_, either you pass it as |
|---|
| 302 | argument to ``--configfile`` or executed as above, tailor will |
|---|
| 303 | actually execute it as a full fledged Python script, that may define |
|---|
| 304 | functions that alter the behaviour of tailor itself. |
|---|
| 305 | |
|---|
| 306 | A common usage of this functionality is to define so called `hooks`, |
|---|
| 307 | sequences of functions that are executed at particular points in |
|---|
| 308 | the tailorization process. |
|---|
| 309 | |
|---|
| 310 | Just to illustrate the functionality, consider the following example:: |
|---|
| 311 | |
|---|
| 312 | #!/usr/bin/env tailor |
|---|
| 313 | |
|---|
| 314 | """ |
|---|
| 315 | [DEFAULT] |
|---|
| 316 | debug = False |
|---|
| 317 | verbose = True |
|---|
| 318 | |
|---|
| 319 | [project] |
|---|
| 320 | target = bzrng:target |
|---|
| 321 | root-directory = /tmp/prova |
|---|
| 322 | state-file = tailor.state |
|---|
| 323 | source = darcs:source |
|---|
| 324 | before-commit = before |
|---|
| 325 | after-commit = after |
|---|
| 326 | start-revision = Almost arbitrarily tagging this as version 0.8 |
|---|
| 327 | |
|---|
| 328 | [bzrng:target] |
|---|
| 329 | python-path = /opt/src/bzr.dev |
|---|
| 330 | subdir = bzrside |
|---|
| 331 | |
|---|
| 332 | [darcs:source] |
|---|
| 333 | repository = /home/lele/WiP/cvsync |
|---|
| 334 | subdir = darcside |
|---|
| 335 | """ |
|---|
| 336 | |
|---|
| 337 | def before(wd, changeset): |
|---|
| 338 | print "BEFORE", changeset |
|---|
| 339 | changeset.author = "LELE" |
|---|
| 340 | return changeset |
|---|
| 341 | |
|---|
| 342 | def after(wd, changeset): |
|---|
| 343 | print "AFTER", changeset |
|---|
| 344 | |
|---|
| 345 | With the above in a `script` called say ``tester``, just doing:: |
|---|
| 346 | |
|---|
| 347 | $ chmod 755 tester |
|---|
| 348 | $ ./tester |
|---|
| 349 | |
|---|
| 350 | will migrate the history from a darcs repository to a bazaar-ng one, |
|---|
| 351 | forcing the author to a well-known name :-) |
|---|
| 352 | |
|---|
| 353 | .. [#] Tailor does actually read just the first two bytes from the |
|---|
| 354 | file, and compare them with "#!", so you are free to choose |
|---|
| 355 | whatever syntax works in your environment. |
|---|
| 356 | |
|---|
| 357 | |
|---|
| 358 | State file |
|---|
| 359 | ---------- |
|---|
| 360 | |
|---|
| 361 | The state file stores two things: the last upstream revision that |
|---|
| 362 | has been applied to the tree, and a sequence of pending (not yet |
|---|
| 363 | applied) changesets, that may be empty. In the latter case, tailor |
|---|
| 364 | will fetch latest changes from the upstream repository. |
|---|
| 365 | |
|---|
| 366 | |
|---|
| 367 | Further help |
|---|
| 368 | ============ |
|---|
| 369 | |
|---|
| 370 | See the output of ``tailor -h`` for some further tips. There's |
|---|
| 371 | also a `wiki page`_ that may give you some other hints. The |
|---|
| 372 | development of Tailor is mainly driven by user requests at this point, |
|---|
| 373 | and the preferred comunication media is the dedicated `mailing list`_ |
|---|
| 374 | [#]_. |
|---|
| 375 | |
|---|
| 376 | .. _wiki page: |
|---|
| 377 | http://www.darcs.net/DarcsWiki/Tailor |
|---|
| 378 | |
|---|
| 379 | .. _mailing list: |
|---|
| 380 | http://lists.zooko.com/mailman/listinfo/tailor |
|---|
| 381 | |
|---|
| 382 | I will be more than happy to answer any doubt, question or suggestion |
|---|
| 383 | you may have on it. I'm usually hanging as "lelit" on the IRC channel |
|---|
| 384 | devoted to darcs on the `freenode.net` network. Do not hesitate to |
|---|
| 385 | contact me either by email or chatting there. |
|---|
| 386 | |
|---|
| 387 | .. [#] I wish to say a big `Thank you` to `Zooko <zooko@zooko.com>`_, |
|---|
| 388 | for hosting the ML and for supporting Tailor in several ways, |
|---|
| 389 | from suggestions to bug reporting and fixing. |
|---|
| 390 | |
|---|
| 391 | |
|---|
| 392 | Authors |
|---|
| 393 | ======= |
|---|
| 394 | |
|---|
| 395 | Lele Gaifax <lele@nautilus.homeip.net> |
|---|
| 396 | |
|---|
| 397 | Since I'm not currently using all the supported systems (so little |
|---|
| 398 | time, so many VCSs...) I'm not in position to test them out properly, |
|---|
| 399 | but I'll do my best to keep them in sync, maybe with your support :-) |
|---|
| 400 | |
|---|
| 401 | ArX support |
|---|
| 402 | ----------- |
|---|
| 403 | |
|---|
| 404 | ArX_ support was contributed by `Walter Landry <wlandry@ucsd.edu>`_. |
|---|
| 405 | |
|---|
| 406 | Bazaar-NG support |
|---|
| 407 | ----------------- |
|---|
| 408 | |
|---|
| 409 | `Bazaar-NG`_ support was contributed by `Johan Rydberg |
|---|
| 410 | <jrydberg@gnu.org>`_. |
|---|
| 411 | |
|---|
| 412 | Monotone support |
|---|
| 413 | ---------------- |
|---|
| 414 | |
|---|
| 415 | Monotone_ support was kindly contributed by `Markus Schiltknecht |
|---|
| 416 | <markus@bluegap.ch>`_ and further developed by `rghetta |
|---|
| 417 | <birrachiara@tin.it>`_. |
|---|
| 418 | |
|---|
| 419 | Tla support |
|---|
| 420 | ----------- |
|---|
| 421 | |
|---|
| 422 | Tla_ support was contributed by `Robin Farine |
|---|
| 423 | <robin.farine@terminus.org>`_. |
|---|
| 424 | |
|---|
| 425 | |
|---|
| 426 | License |
|---|
| 427 | ======= |
|---|
| 428 | |
|---|
| 429 | Tailor is distribuited under the `GNU General Public License`__. |
|---|
| 430 | |
|---|
| 431 | __ http://www.fsf.org/licensing/licenses/gpl.html |
|---|
| 432 | |
|---|
| 433 | |
|---|
| 434 | About this document |
|---|
| 435 | =================== |
|---|
| 436 | |
|---|
| 437 | This document and most of the internal documention use the |
|---|
| 438 | reStructuredText format so that it can be easily converted into other |
|---|
| 439 | formats, such as HTML. For more information about this, please see: |
|---|
| 440 | |
|---|
| 441 | http://docutils.sourceforge.net/rst.html |
|---|
| 442 | |
|---|
| 443 | |
|---|
| 444 | .. vim:ft=rest |
|---|
| 445 | .. Local Variables: |
|---|
| 446 | .. mode: rst |
|---|
| 447 | .. End: |
|---|