source: tailor/README @ 423

Revision 423, 13.7 KB checked in by lele@…, 8 years ago (diff)

Since tailor is finally using subprocess module, correct Windows note

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