source: tailor/README @ 643

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

Dropped the interactive session

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