source: tailor/README @ 644

Revision 644, 13.5 KB checked in by lele@…, 8 years ago (diff)

Added a title for the whole document

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