source: tailor/README @ 422

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

Resolved conflict

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 does not work under Windows (no, that's not a feature :-). Maybe
160   replacing the shwrap machinery with something built on top of
161   subprocess_ that seems able to hide Windows crazyness...
162
163c) Monotone, Codeville and Baazar-NG are (currently) only supported as
164   *target*
165
166d) Specifying ``--subdir .`` may not work, in particular when dealing
167   with remote CVS repositories (it does when the CVS repository is
168   on local machine).
169   
170This list will always be incomplete, but I'll do my best to keep it
171short :-)
172
173.. _subprocess: http://www.lysator.liu.se/~astrand/popen5/
174
175
176Tailor's metadata
177=================
178
179To do its work, tailor needs some information about your source tree,
180such as the upstream repository URL and the current revision of the
181sources on your harddisk.
182
183In the simpler case, tailor keeps this information in a file called
184`tailor.info`, one for each tailored project, that is a very simple
185text document, with the following information, one per line:
186
1871. Upstream repository kind (either "cvs", "darcs" or "svn)
1882. Target repository kind (the same as above)
1893. The name of the "module" that's been tailored
1904. The URL of the upstream repository (that may not be an URL, for cvs...)
1915. The current revision, from the upstream point of view, of the sources
1926. The subdirectory that contains the checked out upstream tree,
193   either that given with with the `--subdir` option or computed
194   taking the last part of the module name.
195
196This is everything tailor needs, to be able to keep going from where it
197left last time.
198
199
200Config file format
201------------------
202
203When your project is composed by multiple upstream modules, it is
204easier to collect such information in a single file. This is done by
205specifying the `--configfile` option with a file name as argument. In
206this case, tailor will read/write the above information from a
207standard Python dictionary stored in the given file.
208
209The dictionary is keyed on the relative position of each project, and
210each entry carries the same information described above.
211
212Here's an example config file entry::
213
214 {'plone/atcontenttypes': {'module': 'ATContentTypes',
215                           'source_kind': 'cvs',
216                           'subdir': 'ATContentTypes',
217                           'target_kind': 'darcs',
218                           'upstream_repos': ':ext:cvs.sourceforge.net:/cvsroot/collective',
219                           'upstream_revision': '2004-11-24 19:42:06 by ctheune'}}
220
221By convention, config files are named with the extension ".tailor",
222but this is not enforced.
223
224In the example above, 'plone/atcontenttypes' is a directory where the
225target source will be stored. The keys such 'module', 'source_kind',
226etc correspond to options of the same name.
227
228When using a config file, tailor will perform its job on each project
229contained in the dictionary.
230
231
232Interactive sessions
233--------------------
234
235Tailor offers an alternative way of driving its activity by using an
236interactive session, bringing the configuration more similar to a
237script.
238
239Although this is still a work-in-progress, it's quickly becoming my
240preferred usage, as its functionality cover the underlying tailor
241features.
242
243For example, this is the script I'm using to test it::
244
245    cd /tmp
246    state_file tailor.state
247    source_kind darcs
248    target_kind svn
249    source_repository /home/lele/WiP/cvsync
250    sub_directory cvsync
251    refill_changelogs no
252    patch_name_format [%(module)s] Changeset %(revision)s by %(author)s
253
254that, as you can see, specifies the context needed by tailor to do its
255work. With the following command line::
256
257    $ tailor --verbose --interactive tailor.cmds
258    Welcome to the Tailor interactive session: you can issue several commands
259    with the usual `readline` facilities. With "help" you'll get a list of
260    available commands.
261
262    Current directory: /tmp
263    Current state file: /tmp/tailor.state
264    Current source kind: darcs
265    Current target kind: svn
266    Current source repository: /home/lele/WiP/cvsync
267    Sub directory: cvsync
268    Refill changelogs: False
269    Patch name format: [%(module)s] Changeset %(revision)s by %(author)s
270    tailor $ help
271   
272    Documented commands (type help <topic>):
273    ========================================
274    EOF                print_executed_commands  state_file
275    bootstrap          refill_changelogs        sub_directory
276    cd                 remove_first_log_line    target_kind
277    current_directory  save                     target_module
278    exit               source_kind              target_repository
279    logfile            source_module
280    patch_name_format  source_repository
281
282    Undocumented commands:
283    ======================
284    help
285
286    tailor $ help bootstrap
287   
288        Usage: bootstrap [revision]
289
290        Checkout the initial upstream revision, by default HEAD (or
291        specified by argument), then import the subtree into the
292        target repository.
293
294As another example, consider the following commands::
295
296    cd /tmp/wc
297    state_file tailor.state
298    source_kind cvs
299    target_kind darcs
300    source_repository :pserver:anonymous@cvs.sourceforge.net:/cvsroot/buildbot
301    source_module buildbot
302    refill_changelogs false
303    patch_name_format %(firstlogline)s
304    print_executed_commands true
305    bootstrap 2004/01/01 20:05:24
306    update ask
307
308Assuming ``/tmp/wc`` exists, executing them will first bootstrap a new
309darcs repository with a snapshot at the given date of the upstream
310sources, then will proceed with the update, asking confirmation about
311any single changeset::
312
313    ...
314    Collected 586 upstream changesets
315    Changeset 2004-01-07 00:42:07 by warner:
316    * buildbot/changes/mail.py (parseFreshCVSMail): ....
317    * test/test_mailparse.py (Test1.testMsg9): test for same
318
319    Apply [Y/n/v/h/q]? h
320    y: yes, apply it and keep going
321    n: no, skip the current changeset
322    v: view more detailed information
323    q: do not apply the current changeset and stop iterating
324
325    Apply [Y/n/v/h/q]? v
326    Revision: 2004-01-07 00:42:07 by warner
327    Date: 2004-01-07 00:42:07
328    Author: warner
329    Modified: ChangeLog,buildbot/changes/mail.py,test/test_mailparse.py
330    Added: test/mail/msg9
331    Log: * buildbot/changes/mail.py (parseFreshCVSMail): ...
332    * test/test_mailparse.py (Test1.testMsg9): test for same
333   
334    Apply [Y/n/v/h/q]?
335
336       
337Further help
338============
339
340See the output of ``tailor -h`` for some further tips.  There's
341also a `wiki page`_ that may give you some other hints.  The
342development of Tailor is mainly driven by user requests at this point,
343and the preferred comunication media is the dedicated `mailing list`_
344[#]_.
345
346.. _wiki page:
347   http://www.darcs.net/DarcsWiki/Tailor
348
349.. _mailing list:
350   http://lists.zooko.com/mailman/listinfo/tailor
351   
352I will be more than happy to answer any doubt, question or suggestion
353you may have on it. I'm usually hanging as "lelit" on the IRC channel
354devoted to darcs on the `freenode.net` network. Do not hesitate to
355contact me either by email or chatting there.
356
357.. [#] I wish to say a big `Thank you` to `Zooko <zooko@zooko.com>`_,
358       for hosting the ML and for supporting Tailor in several ways,
359       from suggestions to bug reporting and fixing.
360
361
362Author
363======
364
365Lele Gaifax <lele@nautilus.homeip.net>
366
367
368Monotone support
369----------------
370
371Monotone_ support was kindly contributed by `Markus Schiltknecht
372<markus@bluegap.ch>`_ and further developed by `rghetta
373<birrachiara@tin.it>`_.  Since I'm not currently using monotone (so
374little time, so many VCSs...) I'm not in position to test it out
375properly, but I'll do my best to keep it in sync, maybe with your
376support :-)
377
378.. _monotone: http://www.venge.net/monotone/
379
380
381License
382=======
383
384Tailor is distribuited under the `GNU General Public License`__.
385
386__ http://www.fsf.org/licensing/licenses/gpl.html
387
388
389About this document
390===================
391
392This document and most of the internal documention use the
393reStructuredText format so that it can be easily converted into other
394formats, such as HTML.  For more information about this, please see:
395
396  http://docutils.sourceforge.net/rst.html
397
398
399.. vim:ft=rest
400.. Local Variables:
401.. mode: rst
402.. End:
Note: See TracBrowser for help on using the repository browser.