source: tailor/README @ 315

Revision 315, 11.2 KB checked in by lele@…, 8 years ago (diff)

Reworked the interactive session, separating configuration from state

Line 
1About
2=====
3
4Tailor is a tool to migrate changesets between CVS, Subversion_,
5darcs_, monotone_, Codeville_ and `Baazar-NG`_ [#]_ repositories.
6
7This script makes it easier to keep the upstream changes merged in
8a branch of a product, storing needed information such as the upstream
9URI and revision in special properties on the branched directory.
10
11The following ascii-art illustrates the usual scenario::
12
13                           +------------+            +------------+
14  +--------------+         | Immutable  |            | Working    |
15  | Upstream CVS |-------->| darcs      |----------->| darcs      |
16  | repository   | tailor  | repository | darcs pull | repository |
17  +--------------+         +------------+            +------------+
18                                                           |^         
19                                                           ||
20                                                           ||
21                                                           v|
22                                                          User
23
24Ideally you should be able to swap and replace "CVS server" and "darcs
25repository" with any combination of the supported systems.
26
27A more convoluted setup shows how brave people are using it to get a
28two way sync::
29
30  +----------+        +--------+        +--------+       +---------+
31  |          | -----> | hybrid | darcs  |        | ----> |   my    |
32  | upstream | tailor |  CVS   | -----> | master | darcs | working |
33  |   CVS    | <----- | darcs  | <----- | darcs  | <---- |  darcs  |
34  |          |        |  sync  | tailor |        |       |         |
35  +----------+        +--------+        +--------+       +---------+
36               (cron)            (cron)
37
38
39.. [#] Monotone, Codeville and Baazar-NG systems may be used only as
40       the `target` backend, since the `source` support isn't
41       coded yet.
42
43.. _subversion: http://subversion.tigris.org/
44.. _darcs: http://www.darcs.net/
45.. _codeville: http://www.codeville.org/
46.. _baazar-ng: http://www.bazaar-ng.org/
47
48
49Installation
50============
51
52tailor.py is written in Python, and thus Python must be installed on
53your system to use it.  It has been successfully used with Python 2.3
54and 2.4.
55
56Since it relays on external tools to do the real work such as `cvs`,
57`darcs` and `svn`, they need to be installed as well, although only
58those you will actually use.
59
60Make tailor.py executable::
61
62 $ chmod +x tailor.py
63
64You can either run tailor.py where it is currently located, or move it
65along with the vcpx directory to a location in your PATH.
66
67There's even a standard setup.py that you may use to install the
68script using Python conventional distutils.
69
70
71Examples
72========
73
741. Bootstrap a new tailored project, starting at upstream revision 10::
75
76    $ tailor.py -b -s svn -R http://svn.server/path/to/svnrepo \
77      --module /Product/trunk -r 10 --subdir Product ~/darcs/MyProduct
78
792. Bootstrap a new product, fetching from CVS and storing under SVN:
80   this will create the directory "~/svnwc/cmfcore"; "~/svnwc" must be
81   already under SVN::
82
83    $ tailor.py --source-kind cvs --target-kind svn --bootstrap \
84                --repository :pserver:cvs.zope.org:/cvs-repository \
85                --module CMF/CMFCore ~/svnwc/cmfcore
86
873. Showing each command bootstrap a new DARCS repos in
88   "~/darcs/cmftopic" under which the upstream module will be
89   extracted as "CMFTopic" (ie, the last component of the module
90   name)::
91
92    $ tailor.py -D -b -R :pserver:anonymous@cvs.zope.org:/cvs-repository/ \
93                -m CMF/CMFTopic ~/darcs/cmftopic
94             
954. Merge upstream changes since last update/bootstrap::
96
97    $ tailor.py ~/svnwc/MyProduct
98
995. Migrate a whole SVN repository, starting from the beginning::
100
101    $ tailor.py -b -s svn -R svn+ssh://caia/tmp/svn/repo --module / \
102      --subdir testsvn --revision 1 testdir
103
104   .. warning:: When using --revision with a SVN source repository, be
105                sure that the path your are tracking was there at that
106                revision, otherwise svn will exit with an error.
107
1086. Bootstrap from a CVS branch, starting from a given point in time::
109
110    $ tailor.py -b -s cvs -R :pserver:anonymous@server.org:/cvsroot/ \
111                --revision 'unstable-branch 2001-12-25 23:26:48 UTC' \
112                --module something new-darcs-repository
113
114
115Resolving conflicts
116===================
117
118Should one of the replayed changes generate any conflict, tailor.py
119will prompt the user to correct them. This is done after the upstream
120patch has been applied and before the final commit on the target
121system, so that manually tweaking the conflict can produce a clean
122patch.
123
124
125Shortcomings
126============
127
128Tailor currently suffers of the following reported problems:
129
130a) It does not handle "empty" CVS checkouts, in other words you cannot
131   bootstrap a project that has nothing in its CVS upstream
132   repository, or from a point in time where this condition was true.
133
134b) It does not work under Windows (no, that's not a feature :-). Maybe
135   replacing the shwrap machinery with something built on top of
136   subprocess_ that seems able to hide Windows crazyness...
137
138c) Monotone, Codeville and Baazar-NG are (currently) only supported as
139   *target*
140
141d) Specifying ``--subdir .`` may not work, in particular when dealing
142   with remote CVS repositories (it does when the CVS repository is
143   on local machine).
144   
145This list will always be incomplete, but I'll do my best to keep it
146short :-)
147
148.. _subprocess: http://www.lysator.liu.se/~astrand/popen5/
149
150
151Tailor's metadata
152=================
153
154To do its work, tailor needs some information about your source tree,
155such as the upstream repository URL and the current revision of the
156sources on your harddisk.
157
158In the simpler case, tailor keeps this information in a file called
159`tailor.info`, one for each tailored project, that is a very simple
160text document, with the following information, one per line:
161
1621. Upstream repository kind (either "cvs", "darcs" or "svn)
1632. Target repository kind (the same as above)
1643. The name of the "module" that's been tailored
1654. The URL of the upstream repository (that may not be an URL, for cvs...)
1665. The current revision, from the upstream point of view, of the sources
1676. The subdirectory that contains the checked out upstream tree,
168   either that given with with the `--subdir` option or computed
169   taking the last part of the module name.
170
171This is everything tailor needs, to be able to keep going from where it
172left last time.
173
174
175Config file format
176------------------
177
178When your project is composed by multiple upstream modules, it is
179easier to collect such information in a single file. This is done by
180specifying the `--configfile` option with a file name as argument. In
181this case, tailor will read/write the above information from a
182standard Python dictionary stored in the given file.
183
184The dictionary is keyed on the relative position of each project, and
185each entry carries the same information described above.
186
187Here's an example config file entry::
188
189 {'plone/atcontenttypes': {'module': 'ATContentTypes',
190                           'source_kind': 'cvs',
191                           'subdir': 'ATContentTypes',
192                           'target_kind': 'darcs',
193                           'upstream_repos': ':ext:cvs.sourceforge.net:/cvsroot/collective',
194                           'upstream_revision': '2004-11-24 19:42:06 by ctheune'}}
195
196By convention, config files are named with the extension ".tailor",
197but this is not enforced.
198
199In the example above, 'plone/atcontenttypes' is a directory where the
200target source will be stored. The keys such 'module', 'source_kind',
201etc correspond to options of the same name.
202
203When using a config file, tailor will perform its job on each project
204contained in the dictionary.
205
206
207Interactive sessions
208--------------------
209
210Tailor offers an alternative way of driving its activity by using an
211interactive session, bringing the configuration more similar to a
212script.
213
214Although this is still a work-in-progress, it's quickly becoming my
215preferred usage, as its functionality cover the underlying tailor
216features.
217
218For example, this is the script I'm using to test it::
219
220    cd /tmp/p/wc
221    state_file tailor.state
222    source_kind darcs
223    target_kind svn
224    source_repository /home/lele/WiP/cvsync
225    sub_directory cvsync
226
227that, as you can see, specifies the context needed by tailor to do its
228work. With the following command line::
229
230    $ tailor.py --verbose --interactive tailor.cmds
231    Welcome to the Tailor interactive session: you can issue several commands
232    with the usual `readline` facilities. With "help" you'll get a list of
233    available commands.
234
235    Current directory: /tmp/p/wc
236    Current state file: /tmp/p/wc/tailor.state
237    Current source kind: darcs
238    Current target kind: svn
239    Current source repository: /home/lele/WiP/cvsync
240    Sub directory: cvsync
241    tailor $ help
242   
243    Documented commands (type help <topic>):
244    ========================================
245    EOF                get_changes   source_module      target_module
246    bootstrap          logfile       source_repository  target_repository
247    cd                 save          state_file
248    current_directory  show_changes  sub_directory
249    exit               source_kind   target_kind
250
251    Undocumented commands:
252    ======================
253    help
254
255    tailor $ help bootstrap
256   
257        Checkout the initial upstream revision, by default HEAD (or
258        specified by argument), then import the subtree into the
259        target repository.
260
261
262Further help
263============
264
265See the output of ``tailor.py -h`` for some further tips.  There's
266also a `wiki page`_ that may give you some other hints.  The
267development of Tailor is mainly driven by user requests at this point,
268and the preferred comunication media is the dedicated `mailing list`_
269[#]_.
270
271.. _wiki page:
272   http://www.darcs.net/DarcsWiki/Tailor
273
274.. _mailing list:
275   http://lists.zooko.com/mailman/listinfo/tailor
276   
277I will be more than happy to answer any doubt, question or suggestion
278you may have on it. I'm usually hanging as "lelit" on the IRC channel
279devoted to darcs on the `freenode.net` network. Do not hesitate to
280contact me either by email or chatting there.
281
282.. [#] I wish to say a big `Thank you` to `Zooko <zooko@zooko.com>`_,
283       for hosting the ML and for supporting Tailor in several ways,
284       from suggestions to bug reporting and fixing.
285
286
287Author
288======
289
290Lele Gaifax <lele@nautilus.homeip.net>
291
292
293Monotone support
294----------------
295
296Monotone_ support was kindly contributed by `Markus Schiltknecht
297<markus@bluegap.ch>`_ and further developed by `rghetta
298<birrachiara@tin.it>`_.  Since I'm not currently using monotone (so
299little time, so many VCSs...) I'm not in position to test it out
300properly, but I'll do my best to keep it in sync, maybe with your
301support :-)
302
303.. _monotone: http://www.venge.net/monotone/
304
305
306License
307=======
308
309Tailor is distribuited under the `GNU General Public License`__.
310
311__ http://www.fsf.org/licensing/licenses/gpl.html
312
313
314About this document
315===================
316
317This document and most of the internal documention use the
318reStructuredText format so that it can be easily converted into other
319formats, such as HTML.  For more information about this, please see:
320
321  http://docutils.sourceforge.net/rst.html
322
323
324.. vim:ft=rest
325.. Local Variables:
326.. mode: rst
327.. End:
Note: See TracBrowser for help on using the repository browser.