source: tailor/README @ 399

Revision 399, 13.1 KB checked in by lele@…, 8 years ago (diff)

Rename the frontend to 'tailor', without extension

Line 
1About
2=====
3
4Tailor is a tool to migrate changesets between CVS, Subversion_,
5darcs_, monotone_, Codeville_, Mercurial_ and `Baazar-NG`_ [#]_
6repositories.
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.. [#] 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.. _subversion: http://subversion.tigris.org/
48.. _darcs: http://www.darcs.net/
49.. _codeville: http://www.codeville.org/
50.. _baazar-ng: http://www.bazaar-ng.org/
51.. _mercurial: http://www.selenic.com/mercurial/
52
53
54Installation
55============
56
57tailor is written in Python, and thus Python must be installed on
58your system to use it.  It has been successfully used with Python 2.3
59and 2.4.
60
61Since it relies on external tools to do the real work such as `cvs`,
62`darcs` and `svn`, they need to be installed as well, although only
63those you will actually use.
64
65Make tailor executable::
66
67 $ chmod +x tailor
68
69You can either run tailor where it is currently located, or move it
70along with the vcpx directory to a location in your PATH.
71
72There's even a standard setup.py that you may use to install the
73script using Python conventional distutils.
74
75
76Examples
77========
78
791. Bootstrap a new tailored project, starting at upstream revision 10::
80
81    $ tailor -b -s svn -R http://svn.server/path/to/svnrepo \
82      --module /Product/trunk -r 10 --subdir Product ~/darcs/MyProduct
83
842. Bootstrap a new product, fetching from CVS and storing under SVN:
85   this will create the directory "~/svnwc/cmfcore"; "~/svnwc" must be
86   already under SVN::
87
88    $ tailor --source-kind cvs --target-kind svn --bootstrap \
89                --repository :pserver:cvs.zope.org:/cvs-repository \
90                --module CMF/CMFCore ~/svnwc/cmfcore
91
923. Showing each command bootstrap a new DARCS repos in
93   "~/darcs/cmftopic" under which the upstream module will be
94   extracted as "CMFTopic" (ie, the last component of the module
95   name)::
96
97    $ tailor -D -b -R :pserver:anonymous@cvs.zope.org:/cvs-repository/ \
98                -m CMF/CMFTopic ~/darcs/cmftopic
99             
1004. Merge upstream changes since last update/bootstrap::
101
102    $ tailor ~/svnwc/MyProduct
103
1045. Migrate a whole SVN repository, starting from the beginning::
105
106    $ tailor -b -s svn -R svn+ssh://caia/tmp/svn/repo --module / \
107      --subdir testsvn --revision 1 testdir
108
109   .. warning:: When using --revision with a SVN source repository, be
110                sure that the path your are tracking was there at that
111                revision, otherwise svn will exit with an error.
112
1136. Bootstrap from a CVS branch, starting from a given point in time::
114
115    $ tailor -b -s cvs -R :pserver:anonymous@server.org:/cvsroot/ \
116                --revision 'unstable-branch 2001-12-25 23:26:48 UTC' \
117                --module something new-darcs-repository
118
119
120Resolving conflicts
121===================
122
123Should one of the replayed changes generate any conflict, tailor
124will prompt the user to correct them. This is done after the upstream
125patch has been applied and before the final commit on the target
126system, so that manually tweaking the conflict can produce a clean
127patch.
128
129
130Shortcomings
131============
132
133Tailor currently suffers of the following reported problems:
134
135a) It does not handle "empty" CVS checkouts, in other words you cannot
136   bootstrap a project that has nothing in its CVS upstream
137   repository, or from a point in time where this condition was true.
138
139b) It does not work under Windows (no, that's not a feature :-). Maybe
140   replacing the shwrap machinery with something built on top of
141   subprocess_ that seems able to hide Windows crazyness...
142
143c) Monotone, Codeville and Baazar-NG are (currently) only supported as
144   *target*
145
146d) Specifying ``--subdir .`` may not work, in particular when dealing
147   with remote CVS repositories (it does when the CVS repository is
148   on local machine).
149   
150This list will always be incomplete, but I'll do my best to keep it
151short :-)
152
153.. _subprocess: http://www.lysator.liu.se/~astrand/popen5/
154
155
156Tailor's metadata
157=================
158
159To do its work, tailor needs some information about your source tree,
160such as the upstream repository URL and the current revision of the
161sources on your harddisk.
162
163In the simpler case, tailor keeps this information in a file called
164`tailor.info`, one for each tailored project, that is a very simple
165text document, with the following information, one per line:
166
1671. Upstream repository kind (either "cvs", "darcs" or "svn)
1682. Target repository kind (the same as above)
1693. The name of the "module" that's been tailored
1704. The URL of the upstream repository (that may not be an URL, for cvs...)
1715. The current revision, from the upstream point of view, of the sources
1726. The subdirectory that contains the checked out upstream tree,
173   either that given with with the `--subdir` option or computed
174   taking the last part of the module name.
175
176This is everything tailor needs, to be able to keep going from where it
177left last time.
178
179
180Config file format
181------------------
182
183When your project is composed by multiple upstream modules, it is
184easier to collect such information in a single file. This is done by
185specifying the `--configfile` option with a file name as argument. In
186this case, tailor will read/write the above information from a
187standard Python dictionary stored in the given file.
188
189The dictionary is keyed on the relative position of each project, and
190each entry carries the same information described above.
191
192Here's an example config file entry::
193
194 {'plone/atcontenttypes': {'module': 'ATContentTypes',
195                           'source_kind': 'cvs',
196                           'subdir': 'ATContentTypes',
197                           'target_kind': 'darcs',
198                           'upstream_repos': ':ext:cvs.sourceforge.net:/cvsroot/collective',
199                           'upstream_revision': '2004-11-24 19:42:06 by ctheune'}}
200
201By convention, config files are named with the extension ".tailor",
202but this is not enforced.
203
204In the example above, 'plone/atcontenttypes' is a directory where the
205target source will be stored. The keys such 'module', 'source_kind',
206etc correspond to options of the same name.
207
208When using a config file, tailor will perform its job on each project
209contained in the dictionary.
210
211
212Interactive sessions
213--------------------
214
215Tailor offers an alternative way of driving its activity by using an
216interactive session, bringing the configuration more similar to a
217script.
218
219Although this is still a work-in-progress, it's quickly becoming my
220preferred usage, as its functionality cover the underlying tailor
221features.
222
223For example, this is the script I'm using to test it::
224
225    cd /tmp
226    state_file tailor.state
227    source_kind darcs
228    target_kind svn
229    source_repository /home/lele/WiP/cvsync
230    sub_directory cvsync
231    refill_changelogs no
232    patch_name_format [%(module)s] Changeset %(revision)s by %(author)s
233
234that, as you can see, specifies the context needed by tailor to do its
235work. With the following command line::
236
237    $ tailor --verbose --interactive tailor.cmds
238    Welcome to the Tailor interactive session: you can issue several commands
239    with the usual `readline` facilities. With "help" you'll get a list of
240    available commands.
241
242    Current directory: /tmp
243    Current state file: /tmp/tailor.state
244    Current source kind: darcs
245    Current target kind: svn
246    Current source repository: /home/lele/WiP/cvsync
247    Sub directory: cvsync
248    Refill changelogs: False
249    Patch name format: [%(module)s] Changeset %(revision)s by %(author)s
250    tailor $ help
251   
252    Documented commands (type help <topic>):
253    ========================================
254    EOF                print_executed_commands  state_file
255    bootstrap          refill_changelogs        sub_directory
256    cd                 remove_first_log_line    target_kind
257    current_directory  save                     target_module
258    exit               source_kind              target_repository
259    logfile            source_module
260    patch_name_format  source_repository
261
262    Undocumented commands:
263    ======================
264    help
265
266    tailor $ help bootstrap
267   
268        Usage: bootstrap [revision]
269
270        Checkout the initial upstream revision, by default HEAD (or
271        specified by argument), then import the subtree into the
272        target repository.
273
274As another example, consider the following commands::
275
276    cd /tmp/wc
277    state_file tailor.state
278    source_kind cvs
279    target_kind darcs
280    source_repository :pserver:anonymous@cvs.sourceforge.net:/cvsroot/buildbot
281    source_module buildbot
282    refill_changelogs false
283    patch_name_format %(firstlogline)s
284    print_executed_commands true
285    bootstrap 2004/01/01 20:05:24
286    update ask
287
288Assuming ``/tmp/wc`` exists, executing them will first bootstrap a new
289darcs repository with a snapshot at the given date of the upstream
290sources, then will proceed with the update, asking confirmation about
291any single changeset::
292
293    ...
294    Collected 586 upstream changesets
295    Changeset 2004-01-07 00:42:07 by warner:
296    * buildbot/changes/mail.py (parseFreshCVSMail): ....
297    * test/test_mailparse.py (Test1.testMsg9): test for same
298
299    Apply [Y/n/v/h/q]? h
300    y: yes, apply it and keep going
301    n: no, skip the current changeset
302    v: view more detailed information
303    q: do not apply the current changeset and stop iterating
304
305    Apply [Y/n/v/h/q]? v
306    Revision: 2004-01-07 00:42:07 by warner
307    Date: 2004-01-07 00:42:07
308    Author: warner
309    Modified: ChangeLog,buildbot/changes/mail.py,test/test_mailparse.py
310    Added: test/mail/msg9
311    Log: * buildbot/changes/mail.py (parseFreshCVSMail): ...
312    * test/test_mailparse.py (Test1.testMsg9): test for same
313   
314    Apply [Y/n/v/h/q]?
315
316       
317Further help
318============
319
320See the output of ``tailor -h`` for some further tips.  There's
321also a `wiki page`_ that may give you some other hints.  The
322development of Tailor is mainly driven by user requests at this point,
323and the preferred comunication media is the dedicated `mailing list`_
324[#]_.
325
326.. _wiki page:
327   http://www.darcs.net/DarcsWiki/Tailor
328
329.. _mailing list:
330   http://lists.zooko.com/mailman/listinfo/tailor
331   
332I will be more than happy to answer any doubt, question or suggestion
333you may have on it. I'm usually hanging as "lelit" on the IRC channel
334devoted to darcs on the `freenode.net` network. Do not hesitate to
335contact me either by email or chatting there.
336
337.. [#] I wish to say a big `Thank you` to `Zooko <zooko@zooko.com>`_,
338       for hosting the ML and for supporting Tailor in several ways,
339       from suggestions to bug reporting and fixing.
340
341
342Author
343======
344
345Lele Gaifax <lele@nautilus.homeip.net>
346
347
348Monotone support
349----------------
350
351Monotone_ support was kindly contributed by `Markus Schiltknecht
352<markus@bluegap.ch>`_ and further developed by `rghetta
353<birrachiara@tin.it>`_.  Since I'm not currently using monotone (so
354little time, so many VCSs...) I'm not in position to test it out
355properly, but I'll do my best to keep it in sync, maybe with your
356support :-)
357
358.. _monotone: http://www.venge.net/monotone/
359
360
361License
362=======
363
364Tailor is distribuited under the `GNU General Public License`__.
365
366__ http://www.fsf.org/licensing/licenses/gpl.html
367
368
369About this document
370===================
371
372This document and most of the internal documention use the
373reStructuredText format so that it can be easily converted into other
374formats, such as HTML.  For more information about this, please see:
375
376  http://docutils.sourceforge.net/rst.html
377
378
379.. vim:ft=rest
380.. Local Variables:
381.. mode: rst
382.. End:
Note: See TracBrowser for help on using the repository browser.