source: tailor/README @ 1367

Revision 1367, 36.0 KB checked in by Wouter van Heyst <larstiq@…>, 6 years ago (diff)

bazaar-ng-renaming
What was formerly know as Bazaar-NG is no longer the next generation, but the current one.
See  http://bazaar-vcs.org/Baz1x and  http://bazaar-vcs.org/Branding.

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