Merge lp:~jelmer/bzr-fastimport/remove-exporters into lp:bzr-fastimport

Proposed by Jelmer Vernooij on 2012-02-28
Status: Merged
Approved by: Martin Packman on 2012-02-29
Approved revision: 352
Merged at revision: 352
Proposed branch: lp:~jelmer/bzr-fastimport/remove-exporters
Merge into: lp:bzr-fastimport
Diff against target: 5423 lines (+20/-4960)
68 files modified
NEWS (+8/-0)
README.txt (+0/-4)
__init__.py (+1/-29)
cmds.py (+11/-234)
exporters/Makefile (+0/-15)
exporters/__init__.py (+0/-326)
exporters/darcs/.gitignore (+0/-3)
exporters/darcs/Makefile (+0/-55)
exporters/darcs/NEWS (+0/-26)
exporters/darcs/README (+0/-187)
exporters/darcs/TODO (+0/-8)
exporters/darcs/asciidoc.conf (+0/-21)
exporters/darcs/d2x (+0/-112)
exporters/darcs/d2x.txt (+0/-27)
exporters/darcs/darcs-fast-export (+0/-380)
exporters/darcs/darcs-fast-export.txt (+0/-68)
exporters/darcs/darcs-fast-import (+0/-375)
exporters/darcs/darcs-fast-import.txt (+0/-57)
exporters/darcs/git-darcs (+0/-279)
exporters/darcs/git-darcs.txt (+0/-92)
exporters/darcs/t/Makefile (+0/-9)
exporters/darcs/t/bench-results/Makefile (+0/-5)
exporters/darcs/t/bench-results/bench-results.gnu (+0/-6)
exporters/darcs/t/bench-results/bench-results.py (+0/-23)
exporters/darcs/t/bench-tailor.sh (+0/-59)
exporters/darcs/t/bench.sh (+0/-38)
exporters/darcs/t/lib-httpd.sh (+0/-67)
exporters/darcs/t/lib.sh (+0/-337)
exporters/darcs/t/test-bzr.sh (+0/-16)
exporters/darcs/t/test-git-d2x.sh (+0/-19)
exporters/darcs/t/test-git-incremental.sh (+0/-24)
exporters/darcs/t/test-git-progress.sh (+0/-18)
exporters/darcs/t/test-git.sh (+0/-18)
exporters/darcs/t/test-hg-d2x.sh (+0/-12)
exporters/darcs/t/test-hg.sh (+0/-16)
exporters/darcs/t/test2-bzr-d2x.sh (+0/-19)
exporters/darcs/t/test2-bzr-incremental.sh (+0/-21)
exporters/darcs/t/test2-git-funny-tagname.sh (+0/-25)
exporters/darcs/t/test2-git-http.sh (+0/-22)
exporters/darcs/t/test2-git-incremental-specworkdir.sh (+0/-22)
exporters/darcs/t/test2-git-incremental.sh (+0/-21)
exporters/darcs/t/test2-git.sh (+0/-18)
exporters/darcs/t/testimport-bzr-x2d.sh (+0/-15)
exporters/darcs/t/testimport-bzr.sh (+0/-15)
exporters/darcs/t/testimport-copy.sh (+0/-26)
exporters/darcs/t/testimport-darcs.sh (+0/-17)
exporters/darcs/t/testimport-deleteall.sh (+0/-31)
exporters/darcs/t/testimport-git-incremental.sh (+0/-16)
exporters/darcs/t/testimport-git-twoway-gd.sh (+0/-34)
exporters/darcs/t/testimport-git-twoway.sh (+0/-30)
exporters/darcs/t/testimport-git-x2d.sh (+0/-15)
exporters/darcs/t/testimport-git.sh (+0/-15)
exporters/darcs/t/testimport-gitsymlink.sh (+0/-45)
exporters/darcs/t/testimport-hg-x2d.sh (+0/-15)
exporters/darcs/t/testimport-hg.sh (+0/-15)
exporters/darcs/t/testimport-rename.sh (+0/-25)
exporters/darcs/x2d (+0/-125)
exporters/darcs/x2d.txt (+0/-28)
exporters/hg-fast-export.README (+0/-54)
exporters/hg-fast-export.py (+0/-442)
exporters/hg-fast-export.sh (+0/-100)
exporters/hg2git.py (+0/-112)
exporters/svn-archive.c (+0/-240)
exporters/svn-fast-export.README (+0/-12)
exporters/svn-fast-export.c (+0/-187)
exporters/svn-fast-export.py (+0/-225)
info.py (+0/-7)
setup.py (+0/-1)
To merge this branch: bzr merge lp:~jelmer/bzr-fastimport/remove-exporters
Reviewer Review Type Date Requested Status
Martin Packman (community) 2012-02-28 Approve on 2012-02-29
Review via email: mp+94998@code.launchpad.net

Description of the Change

Remove the custom exporters from bzr-fastimport.

This is code that is imported from elsewhere which we're not really
maintaining. There are bzr command wrappers for them, but these wrappers only
expose a limited amount of the functionality of the actual exporters and don't
really add much value (other than a consistent, but fairly unuseful interface).

I'd really rather just point people at the actual exporters rather than
having to maintain a copy of them inside of bzr-fastimport.

To post a comment you must log in.
352. By Jelmer Vernooij on 2012-02-28

remove reference to exporter copyrights.

Martin Packman (gz) wrote :

Reasoning for removing these makes sense to me. One thing I'd like to see is web links to exporters in the documentation here. Links do bitrot like code but generally at a slower rate and it's easier to fix them. Giving people a poke in the right direction to find the exporter they need rather than just assuming "widely available" means everyone will know how to google for the right thing would help.

review: Approve

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'NEWS'
2--- NEWS 2012-02-28 14:00:56 +0000
3+++ NEWS 2012-02-28 16:42:20 +0000
4@@ -6,6 +6,14 @@
5
6 0.13 UNRELEASED
7
8+Changes
9+-------
10+
11+* bzr-fastimport no longer ships exporters for various other version
12+ control systems. The versions of these exporters shipped with bzr-fastimport
13+ have been outdated for some time. Better and more recent exporters
14+ are widely available.
15+
16 Compatibility
17 -------------
18
19
20=== modified file 'README.txt'
21--- README.txt 2010-10-15 18:18:53 +0000
22+++ README.txt 2012-02-28 16:42:20 +0000
23@@ -38,14 +38,10 @@
24 To view the documentation after installation:
25
26 bzr help fastimport
27-
28
29 Licensing
30 ---------
31
32-For copyright and licensing details of the exporters, see the relevant
33-files in the exporters/ directory.
34-
35 Otherwise this plugin is (C) Copyright Canonical Limited 2008 under the
36 GPL Version 2 or later. Please see the file COPYING.txt for the licence
37 details.
38
39=== modified file '__init__.py'
40--- __init__.py 2011-12-18 04:07:47 +0000
41+++ __init__.py 2012-02-28 16:42:20 +0000
42@@ -24,12 +24,6 @@
43
44 The normal import recipe is::
45
46- bzr fast-export-from-xxx SOURCE project.fi
47- bzr fast-import project.fi project.bzr
48-
49-If fast-export-from-xxx doesn't exist yet for the tool you're importing
50-from, the alternative recipe is::
51-
52 front-end > project.fi
53 bzr fast-import project.fi project.bzr
54
55@@ -41,22 +35,7 @@
56 bzr fast-import project.fi.gz project.bzr
57
58 The list of known front-ends and their status is documented on
59-http://bazaar-vcs.org/BzrFastImport/FrontEnds. The fast-export-from-xxx
60-commands provide simplified access to these so that the majority of users
61-can generate a fast-import dump file without needing to study up on all
62-the options - and the best combination of them to use - for the front-end
63-relevant to them. In some cases, a fast-export-from-xxx wrapper will require
64-that certain dependencies are installed so it checks for these before
65-starting. A wrapper may also provide a limited set of options. See the
66-online help for the individual commands for details::
67-
68- bzr help fast-export-from-cvs
69- bzr help fast-export-from-darcs
70- bzr help fast-export-from-hg
71- bzr help fast-export-from-git
72- bzr help fast-export-from-mtn
73- bzr help fast-export-from-p4
74- bzr help fast-export-from-svn
75+http://bazaar-vcs.org/BzrFastImport/FrontEnds.
76
77 Once a fast-import dump file is created, it can be imported into a
78 Bazaar repository using the fast-import command. If required, you can
79@@ -108,12 +87,5 @@
80 "fast_import_info",
81 "fast_import_query",
82 "fast_export",
83- "fast_export_from_cvs",
84- "fast_export_from_darcs",
85- "fast_export_from_hg",
86- "fast_export_from_git",
87- "fast_export_from_mtn",
88- "fast_export_from_p4",
89- "fast_export_from_svn"
90 ]:
91 plugin_cmds.register_lazy("cmd_%s" % name, [], "bzrlib.plugins.fastimport.cmds")
92
93=== modified file 'cmds.py'
94--- cmds.py 2012-02-28 16:16:13 +0000
95+++ cmds.py 2012-02-28 16:42:20 +0000
96@@ -72,16 +72,15 @@
97 bzr fast-import project.fi project.bzr
98
99 Numerous commands are provided for generating a fast-import file
100- to use as input. These are named fast-export-from-xxx where xxx
101- is one of cvs, darcs, git, hg, mtn, p4 or svn.
102+ to use as input.
103 To specify standard input as the input stream, use a
104 source name of '-' (instead of project.fi). If the source name
105 ends in '.gz', it is assumed to be compressed in gzip format.
106-
107+
108 project.bzr will be created if it doesn't exist. If it exists
109 already, it should be empty or be an existing Bazaar repository
110 or branch. If not specified, the current directory is assumed.
111-
112+
113 fast-import will intelligently select the format to use when
114 creating a repository or branch. If you are running Bazaar 1.17
115 up to Bazaar 2.0, the default format for Bazaar 2.x ("2a") is used.
116@@ -200,27 +199,30 @@
117
118 Import a Subversion repository into Bazaar::
119
120- bzr fast-export-from-svn /svn/repo/path project.fi
121+ svn-fast-export /svn/repo/path > project.fi
122 bzr fast-import project.fi project.bzr
123
124 Import a CVS repository into Bazaar::
125
126- bzr fast-export-from-cvs /cvs/repo/path project.fi
127+ cvs2git /cvs/repo/path > project.fi
128 bzr fast-import project.fi project.bzr
129
130 Import a Git repository into Bazaar::
131
132- bzr fast-export-from-git /git/repo/path project.fi
133+ cd /git/repo/path
134+ git fast-export --all > project.fi
135 bzr fast-import project.fi project.bzr
136
137 Import a Mercurial repository into Bazaar::
138
139- bzr fast-export-from-hg /hg/repo/path project.fi
140+ cd /hg/repo/path
141+ hg fast-export > project.fi
142 bzr fast-import project.fi project.bzr
143
144 Import a Darcs repository into Bazaar::
145
146- bzr fast-export-from-darcs /darcs/repo/path project.fi
147+ cd /darcs/repo/path
148+ darcs-fast-export > project.fi
149 bzr fast-import project.fi project.bzr
150 """
151 hidden = False
152@@ -682,228 +684,3 @@
153 revision=revision, verbose=verbose, plain_format=plain,
154 rewrite_tags=rewrite_tag_names, baseline=baseline)
155 return exporter.run()
156-
157-
158-class cmd_fast_export_from_cvs(Command):
159- """Generate a fast-import file from a CVS repository.
160-
161- Destination is a dump file, typically named xxx.fi where xxx is
162- the name of the project. If '-' is given, standard output is used.
163-
164- cvs2svn 2.3 or later must be installed as its cvs2bzr script is used
165- under the covers to do the export.
166-
167- The source must be the path on your filesystem to the part of the
168- repository you wish to convert. i.e. either that path or a parent
169- directory must contain a CVSROOT subdirectory. The path may point to
170- either the top of a repository or to a path within it. In the latter
171- case, only that project within the repository will be converted.
172-
173- .. note::
174- Remote access to the repository is not sufficient - the path
175- must point into a copy of the repository itself. See
176- http://cvs2svn.tigris.org/faq.html#repoaccess for instructions
177- on how to clone a remote CVS repository locally.
178-
179- By default, the trunk, branches and tags are all exported. If you
180- only want the trunk, use the `--trunk-only` option.
181-
182- By default, filenames, log messages and author names are expected
183- to be encoded in ascii. Use the `--encoding` option to specify an
184- alternative. If multiple encodings are used, specify the option
185- multiple times. For a list of valid encoding names, see
186- http://docs.python.org/lib/standard-encodings.html.
187-
188- Windows users need to install GNU sort and use the `--sort`
189- option to specify its location. GNU sort can be downloaded from
190- http://unxutils.sourceforge.net/.
191- """
192- hidden = False
193- _see_also = ['fast-import', 'fast-import-filter']
194- takes_args = ['source', 'destination']
195- takes_options = ['verbose',
196- Option('trunk-only',
197- help="Export just the trunk, ignoring tags and branches."
198- ),
199- ListOption('encoding', type=str, argname='CODEC',
200- help="Encoding used for filenames, commit messages "
201- "and author names if not ascii."
202- ),
203- Option('sort', type=str, argname='PATH',
204- help="GNU sort program location if not on the path."
205- ),
206- ]
207- encoding_type = 'exact'
208- def run(self, source, destination, verbose=False, trunk_only=False,
209- encoding=None, sort=None):
210- load_fastimport()
211- from bzrlib.plugins.fastimport.exporters import fast_export_from
212- custom = []
213- if trunk_only:
214- custom.append("--trunk-only")
215- if encoding:
216- for enc in encoding:
217- custom.extend(['--encoding', enc])
218- if sort:
219- custom.extend(['--sort', sort])
220- fast_export_from(source, destination, 'cvs', verbose, custom)
221-
222-
223-class cmd_fast_export_from_darcs(Command):
224- """Generate a fast-import file from a Darcs repository.
225-
226- Destination is a dump file, typically named xxx.fi where xxx is
227- the name of the project. If '-' is given, standard output is used.
228-
229- Darcs 2.2 or later must be installed as various subcommands are
230- used to access the source repository. The source may be a network
231- URL but using a local URL is recommended for performance reasons.
232- """
233- hidden = False
234- _see_also = ['fast-import', 'fast-import-filter']
235- takes_args = ['source', 'destination']
236- takes_options = ['verbose',
237- Option('encoding', type=str, argname='CODEC',
238- help="Encoding used for commit messages if not utf-8."
239- ),
240- ]
241- encoding_type = 'exact'
242- def run(self, source, destination, verbose=False, encoding=None):
243- from bzrlib.plugins.fastimport.exporters import fast_export_from
244- custom = None
245- if encoding is not None:
246- custom = ['--encoding', encoding]
247- fast_export_from(source, destination, 'darcs', verbose, custom)
248-
249-
250-class cmd_fast_export_from_hg(Command):
251- """Generate a fast-import file from a Mercurial repository.
252-
253- Destination is a dump file, typically named xxx.fi where xxx is
254- the name of the project. If '-' is given, standard output is used.
255-
256- Mercurial 1.2 or later must be installed as its libraries are used
257- to access the source repository. Given the APIs currently used,
258- the source repository must be a local file, not a network URL.
259- """
260- hidden = False
261- _see_also = ['fast-import', 'fast-import-filter']
262- takes_args = ['source', 'destination']
263- takes_options = ['verbose']
264- encoding_type = 'exact'
265- def run(self, source, destination, verbose=False):
266- load_fastimport()
267- from bzrlib.plugins.fastimport.exporters import fast_export_from
268- fast_export_from(source, destination, 'hg', verbose)
269-
270-
271-class cmd_fast_export_from_git(Command):
272- """Generate a fast-import file from a Git repository.
273-
274- Destination is a dump file, typically named xxx.fi where xxx is
275- the name of the project. If '-' is given, standard output is used.
276-
277- Git 1.6 or later must be installed as the git fast-export
278- subcommand is used under the covers to generate the stream.
279- The source must be a local directory.
280-
281- .. note::
282-
283- Earlier versions of Git may also work fine but are
284- likely to receive less active support if problems arise.
285- """
286- hidden = False
287- _see_also = ['fast-import', 'fast-import-filter']
288- takes_args = ['source', 'destination']
289- takes_options = ['verbose']
290- encoding_type = 'exact'
291- def run(self, source, destination, verbose=False):
292- load_fastimport()
293- from bzrlib.plugins.fastimport.exporters import fast_export_from
294- fast_export_from(source, destination, 'git', verbose)
295-
296-
297-class cmd_fast_export_from_mtn(Command):
298- """Generate a fast-import file from a Monotone repository.
299-
300- Destination is a dump file, typically named xxx.fi where xxx is
301- the name of the project. If '-' is given, standard output is used.
302-
303- Monotone 0.43 or later must be installed as the mtn git_export
304- subcommand is used under the covers to generate the stream.
305- The source must be a local directory.
306- """
307- hidden = False
308- _see_also = ['fast-import', 'fast-import-filter']
309- takes_args = ['source', 'destination']
310- takes_options = ['verbose']
311- encoding_type = 'exact'
312- def run(self, source, destination, verbose=False):
313- load_fastimport()
314- from bzrlib.plugins.fastimport.exporters import fast_export_from
315- fast_export_from(source, destination, 'mtn', verbose)
316-
317-
318-class cmd_fast_export_from_p4(Command):
319- """Generate a fast-import file from a Perforce repository.
320-
321- Source is a Perforce depot path, e.g., //depot/project
322-
323- Destination is a dump file, typically named xxx.fi where xxx is
324- the name of the project. If '-' is given, standard output is used.
325-
326- bzrp4 must be installed as its p4_fast_export.py module is used under
327- the covers to do the export. bzrp4 can be downloaded from
328- https://launchpad.net/bzrp4/.
329-
330- The P4PORT environment variable must be set, and you must be logged
331- into the Perforce server.
332-
333- By default, only the HEAD changelist is exported. To export all
334- changelists, append '@all' to the source. To export a revision range,
335- append a comma-delimited pair of changelist numbers to the source,
336- e.g., '100,200'.
337- """
338- hidden = False
339- _see_also = ['fast-import', 'fast-import-filter']
340- takes_args = ['source', 'destination']
341- takes_options = []
342- encoding_type = 'exact'
343- def run(self, source, destination, verbose=False):
344- load_fastimport()
345- from bzrlib.plugins.fastimport.exporters import fast_export_from
346- custom = []
347- fast_export_from(source, destination, 'p4', verbose, custom)
348-
349-
350-class cmd_fast_export_from_svn(Command):
351- """Generate a fast-import file from a Subversion repository.
352-
353- Destination is a dump file, typically named xxx.fi where xxx is
354- the name of the project. If '-' is given, standard output is used.
355-
356- Python-Subversion (Python bindings to the Subversion APIs)
357- 1.4 or later must be installed as this library is used to
358- access the source repository. The source may be a network URL
359- but using a local URL is recommended for performance reasons.
360- """
361- hidden = False
362- _see_also = ['fast-import', 'fast-import-filter']
363- takes_args = ['source', 'destination']
364- takes_options = ['verbose',
365- Option('trunk-path', type=str, argname="STR",
366- help="Path in repo to /trunk.\n"
367- "May be `regex:/cvs/(trunk)/proj1/(.*)` in "
368- "which case the first group is used as the "
369- "branch name and the second group is used "
370- "to match files.",
371- ),
372- ]
373- encoding_type = 'exact'
374- def run(self, source, destination, verbose=False, trunk_path=None):
375- load_fastimport()
376- from bzrlib.plugins.fastimport.exporters import fast_export_from
377- custom = []
378- if trunk_path is not None:
379- custom.extend(['--trunk-path', trunk_path])
380- fast_export_from(source, destination, 'svn', verbose, custom)
381
382=== removed directory 'exporters'
383=== removed file 'exporters/Makefile'
384--- exporters/Makefile 2009-10-02 19:01:37 +0000
385+++ exporters/Makefile 1970-01-01 00:00:00 +0000
386@@ -1,15 +0,0 @@
387-SVN ?= /usr
388-CFLAGS += -I${SVN}/include/subversion-1 -pipe -O2 -std=c99
389-CFLAGS += `pkg-config --cflags apr-1`
390-LDFLAGS += -L${SVN}/lib -lsvn_fs-1 -lsvn_repos-1
391-LDFLAGS += `pkg-config --libs apr-1`
392-
393-all: svn-fast-export svn-archive
394-
395-svn-fast-export: svn-fast-export.c
396-svn-archive: svn-archive.c
397-
398-.PHONY: clean
399-
400-clean:
401- rm -rf svn-fast-export svn-archive
402
403=== removed file 'exporters/__init__.py'
404--- exporters/__init__.py 2011-10-06 00:11:52 +0000
405+++ exporters/__init__.py 1970-01-01 00:00:00 +0000
406@@ -1,326 +0,0 @@
407-# Copyright (C) 2009 Canonical Ltd
408-#
409-# This program is free software; you can redistribute it and/or modify
410-# it under the terms of the GNU General Public License as published by
411-# the Free Software Foundation; either version 2 of the License, or
412-# (at your option) any later version.
413-#
414-# This program is distributed in the hope that it will be useful,
415-# but WITHOUT ANY WARRANTY; without even the implied warranty of
416-# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
417-# GNU General Public License for more details.
418-#
419-# You should have received a copy of the GNU General Public License
420-# along with this program. If not, see <http://www.gnu.org/licenses/>.
421-
422-"""Simplified and unified access to the various xxx-fast-export tools."""
423-
424-
425-import gzip, os, subprocess, sys
426-
427-from bzrlib import errors
428-from bzrlib.trace import note, warning
429-
430-
431-class MissingDependency(Exception):
432-
433- def __init__(self, tool, minimum_version, missing):
434- self.tool = tool
435- self.minimum_version = minimum_version
436- self.missing = missing
437-
438- def get_message(self):
439- return "%s missing. Please install %s %s or later and try again." % \
440- (self.missing, self.tool, self.minimum_version)
441-
442-
443-class _Exporter(object):
444-
445- def check_install(self, tool_name, minimum_version, required_commands=None,
446- required_libraries=None):
447- """Check dependencies are correctly installed.
448-
449- :param tool_name: name of the tool
450- :param minimum_version: minimum version required
451- :param required_commands: list of commands that must be on the path
452- :param required_libraries: list of Python libraries that must be
453- available
454- :raises MissingDependency: if a required dependency is not found
455- """
456- self.tool_name = tool_name
457- self.minimum_version = minimum_version
458- if required_commands:
459- for cmd in required_commands:
460- self._check_cmd_available(cmd)
461- if required_libraries:
462- for lib in required_libraries:
463- self._check_lib_available(lib)
464-
465- def _check_cmd_available(self, cmd):
466- try:
467- if isinstance(cmd, str):
468- args = [cmd]
469- else:
470- args = cmd
471- retcode = subprocess.call(args, stdout=subprocess.PIPE,
472- stderr=subprocess.PIPE)
473- except OSError:
474- raise MissingDependency(self.tool_name, self.minimum_version, cmd)
475-
476- def _check_lib_available(self, lib):
477- try:
478- __import__(lib)
479- except ImportError:
480- raise MissingDependency(self.tool_name, self.minimum_version, lib)
481-
482- def generate(self, source, destination, verbose=False, custom=None):
483- """Generate a fast import stream.
484-
485- :param source: the source filename or URL
486- :param destination: filename or '-' for standard output
487- :param verbose: if True, output additional diagnostics
488- :param custom: a list of custom options to be added to the
489- command line of the underlying scripts used. If an option
490- and its argument are to be separated by a space, pass them
491- as consecutive items.
492- """
493- raise NotImplementedError(self.generate)
494-
495- def get_output_info(self, dest):
496- """Get the output streams/filenames given a destination filename.
497-
498- :return: outf, basename, marks where
499- outf is a file-like object for storing the output,
500- basename is the name without the .fi and .gz prefixes
501- marks is the name of the marks file to use, if any
502- """
503- if dest == '-':
504- return sys.stdout, None, None
505- else:
506- #if dest.endswith('.gz'):
507- # outf = gzip.open(dest, 'wb')
508- # base = dest[:-3]
509- #else:
510- outf = open(dest, 'w')
511- base = dest
512- if base.endswith(".fi"):
513- base = dest[:-3]
514- marks = "%s.marks" % (base,)
515- return outf, base, marks
516-
517- def execute(self, args, outf, cwd=None):
518- """Execute a command, capture the output and close files.
519-
520- :param args: list of arguments making up the command
521- :param outf: a file-like object for storing the output,
522- :param cwd: current working directory to use
523- :return: the return code
524- """
525- if cwd is not None:
526- note("Executing %s in directory %s ..." % (" ".join(args), cwd))
527- else:
528- note("Executing %s ..." % (" ".join(args),))
529- try:
530- p = subprocess.Popen(args, stdout=outf, cwd=cwd)
531- p.wait()
532- finally:
533- if outf != sys.stdout:
534- outf.close()
535- return p.returncode
536-
537- def report_results(self, retcode, destination):
538- """Report whether the export succeeded or otherwise."""
539- if retcode == 0:
540- note("Export to %s completed successfully." % (destination,))
541- else:
542- warning("Export to %s exited with error code %d."
543- % (destination, retcode))
544-
545- def execute_exporter_script(self, args, outf):
546- """Execute an exporter script, capturing the output.
547-
548- The script must be a Python script under the exporters directory.
549-
550- :param args: list of arguments making up the script, the first of
551- which is the script name relative to the exporters directory.
552- :param outf: a file-like object for storing the output,
553- :return: the return code
554- """
555- # Note: currently assume Python is on the path. We could work around
556- # this later (for Windows users say) by packaging the scripts as Python
557- # modules and calling their internals directly.
558- exporters_dir = os.path.dirname(__file__)
559- script_abspath = os.path.join(exporters_dir, args[0])
560- actual_args = ['python', script_abspath] + args[1:]
561- return self.execute(actual_args, outf)
562-
563-
564-class CvsExporter(_Exporter):
565-
566- def __init__(self):
567- self.check_install('cvs2svn', '2.30', ['cvs2bzr'])
568- self.check_install('CVS', '1.11', ['cvs'])
569-
570- def generate(self, source, destination, verbose=False, custom=None):
571- """Generate a fast import stream. See _Exporter.generate() for details."""
572- # TODO: pass a custom cvs2bzr-default.options file as soon as
573- # cvs2bzr handles --options along with others.
574- args = ["cvs2bzr", "--dumpfile", destination]
575- outf, base, marks = self.get_output_info(destination)
576- # Marks aren't supported by cvs2bzr so no need to set that option
577- if custom:
578- args.extend(custom)
579- args.append(source)
580- retcode = self.execute(args, outf)
581- self.report_results(retcode, destination)
582-
583-
584-class DarcsExporter(_Exporter):
585-
586- def __init__(self):
587- self.check_install('Darcs', '2.2', [('darcs', '--version')])
588-
589- def generate(self, source, destination, verbose=False, custom=None):
590- """Generate a fast import stream. See _Exporter.generate() for details."""
591- args = ["darcs/darcs-fast-export"]
592- outf, base, marks = self.get_output_info(destination)
593- if marks:
594- args.append('--export-marks=%s' % marks)
595- if custom:
596- args.extend(custom)
597- args.append(source)
598- retcode = self.execute_exporter_script(args, outf)
599- self.report_results(retcode, destination)
600-
601-
602-class MercurialExporter(_Exporter):
603-
604- def __init__(self):
605- self.check_install('Mercurial', '1.2', None, ['mercurial'])
606-
607- def generate(self, source, destination, verbose=False, custom=None):
608- """Generate a fast import stream. See _Exporter.generate() for details."""
609- # XXX: Should we add --force here?
610- args = ["hg-fast-export.py", "-r", source, "-s"]
611- outf, base, marks = self.get_output_info(destination)
612- if base:
613- args.append('--marks=%s.marks' % (base,))
614- args.append('--mapping=%s.mapping' % (base,))
615- args.append('--heads=%s.heads' % (base,))
616- args.append('--status=%s.status' % (base,))
617- if custom:
618- args.extend(custom)
619- retcode = self.execute_exporter_script(args, outf)
620- self.report_results(retcode, destination)
621-
622-
623-class GitExporter(_Exporter):
624-
625- def __init__(self):
626- self.cmd_name = "git"
627- if sys.platform == 'win32':
628- self.cmd_name = "git.cmd"
629- self.check_install('Git', '1.6', [self.cmd_name])
630-
631- def generate(self, source, destination, verbose=False, custom=None):
632- """Generate a fast import stream. See _Exporter.generate() for details."""
633- args = [self.cmd_name, "fast-export", "--all", "--signed-tags=warn"]
634- outf, base, marks = self.get_output_info(destination)
635- if marks:
636- marks = os.path.abspath(marks)
637- # Note: we don't pass import-marks because that creates
638- # a stream of incremental changes, not the full thing.
639- # We may support incremental output later ...
640- #if os.path.exists(marks):
641- # args.append('--import-marks=%s' % marks)
642- args.append('--export-marks=%s' % marks)
643- if custom:
644- args.extend(custom)
645- retcode = self.execute(args, outf, cwd=source)
646- self.report_results(retcode, destination)
647-
648-
649-class MonotoneExporter(_Exporter):
650-
651- def __init__(self):
652- self.check_install('Monotone', '0.43', ['mtn'])
653-
654- def generate(self, source, destination, verbose=False, custom=None):
655- """Generate a fast import stream. See _Exporter.generate() for details."""
656- args = ["mtn", "git_export"]
657- outf, base, marks = self.get_output_info(destination)
658- if marks:
659- marks = os.path.abspath(marks)
660- if os.path.exists(marks):
661- args.append('--import-marks=%s' % marks)
662- args.append('--export-marks=%s' % marks)
663- if custom:
664- args.extend(custom)
665- retcode = self.execute(args, outf, cwd=source)
666- self.report_results(retcode, destination)
667-
668-
669-class PerforceExporter(_Exporter):
670-
671- def __init__(self):
672- self.check_install('p4', '2009.1', ['p4'])
673- self.check_install('Perforce Python API', '2009.1', None, ['P4'])
674- self.check_install('bzrp4', '', None, ['bzrlib.plugins.bzrp4'])
675-
676- def generate(self, source, destination, verbose=False, custom=None):
677- """Generate a fast import stream. See _Exporter.generate() for details."""
678- from bzrlib.plugins.bzrp4 import p4_fast_export
679- outf, base, marks = self.get_output_info(destination)
680- # Marks aren't supported by p4_fast_export so no need to set that
681- # option
682- original_stdout = sys.stdout
683- sys.stdout = outf
684- try:
685- retcode = p4_fast_export.main([source])
686- finally:
687- sys.stdout = original_stdout
688- self.report_results(retcode, destination)
689-
690-
691-class SubversionExporter(_Exporter):
692-
693- def __init__(self):
694- self.check_install('Python Subversion', '1.4', None,
695- ['svn.fs', 'svn.core', 'svn.repos'])
696-
697- def generate(self, source, destination, verbose=False, custom=None):
698- """Generate a fast import stream. See _Exporter.generate() for details."""
699- args = ["svn-fast-export.py"]
700- outf, base, marks = self.get_output_info(destination)
701- # Marks aren't supported by svn-fast-export so no need to set that option
702- if custom:
703- args.extend(custom)
704- args.append(source)
705- retcode = self.execute_exporter_script(args, outf)
706- self.report_results(retcode, destination)
707-
708-
709-def fast_export_from(source, destination, tool, verbose=False, custom=None):
710- # Get the exporter
711- if tool == 'cvs':
712- factory = CvsExporter
713- elif tool == 'darcs':
714- factory = DarcsExporter
715- elif tool == 'hg':
716- factory = MercurialExporter
717- elif tool == 'git':
718- factory = GitExporter
719- elif tool == 'mtn':
720- factory = MonotoneExporter
721- elif tool == 'p4':
722- factory = PerforceExporter
723- elif tool == 'svn':
724- factory = SubversionExporter
725- try:
726- exporter = factory()
727- except MissingDependency, ex:
728- raise errors.BzrError(ex.get_message())
729-
730- # Do the export
731- exporter.generate(source, destination, verbose=verbose,
732- custom=custom)
733
734=== removed directory 'exporters/darcs'
735=== removed file 'exporters/darcs/.gitignore'
736--- exporters/darcs/.gitignore 2008-10-19 12:51:00 +0000
737+++ exporters/darcs/.gitignore 1970-01-01 00:00:00 +0000
738@@ -1,3 +0,0 @@
739-Changelog
740-HEADER.html
741-.htaccess
742
743=== removed file 'exporters/darcs/Makefile'
744--- exporters/darcs/Makefile 2009-06-25 21:47:09 +0000
745+++ exporters/darcs/Makefile 1970-01-01 00:00:00 +0000
746@@ -1,55 +0,0 @@
747-VERSION = 0.9
748-DATE := $(shell date +%Y-%m-%d)
749-
750-INSTALL = /usr/bin/install -c
751-DESTDIR =
752-prefix = /usr
753-bindir = $(prefix)/bin
754-mandir = $(prefix)/share/man/man1
755-
756-MAN_TXT = $(wildcard *.txt)
757-MAN_HTML=$(patsubst %.txt,%.html,$(MAN_TXT))
758-MAN=$(patsubst %.txt,%.1,$(MAN_TXT))
759-
760-PROGRAMS = darcs-fast-export darcs-fast-import d2x x2d git-darcs
761-
762-all: man
763-
764-install: all
765- $(INSTALL) -d $(DESTDIR)$(bindir)
766- $(INSTALL) -d $(DESTDIR)$(mandir)
767- $(INSTALL) -m755 $(PROGRAMS) $(DESTDIR)$(bindir)
768- $(INSTALL) -m644 *.1 $(DESTDIR)$(mandir)
769-
770-doc: HEADER.html Changelog html
771-
772-HEADER.html: README Makefile
773- asciidoc -a toc -a numbered -a sectids -o HEADER.html README
774-
775-Changelog: .git/refs/heads/master
776- git log >Changelog
777-
778-%.html: %.txt
779- asciidoc $^
780-
781-%.1: %.txt asciidoc.conf
782- a2x --asciidoc-opts="-f asciidoc.conf" \
783- -a dfe_version=$(VERSION) -a dfe_date=$(DATE) -f manpage $<
784-
785-man: $(MAN)
786-
787-html: $(MAN_HTML)
788-
789-dist:
790- git archive --format=tar --prefix=darcs-fast-export-$(VERSION)/ $(VERSION) > darcs-fast-export-$(VERSION).tar
791- mkdir -p darcs-fast-export-$(VERSION)
792- git log > darcs-fast-export-$(VERSION)/Changelog
793- tar rf darcs-fast-export-$(VERSION).tar darcs-fast-export-$(VERSION)/Changelog
794- rm -rf darcs-fast-export-$(VERSION)
795- gzip -f -9 darcs-fast-export-$(VERSION).tar
796-
797-release:
798- git tag -l |grep -q $(VERSION) || dg tag $(VERSION)
799- $(MAKE) dist
800- gpg --comment "See http://vmiklos.hu/gpg/ for info" \
801- -ba darcs-fast-export-$(VERSION).tar.gz
802
803=== removed file 'exporters/darcs/NEWS'
804--- exporters/darcs/NEWS 2009-06-25 21:47:09 +0000
805+++ exporters/darcs/NEWS 1970-01-01 00:00:00 +0000
806@@ -1,26 +0,0 @@
807-VERSION DESCRIPTION
808------------------------------------------------------------------------------
809-0.9 - fix handling of accents in tag names
810- - warning fixes for Python-2.6
811- - git-darcs: the add subcommand can now remember d-f-e
812- options
813- - git-darcs: new list, find-darcs and find-git subcommands
814-0.8 - revert the "not exporting unchanged files multiple
815- times" optimization, it causes corrupted results in some
816- cases.
817-0.7 - new darcs-fast-export option: --progress
818- - massive speedup in darcs-fast-export due to not
819- exporting unchanged files multiple times and reading
820- patches directly
821-0.6 - add a new darcs-fast-import script, allowing two-way sync
822- - new darcs-fast-export option: --git-branch
823- - add a new git-darcs script, making two-way sync easy
824-0.5 - new --help, --encoding, --authors-file, --working and
825- --logfile options
826- - add "hashed" support (see darcs init -h)
827- - add incremental conversion support for darcs1 as well
828- - add d2x wrapper script
829-0.4 - add incremental conversion support
830-0.3 - add darcs2 support
831-0.2 - add bzr and hg support
832-0.1 - initial short and fast version, supporting darcs1->git
833
834=== removed file 'exporters/darcs/README'
835--- exporters/darcs/README 2009-09-09 01:12:40 +0000
836+++ exporters/darcs/README 1970-01-01 00:00:00 +0000
837@@ -1,187 +0,0 @@
838-= darcs backend for fast data importers
839-Miklos Vajna <vmiklos-at-frugalware-dot-org>
840-
841-== Purpose and Features
842-
843-darcs-fast-export is a tool to dump a http://darcs.net/[darcs]
844-repository in a format understood by "fast-importers" such as
845-http://git.or.cz/[git]
846-http://www.kernel.org/pub/software/scm/git/docs/git-fast-import.html[fast-import].
847-It exhibits the following _features:_
848-
849-Fast::
850- darcs-fast-export provides a fast darcs backend for fast-import.
851- See link:t/bench-results/[here] for exact details.
852-
853-Correct::
854- darcs-fast-export produces correct results in any extreme cases.
855- It has been tested with a collection of large darcs repos (called
856- http://code.haskell.org/darcs/big-zoo/[big-zoo]). And several testcases
857- under the `t/` directory.
858-
859-Independent::
860- Ideally it should work with any fast importer, but actually it has been
861- tested with git fast-import, bzr fast-import and hg fastimport. (These
862- are the three fast-import implementations available ATM.)
863-
864-Formats::
865- It supports the 'darcs-2', 'hashed', and 'old-fashioned-inventory' darcs
866- repository formats.
867-
868-Incremental conversions::
869- It supports the usual `--export-marks` / `--import-marks` switches to
870- allow incremental conversion.
871-
872-Wrapper scripts::
873- A wrapper script called `d2x` is available if you find typing
874- `--export-marks` / `--import-marks` all the time boring. A similar one
875- is also provided for the other direction, called `x2d`. Finally, if you
876- want to work on darcs repos with git, you can use the `git-darcs`
877- wrapper.
878-
879-Author mappings::
880- Supports `--authors-file` option like Git's SVN adaptor, for DARCS
881- repositories that originated in CVS or SVN.
882-
883-Import script::
884- The pair of `darcs-fast-export`, `darcs-fast-import` is also
885- included in this repo. It has been tested with the fast-expoters of Git,
886- Hg, Bzr and - of course - Darcs itself.
887-
888-Two-way sync::
889- Using `darcs-fast-export` / `darcs-fast-import`, it is possible to
890- convert a darcs repo to an other VCS, work there, then convert your work
891- back to Darcs (or vica versa). This has been tested with "darcs -> git;
892- hack hack; git -> darcs".
893-
894-== Usage
895-
896-See the manpages:
897-
898-* link:darcs-fast-export.html[darcs-fast-export]
899-* link:darcs-fast-import.html[darcs-fast-import]
900-* link:d2x.html[d2x]
901-* link:x2d.html[x2d]
902-* link:git-darcs.html[git-darcs]
903-
904-=== Example
905-
906-Assuming that `test/` is a darcs repo, you could do this:
907-----
908-$ mkdir test.git
909-$ cd test.git
910-$ git --bare init
911-$ cd ..
912-$ darcs-fast-export test |(cd test.git; git fast-import)
913-----
914-
915-For more examples (especially for bzr and hg), see the `t/` directory.
916-
917-== Download
918-
919-Using git:
920-----
921-$ git clone git://vmiklos.hu/darcs-fast-export
922-----
923-
924-== Status
925-
926-In general, darcs-fast-export should work fine. darcs-fast-import has
927-known problems with tags - other than that it should be okay. git-darcs
928-should work properly as long as you are not paying too much attention to
929-the imported tags (newly created tags won't be pushed back).
930-
931-darcs-fast-export has been tested with the following versions:
932-
933-Darcs version (see http://bugs.darcs.net/issue844[this bug] on why do
934-you need such a new version):
935-----
936-$ darcs --version
937-2.2.0 (release)
938-----
939-
940-Git version:
941-----
942-$ git --version
943-git version 1.6.0.2
944-----
945-
946-Bzr versions:
947-----
948-$ bzr version
949-Bazaar (bzr) 1.12
950-$ (cd ~/bzr/fastimport; bzr log --limit 1|grep revno)
951-revno: 181
952-----
953-
954-Yes, you need the fastiport plugin from BZR, the last hg release series
955-supported by fastimport-0.6 is hg-1.0.x.
956-
957-Mercurial (Hg) version:
958-----
959-$ hg version
960-Mercurial Distributed SCM (version 1.3)
961-----
962-
963-Strictly speaking this document is a wrong place to talk about
964-configuring hg fastimport. However... you will need something like:
965-
966-----
967-$ hg clone http://vc.gerg.ca/hg/pyfastimport
968-$ hg clone http://vc.gerg.ca/hg/hg-fastimport
969-$ sudo ln -s /path/to/pyfastimport/fastimport /usr/lib/python2.6/site-packages/fastimport
970-$ sudo ln -s /path/to/hg-fastimport/hgfastimport /usr/lib/python2.6/site-packages/hgfastimport
971-echo -e "[extensions]\nfastimport = /usr/lib/python2.6/site-packages/hgfastimport" > ~/.hgrc
972-----
973-
974-and once you installed the plugin correctly, you should have something like:
975-
976-----
977-$ ls /usr/lib/python*/site-packages/hgext/fastimport/__init__.py
978-/usr/lib/python2.5/site-packages/hgext/fastimport/__init__.py
979-----
980-
981-== Additional resources
982-
983-You can reach the Changelog link:Changelog[here], and a gitweb interface
984-http://vmiklos.hu/gitweb/?p=darcs-fast-export.git[here].
985-
986-The fast-import stream format documentation is
987-http://git.kernel.org/?p=git/git.git;a=blob;f=fast-import.c;hb=HEAD[here]
988-if you're interested.
989-
990-== Alternatives
991-
992-- http://repo.or.cz/w/darcs2git.git[darcs2git] tries to find conflict
993- resolutions (to map them to merge commits), but it's rather slow
994- because of this. It does not support the darcs2 format and/or
995- incremental conversions, either. darcs-fast-export may support mapping
996- to merge commits later, but not before
997- http://bugs.darcs.net/issue1261[this issue] is addressed.
998-
999-- http://progetti.arstecnica.it/tailor[tailor] is an any2any VCS
1000- converter, but it produces corrupted results when converting the
1001- big-zoo - see http://progetti.arstecnica.it/tailor/ticket/171[this
1002- ticket].
1003-
1004-- http://git.sanityinc.com/?p=darcs-to-git.git[darcs-to-git] is similar
1005- to darcs2git, but it fails for the testcases found in the testsuite of
1006- darcs-fast-export.
1007-
1008-- http://github.com/freshtonic/undarcs/tree/master[undarcs] claims to be
1009- fast, but its own README says it produces incorrect results. When I
1010- tried, it did not handle the darcs2 format, binary files and incremental
1011- support.
1012-
1013-== Thanks
1014-
1015-- Jason Dagit for helping me with darcs2 issues
1016-- Shawn O. Pearce and Johannes Schindelin for writing `git-fast-import`
1017- / `git-fast-export`
1018-- Ian Clatworthy for writing bzr fast-import
1019-- Paul Crowley for writing hg fast-import
1020-- Matthias Andree for assorted improvements, among them the --help,
1021- --encoding and --authors-file features (using Python's optparse), support
1022- for hashed repositories, `_darcs/format` interpretation, and mangling
1023- whitespace in tags to cope with repos imported into DARCS from CVS.
1024-- Pieter de Bie for writing git-bzr, which was the base of git-darcs
1025
1026=== removed file 'exporters/darcs/TODO'
1027--- exporters/darcs/TODO 2010-06-27 23:21:13 +0000
1028+++ exporters/darcs/TODO 1970-01-01 00:00:00 +0000
1029@@ -1,8 +0,0 @@
1030-more intelligent tests, such as detect if the hg fastimport extension is
1031-not enabled, etc.
1032-
1033-parse the patches manually so we can avoid re-adding existing files manually.
1034-
1035-avoid darcs apply.
1036-
1037-import: handle evil merges (git-subtree), maybe using git log --first-parent
1038
1039=== removed file 'exporters/darcs/asciidoc.conf'
1040--- exporters/darcs/asciidoc.conf 2008-12-22 23:48:45 +0000
1041+++ exporters/darcs/asciidoc.conf 1970-01-01 00:00:00 +0000
1042@@ -1,21 +0,0 @@
1043-ifdef::doctype-manpage[]
1044-ifdef::backend-docbook[]
1045-[header]
1046-template::[header-declarations]
1047-<refentry>
1048- <refentryinfo>
1049- <date>{dfe_date}</date>
1050- </refentryinfo>
1051- <refmeta>
1052- <refentrytitle>{mantitle}</refentrytitle>
1053- <manvolnum>{manvolnum}</manvolnum>
1054- <refmiscinfo class="source">darcs-fast-export</refmiscinfo>
1055- <refmiscinfo class="version">{dfe_version}</refmiscinfo>
1056- <refmiscinfo class="manual">darcs-fast-export manual</refmiscinfo>
1057- </refmeta>
1058- <refnamediv>
1059- <refname>{manname}</refname>
1060- <refpurpose>{manpurpose}</refpurpose>
1061- </refnamediv>
1062-endif::backend-docbook[]
1063-endif::doctype-manpage[]
1064
1065=== removed file 'exporters/darcs/d2x'
1066--- exporters/darcs/d2x 2011-10-06 00:11:52 +0000
1067+++ exporters/darcs/d2x 1970-01-01 00:00:00 +0000
1068@@ -1,112 +0,0 @@
1069-#!/bin/sh
1070-#
1071-# d2x - convert darcs repos to git, bzr or hg using fast-import
1072-#
1073-# Copyright (c) 2008 by Miklos Vajna <vmiklos@frugalware.org>
1074-#
1075-# This program is free software; you can redistribute it and/or modify
1076-# it under the terms of the GNU General Public License as published by
1077-# the Free Software Foundation; either version 2 of the License, or
1078-# (at your option) any later version.
1079-#
1080-# This program is distributed in the hope that it will be useful,
1081-# but WITHOUT ANY WARRANTY; without even the implied warranty of
1082-# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
1083-# GNU General Public License for more details.
1084-#
1085-# You should have received a copy of the GNU General Public License
1086-# along with this program. If not, see <http://www.gnu.org/licenses/>.
1087-#
1088-
1089-usage()
1090-{
1091- echo "Usage: d2x -f format darcsrepo"
1092-}
1093-
1094-die()
1095-{
1096- echo "$@"
1097- usage
1098- exit 1
1099-}
1100-
1101-check_up_to_date()
1102-{
1103- upstreamnum=$(cd $origin; darcs show repo|grep 'Num Patches'|sed 's/.*: //')
1104- if [ "$upstreamnum" = "$(eval $*)" ]; then
1105- echo "No remote changes to pull!"
1106- exit 0
1107- fi
1108-}
1109-
1110-case $1 in
1111- -h|--help)
1112- usage
1113- exit 0
1114- ;;
1115- -f)
1116- format="$2"
1117- shift 2
1118- ;;
1119-esac
1120-
1121-[ -n "$format" ] || die "Target format is not given!"
1122-
1123-case $format in
1124- git|bzr|hg)
1125- ;;
1126- *)
1127- die "The requested target format is not yet supported!"
1128- ;;
1129-esac
1130-
1131-origin="$1"
1132-shift 1
1133-
1134-[ -d "$origin" ] || die "Source repo does not exist!"
1135-
1136-# convert to abspath
1137-cd $origin
1138-origin=$(pwd)
1139-
1140-dmark="$origin.$format/darcs/dfe-marks"
1141-fmark="$origin.$format/darcs/ffi-marks"
1142-
1143-mkdir -p $origin.$format/darcs
1144-cd $origin.$format
1145-
1146-common_opts="--working $origin.$format/darcs/repo --logfile $origin.$format/darcs/log $origin"
1147-if [ ! -f $dmark ]; then
1148- case $format in
1149- git)
1150- git --bare init
1151- darcs-fast-export $* --export-marks=$dmark $common_opts | \
1152- git fast-import --export-marks=$fmark
1153- ;;
1154- bzr)
1155- bzr init-repo .
1156- darcs-fast-export $* --export-marks=$dmark $common_opts | \
1157- bzr fast-import --export-marks=$fmark -
1158- ;;
1159- hg)
1160- hg init
1161- darcs-fast-export $* $origin | \
1162- hg fastimport -
1163- esac
1164-else
1165- case $format in
1166- git)
1167- check_up_to_date "git rev-list HEAD |wc -l"
1168- darcs-fast-export $* --export-marks=$dmark --import-marks=$dmark $common_opts | \
1169- git fast-import --export-marks=$fmark --import-marks=$fmark
1170- ;;
1171- bzr)
1172- check_up_to_date "cd master; bzr revno"
1173- darcs-fast-export $* --export-marks=$dmark --import-marks=$dmark $common_opts | \
1174- bzr fast-import --export-marks=$fmark --import-marks=$fmark -
1175- ;;
1176- hg)
1177- die "Incremental conversion to hg is not yet supported by hg fastimport."
1178- ;;
1179- esac
1180-fi
1181
1182=== removed file 'exporters/darcs/d2x.txt'
1183--- exporters/darcs/d2x.txt 2008-11-27 13:36:26 +0000
1184+++ exporters/darcs/d2x.txt 1970-01-01 00:00:00 +0000
1185@@ -1,27 +0,0 @@
1186-= d2x(1)
1187-
1188-== NAME
1189-
1190-d2x - convert darcs repos to git, bzr or hg using fast-import
1191-
1192-== SYNOPSIS
1193-
1194-d2x -f <format> <darcsrepo> [<darcs-fast-export options>]
1195-
1196-== DESCRIPTION
1197-
1198-d2x is a wrapper script that just automates doing an initial or
1199-continuing an incremental conversion. All it does is initializing the
1200-target repo, starting darcs-fast-export and the relevant importer with
1201-the proper switches and pipe the exporter's output to the importer's
1202-standard input.
1203-
1204-== OPTIONS
1205-
1206---help::
1207- Display usage.
1208-
1209--f <format>::
1210- Specify the format of the target repo. Currently supported targets are
1211- git, bzr and hg. Incremental conversion is supported in case of git and
1212- bzr.
1213
1214=== removed file 'exporters/darcs/darcs-fast-export'
1215--- exporters/darcs/darcs-fast-export 2010-11-09 00:01:12 +0000
1216+++ exporters/darcs/darcs-fast-export 1970-01-01 00:00:00 +0000
1217@@ -1,380 +0,0 @@
1218-#!/usr/bin/env python
1219-
1220-"""
1221-
1222- darcs-fast-export - darcs backend for fast data importers
1223-
1224- Copyright (c) 2008, 2009 Miklos Vajna <vmiklos@frugalware.org>
1225- Copyright (c) 2008 Matthias Andree <matthias.andree@gmx.de>
1226-
1227- This program is free software; you can redistribute it and/or modify
1228- it under the terms of the GNU General Public License as published by
1229- the Free Software Foundation; either version 2, or (at your option)
1230- any later version.
1231-
1232- This program is distributed in the hope that it will be useful,
1233- but WITHOUT ANY WARRANTY; without even the implied warranty of
1234- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
1235- GNU General Public License for more details.
1236-
1237- You should have received a copy of the GNU General Public License
1238- along with this program; if not, write to the Free Software
1239- Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
1240-
1241-"""
1242-
1243-import xml.dom.minidom
1244-import xml.parsers.expat
1245-import os
1246-import sys
1247-import gzip
1248-import time
1249-import calendar
1250-import shutil
1251-import subprocess
1252-import optparse
1253-import re
1254-import urllib
1255-import urllib2
1256-import StringIO
1257-
1258-sys = reload(sys)
1259-sys.setdefaultencoding("utf-8")
1260-
1261-class Handler:
1262- def __init__(self):
1263- self.hashes = []
1264- self.authormap = {}
1265- self.export_marks = []
1266- self.import_marks = []
1267-
1268- def get_patchname(self, patch):
1269- ret = []
1270- s = ""
1271- if patch.attributes['inverted'].value == 'True':
1272- s = "UNDO: "
1273- cs = patch.getElementsByTagName("name")[0].childNodes
1274- if cs.length > 0:
1275- ret.append(s + cs[0].data)
1276- lines = patch.getElementsByTagName("comment")
1277- if lines:
1278- for i in lines[0].childNodes[0].data.split('\n'):
1279- if not i.startswith("Ignore-this: "):
1280- ret.append(i)
1281- return "\n".join(ret).encode('utf-8')
1282-
1283- def get_author(self, patch):
1284- """darcs allows any freeform string, but fast-import has a more
1285- strict format, so fix up broken author names here."""
1286-
1287- author = patch.attributes['author'].value
1288- if author in self.authormap:
1289- author = self.authormap[author]
1290- if not len(author):
1291- author = "darcs-fast-export <darcs-fast-export>"
1292- # add missing name
1293- elif not ">" in author:
1294- author = "%s <%s>" % (author.split('@')[0], author)
1295- # avoid double quoting
1296- elif author[0] == '"' and author[-1] == '"':
1297- author = author[1:-1]
1298- # name after email
1299- elif author[-1] != '>':
1300- author = author[author.index('>')+2:] + ' ' + author[:author.index('>')+1]
1301- return author.encode('utf-8')
1302-
1303- def get_date(self, patch):
1304- try:
1305- date = time.strptime(patch, "%Y%m%d%H%M%S")
1306- except ValueError:
1307- date = time.strptime(patch[:19] + patch[-5:], '%a %b %d %H:%M:%S %Y')
1308- return calendar.timegm(date)
1309-
1310- def progress(self, s):
1311- print "progress [%s] %s" % (time.strftime("%Y-%m-%d %H:%M:%S", time.localtime()), s)
1312- sys.stdout.flush()
1313-
1314- def log(self, s):
1315- self.logsock.write("[%s] %s" % (time.strftime("%Y-%m-%d %H:%M:%S", time.localtime()), s))
1316- self.logsock.flush()
1317-
1318- def parse_inventory(self, sock=None):
1319- prev = None
1320- nextprev = False
1321- buf = []
1322- if not sock:
1323- sock = self.open(os.path.join(self.origin, "_darcs", "hashed_inventory"))
1324- for i in sock.readlines():
1325- if i.startswith("hash"):
1326- buf.insert(0, i[6:-1])
1327- if i.startswith("Starting with inventory:"):
1328- nextprev = True
1329- elif nextprev:
1330- prev = i[:-1]
1331- nextprev = False
1332- sock.close()
1333- for i in buf:
1334- self.hashes.insert(0, i)
1335- if prev:
1336- sock = self.gzip_open(os.path.join(self.origin, "_darcs", "inventories", prev))
1337- self.parse_inventory(sock)
1338-
1339- # this is like gzip.open but supports urls as well
1340- def gzip_open(self, path):
1341- if os.path.exists(path):
1342- return gzip.open(path)
1343- buf = urllib.urlopen(path).read()
1344- sock = StringIO.StringIO(buf)
1345- return gzip.GzipFile(fileobj=sock)
1346-
1347- # this is like os.path.exists but supports urls as well
1348- def path_exists(self, path):
1349- if os.path.exists(path):
1350- return True
1351- else:
1352- try:
1353- urllib2.urlopen(urllib2.Request(path))
1354- return True
1355- except urllib2.HTTPError, e:
1356- return False
1357-
1358- # this is like open, but supports urls as well
1359- def open(self, path):
1360- if os.path.exists(path):
1361- return open(path)
1362- else:
1363- return urllib.urlopen(path)
1364-
1365- def handle_opts(self):
1366- # Option Parser
1367- usage="%prog [options] darcsrepo"
1368- opp = optparse.OptionParser(usage=usage)
1369- opp.add_option("--import-marks", metavar="IFILE",
1370- help="read state for incremental imports from IFILE")
1371- opp.add_option("--export-marks", metavar="OFILE",
1372- help="write state for incremental imports from OFILE")
1373- opp.add_option("--encoding",
1374- help="encoding of log [default: %default], if unspecified and input isn't utf-8, guess")
1375- opp.add_option("--authors-file", metavar="F",
1376- help="read author transformations in old=new format from F")
1377- opp.add_option("--working", metavar="W",
1378- help="working directory which is removed at the end of non-incremental conversions")
1379- opp.add_option("--logfile", metavar="L",
1380- help="log file which contains the output of external programs invoked during the conversion")
1381- opp.add_option("--git-branch", metavar="B",
1382- help="git branch [default: refs/heads/master]")
1383- opp.add_option("--progress", metavar="P",
1384- help="insert progress statements after every n commit [default: 100]")
1385- (self.options, self.args) = opp.parse_args()
1386- if len(self.args) < 1:
1387- opp.error("darcsrepo required")
1388-
1389- # read author mapping file in gitauthors format,
1390- # i. e. in=out (one per # line)
1391- if self.options.authors_file:
1392- sock = open(self.options.authors_file)
1393- self.authormap = dict([i.strip().split('=',1) for i in sock])
1394- sock.close()
1395-
1396- if "://" not in self.args[0]:
1397- self.origin = os.path.abspath(self.args[0])
1398- else:
1399- self.origin = self.args[0].strip('/')
1400- if self.options.working:
1401- self.working = os.path.abspath(self.options.working)
1402- else:
1403- if "://" not in self.origin:
1404- self.working = "%s.darcs" % self.origin
1405- else:
1406- self.working = "%s.darcs" % os.path.split(self.origin)[-1]
1407- if self.options.logfile:
1408- logfile = os.path.abspath(self.options.logfile)
1409- else:
1410- if "://" not in self.origin:
1411- logfile = "%s.log" % self.origin
1412- else:
1413- logfile = "%s.log" % os.path.split(self.origin)[-1]
1414- self.logsock = open(logfile, "a")
1415- if self.options.git_branch:
1416- self.git_branch = self.options.git_branch
1417- else:
1418- self.git_branch = "refs/heads/master"
1419-
1420- if self.options.progress:
1421- self.prognum = int(self.options.progress)
1422- else:
1423- self.prognum = 100
1424-
1425- def handle_import_marks(self):
1426- if self.options.import_marks:
1427- sock = open(self.options.import_marks)
1428- for i in sock.readlines():
1429- line = i.strip()
1430- if not len(line):
1431- continue
1432- self.import_marks.append(line.split(' ')[1])
1433- self.export_marks.append(line)
1434- sock.close()
1435-
1436- def get_patches(self):
1437- self.progress("getting list of patches")
1438- if not len(self.import_marks):
1439- sock = os.popen("darcs changes --xml --reverse --repo %s" % self.origin)
1440- else:
1441- sock = os.popen("darcs changes --xml --reverse --repo %s --from-match 'hash %s'" % (self.origin, self.import_marks[-1]))
1442- buf = sock.read()
1443- sock.close()
1444- # this is hackish. we need to escape some bad chars, otherwise the xml
1445- # will not be valid
1446- buf = buf.replace('\x1b', '^[')
1447- if self.options.encoding:
1448- xmldoc = xml.dom.minidom.parseString(unicode(buf, self.options.encoding).encode('utf-8'))
1449- else:
1450- try:
1451- xmldoc = xml.dom.minidom.parseString(buf)
1452- except xml.parsers.expat.ExpatError:
1453- try:
1454- import chardet
1455- except ImportError:
1456- sys.exit("Error, encoding is not utf-8. Please " +
1457- "either specify it with the --encoding " +
1458- "option or install chardet.")
1459- self.progress("encoding is not utf8, guessing charset")
1460- encoding = chardet.detect(buf)['encoding']
1461- self.progress("detected encoding is %s" % encoding)
1462- xmldoc = xml.dom.minidom.parseString(unicode(buf, encoding).encode('utf-8'))
1463- sys.stdout.flush()
1464- return xmldoc.getElementsByTagName('patch')
1465-
1466- def setup_workdir(self):
1467- darcs2 = False
1468- self.oldfashionedpatch = True
1469- self.cwd = os.getcwd()
1470- if self.path_exists(os.path.join(self.origin, "_darcs", "format")):
1471- sock = self.open(os.path.join(self.origin, "_darcs", "format"))
1472- format = [x.strip() for x in sock]
1473- sock.close()
1474- darcs2 = 'darcs-2' in format
1475- self.oldfashionedpatch = not 'hashed' in format
1476- if not self.oldfashionedpatch:
1477- self.progress("parsing the inventory")
1478- if "://" not in self.origin:
1479- os.chdir(self.origin)
1480- self.parse_inventory()
1481- if not self.options.import_marks or not os.path.exists(self.working):
1482- # init the tmp darcs repo
1483- os.mkdir(self.working)
1484- os.chdir(self.working)
1485- if darcs2:
1486- os.system("darcs init --darcs-2")
1487- else:
1488- os.system("darcs init --old-fashioned-inventory")
1489- else:
1490- os.chdir(self.working)
1491- if self.options.import_marks:
1492- sock = os.popen("darcs pull -a --match 'hash %s' %s" % (self.import_marks[-1], self.origin))
1493- self.log("Building/updating working directory:\n%s" % sock.read())
1494- sock.close()
1495-
1496- def export_patches(self):
1497- patches = self.get_patches()
1498- # this is the number of the NEXT patch
1499- count = 1
1500- if len(self.import_marks):
1501- patches = patches[1:]
1502- count = len(self.import_marks) + 1
1503- if len(self.export_marks):
1504- # this is the mark number of the NEXT patch
1505- markcount = int(self.export_marks[-1].split(' ')[0][1:]) + 1
1506- else:
1507- markcount = count
1508- # this may be huge and we need it many times
1509- patchnum = len(patches)
1510-
1511- if not len(self.import_marks):
1512- self.progress("starting export, repo has %d patches" % patchnum)
1513- else:
1514- self.progress("continuing export, %d patches to convert" % patchnum)
1515- paths = []
1516- for i in patches:
1517- # apply the patch
1518- hash = i.attributes['hash'].value
1519- buf = ["\nNew patches:\n"]
1520- if self.oldfashionedpatch:
1521- sock = self.gzip_open(os.path.join(self.origin, "_darcs", "patches", hash))
1522- else:
1523- sock = self.gzip_open(os.path.join(self.origin, "_darcs", "patches", self.hashes[count-1]))
1524- buf.append(sock.read())
1525- sock.close()
1526- sock = os.popen("darcs changes --context")
1527- buf.append(sock.read())
1528- sock.close()
1529- sock = subprocess.Popen(["darcs", "apply", "--allow-conflicts"], stdin=subprocess.PIPE, stdout=subprocess.PIPE)
1530- sock.stdin.write("".join(buf))
1531- sock.stdin.close()
1532- self.log("Applying %s:\n%s" % (hash, sock.stdout.read()))
1533- sock.stdout.close()
1534- message = self.get_patchname(i)
1535- # export the commit
1536- print "commit %s" % self.git_branch
1537- print "mark :%s" % markcount
1538- if self.options.export_marks:
1539- self.export_marks.append(":%s %s" % (markcount, hash))
1540- date = self.get_date(i.attributes['date'].value)
1541- print "committer %s %s +0000" % (self.get_author(i), date)
1542- print "data %d\n%s" % (len(message), message)
1543- if markcount > 1:
1544- print "from :%s" % (markcount-1)
1545- # export the files
1546- for j in paths:
1547- print "D %s" % j
1548- paths = []
1549- for (root, dirs, files) in os.walk ("."):
1550- for f in files:
1551- j = os.path.normpath(os.path.join(root, f))
1552- if j.startswith("_darcs") or "-darcs-backup" in j:
1553- continue
1554- paths.append(j)
1555- sock = open(j)
1556- buf = sock.read()
1557- sock.close()
1558- # darcs does not track the executable bit :/
1559- print "M 644 inline %s" % j
1560- print "data %s\n%s" % (len(buf), buf)
1561- if message[:4] == "TAG ":
1562- tag = re.sub('[^\xe9-\xf8\w.\-]+', '_', message[4:].strip().split('\n')[0]).strip('_')
1563- print "tag %s" % tag
1564- print "from :%s" % markcount
1565- print "tagger %s %s +0000" % (self.get_author(i), date)
1566- print "data %d\n%s" % (len(message), message)
1567- if count % self.prognum == 0:
1568- self.progress("%d/%d patches" % (count, patchnum))
1569- count += 1
1570- markcount += 1
1571-
1572- os.chdir(self.cwd)
1573-
1574- if not self.options.export_marks:
1575- shutil.rmtree(self.working)
1576- self.logsock.close()
1577-
1578- def handle_export_marks(self):
1579- if self.options.export_marks:
1580- self.progress("writing export marks")
1581- sock = open(self.options.export_marks, 'w')
1582- sock.write("\n".join(self.export_marks))
1583- sock.write("\n")
1584- sock.close()
1585-
1586- self.progress("finished")
1587-
1588- def handle(self):
1589- self.handle_opts()
1590- self.handle_import_marks()
1591- self.setup_workdir()
1592- self.export_patches()
1593- self.handle_export_marks()
1594-
1595-if __name__ == "__main__":
1596- h = Handler()
1597- h.handle()
1598
1599=== removed file 'exporters/darcs/darcs-fast-export.txt'
1600--- exporters/darcs/darcs-fast-export.txt 2009-10-22 10:25:39 +0000
1601+++ exporters/darcs/darcs-fast-export.txt 1970-01-01 00:00:00 +0000
1602@@ -1,68 +0,0 @@
1603-= darcs-fast-export(1)
1604-
1605-== NAME
1606-
1607-darcs-fast-export - darcs frontend to git fast-import
1608-
1609-== SYNOPSIS
1610-
1611-darcs-fast-export [<options>] <darcsrepo>
1612-
1613-== DESCRIPTION
1614-
1615-darcs-fast-export expects one argument, the path to the source darcs
1616-repository. It will print the git fast-import format on standard output
1617-(stdout).
1618-
1619-The script can produce the fast-import stream format from the darcs
1620-repository. It supports incremental conversion as well, via the
1621---import-marks / --export-marks switches.
1622-
1623-Optionally the darcsrepo string may be a HTTP repository, in that case
1624-only the patches are downloaded, not the pristine, speeding up a
1625-one-time import.
1626-
1627-== OPTIONS
1628-
1629--h, --help::
1630- Display usage.
1631-
1632---import-marks=<file>::
1633- Import marks from <file>. This is read at the beginning of the
1634- conversion at once. Use it if you want to continue an incremental
1635- conversion.
1636-
1637---export-marks=<file>::
1638- Export marks to <file> at the end of the conversion. It can be the
1639- same as the one for --import-marks as it is written only once at the
1640- end. Use it if you want to be able to incrementally update the target
1641- repository later.
1642-
1643---encoding=<encoding>::
1644- The encoding of the author names and commit messages in the repository.
1645- The default is utf-8. If it is not the default, it will be guessed.
1646- Given that it takes some time, you can explicitly specify it as an
1647- option to make the conversion faster. Content in the output will encoded
1648- as utf-8 and will be written that way to the target repository, unless
1649- the importer re-encodes it again to some other character set.
1650-
1651---working=<directory>::
1652- The conversion is done by applying the patches one by one and recording
1653- the state of the working directory. You can specify the path of this
1654- directory using this option.
1655-
1656---logfile=<logfile>::
1657- The output of external commands are redirected to a log file. You can
1658- specify the path of that file with this parameter.
1659-
1660---git-branch=<branch>::
1661- There is only one branch in one darcs repository, but the fast-import
1662- stream format allows multiple branches, thus the exporter has to name
1663- darcs's branch. The default value is 'refs/heads/master'.
1664-
1665---progress=<n>::
1666- Insert progress statements after every <n> patches, to be shown by the
1667- fast importer during import. The default value is '100'.
1668-
1669---authors-file=<file>::
1670- Read author transformations in old=new format from <file>.
1671
1672=== removed file 'exporters/darcs/darcs-fast-import'
1673--- exporters/darcs/darcs-fast-import 2010-07-28 01:33:33 +0000
1674+++ exporters/darcs/darcs-fast-import 1970-01-01 00:00:00 +0000
1675@@ -1,375 +0,0 @@
1676-#!/usr/bin/env python
1677-
1678-"""
1679-
1680- darcs-fast-export - darcs backend for fast data exporters
1681-
1682- Copyright (c) 2008, 2009, 2010 Miklos Vajna <vmiklos@frugalware.org>
1683- Copyright (c) 2008 Matthias Andree <matthias.andree@gmx.de>
1684-
1685- This program is free software; you can redistribute it and/or modify
1686- it under the terms of the GNU General Public License as published by
1687- the Free Software Foundation; either version 2, or (at your option)
1688- any later version.
1689-
1690- This program is distributed in the hope that it will be useful,
1691- but WITHOUT ANY WARRANTY; without even the implied warranty of
1692- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
1693- GNU General Public License for more details.
1694-
1695- You should have received a copy of the GNU General Public License
1696- along with this program; if not, write to the Free Software
1697- Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
1698-
1699-"""
1700-
1701-import sys
1702-import os
1703-import re
1704-import time
1705-import shutil
1706-import optparse
1707-import subprocess
1708-
1709-class Handler:
1710- def __init__(self):
1711- self.marks = {}
1712- self.files = []
1713- self.prevfiles = None
1714- self.ch = None
1715- self.line = None
1716- self.unread_line = False
1717- self.eof = False
1718- self.debug = False
1719- self.export_marks = []
1720- self.import_marks = []
1721-
1722- def read_next_line(self):
1723- if self.unread_line:
1724- self.unread_line = False
1725- return
1726- self.line = ""
1727- if self.eof:
1728- return
1729- if self.ch:
1730- self.line += self.ch
1731- self.ch = None
1732- buf = sys.stdin.readline()
1733- if not len(buf):
1734- self.eof = True
1735- else:
1736- self.line += buf
1737- if self.debug:
1738- print "read_next_line: '%s'" % self.line
1739-
1740- def read(self, length):
1741- buf = ""
1742- if self.ch:
1743- buf += self.ch
1744- self.ch = None
1745- buf += sys.stdin.read(length)
1746- if self.debug:
1747- print "read: '%s'" % buf
1748- return buf
1749-
1750- def skip_optional_lf(self):
1751- self.ch = self.read(1)
1752- if self.ch == "\n":
1753- self.ch = None
1754-
1755- def bug(self, s):
1756- raise Exception(s)
1757-
1758- def get_date(self, ts, tz):
1759- # first fix the case when tz is higher than +1200, as
1760- # darcs won't accept it
1761- if int(tz[:3]) > 12:
1762- ts = str(int(ts) + 60*60*24)
1763- tz = str(int(tz[:3])-24) + tz[3:]
1764- # int(ts) is seconds since epoch. Since we're trying to
1765- # capture both the absolute time of the commit and the
1766- # localtime in the timezone of the committer, we need to turn
1767- # the (seconds-since-epoch, committer-timezone-offset) pair
1768- # that we get from the git-fast-export stream format into a
1769- # localized-time-plus-timezone-marker string that darcs will
1770- # accept. Therefore, we parse the timezone-offset (which
1771- # looks like +0500 or +0000 or -0730 or something) and add it
1772- # to seconds-since-epoch before calling gmtime().
1773- mo = re.search(r'^([\+\-])(\d\d)(\d\d)$', tz)
1774- offset = 60*60*int(mo.group(2)) + 60*int(mo.group(3))
1775- if mo.group(1) == "-":
1776- offset = -offset
1777- offset_time = int(ts) + offset
1778- s = time.strftime("%a %b %d %H:%M:%S %Y", time.gmtime(offset_time))
1779- items = s.split(' ')
1780- return " ".join(items[:-1]) + " " + tz + " " + items[-1]
1781-
1782- def invoke_darcs(self, cmdline):
1783- if os.system("darcs %s" % cmdline) != 0:
1784- self.bug("darcs failed")
1785-
1786- def invoke_add(self, path):
1787- self.invoke_darcs("add --boring --case-ok %s" % path)
1788-
1789- def handle_mark(self):
1790- if self.line.startswith("mark :"):
1791- self.mark_num = int(self.line[6:-1])
1792- self.read_next_line()
1793-
1794- def handle_data(self):
1795- if not self.line.startswith("data "):
1796- self.bug("Expected 'data n' command, found: '%s'" % self.line[:-1])
1797- length = int(self.line[5:-1])
1798- self.buf = self.read(length)
1799- self.skip_optional_lf()
1800-
1801- def handle_blob(self):
1802- self.read_next_line()
1803- self.handle_mark()
1804- self.handle_data()
1805- self.marks[self.mark_num] = self.buf
1806-
1807- def handle_ident(self, s):
1808- items = s.split(' ')
1809- self.ident = " ".join(items[:-2])
1810- self.date = self.get_date(items[-2], items[-1])
1811-
1812- def handle_msg(self):
1813- items = self.buf.split('\n')
1814- self.short = items[0]
1815- self.long = "\n".join(items[1:])
1816-
1817- def handle_tag(self):
1818- version = self.line[:-1].split(' ')[1]
1819- self.read_next_line()
1820- if self.line.startswith("from "):
1821- self.read_next_line()
1822- if self.line.startswith("tagger "):
1823- self.handle_ident(self.line[7:-1])
1824- self.read_next_line()
1825- self.handle_data()
1826- self.skip_optional_lf()
1827- sock = subprocess.Popen(["darcs", "tag", "--pipe"], stdin=subprocess.PIPE, stdout=subprocess.PIPE)
1828- buf = [self.date, self.ident, version]
1829- sock.stdin.write("\n".join(buf))
1830- sock.stdin.close()
1831- self.log("Tagging %s:\n%s" % (version, sock.stdout.read()))
1832- sock.stdout.close()
1833- if sock.wait() != 0:
1834- self.bug("darcs tag failed: '%s'" % sock.returncode)
1835-
1836- def handle_commit(self):
1837- if not self.prevfiles and self.options.import_marks:
1838- # first commit in an incremental continued
1839- # import
1840- for (root, dirs, files) in os.walk("."):
1841- for i in files:
1842- path = os.path.normpath(os.path.join(root, i))
1843- if path.startswith("_darcs") or "-darcs-backup" in path:
1844- continue
1845- self.files.append(path)
1846- self.prevfiles = self.files[:]
1847- adds = []
1848- symlinks = []
1849-
1850- self.read_next_line()
1851- self.handle_mark()
1852- if self.line.startswith("author "):
1853- self.handle_ident(self.line[7:-1])
1854- self.read_next_line()
1855- if self.line.startswith("committer "):
1856- self.handle_ident(self.line[10:-1])
1857- self.read_next_line()
1858- self.handle_data()
1859- self.skip_optional_lf()
1860- self.handle_msg()
1861- self.read_next_line()
1862- if self.line.startswith("from "):
1863- self.read_next_line()
1864- while self.line.startswith("merge "):
1865- self.read_next_line()
1866- change = False
1867- while len(self.line) > 0:
1868- if self.line.startswith("deleteall"):
1869- path = self.line[2:-1]
1870- for path in self.files:
1871- os.unlink(path)
1872- self.files = []
1873- change = True
1874- elif self.line.startswith("D "):
1875- path = self.line[2:-1]
1876- if os.path.exists(path):
1877- os.unlink(path)
1878- if path in self.files:
1879- self.files.remove(path)
1880- change = True
1881- elif self.line.startswith("R "):
1882- self.invoke_darcs("mv %s" % self.line[2:])
1883- change = True
1884- elif self.line.startswith("C "):
1885- src, dest = self.line[:-1].split(' ')[1:]
1886- shutil.copy(src.strip('"'), dest.strip('"'))
1887- self.invoke_add(dest)
1888- change = True
1889- elif self.line.startswith("M "):
1890- items = self.line.split(' ')
1891- path = items[3][:-1]
1892- dir = os.path.split(path)[0]
1893- if len(dir) and not os.path.exists(dir):
1894- os.makedirs(dir)
1895- if items[1] == "120000":
1896- if not self.options.symhack:
1897- print "Adding symbolic links (symlinks) is not supported by Darcs."
1898- sys.exit(2)
1899- idx = int(items[2][1:]) # TODO: handle inline symlinks
1900- symlinks.append((self.marks[idx], path))
1901- self.read_next_line()
1902- continue
1903- sock = open(path, "w")
1904- if items[2] != "inline":
1905- idx = int(items[2][1:])
1906- sock.write(self.marks[idx])
1907- else:
1908- self.read_next_line()
1909- self.handle_data()
1910- sock.write(self.buf)
1911- sock.close()
1912- if path not in self.prevfiles:
1913- adds.append(path)
1914- if path not in self.files:
1915- self.files.append(path)
1916- change = True
1917- else:
1918- self.unread_line = True
1919- break
1920- self.read_next_line()
1921- if not len(self.line):
1922- break
1923-
1924- if not change:
1925- # darcs does not support empty commits
1926- return
1927- for i in adds:
1928- self.invoke_add(i)
1929- args = ["darcs", "record", "--ignore-times", "-a", "--pipe"]
1930- buf = [self.date, self.ident]
1931- if not len(self.short):
1932- args.extend(['-m', ''])
1933- else:
1934- buf.extend([self.short, self.long])
1935- sock = subprocess.Popen(args, stdin=subprocess.PIPE, stdout=subprocess.PIPE)
1936- sock.stdin.write("\n".join(buf)+"\n")
1937- sock.stdin.close()
1938- self.log("Recording :%s:\n%s" % (self.mark_num, sock.stdout.read()))
1939- sock.stdout.close()
1940- if sock.wait() != 0:
1941- self.bug("darcs record failed: '%s'" % sock.returncode)
1942-
1943- for src, path in symlinks:
1944- # symlink does not do what we want if path is
1945- # already there
1946- if os.path.exists(path):
1947- # rmtree() does not work on symlinks
1948- if os.path.islink(path):
1949- os.remove(path)
1950- else:
1951- shutil.rmtree(path)
1952- os.symlink(src, path)
1953- if self.options.export_marks:
1954- # yeah, an xml parser would be better, but
1955- # should we mess with encodings just because of
1956- # this? i hope not
1957- sock = os.popen("darcs changes --last=1 --xml", "r")
1958- buf = sock.read()
1959- sock.close()
1960- hash = buf.split('\n')[1].split("'")[-2]
1961- self.export_marks.append(":%s %s" % (self.mark_num, hash))
1962-
1963- def handle_progress(self, s):
1964- print "import progress [%s] %s" % (time.strftime("%Y-%m-%d %H:%M:%S", time.localtime()), s.strip())
1965- sys.stdout.flush()
1966-
1967- def handle_opts(self):
1968- # Option Parser
1969- usage="%prog [options]"
1970- opp = optparse.OptionParser(usage=usage)
1971- opp.set_defaults(symhack=False)
1972- opp.add_option("--import-marks", metavar="IFILE",
1973- help="read state for incremental imports from IFILE")
1974- opp.add_option("--export-marks", metavar="OFILE",
1975- help="write state for incremental imports to OFILE")
1976- opp.add_option("--logfile", metavar="L",
1977- help="log file which contains the output of external programs invoked during the conversion")
1978- opp.add_option("--symhack", action="store_true", dest="symhack",
1979- help="Do not error out when a symlink would be created, just create it in the workdir")
1980- opp.add_option("--progress", metavar="P",
1981- help="insert progress statements after every n commit [default: 100]")
1982- (self.options, args) = opp.parse_args()
1983-
1984- if self.options.logfile:
1985- logfile = self.options.logfile
1986- else:
1987- logfile = "_darcs/import.log"
1988- self.logsock = open(os.path.abspath(logfile), "a")
1989-
1990- if self.options.progress:
1991- self.prognum = int(self.options.progress)
1992- else:
1993- self.prognum = 0
1994-
1995- def log(self, s):
1996- self.logsock.write("[%s] %s" % (time.strftime("%Y-%m-%d %H:%M:%S", time.localtime()), s))
1997- self.logsock.flush()
1998-
1999- def handle_export_marks(self):
2000- if self.options.export_marks:
2001- sock = open(self.options.export_marks, 'w')
2002- sock.write("\n".join(self.export_marks))
2003- sock.write("\n")
2004- sock.close()
2005-
2006- def handle_import_marks(self):
2007- if self.options.import_marks:
2008- sock = open(self.options.import_marks)
2009- for i in sock.readlines():
2010- line = i.strip()
2011- if not len(line):
2012- continue
2013- self.import_marks.append(line.split(' ')[1])
2014- self.export_marks.append(line)
2015- sock.close()
2016-
2017- def handle(self):
2018- self.handle_opts()
2019- self.handle_import_marks()
2020-
2021- commitcount = 0
2022- while not self.eof:
2023- self.read_next_line()
2024- if not len(self.line[:-1]):
2025- pass
2026- elif self.line.startswith("blob"):
2027- self.handle_blob()
2028- elif self.line.startswith("commit"):
2029- self.handle_commit()
2030- commitcount += 1
2031- if self.prognum != 0 and commitcount % self.prognum == 0:
2032- self.handle_progress("%d patches" % commitcount)
2033- elif self.line.startswith("tag"):
2034- self.handle_tag()
2035- elif self.line.startswith("reset"):
2036- self.read_next_line()
2037- if not self.line.startswith("from "):
2038- self.unread_line = True
2039- elif self.line.startswith("checkpoint"):
2040- pass
2041- elif self.line.startswith("progress"):
2042- self.handle_progress(self.line[9:])
2043- else:
2044- self.bug("'%s': invalid command" % self.line[:-1])
2045-
2046- self.handle_export_marks()
2047-
2048-if __name__ == "__main__":
2049- h = Handler()
2050- h.handle()
2051
2052=== removed file 'exporters/darcs/darcs-fast-import.txt'
2053--- exporters/darcs/darcs-fast-import.txt 2010-06-27 21:28:23 +0000
2054+++ exporters/darcs/darcs-fast-import.txt 1970-01-01 00:00:00 +0000
2055@@ -1,57 +0,0 @@
2056-= darcs-fast-import(1)
2057-
2058-== NAME
2059-
2060-darcs-fast-import - darcs backend to the 'fast-import stream' format
2061-
2062-== SYNOPSIS
2063-
2064-darcs-fast-import [<options>]
2065-
2066-== DESCRIPTION
2067-
2068-darcs-fast-import can produce a darcs repository from a fast-import
2069-stream, read from the standard input. It supports incremental conversion
2070-as well, via the --import-marks / --export-marks switches.
2071-
2072-== OPTIONS
2073-
2074--h, --help::
2075- Display usage.
2076-
2077---import-marks::
2078- Import marks from a given file. This is read at the beginning of the
2079- conversion at once. Use it if you want to continue an incremental
2080- conversion.
2081-
2082---export-marks::
2083- Export marks to a given file at the end of the conversion. It can be the
2084- same as the one for --import-marks as it is written only once at the
2085- end. Use it if you want to be able to incrementally update the target
2086- repository later.
2087-
2088---logfile::
2089- The output of external commands are redirected to a log file. You can
2090- specify the path of that file with this parameter.
2091-
2092---symhack::
2093- Enable hack for symbolic links. darcs add does not handle them
2094- but in case they are just added, we can create them in the working
2095- directory. This can be handy in case for example the symbolic link is in
2096- a subdirectory of the project and you don't even care about that
2097- subdirectory. So the hack can be useful, but be extremely careful when
2098- you use it.
2099-
2100---progress=<n>::
2101- Insert progress statements after every <n> created patches. The
2102- default is not to print anything as progress info is usually provided by
2103- the exporter. Use this option in case the exporter does not have such a
2104- switch but you still want to get some feedback.
2105-
2106-== EXIT CODES
2107-
2108-The exit code is:
2109-
2110-* 0 on success
2111-* 1 on unhandled exception
2112-* 2 in case the stream would try to let the importer create a symlink
2113
2114=== removed file 'exporters/darcs/git-darcs'
2115--- exporters/darcs/git-darcs 2011-10-06 00:11:52 +0000
2116+++ exporters/darcs/git-darcs 1970-01-01 00:00:00 +0000
2117@@ -1,279 +0,0 @@
2118-#!/bin/bash
2119-#
2120-# git-darcs - bidirectional operation between a darcs repo and git
2121-#
2122-# Copyright (c) 2008, 2010 by Miklos Vajna <vmiklos@frugalware.org>
2123-#
2124-# Based on git-bzr, which is
2125-#
2126-# Copyright (c) 2008 Pieter de Bie <pdebie@ai.rug.nl>
2127-#
2128-# This program is free software; you can redistribute it and/or modify
2129-# it under the terms of the GNU General Public License as published by
2130-# the Free Software Foundation; either version 2 of the License, or
2131-# (at your option) any later version.
2132-#
2133-# This program is distributed in the hope that it will be useful,
2134-# but WITHOUT ANY WARRANTY; without even the implied warranty of
2135-# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
2136-# GNU General Public License for more details.
2137-#
2138-# You should have received a copy of the GNU General Public License
2139-# along with this program. If not, see <http://www.gnu.org/licenses/>.
2140-#
2141-
2142-add()
2143-{
2144- name="$1"
2145- shift
2146- location="$1"
2147- shift
2148- if ! [ -n "$name" -a -n "$location" ]; then
2149- echo "Usage: git darcs add name location [darcs-fast-export options]"
2150- return 1
2151- fi
2152- if git remote show |grep -q $name; then
2153- echo "There is already a remote with that name"
2154- return 1
2155- fi
2156- if [ -n "$(git config git-darcs.$name.location)" ]; then
2157- echo "There is already a darcs repo with that name"
2158- return 1
2159- fi
2160- repo=$location/_darcs
2161- if [ ! -d $repo ] && ! wget --quiet --spider $repo; then
2162- echo "Remote is not a darcs repository"
2163- return 1
2164- fi
2165- git config git-darcs.$name.location $location
2166- echo "Darcs repo $name added. You can fetch it with 'git darcs fetch $name'"
2167- if ! [ -z "$*" ]; then
2168- git config git-darcs.$name.darcs-fast-export-options "$*"
2169- echo "darcs-fast-export will get options: $*"
2170- fi
2171-}
2172-
2173-get_location()
2174-{
2175- l=$(git config git-darcs.$remote.location)
2176- if [ -z "$l" ]; then
2177- echo "Cannot find darcs remote with name '$remote'." >&2
2178- return 1
2179- fi
2180- echo $l
2181-}
2182-
2183-fetch()
2184-{
2185- remote="$1"
2186- shift
2187- if ! [ -n "$remote" -a -z "$*" ]; then
2188- echo "Usage: git darcs fetch reponame"
2189- return 1
2190- fi
2191- location=$(get_location $remote) || return $?
2192- git_map=$git_dir/darcs-git/$remote-git-map
2193- darcs_map=$git_dir/darcs-git/$remote-darcs-map
2194- common_opts="--working $git_dir/darcs-git/repo --logfile $git_dir/darcs-git/fetch.log --git-branch=refs/remotes/darcs/$remote"
2195- dfe_opts=$(git config git-darcs.$remote.darcs-fast-export-options)
2196- pre_fetch="$(git config git-darcs.$remote.pre-fetch)"
2197- if [ -n "$pre_fetch" ]; then
2198- $pre_fetch
2199- fi
2200- if [ ! -f $git_map -a ! -f $darcs_map ]; then
2201- echo "There doesn't seem to be an existing refmap."
2202- echo "Doing an initial import"
2203- mkdir -p $git_dir/darcs-git
2204- darcs-fast-export --export-marks=$darcs_map $common_opts $dfe_opts $location | \
2205- git fast-import --export-marks=$git_map
2206- elif [ -f $git_map -a -f $darcs_map ]; then
2207- echo "Updating remote $remote"
2208- old_rev=$(git rev-parse refs/remotes/darcs/$remote)
2209- darcs-fast-export --import-marks=$darcs_map --export-marks=$darcs_map $common_opts $dfe_opts $location | \
2210- git fast-import --quiet --import-marks=$git_map --export-marks=$git_map
2211- new_rev=$(git rev-parse refs/remotes/darcs/$remote)
2212- if [ "$old_rev" != "$new_rev" ]; then
2213- echo "Fetched the following updates:"
2214- git shortlog $old_rev..$new_rev
2215- else
2216- echo "Nothing fetched."
2217- return 0
2218- fi
2219- else
2220- echo "One of the mapfiles is missing! Something went wrong!"
2221- return 1
2222- fi
2223- post_fetch="$(git config git-darcs.$remote.post-fetch)"
2224- if [ -n "$post_fetch" ]; then
2225- $post_fetch
2226- fi
2227-}
2228-
2229-pull()
2230-{
2231- remote="$1"
2232- shift
2233- if ! [ -n "$remote" -a -z "$*" ]; then
2234- echo "Usage: git darcs pull reponame"
2235- return 1
2236- fi
2237- fetch $remote || return $?
2238- # see if we need to merge or rebase
2239- branch=$(git symbolic-ref HEAD|sed 's|.*/||')
2240- if [ "$(git config branch.$branch.rebase)" = "true" ]; then
2241- git rebase refs/remotes/darcs/$remote
2242- else
2243- git merge refs/remotes/darcs/$remote
2244- fi
2245-}
2246-
2247-push()
2248-{
2249- remote="$1"
2250- shift
2251- if ! [ -n "$remote" -a -z "$*" ]; then
2252- echo "Usage: git darcs push reponame"
2253- return 1
2254- fi
2255- location=$(get_location $remote) || return $?
2256- if [ -n "$(git rev-list --left-right HEAD...refs/remotes/darcs/$remote | sed -n '/^>/ p')" ]; then
2257- echo "HEAD is not a strict child of $remote, cannot push. Merge first"
2258- return 1
2259- fi
2260- if [ -z "$(git rev-list --left-right HEAD...refs/remotes/darcs/$remote | sed -n '/^</ p')" ]; then
2261- echo "Nothing to push. Commit something first"
2262- return 1
2263- fi
2264- git_map=$git_dir/darcs-git/$remote-git-map
2265- darcs_map=$git_dir/darcs-git/$remote-darcs-map
2266- if [ ! -f $git_map -o ! -f $darcs_map ]; then
2267- echo "We do not have refmapping yet. Then how can I push?"
2268- return 1
2269- fi
2270- pre_push="$(git config git-darcs.$remote.pre-push)"
2271- if [ -n "$pre_push" ]; then
2272- $pre_push
2273- fi
2274- echo "Pushing the following updates:"
2275- git shortlog refs/remotes/darcs/$remote..
2276- git fast-export --import-marks=$git_map --export-marks=$git_map HEAD | \
2277- (cd $location; darcs-fast-import --import-marks=$darcs_map --export-marks=$darcs_map \
2278- --logfile $git_dir/darcs-git/push.log)
2279- if [ $? == 0 ]; then
2280- git update-ref refs/remotes/darcs/$remote HEAD
2281- post_push="$(git config git-darcs.$remote.post-push)"
2282- if [ -n "$post_push" ]; then
2283- $post_push
2284- fi
2285- fi
2286-}
2287-
2288-# List the darcs remotes
2289-list()
2290-{
2291- if [ -z "$*" ]
2292- then
2293- git config -l | sed -n -e '/git-darcs\..*/ {s/git-darcs\.//; s/\.location=.*//p}'
2294- return 0
2295- elif [ "$#" -eq 1 ]
2296- then
2297- case $1 in
2298- -v|--verbose)
2299- git config -l | sed -n -e '/git-darcs\..*/ {s/git-darcs\.//; s/\.location=/\t/p}'
2300- return 0
2301- ;;
2302- esac
2303- fi
2304- echo "Usage: git darcs list [-v|--verbose]"
2305- return 1
2306-}
2307-
2308-# Find the darcs commit(s) supporting a git SHA1 prefix
2309-find_darcs()
2310-{
2311- sha1="$1"
2312- shift
2313- if [ -z "$sha1" -o -n "$*" ]
2314- then
2315- echo "Usage: git darcs find-darcs <sha1-prefix>"
2316- return 1
2317- fi
2318- for remote in $(git for-each-ref --format='%(refname)' refs/remotes/darcs)
2319- do
2320- remote=`basename $remote`
2321- git_map=$git_dir/darcs-git/$remote-git-map
2322- darcs_map=$git_dir/darcs-git/$remote-darcs-map
2323- if [ ! -f $git_map -o ! -f $darcs_map ]
2324- then
2325- echo "Missing mappings for remote $remote"
2326- return 1
2327- fi
2328- for row in `sed -n -e "/:.* $sha1.*/ s/[^ ]*/&/p" $git_map`
2329- do
2330- sed -n -e "/$row / {s/[^ ]*//; s/.*/$remote\t&/p}" $darcs_map
2331- done
2332- done
2333-}
2334-
2335-# Find the git commit(s) supporting a darcs patch prefix
2336-find_git()
2337-{
2338- patch="$1"
2339- shift
2340- if [ -z "$patch" -o -n "$*" ]
2341- then
2342- echo "Usage: git darcs find-git <patch-prefix>"
2343- return 1
2344- fi
2345- for remote in $(git for-each-ref --format='%(refname)' refs/remotes/darcs)
2346- do
2347- remote=`basename $remote`
2348- git_map=$git_dir/darcs-git/$remote-git-map
2349- darcs_map=$git_dir/darcs-git/$remote-darcs-map
2350- if [ ! -f $git_map -o ! -f $darcs_map ]
2351- then
2352- echo "Missing mappings for remote $remote"
2353- return 1
2354- fi
2355- for row in `sed -n -e "/:.* $patch.*/ s/[^ ]*/&/p" $darcs_map`
2356- do
2357- sed -n -e "/$row / {s/[^ ]* \(.*\)/$remote\t\1/p}" $git_map
2358- done
2359- done
2360-}
2361-
2362-git rev-parse 2> /dev/null
2363-if [ $? != 0 ]; then
2364- echo "Must be inside a git repository to work"
2365- exit 1
2366-fi
2367-
2368-git_dir=$(git rev-parse --git-dir)
2369-# make it absolute
2370-cd $git_dir
2371-git_dir=$(pwd)
2372-cd - >/dev/null
2373-command="$1"
2374-shift
2375-
2376-case $command in
2377- add|push|fetch|pull|list)
2378- ;;
2379- find-darcs)
2380- command=find_darcs
2381- ;;
2382- find-git)
2383- command=find_git
2384- ;;
2385- *)
2386- echo "Usage: git darcs [COMMAND] [OPTIONS]"
2387- echo "Commands: add, push, fetch, pull, list, find-darcs, find-git"
2388- exit 1
2389- ;;
2390-esac
2391-
2392-
2393-up=$(git rev-parse --show-cdup)
2394-[ -z "$up" ] && up="."
2395-cd $up
2396-$command "$@"
2397
2398=== removed file 'exporters/darcs/git-darcs.txt'
2399--- exporters/darcs/git-darcs.txt 2010-03-17 00:09:30 +0000
2400+++ exporters/darcs/git-darcs.txt 1970-01-01 00:00:00 +0000
2401@@ -1,92 +0,0 @@
2402-= git-darcs(1)
2403-
2404-== NAME
2405-
2406-git-darcs - a bidirectional git - darcs gateway
2407-
2408-== SYNOPSIS
2409-
2410-git-darcs <command> <options>
2411-
2412-== DESCRIPTION
2413-
2414-git darcs can convert a darcs repo to a git one, can update such an
2415-existing git repo later, and finally can push back your changes from the
2416-git repo to the darcs one.
2417-
2418-A typical workflow is:
2419-
2420-----
2421-$ mkdir git-repo
2422-$ cd git-repo
2423-$ git init
2424-$ git darcs add upstream /path/to/darcs-repo
2425-$ git darcs pull upstream
2426-
2427-... hack, hack, hack ...
2428-
2429-$ git darcs push upstream
2430-----
2431-
2432-== GLOBAL OPTIONS
2433-
2434--h, --help::
2435- Display usage.
2436-
2437-== COMMANDS
2438-
2439-The supported commands are the followings:
2440-
2441-add::
2442- This can register a new darcs repo in the git one, so that you
2443- can fetch from it. The syntax is `add nick path [dfe-options]`.
2444- Add any options you want to be passed to darcs-fast-export,
2445- like --encoding=utf-8, or --authors-file AUTHORMAP. Remember
2446- that if AUTHORMAP is not absolute, it will be interpreted
2447- relative to the git repository's root directory.
2448-
2449-push::
2450- Transfers your changes created in the current branch back the
2451- darcs one. The syntax is `push nick`.
2452-
2453-fetch::
2454- Downloads changes from the darcs repo and updates the
2455- `darcs/<nick>` branch. None of your local branches are updated.
2456-
2457-pull::
2458- Calls `fetch` then `git merge` or `git rebase` based on the
2459- `branch.<branchname>.rebase` configuration setting, where `<branchname>`
2460- is the current branch. The default is - just like with `git pull` - is
2461- to `git merge`.
2462-
2463-list::
2464- List the name [and location] of each registered darcs repo.
2465- The syntax is `list [-v|--verbose]`.
2466-
2467-find-darcs::
2468- Searches for darcs patches matching a SHA1 prefix.
2469- The syntax is `find-darcs <sha1-prefix>`.
2470-
2471-find-git::
2472- Searches for git commits matching a darcs patch prefix.
2473- The syntax is `find-git <patch-prefix>`.
2474-
2475-== HOOKS
2476-
2477-It's possible to automatically run before and after the fetch and the
2478-push subcommand. For example if you want to automatically run `darcs
2479-pull -a` before a `git darcs fetch upstream`:
2480-
2481-----
2482-git config git-darcs.upstream.pre-fetch "darcs pull -a --repodir=/path/to/darcs-repo"
2483-----
2484-
2485-Or in case you want to automatically `darcs send` all patches after a
2486-`git darcs push upstream`:
2487-
2488-----
2489-git config git-darcs.upstream.post-push "darcs send -a --repodir=/path/to/darcs-repo"
2490-----
2491-
2492-== SEE-ALSO
2493-*git*(1), *darcs*(1)
2494
2495=== removed directory 'exporters/darcs/t'
2496=== removed file 'exporters/darcs/t/Makefile'
2497--- exporters/darcs/t/Makefile 2008-11-11 00:38:24 +0000
2498+++ exporters/darcs/t/Makefile 1970-01-01 00:00:00 +0000
2499@@ -1,9 +0,0 @@
2500-T = $(wildcard test*.sh)
2501-
2502-all: $(T)
2503- @echo "passed $$(echo $(T)|wc -w) tests."
2504-
2505-$(T):
2506- @echo "*** $@ ***"; sh $@
2507-
2508-.PHONY: $(T)
2509
2510=== removed directory 'exporters/darcs/t/bench-results'
2511=== removed file 'exporters/darcs/t/bench-results/Makefile'
2512--- exporters/darcs/t/bench-results/Makefile 2008-12-26 00:36:08 +0000
2513+++ exporters/darcs/t/bench-results/Makefile 1970-01-01 00:00:00 +0000
2514@@ -1,5 +0,0 @@
2515-bench-results.png: bench-results.gnu bench-results.dat
2516- gnuplot bench-results.gnu
2517-
2518-bench-results.dat: bench-results.py $(wildcard ../darcs-benchmark/big-zoo/*.log)
2519- python bench-results.py > bench-results.dat
2520
2521=== removed file 'exporters/darcs/t/bench-results/bench-results.gnu'
2522--- exporters/darcs/t/bench-results/bench-results.gnu 2008-12-26 00:36:08 +0000
2523+++ exporters/darcs/t/bench-results/bench-results.gnu 1970-01-01 00:00:00 +0000
2524@@ -1,6 +0,0 @@
2525-set terminal png
2526-set output 'bench-results.png'
2527-unset key
2528-set xlabel "number of patches"
2529-set ylabel "elapsed time in hours"
2530-plot 'bench-results.dat' with linespoints
2531
2532=== removed file 'exporters/darcs/t/bench-results/bench-results.py'
2533--- exporters/darcs/t/bench-results/bench-results.py 2008-12-26 00:36:08 +0000
2534+++ exporters/darcs/t/bench-results/bench-results.py 1970-01-01 00:00:00 +0000
2535@@ -1,23 +0,0 @@
2536-from glob import glob
2537-import re
2538-
2539-def cmp_data(a, b):
2540- return cmp(a[0], b[0])
2541-
2542-logs = glob("../darcs-benchmark/big-zoo/*.log")
2543-
2544-data = []
2545-
2546-for i in logs:
2547- sock = open(i)
2548- for j in sock.readlines():
2549- if "Num Patches:" in j:
2550- patches = int(j.split(": ")[1].strip())
2551- elif j.startswith("real"):
2552- l = re.sub("real\t([0-9]+)m([0-9.]+)s\n", r"\1 \2", j).split(" ")
2553- secs = int(l[0])*60 + float(l[1])
2554- hours = secs / 3600
2555- data.append([patches, hours])
2556-data.sort(cmp=cmp_data)
2557-for i in data:
2558- print "%s %s" % (i[0], i[1])
2559
2560=== removed file 'exporters/darcs/t/bench-tailor.sh'
2561--- exporters/darcs/t/bench-tailor.sh 2008-11-29 13:34:30 +0000
2562+++ exporters/darcs/t/bench-tailor.sh 1970-01-01 00:00:00 +0000
2563@@ -1,59 +0,0 @@
2564-#!/bin/sh
2565-
2566-create_config()
2567-{
2568- cd $1
2569- mypath=$(pwd)
2570- cd - >/dev/null
2571- myname=$(basename $mypath)
2572-
2573- cat > config << EOF
2574-[DEFAULT]
2575-encoding-errors-policy = replace
2576-
2577-[$myname]
2578-source = darcs:$myname
2579-target = git:$myname
2580-
2581-[darcs:$myname]
2582-subdir = darcs
2583-repository = $mypath
2584-
2585-[git:$myname]
2586-subdir = git
2587-repository = $mypath.git
2588-EOF
2589-}
2590-
2591-PATH=$HOME/darcs/tailor:$PATH
2592-if [ ! -d darcs-benchmark ]; then
2593- darcs get http://code.haskell.org/darcs/darcs-benchmark
2594- cd darcs-benchmark
2595-else
2596- cd darcs-benchmark
2597- darcs pull -a
2598-fi
2599-sh initialise.sh
2600-cd big-zoo
2601-if [ -n "$1" ]; then
2602- targets=$1
2603-else
2604- targets=*_play.tar.gz
2605-fi
2606-for i in $targets
2607-do
2608- echo "benchmarking $i"
2609- rm -rf _playground
2610- tar xf $i
2611- cd _playground
2612- log="../$i.tailor-$(tailor --version).log"
2613- create_config sandbox
2614- sh -c 'time tailor --configfile config' 2>&1 |tee $log
2615- if diff --exclude _darcs --exclude .git -Nur sandbox git >/dev/null; then
2616- echo "ok, the result is correct" >> $log
2617- else
2618- echo "ouch, the result is corrupted" >> $log
2619- exit 1
2620- fi
2621- cd ..
2622-done
2623
2624=== removed file 'exporters/darcs/t/bench.sh'
2625--- exporters/darcs/t/bench.sh 2008-12-25 23:50:21 +0000
2626+++ exporters/darcs/t/bench.sh 1970-01-01 00:00:00 +0000
2627@@ -1,38 +0,0 @@
2628-#!/bin/sh
2629-
2630-# this is a test as well, but it would take a lot of time, so don't
2631-# prefix it with 'test'.
2632-
2633-. lib.sh
2634-
2635-if [ ! -d darcs-benchmark ]; then
2636- darcs get http://code.haskell.org/darcs/darcs-benchmark
2637- cd darcs-benchmark
2638-else
2639- cd darcs-benchmark
2640- darcs pull -a
2641-fi
2642-sh initialise.sh
2643-cd big-zoo
2644-if [ -n "$1" ]; then
2645- targets=$1
2646-else
2647- targets=*_play.tar.gz
2648-fi
2649-for i in $targets
2650-do
2651- echo "benchmarking $i"
2652- rm -rf _playground
2653- tar xf $i
2654- cd _playground
2655- log="../$i.d-f-e-$(git describe).log"
2656- sh -c 'time d2x -f git sandbox' 2>&1 |tee $log
2657- darcs show repo --repodir sandbox |egrep -v 'Root|Cache|Default' >> $log
2658- if diff_git sandbox >/dev/null; then
2659- echo "ok, the result is correct" >> $log
2660- else
2661- echo "ouch, the result is corrupted" >> $log
2662- exit 1
2663- fi
2664- cd ..
2665-done
2666
2667=== removed directory 'exporters/darcs/t/data'
2668=== removed file 'exporters/darcs/t/data/hungarian.gif'
2669Binary files exporters/darcs/t/data/hungarian.gif 2008-11-11 00:27:43 +0000 and exporters/darcs/t/data/hungarian.gif 1970-01-01 00:00:00 +0000 differ
2670=== removed file 'exporters/darcs/t/lib-httpd.sh'
2671--- exporters/darcs/t/lib-httpd.sh 2009-10-22 10:26:11 +0000
2672+++ exporters/darcs/t/lib-httpd.sh 1970-01-01 00:00:00 +0000
2673@@ -1,67 +0,0 @@
2674-#!/bin/sh
2675-#
2676-# This is based on git's t/lib-httpd.sh, which is
2677-# Copyright (c) 2008 Clemens Buchacher <drizzd@aon.at>
2678-#
2679-
2680-if test -n "$DFE_TEST_SKIP_HTTPD"
2681-then
2682- echo "skipping test (undef DFE_TEST_SKIP_HTTPD to enable)"
2683- exit
2684-fi
2685-
2686-LIB_HTTPD_PATH=${LIB_HTTPD_PATH-'/usr/sbin/httpd'}
2687-LIB_HTTPD_PORT=${LIB_HTTPD_PORT-'8111'}
2688-
2689-HTTPD_ROOT_PATH="$PWD"/httpd
2690-HTTPD_DOCUMENT_ROOT_PATH=$HTTPD_ROOT_PATH/www
2691-
2692-if ! test -x "$LIB_HTTPD_PATH"
2693-then
2694- echo "skipping test, no web server found at '$LIB_HTTPD_PATH'"
2695- exit
2696-fi
2697-
2698-HTTPD_VERSION=`$LIB_HTTPD_PATH -v | \
2699- sed -n 's/^Server version: Apache\/\([0-9]*\)\..*$/\1/p; q'`
2700-
2701-if test -n "$HTTPD_VERSION"
2702-then
2703- if test -z "$LIB_HTTPD_MODULE_PATH"
2704- then
2705- if ! test $HTTPD_VERSION -ge 2
2706- then
2707- echo "skipping test, at least Apache version 2 is required"
2708- exit
2709- fi
2710-
2711- LIB_HTTPD_MODULE_PATH='/usr/lib/apache'
2712- fi
2713-else
2714- error "Could not identify web server at '$LIB_HTTPD_PATH'"
2715-fi
2716-
2717-HTTPD_PARA="-d $HTTPD_ROOT_PATH -f $HTTPD_ROOT_PATH/apache.conf"
2718-
2719-prepare_httpd() {
2720- mkdir -p $HTTPD_DOCUMENT_ROOT_PATH
2721-
2722- ln -s $LIB_HTTPD_MODULE_PATH $HTTPD_ROOT_PATH/modules
2723-
2724- echo "PidFile httpd.pid" > $HTTPD_ROOT_PATH/apache.conf
2725- echo "DocumentRoot www" >> $HTTPD_ROOT_PATH/apache.conf
2726- echo "ErrorLog error.log" >> $HTTPD_ROOT_PATH/apache.conf
2727-
2728- HTTPD_URL=http://127.0.0.1:$LIB_HTTPD_PORT
2729-}
2730-
2731-start_httpd() {
2732- prepare_httpd
2733-
2734- "$LIB_HTTPD_PATH" $HTTPD_PARA \
2735- -c "Listen 127.0.0.1:$LIB_HTTPD_PORT" -k start
2736-}
2737-
2738-stop_httpd() {
2739- "$LIB_HTTPD_PATH" $HTTPD_PARA -k stop
2740-}
2741
2742=== removed file 'exporters/darcs/t/lib.sh'
2743--- exporters/darcs/t/lib.sh 2010-07-28 01:33:33 +0000
2744+++ exporters/darcs/t/lib.sh 1970-01-01 00:00:00 +0000
2745@@ -1,337 +0,0 @@
2746-export DARCS_EMAIL="user@example.com"
2747-export GIT_PAGER=cat
2748-export PATH="$(pwd)/..:$PATH"
2749-pypath="/$(python -c 'from distutils import sysconfig; print sysconfig.get_python_lib()[1:]')/"
2750-
2751-_drrec()
2752-{
2753- darcs rec --ignore-times "$@"
2754-}
2755-
2756-_drrec_multiline()
2757-{
2758- echo -e "`LANG= LC_ALL= date +"%a %b %d %H:%M:%S %Z %Y"`
2759-$DARCS_EMAIL
2760-$@" | darcs rec --ignore-times -a --pipe .
2761-}
2762-
2763-_drrecamend()
2764-{
2765- echo y |darcs amend-rec --ignore-times -a
2766-}
2767-
2768-create_darcs()
2769-{
2770- rm -rf $1
2771- mkdir -p $1
2772- cd $1
2773- darcs init $2
2774- echo A > file
2775- darcs add file
2776- _drrec -a -m A
2777- cd ..
2778- rm -rf $1.tmp
2779- darcs get $1 $1.tmp
2780- cd $1
2781- echo B > file
2782- _drrec -a -m B
2783- cd ../$1.tmp
2784- echo C > file
2785- _drrec -a -m C
2786- cd ../$1
2787- darcs pull -a ../$1.tmp
2788- echo D > file
2789- _drrec_multiline "first line
2790-second line
2791-third line"
2792- darcs tag 1.0
2793- echo e > file
2794- _drrec -a -m e
2795- echo f > file
2796- _drrec --author="éáõû <$DARCS_EMAIL>" -a -m f
2797- echo g > file
2798- _drrec --author="" -a -m g
2799- cp ../data/hungarian.gif .
2800- darcs add hungarian.gif
2801- _drrec -a -m "add a binary file"
2802- rm file
2803- echo test > file2
2804- darcs add file2
2805- _drrec -a -m "replace file with file2"
2806- touch file3
2807- darcs add file3
2808- _drrec -a -m "add empty file"
2809- rm file3
2810- _drrec -a -m "remove file"
2811- mkdir dir dir2
2812- darcs add dir
2813- darcs add dir2
2814- _drrec -a -m "add empty dirs"
2815- darcs mv dir dir-p
2816- darcs mv dir2 dir2-p
2817- _drrec -a -m "rename empty dirs"
2818- echo a > a
2819- echo b > b
2820- darcs add a b
2821- _drrec -a -m "add a b"
2822- rm b
2823- _drrec -a -m "remove and rename"
2824- darcs mv a b
2825- _drrecamend
2826- echo c > c
2827- darcs add c
2828- # empty commit message
2829- _drrec -a -m ""
2830- cd ..
2831-}
2832-
2833-create_bzr()
2834-{
2835- rm -rf $1
2836- mkdir -p $1
2837- cd $1
2838- bzr init $2
2839- echo A > file
2840- bzr add file
2841- bzr commit -m A
2842- cd ..
2843- rm -rf $1.tmp
2844- bzr branch $1 $1.tmp
2845- cd $1
2846- echo B > file
2847- bzr commit -m B
2848- cd ../$1.tmp
2849- echo C > file
2850- bzr commit -m C
2851- cd ../$1
2852- bzr merge ../$1.tmp
2853- echo D > file
2854- bzr resolve file
2855- echo "first line
2856-second line
2857-third line" | bzr commit -F /dev/stdin
2858- bzr tag 1.0
2859- echo e > file
2860- bzr commit -m e
2861- #echo f > file
2862- #bzr commit --author="éáõû <$DARCS_EMAIL>" -m f
2863- #echo g > file
2864- #_drrec --author="" -a -m g
2865- cp ../data/hungarian.gif .
2866- bzr add hungarian.gif
2867- bzr commit -m "add a binary file"
2868- rm file
2869- echo test > file2
2870- bzr add file2
2871- bzr commit -m "replace file with file2"
2872- touch file3
2873- bzr add file3
2874- bzr commit -m "add empty file"
2875- rm file3
2876- bzr commit -m "remove file"
2877- cd ..
2878-}
2879-
2880-create_hg()
2881-{
2882- rm -rf $1
2883- mkdir -p $1
2884- cd $1
2885- hg init $2
2886- echo A > file
2887- hg add file
2888- hg commit -m A
2889- cd ..
2890- rm -rf $1.tmp
2891- hg clone $1 $1.tmp
2892- cd $1
2893- echo B > file
2894- hg commit -m B
2895- cd ../$1.tmp
2896- echo C > file
2897- hg commit -m C
2898- cd ../$1
2899- hg pull ../$1.tmp
2900- hg merge
2901- echo D > file
2902- hg resolve -m file
2903- echo "first line
2904-second line
2905-third line" | hg commit -l /dev/stdin
2906- hg tag 1.0
2907- echo e > file
2908- hg commit -m e
2909- #echo f > file
2910- #bzr commit --author="éáõû <$DARCS_EMAIL>" -m f
2911- #echo g > file
2912- #_drrec --author="" -a -m g
2913- cp ../data/hungarian.gif .
2914- hg add hungarian.gif
2915- hg commit -m "add a binary file"
2916- hg rm file
2917- echo test > file2
2918- hg add file2
2919- hg commit -m "replace file with file2"
2920- touch file3
2921- hg add file3
2922- hg commit -m "add empty file"
2923- hg rm file3
2924- hg commit -m "remove file"
2925- mkdir subdir
2926- echo test > subdir/file
2927- hg add subdir/file
2928- hg commit -m "add subdir file"
2929- echo test2 > subdir/file
2930- hg commit -m "commit with weird date" -d "Fri Apr 03 12:38:26 2009 +1300"
2931- cd ..
2932-}
2933-create_git()
2934-{
2935- rm -rf $1
2936- mkdir -p $1
2937- cd $1
2938- git init $2
2939- git commit --allow-empty -m 'root commit'
2940- echo A > file
2941- git add file
2942- git commit -a -m A
2943- echo B > file
2944- git commit -a -m B
2945- git checkout -b tmp HEAD~1
2946- echo C > file
2947- git commit -a -m C
2948- git checkout master
2949- git merge tmp
2950- echo D > file
2951- echo "first line
2952-second line
2953-third line" | git commit -a -F -
2954- git branch -d tmp
2955- git tag 1.0
2956- echo e > file
2957- git commit -a -m e
2958- echo f > file
2959- git config i18n.commitencoding ISO-8859-2
2960- git commit --author="éáõû <$DARCS_EMAIL>" -a -m f
2961- cp ../data/hungarian.gif .
2962- git add hungarian.gif
2963- git commit -a -m "add a binary file"
2964- rm file
2965- echo test > file2
2966- git add file2
2967- git commit -a -m "replace file with file2"
2968- touch file3
2969- git add file3
2970- git commit -a -m "add empty file"
2971- rm file3
2972- git commit -a -m "remove file"
2973- # now add back 'file' with its old conents, so the mark gets
2974- # reused
2975- echo f > file
2976- git add file
2977- git commit -a -m "file: other -> f"
2978- # this is a boring file for Darcs
2979- touch foo.pyc
2980- git add foo.pyc
2981- git commit -a -m "boring file"
2982- # replace an uppercase file to a lowercase one
2983- echo SPAM > SPAM
2984- git add SPAM
2985- git commit -a -m SPAM
2986- rm SPAM
2987- echo spam > spam
2988- git add spam
2989- git commit -a -m "SPAM -> spam"
2990- cd ..
2991-}
2992-
2993-diff_git()
2994-{
2995- rm -rf $1.git.nonbare
2996- git clone -q $1.git $1.git.nonbare
2997- diff --exclude _darcs --exclude .git --exclude '*-darcs-backup*' -Nur $1.git.nonbare $1
2998- return $?
2999-}
3000-
3001-diff_importgit()
3002-{
3003- test -z "`(cd $1.darcs; darcs diff)`" &&
3004- diff --exclude _darcs --exclude .git --exclude '*-darcs-backup*' -Nur $1 $1.darcs
3005- return $?
3006-}
3007-
3008-diff_importhg()
3009-{
3010- cd $1.darcs && test -z "`darcs diff 2>&1`" && cd .. &&
3011- diff --exclude _darcs --exclude .hg --exclude '*-darcs-backup*' --exclude 'hg-export.*' \
3012- --exclude '.hgtags' --exclude '*.orig' -Nur $1 $1.darcs
3013- return $?
3014-}
3015-
3016-diff_importdarcs()
3017-{
3018- cd $1.importdarcs && test -z "`darcs diff 2>&1`" && cd .. &&
3019- diff --exclude _darcs --exclude '*-darcs-backup*' -Nur $1 $2
3020- return $?
3021-}
3022-
3023-diff_importbzr()
3024-{
3025- cd $1.darcs && test -z "`darcs diff 2>&1`" && cd .. &&
3026- diff --exclude _darcs --exclude .bzr --exclude '*-darcs-backup*' -Nur $1 $1.darcs
3027- return $?
3028-}
3029-
3030-diff_bzr()
3031-{
3032- cd $1.bzr/trunk
3033- bzr update
3034- cd - >/dev/null
3035- diff --exclude _darcs --exclude .bzr --exclude '*-darcs-backup*' -Nur $1.bzr/trunk $1
3036- return $?
3037-}
3038-
3039-diff_hg()
3040-{
3041- hg -R $1.hg update
3042- diff --exclude _darcs --exclude .hg --exclude '*-darcs-backup*' -Nur $1.hg $1
3043- return $?
3044-}
3045-
3046-die()
3047-{
3048- echo "fatal: $@"
3049- exit 1
3050-}
3051-
3052-upd_file_darcs()
3053-{
3054- cd $1
3055- echo $3 > $2
3056- _drrec -a -m "updated '$2' to '$3'"
3057- cd ..
3058-}
3059-
3060-upd_file_git()
3061-{
3062- cd $1
3063- echo $3 > $2
3064- git commit -a -m "updated '$2' to '$3'"
3065- cd ..
3066-}
3067-
3068-upd_file_bzr()
3069-{
3070- cd $1
3071- echo $3 > $2
3072- bzr commit -m "updated '$2' to '$3'"
3073- cd ..
3074-}
3075-
3076-upd_file_hg()
3077-{
3078- cd $1
3079- echo $3 > $2
3080- hg commit -m "updated '$2' to '$3'"
3081- cd ..
3082-}
3083
3084=== removed directory 'exporters/darcs/t/test'
3085=== removed file 'exporters/darcs/t/test-bzr.sh'
3086--- exporters/darcs/t/test-bzr.sh 2009-08-10 22:19:29 +0000
3087+++ exporters/darcs/t/test-bzr.sh 1970-01-01 00:00:00 +0000
3088@@ -1,16 +0,0 @@
3089-. ./lib.sh
3090-
3091-create_darcs test --old-fashioned-inventory
3092-
3093-rm -rf test.darcs test.bzr
3094-mkdir test.bzr
3095-cd test.bzr
3096-bzr init-repo .
3097-cd ..
3098-if [ "$1" != "--stdout" ]; then
3099- darcs-fast-export test |(cd test.bzr; bzr fast-import -)
3100- diff_bzr test
3101- exit $?
3102-else
3103- darcs-fast-export test
3104-fi
3105
3106=== removed file 'exporters/darcs/t/test-git-d2x.sh'
3107--- exporters/darcs/t/test-git-d2x.sh 2009-08-10 22:19:29 +0000
3108+++ exporters/darcs/t/test-git-d2x.sh 1970-01-01 00:00:00 +0000
3109@@ -1,19 +0,0 @@
3110-. ./lib.sh
3111-
3112-create_darcs test --old-fashioned-inventory
3113-
3114-rm -rf test.git
3115-if [ "$1" != "--stdout" ]; then
3116- d2x -f git test
3117- diff_git test || die "initial conversion differs"
3118- upd_file_darcs test file2 upd_contents
3119- d2x -f git test
3120- diff_git test || die "update differs"
3121- upd_file_darcs test hungarian.gif "binary to text"
3122- d2x -f git test
3123- diff_git test || die "update2 differs"
3124- d2x -f git test
3125- diff_git test || die "update3 (noop) differs"
3126-else
3127- darcs-fast-export test
3128-fi
3129
3130=== removed file 'exporters/darcs/t/test-git-incremental.sh'
3131--- exporters/darcs/t/test-git-incremental.sh 2009-08-10 22:19:29 +0000
3132+++ exporters/darcs/t/test-git-incremental.sh 1970-01-01 00:00:00 +0000
3133@@ -1,24 +0,0 @@
3134-. ./lib.sh
3135-
3136-create_darcs test --old-fashioned-inventory
3137-
3138-rm -rf test.darcs test.git
3139-mkdir test.git
3140-cd test.git
3141-git --bare init
3142-cd ..
3143-if [ "$1" != "--stdout" ]; then
3144- dmark="$(pwd)/test.dfe-marks"
3145- gmark="$(pwd)/test.gfi-marks"
3146- rm -f $mark $gmark
3147- darcs-fast-export --export-marks=$dmark test |(cd test.git; git fast-import --export-marks=$gmark)
3148- diff_git test || die "initial conversion differs"
3149- upd_file_darcs test file2 upd_contents
3150- darcs-fast-export --export-marks=$dmark --import-marks=$dmark test |(cd test.git; git fast-import --export-marks=$gmark --import-marks=$gmark)
3151- diff_git test || die "update differs"
3152- upd_file_darcs test hungarian.gif "binary to text"
3153- darcs-fast-export --export-marks=$dmark --import-marks=$dmark test |(cd test.git; git fast-import --export-marks=$gmark --import-marks=$gmark)
3154- diff_git test || die "update2 differs"
3155-else
3156- darcs-fast-export test
3157-fi
3158
3159=== removed file 'exporters/darcs/t/test-git-progress.sh'
3160--- exporters/darcs/t/test-git-progress.sh 2009-08-10 22:19:29 +0000
3161+++ exporters/darcs/t/test-git-progress.sh 1970-01-01 00:00:00 +0000
3162@@ -1,18 +0,0 @@
3163-. ./lib.sh
3164-
3165-create_darcs test --old-fashioned-inventory
3166-
3167-rm -rf test.darcs test.git
3168-mkdir test.git
3169-cd test.git
3170-git --bare init
3171-cd ..
3172-if [ "$1" != "--stdout" ]; then
3173- darcs-fast-export --progres 2 test |(cd test.git; git fast-import)
3174- if [ $? = 0 ]; then
3175- diff_git test
3176- exit $?
3177- fi
3178-else
3179- darcs-fast-export test
3180-fi
3181
3182=== removed file 'exporters/darcs/t/test-git.sh'
3183--- exporters/darcs/t/test-git.sh 2009-08-10 22:19:29 +0000
3184+++ exporters/darcs/t/test-git.sh 1970-01-01 00:00:00 +0000
3185@@ -1,18 +0,0 @@
3186-. ./lib.sh
3187-
3188-create_darcs test --old-fashioned-inventory
3189-
3190-rm -rf test.darcs test.git
3191-mkdir test.git
3192-cd test.git
3193-git --bare init
3194-cd ..
3195-if [ "$1" != "--stdout" ]; then
3196- darcs-fast-export test |(cd test.git; git fast-import)
3197- if [ $? = 0 ]; then
3198- diff_git test
3199- exit $?
3200- fi
3201-else
3202- darcs-fast-export test
3203-fi
3204
3205=== removed file 'exporters/darcs/t/test-hg-d2x.sh'
3206--- exporters/darcs/t/test-hg-d2x.sh 2009-08-10 22:19:29 +0000
3207+++ exporters/darcs/t/test-hg-d2x.sh 1970-01-01 00:00:00 +0000
3208@@ -1,12 +0,0 @@
3209-. ./lib.sh
3210-
3211-create_darcs test --old-fashioned-inventory
3212-
3213-rm -rf test.hg
3214-if [ "$1" != "--stdout" ]; then
3215- d2x -f hg test
3216- diff_hg test
3217- exit $?
3218-else
3219- darcs-fast-export test
3220-fi
3221
3222=== removed file 'exporters/darcs/t/test-hg.sh'
3223--- exporters/darcs/t/test-hg.sh 2009-09-09 01:12:40 +0000
3224+++ exporters/darcs/t/test-hg.sh 1970-01-01 00:00:00 +0000
3225@@ -1,16 +0,0 @@
3226-. ./lib.sh
3227-
3228-create_darcs test --old-fashioned-inventory
3229-
3230-rm -rf test.darcs test.hg
3231-mkdir test.hg
3232-cd test.hg
3233-hg init
3234-cd ..
3235-if [ "$1" != "--stdout" ]; then
3236- darcs-fast-export test |(cd test.hg; hg fastimport -)
3237- diff_hg test
3238- exit $?
3239-else
3240- darcs-fast-export test
3241-fi
3242
3243=== removed directory 'exporters/darcs/t/test/_darcs'
3244=== removed directory 'exporters/darcs/t/test/_darcs/patches'
3245=== removed directory 'exporters/darcs/t/test/_darcs/prefs'
3246=== removed directory 'exporters/darcs/t/test/_darcs/pristine'
3247=== removed directory 'exporters/darcs/t/test2'
3248=== removed file 'exporters/darcs/t/test2-bzr-d2x.sh'
3249--- exporters/darcs/t/test2-bzr-d2x.sh 2009-08-10 22:19:29 +0000
3250+++ exporters/darcs/t/test2-bzr-d2x.sh 1970-01-01 00:00:00 +0000
3251@@ -1,19 +0,0 @@
3252-. ./lib.sh
3253-
3254-create_darcs test2 --darcs-2
3255-
3256-rm -rf test2.bzr
3257-if [ "$1" != "--stdout" ]; then
3258- d2x -f bzr test2
3259- diff_bzr test2 || die "initial conversion differs"
3260- upd_file_darcs test2 file2 upd_contents
3261- d2x -f bzr test2
3262- diff_bzr test2 || die "update differs"
3263- upd_file_darcs test2 hungarian.gif "binary to text"
3264- d2x -f bzr test2
3265- diff_bzr test2 || die "update2 differs"
3266- d2x -f bzr test2
3267- diff_bzr test2 || die "update3 (noop) differs"
3268-else
3269- darcs-fast-export test2
3270-fi
3271
3272=== removed file 'exporters/darcs/t/test2-bzr-incremental.sh'
3273--- exporters/darcs/t/test2-bzr-incremental.sh 2009-08-10 22:19:29 +0000
3274+++ exporters/darcs/t/test2-bzr-incremental.sh 1970-01-01 00:00:00 +0000
3275@@ -1,21 +0,0 @@
3276-. ./lib.sh
3277-
3278-create_darcs test2 --darcs-2
3279-
3280-rm -rf test2.darcs test2.bzr
3281-mkdir test2.bzr
3282-cd test2.bzr
3283-bzr init-repo .
3284-cd ..
3285-if [ "$1" != "--stdout" ]; then
3286- dmark="$(pwd)/test2.dfe-marks"
3287- bmark="$(pwd)/test2.bfi-marks"
3288- rm -f $mark $gmark
3289- darcs-fast-export --export-marks=$dmark test2 |(cd test2.bzr; bzr fast-import --export-marks=$bmark -)
3290- diff_bzr test2 || die "initial conversion differs"
3291- upd_file_darcs test2 file2 upd_contents
3292- darcs-fast-export --export-marks=$dmark --import-marks=$dmark test2 |(cd test2.bzr; bzr fast-import --export-marks=$bmark --import-marks=$bmark -)
3293- diff_bzr test2 || die "update differs"
3294-else
3295- darcs-fast-export test2
3296-fi
3297
3298=== removed file 'exporters/darcs/t/test2-git-funny-tagname.sh'
3299--- exporters/darcs/t/test2-git-funny-tagname.sh 2009-08-10 22:19:29 +0000
3300+++ exporters/darcs/t/test2-git-funny-tagname.sh 1970-01-01 00:00:00 +0000
3301@@ -1,25 +0,0 @@
3302-. ./lib.sh
3303-
3304-create_darcs test2 --darcs-2
3305-cd test2
3306-darcs tag "this :just (won't work; die)"
3307-darcs tag "accent-tag-éáőű"
3308-cd ..
3309-
3310-rm -rf test2.darcs test2.git
3311-mkdir test2.git
3312-cd test2.git
3313-git --bare init
3314-cd ..
3315-if [ "$1" != "--stdout" ]; then
3316- darcs-fast-export test2 |(cd test2.git; git fast-import)
3317- ret=$?
3318- if [ $ret = 0 ]; then
3319- diff_git test2
3320- exit $?
3321- else
3322- exit $ret
3323- fi
3324-else
3325- darcs-fast-export test2
3326-fi
3327
3328=== removed file 'exporters/darcs/t/test2-git-http.sh'
3329--- exporters/darcs/t/test2-git-http.sh 2009-10-22 10:26:11 +0000
3330+++ exporters/darcs/t/test2-git-http.sh 1970-01-01 00:00:00 +0000
3331@@ -1,22 +0,0 @@
3332-. ./lib.sh
3333-. ./lib-httpd.sh
3334-
3335-rm -rf test2.darcs test2.git httpd
3336-create_darcs test2 --darcs-2
3337-mkdir -p $HTTPD_DOCUMENT_ROOT_PATH
3338-mv -v test2 $HTTPD_DOCUMENT_ROOT_PATH
3339-ln -s $HTTPD_DOCUMENT_ROOT_PATH/test2 .
3340-
3341-mkdir test2.git
3342-cd test2.git
3343-git --bare init
3344-cd ..
3345-start_httpd
3346-darcs-fast-export $HTTPD_URL/test2 |(cd test2.git; git fast-import)
3347-ret=$?
3348-stop_httpd
3349-if [ $ret != 0 ]; then
3350- exit $ret
3351-fi
3352-diff_git test2
3353-exit $?
3354
3355=== removed file 'exporters/darcs/t/test2-git-incremental-specworkdir.sh'
3356--- exporters/darcs/t/test2-git-incremental-specworkdir.sh 2009-08-10 22:19:29 +0000
3357+++ exporters/darcs/t/test2-git-incremental-specworkdir.sh 1970-01-01 00:00:00 +0000
3358@@ -1,22 +0,0 @@
3359-. ./lib.sh
3360-
3361-create_darcs test2 --darcs-2
3362-
3363-rm -rf test2.darcs test2.git
3364-mkdir test2.git
3365-cd test2.git
3366-git --bare init
3367-mkdir darcs
3368-cd ..
3369-if [ "$1" != "--stdout" ]; then
3370- dmark="$(pwd)/test2.git/darcs/test2.dfe-marks"
3371- gmark="$(pwd)/test2.git/darcs/test2.gfi-marks"
3372- rm -f $mark $gmark
3373- darcs-fast-export --export-marks=$dmark test2 --working test2.git/darcs/repo |(cd test2.git; git fast-import --export-marks=$gmark)
3374- diff_git test2 || die "initial conversion differs"
3375- upd_file_darcs test2 file2 upd_contents
3376- darcs-fast-export --export-marks=$dmark --import-marks=$dmark test2 --working test2.git/darcs/repo |(cd test2.git; git fast-import --export-marks=$gmark --import-marks=$gmark)
3377- diff_git test2 || die "update differs"
3378-else
3379- darcs-fast-export test2
3380-fi
3381
3382=== removed file 'exporters/darcs/t/test2-git-incremental.sh'
3383--- exporters/darcs/t/test2-git-incremental.sh 2009-08-10 22:19:29 +0000
3384+++ exporters/darcs/t/test2-git-incremental.sh 1970-01-01 00:00:00 +0000
3385@@ -1,21 +0,0 @@
3386-. ./lib.sh
3387-
3388-create_darcs test2 --darcs-2
3389-
3390-rm -rf test2.darcs test2.git
3391-mkdir test2.git
3392-cd test2.git
3393-git --bare init
3394-cd ..
3395-if [ "$1" != "--stdout" ]; then
3396- dmark="$(pwd)/test2.dfe-marks"
3397- gmark="$(pwd)/test2.gfi-marks"
3398- rm -f $mark $gmark
3399- darcs-fast-export --export-marks=$dmark test2 |(cd test2.git; git fast-import --export-marks=$gmark)
3400- diff_git test2 || die "initial conversion differs"
3401- upd_file_darcs test2 file2 upd_contents
3402- darcs-fast-export --export-marks=$dmark --import-marks=$dmark test2 |(cd test2.git; git fast-import --export-marks=$gmark --import-marks=$gmark)
3403- diff_git test2 || die "update differs"
3404-else
3405- darcs-fast-export test2
3406-fi
3407
3408=== removed file 'exporters/darcs/t/test2-git.sh'
3409--- exporters/darcs/t/test2-git.sh 2009-08-10 22:19:29 +0000
3410+++ exporters/darcs/t/test2-git.sh 1970-01-01 00:00:00 +0000
3411@@ -1,18 +0,0 @@
3412-. ./lib.sh
3413-
3414-create_darcs test2 --darcs-2
3415-
3416-rm -rf test2.darcs test2.git
3417-mkdir test2.git
3418-cd test2.git
3419-git --bare init
3420-cd ..
3421-if [ "$1" != "--stdout" ]; then
3422- darcs-fast-export test2 |(cd test2.git; git fast-import)
3423- if [ $? = 0 ]; then
3424- diff_git test2
3425- exit $?
3426- fi
3427-else
3428- darcs-fast-export test2
3429-fi
3430
3431=== removed directory 'exporters/darcs/t/test2/_darcs'
3432=== removed directory 'exporters/darcs/t/test2/_darcs/inventories'
3433=== removed directory 'exporters/darcs/t/test2/_darcs/patches'
3434=== removed directory 'exporters/darcs/t/test2/_darcs/prefs'
3435=== removed directory 'exporters/darcs/t/test2/_darcs/pristine.hashed'
3436=== removed file 'exporters/darcs/t/testimport-bzr-x2d.sh'
3437--- exporters/darcs/t/testimport-bzr-x2d.sh 2009-08-10 22:19:29 +0000
3438+++ exporters/darcs/t/testimport-bzr-x2d.sh 1970-01-01 00:00:00 +0000
3439@@ -1,15 +0,0 @@
3440-. ./lib.sh
3441-
3442-create_bzr test
3443-
3444-rm -rf test.darcs
3445-x2d -f bzr test
3446-diff_importbzr test || die "initial conversion differs"
3447-upd_file_bzr test file2 upd_contents
3448-x2d -f bzr test
3449-diff_importbzr test || die "update differs"
3450-upd_file_bzr test hungarian.gif "binary to text"
3451-x2d -f bzr test
3452-diff_importbzr test || die "update2 differs"
3453-x2d -f bzr test
3454-diff_importbzr test || die "update3 (noop) differs"
3455
3456=== removed file 'exporters/darcs/t/testimport-bzr.sh'
3457--- exporters/darcs/t/testimport-bzr.sh 2009-08-10 22:19:29 +0000
3458+++ exporters/darcs/t/testimport-bzr.sh 1970-01-01 00:00:00 +0000
3459@@ -1,15 +0,0 @@
3460-. ./lib.sh
3461-
3462-create_bzr test
3463-
3464-rm -rf test.darcs
3465-mkdir test.darcs
3466-cd test.darcs
3467-darcs init
3468-cd ..
3469-(cd test; bzr fast-export .) | (cd test.darcs; darcs-fast-import)
3470-if [ $? != 0 ]; then
3471- exit 1
3472-fi
3473-diff_importbzr test
3474-exit $?
3475
3476=== removed file 'exporters/darcs/t/testimport-copy.sh'
3477--- exporters/darcs/t/testimport-copy.sh 2009-08-10 22:19:29 +0000
3478+++ exporters/darcs/t/testimport-copy.sh 1970-01-01 00:00:00 +0000
3479@@ -1,26 +0,0 @@
3480-. ./lib.sh
3481-
3482-rm -rf test
3483-mkdir test
3484-cd test
3485-git init
3486-echo a > file
3487-git add file
3488-git commit -m a1
3489-cp file file2
3490-git add file2
3491-git commit -m b
3492-cd ..
3493-
3494-rm -rf test.darcs
3495-mkdir test.darcs
3496-cd test.darcs
3497-darcs init
3498-cd ..
3499-(cd test; git fast-export -C -C HEAD) > out
3500-cat out | (cd test.darcs; darcs-fast-import)
3501-if [ $? != 0 ]; then
3502- exit 1
3503-fi
3504-diff_importgit test
3505-exit $?
3506
3507=== removed file 'exporters/darcs/t/testimport-darcs.sh'
3508--- exporters/darcs/t/testimport-darcs.sh 2009-08-10 22:19:29 +0000
3509+++ exporters/darcs/t/testimport-darcs.sh 1970-01-01 00:00:00 +0000
3510@@ -1,17 +0,0 @@
3511-. ./lib.sh
3512-
3513-create_darcs test2 --darcs-2
3514-
3515-rm -rf test2.importdarcs test2.darcs
3516-mkdir test2.importdarcs
3517-cd test2.importdarcs
3518-darcs init
3519-cd ..
3520-
3521-darcs-fast-export test2 | (cd test2.importdarcs; darcs-fast-import)
3522-
3523-if [ $? != 0 ]; then
3524- exit 1
3525-fi
3526-diff_importdarcs test2 test2.importdarcs
3527-exit $?
3528
3529=== removed file 'exporters/darcs/t/testimport-deleteall.sh'
3530--- exporters/darcs/t/testimport-deleteall.sh 2009-08-10 22:19:29 +0000
3531+++ exporters/darcs/t/testimport-deleteall.sh 1970-01-01 00:00:00 +0000
3532@@ -1,31 +0,0 @@
3533-. ./lib.sh
3534-
3535-rm -rf test
3536-mkdir test
3537-cd test
3538-git init
3539-echo a > file
3540-git add file
3541-echo A > file2
3542-git add file2
3543-git commit -m a12
3544-git rm file*
3545-echo b>file3
3546-git add file3
3547-git commit -m b
3548-cd ..
3549-
3550-rm -rf test.darcs
3551-mkdir test.darcs
3552-cd test.darcs
3553-darcs init
3554-cd ..
3555-(cd test; git fast-export --progress=2 HEAD) > out
3556-sed -i '/^D file$/d' out
3557-sed -i 's/^D file2$/deleteall/' out
3558-cat out | (cd test.darcs; darcs-fast-import)
3559-if [ $? != 0 ]; then
3560- exit 1
3561-fi
3562-diff_importgit test
3563-exit $?
3564
3565=== removed file 'exporters/darcs/t/testimport-git-incremental.sh'
3566--- exporters/darcs/t/testimport-git-incremental.sh 2009-08-10 22:19:29 +0000
3567+++ exporters/darcs/t/testimport-git-incremental.sh 1970-01-01 00:00:00 +0000
3568@@ -1,16 +0,0 @@
3569-. ./lib.sh
3570-
3571-create_git test
3572-
3573-rm -rf test.darcs
3574-mkdir test.darcs
3575-cd test.darcs
3576-darcs init
3577-cd ..
3578-gmark="$(pwd)/test.gfe-marks"
3579-dmark="$(pwd)/test.dfi-marks"
3580-(cd test; git fast-export --export-marks=$gmark HEAD) | (cd test.darcs; darcs-fast-import --export-marks=$dmark)
3581-diff_importgit test || die "initial conversion differs"
3582-upd_file_git test file2 upd_contents
3583-(cd test; git fast-export --export-marks=$gmark --import-marks=$gmark HEAD) | (cd test.darcs; darcs-fast-import --export-marks=$dmark --import-marks=$dmark)
3584-diff_importgit test || die "update differs"
3585
3586=== removed file 'exporters/darcs/t/testimport-git-twoway-gd.sh'
3587--- exporters/darcs/t/testimport-git-twoway-gd.sh 2009-08-10 22:19:29 +0000
3588+++ exporters/darcs/t/testimport-git-twoway-gd.sh 1970-01-01 00:00:00 +0000
3589@@ -1,34 +0,0 @@
3590-. ./lib.sh
3591-
3592-create_darcs test
3593-
3594-rm -rf test.git
3595-mkdir test.git
3596-cd test.git
3597-git init
3598-git darcs add upstream ../test
3599-git darcs pull upstream
3600-cd ..
3601-diff_git test || die "initial fetch differs"
3602-upd_file_darcs test file2 upd_contents
3603-cd test.git
3604-git darcs pull upstream
3605-cd ..
3606-diff_git test || die "fetch #1 differs"
3607-upd_file_git test.git file2 upd_contents2
3608-cd test.git
3609-git darcs push upstream
3610-cd ..
3611-diff_git test || die "push #1 difers"
3612-upd_file_darcs test file2 upd_contents3
3613-upd_file_darcs test file2 upd_contents32
3614-cd test.git
3615-git darcs pull upstream
3616-cd ..
3617-diff_git test || die "fetch #2 (multiple commits) differs"
3618-upd_file_git test.git file2 upd_contents4
3619-upd_file_git test.git file2 upd_contents42
3620-cd test.git
3621-git darcs push upstream
3622-cd ..
3623-diff_git test || die "push #2 (multiple commits) differs"
3624
3625=== removed file 'exporters/darcs/t/testimport-git-twoway.sh'
3626--- exporters/darcs/t/testimport-git-twoway.sh 2009-08-10 22:19:29 +0000
3627+++ exporters/darcs/t/testimport-git-twoway.sh 1970-01-01 00:00:00 +0000
3628@@ -1,30 +0,0 @@
3629-. ./lib.sh
3630-
3631-create_git test
3632-
3633-rm -rf test.darcs
3634-mkdir test.darcs
3635-cd test.darcs
3636-darcs init
3637-cd ..
3638-gmark="$(pwd)/test.gmarks"
3639-dmark="$(pwd)/test.dmarks"
3640-
3641-(cd test; git fast-export --export-marks=$gmark HEAD) | (cd test.darcs; darcs-fast-import --export-marks=$dmark)
3642-diff_importgit test || die "initial conversion differs"
3643-upd_file_git test file2 upd_contents
3644-(cd test; git fast-export --export-marks=$gmark --import-marks=$gmark HEAD) | (cd test.darcs; darcs-fast-import --export-marks=$dmark --import-marks=$dmark)
3645-diff_importgit test || die "git -> darcs update #1 differs"
3646-upd_file_darcs test.darcs file2 upd_contents2
3647-darcs-fast-export --export-marks=$dmark --import-marks=$dmark --working test/.git/darcs test.darcs | (cd test; git fast-import --export-marks=$gmark --import-marks=$gmark)
3648-(cd test; git checkout -f)
3649-diff_importgit test || die "darcs -> git update #2 differs"
3650-upd_file_git test file2 upd_contents3
3651-upd_file_git test file2 upd_contents32
3652-(cd test; git fast-export --export-marks=$gmark --import-marks=$gmark HEAD) | (cd test.darcs; darcs-fast-import --export-marks=$dmark --import-marks=$dmark)
3653-diff_importgit test || die "git -> darcs update #3 differs"
3654-upd_file_darcs test.darcs file2 upd_contents4
3655-upd_file_darcs test.darcs file2 upd_contents42
3656-darcs-fast-export --export-marks=$dmark --import-marks=$dmark --working test/.git/darcs test.darcs | (cd test; git fast-import --export-marks=$gmark --import-marks=$gmark)
3657-(cd test; git checkout -f)
3658-diff_importgit test || die "darcs -> git update #4 differs"
3659
3660=== removed file 'exporters/darcs/t/testimport-git-x2d.sh'
3661--- exporters/darcs/t/testimport-git-x2d.sh 2009-08-10 22:19:29 +0000
3662+++ exporters/darcs/t/testimport-git-x2d.sh 1970-01-01 00:00:00 +0000
3663@@ -1,15 +0,0 @@
3664-. ./lib.sh
3665-
3666-create_git test
3667-
3668-rm -rf test.darcs
3669-x2d -f git test
3670-diff_importgit test || die "initial conversion differs"
3671-upd_file_git test file2 upd_contents
3672-x2d -f git test
3673-diff_importgit test || die "update differs"
3674-upd_file_git test hungarian.gif "binary to text"
3675-x2d -f git test
3676-diff_importgit test || die "update2 differs"
3677-x2d -f git test
3678-diff_importgit test || die "update3 (noop) differs"
3679
3680=== removed file 'exporters/darcs/t/testimport-git.sh'
3681--- exporters/darcs/t/testimport-git.sh 2009-08-10 22:19:29 +0000
3682+++ exporters/darcs/t/testimport-git.sh 1970-01-01 00:00:00 +0000
3683@@ -1,15 +0,0 @@
3684-. ./lib.sh
3685-
3686-create_git test
3687-
3688-rm -rf test.darcs
3689-mkdir test.darcs
3690-cd test.darcs
3691-darcs init
3692-cd ..
3693-(cd test; git fast-export --progress=2 HEAD) | (cd test.darcs; darcs-fast-import)
3694-if [ $? != 0 ]; then
3695- exit 1
3696-fi
3697-diff_importgit test
3698-exit $?
3699
3700=== removed file 'exporters/darcs/t/testimport-gitsymlink.sh'
3701--- exporters/darcs/t/testimport-gitsymlink.sh 2010-06-27 17:37:50 +0000
3702+++ exporters/darcs/t/testimport-gitsymlink.sh 1970-01-01 00:00:00 +0000
3703@@ -1,45 +0,0 @@
3704-. ./lib.sh
3705-
3706-create_git test
3707-cd test
3708-# add two dirs with the some contents, then remove the second
3709-# and make it a symlink to the first
3710-mkdir dira
3711-echo blabla > dira/file
3712-echo blablabla > dira/file2
3713-mkdir dirb
3714-touch dirb/file
3715-touch dirb/file2
3716-git add dira dirb
3717-git commit -a -m "add dira/dirb"
3718-rm -rf dirb
3719-ln -s dira dirb
3720-git add dirb
3721-git commit -a -m "change a dir to a symlink"
3722-cd ..
3723-
3724-rm -rf test.darcs
3725-mkdir test.darcs
3726-cd test.darcs
3727-darcs init
3728-cd ..
3729-(cd test; git fast-export --progress=2 HEAD) | (cd test.darcs; darcs-fast-import)
3730-# we *do* want this to fail, but with error code 2. that means that we
3731-# detected that symlinks are not supported and the user does not get a
3732-# meaningless exception
3733-if [ $? != 2 ]; then
3734- exit 1
3735-fi
3736-
3737-# now try with the symhack option
3738-rm -rf test.darcs
3739-mkdir test.darcs
3740-cd test.darcs
3741-darcs init
3742-cd ..
3743-(cd test; git fast-export --progress=2 HEAD) | (cd test.darcs; darcs-fast-import --symhack)
3744-if [ $? != 0 ]; then
3745- exit 1
3746-fi
3747-diff_importgit test
3748-exit $?
3749
3750=== removed file 'exporters/darcs/t/testimport-hg-x2d.sh'
3751--- exporters/darcs/t/testimport-hg-x2d.sh 2009-08-10 22:19:29 +0000
3752+++ exporters/darcs/t/testimport-hg-x2d.sh 1970-01-01 00:00:00 +0000
3753@@ -1,15 +0,0 @@
3754-. ./lib.sh
3755-
3756-create_hg test
3757-
3758-rm -rf test.darcs
3759-x2d -f hg test
3760-diff_importhg test || die "initial conversion differs"
3761-upd_file_hg test file2 upd_contents
3762-x2d -f hg test
3763-diff_importhg test || die "update differs"
3764-upd_file_hg test hungarian.gif "binary to text"
3765-x2d -f hg test
3766-diff_importhg test || die "update2 differs"
3767-x2d -f hg test
3768-diff_importhg test || die "update3 (noop) differs"
3769
3770=== removed file 'exporters/darcs/t/testimport-hg.sh'
3771--- exporters/darcs/t/testimport-hg.sh 2009-09-09 01:12:40 +0000
3772+++ exporters/darcs/t/testimport-hg.sh 1970-01-01 00:00:00 +0000
3773@@ -1,15 +0,0 @@
3774-. ./lib.sh
3775-
3776-create_hg test
3777-
3778-rm -rf test.darcs
3779-mkdir test.darcs
3780-cd test.darcs
3781-darcs init
3782-cd ..
3783-(cd test; $pypath/bzrlib/plugins/fastimport/exporters/hg-fast-export.py -r .) | (cd test.darcs; darcs-fast-import)
3784-if [ $? != 0 ]; then
3785- exit 1
3786-fi
3787-diff_importhg test
3788-exit $?
3789
3790=== removed file 'exporters/darcs/t/testimport-rename.sh'
3791--- exporters/darcs/t/testimport-rename.sh 2009-08-10 22:19:29 +0000
3792+++ exporters/darcs/t/testimport-rename.sh 1970-01-01 00:00:00 +0000
3793@@ -1,25 +0,0 @@
3794-. ./lib.sh
3795-
3796-rm -rf test
3797-mkdir test
3798-cd test
3799-git init
3800-echo a > file
3801-git add file
3802-git commit -m a1
3803-git mv file file2
3804-git commit -m b
3805-cd ..
3806-
3807-rm -rf test.darcs
3808-mkdir test.darcs
3809-cd test.darcs
3810-darcs init
3811-cd ..
3812-(cd test; git fast-export -M HEAD) > out
3813-cat out | (cd test.darcs; darcs-fast-import)
3814-if [ $? != 0 ]; then
3815- exit 1
3816-fi
3817-diff_importgit test
3818-exit $?
3819
3820=== removed file 'exporters/darcs/x2d'
3821--- exporters/darcs/x2d 2011-10-06 00:11:52 +0000
3822+++ exporters/darcs/x2d 1970-01-01 00:00:00 +0000
3823@@ -1,125 +0,0 @@
3824-#!/bin/sh
3825-#
3826-# x2d - convert git, bzr or hg repos to darcs using fast-export
3827-#
3828-# Copyright (c) 2008 by Miklos Vajna <vmiklos@frugalware.org>
3829-#
3830-# This program is free software; you can redistribute it and/or modify
3831-# it under the terms of the GNU General Public License as published by
3832-# the Free Software Foundation; either version 2 of the License, or
3833-# (at your option) any later version.
3834-#
3835-# This program is distributed in the hope that it will be useful,
3836-# but WITHOUT ANY WARRANTY; without even the implied warranty of
3837-# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
3838-# GNU General Public License for more details.
3839-#
3840-# You should have received a copy of the GNU General Public License
3841-# along with this program. If not, see <http://www.gnu.org/licenses/>.
3842-#
3843-
3844-usage()
3845-{
3846- echo "Usage: x2d -f format repo"
3847-}
3848-
3849-die()
3850-{
3851- echo "$@"
3852- usage
3853- exit 1
3854-}
3855-
3856-check_up_to_date()
3857-{
3858- upstreamnum=$(darcs show repo|grep 'Num Patches'|sed 's/.*: //')
3859- if [ "$upstreamnum" = "$(cd $origin; eval $*)" ]; then
3860- echo "No remote changes to pull!"
3861- exit 0
3862- fi
3863-}
3864-
3865-case $1 in
3866- -h|--help)
3867- usage
3868- exit 0
3869- ;;
3870- -f)
3871- format="$2"
3872- shift 2
3873- ;;
3874-esac
3875-
3876-[ -n "$format" ] || die "Source format is not given!"
3877-
3878-case $format in
3879- git|bzr|hg)
3880- ;;
3881- *)
3882- die "The requested source format is not yet supported!"
3883- ;;
3884-esac
3885-
3886-common_opts=""
3887-while [ -n "$2" ]
3888-do
3889- common_opts="$common_opts $1"
3890- shift 1
3891-done
3892-origin="$1"
3893-shift 1
3894-
3895-[ -d "$origin" ] || die "Source repo does not exist!"
3896-
3897-# convert to abspath
3898-cd $origin
3899-origin=$(pwd)
3900-
3901-dmark="$origin.darcs/_darcs/fast-import/dfe-marks"
3902-fmark="$origin.darcs/_darcs/fast-import/ffi-marks"
3903-
3904-mkdir -p $origin.darcs
3905-cd $origin.darcs
3906-
3907-common_opts="$common_opts --logfile $origin.darcs/_darcs/fast-import/log"
3908-pypath="/$(python -c 'from distutils import sysconfig; print sysconfig.get_python_lib()[1:]')/"
3909-
3910-if [ ! -f $dmark ]; then
3911- darcs init
3912- mkdir -p _darcs/fast-import
3913- case $format in
3914- git)
3915- (cd $origin; git fast-export --export-marks=$fmark HEAD) | \
3916- darcs-fast-import --export-marks=$dmark $common_opts
3917- ;;
3918- bzr)
3919- (cd $origin; bzr fast-export \
3920- --export-marks=$fmark . ) | darcs-fast-import --export-marks=$dmark $common_opts
3921- ;;
3922- hg)
3923- (cd $origin; $pypath/bzrlib/plugins/fastimport/exporters/hg-fast-export.py -r . ) | \
3924- darcs-fast-import --export-marks=$dmark $common_opts
3925- esac
3926-else
3927- case $format in
3928- git)
3929- check_up_to_date "git rev-list HEAD |wc -l"
3930- (cd $origin; git fast-export --export-marks=$fmark --import-marks=$fmark HEAD) | \
3931- darcs-fast-import --export-marks=$dmark --import-marks=$dmark $common_opts
3932- ;;
3933- bzr)
3934- # bzr revno is not good here, because at merges
3935- # it produces less revision than the number we
3936- # have in darcs
3937- check_up_to_date "bzr log --include-merges |grep -c revno:"
3938- (cd $origin; bzr fast-export \
3939- --export-marks=$fmark --import-marks=$fmark . ) | \
3940- darcs-fast-import --export-marks=$dmark --import-marks=$dmark $common_opts
3941- ;;
3942- hg)
3943- check_up_to_date 'echo $(($(hg tip --template "{rev}")+1))'
3944- (cd $origin; $pypath/bzrlib/plugins/fastimport/exporters/hg-fast-export.py -r . ) | \
3945- darcs-fast-import --export-marks=$dmark --import-marks=$dmark $common_opts
3946- ;;
3947- esac
3948-fi
3949
3950=== removed file 'exporters/darcs/x2d.txt'
3951--- exporters/darcs/x2d.txt 2010-06-27 21:11:37 +0000
3952+++ exporters/darcs/x2d.txt 1970-01-01 00:00:00 +0000
3953@@ -1,28 +0,0 @@
3954-= x2d(1)
3955-
3956-== NAME
3957-
3958-x2d - convert git, bzr or hg repos to a darcs one using fast-export
3959-
3960-== SYNOPSIS
3961-
3962-x2d -f <format> [<importoptions>] <otherrepo>
3963-
3964-== DESCRIPTION
3965-
3966-x2d is a wrapper script that just automates doing an initial or
3967-continuing an incremental conversion. All it does is initializing the
3968-target darcs repo, starting darcs-fast-import and the relevant exporter
3969-with the proper switches and pipe the importer's output to the
3970-importer's standard input.
3971-
3972-== OPTIONS
3973-
3974---help::
3975- Display usage.
3976-
3977--f <format>::
3978- Specify the format of the source repo. Currently supported sources are
3979- git, bzr and hg. Incremental conversion is supported for all of them.
3980-
3981-The rest of the options is directly passed to darcs-fast-import.
3982
3983=== removed file 'exporters/hg-fast-export.README'
3984--- exporters/hg-fast-export.README 2009-07-23 04:55:18 +0000
3985+++ exporters/hg-fast-export.README 1970-01-01 00:00:00 +0000
3986@@ -1,54 +0,0 @@
3987-hg-fast-import.py - mercurial to bzr converter using bzr fast-import
3988-
3989-Legal
3990-=====
3991-
3992-Most hg-* scripts are licensed under the MIT license[0] and were written
3993-by Rocco Rutte <pdmef@gmx.net> with hints and help from the git list and
3994-#mercurial on freenode. hg-fast-export[1] was integrated into
3995-bzr-fastimport by Ian Clatworthy with permission from Rocco.
3996-
3997-The current maintainer is Frej Drejhammar <frej.drejhammar@gmail.com>.
3998-
3999-Usage
4000-=====
4001-
4002-Using hg-fast-export is quite simple for a mercurial repository <repo>:
4003-
4004- bzr init-repo foo.bzr
4005- cd foo.bzr
4006- hg-fast-import.py -r <repo> | bzr fast-import -
4007-
4008-Notes/Limitations
4009-=================
4010-
4011-hg-fast-import supports multiple branches but only named branches with exactly
4012-one head each. Otherwise commits to the tip of these heads within branch
4013-will get flattened into merge commits.
4014-
4015-The way the hg API and remote access protocol is designed it is not
4016-possible to use hg-fast-export on remote repositories
4017-(http/ssh). First clone the repository, then convert it.
4018-
4019-Design
4020-======
4021-
4022-hg-fast-import.py was designed in a way that doesn't require a 2-pass mechanism
4023-or any prior repository analysis: if just outputs what it finds.
4024-This also implies that it heavily relies on strictly
4025-linear ordering of changesets from hg, i.e. its append-only storage
4026-model so that changesets hg-fast-import already saw never get modified.
4027-
4028-Todo
4029-====
4030-
4031-Test incremental imports, particularly handling of branches and tags.
4032-
4033-For one-time conversions, everything should be fine.
4034-
4035-Footnotes
4036-=========
4037-
4038-[0] http://www.opensource.org/licenses/mit-license.php
4039-
4040-[1] http://repo.or.cz/w/fast-export.git
4041
4042=== removed file 'exporters/hg-fast-export.py'
4043--- exporters/hg-fast-export.py 2009-08-10 07:24:46 +0000
4044+++ exporters/hg-fast-export.py 1970-01-01 00:00:00 +0000
4045@@ -1,442 +0,0 @@
4046-#!/usr/bin/env python
4047-
4048-# Copyright (c) 2007, 2008 Rocco Rutte <pdmef@gmx.net> and others.
4049-# License: MIT <http://www.opensource.org/licenses/mit-license.php>
4050-
4051-from mercurial import repo,hg,cmdutil,util,ui,revlog,node
4052-from hg2git import setup_repo,fixup_user,get_branch,get_changeset
4053-from hg2git import load_cache,save_cache,get_git_sha1,set_default_branch,set_origin_name
4054-from tempfile import mkstemp
4055-from optparse import OptionParser
4056-import re
4057-import sys
4058-import os
4059-
4060-# silly regex to catch Signed-off-by lines in log message
4061-sob_re=re.compile('^Signed-[Oo]ff-[Bb]y: (.+)$')
4062-# insert 'checkpoint' command after this many commits or none at all if 0
4063-cfg_checkpoint_count=0
4064-# write some progress message every this many file contents written
4065-cfg_export_boundary=1000
4066-
4067-def gitmode(flags):
4068- return 'l' in flags and '120000' or 'x' in flags and '100755' or '100644'
4069-
4070-def wr(msg=''):
4071- if msg == None:
4072- msg = ''
4073- print msg
4074- #map(lambda x: sys.stderr.write('\t[%s]\n' % x),msg.split('\n'))
4075-
4076-def checkpoint(count):
4077- count=count+1
4078- if cfg_checkpoint_count>0 and count%cfg_checkpoint_count==0:
4079- sys.stderr.write("Checkpoint after %d commits\n" % count)
4080- wr('checkpoint')
4081- wr()
4082- return count
4083-
4084-def get_parent_mark(parent,marks):
4085- """Get the mark for some parent.
4086- If we saw it in the current session, return :%d syntax and
4087- otherwise the SHA1 from the cache."""
4088- return marks.get(str(parent),':%d' % (parent+1))
4089-
4090-def file_mismatch(f1,f2):
4091- """See if two revisions of a file are not equal."""
4092- return node.hex(f1)!=node.hex(f2)
4093-
4094-def split_dict(dleft,dright,l=[],c=[],r=[],match=file_mismatch):
4095- """Loop over our repository and find all changed and missing files."""
4096- for left in dleft.keys():
4097- right=dright.get(left,None)
4098- if right==None:
4099- # we have the file but our parent hasn't: add to left set
4100- l.append(left)
4101- elif match(dleft[left],right):
4102- # we have it but checksums mismatch: add to center set
4103- c.append(left)
4104- for right in dright.keys():
4105- left=dleft.get(right,None)
4106- if left==None:
4107- # if parent has file but we don't: add to right set
4108- r.append(right)
4109- # change is already handled when comparing child against parent
4110- return l,c,r
4111-
4112-def get_filechanges(repo,revision,parents,mleft):
4113- """Given some repository and revision, find all changed/deleted files."""
4114- l,c,r=[],[],[]
4115- for p in parents:
4116- if p<0: continue
4117- mright=repo.changectx(p).manifest()
4118- l,c,r=split_dict(mleft,mright,l,c,r)
4119- l.sort()
4120- c.sort()
4121- r.sort()
4122- return l,c,r
4123-
4124-def get_author(logmessage,committer,authors):
4125- """As git distincts between author and committer of a patch, try to
4126- extract author by detecting Signed-off-by lines.
4127-
4128- This walks from the end of the log message towards the top skipping
4129- empty lines. Upon the first non-empty line, it walks all Signed-off-by
4130- lines upwards to find the first one. For that (if found), it extracts
4131- authorship information the usual way (authors table, cleaning, etc.)
4132-
4133- If no Signed-off-by line is found, this defaults to the committer.
4134-
4135- This may sound stupid (and it somehow is), but in log messages we
4136- accidentially may have lines in the middle starting with
4137- "Signed-off-by: foo" and thus matching our detection regex. Prevent
4138- that."""
4139-
4140- loglines=logmessage.split('\n')
4141- i=len(loglines)
4142- # from tail walk to top skipping empty lines
4143- while i>=0:
4144- i-=1
4145- if len(loglines[i].strip())==0: continue
4146- break
4147- if i>=0:
4148- # walk further upwards to find first sob line, store in 'first'
4149- first=None
4150- while i>=0:
4151- m=sob_re.match(loglines[i])
4152- if m==None: break
4153- first=m
4154- i-=1
4155- # if the last non-empty line matches our Signed-Off-by regex: extract username
4156- if first!=None:
4157- r=fixup_user(first.group(1),authors)
4158- return r
4159- return committer
4160-
4161-def export_file_contents(ctx,manifest,files):
4162- count=0
4163- max=len(files)
4164- for file in files:
4165- # Skip .hgtags files. They only get us in trouble.
4166- if file == ".hgtags":
4167- sys.stderr.write('Skip %s\n' % (file))
4168- continue
4169- d=ctx.filectx(file).data()
4170- wr('M %s inline %s' % (gitmode(manifest.flags(file)),file))
4171- wr('data %d' % len(d)) # had some trouble with size()
4172- wr(d)
4173- count+=1
4174- if count%cfg_export_boundary==0:
4175- sys.stderr.write('Exported %d/%d files\n' % (count,max))
4176- if max>cfg_export_boundary:
4177- sys.stderr.write('Exported %d/%d files\n' % (count,max))
4178-
4179-def is_merge(parents):
4180- c=0
4181- for parent in parents:
4182- if parent>=0:
4183- c+=1
4184- return c>1
4185-
4186-def sanitize_name(name,what="branch"):
4187- """Sanitize input roughly according to git-check-ref-format(1)"""
4188-
4189- def dot(name):
4190- if name[0] == '.': return '_'+name[1:]
4191- return name
4192-
4193- n=name
4194- p=re.compile('([[ ~^:?*]|\.\.)')
4195- n=p.sub('_', n)
4196- if n[-1] == '/': n=n[:-1]+'_'
4197- n='/'.join(map(dot,n.split('/')))
4198- p=re.compile('_+')
4199- n=p.sub('_', n)
4200-
4201- if n!=name:
4202- sys.stderr.write('Warning: sanitized %s [%s] to [%s]\n' % (what,name,n))
4203- return n
4204-
4205-def export_commit(ui,repo,revision,marks,mapping,heads,last,max,count,authors,sob,brmap):
4206- def get_branchname(name):
4207- if brmap.has_key(name):
4208- return brmap[name]
4209- n=sanitize_name(name)
4210- brmap[name]=n
4211- return n
4212-
4213- (revnode,_,user,(time,timezone),files,desc,branch,_)=get_changeset(ui,repo,revision,authors)
4214- parents=repo.changelog.parentrevs(revision)
4215-
4216- branch=get_branchname(branch)
4217-
4218- wr('commit refs/heads/%s' % branch)
4219- wr('mark :%d' % (revision+1))
4220- if sob:
4221- wr('author %s %d %s' % (get_author(desc,user,authors),time,timezone))
4222- wr('committer %s %d %s' % (user,time,timezone))
4223- wr('data %d' % (len(desc)+1)) # wtf?
4224- wr(desc)
4225- wr()
4226-
4227- pidx1, pidx2 = 0, 1
4228- if parents[1] > 0:
4229- if parents[0] <= 0 or \
4230- repo.changelog.node(parents[0]) < repo.changelog.node(parents[1]):
4231- pidx1, pidx2 = 1, 0
4232-
4233- full_rev=False
4234- if revision==0: full_rev=True
4235-
4236- src=heads.get(branch,'')
4237- link=''
4238- if src!='':
4239- # if we have a cached head, this is an incremental import: initialize it
4240- # and kill reference so we won't init it again
4241- wr('from %s' % src)
4242- heads[branch]=''
4243- sys.stderr.write('%s: Initializing to parent [%s]\n' %
4244- (branch,src))
4245- link=src # avoid making a merge commit for incremental import
4246- elif link=='' and not heads.has_key(branch) and revision>0:
4247- if parents[0]>=0:
4248- # newly created branch with parent: connect to parent
4249- tmp=get_parent_mark(parents[0],marks)
4250- wr('from %s' % tmp)
4251- sys.stderr.write('%s: Link new branch to parent [%s]\n' %
4252- (branch,tmp))
4253- link=tmp # avoid making a merge commit for branch fork
4254- else:
4255- # newly created branch without parent: feed full revision
4256- full_rev=True
4257- elif last.get(branch,revision) != parents[pidx1] and parents[pidx1] > 0 and revision > 0:
4258- pm=get_parent_mark(parents[pidx1],marks)
4259- sys.stderr.write('%s: Placing commit [r%d] in branch [%s] on top of [r%d]\n' %
4260- (branch,revision,branch,parents[pidx1]));
4261- wr('from %s' % pm)
4262-
4263- if parents[pidx2] > 0:
4264- pm=get_parent_mark(parents[pidx2],marks)
4265- sys.stderr.write('%s: Merging with parent [%s] from [r%d]\n' %
4266- (branch,pm,parents[pidx2]))
4267- wr('merge %s' % pm)
4268-
4269- last[branch]=revision
4270- heads[branch]=''
4271- # we need this later to write out tags
4272- marks[str(revision)]=':%d'%(revision+1)
4273-
4274- ctx=repo.changectx(str(revision))
4275- man=ctx.manifest()
4276- added,changed,removed,type=[],[],[],''
4277-
4278- if full_rev:
4279- # first revision: feed in full manifest
4280- added=man.keys()
4281- added.sort()
4282- type='full'
4283- elif is_merge(parents):
4284- # later merge revision: feed in changed manifest
4285- # for many files comparing checksums is expensive so only do it for
4286- # merges where we really need it due to hg's revlog logic
4287- added,changed,removed=get_filechanges(repo,revision,parents,man)
4288- type='thorough delta'
4289- else:
4290- # later non-merge revision: feed in changed manifest
4291- # if we have exactly one parent, just take the changes from the
4292- # manifest without expensively comparing checksums
4293- f=repo.status(repo.lookup(parents[0]),revnode)[:3]
4294- added,changed,removed=f[1],f[0],f[2]
4295- type='simple delta'
4296-
4297- sys.stderr.write('%s: Exporting %s revision %d/%d with %d/%d/%d added/changed/removed files\n' %
4298- (branch,type,revision+1,max,len(added),len(changed),len(removed)))
4299-
4300- map(lambda r: wr('D %s' % r),removed)
4301- export_file_contents(ctx,man,added)
4302- export_file_contents(ctx,man,changed)
4303- wr()
4304-
4305- return checkpoint(count)
4306-
4307-def export_tags(ui,repo,marks_cache,mapping_cache,count,authors):
4308- l=repo.tagslist()
4309- for tag,node in l:
4310- tag=sanitize_name(tag,"tag")
4311- # ignore latest revision
4312- if tag=='tip': continue
4313- # ignore tags to nodes that are missing (ie, 'in the future')
4314- if node.encode('hex_codec') not in mapping_cache:
4315- sys.stderr.write('Tag %s refers to unseen node %s\n' % (tag, node.encode('hex_codec')))
4316- continue
4317-
4318- rev=int(mapping_cache[node.encode('hex_codec')])
4319-
4320- ref=marks_cache.get(str(rev),':%d' % (rev))
4321- if ref==None:
4322- sys.stderr.write('Failed to find reference for creating tag'
4323- ' %s at r%d\n' % (tag,rev))
4324- continue
4325- sys.stderr.write('Exporting tag [%s] at [hg r%d] [git %s]\n' % (tag,rev,ref))
4326- wr('reset refs/tags/%s' % tag)
4327- wr('from %s' % ref)
4328- wr()
4329- count=checkpoint(count)
4330- return count
4331-
4332-def load_authors(filename):
4333- cache={}
4334- if not os.path.exists(filename):
4335- return cache
4336- f=open(filename,'r')
4337- l=0
4338- lre=re.compile('^([^=]+)[ ]*=[ ]*(.+)$')
4339- for line in f.readlines():
4340- l+=1
4341- m=lre.match(line)
4342- if m==None:
4343- sys.stderr.write('Invalid file format in [%s], line %d\n' % (filename,l))
4344- continue
4345- # put key:value in cache, key without ^:
4346- cache[m.group(1).strip()]=m.group(2).strip()
4347- f.close()
4348- sys.stderr.write('Loaded %d authors\n' % l)
4349- return cache
4350-
4351-def verify_heads(ui,repo,cache,force):
4352- branches=repo.branchtags()
4353- l=[(-repo.changelog.rev(n), n, t) for t, n in branches.items()]
4354- l.sort()
4355-
4356- # get list of hg's branches to verify, don't take all git has
4357- for _,_,b in l:
4358- b=get_branch(b)
4359- sha1=get_git_sha1(b)
4360- c=cache.get(b)
4361- if sha1!=None and c!=None:
4362- sys.stderr.write('Verifying branch [%s]\n' % b)
4363- if sha1!=c:
4364- sys.stderr.write('Error: Branch [%s] modified outside hg-fast-export:'
4365- '\n%s (repo) != %s (cache)\n' % (b,sha1,c))
4366- if not force: return False
4367-
4368- # verify that branch has exactly one head
4369- t={}
4370- for h in repo.heads():
4371- (_,_,_,_,_,_,branch,_)=get_changeset(ui,repo,h)
4372- if t.get(branch,False):
4373- sys.stderr.write('Error: repository has at least one unnamed head: hg r%s\n' %
4374- repo.changelog.rev(h))
4375- if not force: return False
4376- t[branch]=True
4377-
4378- return True
4379-
4380-def mangle_mark(mark):
4381- return str(int(mark)-1)
4382-
4383-def hg2git(repourl,m,marksfile,mappingfile,headsfile,tipfile,authors={},sob=False,force=False):
4384- _max=int(m)
4385-
4386- try:
4387- import msvcrt
4388- msvcrt.setmode(sys.stdout.fileno(), os.O_BINARY)
4389- except ImportError:
4390- pass
4391-
4392- marks_cache=load_cache(marksfile,mangle_mark)
4393- mapping_cache=load_cache(mappingfile)
4394- heads_cache=load_cache(headsfile)
4395- state_cache=load_cache(tipfile)
4396-
4397- ui,repo=setup_repo(repourl)
4398-
4399- if not verify_heads(ui,repo,heads_cache,force):
4400- return 1
4401-
4402- try:
4403- tip=repo.changelog.count()
4404- except AttributeError:
4405- tip=len(repo)
4406-
4407- min=int(state_cache.get('tip',0))
4408- max=_max
4409- if _max<0 or max>tip:
4410- max=tip
4411-
4412- for rev in range(0,max):
4413- (revnode,_,_,_,_,_,_,_)=get_changeset(ui,repo,rev,authors)
4414- mapping_cache[revnode.encode('hex_codec')] = str(rev)
4415-
4416-
4417- c=0
4418- last={}
4419- brmap={}
4420- for rev in range(min,max):
4421- c=export_commit(ui,repo,rev,marks_cache,mapping_cache,heads_cache,last,max,c,authors,sob,brmap)
4422-
4423- state_cache['tip']=max
4424- state_cache['repo']=repourl
4425- save_cache(tipfile,state_cache)
4426- save_cache(mappingfile,mapping_cache)
4427-
4428- c=export_tags(ui,repo,marks_cache,mapping_cache,c,authors)
4429-
4430- sys.stderr.write('Issued %d commands\n' % c)
4431-
4432- return 0
4433-
4434-if __name__=='__main__':
4435- def bail(parser,opt):
4436- sys.stderr.write('Error: No %s option given\n' % opt)
4437- parser.print_help()
4438- sys.exit(2)
4439-
4440- parser=OptionParser()
4441-
4442- parser.add_option("-m","--max",type="int",dest="max",
4443- help="Maximum hg revision to import")
4444- parser.add_option("--mapping",dest="mappingfile",
4445- help="File to read last run's hg-to-git SHA1 mapping")
4446- parser.add_option("--marks",dest="marksfile",
4447- help="File to read git-fast-import's marks from")
4448- parser.add_option("--heads",dest="headsfile",
4449- help="File to read last run's git heads from")
4450- parser.add_option("--status",dest="statusfile",
4451- help="File to read status from")
4452- parser.add_option("-r","--repo",dest="repourl",
4453- help="URL of repo to import")
4454- parser.add_option("-s",action="store_true",dest="sob",
4455- default=False,help="Enable parsing Signed-off-by lines")
4456- parser.add_option("-A","--authors",dest="authorfile",
4457- help="Read authormap from AUTHORFILE")
4458- parser.add_option("-f","--force",action="store_true",dest="force",
4459- default=False,help="Ignore validation errors by force")
4460- parser.add_option("-M","--default-branch",dest="default_branch",
4461- help="Set the default branch")
4462- parser.add_option("-o","--origin",dest="origin_name",
4463- help="use <name> as namespace to track upstream")
4464-
4465- (options,args)=parser.parse_args()
4466-
4467- m=-1
4468- if options.max!=None: m=options.max
4469-
4470- if options.marksfile==None: options.marksfile = 'hg-export.marks'
4471- if options.mappingfile==None: options.mappingfile = 'hg-export.mapping'
4472- if options.headsfile==None: options.headsfile = 'hg-export.heads'
4473- if options.statusfile==None: options.statusfile = 'hg-export.status'
4474- if options.repourl==None: bail(parser,'--repo')
4475-
4476- a={}
4477- if options.authorfile!=None:
4478- a=load_authors(options.authorfile)
4479-
4480- if options.default_branch!=None:
4481- set_default_branch(options.default_branch)
4482-
4483- if options.origin_name!=None:
4484- set_origin_name(options.origin_name)
4485-
4486- sys.exit(hg2git(options.repourl,m,options.marksfile,options.mappingfile,options.headsfile,
4487- options.statusfile,authors=a,sob=options.sob,force=options.force))
4488
4489=== removed file 'exporters/hg-fast-export.sh'
4490--- exporters/hg-fast-export.sh 2009-02-12 01:55:46 +0000
4491+++ exporters/hg-fast-export.sh 1970-01-01 00:00:00 +0000
4492@@ -1,100 +0,0 @@
4493-#!/bin/sh
4494-
4495-# Copyright (c) 2007, 2008 Rocco Rutte <pdmef@gmx.net> and others.
4496-# License: MIT <http://www.opensource.org/licenses/mit-license.php>
4497-
4498-ROOT="`dirname $0`"
4499-REPO=""
4500-PFX="hg2git"
4501-SFX_MAPPING="mapping"
4502-SFX_MARKS="marks"
4503-SFX_HEADS="heads"
4504-SFX_STATE="state"
4505-QUIET=""
4506-PYTHON=${PYTHON:-python}
4507-
4508-USAGE="[--quiet] [-r <repo>] [-m <max>] [-s] [-A <file>] [-M <name>] [-o <name>]"
4509-LONG_USAGE="Import hg repository <repo> up to either tip or <max>
4510-If <repo> is omitted, use last hg repository as obtained from state file,
4511-GIT_DIR/$PFX-$SFX_STATE by default.
4512-
4513-Note: The argument order matters.
4514-
4515-Options:
4516- -m Maximum revision to import
4517- --quiet Passed to git-fast-import(1)
4518- -s Enable parsing Signed-off-by lines
4519- -A Read author map from file
4520- (Same as in git-svnimport(1) and git-cvsimport(1))
4521- -r Mercurial repository to import
4522- -M Set the default branch name (default to 'master')
4523- -o Use <name> as branch namespace to track upstream (eg 'origin')
4524-"
4525-
4526-. "$(git --exec-path)/git-sh-setup"
4527-cd_to_toplevel
4528-
4529-while case "$#" in 0) break ;; esac
4530-do
4531- case "$1" in
4532- -r|--r|--re|--rep|--repo)
4533- shift
4534- REPO="$1"
4535- ;;
4536- --q|--qu|--qui|--quie|--quiet)
4537- QUIET="--quiet"
4538- ;;
4539- -*)
4540- # pass any other options down to hg2git.py
4541- break
4542- ;;
4543- *)
4544- break
4545- ;;
4546- esac
4547- shift
4548-done
4549-
4550-# for convenience: get default repo from state file
4551-if [ x"$REPO" = x -a -f "$GIT_DIR/$PFX-$SFX_STATE" ] ; then
4552- REPO="`egrep '^:repo ' "$GIT_DIR/$PFX-$SFX_STATE" | cut -d ' ' -f 2`"
4553- echo "Using last hg repository \"$REPO\""
4554-fi
4555-
4556-# make sure we have a marks cache
4557-if [ ! -f "$GIT_DIR/$PFX-$SFX_MARKS" ] ; then
4558- touch "$GIT_DIR/$PFX-$SFX_MARKS"
4559-fi
4560-
4561-GIT_DIR="$GIT_DIR" $PYTHON "$ROOT/hg-fast-export.py" \
4562- --repo "$REPO" \
4563- --marks "$GIT_DIR/$PFX-$SFX_MARKS" \
4564- --mapping "$GIT_DIR/$PFX-$SFX_MAPPING" \
4565- --heads "$GIT_DIR/$PFX-$SFX_HEADS" \
4566- --status "$GIT_DIR/$PFX-$SFX_STATE" \
4567- "$@" \
4568-| git fast-import $QUIET --export-marks="$GIT_DIR/$PFX-$SFX_MARKS.tmp"
4569-
4570-# move recent marks cache out of the way...
4571-if [ -f "$GIT_DIR/$PFX-$SFX_MARKS" ] ; then
4572- mv "$GIT_DIR/$PFX-$SFX_MARKS" "$GIT_DIR/$PFX-$SFX_MARKS.old"
4573-else
4574- touch "$GIT_DIR/$PFX-$SFX_MARKS.old"
4575-fi
4576-
4577-# ...to create a new merged one
4578-cat "$GIT_DIR/$PFX-$SFX_MARKS.old" "$GIT_DIR/$PFX-$SFX_MARKS.tmp" \
4579-| uniq > "$GIT_DIR/$PFX-$SFX_MARKS"
4580-
4581-# cleanup
4582-rm -rf "$GIT_DIR/$PFX-$SFX_MARKS.old" "$GIT_DIR/$PFX-$SFX_MARKS.tmp"
4583-
4584-# save SHA1s of current heads for incremental imports
4585-# and connectivity (plus sanity checking)
4586-for head in `git branch | sed 's#^..##'` ; do
4587- id="`git rev-parse $head`"
4588- echo ":$head $id"
4589-done > "$GIT_DIR/$PFX-$SFX_HEADS"
4590-
4591-# check diff with color:
4592-# ( for i in `find . -type f | grep -v '\.git'` ; do diff -u $i $REPO/$i ; done | cdiff ) | less -r
4593
4594=== removed file 'exporters/hg2git.py'
4595--- exporters/hg2git.py 2011-10-06 21:39:31 +0000
4596+++ exporters/hg2git.py 1970-01-01 00:00:00 +0000
4597@@ -1,112 +0,0 @@
4598-
4599-# Copyright (c) 2007, 2008 Rocco Rutte <pdmef@gmx.net> and others.
4600-# License: MIT <http://www.opensource.org/licenses/mit-license.php>
4601-
4602-from mercurial import repo,hg,cmdutil,util,ui,revlog,node
4603-import re
4604-import os
4605-import sys
4606-
4607-# default git branch name
4608-cfg_master='master'
4609-# default origin name
4610-origin_name=''
4611-# silly regex to see if user field has email address
4612-user_re=re.compile('([^<]+) (<[^>]+>)$')
4613-# silly regex to clean out user names
4614-user_clean_re=re.compile('^["]([^"]+)["]$')
4615-
4616-def set_default_branch(name):
4617- global cfg_master
4618- cfg_master = name
4619-
4620-def set_origin_name(name):
4621- global origin_name
4622- origin_name = name
4623-
4624-def setup_repo(url):
4625- try:
4626- myui=ui.ui(interactive=False)
4627- except TypeError:
4628- myui=ui.ui()
4629- myui.setconfig('ui', 'interactive', 'off')
4630- return myui,hg.repository(myui,url)
4631-
4632-def fixup_user(user,authors):
4633- if authors!=None:
4634- # if we have an authors table, try to get mapping
4635- # by defaulting to the current value of 'user'
4636- user=authors.get(user,user)
4637- name,mail,m='','',user_re.match(user)
4638- if m==None:
4639- # if we don't have 'Name <mail>' syntax, use 'user
4640- # <devnull@localhost>' if use contains no at and
4641- # 'user <user>' otherwise
4642- name=user
4643- if '@' not in user:
4644- mail='<devnull@localhost>'
4645- else:
4646- mail='<%s>' % user
4647- else:
4648- # if we have 'Name <mail>' syntax, everything is fine :)
4649- name,mail=m.group(1),m.group(2)
4650-
4651- # remove any silly quoting from username
4652- m2=user_clean_re.match(name)
4653- if m2!=None:
4654- name=m2.group(1)
4655- return '%s %s' % (name,mail)
4656-
4657-def get_branch(name):
4658- # 'HEAD' is the result of a bug in mutt's cvs->hg conversion,
4659- # other CVS imports may need it, too
4660- if name=='HEAD' or name=='default' or name=='':
4661- name=cfg_master
4662- if origin_name:
4663- return origin_name + '/' + name
4664- return name
4665-
4666-def get_changeset(ui,repo,revision,authors={}):
4667- node=repo.lookup(revision)
4668- (manifest,user,(time,timezone),files,desc,extra)=repo.changelog.read(node)
4669- tz="%+03d%02d" % (-timezone / 3600, ((-timezone % 3600) / 60))
4670- branch=get_branch(extra.get('branch','master'))
4671- return (node,manifest,fixup_user(user,authors),(time,tz),files,desc,branch,extra)
4672-
4673-def mangle_key(key):
4674- return key
4675-
4676-def load_cache(filename,get_key=mangle_key):
4677- cache={}
4678- if not os.path.exists(filename):
4679- return cache
4680- f=open(filename,'r')
4681- l=0
4682- for line in f.readlines():
4683- l+=1
4684- fields=line.split(' ')
4685- if fields==None or not len(fields)==2 or fields[0][0]!=':':
4686- sys.stderr.write('Invalid file format in [%s], line %d\n' % (filename,l))
4687- continue
4688- # put key:value in cache, key without ^:
4689- cache[get_key(fields[0][1:])]=fields[1].split('\n')[0]
4690- f.close()
4691- return cache
4692-
4693-def save_cache(filename,cache):
4694- f=open(filename,'w+')
4695- map(lambda x: f.write(':%s %s\n' % (str(x),str(cache.get(x)))),cache.keys())
4696- f.close()
4697-
4698-def get_git_sha1(name,type='heads'):
4699- try:
4700- # use git-rev-parse to support packed refs
4701- cmd="GIT_DIR='%s' git rev-parse --verify refs/%s/%s 2>/dev/null" % (os.getenv('GIT_DIR','/dev/null'),type,name)
4702- p=os.popen(cmd)
4703- l=p.readline()
4704- p.close()
4705- if l == None or len(l) == 0:
4706- return None
4707- return l[0:40]
4708- except IOError:
4709- return None
4710
4711=== removed file 'exporters/svn-archive.c'
4712--- exporters/svn-archive.c 2008-03-14 19:17:42 +0000
4713+++ exporters/svn-archive.c 1970-01-01 00:00:00 +0000
4714@@ -1,240 +0,0 @@
4715-/*
4716- * svn-archive.c
4717- * ----------
4718- * Walk through a given revision of a local Subversion repository and export
4719- * all of the contents as a tarfile.
4720- *
4721- * Author: Chris Lee <clee@kde.org>
4722- * License: MIT <http://www.opensource.org/licenses/mit-license.php>
4723- */
4724-
4725-#define _XOPEN_SOURCE
4726-#include <unistd.h>
4727-#include <string.h>
4728-#include <stdio.h>
4729-#include <time.h>
4730-
4731-#ifndef PATH_MAX
4732-#define PATH_MAX 4096
4733-#endif
4734-
4735-#include <apr_general.h>
4736-#include <apr_strings.h>
4737-#include <apr_getopt.h>
4738-#include <apr_lib.h>
4739-
4740-#include <svn_types.h>
4741-#include <svn_pools.h>
4742-#include <svn_repos.h>
4743-#include <svn_fs.h>
4744-
4745-#undef SVN_ERR
4746-#define SVN_ERR(expr) SVN_INT_ERR(expr)
4747-#define apr_sane_push(arr, contents) *(char **)apr_array_push(arr) = contents
4748-
4749-#define TRUNK "/trunk"
4750-
4751-static time_t archive_time;
4752-
4753-time_t get_epoch(char *svn_date)
4754-{
4755- struct tm tm = {0};
4756- char *date = malloc(strlen(svn_date) * sizeof(char *));
4757- strncpy(date, svn_date, strlen(svn_date) - 8);
4758- strptime(date, "%Y-%m-%dT%H:%M:%S", &tm);
4759- free(date);
4760- return mktime(&tm);
4761-}
4762-
4763-int tar_header(apr_pool_t *pool, char *path, char *node, size_t f_size)
4764-{
4765- char buf[512];
4766- unsigned int i, checksum;
4767- svn_boolean_t is_dir;
4768-
4769- memset(buf, 0, sizeof(buf));
4770-
4771- if ((strlen(path) == 0) && (strlen(node) == 0)) {
4772- return 0;
4773- }
4774-
4775- if (strlen(node) == 0) {
4776- is_dir = 1;
4777- } else {
4778- is_dir = 0;
4779- }
4780-
4781- if (strlen(path) == 0) {
4782- strncpy(buf, apr_psprintf(pool, "%s", node), 99);
4783- } else if (strlen(path) + strlen(node) < 100) {
4784- strncpy(buf, apr_psprintf(pool, "%s/%s", path+1, node), 99);
4785- } else {
4786- fprintf(stderr, "really long file path...\n");
4787- strncpy(&buf[0], node, 99);
4788- strncpy(&buf[345], path+1, 154);
4789- }
4790-
4791- strncpy(&buf[100], apr_psprintf(pool, "%07o", (is_dir ? 0755 : 0644)), 7);
4792- strncpy(&buf[108], apr_psprintf(pool, "%07o", 1000), 7);
4793- strncpy(&buf[116], apr_psprintf(pool, "%07o", 1000), 7);
4794- strncpy(&buf[124], apr_psprintf(pool, "%011lo", f_size), 11);
4795- strncpy(&buf[136], apr_psprintf(pool, "%011lo", archive_time), 11);
4796- strncpy(&buf[156], (is_dir ? "5" : "0"), 1);
4797- strncpy(&buf[257], "ustar ", 8);
4798- strncpy(&buf[265], "clee", 31);
4799- strncpy(&buf[297], "clee", 31);
4800- // strncpy(&buf[329], apr_psprintf(pool, "%07o", 0), 7);
4801- // strncpy(&buf[337], apr_psprintf(pool, "%07o", 0), 7);
4802-
4803- strncpy(&buf[148], " ", 8);
4804- checksum = 0;
4805- for (i = 0; i < sizeof(buf); i++) {
4806- checksum += buf[i];
4807- }
4808- strncpy(&buf[148], apr_psprintf(pool, "%07o", checksum & 0x1fffff), 7);
4809-
4810- fwrite(buf, sizeof(char), sizeof(buf), stdout);
4811-
4812- return 0;
4813-}
4814-
4815-int tar_footer()
4816-{
4817- char block[1024];
4818- memset(block, 0, sizeof(block));
4819- fwrite(block, sizeof(char), sizeof(block), stdout);
4820-}
4821-
4822-int dump_blob(svn_fs_root_t *root, char *prefix, char *path, char *node, apr_pool_t *pool)
4823-{
4824- char *full_path, buf[512];
4825- apr_size_t len;
4826- svn_stream_t *stream;
4827- svn_filesize_t stream_length;
4828-
4829- full_path = apr_psprintf(pool, "%s%s/%s", prefix, path, node);
4830-
4831- SVN_ERR(svn_fs_file_length(&stream_length, root, full_path, pool));
4832- SVN_ERR(svn_fs_file_contents(&stream, root, full_path, pool));
4833-
4834- tar_header(pool, path, node, stream_length);
4835-
4836- do {
4837- len = sizeof(buf);
4838- memset(buf, '\0', sizeof(buf));
4839- SVN_ERR(svn_stream_read(stream, buf, &len));
4840- fwrite(buf, sizeof(char), sizeof(buf), stdout);
4841- } while (len == sizeof(buf));
4842-
4843- return 0;
4844-}
4845-
4846-int dump_tree(svn_fs_root_t *root, char *prefix, char *path, apr_pool_t *pool)
4847-{
4848- const void *key;
4849- void *val;
4850- char *node, *subpath, *full_path;
4851-
4852- apr_pool_t *subpool;
4853- apr_hash_t *dir_entries;
4854- apr_hash_index_t *i;
4855-
4856- svn_boolean_t is_dir;
4857-
4858- tar_header(pool, path, "", 0);
4859-
4860- SVN_ERR(svn_fs_dir_entries(&dir_entries, root, apr_psprintf(pool, "%s/%s", prefix, path), pool));
4861-
4862- subpool = svn_pool_create(pool);
4863-
4864- for (i = apr_hash_first(pool, dir_entries); i; i = apr_hash_next(i)) {
4865- svn_pool_clear(subpool);
4866- apr_hash_this(i, &key, NULL, &val);
4867- node = (char *)key;
4868-
4869- subpath = apr_psprintf(subpool, "%s/%s", path, node);
4870- full_path = apr_psprintf(subpool, "%s%s", prefix, subpath);
4871-
4872- svn_fs_is_dir(&is_dir, root, full_path, subpool);
4873-
4874- if (is_dir) {
4875- dump_tree(root, prefix, subpath, subpool);
4876- } else {
4877- dump_blob(root, prefix, path, node, subpool);
4878- }
4879- }
4880-
4881- svn_pool_destroy(subpool);
4882-
4883- return 0;
4884-}
4885-
4886-int crawl_filesystem(char *repos_path, char *root_path, apr_pool_t *pool)
4887-{
4888- char *path;
4889-
4890- apr_hash_t *props;
4891- apr_hash_index_t *i;
4892-
4893- svn_repos_t *repos;
4894- svn_fs_t *fs;
4895- svn_string_t *svndate;
4896- svn_revnum_t youngest_rev, export_rev;
4897- svn_fs_root_t *fs_root;
4898-
4899- SVN_ERR(svn_fs_initialize(pool));
4900- SVN_ERR(svn_repos_open(&repos, repos_path, pool));
4901- if ((fs = svn_repos_fs(repos)) == NULL)
4902- return -1;
4903- SVN_ERR(svn_fs_youngest_rev(&youngest_rev, fs, pool));
4904-
4905- export_rev = youngest_rev;
4906-
4907- SVN_ERR(svn_fs_revision_root(&fs_root, fs, export_rev, pool));
4908- SVN_ERR(svn_fs_revision_proplist(&props, fs, export_rev, pool));
4909-
4910- svndate = apr_hash_get(props, "svn:date", APR_HASH_KEY_STRING);
4911- archive_time = get_epoch((char *)svndate->data);
4912-
4913- fprintf(stderr, "Exporting archive of r%ld... \n", export_rev);
4914-
4915- dump_tree(fs_root, root_path, "", pool);
4916-
4917- tar_footer();
4918-
4919- fprintf(stderr, "done!\n");
4920-
4921- return 0;
4922-}
4923-
4924-int main(int argc, char *argv[])
4925-{
4926- apr_pool_t *pool;
4927- apr_getopt_t *options;
4928-
4929- apr_getopt_option_t long_options[] = {
4930- { "help", 'h', 0 },
4931- { "prefix", 'p', 0 },
4932- { "basename", 'b', 0 },
4933- { "revision", 'r', 0 },
4934- { NULL, 0, 0 }
4935- };
4936-
4937- if (argc < 2) {
4938- fprintf(stderr, "usage: %s REPOS_PATH [prefix]\n", argv[0]);
4939- return -1;
4940- }
4941-
4942- if (apr_initialize() != APR_SUCCESS) {
4943- fprintf(stderr, "You lose at apr_initialize().\n");
4944- return -1;
4945- }
4946-
4947- pool = svn_pool_create(NULL);
4948-
4949- crawl_filesystem(argv[1], (argc == 3 ? argv[2] : TRUNK), pool);
4950-
4951- apr_terminate();
4952-
4953- return 0;
4954-}
4955
4956=== removed file 'exporters/svn-fast-export.README'
4957--- exporters/svn-fast-export.README 2009-10-13 02:02:22 +0000
4958+++ exporters/svn-fast-export.README 1970-01-01 00:00:00 +0000
4959@@ -1,12 +0,0 @@
4960-To compile svn-fast-export.c, use make. You'll need to install
4961-some packages first using the package manager on your OS:
4962-
4963-* libsvn-dev - the Subversion libraries
4964-* libapr1-dev - the Apache Portable Runtime libraries
4965-
4966-Note: If someone with good knowledge of the Subversion
4967-Python bindings could rewrite svn-fast-export.py so that
4968-https://bugs.launchpad.net/bzr-fastimport/+bug/273361
4969-went away, then there would be much rejoicing throughout
4970-the land and the need for svn-fast-export.c would largely
4971-disappear.
4972
4973=== removed file 'exporters/svn-fast-export.c'
4974--- exporters/svn-fast-export.c 2008-03-14 19:17:42 +0000
4975+++ exporters/svn-fast-export.c 1970-01-01 00:00:00 +0000
4976@@ -1,187 +0,0 @@
4977-/*
4978- * svn-fast-export.c
4979- * ----------
4980- * Walk through each revision of a local Subversion repository and export it
4981- * in a stream that git-fast-import can consume.
4982- *
4983- * Author: Chris Lee <clee@kde.org>
4984- * License: MIT <http://www.opensource.org/licenses/mit-license.php>
4985- */
4986-
4987-#define _XOPEN_SOURCE
4988-#include <unistd.h>
4989-#include <string.h>
4990-#include <stdio.h>
4991-#include <time.h>
4992-
4993-#ifndef PATH_MAX
4994-#define PATH_MAX 4096
4995-#endif
4996-
4997-#include <apr_lib.h>
4998-#include <apr_getopt.h>
4999-#include <apr_general.h>
5000-
The diff has been truncated for viewing.

Subscribers

People subscribed via source and target branches