| 1 | Tailor 1.0 |
|---|
| 2 | ########## |
|---|
| 3 | |
|---|
| 4 | .. contents:: |
|---|
| 5 | |
|---|
| 6 | About |
|---|
| 7 | ===== |
|---|
| 8 | |
|---|
| 9 | Tailor is a tool to migrate changesets between ArX_, Bazaar_, `Bazaar-NG`_, |
|---|
| 10 | CVS_, Codeville_, Darcs_, Git_, Mercurial_, Monotone_, Subversion_ and Tla_ |
|---|
| 11 | [#]_ repositories. |
|---|
| 12 | |
|---|
| 13 | This script makes it easier to keep the upstream changes merged in |
|---|
| 14 | a branch of a product, storing needed information such as the upstream |
|---|
| 15 | URI and revision in special properties on the branched directory. |
|---|
| 16 | |
|---|
| 17 | The following ascii-art illustrates the usual scenario:: |
|---|
| 18 | |
|---|
| 19 | +------------+ +------------+ |
|---|
| 20 | +--------------+ | Immutable | | Working | |
|---|
| 21 | | Upstream CVS |-------->| darcs |----------->| darcs | |
|---|
| 22 | | repository | tailor | repository | darcs pull | repository | |
|---|
| 23 | +--------------+ +------------+ +------------+ |
|---|
| 24 | |^ |
|---|
| 25 | || |
|---|
| 26 | || |
|---|
| 27 | v| |
|---|
| 28 | User |
|---|
| 29 | |
|---|
| 30 | Ideally you should be able to swap and replace "CVS server" and "darcs |
|---|
| 31 | repository" with any combination of the supported systems. |
|---|
| 32 | |
|---|
| 33 | A more convoluted setup shows how brave people are using it to get a |
|---|
| 34 | two way sync:: |
|---|
| 35 | |
|---|
| 36 | +----------+ +--------+ +--------+ +---------+ |
|---|
| 37 | | | -----> | hybrid | darcs | | ----> | my | |
|---|
| 38 | | upstream | tailor | CVS | -----> | master | darcs | working | |
|---|
| 39 | | CVS | <----- | darcs | <----- | darcs | <---- | darcs | |
|---|
| 40 | | | | sync | tailor | | | | |
|---|
| 41 | +----------+ +--------+ +--------+ +---------+ |
|---|
| 42 | (cron) (cron) |
|---|
| 43 | |
|---|
| 44 | |
|---|
| 45 | .. [#] ArX, Baazar-NG, Codeville, Git and Mercurial systems may be |
|---|
| 46 | used only as the `target` backend, since the `source` support |
|---|
| 47 | isn't coded yet. Contributions on these backends will be very |
|---|
| 48 | appreciated, since I do not use them enough to figure out the |
|---|
| 49 | best way to get pending changes and build tailor ChangeSets out |
|---|
| 50 | of them. |
|---|
| 51 | |
|---|
| 52 | To the opposite, Bazaar and Tla are supported only as source |
|---|
| 53 | systems. |
|---|
| 54 | |
|---|
| 55 | .. _arx: http://www.nongnu.org/arx/ |
|---|
| 56 | .. _bazaar: http://bazaar.canonical.com/ |
|---|
| 57 | .. _bazaar-ng: http://www.bazaar-ng.org/ |
|---|
| 58 | .. _codeville: http://www.codeville.org/ |
|---|
| 59 | .. _cvs: http://www.nongnu.org/cvs/ |
|---|
| 60 | .. _darcs: http://www.darcs.net/ |
|---|
| 61 | .. _git: http://git.or.cz/ |
|---|
| 62 | .. _mercurial: http://www.selenic.com/mercurial/ |
|---|
| 63 | .. _monotone: http://www.venge.net/monotone/ |
|---|
| 64 | .. _subversion: http://subversion.tigris.org/ |
|---|
| 65 | .. _tla: http://www.gnuarch.org/arch/index.html |
|---|
| 66 | |
|---|
| 67 | |
|---|
| 68 | Installation |
|---|
| 69 | ============ |
|---|
| 70 | |
|---|
| 71 | tailor is written in Python, and thus Python must be installed on |
|---|
| 72 | your system to use it. It has been successfully used with Python 2.3 |
|---|
| 73 | and 2.4. |
|---|
| 74 | |
|---|
| 75 | Since it relies on external tools to do the real work such as `cvs`, |
|---|
| 76 | `darcs` [#]_ and `svn`, they need to be installed as well, although only |
|---|
| 77 | those you will actually use. |
|---|
| 78 | |
|---|
| 79 | Make tailor executable:: |
|---|
| 80 | |
|---|
| 81 | $ chmod +x tailor |
|---|
| 82 | |
|---|
| 83 | You can either run tailor where it is currently located, or move it |
|---|
| 84 | along with the vcpx directory to a location in your PATH. |
|---|
| 85 | |
|---|
| 86 | There's even a standard setup.py that you may use to install the |
|---|
| 87 | script using Python conventional distutils. |
|---|
| 88 | |
|---|
| 89 | .. [#] Darcs 1.0.2 is too old, 1.0.3 is good, 1.0.4 (the fourth |
|---|
| 90 | release candidate is under final testing) is recommended since |
|---|
| 91 | it's faster in most operations! |
|---|
| 92 | |
|---|
| 93 | |
|---|
| 94 | Testing |
|---|
| 95 | ======= |
|---|
| 96 | |
|---|
| 97 | You can run the test suite with the following command line:: |
|---|
| 98 | |
|---|
| 99 | $ tailor test -v |
|---|
| 100 | |
|---|
| 101 | that runs all the tests in sequence, or:: |
|---|
| 102 | |
|---|
| 103 | $ tailor test -v TailorTest |
|---|
| 104 | |
|---|
| 105 | to trigger just a subset of them. |
|---|
| 106 | |
|---|
| 107 | |
|---|
| 108 | Operation |
|---|
| 109 | ========= |
|---|
| 110 | |
|---|
| 111 | tailor needs now a configuration file that collects the various bits |
|---|
| 112 | of information it needs to do it's job. |
|---|
| 113 | |
|---|
| 114 | The simplest way of starting out a new configuration is by omitting |
|---|
| 115 | the --configfile command line option, and specifying the other as |
|---|
| 116 | needed plus --verbose: in this situation, tailor will print out an |
|---|
| 117 | equivalent configuration that you can redirect to a file, that you |
|---|
| 118 | later will pass as --configfile. |
|---|
| 119 | |
|---|
| 120 | |
|---|
| 121 | Examples |
|---|
| 122 | -------- |
|---|
| 123 | |
|---|
| 124 | 1. Bootstrap a new tailored project, starting at upstream revision 10 |
|---|
| 125 | |
|---|
| 126 | a. First create a config file:: |
|---|
| 127 | |
|---|
| 128 | $ tailor --verbose -s svn -R http://svn.server/path/to/svnrepo \ |
|---|
| 129 | --module /Product/trunk -r 10 --subdir Product \ |
|---|
| 130 | ~/darcs/MyProduct > myproject.tailor |
|---|
| 131 | |
|---|
| 132 | b. Modify it as you like (mostly adjusting root-directories and the |
|---|
| 133 | like):: |
|---|
| 134 | |
|---|
| 135 | $ emacs myproject.tailor |
|---|
| 136 | |
|---|
| 137 | c. Run tailor on it:: |
|---|
| 138 | |
|---|
| 139 | $ tailor --configfile myproject.tailor |
|---|
| 140 | |
|---|
| 141 | 2. Bootstrap a new product, fetching its whole CVS repository and |
|---|
| 142 | storing under SVN |
|---|
| 143 | |
|---|
| 144 | a. First create a config file:: |
|---|
| 145 | |
|---|
| 146 | $ tailor --verbose --source-kind cvs --target-kind svn \ |
|---|
| 147 | --repository :pserver:cvs.zope.org:/cvs-repository \ |
|---|
| 148 | --module CMF/CMFCore --revision INITIAL \ |
|---|
| 149 | --target-repository file:///some/where/svnrepo \ |
|---|
| 150 | --target-module / cmfcore > cmfcore.tailor |
|---|
| 151 | |
|---|
| 152 | b. Modify it as you like (mostly adjusting root-directories and the |
|---|
| 153 | like):: |
|---|
| 154 | |
|---|
| 155 | $ emacs cmfcore.tailor |
|---|
| 156 | |
|---|
| 157 | c. Run tailor on it once, to bootstrap the project:: |
|---|
| 158 | |
|---|
| 159 | $ tailor -D -v --configfile cmfcore.tailor |
|---|
| 160 | |
|---|
| 161 | If the target repository is on the local filesystem (ie, it |
|---|
| 162 | starts with ``file:///``) and it does not exist, tailor |
|---|
| 163 | creates a new empty Subversion repository at the specified |
|---|
| 164 | location. |
|---|
| 165 | |
|---|
| 166 | .. note:: Before step d) below, you may want to install an |
|---|
| 167 | appropriate hook in the repository to enable the |
|---|
| 168 | propset command to operate on unversioned properties, |
|---|
| 169 | as described in the `svn manual`__. Then you can |
|---|
| 170 | specify '--use-svn-propset' option, and tailor will |
|---|
| 171 | put the original author and timestamp in the proper |
|---|
| 172 | svn metadata instead of appending them to the changelog. |
|---|
| 173 | |
|---|
| 174 | Other than the annoying repository manual intervention, |
|---|
| 175 | this thread__ and this other__ explain why using |
|---|
| 176 | ``-r{DATE}`` may produce strange results with this setup. |
|---|
| 177 | |
|---|
| 178 | d. Run tailor again and again, to sync up with latest changes:: |
|---|
| 179 | |
|---|
| 180 | $ tailor -D -v --configfile myproject.tailor |
|---|
| 181 | |
|---|
| 182 | __ http://svnbook.red-bean.com/en/1.0/ch05s02.html#svn-ch-5-sect-2.1 |
|---|
| 183 | __ http://svn.haxx.se/users/archive-2005-07/0605.shtml |
|---|
| 184 | __ http://svn.haxx.se/users/archive-2005-03/0596.shtml |
|---|
| 185 | |
|---|
| 186 | |
|---|
| 187 | 3. Given the configuration file shown below in `Config file format`_, |
|---|
| 188 | the following command:: |
|---|
| 189 | |
|---|
| 190 | $ tailor --configfile example.tailor |
|---|
| 191 | |
|---|
| 192 | is equivalent to this one:: |
|---|
| 193 | |
|---|
| 194 | $ tailor --configfile example.tailor tailor |
|---|
| 195 | |
|---|
| 196 | in that they operate respectively on the default project(s) or |
|---|
| 197 | the ones specified on the command line (and in this case there |
|---|
| 198 | is just a single default project, tailor). |
|---|
| 199 | |
|---|
| 200 | This one instead:: |
|---|
| 201 | |
|---|
| 202 | $ tailor --configfile example.tailor tailor tailor-reverse |
|---|
| 203 | |
|---|
| 204 | operates on both projects. |
|---|
| 205 | |
|---|
| 206 | |
|---|
| 207 | CVS start-revision |
|---|
| 208 | ------------------ |
|---|
| 209 | |
|---|
| 210 | With CVS, you can specify a particular *point in time* specifying |
|---|
| 211 | a `start-revision` with a timestamp like ``2001-12-25 23:26:48 UTC``. |
|---|
| 212 | |
|---|
| 213 | To specify also a particular `branch`, prepend it before the |
|---|
| 214 | timestamp, as in ``unstable-branch 2001-12-25 23:26:48 UTC``. |
|---|
| 215 | |
|---|
| 216 | |
|---|
| 217 | Resolving conflicts |
|---|
| 218 | =================== |
|---|
| 219 | |
|---|
| 220 | Should one of the replayed changes generate any conflict, tailor |
|---|
| 221 | will prompt the user to correct them. This is done after the upstream |
|---|
| 222 | patch has been applied and before the final commit on the target |
|---|
| 223 | system, so that manually tweaking the conflict can produce a clean |
|---|
| 224 | patch. |
|---|
| 225 | |
|---|
| 226 | |
|---|
| 227 | Shortcomings |
|---|
| 228 | ============ |
|---|
| 229 | |
|---|
| 230 | Tailor currently suffers of the following reported problems: |
|---|
| 231 | |
|---|
| 232 | a) It does not handle "empty" CVS checkouts, in other words you cannot |
|---|
| 233 | bootstrap a project that has nothing in its CVS upstream |
|---|
| 234 | repository, or from a point in time where this condition was true. |
|---|
| 235 | |
|---|
| 236 | b) It's completely unsupported under Windows, evenif it now uses |
|---|
| 237 | 2.4's subprocess_ that seems able to hide Windows crazyness... |
|---|
| 238 | |
|---|
| 239 | c) ArX, Baazar-NG, Codeville, Git, and Mercurial are (currently) only |
|---|
| 240 | supported as *target*; Bazaar and Tla only as *source*. |
|---|
| 241 | |
|---|
| 242 | d) Specifying ``--subdir .`` may not work, in particular when dealing |
|---|
| 243 | with remote CVS repositories (it does when the CVS repository is |
|---|
| 244 | on local machine). |
|---|
| 245 | |
|---|
| 246 | This list will always be incomplete, but I'll do my best to keep it |
|---|
| 247 | short :-) |
|---|
| 248 | |
|---|
| 249 | .. _subprocess: http://www.lysator.liu.se/~astrand/popen5/ |
|---|
| 250 | |
|---|
| 251 | |
|---|
| 252 | Config file format |
|---|
| 253 | ================== |
|---|
| 254 | |
|---|
| 255 | When your project is composed by multiple upstream modules, it is |
|---|
| 256 | easier to collect such information in a single file. This is done by |
|---|
| 257 | specifying the `--configfile` option with a file name as argument. In |
|---|
| 258 | this case, tailor will read the above information from a standard |
|---|
| 259 | Python ConfigParser file. |
|---|
| 260 | |
|---|
| 261 | For example:: |
|---|
| 262 | |
|---|
| 263 | [DEFAULT] |
|---|
| 264 | verbose = True |
|---|
| 265 | projects = tailor |
|---|
| 266 | |
|---|
| 267 | [tailor] |
|---|
| 268 | root-directory = /tmp/n9 |
|---|
| 269 | source = darcs:tailor |
|---|
| 270 | target = svn:tailor |
|---|
| 271 | dont-refill-changelogs = True |
|---|
| 272 | state-file = tailor.state |
|---|
| 273 | |
|---|
| 274 | [tailor-reverse] |
|---|
| 275 | root-directory = /tmp/n9 |
|---|
| 276 | source = svn:tailor |
|---|
| 277 | target = darcs:tailor |
|---|
| 278 | state-file = reverse.state |
|---|
| 279 | |
|---|
| 280 | [svn:tailor] |
|---|
| 281 | repository = file:///tmp/testtai |
|---|
| 282 | module = /project1 |
|---|
| 283 | subdir = svnside |
|---|
| 284 | |
|---|
| 285 | [darcs:tailor] |
|---|
| 286 | repository = ~/WiP/cvsync |
|---|
| 287 | subdir = darcside |
|---|
| 288 | |
|---|
| 289 | The configuration may hold one or more `projects`_ and two or more |
|---|
| 290 | `repositories`_: project names do not contains colons ":", |
|---|
| 291 | repository names must and the first part of the name before the |
|---|
| 292 | colon specify the kind of the repository. So, the above example |
|---|
| 293 | contains two projects, one that goes from `darcs` to `subversion`, the |
|---|
| 294 | other in the opposite direction. |
|---|
| 295 | |
|---|
| 296 | The ``[DEFAULT]`` section contains the default values, that will be |
|---|
| 297 | used when a specific setting is missing from the particular section. |
|---|
| 298 | |
|---|
| 299 | You can specify on which project tailor should operate by |
|---|
| 300 | giving its name on the command line, even more than one. When not |
|---|
| 301 | explicitly given, tailor will look at ``projects`` in the |
|---|
| 302 | ``[DEFAULT]`` section, and if its missing it will loop over all |
|---|
| 303 | projects in the configuration. |
|---|
| 304 | |
|---|
| 305 | The following simpler config just go in one direction, for a single |
|---|
| 306 | project, so no need neither for ``[DEFAULT].projects`` nor command |
|---|
| 307 | line arguments:: |
|---|
| 308 | |
|---|
| 309 | [pxlib] |
|---|
| 310 | source = cvs:pxlib |
|---|
| 311 | target = hg:pxlib |
|---|
| 312 | root-directory = ~/mypxlib |
|---|
| 313 | start-revision = INITIAL |
|---|
| 314 | subdir = pxlib |
|---|
| 315 | |
|---|
| 316 | [cvs:pxlib] |
|---|
| 317 | repository = :pserver:anonymous@cvs.sf.net:/cvsroot/pxlib |
|---|
| 318 | module = pxlib |
|---|
| 319 | |
|---|
| 320 | [hg:pxlib] |
|---|
| 321 | hg-command = /usr/local/bin/hg |
|---|
| 322 | |
|---|
| 323 | This will use a single directory, ``pxlib`` to contain both the source |
|---|
| 324 | and the target system. If you prefer keeping the separated, you just |
|---|
| 325 | need to specify a different directory for each repository [#]_, as in:: |
|---|
| 326 | |
|---|
| 327 | [pxlib] |
|---|
| 328 | source = cvs:pxlib |
|---|
| 329 | target = hg:pxlib |
|---|
| 330 | root-directory = ~/mypxlib |
|---|
| 331 | start-revision = INITIAL |
|---|
| 332 | |
|---|
| 333 | [cvs:pxlib] |
|---|
| 334 | repository = :pserver:anonymous@cvs.sf.net:/cvsroot/pxlib |
|---|
| 335 | module = pxlib |
|---|
| 336 | subdir = original |
|---|
| 337 | |
|---|
| 338 | [hg:pxlib] |
|---|
| 339 | hg-command = /usr/local/bin/hg |
|---|
| 340 | subdir = migrated |
|---|
| 341 | |
|---|
| 342 | This will extract upstream CVS sources into ``~/mypxlib/original``, |
|---|
| 343 | and create a new Mercurial repository in ``~/mypxlib/migrated``. |
|---|
| 344 | |
|---|
| 345 | On final example to show the syntax of Bazaar sources:: |
|---|
| 346 | |
|---|
| 347 | [project] |
|---|
| 348 | target = hg:target |
|---|
| 349 | start-revision = base-0 |
|---|
| 350 | root-directory = /tmp/calife |
|---|
| 351 | state-file = tailor.state |
|---|
| 352 | source = baz:source |
|---|
| 353 | |
|---|
| 354 | [baz:source] |
|---|
| 355 | module = calife--pam--3.0 |
|---|
| 356 | repository = roberto@keltia.net--2003-depot |
|---|
| 357 | subdir = tla |
|---|
| 358 | |
|---|
| 359 | [hg:target] |
|---|
| 360 | repository = /tmp/HG/calife-pam |
|---|
| 361 | subdir = hg |
|---|
| 362 | |
|---|
| 363 | .. [#] NB: when the source and the target repositories specify |
|---|
| 364 | different directories with the ``subdir`` option, tailor |
|---|
| 365 | uses ``rsync`` to keep them in sync, so that tool needs |
|---|
| 366 | to be installed. |
|---|
| 367 | |
|---|
| 368 | |
|---|
| 369 | Configuration sections |
|---|
| 370 | ---------------------- |
|---|
| 371 | |
|---|
| 372 | Default |
|---|
| 373 | ~~~~~~~ |
|---|
| 374 | |
|---|
| 375 | The ``[DEFAULT]`` section in the configuration file may set the |
|---|
| 376 | default value for any of the recognized options: when a value is |
|---|
| 377 | missing from a specific section it is looked up in this section. |
|---|
| 378 | |
|---|
| 379 | One particular option, ``projects``, is meaningful only in the |
|---|
| 380 | ``[DEFAULT]`` section: it's a comma separated list of project names, |
|---|
| 381 | the one that will be operated on by tailor when no project is |
|---|
| 382 | specified on the command line. When the there are no ``projects`` |
|---|
| 383 | setting nor any on the command line, tailor activates all configured |
|---|
| 384 | projects, in order of appearance in the config file. |
|---|
| 385 | |
|---|
| 386 | |
|---|
| 387 | Projects |
|---|
| 388 | ~~~~~~~~ |
|---|
| 389 | |
|---|
| 390 | A project is identified by a section whose name does not contain any |
|---|
| 391 | colon (":") character, and configured with the following values: |
|---|
| 392 | |
|---|
| 393 | root-directory |
|---|
| 394 | This is where all the fun will happen: this directory will contain |
|---|
| 395 | the source and the target working copy, and usually the state and |
|---|
| 396 | the log file. It support the conventional `~user` to indicate user's |
|---|
| 397 | home directory. |
|---|
| 398 | |
|---|
| 399 | subdir |
|---|
| 400 | This is the subdirectory, relative to the `root-directory`, where |
|---|
| 401 | tailor will extract the source working copy. It may be '.' for some |
|---|
| 402 | backend kinds. |
|---|
| 403 | |
|---|
| 404 | state-file |
|---|
| 405 | Name of the state file needed to store tailor last activity. |
|---|
| 406 | |
|---|
| 407 | source |
|---|
| 408 | The source repository: a repository name is something like |
|---|
| 409 | "darcs:somename", that will be loaded from the homonymous section |
|---|
| 410 | in the configuration. |
|---|
| 411 | |
|---|
| 412 | target |
|---|
| 413 | The counterpart of `source`, the repository that will receive the |
|---|
| 414 | changes coming from there. |
|---|
| 415 | |
|---|
| 416 | Non mandatory options: |
|---|
| 417 | |
|---|
| 418 | verbose |
|---|
| 419 | Print the commands as they are executed. |
|---|
| 420 | |
|---|
| 421 | debug |
|---|
| 422 | Print also their output. |
|---|
| 423 | |
|---|
| 424 | before-commit |
|---|
| 425 | This is a function name, or a sequence of function names enclosed |
|---|
| 426 | by brackets, that will be executed on each changeset just before |
|---|
| 427 | it get replayed on the target system: this may be used to perform |
|---|
| 428 | any kind of alteration on the content of the changeset, or to skip |
|---|
| 429 | some of them. |
|---|
| 430 | |
|---|
| 431 | after-commit |
|---|
| 432 | This is a function name, or a sequence of function names enclosed |
|---|
| 433 | by brackets, that will be executed on each changeset just after |
|---|
| 434 | the commit on the target system: this may be used for example to |
|---|
| 435 | create a tag. |
|---|
| 436 | |
|---|
| 437 | subdir |
|---|
| 438 | The name of the subdirectory, under ``root-directory``, that will |
|---|
| 439 | contain the source and target repositories/working directories. |
|---|
| 440 | |
|---|
| 441 | start-revision |
|---|
| 442 | This identifies from when tailor should start the migration. It can |
|---|
| 443 | be either ``INITIAL``, to indicate the start of the history, or |
|---|
| 444 | ``HEAD`` to indicate the current latest changeset, or a backend |
|---|
| 445 | specific way of indicate a particular revision/tag in the history. |
|---|
| 446 | See also `CVS start-revision`_ above. |
|---|
| 447 | |
|---|
| 448 | patch-name-format |
|---|
| 449 | Some backends have a distinct notion of `patch name` and `change |
|---|
| 450 | log`, others just suggest a policy that the first line of the |
|---|
| 451 | message is a summary, the rest if present is a more detailed |
|---|
| 452 | description of the change. With this option you can control the |
|---|
| 453 | format of the name, or of the first line of the changelog. |
|---|
| 454 | |
|---|
| 455 | The prototype may contain ``%(keyword)s`` such as 'author', 'date', |
|---|
| 456 | 'revision', 'firstlogline', 'remaininglog'. It defaults to |
|---|
| 457 | `Tailorized "%(revision)s"`; setting it to the empty string means |
|---|
| 458 | that tailor will simply use the original changelog. |
|---|
| 459 | |
|---|
| 460 | remove-first-log-line |
|---|
| 461 | Remove the first line of the upstream changelog. This is intended to |
|---|
| 462 | go in pair with ``patch-name-format``, when using it's 'firstlogline' |
|---|
| 463 | variable to build the name of the patch. By default is ``False``. |
|---|
| 464 | |
|---|
| 465 | |
|---|
| 466 | Repositories |
|---|
| 467 | ~~~~~~~~~~~~ |
|---|
| 468 | |
|---|
| 469 | All the section whose name contains at least one colon character |
|---|
| 470 | denote a repository. A single repository may be shared by zero, one or |
|---|
| 471 | more projects. The first part of the name up to the first colon |
|---|
| 472 | indicates the `kind` of the repository, one of ``arx``, ``baz``, ``bzr``, |
|---|
| 473 | ``bzrng``, ``cdv``, ``cg``, ``cvs``, ``darcs``, ``hg``, ``monotone``, |
|---|
| 474 | ``svn`` and ``tla``. |
|---|
| 475 | |
|---|
| 476 | When a repository is used as a `source`, it must indicate its origin |
|---|
| 477 | with ``repository``, and for some backends also a ``module``, but are |
|---|
| 478 | not required when it's a target system, even if some backend may use |
|---|
| 479 | the information to create the target repository (like ``svn`` backend |
|---|
| 480 | does). |
|---|
| 481 | |
|---|
| 482 | Each repository may then impose a particular external binary to be |
|---|
| 483 | used, as done in the example above for ``hg``. Actually only one of |
|---|
| 484 | them, `bzrng`, accepts an option ``python-path``, to indicate where |
|---|
| 485 | the BazaarNG Python library is located. |
|---|
| 486 | |
|---|
| 487 | A repository may also have it's own ``subdir``: when the `source` and |
|---|
| 488 | `target` repositories use different subdirectories, tailor uses |
|---|
| 489 | ``rsync`` to copy the changes between the two after each applied |
|---|
| 490 | changeset. |
|---|
| 491 | |
|---|
| 492 | CVS and CVSPS repositories may turn of automatic tagging of entries, |
|---|
| 493 | that tailor does by default to prevent manual interventions in the |
|---|
| 494 | CVS working copy, using ``tag_entries = False``. |
|---|
| 495 | |
|---|
| 496 | |
|---|
| 497 | Using a Python script as configuration file |
|---|
| 498 | ------------------------------------------- |
|---|
| 499 | |
|---|
| 500 | Instead of executing ``tailor --configfile project.tailor.conf`` |
|---|
| 501 | you can prepend the following signature to the config itself:: |
|---|
| 502 | |
|---|
| 503 | #!/usr/bin/env /path/to/tailor |
|---|
| 504 | |
|---|
| 505 | Giving execute mode to it will permit the launch of the tailor |
|---|
| 506 | process by running the config script directly:: |
|---|
| 507 | |
|---|
| 508 | $ ./project.tailor.conf |
|---|
| 509 | |
|---|
| 510 | When a config file is signed in this way [#]_, either you pass it as |
|---|
| 511 | argument to ``--configfile`` or executed as above, tailor will |
|---|
| 512 | actually execute it as a full fledged Python script, that may define |
|---|
| 513 | functions that alter the behaviour of tailor itself. |
|---|
| 514 | |
|---|
| 515 | A common usage of this functionality is to define so called `hooks`, |
|---|
| 516 | sequences of functions that are executed at particular points in |
|---|
| 517 | the tailorization process. |
|---|
| 518 | |
|---|
| 519 | Just to illustrate the functionality, consider the following example:: |
|---|
| 520 | |
|---|
| 521 | #!/usr/bin/env tailor |
|---|
| 522 | |
|---|
| 523 | """ |
|---|
| 524 | [DEFAULT] |
|---|
| 525 | debug = False |
|---|
| 526 | verbose = True |
|---|
| 527 | |
|---|
| 528 | [project] |
|---|
| 529 | target = bzrng:target |
|---|
| 530 | root-directory = /tmp/prova |
|---|
| 531 | state-file = tailor.state |
|---|
| 532 | source = darcs:source |
|---|
| 533 | before-commit = before |
|---|
| 534 | after-commit = after |
|---|
| 535 | start-revision = Almost arbitrarily tagging this as version 0.8 |
|---|
| 536 | |
|---|
| 537 | [bzrng:target] |
|---|
| 538 | python-path = /opt/src/bzr.dev |
|---|
| 539 | subdir = bzrside |
|---|
| 540 | |
|---|
| 541 | [darcs:source] |
|---|
| 542 | repository = /home/lele/WiP/cvsync |
|---|
| 543 | subdir = darcside |
|---|
| 544 | """ |
|---|
| 545 | |
|---|
| 546 | def before(wd, changeset): |
|---|
| 547 | print "BEFORE", changeset |
|---|
| 548 | changeset.author = "LELE" |
|---|
| 549 | return changeset |
|---|
| 550 | |
|---|
| 551 | def after(wd, changeset): |
|---|
| 552 | print "AFTER", changeset |
|---|
| 553 | |
|---|
| 554 | With the above in a `script` called say ``tester``, just doing:: |
|---|
| 555 | |
|---|
| 556 | $ chmod 755 tester |
|---|
| 557 | $ ./tester |
|---|
| 558 | |
|---|
| 559 | will migrate the history from a darcs repository to a bazaar-ng one, |
|---|
| 560 | forcing the author to a well-known name :-) |
|---|
| 561 | |
|---|
| 562 | .. [#] Tailor does actually read just the first two bytes from the |
|---|
| 563 | file, and compare them with "#!", so you are free to choose |
|---|
| 564 | whatever syntax works in your environment. |
|---|
| 565 | |
|---|
| 566 | |
|---|
| 567 | State file |
|---|
| 568 | ---------- |
|---|
| 569 | |
|---|
| 570 | The state file stores two things: the last upstream revision that |
|---|
| 571 | has been applied to the tree, and a sequence of pending (not yet |
|---|
| 572 | applied) changesets, that may be empty. In the latter case, tailor |
|---|
| 573 | will fetch latest changes from the upstream repository. |
|---|
| 574 | |
|---|
| 575 | |
|---|
| 576 | Further help |
|---|
| 577 | ============ |
|---|
| 578 | |
|---|
| 579 | See the output of ``tailor -h`` for some further tips. There's |
|---|
| 580 | also a `wiki page`_ that may give you some other hints. The |
|---|
| 581 | development of Tailor is mainly driven by user requests at this point, |
|---|
| 582 | and the preferred comunication media is the dedicated `mailing list`_ |
|---|
| 583 | [#]_. |
|---|
| 584 | |
|---|
| 585 | .. _wiki page: |
|---|
| 586 | http://www.darcs.net/DarcsWiki/Tailor |
|---|
| 587 | |
|---|
| 588 | .. _mailing list: |
|---|
| 589 | http://lists.zooko.com/mailman/listinfo/tailor |
|---|
| 590 | |
|---|
| 591 | I will be more than happy to answer any doubt, question or suggestion |
|---|
| 592 | you may have on it. I'm usually hanging as "lelit" on the IRC channel |
|---|
| 593 | devoted to darcs on the `freenode.net` network. Do not hesitate to |
|---|
| 594 | contact me either by email or chatting there. |
|---|
| 595 | |
|---|
| 596 | .. [#] I wish to say a big `Thank you` to `Zooko <zooko@zooko.com>`_, |
|---|
| 597 | for hosting the ML and for supporting Tailor in several ways, |
|---|
| 598 | from suggestions to bug reporting and fixing. |
|---|
| 599 | |
|---|
| 600 | |
|---|
| 601 | Authors |
|---|
| 602 | ======= |
|---|
| 603 | |
|---|
| 604 | Lele Gaifax <lele@nautilus.homeip.net> |
|---|
| 605 | |
|---|
| 606 | Since I'm not currently using all the supported systems (so little |
|---|
| 607 | time, so many VCSs...) I'm not in position to test them out properly, |
|---|
| 608 | but I'll do my best to keep them in sync, maybe with your support :-) |
|---|
| 609 | |
|---|
| 610 | ArX support |
|---|
| 611 | ----------- |
|---|
| 612 | |
|---|
| 613 | ArX_ support was contributed by `Walter Landry <wlandry@ucsd.edu>`_. |
|---|
| 614 | |
|---|
| 615 | Bazaar-NG support |
|---|
| 616 | ----------------- |
|---|
| 617 | |
|---|
| 618 | `Bazaar-NG`_ support was contributed by `Johan Rydberg |
|---|
| 619 | <jrydberg@gnu.org>`_. |
|---|
| 620 | |
|---|
| 621 | Git support |
|---|
| 622 | ----------- |
|---|
| 623 | |
|---|
| 624 | `Git`_ support (using Cogito) was contributed by `Todd Mokros |
|---|
| 625 | <tmokros@tmokros.net>`_. |
|---|
| 626 | |
|---|
| 627 | Monotone support |
|---|
| 628 | ---------------- |
|---|
| 629 | |
|---|
| 630 | Monotone_ support was kindly contributed by `Markus Schiltknecht |
|---|
| 631 | <markus@bluegap.ch>`_ and further developed by `rghetta |
|---|
| 632 | <birrachiara@tin.it>`_, that was able to linearize the multi-headed |
|---|
| 633 | monotone history into something tailor groks. Kudos! |
|---|
| 634 | |
|---|
| 635 | Tla support |
|---|
| 636 | ----------- |
|---|
| 637 | |
|---|
| 638 | Tla_ support was contributed by `Robin Farine |
|---|
| 639 | <robin.farine@terminus.org>`_. |
|---|
| 640 | |
|---|
| 641 | |
|---|
| 642 | License |
|---|
| 643 | ======= |
|---|
| 644 | |
|---|
| 645 | Tailor is distribuited under the `GNU General Public License`__. |
|---|
| 646 | |
|---|
| 647 | __ http://www.fsf.org/licensing/licenses/gpl.html |
|---|
| 648 | |
|---|
| 649 | |
|---|
| 650 | About this document |
|---|
| 651 | =================== |
|---|
| 652 | |
|---|
| 653 | This document and most of the internal documention use the |
|---|
| 654 | reStructuredText format so that it can be easily converted into other |
|---|
| 655 | formats, such as HTML. For more information about this, please see: |
|---|
| 656 | |
|---|
| 657 | http://docutils.sourceforge.net/rst.html |
|---|
| 658 | |
|---|
| 659 | |
|---|
| 660 | .. vim:ft=rest |
|---|
| 661 | .. Local Variables: |
|---|
| 662 | .. mode: rst |
|---|
| 663 | .. End: |
|---|