Merge lp:~vmiklos/bzr-fastimport/darcs into lp:~bzr/bzr-fastimport/fastimport.dev

Proposed by Miklos Vajna
Status: Merged
Approved by: Ian Clatworthy
Approved revision: no longer in the revision history of the source branch.
Merged at revision: not available
Proposed branch: lp:~vmiklos/bzr-fastimport/darcs
Merge into: lp:~bzr/bzr-fastimport/fastimport.dev
Diff against target: None lines
To merge this branch: bzr merge lp:~vmiklos/bzr-fastimport/darcs
Reviewer Review Type Date Requested Status
Ian Clatworthy Approve
Review via email: mp+9270@code.launchpad.net
To post a comment you must log in.
Revision history for this message
Ian Clatworthy (ian-clatworthy) :
review: Approve
lp:~vmiklos/bzr-fastimport/darcs updated
189. By Ian Clatworthy

merge darcs-fast-export (Miklos Jayna)

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
=== added directory 'exporters/darcs'
=== added file 'exporters/darcs/.gitignore'
--- exporters/darcs/.gitignore 1970-01-01 00:00:00 +0000
+++ exporters/darcs/.gitignore 2008-10-19 12:51:00 +0000
@@ -0,0 +1,3 @@
1Changelog
2HEADER.html
3.htaccess
04
=== added file 'exporters/darcs/Makefile'
--- exporters/darcs/Makefile 1970-01-01 00:00:00 +0000
+++ exporters/darcs/Makefile 2009-06-25 21:47:09 +0000
@@ -0,0 +1,55 @@
1VERSION = 0.9
2DATE := $(shell date +%Y-%m-%d)
3
4INSTALL = /usr/bin/install -c
5DESTDIR =
6prefix = /usr
7bindir = $(prefix)/bin
8mandir = $(prefix)/share/man/man1
9
10MAN_TXT = $(wildcard *.txt)
11MAN_HTML=$(patsubst %.txt,%.html,$(MAN_TXT))
12MAN=$(patsubst %.txt,%.1,$(MAN_TXT))
13
14PROGRAMS = darcs-fast-export darcs-fast-import d2x x2d git-darcs
15
16all: man
17
18install: all
19 $(INSTALL) -d $(DESTDIR)$(bindir)
20 $(INSTALL) -d $(DESTDIR)$(mandir)
21 $(INSTALL) -m755 $(PROGRAMS) $(DESTDIR)$(bindir)
22 $(INSTALL) -m644 *.1 $(DESTDIR)$(mandir)
23
24doc: HEADER.html Changelog html
25
26HEADER.html: README Makefile
27 asciidoc -a toc -a numbered -a sectids -o HEADER.html README
28
29Changelog: .git/refs/heads/master
30 git log >Changelog
31
32%.html: %.txt
33 asciidoc $^
34
35%.1: %.txt asciidoc.conf
36 a2x --asciidoc-opts="-f asciidoc.conf" \
37 -a dfe_version=$(VERSION) -a dfe_date=$(DATE) -f manpage $<
38
39man: $(MAN)
40
41html: $(MAN_HTML)
42
43dist:
44 git archive --format=tar --prefix=darcs-fast-export-$(VERSION)/ $(VERSION) > darcs-fast-export-$(VERSION).tar
45 mkdir -p darcs-fast-export-$(VERSION)
46 git log > darcs-fast-export-$(VERSION)/Changelog
47 tar rf darcs-fast-export-$(VERSION).tar darcs-fast-export-$(VERSION)/Changelog
48 rm -rf darcs-fast-export-$(VERSION)
49 gzip -f -9 darcs-fast-export-$(VERSION).tar
50
51release:
52 git tag -l |grep -q $(VERSION) || dg tag $(VERSION)
53 $(MAKE) dist
54 gpg --comment "See http://vmiklos.hu/gpg/ for info" \
55 -ba darcs-fast-export-$(VERSION).tar.gz
056
=== added file 'exporters/darcs/NEWS'
--- exporters/darcs/NEWS 1970-01-01 00:00:00 +0000
+++ exporters/darcs/NEWS 2009-06-25 21:47:09 +0000
@@ -0,0 +1,26 @@
1VERSION DESCRIPTION
2-----------------------------------------------------------------------------
30.9 - fix handling of accents in tag names
4 - warning fixes for Python-2.6
5 - git-darcs: the add subcommand can now remember d-f-e
6 options
7 - git-darcs: new list, find-darcs and find-git subcommands
80.8 - revert the "not exporting unchanged files multiple
9 times" optimization, it causes corrupted results in some
10 cases.
110.7 - new darcs-fast-export option: --progress
12 - massive speedup in darcs-fast-export due to not
13 exporting unchanged files multiple times and reading
14 patches directly
150.6 - add a new darcs-fast-import script, allowing two-way sync
16 - new darcs-fast-export option: --git-branch
17 - add a new git-darcs script, making two-way sync easy
180.5 - new --help, --encoding, --authors-file, --working and
19 --logfile options
20 - add "hashed" support (see darcs init -h)
21 - add incremental conversion support for darcs1 as well
22 - add d2x wrapper script
230.4 - add incremental conversion support
240.3 - add darcs2 support
250.2 - add bzr and hg support
260.1 - initial short and fast version, supporting darcs1->git
027
=== added file 'exporters/darcs/README'
--- exporters/darcs/README 1970-01-01 00:00:00 +0000
+++ exporters/darcs/README 2009-06-25 22:21:33 +0000
@@ -0,0 +1,192 @@
1= darcs backend for fast data importers
2Miklos Vajna <vmiklos-at-frugalware-dot-org>
3
4== Purpose and Features
5
6darcs-fast-export is a tool to dump a http://darcs.net/[darcs]
7repository in a format understood by "fast-importers" such as
8http://git.or.cz/[git]
9http://www.kernel.org/pub/software/scm/git/docs/git-fast-import.html[fast-import].
10It exhibits the following _features:_
11
12Fast::
13 darcs-fast-export provides a fast darcs backend for fast-import.
14 See link:t/bench-results/[here] for exact details.
15
16Correct::
17 darcs-fast-export produces correct results in any extreme cases.
18 It has been tested with a collection of large darcs repos (called
19 http://code.haskell.org/darcs/big-zoo/[big-zoo]). And several testcases
20 under the `t/` directory.
21
22Independent::
23 Ideally it should work with any fast importer, but actually it has been
24 tested with git fast-import, bzr fast-import and hg fastimport. (These
25 are the three fast-import implementations available ATM.)
26 +
27 hg fastimport needs three patches. While they are not in the upstream,
28 you can get it from my repository using
29+
30----
31$ hg clone static-http://frugalware.org/~vmiklos/hg/hg-fastimport
32----
33
34Formats::
35 It supports the 'darcs-2', 'hashed', and 'old-fashioned-inventory' darcs
36 repository formats.
37
38Incremental conversions::
39 It supports the usual `--export-marks` / `--import-marks` switches to
40 allow incremental conversion.
41
42Wrapper scripts::
43 A wrapper script called `d2x` is available if you find typing
44 `--export-marks` / `--import-marks` all the time boring. A similar one
45 is also provided for the other direction, called `x2d`. Finally, if you
46 want to work on darcs repos with git, you can use the `git-darcs`
47 wrapper.
48
49Author mappings::
50 Supports `--authors-file` option like Git's SVN adaptor, for DARCS
51 repositories that originated in CVS or SVN.
52
53Import script::
54 The pair of `darcs-fast-export`, `darcs-fast-import` is also
55 included in this repo. It has been tested with the fast-expoters of Git,
56 Hg, Bzr and - of course - Darcs itself.
57
58Two-way sync::
59 Using `darcs-fast-export` / `darcs-fast-import`, it is possible to
60 convert a darcs repo to an other VCS, work there, then convert your work
61 back to Darcs (or vica versa). This has been tested with "darcs -> git;
62 hack hack; git -> darcs".
63
64== Usage
65
66See the manpages:
67
68* link:darcs-fast-export.html[darcs-fast-export]
69* link:darcs-fast-import.html[darcs-fast-import]
70* link:d2x.html[d2x]
71* link:x2d.html[x2d]
72* link:git-darcs.html[git-darcs]
73
74=== Example
75
76Assuming that `test/` is a darcs repo, you could do this:
77----
78$ mkdir test.git
79$ cd test.git
80$ git --bare init
81$ cd ..
82$ darcs-fast-export test |(cd test.git; git fast-import)
83----
84
85For more examples (especially for bzr and hg), see the `t/` directory.
86
87== Download
88
89Using git:
90----
91$ git clone git://vmiklos.hu/darcs-fast-export
92----
93
94== Status
95
96In general, darcs-fast-export should work fine. darcs-fast-import has
97known problems with tags - other than that it should be okay. git-darcs
98should work properly as long as you are not paying too much attention to
99the imported tags (newly created tags won't be pushed back).
100
101darcs-fast-export has been tested with the following versions:
102
103Darcs version (see http://bugs.darcs.net/issue844[this bug] on why do
104you need such a new version):
105----
106$ darcs --version
1072.2.0 (release)
108----
109
110Git version:
111----
112$ git --version
113git version 1.6.0.2
114----
115
116Bzr versions:
117----
118$ bzr version
119Bazaar (bzr) 1.12
120$ (cd ~/bzr/fastimport; bzr log --limit 1|grep revno)
121revno: 181
122----
123
124Yes, you need the fastiport plugin from BZR, the last hg release series
125supported by fastimport-0.6 is hg-1.0.x.
126
127Mercurial (Hg) version:
128----
129$ hg version
130Mercurial Distributed SCM (version 1.2.1)
131----
132
133Strictly speaking this document is a wrong place to talk about enabling
134hg plugins. However...
135
136----
137$ cat ~/.hgrc
138[extensions]
139hgext.fastimport=
140----
141
142and once you installed the plugin correctly, you should have something like:
143
144----
145$ ls /usr/lib/python*/site-packages/hgext/fastimport/__init__.py
146/usr/lib/python2.5/site-packages/hgext/fastimport/__init__.py
147----
148
149== Additional resources
150
151You can reach the Changelog link:Changelog[here], and a gitweb interface
152http://vmiklos.hu/gitweb/?p=darcs-fast-export.git[here].
153
154The fast-import stream format documentation is
155http://git.kernel.org/?p=git/git.git;a=blob;f=fast-import.c;hb=HEAD[here]
156if you're interested.
157
158== Alternatives
159
160- http://repo.or.cz/w/darcs2git.git[darcs2git] tries to find conflict
161 resolutions (to map them to merge commits), but it's rather slow
162 because of this. It does not support the darcs2 format and/or
163 incremental conversions, either. darcs-fast-export may support mapping
164 to merge commits later, but not before
165 http://bugs.darcs.net/issue1261[this issue] is addressed.
166
167- http://progetti.arstecnica.it/tailor[tailor] is an any2any VCS
168 converter, but it produces corrupted results when converting the
169 big-zoo - see http://progetti.arstecnica.it/tailor/ticket/171[this
170 ticket].
171
172- http://git.sanityinc.com/?p=darcs-to-git.git[darcs-to-git] is similar
173 to darcs2git, but it fails for the testcases found in the testsuite of
174 darcs-fast-export.
175
176- http://github.com/freshtonic/undarcs/tree/master[undarcs] claims to be
177 fast, but its own README says it produces incorrect results. When I
178 tried, it did not handle the darcs2 format, binary files and incremental
179 support.
180
181== Thanks
182
183- Jason Dagit for helping me with darcs2 issues
184- Shawn O. Pearce and Johannes Schindelin for writing `git-fast-import`
185 / `git-fast-export`
186- Ian Clatworthy for writing bzr fast-import
187- Paul Crowley for writing hg fast-import
188- Matthias Andree for assorted improvements, among them the --help,
189 --encoding and --authors-file features (using Python's optparse), support
190 for hashed repositories, `_darcs/format` interpretation, and mangling
191 whitespace in tags to cope with repos imported into DARCS from CVS.
192- Pieter de Bie for writing git-bzr, which was the base of git-darcs
0193
=== added file 'exporters/darcs/TODO'
--- exporters/darcs/TODO 1970-01-01 00:00:00 +0000
+++ exporters/darcs/TODO 2008-12-26 01:09:24 +0000
@@ -0,0 +1,6 @@
1more intelligent tests, such as detect if the hg fastimport extension is
2not enabled, etc.
3
4parse the patches manually so we can avoid re-adding existing files manually.
5
6avoid darcs apply.
07
=== added file 'exporters/darcs/asciidoc.conf'
--- exporters/darcs/asciidoc.conf 1970-01-01 00:00:00 +0000
+++ exporters/darcs/asciidoc.conf 2008-12-22 23:48:45 +0000
@@ -0,0 +1,21 @@
1ifdef::doctype-manpage[]
2ifdef::backend-docbook[]
3[header]
4template::[header-declarations]
5<refentry>
6 <refentryinfo>
7 <date>{dfe_date}</date>
8 </refentryinfo>
9 <refmeta>
10 <refentrytitle>{mantitle}</refentrytitle>
11 <manvolnum>{manvolnum}</manvolnum>
12 <refmiscinfo class="source">darcs-fast-export</refmiscinfo>
13 <refmiscinfo class="version">{dfe_version}</refmiscinfo>
14 <refmiscinfo class="manual">darcs-fast-export manual</refmiscinfo>
15 </refmeta>
16 <refnamediv>
17 <refname>{manname}</refname>
18 <refpurpose>{manpurpose}</refpurpose>
19 </refnamediv>
20endif::backend-docbook[]
21endif::doctype-manpage[]
022
=== added file 'exporters/darcs/d2x'
--- exporters/darcs/d2x 1970-01-01 00:00:00 +0000
+++ exporters/darcs/d2x 2008-11-27 13:36:26 +0000
@@ -0,0 +1,114 @@
1#!/bin/sh
2#
3# d2x - convert darcs repos to git, bzr or hg using fast-import
4#
5# Copyright (c) 2008 by Miklos Vajna <vmiklos@frugalware.org>
6#
7# This program is free software; you can redistribute it and/or modify
8# it under the terms of the GNU General Public License as published by
9# the Free Software Foundation; either version 2 of the License, or
10# (at your option) any later version.
11#
12# This program is distributed in the hope that it will be useful,
13# but WITHOUT ANY WARRANTY; without even the implied warranty of
14# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15# GNU General Public License for more details.
16#
17# You should have received a copy of the GNU General Public License
18# along with this program; if not, write to the Free Software
19# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307,
20# USA.
21#
22
23usage()
24{
25 echo "Usage: d2x -f format darcsrepo"
26}
27
28die()
29{
30 echo "$@"
31 usage
32 exit 1
33}
34
35check_up_to_date()
36{
37 upstreamnum=$(cd $origin; darcs show repo|grep 'Num Patches'|sed 's/.*: //')
38 if [ "$upstreamnum" = "$(eval $*)" ]; then
39 echo "No remote changes to pull!"
40 exit 0
41 fi
42}
43
44case $1 in
45 -h|--help)
46 usage
47 exit 0
48 ;;
49 -f)
50 format="$2"
51 shift 2
52 ;;
53esac
54
55[ -n "$format" ] || die "Target format is not given!"
56
57case $format in
58 git|bzr|hg)
59 ;;
60 *)
61 die "The requested target format is not yet supported!"
62 ;;
63esac
64
65origin="$1"
66shift 1
67
68[ -d "$origin" ] || die "Source repo does not exist!"
69
70# convert to abspath
71cd $origin
72origin=$(pwd)
73
74dmark="$origin.$format/darcs/dfe-marks"
75fmark="$origin.$format/darcs/ffi-marks"
76
77mkdir -p $origin.$format/darcs
78cd $origin.$format
79
80common_opts="--working $origin.$format/darcs/repo --logfile $origin.$format/darcs/log $origin"
81if [ ! -f $dmark ]; then
82 case $format in
83 git)
84 git --bare init
85 darcs-fast-export $* --export-marks=$dmark $common_opts | \
86 git fast-import --export-marks=$fmark
87 ;;
88 bzr)
89 bzr init-repo .
90 darcs-fast-export $* --export-marks=$dmark $common_opts | \
91 bzr fast-import --export-marks=$fmark -
92 ;;
93 hg)
94 hg init
95 darcs-fast-export $* $origin | \
96 hg fastimport /dev/stdin
97 esac
98else
99 case $format in
100 git)
101 check_up_to_date "git rev-list HEAD |wc -l"
102 darcs-fast-export $* --export-marks=$dmark --import-marks=$dmark $common_opts | \
103 git fast-import --export-marks=$fmark --import-marks=$fmark
104 ;;
105 bzr)
106 check_up_to_date "cd master; bzr revno"
107 darcs-fast-export $* --export-marks=$dmark --import-marks=$dmark $common_opts | \
108 bzr fast-import --export-marks=$fmark --import-marks=$fmark -
109 ;;
110 hg)
111 die "Incremental conversion to hg is not yet supported by hg fastimport."
112 ;;
113 esac
114fi
0115
=== added file 'exporters/darcs/d2x.txt'
--- exporters/darcs/d2x.txt 1970-01-01 00:00:00 +0000
+++ exporters/darcs/d2x.txt 2008-11-27 13:36:26 +0000
@@ -0,0 +1,27 @@
1= d2x(1)
2
3== NAME
4
5d2x - convert darcs repos to git, bzr or hg using fast-import
6
7== SYNOPSIS
8
9d2x -f <format> <darcsrepo> [<darcs-fast-export options>]
10
11== DESCRIPTION
12
13d2x is a wrapper script that just automates doing an initial or
14continuing an incremental conversion. All it does is initializing the
15target repo, starting darcs-fast-export and the relevant importer with
16the proper switches and pipe the exporter's output to the importer's
17standard input.
18
19== OPTIONS
20
21--help::
22 Display usage.
23
24-f <format>::
25 Specify the format of the target repo. Currently supported targets are
26 git, bzr and hg. Incremental conversion is supported in case of git and
27 bzr.
028
=== added file 'exporters/darcs/darcs-fast-export'
--- exporters/darcs/darcs-fast-export 1970-01-01 00:00:00 +0000
+++ exporters/darcs/darcs-fast-export 2009-06-26 02:10:04 +0000
@@ -0,0 +1,337 @@
1#!/usr/bin/env python
2
3"""
4
5 darcs-fast-export - darcs backend for fast data importers
6
7 Copyright (c) 2008 Miklos Vajna <vmiklos@frugalware.org>
8 Copyright (c) 2008 Matthias Andree <matthias.andree@gmx.de>
9
10 This program is free software; you can redistribute it and/or modify
11 it under the terms of the GNU General Public License as published by
12 the Free Software Foundation; either version 2, or (at your option)
13 any later version.
14
15 This program is distributed in the hope that it will be useful,
16 but WITHOUT ANY WARRANTY; without even the implied warranty of
17 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
18 GNU General Public License for more details.
19
20 You should have received a copy of the GNU General Public License
21 along with this program; if not, write to the Free Software
22 Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
23
24"""
25
26import xml.dom.minidom
27import xml.parsers.expat
28import os
29import sys
30import gzip
31import time
32import shutil
33import subprocess
34import optparse
35import re
36
37sys = reload(sys)
38sys.setdefaultencoding("utf-8")
39
40def __get_zone():
41 now = time.localtime()
42 if time.daylight and now[-1]:
43 offset = time.altzone
44 else:
45 offset = time.timezone
46 hours, minutes = divmod(abs(offset), 3600)
47 if offset > 0:
48 sign = "-"
49 else:
50 sign = "+"
51 return sign, hours, minutes
52
53def get_zone_str():
54 sign, hours, minutes = __get_zone()
55 return "%s%02d%02d" % (sign, hours, minutes // 60)
56
57def get_zone_int():
58 sign, hours, minutes = __get_zone()
59 ret = hours*3600+minutes*60
60 if sign == "-":
61 ret *= -1
62 return ret
63
64def get_patchname(patch):
65 ret = []
66 s = ""
67 if patch.attributes['inverted'].value == 'True':
68 s = "UNDO: "
69 ret.append(s + patch.getElementsByTagName("name")[0].childNodes[0].data)
70 lines = patch.getElementsByTagName("comment")
71 if lines:
72 for i in lines[0].childNodes[0].data.split('\n'):
73 if not i.startswith("Ignore-this: "):
74 ret.append(i)
75 return "\n".join(ret).encode('utf-8')
76
77def get_author(patch):
78 """darcs allows any freeform string, but fast-import has a more
79 strict format, so fix up broken author names here."""
80
81 author = patch.attributes['author'].value
82 if author in authormap:
83 author = authormap[author]
84 if not len(author):
85 author = "darcs-fast-export <darcs-fast-export>"
86 # add missing name
87 elif not ">" in author:
88 author = "%s <%s>" % (author.split('@')[0], author)
89 # avoid double quoting
90 elif author[0] == '"' and author[-1] == '"':
91 author = author[1:-1]
92 # name after email
93 elif author[-1] != '>':
94 author = author[author.index('>')+2:] + ' ' + author[:author.index('>')+1]
95 return author.encode('utf-8')
96
97def get_date(patch):
98 try:
99 date = time.strptime(patch, "%Y%m%d%H%M%S")
100 except ValueError:
101 date = time.strptime(patch[:19] + patch[-5:], '%a %b %d %H:%M:%S %Y')
102 return int(time.mktime(date)) + get_zone_int()
103
104def progress(s):
105 print "progress [%s] %s" % (time.strftime("%Y-%m-%d %H:%M:%S", time.localtime()), s)
106 sys.stdout.flush()
107
108def log(s):
109 logsock.write("[%s] %s" % (time.strftime("%Y-%m-%d %H:%M:%S", time.localtime()), s))
110 logsock.flush()
111
112hashes = []
113def parse_inventory(sock=None):
114 prev = None
115 nextprev = False
116 buf = []
117 if not sock:
118 sock = open(os.path.join("_darcs", "hashed_inventory"))
119 for i in sock.readlines():
120 if i.startswith("hash"):
121 buf.insert(0, i[6:-1])
122 if i.startswith("Starting with inventory:"):
123 nextprev = True
124 elif nextprev:
125 prev = i[:-1]
126 nextprev = False
127 sock.close()
128 for i in buf:
129 hashes.insert(0, i)
130 if prev:
131 sock = gzip.open(os.path.join("_darcs", "inventories", prev))
132 parse_inventory(sock)
133
134# Option Parser
135usage="%prog [options] darcsrepo"
136opp = optparse.OptionParser(usage=usage)
137opp.add_option("--import-marks", metavar="IFILE",
138 help="read state for incremental imports from IFILE")
139opp.add_option("--export-marks", metavar="OFILE",
140 help="write state for incremental imports from OFILE")
141opp.add_option("--encoding",
142 help="encoding of log [default: %default], if unspecified and input isn't utf-8, guess")
143opp.add_option("--authors-file", metavar="F",
144 help="read author transformations in old=new format from F")
145opp.add_option("--working", metavar="W",
146 help="working directory which is removed at the end of non-incremental conversions")
147opp.add_option("--logfile", metavar="L",
148 help="log file which contains the output of external programs invoked during the conversion")
149opp.add_option("--git-branch", metavar="B",
150 help="git branch [default: refs/heads/master]")
151opp.add_option("--progress", metavar="P",
152 help="insert progress statements after every n commit [default: 100]")
153(options, args) = opp.parse_args()
154if len(args) < 1:
155 opp.error("darcsrepo required")
156
157export_marks = []
158import_marks = []
159if options.import_marks:
160 sock = open(options.import_marks)
161 for i in sock.readlines():
162 line = i.strip()
163 if not len(line):
164 continue
165 import_marks.append(line.split(' ')[1])
166 export_marks.append(line)
167 sock.close()
168
169# read author mapping file in gitauthors format,
170# i. e. in=out (one per # line)
171authormap = {}
172if options.authors_file:
173 sock = open(options.authors_file)
174 authormap = dict([i.strip().split('=',1) for i in sock])
175 sock.close()
176
177origin = os.path.abspath(args[0])
178if options.working:
179 working = os.path.abspath(options.working)
180else:
181 working = "%s.darcs" % origin
182patchfile = "%s.patch" % origin
183if options.logfile:
184 logfile = os.path.abspath(options.logfile)
185else:
186 logfile = "%s.log" % origin
187logsock = open(logfile, "a")
188if options.git_branch:
189 git_branch = options.git_branch
190else:
191 git_branch = "refs/heads/master"
192
193if options.progress:
194 prognum = int(options.progress)
195else:
196 prognum = 100
197
198progress("getting list of patches")
199if not len(import_marks):
200 sock = os.popen("darcs changes --xml --reverse --repo %s" % origin)
201else:
202 sock = os.popen("darcs changes --xml --reverse --repo %s --from-match 'hash %s'" % (origin, import_marks[-1]))
203buf = sock.read()
204sock.close()
205# this is hackish. we need to escape some bad chars, otherwise the xml
206# will not be valid
207buf = buf.replace('\x1b', '^[')
208if options.encoding:
209 xmldoc = xml.dom.minidom.parseString(unicode(buf, options.encoding).encode('utf-8'))
210else:
211 try:
212 xmldoc = xml.dom.minidom.parseString(buf)
213 except xml.parsers.expat.ExpatError:
214 import chardet
215 progress("encoding is not utf8, guessing charset")
216 encoding = chardet.detect(buf)['encoding']
217 progress("detected encoding is %s" % encoding)
218 xmldoc = xml.dom.minidom.parseString(unicode(buf, encoding).encode('utf-8'))
219sys.stdout.flush()
220
221darcs2 = False
222oldfashionedpatch = True
223cwd = os.getcwd()
224if os.path.exists(os.path.join(origin, "_darcs", "format")):
225 sock = open(os.path.join(origin, "_darcs", "format"))
226 format = [x.strip() for x in sock]
227 sock.close()
228 darcs2 = 'darcs-2' in format
229 oldfashionedpatch = not 'hashed' in format
230if not oldfashionedpatch:
231 progress("parsing the inventory")
232 os.chdir(origin)
233 parse_inventory()
234if not options.import_marks or not os.path.exists(working):
235 # init the tmp darcs repo
236 os.mkdir(working)
237 os.chdir(working)
238 if darcs2:
239 os.system("darcs init --darcs-2")
240 else:
241 os.system("darcs init --old-fashioned-inventory")
242else:
243 os.chdir(working)
244if options.import_marks:
245 sock = os.popen("darcs pull -a --match 'hash %s' %s" % (import_marks[-1], origin))
246 log("Building/updating working directory:\n%s" % sock.read())
247 sock.close()
248
249# this is the number of the NEXT patch
250count = 1
251patches = xmldoc.getElementsByTagName('patch')
252if len(import_marks):
253 patches = patches[1:]
254 count = len(import_marks) + 1
255if len(export_marks):
256 # this is the mark number of the NEXT patch
257 markcount = int(export_marks[-1].split(' ')[0][1:]) + 1
258else:
259 markcount = count
260# this may be huge and we need it many times
261patchnum = len(patches)
262
263if not len(import_marks):
264 progress("starting export, repo has %d patches" % patchnum)
265else:
266 progress("continuing export, %d patches to convert" % patchnum)
267paths = []
268for i in patches:
269 # apply the patch
270 hash = i.attributes['hash'].value
271 buf = ["\nNew patches:\n"]
272 if oldfashionedpatch:
273 sock = gzip.open(os.path.join(origin, "_darcs", "patches", hash))
274 else:
275 sock = gzip.open(os.path.join(origin, "_darcs", "patches", hashes[count-1]))
276 buf.append(sock.read())
277 sock.close()
278 sock = os.popen("darcs changes --context")
279 buf.append(sock.read())
280 sock.close()
281 sock = subprocess.Popen(["darcs", "apply", "--allow-conflicts"], stdin=subprocess.PIPE, stdout=subprocess.PIPE)
282 sock.stdin.write("".join(buf))
283 sock.stdin.close()
284 log("Applying %s:\n%s" % (hash, sock.stdout.read()))
285 sock.stdout.close()
286 message = get_patchname(i)
287 # export the commit
288 print "commit %s" % git_branch
289 print "mark :%s" % markcount
290 if options.export_marks:
291 export_marks.append(":%s %s" % (markcount, hash))
292 date = get_date(i.attributes['date'].value)
293 print "committer %s %s %s" % (get_author(i), date, get_zone_str())
294 print "data %d\n%s" % (len(message), message)
295 if markcount > 1:
296 print "from :%s" % (markcount-1)
297 # export the files
298 for j in paths:
299 print "D %s" % j
300 paths = []
301 for (root, dirs, files) in os.walk ("."):
302 for f in files:
303 j = os.path.normpath(os.path.join(root, f))
304 if j.startswith("_darcs") or "-darcs-backup" in j:
305 continue
306 paths.append(j)
307 sock = open(j)
308 buf = sock.read()
309 sock.close()
310 # darcs does not track the executable bit :/
311 print "M 644 inline %s" % j
312 print "data %s\n%s" % (len(buf), buf)
313 if message[:4] == "TAG ":
314 tag = re.sub('[^\xe9-\xf8\w.\-]+', '_', message[4:].strip().split('\n')[0]).strip('_')
315 print "tag %s" % tag
316 print "from :%s" % markcount
317 print "tagger %s %s %s" % (get_author(i), date, get_zone_str())
318 print "data %d\n%s" % (len(message), message)
319 if count % prognum == 0:
320 progress("%d/%d patches" % (count, patchnum))
321 count += 1
322 markcount += 1
323
324os.chdir(cwd)
325
326if not options.export_marks:
327 shutil.rmtree(working)
328logsock.close()
329
330if options.export_marks:
331 progress("writing export marks")
332 sock = open(options.export_marks, 'w')
333 sock.write("\n".join(export_marks))
334 sock.write("\n")
335 sock.close()
336
337progress("finished")
0338
=== added file 'exporters/darcs/darcs-fast-export.txt'
--- exporters/darcs/darcs-fast-export.txt 1970-01-01 00:00:00 +0000
+++ exporters/darcs/darcs-fast-export.txt 2008-11-28 14:43:30 +0000
@@ -0,0 +1,61 @@
1= darcs-fast-export(1)
2
3== NAME
4
5darcs-fast-export - darcs frontend to git fast-import
6
7== SYNOPSIS
8
9darcs-fast-export [<options>] <darcsrepo>
10
11== DESCRIPTION
12
13darcs-fast-export expects one argument, the path to the source darcs
14repository. It will print the git fast-import format on standard output
15(stdout).
16
17The script can produce the fast-import stream format from the darcs
18repository. It supports incremental conversion as well, via the
19--import-marks / --export-marks switches.
20
21== OPTIONS
22
23-h, --help::
24 Display usage.
25
26--import-marks::
27 Import marks from a given file. This is read at the beginning of the
28 conversion at once. Use it if you want to continue an incremental
29 conversion.
30
31--export-marks::
32 Export marks to a given file at the end of the conversion. It can be the
33 same as the one for --import-marks as it is written only once at the
34 end. Use it if you want to be able to incrementally update the target
35 repository later.
36
37--encoding::
38 The encoding of the author names and commit messages in the repository.
39 The default is utf-8. If it is not the default, it will be guessed.
40 Given that it takes some time, you can explicitly specify it as an
41 option to make the conversion faster. Content in the output will encoded
42 as utf-8 and will be written that way to the target repository, unless
43 the importer re-encodes it again to some other character set.
44
45--working::
46 The conversion is done by applying the patches one by one and recording
47 the state of the working directory. You can specify the path of this
48 directory using this option.
49
50--logfile::
51 The output of external commands are redirected to a log file. You can
52 specify the path of that file with this parameter.
53
54--git-branch::
55 There is only one branch in one darcs repository, but the fast-import
56 stream format allows multiple branches, thus the exporter has to name
57 darcs's branch. The default value is 'refs/heads/master'.
58
59--progress::
60 Insert progress statements after every <n> patches, to be shown by the
61 fast importer during import.
062
=== added file 'exporters/darcs/darcs-fast-import'
--- exporters/darcs/darcs-fast-import 1970-01-01 00:00:00 +0000
+++ exporters/darcs/darcs-fast-import 2009-06-26 02:05:21 +0000
@@ -0,0 +1,310 @@
1#!/usr/bin/env python
2
3"""
4
5 darcs-fast-export - darcs backend for fast data exporters
6
7 Copyright (c) 2008 Miklos Vajna <vmiklos@frugalware.org>
8 Copyright (c) 2008 Matthias Andree <matthias.andree@gmx.de>
9
10 This program is free software; you can redistribute it and/or modify
11 it under the terms of the GNU General Public License as published by
12 the Free Software Foundation; either version 2, or (at your option)
13 any later version.
14
15 This program is distributed in the hope that it will be useful,
16 but WITHOUT ANY WARRANTY; without even the implied warranty of
17 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
18 GNU General Public License for more details.
19
20 You should have received a copy of the GNU General Public License
21 along with this program; if not, write to the Free Software
22 Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
23
24"""
25
26import sys
27import os
28import re
29import time
30import shutil
31import optparse
32import subprocess
33
34class Handler:
35 def __init__(self):
36 self.marks = {}
37 self.files = []
38 self.prevfiles = None
39 self.ch = None
40 self.line = None
41 self.unread_line = False
42 self.eof = False
43 self.debug = False
44 self.export_marks = []
45 self.import_marks = []
46
47 def read_next_line(self):
48 if self.unread_line:
49 self.unread_line = False
50 return
51 self.line = ""
52 if self.eof:
53 return
54 if self.ch:
55 self.line += self.ch
56 self.ch = None
57 buf = sys.stdin.readline()
58 if not len(buf):
59 self.eof = True
60 else:
61 self.line += buf
62 if self.debug:
63 print "read_next_line: '%s'" % self.line
64
65 def read(self, length):
66 buf = ""
67 if self.ch:
68 buf += self.ch
69 self.ch = None
70 buf += sys.stdin.read(length)
71 if self.debug:
72 print "read: '%s'" % buf
73 return buf
74
75 def skip_optional_lf(self):
76 self.ch = self.read(1)
77 if self.ch == "\n":
78 self.ch = None
79
80 def bug(self, s):
81 raise Exception(s)
82
83 def get_date(self, ts, tz):
84 # int(ts) is seconds since epoch. Since we're trying to
85 # capture both the absolute time of the commit and the
86 # localtime in the timezone of the committer, we need to turn
87 # the (seconds-since-epoch, committer-timezone-offset) pair
88 # that we get from the git-fast-export stream format into a
89 # localized-time-plus-timezone-marker string that darcs will
90 # accept. Therefore, we parse the timezone-offset (which
91 # looks like +0500 or +0000 or -0730 or something) and add it
92 # to seconds-since-epoch before calling gmtime().
93 mo = re.search(r'^([\+\-])(\d\d)(\d\d)$', tz)
94 offset = 60*60*int(mo.group(2)) + 60*int(mo.group(3))
95 if mo.group(1) == "-":
96 offset = -offset
97 offset_time = int(ts) + offset
98 s = time.strftime("%a %b %d %H:%M:%S %Y", time.gmtime(offset_time))
99 items = s.split(' ')
100 return " ".join(items[:-1]) + " " + tz + " " + items[-1]
101
102 def handle_mark(self):
103 if self.line.startswith("mark :"):
104 self.mark_num = int(self.line[6:-1])
105 self.read_next_line()
106
107 def handle_data(self):
108 if not self.line.startswith("data "):
109 self.bug("Expected 'data n' command, found: '%s'" % self.line[:-1])
110 length = int(self.line[5:-1])
111 self.buf = self.read(length)
112 self.skip_optional_lf()
113
114 def handle_blob(self):
115 self.read_next_line()
116 self.handle_mark()
117 self.handle_data()
118 self.marks[self.mark_num] = self.buf
119
120 def handle_ident(self, s):
121 items = s.split(' ')
122 self.ident = " ".join(items[:-2])
123 self.date = self.get_date(items[-2], items[-1])
124
125 def handle_msg(self):
126 items = self.buf.split('\n')
127 self.short = items[0]
128 self.long = "\n".join(items[1:])
129
130 def handle_tag(self):
131 version = self.line[:-1].split(' ')[1]
132 self.read_next_line()
133 if self.line.startswith("from "):
134 self.read_next_line()
135 if self.line.startswith("tagger "):
136 self.handle_ident(self.line[7:-1])
137 self.read_next_line()
138 self.handle_data()
139 self.skip_optional_lf()
140 sock = subprocess.Popen(["darcs", "tag", "--pipe"], stdin=subprocess.PIPE, stdout=subprocess.PIPE)
141 buf = [self.date, self.ident, version]
142 sock.stdin.write("\n".join(buf))
143 sock.stdin.close()
144 self.log("Tagging %s:\n%s" % (version, sock.stdout.read()))
145 sock.stdout.close()
146
147 def handle_commit(self):
148 if not self.prevfiles and self.options.import_marks:
149 # first commit in an incremental continued
150 # import
151 for (root, dirs, files) in os.walk("."):
152 for i in files:
153 path = os.path.normpath(os.path.join(root, i))
154 if path.startswith("_darcs") or "-darcs-backup" in path:
155 continue
156 self.files.append(path)
157 self.prevfiles = self.files[:]
158 adds = []
159
160 self.read_next_line()
161 self.handle_mark()
162 if self.line.startswith("author "):
163 self.handle_ident(self.line[7:-1])
164 self.read_next_line()
165 if self.line.startswith("committer "):
166 self.handle_ident(self.line[10:-1])
167 self.read_next_line()
168 self.handle_data()
169 self.skip_optional_lf()
170 self.handle_msg()
171 self.read_next_line()
172 if self.line.startswith("from "):
173 self.read_next_line()
174 while self.line.startswith("merge "):
175 self.read_next_line()
176 while len(self.line) > 0:
177 if self.line.startswith("deleteall"):
178 path = self.line[2:-1]
179 for path in self.files:
180 os.unlink(path)
181 self.files = []
182 elif self.line.startswith("D "):
183 path = self.line[2:-1]
184 if os.path.exists(path):
185 os.unlink(path)
186 if path in self.files:
187 self.files.remove(path)
188 elif self.line.startswith("R "):
189 os.system("darcs mv %s" % self.line[2:])
190 elif self.line.startswith("C "):
191 src, dest = self.line[:-1].split(' ')[1:]
192 shutil.copy(src.strip('"'), dest.strip('"'))
193 os.system("darcs add %s" % dest)
194 elif self.line.startswith("M "):
195 items = self.line.split(' ')
196 path = items[3][:-1]
197 sock = open(path, "w")
198 if items[2] != "inline":
199 idx = int(items[2][1:])
200 sock.write(self.marks[idx])
201 del self.marks[idx]
202 else:
203 self.read_next_line()
204 self.handle_data()
205 sock.write(self.buf)
206 sock.close()
207 if path not in self.prevfiles:
208 adds.append(path)
209 if path not in self.files:
210 self.files.append(path)
211 else:
212 self.unread_line = True
213 break
214 self.read_next_line()
215 if not len(self.line):
216 break
217
218 for i in adds:
219 os.system("darcs add %s" % i)
220 sock = subprocess.Popen(["darcs", "record", "--ignore-times", "-a", "--pipe"], stdin=subprocess.PIPE, stdout=subprocess.PIPE)
221 buf = [self.date, self.ident, self.short, self.long]
222 sock.stdin.write("\n".join(buf))
223 sock.stdin.close()
224 self.log("Recording :%s:\n%s" % (self.mark_num, sock.stdout.read()))
225 sock.stdout.close()
226
227 if self.options.export_marks:
228 # yeah, an xml parser would be better, but
229 # should we mess with encodings just because of
230 # this? i hope not
231 sock = os.popen("darcs changes --last=1 --xml", "r")
232 buf = sock.read()
233 sock.close()
234 hash = buf.split('\n')[1].split("'")[-2]
235 self.export_marks.append(":%s %s" % (self.mark_num, hash))
236
237 def handle_progress(self, s):
238 print "progress [%s] %s" % (time.strftime("%Y-%m-%d %H:%M:%S", time.localtime()), s.strip())
239 sys.stdout.flush()
240
241 def handle_opts(self):
242 # Option Parser
243 usage="%prog [options]"
244 opp = optparse.OptionParser(usage=usage)
245 opp.add_option("--import-marks", metavar="IFILE",
246 help="read state for incremental imports from IFILE")
247 opp.add_option("--export-marks", metavar="OFILE",
248 help="write state for incremental imports to OFILE")
249 opp.add_option("--logfile", metavar="L",
250 help="log file which contains the output of external programs invoked during the conversion")
251 (self.options, args) = opp.parse_args()
252
253 if self.options.logfile:
254 logfile = self.options.logfile
255 else:
256 logfile = "_darcs/import.log"
257 self.logsock = open(os.path.abspath(logfile), "a")
258
259 def log(self, s):
260 self.logsock.write("[%s] %s" % (time.strftime("%Y-%m-%d %H:%M:%S", time.localtime()), s))
261 self.logsock.flush()
262
263 def handle_export_marks(self):
264 if self.options.export_marks:
265 sock = open(self.options.export_marks, 'w')
266 sock.write("\n".join(self.export_marks))
267 sock.write("\n")
268 sock.close()
269
270 def handle_import_marks(self):
271 if self.options.import_marks:
272 sock = open(self.options.import_marks)
273 for i in sock.readlines():
274 line = i.strip()
275 if not len(line):
276 continue
277 self.import_marks.append(line.split(' ')[1])
278 self.export_marks.append(line)
279 sock.close()
280
281 def handle(self):
282 self.handle_opts()
283 self.handle_import_marks()
284
285 while not self.eof:
286 self.read_next_line()
287 if not len(self.line[:-1]):
288 pass
289 elif self.line.startswith("blob"):
290 self.handle_blob()
291 elif self.line.startswith("commit"):
292 self.handle_commit()
293 elif self.line.startswith("tag"):
294 self.handle_tag()
295 elif self.line.startswith("reset"):
296 self.read_next_line()
297 if not self.line.startswith("from "):
298 self.unread_line = True
299 elif self.line.startswith("checkpoint"):
300 pass
301 elif self.line.startswith("progress"):
302 self.handle_progress(self.line[9:])
303 else:
304 self.bug("'%s': invalid command" % self.line[:-1])
305
306 self.handle_export_marks()
307
308if __name__ == "__main__":
309 h = Handler()
310 h.handle()
0311
=== added file 'exporters/darcs/darcs-fast-import.txt'
--- exporters/darcs/darcs-fast-import.txt 1970-01-01 00:00:00 +0000
+++ exporters/darcs/darcs-fast-import.txt 2008-11-23 22:11:24 +0000
@@ -0,0 +1,35 @@
1= darcs-fast-import(1)
2
3== NAME
4
5darcs-fast-import - darcs backend to the 'fast-import stream' format
6
7== SYNOPSIS
8
9darcs-fast-import [<options>]
10
11== DESCRIPTION
12
13darcs-fast-import can produce a darcs repository from a fast-import
14stream, read from the standard input. It supports incremental conversion
15as well, via the --import-marks / --export-marks switches.
16
17== OPTIONS
18
19-h, --help::
20 Display usage.
21
22--import-marks::
23 Import marks from a given file. This is read at the beginning of the
24 conversion at once. Use it if you want to continue an incremental
25 conversion.
26
27--export-marks::
28 Export marks to a given file at the end of the conversion. It can be the
29 same as the one for --import-marks as it is written only once at the
30 end. Use it if you want to be able to incrementally update the target
31 repository later.
32
33--logfile::
34 The output of external commands are redirected to a log file. You can
35 specify the path of that file with this parameter.
036
=== added file 'exporters/darcs/git-darcs'
--- exporters/darcs/git-darcs 1970-01-01 00:00:00 +0000
+++ exporters/darcs/git-darcs 2009-07-14 15:05:28 +0000
@@ -0,0 +1,264 @@
1#!/bin/bash
2#
3# git-darcs - bidirectional operation between a darcs repo and git
4#
5# Copyright (c) 2008 by Miklos Vajna <vmiklos@frugalware.org>
6#
7# Based on git-bzr, which is
8#
9# Copyright (c) 2008 Pieter de Bie <pdebie@ai.rug.nl>
10#
11# This program is free software; you can redistribute it and/or modify
12# it under the terms of the GNU General Public License as published by
13# the Free Software Foundation; either version 2 of the License, or
14# (at your option) any later version.
15#
16# This program is distributed in the hope that it will be useful,
17# but WITHOUT ANY WARRANTY; without even the implied warranty of
18# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
19# GNU General Public License for more details.
20#
21# You should have received a copy of the GNU General Public License
22# along with this program; if not, write to the Free Software
23# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307,
24# USA.
25#
26
27add()
28{
29 name="$1"
30 shift
31 location="$1"
32 shift
33 if ! [ -n "$name" -a -n "$location" ]; then
34 echo "Usage: git darcs add name location [darcs-fast-export options]"
35 exit
36 fi
37 if git remote show |grep -q $name; then
38 echo "There is already a remote with that name"
39 exit
40 fi
41 if [ -n "$(git config git-darcs.$name.location)" ]; then
42 echo "There is already a darcs repo with that name"
43 exit
44 fi
45 if [ ! -d $location/_darcs ]; then
46 echo "Remote is not a darcs repository"
47 exit
48 fi
49 git config git-darcs.$name.location $location
50 git config git-darcs.$name.darcs-fast-export-options "$*"
51 echo "Darcs repo $name added. You can fetch it with 'git darcs fetch $name'"
52 if ! [ -z "$*" ]; then
53 echo "darcs-fast-export will get options: $*"
54 fi
55}
56
57get_location()
58{
59 l=$(git config git-darcs.$remote.location)
60 if [ -z "$l" ]; then
61 echo "Cannot find darcs remote with name '$remote'." >&2
62 exit
63 fi
64 echo $l
65}
66
67fetch()
68{
69 remote="$1"
70 shift
71 if ! [ -n "$remote" -a -z "$*" ]; then
72 echo "Usage: git darcs fetch reponame"
73 exit
74 fi
75 location=$(get_location $remote)
76 git_map=$git_dir/darcs-git/$remote-git-map
77 darcs_map=$git_dir/darcs-git/$remote-darcs-map
78 common_opts="--working $git_dir/darcs-git/repo --logfile $git_dir/darcs-git/fetch.log --git-branch=darcs/$remote"
79 dfe_opts=$(git config git-darcs.$remote.darcs-fast-export-options)
80 if [ ! -f $git_map -a ! -f $darcs_map ]; then
81 echo "There doesn't seem to be an existing refmap."
82 echo "Doing an initial import"
83 mkdir -p $git_dir/darcs-git
84 darcs-fast-export --export-marks=$darcs_map $common_opts $dfe_opts $location | \
85 git fast-import --export-marks=$git_map
86 elif [ -f $git_map -a -f $darcs_map ]; then
87 echo "Updating remote $remote"
88 old_rev=$(git rev-parse darcs/$remote)
89 darcs-fast-export --import-marks=$darcs_map --export-marks=$darcs_map $common_opts $dfe_opts $location | \
90 git fast-import --quiet --import-marks=$git_map --export-marks=$git_map
91 new_rev=$(git rev-parse darcs/$remote)
92 if [ "$old_rev" != "$new_rev" ]; then
93 echo "Fetched the following updates:"
94 git shortlog $old_rev..$new_rev
95 else
96 echo "Nothing fetched."
97 exit
98 fi
99 else
100 echo "One of the mapfiles is missing! Something went wrong!"
101 exit
102 fi
103}
104
105pull()
106{
107 remote="$1"
108 shift
109 if ! [ -n "$remote" -a -z "$*" ]; then
110 echo "Usage: git darcs pull reponame"
111 exit
112 fi
113 fetch $remote
114 # see if we need to merge or rebase
115 branch=$(git symbolic-ref HEAD|sed 's|.*/||')
116 if [ "$(git config branch.$branch.rebase)" = "true" ]; then
117 git rebase darcs/$remote
118 else
119 git merge darcs/$remote
120 fi
121}
122
123push()
124{
125 remote="$1"
126 shift
127 if ! [ -n "$remote" -a -z "$*" ]; then
128 echo "Usage: git darcs push reponame"
129 exit
130 fi
131 location=$(get_location $remote)
132 if [ -n "$(git rev-list --left-right HEAD...darcs/$remote | sed -n '/^>/ p')" ]; then
133 echo "HEAD is not a strict child of $remote, cannot push. Merge first"
134 exit
135 fi
136 if [ -z "$(git rev-list --left-right HEAD...darcs/$remote | sed -n '/^</ p')" ]; then
137 echo "Nothing to push. Commit something first"
138 exit
139 fi
140 git_map=$git_dir/darcs-git/$remote-git-map
141 darcs_map=$git_dir/darcs-git/$remote-darcs-map
142 if [ ! -f $git_map -o ! -f $darcs_map ]; then
143 echo "We do not have refmapping yet. Then how can I push?"
144 exit
145 fi
146 echo "Pushing the following updates:"
147 git shortlog darcs/$remote..
148 git fast-export --import-marks=$git_map --export-marks=$git_map HEAD | \
149 (cd $location; darcs-fast-import --import-marks=$darcs_map --export-marks=$darcs_map \
150 --logfile $git_dir/darcs-git/push.log)
151 if [ $? == 0 ]; then
152 git update-ref darcs/$remote HEAD
153 fi
154}
155
156# List the darcs remotes
157list()
158{
159 if [ -z "$*" ]
160 then
161 git config -l | sed -n -e '/git-darcs\..*/ {s/git-darcs\.//; s/\.location=.*//p}'
162 exit
163 elif [ "$#" -eq 1 ]
164 then
165 case $1 in
166 -v|--verbose)
167 git config -l | sed -n -e '/git-darcs\..*/ {s/git-darcs\.//; s/\.location=/\t/p}'
168 exit
169 ;;
170 esac
171 fi
172 echo "Usage: git darcs list [-v|--verbose]"
173 exit 1
174}
175
176# Find the darcs commit(s) supporting a git SHA1 prefix
177find_darcs()
178{
179 sha1="$1"
180 shift
181 if [ -z "$sha1" -o -n "$*" ]
182 then
183 echo "Usage: git darcs find-darcs <sha1-prefix>"
184 exit 1
185 fi
186 for remote in $git_dir/darcs/*
187 do
188 remote=`basename $remote`
189 git_map=$git_dir/darcs-git/$remote-git-map
190 darcs_map=$git_dir/darcs-git/$remote-darcs-map
191 if [ ! -f $git_map -o ! -f $darcs_map ]
192 then
193 echo "Missing mappings for remote $remote"
194 exit 1
195 fi
196 for row in `sed -n -e "/:.* $sha1.*/ s/[^ ]*/&/p" $git_map`
197 do
198 sed -n -e "/$row / {s/[^ ]*//; s/.*/$remote\t&/p}" $darcs_map
199 done
200 done
201}
202
203# Find the git commit(s) supporting a darcs patch prefix
204find_git()
205{
206 patch="$1"
207 shift
208 if [ -z "$patch" -o -n "$*" ]
209 then
210 echo "Usage: git darcs find-git <patch-prefix>"
211 exit 1
212 fi
213 for remote in $git_dir/darcs/*
214 do
215 remote=`basename $remote`
216 git_map=$git_dir/darcs-git/$remote-git-map
217 darcs_map=$git_dir/darcs-git/$remote-darcs-map
218 if [ ! -f $git_map -o ! -f $darcs_map ]
219 then
220 echo "Missing mappings for remote $remote"
221 exit 1
222 fi
223 for row in `sed -n -e "/:.* $patch.*/ s/[^ ]*/&/p" $darcs_map`
224 do
225 sed -n -e "/$row / {s/[^ ]* \(.*\)/$remote\t\1/p}" $git_map
226 done
227 done
228}
229
230git rev-parse 2> /dev/null
231if [ $? != 0 ]; then
232 echo "Must be inside a git repository to work"
233 exit
234fi
235
236git_dir=$(git rev-parse --git-dir)
237# make it absolute
238cd $git_dir
239git_dir=$(pwd)
240cd - >/dev/null
241command="$1"
242shift
243
244case $command in
245 add|push|fetch|pull|list)
246 ;;
247 find-darcs)
248 command=find_darcs
249 ;;
250 find-git)
251 command=find_git
252 ;;
253 *)
254 echo "Usage: git darcs [COMMAND] [OPTIONS]"
255 echo "Commands: add, push, fetch, pull, list, find-darcs, find-git"
256 exit
257 ;;
258esac
259
260
261up=$(git rev-parse --show-cdup)
262[ -z "$up" ] && up="."
263cd $up
264$command "$@"
0265
=== added file 'exporters/darcs/git-darcs.txt'
--- exporters/darcs/git-darcs.txt 1970-01-01 00:00:00 +0000
+++ exporters/darcs/git-darcs.txt 2009-06-28 22:31:05 +0000
@@ -0,0 +1,72 @@
1= git-darcs(1)
2
3== NAME
4
5git-darcs - a bidirectional git - darcs gateway
6
7== SYNOPSIS
8
9git-darcs <command> <options>
10
11== DESCRIPTION
12
13git darcs can convert a darcs repo to a git one, can update such an
14existing git repo later, and finally can push back your changes from the
15git repo to the darcs one.
16
17A typical workflow is:
18
19----
20$ mkdir git-repo
21$ cd git-repo
22$ git init
23$ git darcs add upstream ../darcs-repo
24$ git darcs pull upstream
25
26... hack, hack, hack ...
27
28$ git darcs push upstream
29----
30
31== GLOBAL OPTIONS
32
33-h, --help::
34 Display usage.
35
36== COMMANDS
37
38The supported commands are the followings:
39
40add::
41 This can register a new darcs repo in the git one, so that you
42 can fetch from it. The syntax is `add nick path [dfe-options]`.
43 Add any options you want to be passed to darcs-fast-export,
44 like --encoding=utf-8, or --authors-file AUTHORMAP. Remember
45 that if AUTHORMAP is not absolute, it will be interpreted
46 relative to the git repository's root directory.
47
48push::
49 Transfers your changes created in the current branch back the
50 darcs one. The syntax is `push nick`.
51
52fetch::
53 Downloads changes from the darcs repo and updates the
54 `darcs/<nick>` branch. None of your local branches are updated.
55
56pull::
57 Calls `fetch` then `git merge` or `git rebase` based on the
58 `branch.<branchname>.rebase` configuration setting, where `<branchname>`
59 is the current branch. The default is - just like with `git pull` - is
60 to `git merge`.
61
62list::
63 List the name [and location] of each registered darcs repo.
64 The syntax is `list [-v|--verbose]`.
65
66find-darcs::
67 Searches for darcs patches matching a SHA1 prefix.
68 The syntax is `find-darcs <sha1-prefix>`.
69
70find-git::
71 Searches for git commits matching a darcs patch prefix.
72 The syntax is `find-git <patch-prefix>`.
073
=== added directory 'exporters/darcs/t'
=== added file 'exporters/darcs/t/Makefile'
--- exporters/darcs/t/Makefile 1970-01-01 00:00:00 +0000
+++ exporters/darcs/t/Makefile 2008-11-11 00:38:24 +0000
@@ -0,0 +1,9 @@
1T = $(wildcard test*.sh)
2
3all: $(T)
4 @echo "passed $$(echo $(T)|wc -w) tests."
5
6$(T):
7 @echo "*** $@ ***"; sh $@
8
9.PHONY: $(T)
010
=== added directory 'exporters/darcs/t/bench-results'
=== added file 'exporters/darcs/t/bench-results/Makefile'
--- exporters/darcs/t/bench-results/Makefile 1970-01-01 00:00:00 +0000
+++ exporters/darcs/t/bench-results/Makefile 2008-12-26 00:36:08 +0000
@@ -0,0 +1,5 @@
1bench-results.png: bench-results.gnu bench-results.dat
2 gnuplot bench-results.gnu
3
4bench-results.dat: bench-results.py $(wildcard ../darcs-benchmark/big-zoo/*.log)
5 python bench-results.py > bench-results.dat
06
=== added file 'exporters/darcs/t/bench-results/bench-results.gnu'
--- exporters/darcs/t/bench-results/bench-results.gnu 1970-01-01 00:00:00 +0000
+++ exporters/darcs/t/bench-results/bench-results.gnu 2008-12-26 00:36:08 +0000
@@ -0,0 +1,6 @@
1set terminal png
2set output 'bench-results.png'
3unset key
4set xlabel "number of patches"
5set ylabel "elapsed time in hours"
6plot 'bench-results.dat' with linespoints
07
=== added file 'exporters/darcs/t/bench-results/bench-results.py'
--- exporters/darcs/t/bench-results/bench-results.py 1970-01-01 00:00:00 +0000
+++ exporters/darcs/t/bench-results/bench-results.py 2008-12-26 00:36:08 +0000
@@ -0,0 +1,23 @@
1from glob import glob
2import re
3
4def cmp_data(a, b):
5 return cmp(a[0], b[0])
6
7logs = glob("../darcs-benchmark/big-zoo/*.log")
8
9data = []
10
11for i in logs:
12 sock = open(i)
13 for j in sock.readlines():
14 if "Num Patches:" in j:
15 patches = int(j.split(": ")[1].strip())
16 elif j.startswith("real"):
17 l = re.sub("real\t([0-9]+)m([0-9.]+)s\n", r"\1 \2", j).split(" ")
18 secs = int(l[0])*60 + float(l[1])
19 hours = secs / 3600
20 data.append([patches, hours])
21data.sort(cmp=cmp_data)
22for i in data:
23 print "%s %s" % (i[0], i[1])
024
=== added file 'exporters/darcs/t/bench-tailor.sh'
--- exporters/darcs/t/bench-tailor.sh 1970-01-01 00:00:00 +0000
+++ exporters/darcs/t/bench-tailor.sh 2008-11-29 13:34:30 +0000
@@ -0,0 +1,59 @@
1#!/bin/sh
2
3create_config()
4{
5 cd $1
6 mypath=$(pwd)
7 cd - >/dev/null
8 myname=$(basename $mypath)
9
10 cat > config << EOF
11[DEFAULT]
12encoding-errors-policy = replace
13
14[$myname]
15source = darcs:$myname
16target = git:$myname
17
18[darcs:$myname]
19subdir = darcs
20repository = $mypath
21
22[git:$myname]
23subdir = git
24repository = $mypath.git
25EOF
26}
27
28PATH=$HOME/darcs/tailor:$PATH
29if [ ! -d darcs-benchmark ]; then
30 darcs get http://code.haskell.org/darcs/darcs-benchmark
31 cd darcs-benchmark
32else
33 cd darcs-benchmark
34 darcs pull -a
35fi
36sh initialise.sh
37cd big-zoo
38if [ -n "$1" ]; then
39 targets=$1
40else
41 targets=*_play.tar.gz
42fi
43for i in $targets
44do
45 echo "benchmarking $i"
46 rm -rf _playground
47 tar xf $i
48 cd _playground
49 log="../$i.tailor-$(tailor --version).log"
50 create_config sandbox
51 sh -c 'time tailor --configfile config' 2>&1 |tee $log
52 if diff --exclude _darcs --exclude .git -Nur sandbox git >/dev/null; then
53 echo "ok, the result is correct" >> $log
54 else
55 echo "ouch, the result is corrupted" >> $log
56 exit 1
57 fi
58 cd ..
59done
060
=== added file 'exporters/darcs/t/bench.sh'
--- exporters/darcs/t/bench.sh 1970-01-01 00:00:00 +0000
+++ exporters/darcs/t/bench.sh 2008-12-25 23:50:21 +0000
@@ -0,0 +1,38 @@
1#!/bin/sh
2
3# this is a test as well, but it would take a lot of time, so don't
4# prefix it with 'test'.
5
6. lib.sh
7
8if [ ! -d darcs-benchmark ]; then
9 darcs get http://code.haskell.org/darcs/darcs-benchmark
10 cd darcs-benchmark
11else
12 cd darcs-benchmark
13 darcs pull -a
14fi
15sh initialise.sh
16cd big-zoo
17if [ -n "$1" ]; then
18 targets=$1
19else
20 targets=*_play.tar.gz
21fi
22for i in $targets
23do
24 echo "benchmarking $i"
25 rm -rf _playground
26 tar xf $i
27 cd _playground
28 log="../$i.d-f-e-$(git describe).log"
29 sh -c 'time d2x -f git sandbox' 2>&1 |tee $log
30 darcs show repo --repodir sandbox |egrep -v 'Root|Cache|Default' >> $log
31 if diff_git sandbox >/dev/null; then
32 echo "ok, the result is correct" >> $log
33 else
34 echo "ouch, the result is corrupted" >> $log
35 exit 1
36 fi
37 cd ..
38done
039
=== added directory 'exporters/darcs/t/data'
=== added file 'exporters/darcs/t/data/hungarian.gif'
1Binary files exporters/darcs/t/data/hungarian.gif 1970-01-01 00:00:00 +0000 and exporters/darcs/t/data/hungarian.gif 2008-11-11 00:27:43 +0000 differ40Binary files exporters/darcs/t/data/hungarian.gif 1970-01-01 00:00:00 +0000 and exporters/darcs/t/data/hungarian.gif 2008-11-11 00:27:43 +0000 differ
=== added file 'exporters/darcs/t/lib.sh'
--- exporters/darcs/t/lib.sh 1970-01-01 00:00:00 +0000
+++ exporters/darcs/t/lib.sh 2009-06-25 22:21:33 +0000
@@ -0,0 +1,303 @@
1export DARCS_EMAIL="user@example.com"
2export GIT_PAGER=cat
3export PATH="$(pwd)/..:$PATH"
4pypath="/$(python -c 'from distutils import sysconfig; print sysconfig.get_python_lib()[1:]')/"
5
6_drrec()
7{
8 darcs rec --ignore-times "$@"
9}
10
11_drrec_multiline()
12{
13 echo -e "`LANG= LC_ALL= date +"%a %b %d %H:%M:%S %Z %Y"`
14$DARCS_EMAIL
15$@" | darcs rec --ignore-times -a --pipe .
16}
17
18_drrecamend()
19{
20 echo y |darcs amend-rec --ignore-times -a
21}
22
23create_darcs()
24{
25 rm -rf $1
26 mkdir -p $1
27 cd $1
28 darcs init $2
29 echo A > file
30 darcs add file
31 _drrec -a -m A
32 cd ..
33 rm -rf $1.tmp
34 darcs get $1 $1.tmp
35 cd $1
36 echo B > file
37 _drrec -a -m B
38 cd ../$1.tmp
39 echo C > file
40 _drrec -a -m C
41 cd ../$1
42 darcs pull -a ../$1.tmp
43 echo D > file
44 _drrec_multiline "first line
45second line
46third line"
47 darcs tag 1.0
48 echo e > file
49 _drrec -a -m e
50 echo f > file
51 _drrec --author="éáõû <$DARCS_EMAIL>" -a -m f
52 echo g > file
53 _drrec --author="" -a -m g
54 cp ../data/hungarian.gif .
55 darcs add hungarian.gif
56 _drrec -a -m "add a binary file"
57 rm file
58 echo test > file2
59 darcs add file2
60 _drrec -a -m "replace file with file2"
61 touch file3
62 darcs add file3
63 _drrec -a -m "add empty file"
64 rm file3
65 _drrec -a -m "remove file"
66 mkdir dir dir2
67 darcs add dir
68 darcs add dir2
69 _drrec -a -m "add empty dirs"
70 darcs mv dir dir-p
71 darcs mv dir2 dir2-p
72 _drrec -a -m "rename empty dirs"
73 echo a > a
74 echo b > b
75 darcs add a b
76 _drrec -a -m "add a b"
77 rm b
78 _drrec -a -m "remove and rename"
79 darcs mv a b
80 _drrecamend
81 cd ..
82}
83
84create_bzr()
85{
86 rm -rf $1
87 mkdir -p $1
88 cd $1
89 bzr init $2
90 echo A > file
91 bzr add file
92 bzr commit -m A
93 cd ..
94 rm -rf $1.tmp
95 bzr branch $1 $1.tmp
96 cd $1
97 echo B > file
98 bzr commit -m B
99 cd ../$1.tmp
100 echo C > file
101 bzr commit -m C
102 cd ../$1
103 bzr merge ../$1.tmp
104 echo D > file
105 bzr resolve file
106 echo "first line
107second line
108third line" | bzr commit -F /dev/stdin
109 bzr tag 1.0
110 echo e > file
111 bzr commit -m e
112 #echo f > file
113 #bzr commit --author="éáõû <$DARCS_EMAIL>" -m f
114 #echo g > file
115 #_drrec --author="" -a -m g
116 cp ../data/hungarian.gif .
117 bzr add hungarian.gif
118 bzr commit -m "add a binary file"
119 rm file
120 echo test > file2
121 bzr add file2
122 bzr commit -m "replace file with file2"
123 touch file3
124 bzr add file3
125 bzr commit -m "add empty file"
126 rm file3
127 bzr commit -m "remove file"
128 cd ..
129}
130
131create_hg()
132{
133 rm -rf $1
134 mkdir -p $1
135 cd $1
136 hg init $2
137 echo A > file
138 hg add file
139 hg commit -m A
140 cd ..
141 rm -rf $1.tmp
142 hg clone $1 $1.tmp
143 cd $1
144 echo B > file
145 hg commit -m B
146 cd ../$1.tmp
147 echo C > file
148 hg commit -m C
149 cd ../$1
150 hg pull ../$1.tmp
151 hg merge
152 echo D > file
153 echo "first line
154second line
155third line" | hg commit -l /dev/stdin
156 hg tag 1.0
157 echo e > file
158 hg commit -m e
159 #echo f > file
160 #bzr commit --author="éáõû <$DARCS_EMAIL>" -m f
161 #echo g > file
162 #_drrec --author="" -a -m g
163 cp ../data/hungarian.gif .
164 hg add hungarian.gif
165 hg commit -m "add a binary file"
166 hg rm file
167 echo test > file2
168 hg add file2
169 hg commit -m "replace file with file2"
170 touch file3
171 hg add file3
172 hg commit -m "add empty file"
173 hg rm file3
174 hg commit -m "remove file"
175 cd ..
176}
177create_git()
178{
179 rm -rf $1
180 mkdir -p $1
181 cd $1
182 git init $2
183 echo A > file
184 git add file
185 git commit -a -m A
186 echo B > file
187 git commit -a -m B
188 git checkout -b tmp HEAD~1
189 echo C > file
190 git commit -a -m C
191 git checkout master
192 git merge tmp
193 echo D > file
194 echo "first line
195second line
196third line" | git commit -a -F -
197 git branch -d tmp
198 git tag 1.0
199 echo e > file
200 git commit -a -m e
201 echo f > file
202 git config i18n.commitencoding ISO-8859-2
203 git commit --author="éáõû <$DARCS_EMAIL>" -a -m f
204 cp ../data/hungarian.gif .
205 git add hungarian.gif
206 git commit -a -m "add a binary file"
207 rm file
208 echo test > file2
209 git add file2
210 git commit -a -m "replace file with file2"
211 touch file3
212 git add file3
213 git commit -a -m "add empty file"
214 rm file3
215 git commit -a -m "remove file"
216 cd ..
217}
218
219diff_git()
220{
221 rm -rf $1.git.nonbare
222 git clone -q $1.git $1.git.nonbare
223 diff --exclude _darcs --exclude .git --exclude '*-darcs-backup*' -Nur $1.git.nonbare $1
224 return $?
225}
226
227diff_importgit()
228{
229 diff --exclude _darcs --exclude .git --exclude '*-darcs-backup*' -Nur $1 $1.darcs
230 return $?
231}
232
233diff_importhg()
234{
235 diff --exclude _darcs --exclude .hg --exclude '*-darcs-backup*' --exclude 'hg-export.*' \
236 --exclude '.hgtags' --exclude '*.orig' -Nur $1 $1.darcs
237 return $?
238}
239
240diff_importdarcs()
241{
242 diff --exclude _darcs --exclude '*-darcs-backup*' -Nur $1 $2
243 return $?
244}
245
246diff_importbzr()
247{
248 diff --exclude _darcs --exclude .bzr --exclude '*-darcs-backup*' -Nur $1 $1.darcs
249 return $?
250}
251
252diff_bzr()
253{
254 cd $1.bzr/trunk
255 bzr update
256 cd - >/dev/null
257 diff --exclude _darcs --exclude .bzr --exclude '*-darcs-backup*' -Nur $1.bzr/trunk $1
258 return $?
259}
260
261diff_hg()
262{
263 diff --exclude _darcs --exclude .hg --exclude '*-darcs-backup*' -Nur $1.hg $1
264 return $?
265}
266
267die()
268{
269 echo "fatal: $@"
270 exit 1
271}
272
273upd_file_darcs()
274{
275 cd $1
276 echo $3 > $2
277 _drrec -a -m "updated '$2' to '$3'"
278 cd ..
279}
280
281upd_file_git()
282{
283 cd $1
284 echo $3 > $2
285 git commit -a -m "updated '$2' to '$3'"
286 cd ..
287}
288
289upd_file_bzr()
290{
291 cd $1
292 echo $3 > $2
293 bzr commit -m "updated '$2' to '$3'"
294 cd ..
295}
296
297upd_file_hg()
298{
299 cd $1
300 echo $3 > $2
301 hg commit -m "updated '$2' to '$3'"
302 cd ..
303}
0304
=== added directory 'exporters/darcs/t/test'
=== added file 'exporters/darcs/t/test-bzr.sh'
--- exporters/darcs/t/test-bzr.sh 1970-01-01 00:00:00 +0000
+++ exporters/darcs/t/test-bzr.sh 2008-11-15 22:35:31 +0000
@@ -0,0 +1,16 @@
1. lib.sh
2
3create_darcs test --old-fashioned-inventory
4
5rm -rf test.darcs test.bzr
6mkdir test.bzr
7cd test.bzr
8bzr init-repo .
9cd ..
10if [ "$1" != "--stdout" ]; then
11 darcs-fast-export test |(cd test.bzr; bzr fast-import -)
12 diff_bzr test
13 exit $?
14else
15 darcs-fast-export test
16fi
017
=== added file 'exporters/darcs/t/test-git-d2x.sh'
--- exporters/darcs/t/test-git-d2x.sh 1970-01-01 00:00:00 +0000
+++ exporters/darcs/t/test-git-d2x.sh 2008-11-16 00:57:20 +0000
@@ -0,0 +1,19 @@
1. lib.sh
2
3create_darcs test --old-fashioned-inventory
4
5rm -rf test.git
6if [ "$1" != "--stdout" ]; then
7 d2x -f git test
8 diff_git test || die "initial conversion differs"
9 upd_file_darcs test file2 upd_contents
10 d2x -f git test
11 diff_git test || die "update differs"
12 upd_file_darcs test hungarian.gif "binary to text"
13 d2x -f git test
14 diff_git test || die "update2 differs"
15 d2x -f git test
16 diff_git test || die "update3 (noop) differs"
17else
18 darcs-fast-export test
19fi
020
=== added file 'exporters/darcs/t/test-git-incremental.sh'
--- exporters/darcs/t/test-git-incremental.sh 1970-01-01 00:00:00 +0000
+++ exporters/darcs/t/test-git-incremental.sh 2008-11-15 22:35:31 +0000
@@ -0,0 +1,24 @@
1. lib.sh
2
3create_darcs test --old-fashioned-inventory
4
5rm -rf test.darcs test.git
6mkdir test.git
7cd test.git
8git --bare init
9cd ..
10if [ "$1" != "--stdout" ]; then
11 dmark="$(pwd)/test.dfe-marks"
12 gmark="$(pwd)/test.gfi-marks"
13 rm -f $mark $gmark
14 darcs-fast-export --export-marks=$dmark test |(cd test.git; git fast-import --export-marks=$gmark)
15 diff_git test || die "initial conversion differs"
16 upd_file_darcs test file2 upd_contents
17 darcs-fast-export --export-marks=$dmark --import-marks=$dmark test |(cd test.git; git fast-import --export-marks=$gmark --import-marks=$gmark)
18 diff_git test || die "update differs"
19 upd_file_darcs test hungarian.gif "binary to text"
20 darcs-fast-export --export-marks=$dmark --import-marks=$dmark test |(cd test.git; git fast-import --export-marks=$gmark --import-marks=$gmark)
21 diff_git test || die "update2 differs"
22else
23 darcs-fast-export test
24fi
025
=== added file 'exporters/darcs/t/test-git-progress.sh'
--- exporters/darcs/t/test-git-progress.sh 1970-01-01 00:00:00 +0000
+++ exporters/darcs/t/test-git-progress.sh 2008-11-28 14:43:30 +0000
@@ -0,0 +1,18 @@
1. lib.sh
2
3create_darcs test --old-fashioned-inventory
4
5rm -rf test.darcs test.git
6mkdir test.git
7cd test.git
8git --bare init
9cd ..
10if [ "$1" != "--stdout" ]; then
11 darcs-fast-export --progres 2 test |(cd test.git; git fast-import)
12 if [ $? = 0 ]; then
13 diff_git test
14 exit $?
15 fi
16else
17 darcs-fast-export test
18fi
019
=== added file 'exporters/darcs/t/test-git.sh'
--- exporters/darcs/t/test-git.sh 1970-01-01 00:00:00 +0000
+++ exporters/darcs/t/test-git.sh 2008-11-15 22:35:31 +0000
@@ -0,0 +1,18 @@
1. lib.sh
2
3create_darcs test --old-fashioned-inventory
4
5rm -rf test.darcs test.git
6mkdir test.git
7cd test.git
8git --bare init
9cd ..
10if [ "$1" != "--stdout" ]; then
11 darcs-fast-export test |(cd test.git; git fast-import)
12 if [ $? = 0 ]; then
13 diff_git test
14 exit $?
15 fi
16else
17 darcs-fast-export test
18fi
019
=== added file 'exporters/darcs/t/test-hg-d2x.sh'
--- exporters/darcs/t/test-hg-d2x.sh 1970-01-01 00:00:00 +0000
+++ exporters/darcs/t/test-hg-d2x.sh 2008-11-15 22:47:45 +0000
@@ -0,0 +1,12 @@
1. lib.sh
2
3create_darcs test --old-fashioned-inventory
4
5rm -rf test.hg
6if [ "$1" != "--stdout" ]; then
7 d2x -f hg test
8 diff_hg test
9 exit $?
10else
11 darcs-fast-export test
12fi
013
=== added file 'exporters/darcs/t/test-hg.sh'
--- exporters/darcs/t/test-hg.sh 1970-01-01 00:00:00 +0000
+++ exporters/darcs/t/test-hg.sh 2008-11-15 22:35:31 +0000
@@ -0,0 +1,16 @@
1. lib.sh
2
3create_darcs test --old-fashioned-inventory
4
5rm -rf test.darcs test.hg
6mkdir test.hg
7cd test.hg
8hg init
9cd ..
10if [ "$1" != "--stdout" ]; then
11 darcs-fast-export test |(cd test.hg; hg fastimport /dev/stdin)
12 diff_hg test
13 exit $?
14else
15 darcs-fast-export test
16fi
017
=== added directory 'exporters/darcs/t/test/_darcs'
=== added directory 'exporters/darcs/t/test/_darcs/patches'
=== added directory 'exporters/darcs/t/test/_darcs/prefs'
=== added directory 'exporters/darcs/t/test/_darcs/pristine'
=== added directory 'exporters/darcs/t/test2'
=== added file 'exporters/darcs/t/test2-bzr-d2x.sh'
--- exporters/darcs/t/test2-bzr-d2x.sh 1970-01-01 00:00:00 +0000
+++ exporters/darcs/t/test2-bzr-d2x.sh 2008-11-16 00:57:20 +0000
@@ -0,0 +1,19 @@
1. lib.sh
2
3create_darcs test2 --darcs-2
4
5rm -rf test2.bzr
6if [ "$1" != "--stdout" ]; then
7 d2x -f bzr test2
8 diff_bzr test2 || die "initial conversion differs"
9 upd_file_darcs test2 file2 upd_contents
10 d2x -f bzr test2
11 diff_bzr test2 || die "update differs"
12 upd_file_darcs test2 hungarian.gif "binary to text"
13 d2x -f bzr test2
14 diff_bzr test2 || die "update2 differs"
15 d2x -f bzr test2
16 diff_bzr test2 || die "update3 (noop) differs"
17else
18 darcs-fast-export test2
19fi
020
=== added file 'exporters/darcs/t/test2-bzr-incremental.sh'
--- exporters/darcs/t/test2-bzr-incremental.sh 1970-01-01 00:00:00 +0000
+++ exporters/darcs/t/test2-bzr-incremental.sh 2008-11-15 22:35:31 +0000
@@ -0,0 +1,21 @@
1. lib.sh
2
3create_darcs test2 --darcs-2
4
5rm -rf test2.darcs test2.bzr
6mkdir test2.bzr
7cd test2.bzr
8bzr init-repo .
9cd ..
10if [ "$1" != "--stdout" ]; then
11 dmark="$(pwd)/test2.dfe-marks"
12 bmark="$(pwd)/test2.bfi-marks"
13 rm -f $mark $gmark
14 darcs-fast-export --export-marks=$dmark test2 |(cd test2.bzr; bzr fast-import --export-marks=$bmark -)
15 diff_bzr test2 || die "initial conversion differs"
16 upd_file_darcs test2 file2 upd_contents
17 darcs-fast-export --export-marks=$dmark --import-marks=$dmark test2 |(cd test2.bzr; bzr fast-import --export-marks=$bmark --import-marks=$bmark -)
18 diff_bzr test2 || die "update differs"
19else
20 darcs-fast-export test2
21fi
022
=== added file 'exporters/darcs/t/test2-git-funny-tagname.sh'
--- exporters/darcs/t/test2-git-funny-tagname.sh 1970-01-01 00:00:00 +0000
+++ exporters/darcs/t/test2-git-funny-tagname.sh 2009-01-24 19:09:46 +0000
@@ -0,0 +1,25 @@
1. lib.sh
2
3create_darcs test2 --darcs-2
4cd test2
5darcs tag "this :just (won't work; die)"
6darcs tag "accent-tag-éáőű"
7cd ..
8
9rm -rf test2.darcs test2.git
10mkdir test2.git
11cd test2.git
12git --bare init
13cd ..
14if [ "$1" != "--stdout" ]; then
15 darcs-fast-export test2 |(cd test2.git; git fast-import)
16 ret=$?
17 if [ $ret = 0 ]; then
18 diff_git test2
19 exit $?
20 else
21 exit $ret
22 fi
23else
24 darcs-fast-export test2
25fi
026
=== added file 'exporters/darcs/t/test2-git-incremental-specworkdir.sh'
--- exporters/darcs/t/test2-git-incremental-specworkdir.sh 1970-01-01 00:00:00 +0000
+++ exporters/darcs/t/test2-git-incremental-specworkdir.sh 2008-11-15 22:35:31 +0000
@@ -0,0 +1,22 @@
1. lib.sh
2
3create_darcs test2 --darcs-2
4
5rm -rf test2.darcs test2.git
6mkdir test2.git
7cd test2.git
8git --bare init
9mkdir darcs
10cd ..
11if [ "$1" != "--stdout" ]; then
12 dmark="$(pwd)/test2.git/darcs/test2.dfe-marks"
13 gmark="$(pwd)/test2.git/darcs/test2.gfi-marks"
14 rm -f $mark $gmark
15 darcs-fast-export --export-marks=$dmark test2 --working test2.git/darcs/repo |(cd test2.git; git fast-import --export-marks=$gmark)
16 diff_git test2 || die "initial conversion differs"
17 upd_file_darcs test2 file2 upd_contents
18 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)
19 diff_git test2 || die "update differs"
20else
21 darcs-fast-export test2
22fi
023
=== added file 'exporters/darcs/t/test2-git-incremental.sh'
--- exporters/darcs/t/test2-git-incremental.sh 1970-01-01 00:00:00 +0000
+++ exporters/darcs/t/test2-git-incremental.sh 2008-11-15 22:35:31 +0000
@@ -0,0 +1,21 @@
1. lib.sh
2
3create_darcs test2 --darcs-2
4
5rm -rf test2.darcs test2.git
6mkdir test2.git
7cd test2.git
8git --bare init
9cd ..
10if [ "$1" != "--stdout" ]; then
11 dmark="$(pwd)/test2.dfe-marks"
12 gmark="$(pwd)/test2.gfi-marks"
13 rm -f $mark $gmark
14 darcs-fast-export --export-marks=$dmark test2 |(cd test2.git; git fast-import --export-marks=$gmark)
15 diff_git test2 || die "initial conversion differs"
16 upd_file_darcs test2 file2 upd_contents
17 darcs-fast-export --export-marks=$dmark --import-marks=$dmark test2 |(cd test2.git; git fast-import --export-marks=$gmark --import-marks=$gmark)
18 diff_git test2 || die "update differs"
19else
20 darcs-fast-export test2
21fi
022
=== added file 'exporters/darcs/t/test2-git.sh'
--- exporters/darcs/t/test2-git.sh 1970-01-01 00:00:00 +0000
+++ exporters/darcs/t/test2-git.sh 2008-11-15 22:35:31 +0000
@@ -0,0 +1,18 @@
1. lib.sh
2
3create_darcs test2 --darcs-2
4
5rm -rf test2.darcs test2.git
6mkdir test2.git
7cd test2.git
8git --bare init
9cd ..
10if [ "$1" != "--stdout" ]; then
11 darcs-fast-export test2 |(cd test2.git; git fast-import)
12 if [ $? = 0 ]; then
13 diff_git test2
14 exit $?
15 fi
16else
17 darcs-fast-export test2
18fi
019
=== added directory 'exporters/darcs/t/test2/_darcs'
=== added directory 'exporters/darcs/t/test2/_darcs/inventories'
=== added directory 'exporters/darcs/t/test2/_darcs/patches'
=== added directory 'exporters/darcs/t/test2/_darcs/prefs'
=== added directory 'exporters/darcs/t/test2/_darcs/pristine.hashed'
=== added file 'exporters/darcs/t/testimport-bzr-x2d.sh'
--- exporters/darcs/t/testimport-bzr-x2d.sh 1970-01-01 00:00:00 +0000
+++ exporters/darcs/t/testimport-bzr-x2d.sh 2008-11-23 02:50:58 +0000
@@ -0,0 +1,15 @@
1. lib.sh
2
3create_bzr test
4
5rm -rf test.darcs
6x2d -f bzr test
7diff_importbzr test || die "initial conversion differs"
8upd_file_bzr test file2 upd_contents
9x2d -f bzr test
10diff_importbzr test || die "update differs"
11upd_file_bzr test hungarian.gif "binary to text"
12x2d -f bzr test
13diff_importbzr test || die "update2 differs"
14x2d -f bzr test
15diff_importbzr test || die "update3 (noop) differs"
016
=== added file 'exporters/darcs/t/testimport-bzr.sh'
--- exporters/darcs/t/testimport-bzr.sh 1970-01-01 00:00:00 +0000
+++ exporters/darcs/t/testimport-bzr.sh 2009-06-25 22:21:33 +0000
@@ -0,0 +1,15 @@
1. lib.sh
2
3create_bzr test
4
5rm -rf test.darcs
6mkdir test.darcs
7cd test.darcs
8darcs init
9cd ..
10(cd test; bzr fast-export .) | (cd test.darcs; darcs-fast-import)
11if [ $? != 0 ]; then
12 exit 1
13fi
14diff_importbzr test
15exit $?
016
=== added file 'exporters/darcs/t/testimport-copy.sh'
--- exporters/darcs/t/testimport-copy.sh 1970-01-01 00:00:00 +0000
+++ exporters/darcs/t/testimport-copy.sh 2008-11-22 19:37:26 +0000
@@ -0,0 +1,26 @@
1. lib.sh
2
3rm -rf test
4mkdir test
5cd test
6git init
7echo a > file
8git add file
9git commit -m a1
10cp file file2
11git add file2
12git commit -m b
13cd ..
14
15rm -rf test.darcs
16mkdir test.darcs
17cd test.darcs
18darcs init
19cd ..
20(cd test; git fast-export -C -C HEAD) > out
21cat out | (cd test.darcs; darcs-fast-import)
22if [ $? != 0 ]; then
23 exit 1
24fi
25diff_importgit test
26exit $?
027
=== added file 'exporters/darcs/t/testimport-darcs.sh'
--- exporters/darcs/t/testimport-darcs.sh 1970-01-01 00:00:00 +0000
+++ exporters/darcs/t/testimport-darcs.sh 2008-11-22 17:44:00 +0000
@@ -0,0 +1,17 @@
1. lib.sh
2
3create_darcs test2 --darcs-2
4
5rm -rf test2.importdarcs test2.darcs
6mkdir test2.importdarcs
7cd test2.importdarcs
8darcs init
9cd ..
10
11darcs-fast-export test2 | (cd test2.importdarcs; darcs-fast-import)
12
13if [ $? != 0 ]; then
14 exit 1
15fi
16diff_importdarcs test2 test2.importdarcs
17exit $?
018
=== added file 'exporters/darcs/t/testimport-deleteall.sh'
--- exporters/darcs/t/testimport-deleteall.sh 1970-01-01 00:00:00 +0000
+++ exporters/darcs/t/testimport-deleteall.sh 2008-11-22 19:19:32 +0000
@@ -0,0 +1,31 @@
1. lib.sh
2
3rm -rf test
4mkdir test
5cd test
6git init
7echo a > file
8git add file
9echo A > file2
10git add file2
11git commit -m a12
12git rm file*
13echo b>file3
14git add file3
15git commit -m b
16cd ..
17
18rm -rf test.darcs
19mkdir test.darcs
20cd test.darcs
21darcs init
22cd ..
23(cd test; git fast-export --progress=2 HEAD) > out
24sed -i '/^D file$/d' out
25sed -i 's/^D file2$/deleteall/' out
26cat out | (cd test.darcs; darcs-fast-import)
27if [ $? != 0 ]; then
28 exit 1
29fi
30diff_importgit test
31exit $?
032
=== added file 'exporters/darcs/t/testimport-git-incremental.sh'
--- exporters/darcs/t/testimport-git-incremental.sh 1970-01-01 00:00:00 +0000
+++ exporters/darcs/t/testimport-git-incremental.sh 2008-11-22 22:20:00 +0000
@@ -0,0 +1,16 @@
1. lib.sh
2
3create_git test
4
5rm -rf test.darcs
6mkdir test.darcs
7cd test.darcs
8darcs init
9cd ..
10gmark="$(pwd)/test.gfe-marks"
11dmark="$(pwd)/test.dfi-marks"
12(cd test; git fast-export --export-marks=$gmark HEAD) | (cd test.darcs; darcs-fast-import --export-marks=$dmark)
13diff_importgit test || die "initial conversion differs"
14upd_file_git test file2 upd_contents
15(cd test; git fast-export --export-marks=$gmark --import-marks=$gmark HEAD) | (cd test.darcs; darcs-fast-import --export-marks=$dmark --import-marks=$dmark)
16diff_importgit test || die "update differs"
017
=== added file 'exporters/darcs/t/testimport-git-twoway-gd.sh'
--- exporters/darcs/t/testimport-git-twoway-gd.sh 1970-01-01 00:00:00 +0000
+++ exporters/darcs/t/testimport-git-twoway-gd.sh 2008-11-23 21:00:12 +0000
@@ -0,0 +1,34 @@
1. lib.sh
2
3create_darcs test
4
5rm -rf test.git
6mkdir test.git
7cd test.git
8git init
9git darcs add upstream ../test
10git darcs pull upstream
11cd ..
12diff_git test || die "initial fetch differs"
13upd_file_darcs test file2 upd_contents
14cd test.git
15git darcs pull upstream
16cd ..
17diff_git test || die "fetch #1 differs"
18upd_file_git test.git file2 upd_contents2
19cd test.git
20git darcs push upstream
21cd ..
22diff_git test || die "push #1 difers"
23upd_file_darcs test file2 upd_contents3
24upd_file_darcs test file2 upd_contents32
25cd test.git
26git darcs pull upstream
27cd ..
28diff_git test || die "fetch #2 (multiple commits) differs"
29upd_file_git test.git file2 upd_contents4
30upd_file_git test.git file2 upd_contents42
31cd test.git
32git darcs push upstream
33cd ..
34diff_git test || die "push #2 (multiple commits) differs"
035
=== added file 'exporters/darcs/t/testimport-git-twoway.sh'
--- exporters/darcs/t/testimport-git-twoway.sh 1970-01-01 00:00:00 +0000
+++ exporters/darcs/t/testimport-git-twoway.sh 2008-11-27 01:45:46 +0000
@@ -0,0 +1,30 @@
1. lib.sh
2
3create_git test
4
5rm -rf test.darcs
6mkdir test.darcs
7cd test.darcs
8darcs init
9cd ..
10gmark="$(pwd)/test.gmarks"
11dmark="$(pwd)/test.dmarks"
12
13(cd test; git fast-export --export-marks=$gmark HEAD) | (cd test.darcs; darcs-fast-import --export-marks=$dmark)
14diff_importgit test || die "initial conversion differs"
15upd_file_git test file2 upd_contents
16(cd test; git fast-export --export-marks=$gmark --import-marks=$gmark HEAD) | (cd test.darcs; darcs-fast-import --export-marks=$dmark --import-marks=$dmark)
17diff_importgit test || die "git -> darcs update #1 differs"
18upd_file_darcs test.darcs file2 upd_contents2
19darcs-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)
20(cd test; git checkout -f)
21diff_importgit test || die "darcs -> git update #2 differs"
22upd_file_git test file2 upd_contents3
23upd_file_git test file2 upd_contents32
24(cd test; git fast-export --export-marks=$gmark --import-marks=$gmark HEAD) | (cd test.darcs; darcs-fast-import --export-marks=$dmark --import-marks=$dmark)
25diff_importgit test || die "git -> darcs update #3 differs"
26upd_file_darcs test.darcs file2 upd_contents4
27upd_file_darcs test.darcs file2 upd_contents42
28darcs-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)
29(cd test; git checkout -f)
30diff_importgit test || die "darcs -> git update #4 differs"
031
=== added file 'exporters/darcs/t/testimport-git-x2d.sh'
--- exporters/darcs/t/testimport-git-x2d.sh 1970-01-01 00:00:00 +0000
+++ exporters/darcs/t/testimport-git-x2d.sh 2008-11-23 02:42:25 +0000
@@ -0,0 +1,15 @@
1. lib.sh
2
3create_git test
4
5rm -rf test.darcs
6x2d -f git test
7diff_importgit test || die "initial conversion differs"
8upd_file_git test file2 upd_contents
9x2d -f git test
10diff_importgit test || die "update differs"
11upd_file_git test hungarian.gif "binary to text"
12x2d -f git test
13diff_importgit test || die "update2 differs"
14x2d -f git test
15diff_importgit test || die "update3 (noop) differs"
016
=== added file 'exporters/darcs/t/testimport-git.sh'
--- exporters/darcs/t/testimport-git.sh 1970-01-01 00:00:00 +0000
+++ exporters/darcs/t/testimport-git.sh 2008-11-22 01:36:29 +0000
@@ -0,0 +1,15 @@
1. lib.sh
2
3create_git test
4
5rm -rf test.darcs
6mkdir test.darcs
7cd test.darcs
8darcs init
9cd ..
10(cd test; git fast-export --progress=2 HEAD) | (cd test.darcs; darcs-fast-import)
11if [ $? != 0 ]; then
12 exit 1
13fi
14diff_importgit test
15exit $?
016
=== added file 'exporters/darcs/t/testimport-hg-x2d.sh'
--- exporters/darcs/t/testimport-hg-x2d.sh 1970-01-01 00:00:00 +0000
+++ exporters/darcs/t/testimport-hg-x2d.sh 2008-11-23 02:53:21 +0000
@@ -0,0 +1,15 @@
1. lib.sh
2
3create_hg test
4
5rm -rf test.darcs
6x2d -f hg test
7diff_importhg test || die "initial conversion differs"
8upd_file_hg test file2 upd_contents
9x2d -f hg test
10diff_importhg test || die "update differs"
11upd_file_hg test hungarian.gif "binary to text"
12x2d -f hg test
13diff_importhg test || die "update2 differs"
14x2d -f hg test
15diff_importhg test || die "update3 (noop) differs"
016
=== added file 'exporters/darcs/t/testimport-hg.sh'
--- exporters/darcs/t/testimport-hg.sh 1970-01-01 00:00:00 +0000
+++ exporters/darcs/t/testimport-hg.sh 2008-11-23 02:02:24 +0000
@@ -0,0 +1,16 @@
1. lib.sh
2
3create_hg test
4
5rm -rf test.darcs
6mkdir test.darcs
7cd test.darcs
8darcs init
9cd ..
10(cd test; $pypath/bzrlib/plugins/fastimport/exporters/hg-fast-export.py -r .) | (cd test.darcs; darcs-fast-import)
11rm test/{*.orig,hg-export.status}
12if [ $? != 0 ]; then
13 exit 1
14fi
15diff_importhg test
16exit $?
017
=== added file 'exporters/darcs/t/testimport-rename.sh'
--- exporters/darcs/t/testimport-rename.sh 1970-01-01 00:00:00 +0000
+++ exporters/darcs/t/testimport-rename.sh 2008-11-22 19:30:35 +0000
@@ -0,0 +1,25 @@
1. lib.sh
2
3rm -rf test
4mkdir test
5cd test
6git init
7echo a > file
8git add file
9git commit -m a1
10git mv file file2
11git commit -m b
12cd ..
13
14rm -rf test.darcs
15mkdir test.darcs
16cd test.darcs
17darcs init
18cd ..
19(cd test; git fast-export -M HEAD) > out
20cat out | (cd test.darcs; darcs-fast-import)
21if [ $? != 0 ]; then
22 exit 1
23fi
24diff_importgit test
25exit $?
026
=== added file 'exporters/darcs/x2d'
--- exporters/darcs/x2d 1970-01-01 00:00:00 +0000
+++ exporters/darcs/x2d 2009-06-25 22:21:33 +0000
@@ -0,0 +1,121 @@
1#!/bin/sh
2#
3# x2d - convert git, bzr or hg repos to darcs using fast-export
4#
5# Copyright (c) 2008 by Miklos Vajna <vmiklos@frugalware.org>
6#
7# This program is free software; you can redistribute it and/or modify
8# it under the terms of the GNU General Public License as published by
9# the Free Software Foundation; either version 2 of the License, or
10# (at your option) any later version.
11#
12# This program is distributed in the hope that it will be useful,
13# but WITHOUT ANY WARRANTY; without even the implied warranty of
14# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15# GNU General Public License for more details.
16#
17# You should have received a copy of the GNU General Public License
18# along with this program; if not, write to the Free Software
19# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307,
20# USA.
21#
22
23usage()
24{
25 echo "Usage: x2d -f format repo"
26}
27
28die()
29{
30 echo "$@"
31 usage
32 exit 1
33}
34
35check_up_to_date()
36{
37 upstreamnum=$(darcs show repo|grep 'Num Patches'|sed 's/.*: //')
38 if [ "$upstreamnum" = "$(cd $origin; eval $*)" ]; then
39 echo "No remote changes to pull!"
40 exit 0
41 fi
42}
43
44case $1 in
45 -h|--help)
46 usage
47 exit 0
48 ;;
49 -f)
50 format="$2"
51 shift 2
52 ;;
53esac
54
55[ -n "$format" ] || die "Source format is not given!"
56
57case $format in
58 git|bzr|hg)
59 ;;
60 *)
61 die "The requested source format is not yet supported!"
62 ;;
63esac
64
65origin="$1"
66shift 1
67
68[ -d "$origin" ] || die "Source repo does not exist!"
69
70# convert to abspath
71cd $origin
72origin=$(pwd)
73
74dmark="$origin.darcs/_darcs/fast-import/dfe-marks"
75fmark="$origin.darcs/_darcs/fast-import/ffi-marks"
76
77mkdir -p $origin.darcs
78cd $origin.darcs
79
80common_opts="--logfile $origin.darcs/_darcs/fast-import/log"
81pypath="/$(python -c 'from distutils import sysconfig; print sysconfig.get_python_lib()[1:]')/"
82
83if [ ! -f $dmark ]; then
84 darcs init
85 mkdir -p _darcs/fast-import
86 case $format in
87 git)
88 (cd $origin; git fast-export --export-marks=$fmark HEAD) | \
89 darcs-fast-import --export-marks=$dmark $common_opts
90 ;;
91 bzr)
92 (cd $origin; bzr fast-export \
93 --export-marks=$fmark . ) | darcs-fast-import --export-marks=$dmark $common_opts
94 ;;
95 hg)
96 (cd $origin; $pypath/bzrlib/plugins/fastimport/exporters/hg-fast-export.py -r . ) | \
97 darcs-fast-import --export-marks=$dmark $common_opts
98 esac
99else
100 case $format in
101 git)
102 check_up_to_date "git rev-list HEAD |wc -l"
103 (cd $origin; git fast-export --export-marks=$fmark --import-marks=$fmark HEAD) | \
104 darcs-fast-import --export-marks=$dmark --import-marks=$dmark $common_opts
105 ;;
106 bzr)
107 # bzr revno is not good here, because at merges
108 # it produces less revision than the number we
109 # have in darcs
110 check_up_to_date "bzr log|grep -c revno:"
111 (cd $origin; bzr fast-export \
112 --export-marks=$fmark --import-marks=$fmark . ) | \
113 darcs-fast-import --export-marks=$dmark --import-marks=$dmark $common_opts
114 ;;
115 hg)
116 check_up_to_date 'echo $(($(hg tip --template "{rev}")+1))'
117 (cd $origin; $pypath/bzrlib/plugins/fastimport/exporters/hg-fast-export.py -r . ) | \
118 darcs-fast-import --export-marks=$dmark --import-marks=$dmark $common_opts
119 ;;
120 esac
121fi
0122
=== added file 'exporters/darcs/x2d.txt'
--- exporters/darcs/x2d.txt 1970-01-01 00:00:00 +0000
+++ exporters/darcs/x2d.txt 2008-11-23 22:26:27 +0000
@@ -0,0 +1,26 @@
1= x2d(1)
2
3== NAME
4
5x2d - convert git, bzr or hg repos to a darcs one using fast-export
6
7== SYNOPSIS
8
9x2d -f <format> <otherrepo>
10
11== DESCRIPTION
12
13x2d is a wrapper script that just automates doing an initial or
14continuing an incremental conversion. All it does is initializing the
15target darcs repo, starting darcs-fast-import and the relevant exporter
16with the proper switches and pipe the importer's output to the
17importer's standard input.
18
19== OPTIONS
20
21--help::
22 Display usage.
23
24-f <format>::
25 Specify the format of the source repo. Currently supported sources are
26 git, bzr and hg. Incremental conversion is supported for all of them.

Subscribers

People subscribed via source and target branches

to all changes: