source: tailor/README.rst @ 1480

Revision 1480, 41.8 KB checked in by lele@…, 5 years ago (diff)

Factorize the sources and targets in the example
Given that all projects migrate patches from Monotone to Subversion,
take advantage of the "source = kind:" syntax.

RevLine 
[1060]1.. Hey! This is reStructuredText, where "*this*" notation means an
2.. italic "this" and similar oddities. See the notes at the end of
3.. this file for details.
4
[644]5Tailor 1.0
6##########
7
[646]8.. contents::
9
[173]10About
11=====
[172]12
[1367]13Tailor is a tool to migrate changesets between ArX_, Baz_,
14`Bazaar`_, CVS_, Codeville_, Darcs_, Git_, Mercurial_, Monotone_,
[1340]15Perforce_, Subversion_ and Tla_ [#]_ repositories.
[173]16
[172]17This script makes it easier to keep the upstream changes merged in
18a branch of a product, storing needed information such as the upstream
19URI and revision in special properties on the branched directory.
20
[180]21The following ascii-art illustrates the usual scenario::
22
23                           +------------+            +------------+
24  +--------------+         | Immutable  |            | Working    |
25  | Upstream CVS |-------->| darcs      |----------->| darcs      |
26  | repository   | tailor  | repository | darcs pull | repository |
27  +--------------+         +------------+            +------------+
28                                                           |^         
29                                                           ||
30                                                           ||
31                                                           v|
32                                                          User
33
34Ideally you should be able to swap and replace "CVS server" and "darcs
[306]35repository" with any combination of the supported systems.
36
[1459]37It's still lacks the ability of doing a `two way sync`_.
[172]38
[1012]39.. [#] ArX and Codeville systems may be used only as the `target`
[996]40       backend, since the `source` support isn't coded yet.
41       Contributions on these backends will be very appreciated,
42       since I do not use them enough to figure out the best way to
43       get pending changes and build tailor ChangeSets out of them.
[310]44
[1367]45       To the opposite, Baz (1.0, not Bazaar), Perforce and Tla
[1340]46       are supported only as source systems.
[554]47
48.. _arx: http://www.nongnu.org/arx/
[1367]49.. _baz: http://bazaar-vcs.org/Baz1x
50.. _bazaar: http://bazaar-vcs.org/
[554]51.. _codeville: http://www.codeville.org/
52.. _cvs: http://www.nongnu.org/cvs/
53.. _darcs: http://www.darcs.net/
[691]54.. _git: http://git.or.cz/
[381]55.. _mercurial: http://www.selenic.com/mercurial/
[1382]56.. _monotone: http://www.monotone.ca/
[1340]57.. _perforce: http://www.perforce.com/
[554]58.. _subversion: http://subversion.tigris.org/
59.. _tla: http://www.gnuarch.org/arch/index.html
[1079]60.. _two way sync: http://progetti.arstecnica.it/tailor/wiki/TwoWaySync
[315]61
[488]62
[173]63Installation
64============
65
[399]66tailor is written in Python, and thus Python must be installed on
[1460]67your system to use it.  It has been successfully used with Python 2.3,
682.4 and 2.5.
[229]69
[338]70Since it relies on external tools to do the real work such as `cvs`,
[636]71`darcs` [#]_ and `svn`, they need to be installed as well, although only
[261]72those you will actually use.
[172]73
[399]74Make tailor executable::
[172]75
[399]76 $ chmod +x tailor
[172]77
[399]78You can either run tailor where it is currently located, or move it
[172]79along with the vcpx directory to a location in your PATH.
[261]80
81There's even a standard setup.py that you may use to install the
[745]82script using Python's conventional distutils.
[172]83
[636]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
[172]88
[589]89Testing
90=======
91
[882]92Tailor has more than 50 unit and operational tests, that you can
93run with the following command line::
[589]94
95 $ tailor test -v
96
[882]97Since some tests take very long to complete, in particular the
98operational tests, you may prefer the execution of a single suite::
[589]99
[882]100 $ tailor test -v Darcs
[589]101
[882]102or even a single test within a suite::
103
104 $ tailor test StateFile.testJournal
105
106To obtain a list of the test, use ``--list`` option.  As usual with::
107
108 $ tailor test --help
109
110you will get some more details.
[1401]111
112More recently, a suite of functional tests was added, in the directory
113``./test-scripts``: these are simple shell scripts that basically
114build a source repository, create a configuration file and run tailor,
115checking the result. You can execute them with::
116
117 $ sh test-svn2svn-simple.sh
118
119or::
120
121 $ sh run-all-test.sh
[589]122
123
124Operation
125=========
126
127tailor needs now a configuration file that collects the various bits
[1304]128of information it needs to do its job.
[589]129
130The simplest way of starting out a new configuration is by omitting
[1305]131the ``--configfile`` command line option, and specifying the other as
132needed plus ``--verbose``: in this situation, tailor will print out an
[589]133equivalent configuration that you can redirect to a file, that you
[1305]134later will pass as ``--configfile`` (or simply ``-c``).
[589]135
136
[173]137Examples
[589]138--------
[172]139
[589]1401. Bootstrap a new tailored project, starting at upstream revision 10
[173]141
[589]142   a. First create a config file::
143   
144       $ tailor --verbose -s svn -R http://svn.server/path/to/svnrepo \
145                --module /Product/trunk -r 10 --subdir Product \
146                ~/darcs/MyProduct > myproject.tailor
[172]147
[589]148   b. Modify it as you like (mostly adjusting root-directories and the
149      like)::
150     
151       $ emacs myproject.tailor
[173]152
[589]153   c. Run tailor on it::
154   
155       $ tailor --configfile myproject.tailor
[422]156
[589]1572. Bootstrap a new product, fetching its whole CVS repository and
158   storing under SVN
[428]159
[589]160   a. First create a config file::
[422]161
[589]162       $ tailor --verbose --source-kind cvs --target-kind svn \
[286]163                --repository :pserver:cvs.zope.org:/cvs-repository \
[589]164                --module CMF/CMFCore --revision INITIAL \
165                --target-repository file:///some/where/svnrepo \
166                --target-module / cmfcore > cmfcore.tailor
[421]167
[589]168   b. Modify it as you like (mostly adjusting root-directories and the
169      like)::
[874]170
[646]171       $ emacs cmfcore.tailor
[212]172
[874]173   .. note:: By default, tailor uses "." as ``subdir``, to mean that
174             it will extract upstream source directly inside the
175             ``root-directory``.
176
177             This is known to cause problems with CVS as source, with
178             which you could see some wierd error like
179
180             ::
181
182               $ cvs -q -d ...:/cvsroot/mymodule checkout -d . ... mymodule
183               cvs checkout: existing repository /cvsroot/mymodule does not match /cvsroot/mymodule/mymodule
184               cvs checkout: ignoring module mymodule
185
186             When this is the case, the culprit may be a CVS
187             shortcoming not being able to handle ``-d .`` in the
188             right way.  Specify a different ``subdir`` option to
189             avoid the problem.
190
[589]191   c. Run tailor on it once, to bootstrap the project::
192   
[1305]193       $ tailor -D -v -c cmfcore.tailor
[429]194
[589]195      If the target repository is on the local filesystem (ie, it
196      starts with ``file:///``) and it does not exist, tailor
197      creates a new empty Subversion repository at the specified
198      location.
199     
200   .. note:: Before step d) below, you may want to install an
[429]201             appropriate hook in the repository to enable the
202             propset command to operate on unversioned properties,
203             as described in the `svn manual`__. Then you can
[1272]204             specify '--use-propset' option, and tailor will
[429]205             put the original author and timestamp in the proper
206             svn metadata instead of appending them to the changelog.
207
[458]208             Other than the annoying repository manual intervention,
209             this thread__ and this other__ explain why using
210             ``-r{DATE}`` may produce strange results with this setup.
211
[589]212   d. Run tailor again and again, to sync up with latest changes::
213
[1365]214       $ tailor -v --configfile cmfcore.tailor
[589]215   
[554]216__ http://svnbook.red-bean.com/en/1.0/ch05s02.html#svn-ch-5-sect-2.1
[458]217__ http://svn.haxx.se/users/archive-2005-07/0605.shtml
218__ http://svn.haxx.se/users/archive-2005-03/0596.shtml
[429]219
[455]220
[589]2213. Given the configuration file shown below in `Config file format`_,
[488]222   the following command::
223
[589]224    $ tailor --configfile example.tailor
[488]225
226   is equivalent to this one::
227
[589]228    $ tailor --configfile example.tailor tailor
[488]229
[589]230   in that they operate respectively on the default project(s) or
[488]231   the ones specified on the command line (and in this case there
232   is just a single default project, tailor).
233
234   This one instead::
235
[1305]236    $ tailor -c example.tailor tailor tailor-reverse
[488]237
[589]238   operates on both projects.
239
240
241CVS start-revision
242------------------
243
244With CVS, you can specify a particular *point in time* specifying
245a `start-revision` with a timestamp like ``2001-12-25 23:26:48 UTC``.
246
247To specify also a particular `branch`, prepend it before the
248timestamp, as in ``unstable-branch 2001-12-25 23:26:48 UTC``.
[718]249
250To migrate the whole history of a specific `branch`, use something
251like ``somebranch INITIAL``.
[488]252
253
[198]254Resolving conflicts
[196]255===================
256
[399]257Should one of the replayed changes generate any conflict, tailor
[198]258will prompt the user to correct them. This is done after the upstream
259patch has been applied and before the final commit on the target
260system, so that manually tweaking the conflict can produce a clean
261patch.
[212]262
263
264Shortcomings
265============
266
267Tailor currently suffers of the following reported problems:
268
269a) It does not handle "empty" CVS checkouts, in other words you cannot
270   bootstrap a project that has nothing in its CVS upstream
271   repository, or from a point in time where this condition was true.
272
[423]273b) It's completely unsupported under Windows, evenif it now uses
274   2.4's subprocess_ that seems able to hide Windows crazyness...
[276]275
[1012]276c) ArX and Codeville are (currently) only supported as *target*;
[1367]277   Baz and Tla only as *source*.
[212]278
[307]279d) Specifying ``--subdir .`` may not work, in particular when dealing
280   with remote CVS repositories (it does when the CVS repository is
281   on local machine).
282   
[212]283This list will always be incomplete, but I'll do my best to keep it
284short :-)
[214]285
286.. _subprocess: http://www.lysator.liu.se/~astrand/popen5/
[196]287
[172]288
[173]289Config file format
[488]290==================
[173]291
292When your project is composed by multiple upstream modules, it is
293easier to collect such information in a single file. This is done by
294specifying the `--configfile` option with a file name as argument. In
[589]295this case, tailor will read the above information from a standard
296Python ConfigParser file.
[173]297
[488]298For example::
[173]299
[488]300    [DEFAULT]
[589]301    verbose = True
[488]302    projects = tailor
[173]303
[488]304    [tailor]
[646]305    root-directory = /tmp/n9
[488]306    source = darcs:tailor
307    target = svn:tailor
308    state-file = tailor.state
309
310    [tailor-reverse]
[646]311    root-directory = /tmp/n9
[488]312    source = svn:tailor
313    target = darcs:tailor
314    state-file = reverse.state
315   
316    [svn:tailor]
317    repository = file:///tmp/testtai
318    module = /project1
[646]319    subdir = svnside
320   
[488]321    [darcs:tailor]
[589]322    repository = ~/WiP/cvsync
[646]323    subdir = darcside
324
[651]325The configuration may hold one or more `projects`_ and two or more
326`repositories`_: project names do not contains colons ":",
[646]327repository names must and the first part of the name before the
328colon specify the kind of the repository.  So, the above example
329contains two projects, one that goes from `darcs` to `subversion`, the
330other in the opposite direction.
331
332The ``[DEFAULT]`` section contains the default values, that will be
333used when a specific setting is missing from the particular section.
334
335You can specify on which project tailor should operate by
336giving its name on the command line, even more than one. When not
337explicitly given, tailor will look at ``projects`` in the
338``[DEFAULT]`` section, and if its missing it will loop over all
339projects in the configuration.
340
341The following simpler config just go in one direction, for a single
342project, so no need neither for ``[DEFAULT].projects`` nor command
[1283]343line arguments. Also, notice the usage of the repository short cut:
344the ``source`` and ``target`` will be implicitly loaded from
345`cvs:pxlib` and `hg:pxlib` respectively::
[646]346
347    [pxlib]
[1283]348    source = cvs:
349    target = hg:
[646]350    root-directory = ~/mypxlib
351    start-revision = INITIAL
352    subdir = pxlib
353   
354    [cvs:pxlib]
355    repository = :pserver:anonymous@cvs.sf.net:/cvsroot/pxlib
356    module = pxlib
357
358    [hg:pxlib]
359    hg-command = /usr/local/bin/hg
360
361This will use a single directory, ``pxlib`` to contain both the source
[1283]362and the target system. If you prefer keeping them separated, you just
[703]363need to specify a different directory for each repository [#]_, as in::
[646]364
365    [pxlib]
366    source = cvs:pxlib
367    target = hg:pxlib
368    root-directory = ~/mypxlib
369    start-revision = INITIAL
370   
371    [cvs:pxlib]
372    repository = :pserver:anonymous@cvs.sf.net:/cvsroot/pxlib
373    module = pxlib
374    subdir = original
[849]375    delay-before-apply = 10
[646]376
377    [hg:pxlib]
378    hg-command = /usr/local/bin/hg
379    subdir = migrated
[172]380
[646]381This will extract upstream CVS sources into ``~/mypxlib/original``,
382and create a new Mercurial repository in ``~/mypxlib/migrated``.
[172]383
[1400]384The following example shows the syntax of Baz sources::
[703]385
386    [project]
387    target = hg:target
388    start-revision = base-0
389    root-directory = /tmp/calife
[1348]390    state-file = hidden
[703]391    source = baz:source
392
393    [baz:source]
394    module = calife--pam--3.0
395    repository = roberto@keltia.net--2003-depot
396    subdir = tla
397
398    [hg:target]
399    repository = /tmp/HG/calife-pam
400    subdir = hg
401
[1348]402Note the usage of ``hidden`` for the state file name: given the
403importance of this file, that at the same time is of no interest by
404the user, this will store that information `inside` the same directory
405used by the target repository for its metadata, with the name
406``tailor.state``.  In this particular example, it will end up as
407``/tmp/calife/hg/.hg/tailor.state``.
408
[1400]409Last, a complete example used to migrate the whole Monotone_ source
410repository under Subversion_::
411
412    [DEFAULT]
413    #debug = True
414    #verbose = True
415    start-revision = INITIAL
416    root-directory = /tmp/rootdir-Monotone
[1480]417    source = monotone:
418    target = svn:
[1400]419    source-repository = /home/user/Monotone/monotone-database.mtn
420    target-repository = file:///tmp/svn-repository
421    use-propset = True
422
423    # Projects
424    [net.venge.monotone.cvssync]
425
426    [net.venge.monotone.cvssync.attrs]
427
428    [net.venge.monotone.de]
429
430    [net.venge.monotone.svn_import]
431
432    [net.venge.monotone]
433
434
435    # Sources
436    [monotone:net.venge.monotone.cvssync]
437    module = net.venge.monotone.cvssync
438    subdir = mtnside-net.venge.monotone.cvssync
439
440    [monotone:net.venge.monotone.cvssync.attrs]
441    module = net.venge.monotone.cvssync.attrs
442    subdir = mtnside-net.venge.monotone.cvssync.attrs
443
444    [monotone:net.venge.monotone.de]
445    module = net.venge.monotone.de
446    subdir = mtnside-net.venge.monotone.de
447
448    [monotone:net.venge.monotone.svn_import]
449    module = net.venge.monotone.svn_import
450    subdir = mtnside-net.venge.monotone.svn_import
451
452    [monotone:net.venge.monotone]
453    module = net.venge.monotone
454    subdir = mtnside-net.venge.monotone
455
456
457    # Targets
458    [svn:net.venge.monotone.cvssync]
459    module = branches/net.venge.monotone.cvssync
460    subdir = svnside-net.venge.monotone.cvssync
461
462    [svn:net.venge.monotone.cvssync.attrs]
463    module = branches/net.venge.monotone.cvssync.attrs
464    subdir = svnside-net.venge.monotone.cvssync.attrs
465
466    [svn:net.venge.monotone.de]
467    module = branches/net.venge.monotone.de
468    subdir = svnside-net.venge.monotone.de
469
470    [svn:net.venge.monotone.svn_import]
471    module = branches/net.venge.monotone.svn_import
472    subdir = svnside-net.venge.monotone.svn_import
473
474    [svn:net.venge.monotone]
475    module = trunk
476    subdir = svnside-net.venge.monotone
477
[703]478.. [#] NB: when the source and the target repositories specify
479       different directories with the ``subdir`` option, tailor
480       uses ``rsync`` to keep them in sync, so that tool needs
481       to be installed.
482
[651]483
484Configuration sections
485----------------------
486
[656]487Default
488~~~~~~~
489
490The ``[DEFAULT]`` section in the configuration file may set the
491default value for any of the recognized options: when a value is
492missing from a specific section it is looked up in this section.
493
494One particular option, ``projects``, is meaningful only in the
495``[DEFAULT]`` section: it's a comma separated list of project names,
496the one that will be operated on by tailor when no project is
497specified on the command line.  When the there are no ``projects``
498setting nor any on the command line, tailor activates all configured
499projects, in order of appearance in the config file.
500
501
[651]502Projects
503~~~~~~~~
504
505A project is identified by a section whose name does not contain any
506colon (":") character, and configured with the following values:
507
[1014]508.. note:: If a particular option is missing from the project section,
509          its value is obtained looking up the same option in the
510          ``[DEFAULT]`` section.
511
[898]512root-directory : string
[651]513  This is where all the fun will happen: this directory will contain
514  the source and the target working copy, and usually the state and
[831]515  the log file. It supports the conventional `~user` to indicate user's
516  home directory and defaults to the current working directory.
[651]517
[898]518subdir : string
[651]519  This is the subdirectory, relative to the `root-directory`, where
520  tailor will extract the source working copy. It may be '.' for some
[832]521  backend kinds. The source and target backends will use this value
522  if they don't explicitly override it.
[651]523
[898]524state-file : string
[1348]525  Name of the state file needed to store tailor last activity. When
526  this is set to ``hidden``, the state file will be named
527  ``tailor.state``, possibly under the target's ``METADIR``.
[651]528
[898]529source : string
[651]530  The source repository: a repository name is something like
531  "darcs:somename", that will be loaded from the homonymous section
[1283]532  in the configuration. As a short cut, the "somename" part may be
533  omitted: in that case, the project name will be appended to the
534  specified prefix.
[651]535
[898]536target : string
[651]537  The counterpart of `source`, the repository that will receive the
538  changes coming from there.
539
540Non mandatory options:
541
[898]542verbose : bool
[651]543  Print the commands as they are executed.
544
[898]545debug : bool
[651]546  Print also their output.
547 
[898]548before-commit : tuple
[651]549  This is a function name, or a sequence of function names enclosed
550  by brackets, that will be executed on each changeset just before
551  it get replayed on the target system: this may be used to perform
552  any kind of alteration on the content of the changeset, or to skip
553  some of them.
554
[898]555after-commit : tuple
[651]556  This is a function name, or a sequence of function names enclosed
557  by brackets, that will be executed on each changeset just after
558  the commit on the target system: this may be used for example to
559  create a tag.
560
[898]561subdir : string
[651]562  The name of the subdirectory, under ``root-directory``, that will
563  contain the source and target repositories/working directories.
564
[898]565start-revision : string
[655]566  This identifies from when tailor should start the migration. It can
567  be either ``INITIAL``, to indicate the start of the history, or
568  ``HEAD`` to indicate the current latest changeset, or a backend
569  specific way of indicate a particular revision/tag in the history.
570  See also `CVS start-revision`_ above.
[662]571
[898]572patch-name-format : string
[662]573  Some backends have a distinct notion of `patch name` and `change
574  log`, others just suggest a policy that the first line of the
575  message is a summary, the rest if present is a more detailed
576  description of the change.  With this option you can control the
577  format of the name, or of the first line of the changelog.
578
579  The prototype may contain ``%(keyword)s`` such as 'author', 'date',
[837]580  'revision', 'firstlogline', 'remaininglog' or 'project'.  It
581  defaults to ``[%(project)s @ %(revision)s]``; setting it to the
582  empty string means that tailor will simply use the original
583  changelog.
[723]584
585  When you set it empty, as in
586
587  ::
588
589    [project]
[1399]590    patch-name-format = ""
[723]591
592  tailor will keep the original changelog as is.
[662]593
[898]594remove-first-log-line : bool
[662]595  Remove the first line of the upstream changelog. This is intended to
[1304]596  go in pair with ``patch-name-format``, when using its 'firstlogline'
597  variable to build the name of the patch.  The default is ``False``.
[837]598 
599  A reasonable usage is::
600
601    [DEFAULT]
602    patch-name-format=[%(project)s @ %(revision)s]: %(firstlogline)s
603    remove-first-log-line=True
[651]604
[898]605refill-changelogs : bool
[722]606  Off by default, when active tailor reformats every changelog before
607  committing on the target system.
[655]608
[898]609
[651]610Repositories
611~~~~~~~~~~~~
612
613All the section whose name contains at least one colon character
614denote a repository.  A single repository may be shared by zero, one or
615more projects.  The first part of the name up to the first colon
[703]616indicates the `kind` of the repository, one of ``arx``, ``baz``, ``bzr``,
[1340]617``cdv``, ``cvs``, ``darcs``, ``git``, ``hg``, ``monotone``, ``p4``,
[1105]618``svn`` and ``tla``.
[651]619
[1014]620.. note:: If a particular option is missing from the repository section,
621          its value is obtained looking up the same option in the
622          section of the project *currently* using the repository,
623          falling back to the ``[DEFAULT]`` section.
[1232]624
625Some options may be shared with others repositories, like in the
626following example, where the common settings for the target monotone
627repository are set just once::
628
629  [DEFAULT]
630  target-repository = /bigdisk/my-huge-repository.mtn
631  target-keyid = test@example.com
632  target-passphrase = lala
633  source-repository = http://svn.someserver.com
634 
635  [productA]
636  target = monotone:productA
637  source = svn:sourceA
638
639  [productB]
640  target = monotone:productB
641  source = darcs:sourceB
642
643  [productC]
644  target = monotone:productC
645  source = svn:sourceC
[1283]646
647  [productC_darcs]
648  target = darcs:
649  source = svn:sourceC
[1232]650 
651  ...
652
653  [monotone:productA]
654  module = every.thing.productA
655
656  [monotone:productB]
657  module = every.thing.productB
658
659  [monotone:productC]
660  module = every.thing.productC
661 
662  [svn:sourceA]
663  module = /productA
664
665  [darcs:sourceB]
666  repository = http://some.server.com/darcs/productB
667
668  [svn:sourceC]
669  module = /productC
670
[1283]671For some backends, for example for those that like ``darcs`` do not
672make a distinction between `repository` and `working copy` and thus
673the former may be assumed by ``root-directory`` (and possibly
674``subdir``), the config section may be completely omitted, as done for
675`productC_darcs` above.
676
[1232]677
678Common options
679%%%%%%%%%%%%%%
[1014]680
[898]681repository : string
682  When a repository is used as a `source`, it must indicate its origin
683  with ``repository``, and for some backends also a ``module``, but
684  are not required when it's a target system, even if some backend may
685  use the information to create the target repository (like ``svn``
686  backend does).
687
688subdir : string
689  When the `source` and `target` repositories use different
690  subdirectories, tailor uses ``rsync`` to copy the changes between
691  the two after each applied changeset.  When the source repository
692  basedir is a subdirectory of target basedir tailor prefixes all
693  paths coming from upstream to match the relative position.
694
695  This defaults to the project's setting.
696
697command : string
698  Backends based on external command line tool such as *svn* or
699  *darcs* offers this option to impose a particular external binary to
700  be used, as done in the example above for ``hg``.
701
702python-path : string
[1104]703  For pythonique backends such as *bzr* and *hg* this indicates
[898]704  where the respective library is located.
705
706encoding : string
707  States the charset encoding the particular repository uses, and it's
708  particularly important when it differs from local system setup, that
709  you may inspect executing::
710
711    python -m locale
[1015]712
713encoding-errors-policy : string
714  By default is *strict*, that means that Python will raise an
715  exception on Unicode conversion errors. Valid options are *ignore*
716  that simply skips offending glyphs and *replace* where unrecognized
717  entities are replaced with a place holder.
[898]718
719delay-before-apply : integer
720  Sometime the migration is fast enough to put the upstream server
721  under an excessive load. When this is the case, you may specify
722  ``delay-before-apply = 5``, that is the number of seconds tailor
723  will wait before applying each changeset.
724
725  It defaults to *None*, ie no delay at all.
726
727arx
728%%%
729
[1075]730.. no specific options
[898]731
732baz
733%%%
734
[1075]735.. no specific options
[898]736
737bzr
738%%%
739
[1075]740.. no specific options
[898]741
742cdv
743%%%
744
[1075]745.. no specific options
[898]746
747cvs
748%%%
749
[1159]750changeset-threshold : integer
751  Maximum number of seconds allowed to separated commits to different
752  files for them to be considered part of the same changeset.
753
754  180 by default.
755
[1149]756freeze-keywords : bool
757  With this enabled (it is off by default) tailor will use ``-kk`` flag
758  on `checkouts` and `updates` to turn off the keyword expansion. This
759  may help minimizing the chance of spurious conflicts with later
760  merges between different branches.
761
762  *False* by default.
763
[898]764tag-entries : bool
765  CVS and CVSPS repositories may turn off automatic tagging of
766  entries, that tailor does by default to prevent manual interventions
767  in the CVS working copy, using ``tag_entries = False``.
[651]768
[898]769  *True* by default.
[1428]770
771trim-module-components : integer
772  When the checked out tree involves `CVS modules`__ on the server
773  Tailor fails to build up the ChangeSets view from the ``cvs rlog``
774  output, since in that case the paths that Tailor finds in the log
775  refers to the real location of the entries *on the server*, and
776  not, as usual, relatives to the root of the checked out tree. Of
777  course, Tailor must be exact in correlating the information coming
778  from the log and the actual checked out content in the filesystem,
779  so in this case, by default it fails with an obscure message at
780  bootstrap time.
781
782  Given that most of the time it's simply a matter of a common prefix,
783  this option offers the so called "far-from-perfect-poor-man-workaround"
784  to the CVS/Tailor shortcoming, until a better solution arises.
785
786  When you set this to an integer greater than zero, the parser will
787  cut off that many components from the beginning of the pathnames it
788  finds in the log.
789
790  *0 (zero)* by default.
791
792__ http://ximbiot.com/cvs/wiki/index.php?title=CVS--Concurrent_Versions_System_v1.12.12.1:_Reference_manual_for_Administrative_files#The_modules_file
[898]793
794cvsps
795%%%%%
796
[1149]797freeze-keywords : bool
798  With this enabled (it is off by default) tailor will use ``-kk`` flag
799  on `checkouts` and `updates` to turn off the keyword expansion. This
800  may help minimizing the chance of spurious conflicts with later
801  merges between different branches.
802
803  *False* by default.
804
[898]805tag-entries : bool
806  CVS and CVSPS repositories may turn off automatic tagging of
807  entries, that tailor does by default to prevent manual interventions
808  in the CVS working copy, using ``tag_entries = False``.
809
810  *True* by default.
811 
812darcs
813%%%%%
814
[1056]815look-for-adds : bool
816  By default tailor commits only the entries explicitly mentioned by
817  the upstream changeset. Sometimes this is not desiderable, maybe
818  even as a quick workaround to a tailor bug. This option allows a
819  more relaxed view of life using ``record --look-for-adds``.
[1384]820
821replace-badchars : string
822  Apparently some darcs repo contains some characters that are illegal
823  in an XML stream. This is the case when one uses non-utf8
824  accents. To be safe, you can replace them with their xml-safe
825  equivalent. The given string must be a regular and valid Python
826  dictionary, with each substitution keyed on the character to be
827  replaced. By default it's::
[898]828
[1384]829    {
830      '\xc1': 'Á',
831      '\xc9': 'É',
832      '\xcd': 'Í',
833      '\xd3': 'Ó',
834      '\xd6': 'Ö',
835      '\xd5': 'Ő',
836      '\xda': 'Ú',
837      '\xdc': 'Ü',
838      '\xdb': 'Ű',
839      '\xe1': 'á',
840      '\xe9': 'é',
841      '\xed': 'í',
842      '\xf3': 'ó',
843      '\xf6': 'ö',
844      '\xf5': 'ő',
845      '\xfa': 'ú',
846      '\xfc': 'ü',
847      '\xfb': 'ű',
848      '\xf1': 'ñ',
849      '\xdf': 'ß',
850      '\xe5': 'å'
851    }
852   
[1130]853start-revision : string
854  Under darcs this may be either the name of a tag or the hash of an
855  arbitrary patch in the repository, plus the ordinary ``INITIAL`` or
856  ``HEAD`` symbols.
857
[1304]858  .. note:: If you want to start from a particular patch, giving its
[1130]859            hash value as ``start-revision``, you **must** use a
860            ``subdir`` different from ``.``. [#]_
861
[1195]862git target
863%%%%%%%%%%
[898]864
[1184]865parent-repo : string
[1195]866  Relative path to a git directory to use as a parent.  This is one
867  way to import branches into a git repository, which creates a new
868  git repository borrowing ancestry from the parent-repo.  It is quite
869  a simple way, and thus believed to be quite robust, but spreads
870  branches across several git repositories. If this parameter is
871  not set, and ``repository`` is not set either, the branch has no
872  parent.
873
874  The alternative is to specify a ``repository`` parameter, to contain
875  all git branches.  The .git directory in the working copy for each
876  branch will then only contain the ``.git/index`` file.
[1184]877
[1195]878branch : string
879  The name of the branch to which to commit.  It is only used in
880  single-repository mode (using ``repository``, see above).  The
881  default is to use the "master" branch.
882
[1184]883branchpoint : string
884  A reference to the git commit which is the parent for the first
885  revision on the branch to be imported.  It can be a tag name or any
886  syntax acceptable by git (eg. something like "tag~2", if you want to
887  correct the idea of where the branchpoint is).
888
889  Since tailor generates mostly-stable SHA-1 revisions, you can
890  usually also use a SHA-1 as branchpoint.  Just import your trunk
891  first, find the correct SHA-1, and setup and import your branch.
892  This is especially useful since the current cvs source
893  implementation misses many tags.
[898]894
895hg
896%%
897
[1075]898.. no specific options
[898]899
900monotone
901%%%%%%%%
902
903keyid : string
[963]904  Monotone key id to use for commits. The specified key
905  must exist on keystore. Takes precedence
[1291]906  over keygenid.
[963]907
908keygenid : string
909  Id of a new keypair to generate and store in the
910  repository.
911  The keypair is used for commits. Ignored if keyid is
912  specified.
913
914passphrase : string
[1291]915  Passphrase to use for commits. Must be specified unless you have one
916  on your .monotonerc file
[1019]917
[1396]918custom-lua : string
[1291]919  Optional custom lua script. If present, is written into _MTN/monotonerc.
[898]920
[1340]921p4
922%%
923
[1342]924depot-path : string
[1341]925  The path within the depot indicating the root of all files that will be
926  replicated.
927 
928  This is used both for determining changes as well as mapping
929  file locations from changesets to the filesystem.
930
931  Example:  ``//depot/project/main/``
[1340]932
933p4-client : string
[1341]934  The perforce client spec to use.
935
936  Example:  ``myhostname-tailor``
[1340]937
938p4-port : string
[1341]939  The address of the perforce server.
940
941  Example: ``perforce.mycompany.com:1666``
[1340]942
[898]943svn
944%%%
945
946filter-badchars : bool (or string)
947  Activate (with *True*) or activate and specify (with a *string*) the
948  filter on the svn log to eliminate illegal XML characters.
949
[1052]950  *False* by default, when set to *True* the following characters are
951  washed out from the upstream changes::
952
953    allbadchars = "\x00\x01\x02\x03\x04\x05\x06\x07\x08\x09" \
954                  "\x0B\x0C\x0E\x0F\x10\x11\x12\x13\x14\x15" \
955                  "\x16\x17\x18\x19\x1A\x1B\x1C\x1D\x1E\x1F\x7f"
956
957  If this is not right or enough, you can specify a string value
958  instead of the boolean flag, containing the characters to omit, as
959  in::
960
961    filter-badchars=\x00\x01
[898]962 
963use-propset : bool
964  Indicate that tailor is allowed to properly inject the upstream
965  changeset's author and timestamp into the target repository.  As
966  stated above, this requires a manual intervention on the repository
967  itself and thus is off by default, and tailor simply appends those
968  values to the changelog.  When active at bootstrap time and the
969  repository is local, tailor creates automatically a minimal
970  ``hooks/pre-revprop-change`` script inside the repository, so no
971  other intervention is needed.
[651]972
[898]973  *False* by default.
[1273]974
975propset-date : bool
976  By default *True*, can be used to avoid setting the ``svn:date``
977  property on the Subversion revision, and thus problem with
978  ``-r{DATE}`` mentioned above.  When this is *False*, the original
979  timestamp gets appended to the revision log.
[936]980
981use-limit : bool
982  By default *True*, should be set to *False* when using old
983  Subversion clients, since ``log --limit`` was introduced with
984  version 1.2. By using this option tailor can fetch just the
985  revision it needs, instead of transfering whole history log.
[1388]986
987commit-all-files : bool
988  By default *True*, commits all files from current changeset. Lets
989  Subversion check the changes self.
990  Set it to *False*, then whish to commits only changed files, that
991  tailor detects, perhaps a network speedup.  But a  *False* can be
992  insert an extra revision on long dep paths with lot of files. You
993  would see two revisions on target, where the source have only one.
994  For a true convert should leave it *True*.
[978]995
996trust-root : bool
997  Tailor by default verifies that the specified ``repository``
998  effectively points to the root of a Subversion repository,
999  eventually splitting it and adjusting ``module`` accordingly.  This
1000  is sometimes undesiderable, for example when the root isn't public
1001  and cannot be listed.  Setting this option to *True* disable the
1002  check and tailor takes the given ``repository`` and ``module`` as-is.
1003
[1042]1004ignore-externals : bool
1005  By default the Subversion backend does not consider the external
1006  references defined in the source repository.  This option force
1007  Tailor to behave as it did up to 0.9.20.
[1389]1008
1009svn-tags : string
[1395]1010  Name of the directory used for tags: tailor will copy tagged
1011  revisions under this directory.
[1389]1012
[1395]1013  ``/tags`` by default.
[1391]1014
1015svn-branches : string
[1395]1016  Name of the directory used for branches: tailor will copy branches
1017  under that directory.
[1391]1018
[1395]1019  ``/branches`` by default.
[1391]1020
1021  .. note:: Target module for branches **must** start with ``branches/``.
1022            Every branch must configure in a single-repository mode.
1023
[1395]1024            Example: ``module = branches/branch.name``
[780]1025
[898]1026tla
1027%%%
[651]1028
[1075]1029.. no specific options
[806]1030
[1130]1031
1032.. [#] This is because when you use ``subdir = .`` tailor uses
1033       ``darcs pull`` instead of ``darcs get``, and the former does
1034       not accept the option ``--to-match``.
1035
[847]1036
[506]1037Using a Python script as configuration file
1038-------------------------------------------
1039
1040Instead of executing ``tailor --configfile project.tailor.conf``
1041you can prepend the following signature to the config itself::
1042
1043  #!/usr/bin/env /path/to/tailor
1044
1045Giving execute mode to it will permit the launch of the tailor
1046process by running the config script directly::
1047
1048  $ ./project.tailor.conf
1049
1050When a config file is signed in this way [#]_, either you pass it as
1051argument to ``--configfile`` or executed as above, tailor will
1052actually execute it as a full fledged Python script, that may define
1053functions that alter the behaviour of tailor itself.
1054
[1079]1055Pre-commit and post-commit hooks
1056~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
1057
[506]1058A common usage of this functionality is to define so called `hooks`,
1059sequences of functions that are executed at particular points in
1060the tailorization process.
1061
[1079]1062Example 1
1063%%%%%%%%%
1064
[639]1065Just to illustrate the functionality, consider the following example::
[506]1066
[639]1067    #!/usr/bin/env tailor
1068
[506]1069    """
[639]1070    [DEFAULT]
1071    debug = False
1072    verbose = True
1073
[506]1074    [project]
[879]1075    target = bzr:target
[639]1076    root-directory = /tmp/prova
1077    state-file = tailor.state
1078    source = darcs:source
1079    before-commit = before
1080    after-commit = after
1081    start-revision = Almost arbitrarily tagging this as version 0.8
1082
[879]1083    [bzr:target]
[639]1084    python-path = /opt/src/bzr.dev
1085    subdir = bzrside
1086
1087    [darcs:source]
1088    repository = /home/lele/WiP/cvsync
1089    subdir = darcside
[506]1090    """
1091
[639]1092    def before(wd, changeset):
1093        print "BEFORE", changeset
1094        changeset.author = "LELE"
1095        return changeset
1096
1097    def after(wd, changeset):
1098        print "AFTER", changeset
[506]1099
[639]1100With the above in a `script` called say ``tester``, just doing::
1101
1102    $ chmod 755 tester
1103    $ ./tester
1104
[1367]1105will migrate the history from a darcs repository to a Bazaar one,
[639]1106forcing the author to a well-known name :-)
1107
[1079]1108Example 2
1109%%%%%%%%%
1110
1111A pre commit hook may even alter the content of the files. The
1112following function replaces the DOS end-of-line convention with the
1113UNIX one::
1114
1115    def newlinefix(wd, changeset):
1116        from pyutil import lineutil
1117        lineutil.lineify_all_files(wd.basedir, strip=True,
1118                                   dirpruner=lineutil.darcs_metadir_dirpruner,
1119                                   filepruner=lineutil.source_code_filepruner)
1120        return True
1121
1122It uses zooko's pyutil[#]_ toolset.  Another approach would be looping
1123over changeset.entries and operating only on added or changed entries.
1124
1125Example 3
1126%%%%%%%%%
1127
1128This loops over the file touched by a particular changeset and tries
1129to reindent it if it's a Python file::
1130
1131    def reindent_em(wd, changeset):
1132        import reindent
1133        import os
1134       
1135        for entry in changeset.entries:
1136            fname = os.path.join(wd.basedir, entry.name)
1137
1138            try:
1139                if fname[-3:] == '.py':
1140                    reindent.check(fname)
1141            except Exception, le:
1142                print "got an exception from attempt to reindent" \
1143                      " (maybe that file wasn't Python code?):" \
1144                      " changeset entry: %s, exception:" \
1145                      " %s %s %s" % (entry, type(le), repr(le),
1146                                     hasattr(le, 'args') and le.args,)
1147                raise le
1148        return True
1149
1150You have to find reindent.py in your Python distribution and put it
1151in your python path. **Beware** that this has some drawbacks: be sure
1152to read `ticket 8`_ annotations if you use it.
1153
[506]1154.. [#] Tailor does actually read just the first two bytes from the
1155       file, and compare them with "#!", so you are free to choose
1156       whatever syntax works in your environment.
1157
[1079]1158.. [#] Available either at https://yumyum.zooko.com:19144/pub/repos/pyutil
1159       or http://zooko.com/repos/pyutil.
1160
1161.. _ticket 8: http://progetti.arstecnica.it/tailor/ticket/8
1162
[506]1163
[488]1164State file
1165----------
[315]1166
[488]1167The state file stores two things: the last upstream revision that
1168has been applied to the tree, and a sequence of pending (not yet
1169applied) changesets, that may be empty. In the latter case, tailor
1170will fetch latest changes from the upstream repository.
[315]1171
[940]1172
1173Logging
1174-------
1175
[1304]1176Tailor uses the Python's logging module to emit noise. Its basic
1177configuration is hardwired and corresponds to the following::
[940]1178
1179    [formatters]
1180    keys = console
1181
1182    [formatter_console]
1183    format =  %(asctime)s [%(levelname).1s] %(message)s
1184    datefmt = %H:%M:%S
1185
1186    [loggers]
1187    keys = root
1188
1189    [logger_root]
1190    level = INFO
1191    handlers = console
1192
1193    [handlers]
1194    keys = console
1195
1196    [handler_console]
1197    class = StreamHandler
1198    formatter = console
1199    args = (sys.stdout,)
1200    level = INFO
[1443]1201
1202Another handler is added at runtime that appends any message in a file
1203named ``projectname.log`` inside the root directory. This file
1204contains much more details than those usually reaching the console,
1205and may be of some help to understand what went wrong.
[940]1206
1207However, you can completely override the default adding a
1208*supersection* ``[[logging]]`` to the configuration file, something
1209like::
1210
1211    # ... usual tailor config ...
1212    [project]
1213    source = bzr:source
1214    target = hg:target
1215
1216    # Here ends tailor config, and start the one for the logging
1217    # module
1218
1219    [[logging]]
1220
1221    [logger_tailor.BzrRepository]
1222    level = DEBUG
1223    handlers = tailor.source
1224
1225    [handler_tailor.source]
1226    class = SMTPHandler
1227    args = ('localhost', 'from@abc', ['tailor@abc'], 'Tailor log')
1228
[1420]1229
[173]1230Further help
1231============
[172]1232
[1420]1233See the output of ``tailor -h`` for some further tips.  The official
1234documentation is available as a set of `wiki pages`_ managed by a
1235Trac_ instance, but there is also `this page`_ on the Darcs wiki
1236that may give you some other hints.
1237
1238The development of Tailor is mainly driven by user requests at this
1239point, and the preferred comunication medium is the dedicated `mailing
1240list`_ [#]_.
1241
1242.. _wiki pages:
1243   http://progetti.arstecnica.it/tailor/
[177]1244
[1420]1245.. _this page:
[287]1246   http://www.darcs.net/DarcsWiki/Tailor
[177]1247
[288]1248.. _mailing list:
1249   http://lists.zooko.com/mailman/listinfo/tailor
[1420]1250
1251.. _trac:
1252   http://trac.edgewall.org/
1253
[177]1254I will be more than happy to answer any doubt, question or suggestion
[1069]1255you may have on it. I'm usually hanging out as "lelit" on the
1256``#tailor`` IRC channel on the `freenode.net` network. Do not hesitate
1257to contact me either by email or chatting there.
[288]1258
[310]1259.. [#] I wish to say a big `Thank you` to `Zooko <zooko@zooko.com>`_,
1260       for hosting the ML and for supporting Tailor in several ways,
1261       from suggestions to bug reporting and fixing.
[173]1262
1263
[635]1264Authors
1265=======
[173]1266
[172]1267Lele Gaifax <lele@nautilus.homeip.net>
[261]1268
[554]1269Since I'm not currently using all the supported systems (so little
1270time, so many VCSs...) I'm not in position to test them out properly,
1271but I'll do my best to keep them in sync, maybe with your support :-)
1272
1273ArX support
1274-----------
1275
[1456]1276ArX_ support was contributed by `Walter Landry <wlandry@caltech.edu>`_.
[261]1277
[1367]1278Bazaar support
[635]1279-----------------
1280
[1367]1281`Bazaar`_ support was contributed by `Johan Rydberg
[1101]1282<jrydberg@gnu.org>`_.  Nowadays it's being maintained by `Lalo Martins
1283<lalo.martins@gmail.com>`_.
[691]1284
1285Git support
1286-----------
1287
[787]1288`Git`_ support was contributed by `Todd Mokros
[691]1289<tmokros@tmokros.net>`_.
[635]1290
[261]1291Monotone support
1292----------------
1293
1294Monotone_ support was kindly contributed by `Markus Schiltknecht
[308]1295<markus@bluegap.ch>`_ and further developed by `rghetta
[686]1296<birrachiara@tin.it>`_, that was able to linearize the multi-headed
1297monotone history into something tailor groks. Kudos!
[1398]1298More recently, `Henry Nestler <henry@bigfoot.de>`_ contributed
[1394]1299various enhancements, like using ``automate`` instead ``list`` and tag
1300support.
[554]1301
[1340]1302Perforce support
1303----------------
1304
1305Perforce_ support was kindly contributed by `Dustin Sallings
1306<dustin@spy.net>`_.
1307
[554]1308Tla support
1309-----------
1310
1311Tla_ support was contributed by `Robin Farine
1312<robin.farine@terminus.org>`_.
[261]1313
[305]1314
1315License
1316=======
1317
[1419]1318Tailor is `free software`__: you can redistribute it and/or modify
1319it under the terms of the `GNU General Public License` as published by
1320the Free Software Foundation, either version 3 of the License, or
1321(at your option) any later version.
[305]1322
[1419]1323This program is distributed in the hope that it will be useful,
1324but **without any warranty**; without even the implied warranty of
1325**merchantability** or **fitness for a particular purpose**.  See the
1326GNU General Public License for more details.
1327
1328You should have received a copy of the GNU General Public License
1329along with this program in the file ``COPYING``.  If not, see `this
1330web page`__.
1331
1332__ http://www.gnu.org/philosophy/free-sw.html
[305]1333__ http://www.fsf.org/licensing/licenses/gpl.html
[177]1334
[172]1335
[176]1336About this document
1337===================
[177]1338
[1059]1339This document and most of the internal documentation use the
[177]1340reStructuredText format so that it can be easily converted into other
1341formats, such as HTML.  For more information about this, please see:
[172]1342
[177]1343  http://docutils.sourceforge.net/rst.html
[176]1344
1345
1346.. vim:ft=rest
[174]1347.. Local Variables:
1348.. mode: rst
1349.. End:
Note: See TracBrowser for help on using the repository browser.