diff options
author | Jelmer Vernooij <jelmer@samba.org> | 2012-02-29 12:50:00 +0100 |
---|---|---|
committer | Jelmer Vernooij <jelmer@samba.org> | 2012-02-29 12:50:00 +0100 |
commit | 9cb7942d7429b185e6a80352ea015375eb203ca9 (patch) | |
tree | ed849529d3e96d24a6cfd1287aeacfa186542598 /exporters/darcs | |
parent | f4165c0c842c7b80f33b93832c3b0fcc2cc95c8a (diff) | |
parent | 501697d4089bd97f545c546a174cbda48d0ce235 (diff) | |
download | bzr-fastimport-9cb7942d7429b185e6a80352ea015375eb203ca9.tar.gz |
Merge removal of exporters.
Diffstat (limited to 'exporters/darcs')
53 files changed, 0 insertions, 2972 deletions
diff --git a/exporters/darcs/.gitignore b/exporters/darcs/.gitignore deleted file mode 100644 index d26377c..0000000 --- a/exporters/darcs/.gitignore +++ /dev/null @@ -1,3 +0,0 @@ -Changelog -HEADER.html -.htaccess diff --git a/exporters/darcs/Makefile b/exporters/darcs/Makefile deleted file mode 100644 index 0c81c68..0000000 --- a/exporters/darcs/Makefile +++ /dev/null @@ -1,55 +0,0 @@ -VERSION = 0.9 -DATE := $(shell date +%Y-%m-%d) - -INSTALL = /usr/bin/install -c -DESTDIR = -prefix = /usr -bindir = $(prefix)/bin -mandir = $(prefix)/share/man/man1 - -MAN_TXT = $(wildcard *.txt) -MAN_HTML=$(patsubst %.txt,%.html,$(MAN_TXT)) -MAN=$(patsubst %.txt,%.1,$(MAN_TXT)) - -PROGRAMS = darcs-fast-export darcs-fast-import d2x x2d git-darcs - -all: man - -install: all - $(INSTALL) -d $(DESTDIR)$(bindir) - $(INSTALL) -d $(DESTDIR)$(mandir) - $(INSTALL) -m755 $(PROGRAMS) $(DESTDIR)$(bindir) - $(INSTALL) -m644 *.1 $(DESTDIR)$(mandir) - -doc: HEADER.html Changelog html - -HEADER.html: README Makefile - asciidoc -a toc -a numbered -a sectids -o HEADER.html README - -Changelog: .git/refs/heads/master - git log >Changelog - -%.html: %.txt - asciidoc $^ - -%.1: %.txt asciidoc.conf - a2x --asciidoc-opts="-f asciidoc.conf" \ - -a dfe_version=$(VERSION) -a dfe_date=$(DATE) -f manpage $< - -man: $(MAN) - -html: $(MAN_HTML) - -dist: - git archive --format=tar --prefix=darcs-fast-export-$(VERSION)/ $(VERSION) > darcs-fast-export-$(VERSION).tar - mkdir -p darcs-fast-export-$(VERSION) - git log > darcs-fast-export-$(VERSION)/Changelog - tar rf darcs-fast-export-$(VERSION).tar darcs-fast-export-$(VERSION)/Changelog - rm -rf darcs-fast-export-$(VERSION) - gzip -f -9 darcs-fast-export-$(VERSION).tar - -release: - git tag -l |grep -q $(VERSION) || dg tag $(VERSION) - $(MAKE) dist - gpg --comment "See http://vmiklos.hu/gpg/ for info" \ - -ba darcs-fast-export-$(VERSION).tar.gz diff --git a/exporters/darcs/NEWS b/exporters/darcs/NEWS deleted file mode 100644 index 1a0daa5..0000000 --- a/exporters/darcs/NEWS +++ /dev/null @@ -1,26 +0,0 @@ -VERSION DESCRIPTION ------------------------------------------------------------------------------ -0.9 - fix handling of accents in tag names - - warning fixes for Python-2.6 - - git-darcs: the add subcommand can now remember d-f-e - options - - git-darcs: new list, find-darcs and find-git subcommands -0.8 - revert the "not exporting unchanged files multiple - times" optimization, it causes corrupted results in some - cases. -0.7 - new darcs-fast-export option: --progress - - massive speedup in darcs-fast-export due to not - exporting unchanged files multiple times and reading - patches directly -0.6 - add a new darcs-fast-import script, allowing two-way sync - - new darcs-fast-export option: --git-branch - - add a new git-darcs script, making two-way sync easy -0.5 - new --help, --encoding, --authors-file, --working and - --logfile options - - add "hashed" support (see darcs init -h) - - add incremental conversion support for darcs1 as well - - add d2x wrapper script -0.4 - add incremental conversion support -0.3 - add darcs2 support -0.2 - add bzr and hg support -0.1 - initial short and fast version, supporting darcs1->git diff --git a/exporters/darcs/README b/exporters/darcs/README deleted file mode 100644 index 3fc9449..0000000 --- a/exporters/darcs/README +++ /dev/null @@ -1,187 +0,0 @@ -= darcs backend for fast data importers -Miklos Vajna <vmiklos-at-frugalware-dot-org> - -== Purpose and Features - -darcs-fast-export is a tool to dump a http://darcs.net/[darcs] -repository in a format understood by "fast-importers" such as -http://git.or.cz/[git] -http://www.kernel.org/pub/software/scm/git/docs/git-fast-import.html[fast-import]. -It exhibits the following _features:_ - -Fast:: - darcs-fast-export provides a fast darcs backend for fast-import. - See link:t/bench-results/[here] for exact details. - -Correct:: - darcs-fast-export produces correct results in any extreme cases. - It has been tested with a collection of large darcs repos (called - http://code.haskell.org/darcs/big-zoo/[big-zoo]). And several testcases - under the `t/` directory. - -Independent:: - Ideally it should work with any fast importer, but actually it has been - tested with git fast-import, bzr fast-import and hg fastimport. (These - are the three fast-import implementations available ATM.) - -Formats:: - It supports the 'darcs-2', 'hashed', and 'old-fashioned-inventory' darcs - repository formats. - -Incremental conversions:: - It supports the usual `--export-marks` / `--import-marks` switches to - allow incremental conversion. - -Wrapper scripts:: - A wrapper script called `d2x` is available if you find typing - `--export-marks` / `--import-marks` all the time boring. A similar one - is also provided for the other direction, called `x2d`. Finally, if you - want to work on darcs repos with git, you can use the `git-darcs` - wrapper. - -Author mappings:: - Supports `--authors-file` option like Git's SVN adaptor, for DARCS - repositories that originated in CVS or SVN. - -Import script:: - The pair of `darcs-fast-export`, `darcs-fast-import` is also - included in this repo. It has been tested with the fast-expoters of Git, - Hg, Bzr and - of course - Darcs itself. - -Two-way sync:: - Using `darcs-fast-export` / `darcs-fast-import`, it is possible to - convert a darcs repo to an other VCS, work there, then convert your work - back to Darcs (or vica versa). This has been tested with "darcs -> git; - hack hack; git -> darcs". - -== Usage - -See the manpages: - -* link:darcs-fast-export.html[darcs-fast-export] -* link:darcs-fast-import.html[darcs-fast-import] -* link:d2x.html[d2x] -* link:x2d.html[x2d] -* link:git-darcs.html[git-darcs] - -=== Example - -Assuming that `test/` is a darcs repo, you could do this: ----- -$ mkdir test.git -$ cd test.git -$ git --bare init -$ cd .. -$ darcs-fast-export test |(cd test.git; git fast-import) ----- - -For more examples (especially for bzr and hg), see the `t/` directory. - -== Download - -Using git: ----- -$ git clone git://vmiklos.hu/darcs-fast-export ----- - -== Status - -In general, darcs-fast-export should work fine. darcs-fast-import has -known problems with tags - other than that it should be okay. git-darcs -should work properly as long as you are not paying too much attention to -the imported tags (newly created tags won't be pushed back). - -darcs-fast-export has been tested with the following versions: - -Darcs version (see http://bugs.darcs.net/issue844[this bug] on why do -you need such a new version): ----- -$ darcs --version -2.2.0 (release) ----- - -Git version: ----- -$ git --version -git version 1.6.0.2 ----- - -Bzr versions: ----- -$ bzr version -Bazaar (bzr) 1.12 -$ (cd ~/bzr/fastimport; bzr log --limit 1|grep revno) -revno: 181 ----- - -Yes, you need the fastiport plugin from BZR, the last hg release series -supported by fastimport-0.6 is hg-1.0.x. - -Mercurial (Hg) version: ----- -$ hg version -Mercurial Distributed SCM (version 1.3) ----- - -Strictly speaking this document is a wrong place to talk about -configuring hg fastimport. However... you will need something like: - ----- -$ hg clone http://vc.gerg.ca/hg/pyfastimport -$ hg clone http://vc.gerg.ca/hg/hg-fastimport -$ sudo ln -s /path/to/pyfastimport/fastimport /usr/lib/python2.6/site-packages/fastimport -$ sudo ln -s /path/to/hg-fastimport/hgfastimport /usr/lib/python2.6/site-packages/hgfastimport -echo -e "[extensions]\nfastimport = /usr/lib/python2.6/site-packages/hgfastimport" > ~/.hgrc ----- - -and once you installed the plugin correctly, you should have something like: - ----- -$ ls /usr/lib/python*/site-packages/hgext/fastimport/__init__.py -/usr/lib/python2.5/site-packages/hgext/fastimport/__init__.py ----- - -== Additional resources - -You can reach the Changelog link:Changelog[here], and a gitweb interface -http://vmiklos.hu/gitweb/?p=darcs-fast-export.git[here]. - -The fast-import stream format documentation is -http://git.kernel.org/?p=git/git.git;a=blob;f=fast-import.c;hb=HEAD[here] -if you're interested. - -== Alternatives - -- http://repo.or.cz/w/darcs2git.git[darcs2git] tries to find conflict - resolutions (to map them to merge commits), but it's rather slow - because of this. It does not support the darcs2 format and/or - incremental conversions, either. darcs-fast-export may support mapping - to merge commits later, but not before - http://bugs.darcs.net/issue1261[this issue] is addressed. - -- http://progetti.arstecnica.it/tailor[tailor] is an any2any VCS - converter, but it produces corrupted results when converting the - big-zoo - see http://progetti.arstecnica.it/tailor/ticket/171[this - ticket]. - -- http://git.sanityinc.com/?p=darcs-to-git.git[darcs-to-git] is similar - to darcs2git, but it fails for the testcases found in the testsuite of - darcs-fast-export. - -- http://github.com/freshtonic/undarcs/tree/master[undarcs] claims to be - fast, but its own README says it produces incorrect results. When I - tried, it did not handle the darcs2 format, binary files and incremental - support. - -== Thanks - -- Jason Dagit for helping me with darcs2 issues -- Shawn O. Pearce and Johannes Schindelin for writing `git-fast-import` - / `git-fast-export` -- Ian Clatworthy for writing bzr fast-import -- Paul Crowley for writing hg fast-import -- Matthias Andree for assorted improvements, among them the --help, - --encoding and --authors-file features (using Python's optparse), support - for hashed repositories, `_darcs/format` interpretation, and mangling - whitespace in tags to cope with repos imported into DARCS from CVS. -- Pieter de Bie for writing git-bzr, which was the base of git-darcs diff --git a/exporters/darcs/TODO b/exporters/darcs/TODO deleted file mode 100644 index c6892c8..0000000 --- a/exporters/darcs/TODO +++ /dev/null @@ -1,8 +0,0 @@ -more intelligent tests, such as detect if the hg fastimport extension is -not enabled, etc. - -parse the patches manually so we can avoid re-adding existing files manually. - -avoid darcs apply. - -import: handle evil merges (git-subtree), maybe using git log --first-parent diff --git a/exporters/darcs/asciidoc.conf b/exporters/darcs/asciidoc.conf deleted file mode 100644 index cb31717..0000000 --- a/exporters/darcs/asciidoc.conf +++ /dev/null @@ -1,21 +0,0 @@ -ifdef::doctype-manpage[] -ifdef::backend-docbook[] -[header] -template::[header-declarations] -<refentry> - <refentryinfo> - <date>{dfe_date}</date> - </refentryinfo> - <refmeta> - <refentrytitle>{mantitle}</refentrytitle> - <manvolnum>{manvolnum}</manvolnum> - <refmiscinfo class="source">darcs-fast-export</refmiscinfo> - <refmiscinfo class="version">{dfe_version}</refmiscinfo> - <refmiscinfo class="manual">darcs-fast-export manual</refmiscinfo> - </refmeta> - <refnamediv> - <refname>{manname}</refname> - <refpurpose>{manpurpose}</refpurpose> - </refnamediv> -endif::backend-docbook[] -endif::doctype-manpage[] diff --git a/exporters/darcs/d2x b/exporters/darcs/d2x deleted file mode 100755 index 85e15e2..0000000 --- a/exporters/darcs/d2x +++ /dev/null @@ -1,112 +0,0 @@ -#!/bin/sh -# -# d2x - convert darcs repos to git, bzr or hg using fast-import -# -# Copyright (c) 2008 by Miklos Vajna <vmiklos@frugalware.org> -# -# This program is free software; you can redistribute it and/or modify -# it under the terms of the GNU General Public License as published by -# the Free Software Foundation; either version 2 of the License, or -# (at your option) any later version. -# -# This program is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -# GNU General Public License for more details. -# -# You should have received a copy of the GNU General Public License -# along with this program. If not, see <http://www.gnu.org/licenses/>. -# - -usage() -{ - echo "Usage: d2x -f format darcsrepo" -} - -die() -{ - echo "$@" - usage - exit 1 -} - -check_up_to_date() -{ - upstreamnum=$(cd $origin; darcs show repo|grep 'Num Patches'|sed 's/.*: //') - if [ "$upstreamnum" = "$(eval $*)" ]; then - echo "No remote changes to pull!" - exit 0 - fi -} - -case $1 in - -h|--help) - usage - exit 0 - ;; - -f) - format="$2" - shift 2 - ;; -esac - -[ -n "$format" ] || die "Target format is not given!" - -case $format in - git|bzr|hg) - ;; - *) - die "The requested target format is not yet supported!" - ;; -esac - -origin="$1" -shift 1 - -[ -d "$origin" ] || die "Source repo does not exist!" - -# convert to abspath -cd $origin -origin=$(pwd) - -dmark="$origin.$format/darcs/dfe-marks" -fmark="$origin.$format/darcs/ffi-marks" - -mkdir -p $origin.$format/darcs -cd $origin.$format - -common_opts="--working $origin.$format/darcs/repo --logfile $origin.$format/darcs/log $origin" -if [ ! -f $dmark ]; then - case $format in - git) - git --bare init - darcs-fast-export $* --export-marks=$dmark $common_opts | \ - git fast-import --export-marks=$fmark - ;; - bzr) - bzr init-repo . - darcs-fast-export $* --export-marks=$dmark $common_opts | \ - bzr fast-import --export-marks=$fmark - - ;; - hg) - hg init - darcs-fast-export $* $origin | \ - hg fastimport - - esac -else - case $format in - git) - check_up_to_date "git rev-list HEAD |wc -l" - darcs-fast-export $* --export-marks=$dmark --import-marks=$dmark $common_opts | \ - git fast-import --export-marks=$fmark --import-marks=$fmark - ;; - bzr) - check_up_to_date "cd master; bzr revno" - darcs-fast-export $* --export-marks=$dmark --import-marks=$dmark $common_opts | \ - bzr fast-import --export-marks=$fmark --import-marks=$fmark - - ;; - hg) - die "Incremental conversion to hg is not yet supported by hg fastimport." - ;; - esac -fi diff --git a/exporters/darcs/d2x.txt b/exporters/darcs/d2x.txt deleted file mode 100644 index 41732fd..0000000 --- a/exporters/darcs/d2x.txt +++ /dev/null @@ -1,27 +0,0 @@ -= d2x(1) - -== NAME - -d2x - convert darcs repos to git, bzr or hg using fast-import - -== SYNOPSIS - -d2x -f <format> <darcsrepo> [<darcs-fast-export options>] - -== DESCRIPTION - -d2x is a wrapper script that just automates doing an initial or -continuing an incremental conversion. All it does is initializing the -target repo, starting darcs-fast-export and the relevant importer with -the proper switches and pipe the exporter's output to the importer's -standard input. - -== OPTIONS - ---help:: - Display usage. - --f <format>:: - Specify the format of the target repo. Currently supported targets are - git, bzr and hg. Incremental conversion is supported in case of git and - bzr. diff --git a/exporters/darcs/darcs-fast-export b/exporters/darcs/darcs-fast-export deleted file mode 100755 index fa850de..0000000 --- a/exporters/darcs/darcs-fast-export +++ /dev/null @@ -1,380 +0,0 @@ -#!/usr/bin/env python - -""" - - darcs-fast-export - darcs backend for fast data importers - - Copyright (c) 2008, 2009 Miklos Vajna <vmiklos@frugalware.org> - Copyright (c) 2008 Matthias Andree <matthias.andree@gmx.de> - - This program is free software; you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation; either version 2, or (at your option) - any later version. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with this program; if not, write to the Free Software - Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. - -""" - -import xml.dom.minidom -import xml.parsers.expat -import os -import sys -import gzip -import time -import calendar -import shutil -import subprocess -import optparse -import re -import urllib -import urllib2 -import StringIO - -sys = reload(sys) -sys.setdefaultencoding("utf-8") - -class Handler: - def __init__(self): - self.hashes = [] - self.authormap = {} - self.export_marks = [] - self.import_marks = [] - - def get_patchname(self, patch): - ret = [] - s = "" - if patch.attributes['inverted'].value == 'True': - s = "UNDO: " - cs = patch.getElementsByTagName("name")[0].childNodes - if cs.length > 0: - ret.append(s + cs[0].data) - lines = patch.getElementsByTagName("comment") - if lines: - for i in lines[0].childNodes[0].data.split('\n'): - if not i.startswith("Ignore-this: "): - ret.append(i) - return "\n".join(ret).encode('utf-8') - - def get_author(self, patch): - """darcs allows any freeform string, but fast-import has a more - strict format, so fix up broken author names here.""" - - author = patch.attributes['author'].value - if author in self.authormap: - author = self.authormap[author] - if not len(author): - author = "darcs-fast-export <darcs-fast-export>" - # add missing name - elif not ">" in author: - author = "%s <%s>" % (author.split('@')[0], author) - # avoid double quoting - elif author[0] == '"' and author[-1] == '"': - author = author[1:-1] - # name after email - elif author[-1] != '>': - author = author[author.index('>')+2:] + ' ' + author[:author.index('>')+1] - return author.encode('utf-8') - - def get_date(self, patch): - try: - date = time.strptime(patch, "%Y%m%d%H%M%S") - except ValueError: - date = time.strptime(patch[:19] + patch[-5:], '%a %b %d %H:%M:%S %Y') - return calendar.timegm(date) - - def progress(self, s): - print "progress [%s] %s" % (time.strftime("%Y-%m-%d %H:%M:%S", time.localtime()), s) - sys.stdout.flush() - - def log(self, s): - self.logsock.write("[%s] %s" % (time.strftime("%Y-%m-%d %H:%M:%S", time.localtime()), s)) - self.logsock.flush() - - def parse_inventory(self, sock=None): - prev = None - nextprev = False - buf = [] - if not sock: - sock = self.open(os.path.join(self.origin, "_darcs", "hashed_inventory")) - for i in sock.readlines(): - if i.startswith("hash"): - buf.insert(0, i[6:-1]) - if i.startswith("Starting with inventory:"): - nextprev = True - elif nextprev: - prev = i[:-1] - nextprev = False - sock.close() - for i in buf: - self.hashes.insert(0, i) - if prev: - sock = self.gzip_open(os.path.join(self.origin, "_darcs", "inventories", prev)) - self.parse_inventory(sock) - - # this is like gzip.open but supports urls as well - def gzip_open(self, path): - if os.path.exists(path): - return gzip.open(path) - buf = urllib.urlopen(path).read() - sock = StringIO.StringIO(buf) - return gzip.GzipFile(fileobj=sock) - - # this is like os.path.exists but supports urls as well - def path_exists(self, path): - if os.path.exists(path): - return True - else: - try: - urllib2.urlopen(urllib2.Request(path)) - return True - except urllib2.HTTPError, e: - return False - - # this is like open, but supports urls as well - def open(self, path): - if os.path.exists(path): - return open(path) - else: - return urllib.urlopen(path) - - def handle_opts(self): - # Option Parser - usage="%prog [options] darcsrepo" - opp = optparse.OptionParser(usage=usage) - opp.add_option("--import-marks", metavar="IFILE", - help="read state for incremental imports from IFILE") - opp.add_option("--export-marks", metavar="OFILE", - help="write state for incremental imports from OFILE") - opp.add_option("--encoding", - help="encoding of log [default: %default], if unspecified and input isn't utf-8, guess") - opp.add_option("--authors-file", metavar="F", - help="read author transformations in old=new format from F") - opp.add_option("--working", metavar="W", - help="working directory which is removed at the end of non-incremental conversions") - opp.add_option("--logfile", metavar="L", - help="log file which contains the output of external programs invoked during the conversion") - opp.add_option("--git-branch", metavar="B", - help="git branch [default: refs/heads/master]") - opp.add_option("--progress", metavar="P", - help="insert progress statements after every n commit [default: 100]") - (self.options, self.args) = opp.parse_args() - if len(self.args) < 1: - opp.error("darcsrepo required") - - # read author mapping file in gitauthors format, - # i. e. in=out (one per # line) - if self.options.authors_file: - sock = open(self.options.authors_file) - self.authormap = dict([i.strip().split('=',1) for i in sock]) - sock.close() - - if "://" not in self.args[0]: - self.origin = os.path.abspath(self.args[0]) - else: - self.origin = self.args[0].strip('/') - if self.options.working: - self.working = os.path.abspath(self.options.working) - else: - if "://" not in self.origin: - self.working = "%s.darcs" % self.origin - else: - self.working = "%s.darcs" % os.path.split(self.origin)[-1] - if self.options.logfile: - logfile = os.path.abspath(self.options.logfile) - else: - if "://" not in self.origin: - logfile = "%s.log" % self.origin - else: - logfile = "%s.log" % os.path.split(self.origin)[-1] - self.logsock = open(logfile, "a") - if self.options.git_branch: - self.git_branch = self.options.git_branch - else: - self.git_branch = "refs/heads/master" - - if self.options.progress: - self.prognum = int(self.options.progress) - else: - self.prognum = 100 - - def handle_import_marks(self): - if self.options.import_marks: - sock = open(self.options.import_marks) - for i in sock.readlines(): - line = i.strip() - if not len(line): - continue - self.import_marks.append(line.split(' ')[1]) - self.export_marks.append(line) - sock.close() - - def get_patches(self): - self.progress("getting list of patches") - if not len(self.import_marks): - sock = os.popen("darcs changes --xml --reverse --repo %s" % self.origin) - else: - sock = os.popen("darcs changes --xml --reverse --repo %s --from-match 'hash %s'" % (self.origin, self.import_marks[-1])) - buf = sock.read() - sock.close() - # this is hackish. we need to escape some bad chars, otherwise the xml - # will not be valid - buf = buf.replace('\x1b', '^[') - if self.options.encoding: - xmldoc = xml.dom.minidom.parseString(unicode(buf, self.options.encoding).encode('utf-8')) - else: - try: - xmldoc = xml.dom.minidom.parseString(buf) - except xml.parsers.expat.ExpatError: - try: - import chardet - except ImportError: - sys.exit("Error, encoding is not utf-8. Please " + - "either specify it with the --encoding " + - "option or install chardet.") - self.progress("encoding is not utf8, guessing charset") - encoding = chardet.detect(buf)['encoding'] - self.progress("detected encoding is %s" % encoding) - xmldoc = xml.dom.minidom.parseString(unicode(buf, encoding).encode('utf-8')) - sys.stdout.flush() - return xmldoc.getElementsByTagName('patch') - - def setup_workdir(self): - darcs2 = False - self.oldfashionedpatch = True - self.cwd = os.getcwd() - if self.path_exists(os.path.join(self.origin, "_darcs", "format")): - sock = self.open(os.path.join(self.origin, "_darcs", "format")) - format = [x.strip() for x in sock] - sock.close() - darcs2 = 'darcs-2' in format - self.oldfashionedpatch = not 'hashed' in format - if not self.oldfashionedpatch: - self.progress("parsing the inventory") - if "://" not in self.origin: - os.chdir(self.origin) - self.parse_inventory() - if not self.options.import_marks or not os.path.exists(self.working): - # init the tmp darcs repo - os.mkdir(self.working) - os.chdir(self.working) - if darcs2: - os.system("darcs init --darcs-2") - else: - os.system("darcs init --old-fashioned-inventory") - else: - os.chdir(self.working) - if self.options.import_marks: - sock = os.popen("darcs pull -a --match 'hash %s' %s" % (self.import_marks[-1], self.origin)) - self.log("Building/updating working directory:\n%s" % sock.read()) - sock.close() - - def export_patches(self): - patches = self.get_patches() - # this is the number of the NEXT patch - count = 1 - if len(self.import_marks): - patches = patches[1:] - count = len(self.import_marks) + 1 - if len(self.export_marks): - # this is the mark number of the NEXT patch - markcount = int(self.export_marks[-1].split(' ')[0][1:]) + 1 - else: - markcount = count - # this may be huge and we need it many times - patchnum = len(patches) - - if not len(self.import_marks): - self.progress("starting export, repo has %d patches" % patchnum) - else: - self.progress("continuing export, %d patches to convert" % patchnum) - paths = [] - for i in patches: - # apply the patch - hash = i.attributes['hash'].value - buf = ["\nNew patches:\n"] - if self.oldfashionedpatch: - sock = self.gzip_open(os.path.join(self.origin, "_darcs", "patches", hash)) - else: - sock = self.gzip_open(os.path.join(self.origin, "_darcs", "patches", self.hashes[count-1])) - buf.append(sock.read()) - sock.close() - sock = os.popen("darcs changes --context") - buf.append(sock.read()) - sock.close() - sock = subprocess.Popen(["darcs", "apply", "--allow-conflicts"], stdin=subprocess.PIPE, stdout=subprocess.PIPE) - sock.stdin.write("".join(buf)) - sock.stdin.close() - self.log("Applying %s:\n%s" % (hash, sock.stdout.read())) - sock.stdout.close() - message = self.get_patchname(i) - # export the commit - print "commit %s" % self.git_branch - print "mark :%s" % markcount - if self.options.export_marks: - self.export_marks.append(":%s %s" % (markcount, hash)) - date = self.get_date(i.attributes['date'].value) - print "committer %s %s +0000" % (self.get_author(i), date) - print "data %d\n%s" % (len(message), message) - if markcount > 1: - print "from :%s" % (markcount-1) - # export the files - for j in paths: - print "D %s" % j - paths = [] - for (root, dirs, files) in os.walk ("."): - for f in files: - j = os.path.normpath(os.path.join(root, f)) - if j.startswith("_darcs") or "-darcs-backup" in j: - continue - paths.append(j) - sock = open(j) - buf = sock.read() - sock.close() - # darcs does not track the executable bit :/ - print "M 644 inline %s" % j - print "data %s\n%s" % (len(buf), buf) - if message[:4] == "TAG ": - tag = re.sub('[^\xe9-\xf8\w.\-]+', '_', message[4:].strip().split('\n')[0]).strip('_') - print "tag %s" % tag - print "from :%s" % markcount - print "tagger %s %s +0000" % (self.get_author(i), date) - print "data %d\n%s" % (len(message), message) - if count % self.prognum == 0: - self.progress("%d/%d patches" % (count, patchnum)) - count += 1 - markcount += 1 - - os.chdir(self.cwd) - - if not self.options.export_marks: - shutil.rmtree(self.working) - self.logsock.close() - - def handle_export_marks(self): - if self.options.export_marks: - self.progress("writing export marks") - sock = open(self.options.export_marks, 'w') - sock.write("\n".join(self.export_marks)) - sock.write("\n") - sock.close() - - self.progress("finished") - - def handle(self): - self.handle_opts() - self.handle_import_marks() - self.setup_workdir() - self.export_patches() - self.handle_export_marks() - -if __name__ == "__main__": - h = Handler() - h.handle() diff --git a/exporters/darcs/darcs-fast-export.txt b/exporters/darcs/darcs-fast-export.txt deleted file mode 100644 index d404ecf..0000000 --- a/exporters/darcs/darcs-fast-export.txt +++ /dev/null @@ -1,68 +0,0 @@ -= darcs-fast-export(1) - -== NAME - -darcs-fast-export - darcs frontend to git fast-import - -== SYNOPSIS - -darcs-fast-export [<options>] <darcsrepo> - -== DESCRIPTION - -darcs-fast-export expects one argument, the path to the source darcs -repository. It will print the git fast-import format on standard output -(stdout). - -The script can produce the fast-import stream format from the darcs -repository. It supports incremental conversion as well, via the ---import-marks / --export-marks switches. - -Optionally the darcsrepo string may be a HTTP repository, in that case -only the patches are downloaded, not the pristine, speeding up a -one-time import. - -== OPTIONS - --h, --help:: - Display usage. - ---import-marks=<file>:: - Import marks from <file>. This is read at the beginning of the - conversion at once. Use it if you want to continue an incremental - conversion. - ---export-marks=<file>:: - Export marks to <file> at the end of the conversion. It can be the - same as the one for --import-marks as it is written only once at the - end. Use it if you want to be able to incrementally update the target - repository later. - ---encoding=<encoding>:: - The encoding of the author names and commit messages in the repository. - The default is utf-8. If it is not the default, it will be guessed. - Given that it takes some time, you can explicitly specify it as an - option to make the conversion faster. Content in the output will encoded - as utf-8 and will be written that way to the target repository, unless - the importer re-encodes it again to some other character set. - ---working=<directory>:: - The conversion is done by applying the patches one by one and recording - the state of the working directory. You can specify the path of this - directory using this option. - ---logfile=<logfile>:: - The output of external commands are redirected to a log file. You can - specify the path of that file with this parameter. - ---git-branch=<branch>:: - There is only one branch in one darcs repository, but the fast-import - stream format allows multiple branches, thus the exporter has to name - darcs's branch. The default value is 'refs/heads/master'. - ---progress=<n>:: - Insert progress statements after every <n> patches, to be shown by the - fast importer during import. The default value is '100'. - ---authors-file=<file>:: - Read author transformations in old=new format from <file>. diff --git a/exporters/darcs/darcs-fast-import b/exporters/darcs/darcs-fast-import deleted file mode 100755 index 69ec7bb..0000000 --- a/exporters/darcs/darcs-fast-import +++ /dev/null @@ -1,375 +0,0 @@ -#!/usr/bin/env python - -""" - - darcs-fast-export - darcs backend for fast data exporters - - Copyright (c) 2008, 2009, 2010 Miklos Vajna <vmiklos@frugalware.org> - Copyright (c) 2008 Matthias Andree <matthias.andree@gmx.de> - - This program is free software; you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation; either version 2, or (at your option) - any later version. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with this program; if not, write to the Free Software - Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. - -""" - -import sys -import os -import re -import time -import shutil -import optparse -import subprocess - -class Handler: - def __init__(self): - self.marks = {} - self.files = [] - self.prevfiles = None - self.ch = None - self.line = None - self.unread_line = False - self.eof = False - self.debug = False - self.export_marks = [] - self.import_marks = [] - - def read_next_line(self): - if self.unread_line: - self.unread_line = False - return - self.line = "" - if self.eof: - return - if self.ch: - self.line += self.ch - self.ch = None - buf = sys.stdin.readline() - if not len(buf): - self.eof = True - else: - self.line += buf - if self.debug: - print "read_next_line: '%s'" % self.line - - def read(self, length): - buf = "" - if self.ch: - buf += self.ch - self.ch = None - buf += sys.stdin.read(length) - if self.debug: - print "read: '%s'" % buf - return buf - - def skip_optional_lf(self): - self.ch = self.read(1) - if self.ch == "\n": - self.ch = None - - def bug(self, s): - raise Exception(s) - - def get_date(self, ts, tz): - # first fix the case when tz is higher than +1200, as - # darcs won't accept it - if int(tz[:3]) > 12: - ts = str(int(ts) + 60*60*24) - tz = str(int(tz[:3])-24) + tz[3:] - # int(ts) is seconds since epoch. Since we're trying to - # capture both the absolute time of the commit and the - # localtime in the timezone of the committer, we need to turn - # the (seconds-since-epoch, committer-timezone-offset) pair - # that we get from the git-fast-export stream format into a - # localized-time-plus-timezone-marker string that darcs will - # accept. Therefore, we parse the timezone-offset (which - # looks like +0500 or +0000 or -0730 or something) and add it - # to seconds-since-epoch before calling gmtime(). - mo = re.search(r'^([\+\-])(\d\d)(\d\d)$', tz) - offset = 60*60*int(mo.group(2)) + 60*int(mo.group(3)) - if mo.group(1) == "-": - offset = -offset - offset_time = int(ts) + offset - s = time.strftime("%a %b %d %H:%M:%S %Y", time.gmtime(offset_time)) - items = s.split(' ') - return " ".join(items[:-1]) + " " + tz + " " + items[-1] - - def invoke_darcs(self, cmdline): - if os.system("darcs %s" % cmdline) != 0: - self.bug("darcs failed") - - def invoke_add(self, path): - self.invoke_darcs("add --boring --case-ok %s" % path) - - def handle_mark(self): - if self.line.startswith("mark :"): - self.mark_num = int(self.line[6:-1]) - self.read_next_line() - - def handle_data(self): - if not self.line.startswith("data "): - self.bug("Expected 'data n' command, found: '%s'" % self.line[:-1]) - length = int(self.line[5:-1]) - self.buf = self.read(length) - self.skip_optional_lf() - - def handle_blob(self): - self.read_next_line() - self.handle_mark() - self.handle_data() - self.marks[self.mark_num] = self.buf - - def handle_ident(self, s): - items = s.split(' ') - self.ident = " ".join(items[:-2]) - self.date = self.get_date(items[-2], items[-1]) - - def handle_msg(self): - items = self.buf.split('\n') - self.short = items[0] - self.long = "\n".join(items[1:]) - - def handle_tag(self): - version = self.line[:-1].split(' ')[1] - self.read_next_line() - if self.line.startswith("from "): - self.read_next_line() - if self.line.startswith("tagger "): - self.handle_ident(self.line[7:-1]) - self.read_next_line() - self.handle_data() - self.skip_optional_lf() - sock = subprocess.Popen(["darcs", "tag", "--pipe"], stdin=subprocess.PIPE, stdout=subprocess.PIPE) - buf = [self.date, self.ident, version] - sock.stdin.write("\n".join(buf)) - sock.stdin.close() - self.log("Tagging %s:\n%s" % (version, sock.stdout.read())) - sock.stdout.close() - if sock.wait() != 0: - self.bug("darcs tag failed: '%s'" % sock.returncode) - - def handle_commit(self): - if not self.prevfiles and self.options.import_marks: - # first commit in an incremental continued - # import - for (root, dirs, files) in os.walk("."): - for i in files: - path = os.path.normpath(os.path.join(root, i)) - if path.startswith("_darcs") or "-darcs-backup" in path: - continue - self.files.append(path) - self.prevfiles = self.files[:] - adds = [] - symlinks = [] - - self.read_next_line() - self.handle_mark() - if self.line.startswith("author "): - self.handle_ident(self.line[7:-1]) - self.read_next_line() - if self.line.startswith("committer "): - self.handle_ident(self.line[10:-1]) - self.read_next_line() - self.handle_data() - self.skip_optional_lf() - self.handle_msg() - self.read_next_line() - if self.line.startswith("from "): - self.read_next_line() - while self.line.startswith("merge "): - self.read_next_line() - change = False - while len(self.line) > 0: - if self.line.startswith("deleteall"): - path = self.line[2:-1] - for path in self.files: - os.unlink(path) - self.files = [] - change = True - elif self.line.startswith("D "): - path = self.line[2:-1] - if os.path.exists(path): - os.unlink(path) - if path in self.files: - self.files.remove(path) - change = True - elif self.line.startswith("R "): - self.invoke_darcs("mv %s" % self.line[2:]) - change = True - elif self.line.startswith("C "): - src, dest = self.line[:-1].split(' ')[1:] - shutil.copy(src.strip('"'), dest.strip('"')) - self.invoke_add(dest) - change = True - elif self.line.startswith("M "): - items = self.line.split(' ') - path = items[3][:-1] - dir = os.path.split(path)[0] - if len(dir) and not os.path.exists(dir): - os.makedirs(dir) - if items[1] == "120000": - if not self.options.symhack: - print "Adding symbolic links (symlinks) is not supported by Darcs." - sys.exit(2) - idx = int(items[2][1:]) # TODO: handle inline symlinks - symlinks.append((self.marks[idx], path)) - self.read_next_line() - continue - sock = open(path, "w") - if items[2] != "inline": - idx = int(items[2][1:]) - sock.write(self.marks[idx]) - else: - self.read_next_line() - self.handle_data() - sock.write(self.buf) - sock.close() - if path not in self.prevfiles: - adds.append(path) - if path not in self.files: - self.files.append(path) - change = True - else: - self.unread_line = True - break - self.read_next_line() - if not len(self.line): - break - - if not change: - # darcs does not support empty commits - return - for i in adds: - self.invoke_add(i) - args = ["darcs", "record", "--ignore-times", "-a", "--pipe"] - buf = [self.date, self.ident] - if not len(self.short): - args.extend(['-m', '']) - else: - buf.extend([self.short, self.long]) - sock = subprocess.Popen(args, stdin=subprocess.PIPE, stdout=subprocess.PIPE) - sock.stdin.write("\n".join(buf)+"\n") - sock.stdin.close() - self.log("Recording :%s:\n%s" % (self.mark_num, sock.stdout.read())) - sock.stdout.close() - if sock.wait() != 0: - self.bug("darcs record failed: '%s'" % sock.returncode) - - for src, path in symlinks: - # symlink does not do what we want if path is - # already there - if os.path.exists(path): - # rmtree() does not work on symlinks - if os.path.islink(path): - os.remove(path) - else: - shutil.rmtree(path) - os.symlink(src, path) - if self.options.export_marks: - # yeah, an xml parser would be better, but - # should we mess with encodings just because of - # this? i hope not - sock = os.popen("darcs changes --last=1 --xml", "r") - buf = sock.read() - sock.close() - hash = buf.split('\n')[1].split("'")[-2] - self.export_marks.append(":%s %s" % (self.mark_num, hash)) - - def handle_progress(self, s): - print "import progress [%s] %s" % (time.strftime("%Y-%m-%d %H:%M:%S", time.localtime()), s.strip()) - sys.stdout.flush() - - def handle_opts(self): - # Option Parser - usage="%prog [options]" - opp = optparse.OptionParser(usage=usage) - opp.set_defaults(symhack=False) - opp.add_option("--import-marks", metavar="IFILE", - help="read state for incremental imports from IFILE") - opp.add_option("--export-marks", metavar="OFILE", - help="write state for incremental imports to OFILE") - opp.add_option("--logfile", metavar="L", - help="log file which contains the output of external programs invoked during the conversion") - opp.add_option("--symhack", action="store_true", dest="symhack", - help="Do not error out when a symlink would be created, just create it in the workdir") - opp.add_option("--progress", metavar="P", - help="insert progress statements after every n commit [default: 100]") - (self.options, args) = opp.parse_args() - - if self.options.logfile: - logfile = self.options.logfile - else: - logfile = "_darcs/import.log" - self.logsock = open(os.path.abspath(logfile), "a") - - if self.options.progress: - self.prognum = int(self.options.progress) - else: - self.prognum = 0 - - def log(self, s): - self.logsock.write("[%s] %s" % (time.strftime("%Y-%m-%d %H:%M:%S", time.localtime()), s)) - self.logsock.flush() - - def handle_export_marks(self): - if self.options.export_marks: - sock = open(self.options.export_marks, 'w') - sock.write("\n".join(self.export_marks)) - sock.write("\n") - sock.close() - - def handle_import_marks(self): - if self.options.import_marks: - sock = open(self.options.import_marks) - for i in sock.readlines(): - line = i.strip() - if not len(line): - continue - self.import_marks.append(line.split(' ')[1]) - self.export_marks.append(line) - sock.close() - - def handle(self): - self.handle_opts() - self.handle_import_marks() - - commitcount = 0 - while not self.eof: - self.read_next_line() - if not len(self.line[:-1]): - pass - elif self.line.startswith("blob"): - self.handle_blob() - elif self.line.startswith("commit"): - self.handle_commit() - commitcount += 1 - if self.prognum != 0 and commitcount % self.prognum == 0: - self.handle_progress("%d patches" % commitcount) - elif self.line.startswith("tag"): - self.handle_tag() - elif self.line.startswith("reset"): - self.read_next_line() - if not self.line.startswith("from "): - self.unread_line = True - elif self.line.startswith("checkpoint"): - pass - elif self.line.startswith("progress"): - self.handle_progress(self.line[9:]) - else: - self.bug("'%s': invalid command" % self.line[:-1]) - - self.handle_export_marks() - -if __name__ == "__main__": - h = Handler() - h.handle() diff --git a/exporters/darcs/darcs-fast-import.txt b/exporters/darcs/darcs-fast-import.txt deleted file mode 100644 index a7f2a12..0000000 --- a/exporters/darcs/darcs-fast-import.txt +++ /dev/null @@ -1,57 +0,0 @@ -= darcs-fast-import(1) - -== NAME - -darcs-fast-import - darcs backend to the 'fast-import stream' format - -== SYNOPSIS - -darcs-fast-import [<options>] - -== DESCRIPTION - -darcs-fast-import can produce a darcs repository from a fast-import -stream, read from the standard input. It supports incremental conversion -as well, via the --import-marks / --export-marks switches. - -== OPTIONS - --h, --help:: - Display usage. - ---import-marks:: - Import marks from a given file. This is read at the beginning of the - conversion at once. Use it if you want to continue an incremental - conversion. - ---export-marks:: - Export marks to a given file at the end of the conversion. It can be the - same as the one for --import-marks as it is written only once at the - end. Use it if you want to be able to incrementally update the target - repository later. - ---logfile:: - The output of external commands are redirected to a log file. You can - specify the path of that file with this parameter. - ---symhack:: - Enable hack for symbolic links. darcs add does not handle them - but in case they are just added, we can create them in the working - directory. This can be handy in case for example the symbolic link is in - a subdirectory of the project and you don't even care about that - subdirectory. So the hack can be useful, but be extremely careful when - you use it. - ---progress=<n>:: - Insert progress statements after every <n> created patches. The - default is not to print anything as progress info is usually provided by - the exporter. Use this option in case the exporter does not have such a - switch but you still want to get some feedback. - -== EXIT CODES - -The exit code is: - -* 0 on success -* 1 on unhandled exception -* 2 in case the stream would try to let the importer create a symlink diff --git a/exporters/darcs/git-darcs b/exporters/darcs/git-darcs deleted file mode 100755 index c4343ef..0000000 --- a/exporters/darcs/git-darcs +++ /dev/null @@ -1,279 +0,0 @@ -#!/bin/bash -# -# git-darcs - bidirectional operation between a darcs repo and git -# -# Copyright (c) 2008, 2010 by Miklos Vajna <vmiklos@frugalware.org> -# -# Based on git-bzr, which is -# -# Copyright (c) 2008 Pieter de Bie <pdebie@ai.rug.nl> -# -# This program is free software; you can redistribute it and/or modify -# it under the terms of the GNU General Public License as published by -# the Free Software Foundation; either version 2 of the License, or -# (at your option) any later version. -# -# This program is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -# GNU General Public License for more details. -# -# You should have received a copy of the GNU General Public License -# along with this program. If not, see <http://www.gnu.org/licenses/>. -# - -add() -{ - name="$1" - shift - location="$1" - shift - if ! [ -n "$name" -a -n "$location" ]; then - echo "Usage: git darcs add name location [darcs-fast-export options]" - return 1 - fi - if git remote show |grep -q $name; then - echo "There is already a remote with that name" - return 1 - fi - if [ -n "$(git config git-darcs.$name.location)" ]; then - echo "There is already a darcs repo with that name" - return 1 - fi - repo=$location/_darcs - if [ ! -d $repo ] && ! wget --quiet --spider $repo; then - echo "Remote is not a darcs repository" - return 1 - fi - git config git-darcs.$name.location $location - echo "Darcs repo $name added. You can fetch it with 'git darcs fetch $name'" - if ! [ -z "$*" ]; then - git config git-darcs.$name.darcs-fast-export-options "$*" - echo "darcs-fast-export will get options: $*" - fi -} - -get_location() -{ - l=$(git config git-darcs.$remote.location) - if [ -z "$l" ]; then - echo "Cannot find darcs remote with name '$remote'." >&2 - return 1 - fi - echo $l -} - -fetch() -{ - remote="$1" - shift - if ! [ -n "$remote" -a -z "$*" ]; then - echo "Usage: git darcs fetch reponame" - return 1 - fi - location=$(get_location $remote) || return $? - git_map=$git_dir/darcs-git/$remote-git-map - darcs_map=$git_dir/darcs-git/$remote-darcs-map - common_opts="--working $git_dir/darcs-git/repo --logfile $git_dir/darcs-git/fetch.log --git-branch=refs/remotes/darcs/$remote" - dfe_opts=$(git config git-darcs.$remote.darcs-fast-export-options) - pre_fetch="$(git config git-darcs.$remote.pre-fetch)" - if [ -n "$pre_fetch" ]; then - $pre_fetch - fi - if [ ! -f $git_map -a ! -f $darcs_map ]; then - echo "There doesn't seem to be an existing refmap." - echo "Doing an initial import" - mkdir -p $git_dir/darcs-git - darcs-fast-export --export-marks=$darcs_map $common_opts $dfe_opts $location | \ - git fast-import --export-marks=$git_map - elif [ -f $git_map -a -f $darcs_map ]; then - echo "Updating remote $remote" - old_rev=$(git rev-parse refs/remotes/darcs/$remote) - darcs-fast-export --import-marks=$darcs_map --export-marks=$darcs_map $common_opts $dfe_opts $location | \ - git fast-import --quiet --import-marks=$git_map --export-marks=$git_map - new_rev=$(git rev-parse refs/remotes/darcs/$remote) - if [ "$old_rev" != "$new_rev" ]; then - echo "Fetched the following updates:" - git shortlog $old_rev..$new_rev - else - echo "Nothing fetched." - return 0 - fi - else - echo "One of the mapfiles is missing! Something went wrong!" - return 1 - fi - post_fetch="$(git config git-darcs.$remote.post-fetch)" - if [ -n "$post_fetch" ]; then - $post_fetch - fi -} - -pull() -{ - remote="$1" - shift - if ! [ -n "$remote" -a -z "$*" ]; then - echo "Usage: git darcs pull reponame" - return 1 - fi - fetch $remote || return $? - # see if we need to merge or rebase - branch=$(git symbolic-ref HEAD|sed 's|.*/||') - if [ "$(git config branch.$branch.rebase)" = "true" ]; then - git rebase refs/remotes/darcs/$remote - else - git merge refs/remotes/darcs/$remote - fi -} - -push() -{ - remote="$1" - shift - if ! [ -n "$remote" -a -z "$*" ]; then - echo "Usage: git darcs push reponame" - return 1 - fi - location=$(get_location $remote) || return $? - if [ -n "$(git rev-list --left-right HEAD...refs/remotes/darcs/$remote | sed -n '/^>/ p')" ]; then - echo "HEAD is not a strict child of $remote, cannot push. Merge first" - return 1 - fi - if [ -z "$(git rev-list --left-right HEAD...refs/remotes/darcs/$remote | sed -n '/^</ p')" ]; then - echo "Nothing to push. Commit something first" - return 1 - fi - git_map=$git_dir/darcs-git/$remote-git-map - darcs_map=$git_dir/darcs-git/$remote-darcs-map - if [ ! -f $git_map -o ! -f $darcs_map ]; then - echo "We do not have refmapping yet. Then how can I push?" - return 1 - fi - pre_push="$(git config git-darcs.$remote.pre-push)" - if [ -n "$pre_push" ]; then - $pre_push - fi - echo "Pushing the following updates:" - git shortlog refs/remotes/darcs/$remote.. - git fast-export --import-marks=$git_map --export-marks=$git_map HEAD | \ - (cd $location; darcs-fast-import --import-marks=$darcs_map --export-marks=$darcs_map \ - --logfile $git_dir/darcs-git/push.log) - if [ $? == 0 ]; then - git update-ref refs/remotes/darcs/$remote HEAD - post_push="$(git config git-darcs.$remote.post-push)" - if [ -n "$post_push" ]; then - $post_push - fi - fi -} - -# List the darcs remotes -list() -{ - if [ -z "$*" ] - then - git config -l | sed -n -e '/git-darcs\..*/ {s/git-darcs\.//; s/\.location=.*//p}' - return 0 - elif [ "$#" -eq 1 ] - then - case $1 in - -v|--verbose) - git config -l | sed -n -e '/git-darcs\..*/ {s/git-darcs\.//; s/\.location=/\t/p}' - return 0 - ;; - esac - fi - echo "Usage: git darcs list [-v|--verbose]" - return 1 -} - -# Find the darcs commit(s) supporting a git SHA1 prefix -find_darcs() -{ - sha1="$1" - shift - if [ -z "$sha1" -o -n "$*" ] - then - echo "Usage: git darcs find-darcs <sha1-prefix>" - return 1 - fi - for remote in $(git for-each-ref --format='%(refname)' refs/remotes/darcs) - do - remote=`basename $remote` - git_map=$git_dir/darcs-git/$remote-git-map - darcs_map=$git_dir/darcs-git/$remote-darcs-map - if [ ! -f $git_map -o ! -f $darcs_map ] - then - echo "Missing mappings for remote $remote" - return 1 - fi - for row in `sed -n -e "/:.* $sha1.*/ s/[^ ]*/&/p" $git_map` - do - sed -n -e "/$row / {s/[^ ]*//; s/.*/$remote\t&/p}" $darcs_map - done - done -} - -# Find the git commit(s) supporting a darcs patch prefix -find_git() -{ - patch="$1" - shift - if [ -z "$patch" -o -n "$*" ] - then - echo "Usage: git darcs find-git <patch-prefix>" - return 1 - fi - for remote in $(git for-each-ref --format='%(refname)' refs/remotes/darcs) - do - remote=`basename $remote` - git_map=$git_dir/darcs-git/$remote-git-map - darcs_map=$git_dir/darcs-git/$remote-darcs-map - if [ ! -f $git_map -o ! -f $darcs_map ] - then - echo "Missing mappings for remote $remote" - return 1 - fi - for row in `sed -n -e "/:.* $patch.*/ s/[^ ]*/&/p" $darcs_map` - do - sed -n -e "/$row / {s/[^ ]* \(.*\)/$remote\t\1/p}" $git_map - done - done -} - -git rev-parse 2> /dev/null -if [ $? != 0 ]; then - echo "Must be inside a git repository to work" - exit 1 -fi - -git_dir=$(git rev-parse --git-dir) -# make it absolute -cd $git_dir -git_dir=$(pwd) -cd - >/dev/null -command="$1" -shift - -case $command in - add|push|fetch|pull|list) - ;; - find-darcs) - command=find_darcs - ;; - find-git) - command=find_git - ;; - *) - echo "Usage: git darcs [COMMAND] [OPTIONS]" - echo "Commands: add, push, fetch, pull, list, find-darcs, find-git" - exit 1 - ;; -esac - - -up=$(git rev-parse --show-cdup) -[ -z "$up" ] && up="." -cd $up -$command "$@" diff --git a/exporters/darcs/git-darcs.txt b/exporters/darcs/git-darcs.txt deleted file mode 100644 index 8bf5b33..0000000 --- a/exporters/darcs/git-darcs.txt +++ /dev/null @@ -1,92 +0,0 @@ -= git-darcs(1) - -== NAME - -git-darcs - a bidirectional git - darcs gateway - -== SYNOPSIS - -git-darcs <command> <options> - -== DESCRIPTION - -git darcs can convert a darcs repo to a git one, can update such an -existing git repo later, and finally can push back your changes from the -git repo to the darcs one. - -A typical workflow is: - ----- -$ mkdir git-repo -$ cd git-repo -$ git init -$ git darcs add upstream /path/to/darcs-repo -$ git darcs pull upstream - -... hack, hack, hack ... - -$ git darcs push upstream ----- - -== GLOBAL OPTIONS - --h, --help:: - Display usage. - -== COMMANDS - -The supported commands are the followings: - -add:: - This can register a new darcs repo in the git one, so that you - can fetch from it. The syntax is `add nick path [dfe-options]`. - Add any options you want to be passed to darcs-fast-export, - like --encoding=utf-8, or --authors-file AUTHORMAP. Remember - that if AUTHORMAP is not absolute, it will be interpreted - relative to the git repository's root directory. - -push:: - Transfers your changes created in the current branch back the - darcs one. The syntax is `push nick`. - -fetch:: - Downloads changes from the darcs repo and updates the - `darcs/<nick>` branch. None of your local branches are updated. - -pull:: - Calls `fetch` then `git merge` or `git rebase` based on the - `branch.<branchname>.rebase` configuration setting, where `<branchname>` - is the current branch. The default is - just like with `git pull` - is - to `git merge`. - -list:: - List the name [and location] of each registered darcs repo. - The syntax is `list [-v|--verbose]`. - -find-darcs:: - Searches for darcs patches matching a SHA1 prefix. - The syntax is `find-darcs <sha1-prefix>`. - -find-git:: - Searches for git commits matching a darcs patch prefix. - The syntax is `find-git <patch-prefix>`. - -== HOOKS - -It's possible to automatically run before and after the fetch and the -push subcommand. For example if you want to automatically run `darcs -pull -a` before a `git darcs fetch upstream`: - ----- -git config git-darcs.upstream.pre-fetch "darcs pull -a --repodir=/path/to/darcs-repo" ----- - -Or in case you want to automatically `darcs send` all patches after a -`git darcs push upstream`: - ----- -git config git-darcs.upstream.post-push "darcs send -a --repodir=/path/to/darcs-repo" ----- - -== SEE-ALSO -*git*(1), *darcs*(1) diff --git a/exporters/darcs/t/Makefile b/exporters/darcs/t/Makefile deleted file mode 100644 index de8a7ab..0000000 --- a/exporters/darcs/t/Makefile +++ /dev/null @@ -1,9 +0,0 @@ -T = $(wildcard test*.sh) - -all: $(T) - @echo "passed $$(echo $(T)|wc -w) tests." - -$(T): - @echo "*** $@ ***"; sh $@ - -.PHONY: $(T) diff --git a/exporters/darcs/t/bench-results/Makefile b/exporters/darcs/t/bench-results/Makefile deleted file mode 100644 index 0157f69..0000000 --- a/exporters/darcs/t/bench-results/Makefile +++ /dev/null @@ -1,5 +0,0 @@ -bench-results.png: bench-results.gnu bench-results.dat - gnuplot bench-results.gnu - -bench-results.dat: bench-results.py $(wildcard ../darcs-benchmark/big-zoo/*.log) - python bench-results.py > bench-results.dat diff --git a/exporters/darcs/t/bench-results/bench-results.gnu b/exporters/darcs/t/bench-results/bench-results.gnu deleted file mode 100644 index f4e8917..0000000 --- a/exporters/darcs/t/bench-results/bench-results.gnu +++ /dev/null @@ -1,6 +0,0 @@ -set terminal png -set output 'bench-results.png' -unset key -set xlabel "number of patches" -set ylabel "elapsed time in hours" -plot 'bench-results.dat' with linespoints diff --git a/exporters/darcs/t/bench-results/bench-results.py b/exporters/darcs/t/bench-results/bench-results.py deleted file mode 100644 index fbb834b..0000000 --- a/exporters/darcs/t/bench-results/bench-results.py +++ /dev/null @@ -1,23 +0,0 @@ -from glob import glob -import re - -def cmp_data(a, b): - return cmp(a[0], b[0]) - -logs = glob("../darcs-benchmark/big-zoo/*.log") - -data = [] - -for i in logs: - sock = open(i) - for j in sock.readlines(): - if "Num Patches:" in j: - patches = int(j.split(": ")[1].strip()) - elif j.startswith("real"): - l = re.sub("real\t([0-9]+)m([0-9.]+)s\n", r"\1 \2", j).split(" ") - secs = int(l[0])*60 + float(l[1]) - hours = secs / 3600 - data.append([patches, hours]) -data.sort(cmp=cmp_data) -for i in data: - print "%s %s" % (i[0], i[1]) diff --git a/exporters/darcs/t/bench-tailor.sh b/exporters/darcs/t/bench-tailor.sh deleted file mode 100644 index 7567f7b..0000000 --- a/exporters/darcs/t/bench-tailor.sh +++ /dev/null @@ -1,59 +0,0 @@ -#!/bin/sh - -create_config() -{ - cd $1 - mypath=$(pwd) - cd - >/dev/null - myname=$(basename $mypath) - - cat > config << EOF -[DEFAULT] -encoding-errors-policy = replace - -[$myname] -source = darcs:$myname -target = git:$myname - -[darcs:$myname] -subdir = darcs -repository = $mypath - -[git:$myname] -subdir = git -repository = $mypath.git -EOF -} - -PATH=$HOME/darcs/tailor:$PATH -if [ ! -d darcs-benchmark ]; then - darcs get http://code.haskell.org/darcs/darcs-benchmark - cd darcs-benchmark -else - cd darcs-benchmark - darcs pull -a -fi -sh initialise.sh -cd big-zoo -if [ -n "$1" ]; then - targets=$1 -else - targets=*_play.tar.gz -fi -for i in $targets -do - echo "benchmarking $i" - rm -rf _playground - tar xf $i - cd _playground - log="../$i.tailor-$(tailor --version).log" - create_config sandbox - sh -c 'time tailor --configfile config' 2>&1 |tee $log - if diff --exclude _darcs --exclude .git -Nur sandbox git >/dev/null; then - echo "ok, the result is correct" >> $log - else - echo "ouch, the result is corrupted" >> $log - exit 1 - fi - cd .. -done diff --git a/exporters/darcs/t/bench.sh b/exporters/darcs/t/bench.sh deleted file mode 100644 index a4b3d0d..0000000 --- a/exporters/darcs/t/bench.sh +++ /dev/null @@ -1,38 +0,0 @@ -#!/bin/sh - -# this is a test as well, but it would take a lot of time, so don't -# prefix it with 'test'. - -. lib.sh - -if [ ! -d darcs-benchmark ]; then - darcs get http://code.haskell.org/darcs/darcs-benchmark - cd darcs-benchmark -else - cd darcs-benchmark - darcs pull -a -fi -sh initialise.sh -cd big-zoo -if [ -n "$1" ]; then - targets=$1 -else - targets=*_play.tar.gz -fi -for i in $targets -do - echo "benchmarking $i" - rm -rf _playground - tar xf $i - cd _playground - log="../$i.d-f-e-$(git describe).log" - sh -c 'time d2x -f git sandbox' 2>&1 |tee $log - darcs show repo --repodir sandbox |egrep -v 'Root|Cache|Default' >> $log - if diff_git sandbox >/dev/null; then - echo "ok, the result is correct" >> $log - else - echo "ouch, the result is corrupted" >> $log - exit 1 - fi - cd .. -done diff --git a/exporters/darcs/t/data/hungarian.gif b/exporters/darcs/t/data/hungarian.gif Binary files differdeleted file mode 100644 index 41a36fe..0000000 --- a/exporters/darcs/t/data/hungarian.gif +++ /dev/null diff --git a/exporters/darcs/t/lib-httpd.sh b/exporters/darcs/t/lib-httpd.sh deleted file mode 100644 index fad953e..0000000 --- a/exporters/darcs/t/lib-httpd.sh +++ /dev/null @@ -1,67 +0,0 @@ -#!/bin/sh -# -# This is based on git's t/lib-httpd.sh, which is -# Copyright (c) 2008 Clemens Buchacher <drizzd@aon.at> -# - -if test -n "$DFE_TEST_SKIP_HTTPD" -then - echo "skipping test (undef DFE_TEST_SKIP_HTTPD to enable)" - exit -fi - -LIB_HTTPD_PATH=${LIB_HTTPD_PATH-'/usr/sbin/httpd'} -LIB_HTTPD_PORT=${LIB_HTTPD_PORT-'8111'} - -HTTPD_ROOT_PATH="$PWD"/httpd -HTTPD_DOCUMENT_ROOT_PATH=$HTTPD_ROOT_PATH/www - -if ! test -x "$LIB_HTTPD_PATH" -then - echo "skipping test, no web server found at '$LIB_HTTPD_PATH'" - exit -fi - -HTTPD_VERSION=`$LIB_HTTPD_PATH -v | \ - sed -n 's/^Server version: Apache\/\([0-9]*\)\..*$/\1/p; q'` - -if test -n "$HTTPD_VERSION" -then - if test -z "$LIB_HTTPD_MODULE_PATH" - then - if ! test $HTTPD_VERSION -ge 2 - then - echo "skipping test, at least Apache version 2 is required" - exit - fi - - LIB_HTTPD_MODULE_PATH='/usr/lib/apache' - fi -else - error "Could not identify web server at '$LIB_HTTPD_PATH'" -fi - -HTTPD_PARA="-d $HTTPD_ROOT_PATH -f $HTTPD_ROOT_PATH/apache.conf" - -prepare_httpd() { - mkdir -p $HTTPD_DOCUMENT_ROOT_PATH - - ln -s $LIB_HTTPD_MODULE_PATH $HTTPD_ROOT_PATH/modules - - echo "PidFile httpd.pid" > $HTTPD_ROOT_PATH/apache.conf - echo "DocumentRoot www" >> $HTTPD_ROOT_PATH/apache.conf - echo "ErrorLog error.log" >> $HTTPD_ROOT_PATH/apache.conf - - HTTPD_URL=http://127.0.0.1:$LIB_HTTPD_PORT -} - -start_httpd() { - prepare_httpd - - "$LIB_HTTPD_PATH" $HTTPD_PARA \ - -c "Listen 127.0.0.1:$LIB_HTTPD_PORT" -k start -} - -stop_httpd() { - "$LIB_HTTPD_PATH" $HTTPD_PARA -k stop -} diff --git a/exporters/darcs/t/lib.sh b/exporters/darcs/t/lib.sh deleted file mode 100644 index 7d2218a..0000000 --- a/exporters/darcs/t/lib.sh +++ /dev/null @@ -1,337 +0,0 @@ -export DARCS_EMAIL="user@example.com" -export GIT_PAGER=cat -export PATH="$(pwd)/..:$PATH" -pypath="/$(python -c 'from distutils import sysconfig; print sysconfig.get_python_lib()[1:]')/" - -_drrec() -{ - darcs rec --ignore-times "$@" -} - -_drrec_multiline() -{ - echo -e "`LANG= LC_ALL= date +"%a %b %d %H:%M:%S %Z %Y"` -$DARCS_EMAIL -$@" | darcs rec --ignore-times -a --pipe . -} - -_drrecamend() -{ - echo y |darcs amend-rec --ignore-times -a -} - -create_darcs() -{ - rm -rf $1 - mkdir -p $1 - cd $1 - darcs init $2 - echo A > file - darcs add file - _drrec -a -m A - cd .. - rm -rf $1.tmp - darcs get $1 $1.tmp - cd $1 - echo B > file - _drrec -a -m B - cd ../$1.tmp - echo C > file - _drrec -a -m C - cd ../$1 - darcs pull -a ../$1.tmp - echo D > file - _drrec_multiline "first line -second line -third line" - darcs tag 1.0 - echo e > file - _drrec -a -m e - echo f > file - _drrec --author="éáõû <$DARCS_EMAIL>" -a -m f - echo g > file - _drrec --author="" -a -m g - cp ../data/hungarian.gif . - darcs add hungarian.gif - _drrec -a -m "add a binary file" - rm file - echo test > file2 - darcs add file2 - _drrec -a -m "replace file with file2" - touch file3 - darcs add file3 - _drrec -a -m "add empty file" - rm file3 - _drrec -a -m "remove file" - mkdir dir dir2 - darcs add dir - darcs add dir2 - _drrec -a -m "add empty dirs" - darcs mv dir dir-p - darcs mv dir2 dir2-p - _drrec -a -m "rename empty dirs" - echo a > a - echo b > b - darcs add a b - _drrec -a -m "add a b" - rm b - _drrec -a -m "remove and rename" - darcs mv a b - _drrecamend - echo c > c - darcs add c - # empty commit message - _drrec -a -m "" - cd .. -} - -create_bzr() -{ - rm -rf $1 - mkdir -p $1 - cd $1 - bzr init $2 - echo A > file - bzr add file - bzr commit -m A - cd .. - rm -rf $1.tmp - bzr branch $1 $1.tmp - cd $1 - echo B > file - bzr commit -m B - cd ../$1.tmp - echo C > file - bzr commit -m C - cd ../$1 - bzr merge ../$1.tmp - echo D > file - bzr resolve file - echo "first line -second line -third line" | bzr commit -F /dev/stdin - bzr tag 1.0 - echo e > file - bzr commit -m e - #echo f > file - #bzr commit --author="éáõû <$DARCS_EMAIL>" -m f - #echo g > file - #_drrec --author="" -a -m g - cp ../data/hungarian.gif . - bzr add hungarian.gif - bzr commit -m "add a binary file" - rm file - echo test > file2 - bzr add file2 - bzr commit -m "replace file with file2" - touch file3 - bzr add file3 - bzr commit -m "add empty file" - rm file3 - bzr commit -m "remove file" - cd .. -} - -create_hg() -{ - rm -rf $1 - mkdir -p $1 - cd $1 - hg init $2 - echo A > file - hg add file - hg commit -m A - cd .. - rm -rf $1.tmp - hg clone $1 $1.tmp - cd $1 - echo B > file - hg commit -m B - cd ../$1.tmp - echo C > file - hg commit -m C - cd ../$1 - hg pull ../$1.tmp - hg merge - echo D > file - hg resolve -m file - echo "first line -second line -third line" | hg commit -l /dev/stdin - hg tag 1.0 - echo e > file - hg commit -m e - #echo f > file - #bzr commit --author="éáõû <$DARCS_EMAIL>" -m f - #echo g > file - #_drrec --author="" -a -m g - cp ../data/hungarian.gif . - hg add hungarian.gif - hg commit -m "add a binary file" - hg rm file - echo test > file2 - hg add file2 - hg commit -m "replace file with file2" - touch file3 - hg add file3 - hg commit -m "add empty file" - hg rm file3 - hg commit -m "remove file" - mkdir subdir - echo test > subdir/file - hg add subdir/file - hg commit -m "add subdir file" - echo test2 > subdir/file - hg commit -m "commit with weird date" -d "Fri Apr 03 12:38:26 2009 +1300" - cd .. -} -create_git() -{ - rm -rf $1 - mkdir -p $1 - cd $1 - git init $2 - git commit --allow-empty -m 'root commit' - echo A > file - git add file - git commit -a -m A - echo B > file - git commit -a -m B - git checkout -b tmp HEAD~1 - echo C > file - git commit -a -m C - git checkout master - git merge tmp - echo D > file - echo "first line -second line -third line" | git commit -a -F - - git branch -d tmp - git tag 1.0 - echo e > file - git commit -a -m e - echo f > file - git config i18n.commitencoding ISO-8859-2 - git commit --author="éáõû <$DARCS_EMAIL>" -a -m f - cp ../data/hungarian.gif . - git add hungarian.gif - git commit -a -m "add a binary file" - rm file - echo test > file2 - git add file2 - git commit -a -m "replace file with file2" - touch file3 - git add file3 - git commit -a -m "add empty file" - rm file3 - git commit -a -m "remove file" - # now add back 'file' with its old conents, so the mark gets - # reused - echo f > file - git add file - git commit -a -m "file: other -> f" - # this is a boring file for Darcs - touch foo.pyc - git add foo.pyc - git commit -a -m "boring file" - # replace an uppercase file to a lowercase one - echo SPAM > SPAM - git add SPAM - git commit -a -m SPAM - rm SPAM - echo spam > spam - git add spam - git commit -a -m "SPAM -> spam" - cd .. -} - -diff_git() -{ - rm -rf $1.git.nonbare - git clone -q $1.git $1.git.nonbare - diff --exclude _darcs --exclude .git --exclude '*-darcs-backup*' -Nur $1.git.nonbare $1 - return $? -} - -diff_importgit() -{ - test -z "`(cd $1.darcs; darcs diff)`" && - diff --exclude _darcs --exclude .git --exclude '*-darcs-backup*' -Nur $1 $1.darcs - return $? -} - -diff_importhg() -{ - cd $1.darcs && test -z "`darcs diff 2>&1`" && cd .. && - diff --exclude _darcs --exclude .hg --exclude '*-darcs-backup*' --exclude 'hg-export.*' \ - --exclude '.hgtags' --exclude '*.orig' -Nur $1 $1.darcs - return $? -} - -diff_importdarcs() -{ - cd $1.importdarcs && test -z "`darcs diff 2>&1`" && cd .. && - diff --exclude _darcs --exclude '*-darcs-backup*' -Nur $1 $2 - return $? -} - -diff_importbzr() -{ - cd $1.darcs && test -z "`darcs diff 2>&1`" && cd .. && - diff --exclude _darcs --exclude .bzr --exclude '*-darcs-backup*' -Nur $1 $1.darcs - return $? -} - -diff_bzr() -{ - cd $1.bzr/trunk - bzr update - cd - >/dev/null - diff --exclude _darcs --exclude .bzr --exclude '*-darcs-backup*' -Nur $1.bzr/trunk $1 - return $? -} - -diff_hg() -{ - hg -R $1.hg update - diff --exclude _darcs --exclude .hg --exclude '*-darcs-backup*' -Nur $1.hg $1 - return $? -} - -die() -{ - echo "fatal: $@" - exit 1 -} - -upd_file_darcs() -{ - cd $1 - echo $3 > $2 - _drrec -a -m "updated '$2' to '$3'" - cd .. -} - -upd_file_git() -{ - cd $1 - echo $3 > $2 - git commit -a -m "updated '$2' to '$3'" - cd .. -} - -upd_file_bzr() -{ - cd $1 - echo $3 > $2 - bzr commit -m "updated '$2' to '$3'" - cd .. -} - -upd_file_hg() -{ - cd $1 - echo $3 > $2 - hg commit -m "updated '$2' to '$3'" - cd .. -} diff --git a/exporters/darcs/t/test-bzr.sh b/exporters/darcs/t/test-bzr.sh deleted file mode 100644 index 479f259..0000000 --- a/exporters/darcs/t/test-bzr.sh +++ /dev/null @@ -1,16 +0,0 @@ -. ./lib.sh - -create_darcs test --old-fashioned-inventory - -rm -rf test.darcs test.bzr -mkdir test.bzr -cd test.bzr -bzr init-repo . -cd .. -if [ "$1" != "--stdout" ]; then - darcs-fast-export test |(cd test.bzr; bzr fast-import -) - diff_bzr test - exit $? -else - darcs-fast-export test -fi diff --git a/exporters/darcs/t/test-git-d2x.sh b/exporters/darcs/t/test-git-d2x.sh deleted file mode 100644 index 364edec..0000000 --- a/exporters/darcs/t/test-git-d2x.sh +++ /dev/null @@ -1,19 +0,0 @@ -. ./lib.sh - -create_darcs test --old-fashioned-inventory - -rm -rf test.git -if [ "$1" != "--stdout" ]; then - d2x -f git test - diff_git test || die "initial conversion differs" - upd_file_darcs test file2 upd_contents - d2x -f git test - diff_git test || die "update differs" - upd_file_darcs test hungarian.gif "binary to text" - d2x -f git test - diff_git test || die "update2 differs" - d2x -f git test - diff_git test || die "update3 (noop) differs" -else - darcs-fast-export test -fi diff --git a/exporters/darcs/t/test-git-incremental.sh b/exporters/darcs/t/test-git-incremental.sh deleted file mode 100644 index 1c62b9a..0000000 --- a/exporters/darcs/t/test-git-incremental.sh +++ /dev/null @@ -1,24 +0,0 @@ -. ./lib.sh - -create_darcs test --old-fashioned-inventory - -rm -rf test.darcs test.git -mkdir test.git -cd test.git -git --bare init -cd .. -if [ "$1" != "--stdout" ]; then - dmark="$(pwd)/test.dfe-marks" - gmark="$(pwd)/test.gfi-marks" - rm -f $mark $gmark - darcs-fast-export --export-marks=$dmark test |(cd test.git; git fast-import --export-marks=$gmark) - diff_git test || die "initial conversion differs" - upd_file_darcs test file2 upd_contents - darcs-fast-export --export-marks=$dmark --import-marks=$dmark test |(cd test.git; git fast-import --export-marks=$gmark --import-marks=$gmark) - diff_git test || die "update differs" - upd_file_darcs test hungarian.gif "binary to text" - darcs-fast-export --export-marks=$dmark --import-marks=$dmark test |(cd test.git; git fast-import --export-marks=$gmark --import-marks=$gmark) - diff_git test || die "update2 differs" -else - darcs-fast-export test -fi diff --git a/exporters/darcs/t/test-git-progress.sh b/exporters/darcs/t/test-git-progress.sh deleted file mode 100644 index 6586e80..0000000 --- a/exporters/darcs/t/test-git-progress.sh +++ /dev/null @@ -1,18 +0,0 @@ -. ./lib.sh - -create_darcs test --old-fashioned-inventory - -rm -rf test.darcs test.git -mkdir test.git -cd test.git -git --bare init -cd .. -if [ "$1" != "--stdout" ]; then - darcs-fast-export --progres 2 test |(cd test.git; git fast-import) - if [ $? = 0 ]; then - diff_git test - exit $? - fi -else - darcs-fast-export test -fi diff --git a/exporters/darcs/t/test-git.sh b/exporters/darcs/t/test-git.sh deleted file mode 100644 index de504ee..0000000 --- a/exporters/darcs/t/test-git.sh +++ /dev/null @@ -1,18 +0,0 @@ -. ./lib.sh - -create_darcs test --old-fashioned-inventory - -rm -rf test.darcs test.git -mkdir test.git -cd test.git -git --bare init -cd .. -if [ "$1" != "--stdout" ]; then - darcs-fast-export test |(cd test.git; git fast-import) - if [ $? = 0 ]; then - diff_git test - exit $? - fi -else - darcs-fast-export test -fi diff --git a/exporters/darcs/t/test-hg-d2x.sh b/exporters/darcs/t/test-hg-d2x.sh deleted file mode 100644 index bc83385..0000000 --- a/exporters/darcs/t/test-hg-d2x.sh +++ /dev/null @@ -1,12 +0,0 @@ -. ./lib.sh - -create_darcs test --old-fashioned-inventory - -rm -rf test.hg -if [ "$1" != "--stdout" ]; then - d2x -f hg test - diff_hg test - exit $? -else - darcs-fast-export test -fi diff --git a/exporters/darcs/t/test-hg.sh b/exporters/darcs/t/test-hg.sh deleted file mode 100644 index 95bfc4b..0000000 --- a/exporters/darcs/t/test-hg.sh +++ /dev/null @@ -1,16 +0,0 @@ -. ./lib.sh - -create_darcs test --old-fashioned-inventory - -rm -rf test.darcs test.hg -mkdir test.hg -cd test.hg -hg init -cd .. -if [ "$1" != "--stdout" ]; then - darcs-fast-export test |(cd test.hg; hg fastimport -) - diff_hg test - exit $? -else - darcs-fast-export test -fi diff --git a/exporters/darcs/t/test2-bzr-d2x.sh b/exporters/darcs/t/test2-bzr-d2x.sh deleted file mode 100644 index 13812eb..0000000 --- a/exporters/darcs/t/test2-bzr-d2x.sh +++ /dev/null @@ -1,19 +0,0 @@ -. ./lib.sh - -create_darcs test2 --darcs-2 - -rm -rf test2.bzr -if [ "$1" != "--stdout" ]; then - d2x -f bzr test2 - diff_bzr test2 || die "initial conversion differs" - upd_file_darcs test2 file2 upd_contents - d2x -f bzr test2 - diff_bzr test2 || die "update differs" - upd_file_darcs test2 hungarian.gif "binary to text" - d2x -f bzr test2 - diff_bzr test2 || die "update2 differs" - d2x -f bzr test2 - diff_bzr test2 || die "update3 (noop) differs" -else - darcs-fast-export test2 -fi diff --git a/exporters/darcs/t/test2-bzr-incremental.sh b/exporters/darcs/t/test2-bzr-incremental.sh deleted file mode 100644 index d464559..0000000 --- a/exporters/darcs/t/test2-bzr-incremental.sh +++ /dev/null @@ -1,21 +0,0 @@ -. ./lib.sh - -create_darcs test2 --darcs-2 - -rm -rf test2.darcs test2.bzr -mkdir test2.bzr -cd test2.bzr -bzr init-repo . -cd .. -if [ "$1" != "--stdout" ]; then - dmark="$(pwd)/test2.dfe-marks" - bmark="$(pwd)/test2.bfi-marks" - rm -f $mark $gmark - darcs-fast-export --export-marks=$dmark test2 |(cd test2.bzr; bzr fast-import --export-marks=$bmark -) - diff_bzr test2 || die "initial conversion differs" - upd_file_darcs test2 file2 upd_contents - darcs-fast-export --export-marks=$dmark --import-marks=$dmark test2 |(cd test2.bzr; bzr fast-import --export-marks=$bmark --import-marks=$bmark -) - diff_bzr test2 || die "update differs" -else - darcs-fast-export test2 -fi diff --git a/exporters/darcs/t/test2-git-funny-tagname.sh b/exporters/darcs/t/test2-git-funny-tagname.sh deleted file mode 100644 index 03eca66..0000000 --- a/exporters/darcs/t/test2-git-funny-tagname.sh +++ /dev/null @@ -1,25 +0,0 @@ -. ./lib.sh - -create_darcs test2 --darcs-2 -cd test2 -darcs tag "this :just (won't work; die)" -darcs tag "accent-tag-éáőű" -cd .. - -rm -rf test2.darcs test2.git -mkdir test2.git -cd test2.git -git --bare init -cd .. -if [ "$1" != "--stdout" ]; then - darcs-fast-export test2 |(cd test2.git; git fast-import) - ret=$? - if [ $ret = 0 ]; then - diff_git test2 - exit $? - else - exit $ret - fi -else - darcs-fast-export test2 -fi diff --git a/exporters/darcs/t/test2-git-http.sh b/exporters/darcs/t/test2-git-http.sh deleted file mode 100644 index 02549e4..0000000 --- a/exporters/darcs/t/test2-git-http.sh +++ /dev/null @@ -1,22 +0,0 @@ -. ./lib.sh -. ./lib-httpd.sh - -rm -rf test2.darcs test2.git httpd -create_darcs test2 --darcs-2 -mkdir -p $HTTPD_DOCUMENT_ROOT_PATH -mv -v test2 $HTTPD_DOCUMENT_ROOT_PATH -ln -s $HTTPD_DOCUMENT_ROOT_PATH/test2 . - -mkdir test2.git -cd test2.git -git --bare init -cd .. -start_httpd -darcs-fast-export $HTTPD_URL/test2 |(cd test2.git; git fast-import) -ret=$? -stop_httpd -if [ $ret != 0 ]; then - exit $ret -fi -diff_git test2 -exit $? diff --git a/exporters/darcs/t/test2-git-incremental-specworkdir.sh b/exporters/darcs/t/test2-git-incremental-specworkdir.sh deleted file mode 100644 index 83731f2..0000000 --- a/exporters/darcs/t/test2-git-incremental-specworkdir.sh +++ /dev/null @@ -1,22 +0,0 @@ -. ./lib.sh - -create_darcs test2 --darcs-2 - -rm -rf test2.darcs test2.git -mkdir test2.git -cd test2.git -git --bare init -mkdir darcs -cd .. -if [ "$1" != "--stdout" ]; then - dmark="$(pwd)/test2.git/darcs/test2.dfe-marks" - gmark="$(pwd)/test2.git/darcs/test2.gfi-marks" - rm -f $mark $gmark - darcs-fast-export --export-marks=$dmark test2 --working test2.git/darcs/repo |(cd test2.git; git fast-import --export-marks=$gmark) - diff_git test2 || die "initial conversion differs" - upd_file_darcs test2 file2 upd_contents - 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) - diff_git test2 || die "update differs" -else - darcs-fast-export test2 -fi diff --git a/exporters/darcs/t/test2-git-incremental.sh b/exporters/darcs/t/test2-git-incremental.sh deleted file mode 100644 index 41a3937..0000000 --- a/exporters/darcs/t/test2-git-incremental.sh +++ /dev/null @@ -1,21 +0,0 @@ -. ./lib.sh - -create_darcs test2 --darcs-2 - -rm -rf test2.darcs test2.git -mkdir test2.git -cd test2.git -git --bare init -cd .. -if [ "$1" != "--stdout" ]; then - dmark="$(pwd)/test2.dfe-marks" - gmark="$(pwd)/test2.gfi-marks" - rm -f $mark $gmark - darcs-fast-export --export-marks=$dmark test2 |(cd test2.git; git fast-import --export-marks=$gmark) - diff_git test2 || die "initial conversion differs" - upd_file_darcs test2 file2 upd_contents - darcs-fast-export --export-marks=$dmark --import-marks=$dmark test2 |(cd test2.git; git fast-import --export-marks=$gmark --import-marks=$gmark) - diff_git test2 || die "update differs" -else - darcs-fast-export test2 -fi diff --git a/exporters/darcs/t/test2-git.sh b/exporters/darcs/t/test2-git.sh deleted file mode 100644 index a8fc005..0000000 --- a/exporters/darcs/t/test2-git.sh +++ /dev/null @@ -1,18 +0,0 @@ -. ./lib.sh - -create_darcs test2 --darcs-2 - -rm -rf test2.darcs test2.git -mkdir test2.git -cd test2.git -git --bare init -cd .. -if [ "$1" != "--stdout" ]; then - darcs-fast-export test2 |(cd test2.git; git fast-import) - if [ $? = 0 ]; then - diff_git test2 - exit $? - fi -else - darcs-fast-export test2 -fi diff --git a/exporters/darcs/t/testimport-bzr-x2d.sh b/exporters/darcs/t/testimport-bzr-x2d.sh deleted file mode 100644 index ebe014b..0000000 --- a/exporters/darcs/t/testimport-bzr-x2d.sh +++ /dev/null @@ -1,15 +0,0 @@ -. ./lib.sh - -create_bzr test - -rm -rf test.darcs -x2d -f bzr test -diff_importbzr test || die "initial conversion differs" -upd_file_bzr test file2 upd_contents -x2d -f bzr test -diff_importbzr test || die "update differs" -upd_file_bzr test hungarian.gif "binary to text" -x2d -f bzr test -diff_importbzr test || die "update2 differs" -x2d -f bzr test -diff_importbzr test || die "update3 (noop) differs" diff --git a/exporters/darcs/t/testimport-bzr.sh b/exporters/darcs/t/testimport-bzr.sh deleted file mode 100644 index 358c5e5..0000000 --- a/exporters/darcs/t/testimport-bzr.sh +++ /dev/null @@ -1,15 +0,0 @@ -. ./lib.sh - -create_bzr test - -rm -rf test.darcs -mkdir test.darcs -cd test.darcs -darcs init -cd .. -(cd test; bzr fast-export .) | (cd test.darcs; darcs-fast-import) -if [ $? != 0 ]; then - exit 1 -fi -diff_importbzr test -exit $? diff --git a/exporters/darcs/t/testimport-copy.sh b/exporters/darcs/t/testimport-copy.sh deleted file mode 100644 index 109d87e..0000000 --- a/exporters/darcs/t/testimport-copy.sh +++ /dev/null @@ -1,26 +0,0 @@ -. ./lib.sh - -rm -rf test -mkdir test -cd test -git init -echo a > file -git add file -git commit -m a1 -cp file file2 -git add file2 -git commit -m b -cd .. - -rm -rf test.darcs -mkdir test.darcs -cd test.darcs -darcs init -cd .. -(cd test; git fast-export -C -C HEAD) > out -cat out | (cd test.darcs; darcs-fast-import) -if [ $? != 0 ]; then - exit 1 -fi -diff_importgit test -exit $? diff --git a/exporters/darcs/t/testimport-darcs.sh b/exporters/darcs/t/testimport-darcs.sh deleted file mode 100644 index 8b6d603..0000000 --- a/exporters/darcs/t/testimport-darcs.sh +++ /dev/null @@ -1,17 +0,0 @@ -. ./lib.sh - -create_darcs test2 --darcs-2 - -rm -rf test2.importdarcs test2.darcs -mkdir test2.importdarcs -cd test2.importdarcs -darcs init -cd .. - -darcs-fast-export test2 | (cd test2.importdarcs; darcs-fast-import) - -if [ $? != 0 ]; then - exit 1 -fi -diff_importdarcs test2 test2.importdarcs -exit $? diff --git a/exporters/darcs/t/testimport-deleteall.sh b/exporters/darcs/t/testimport-deleteall.sh deleted file mode 100644 index 11c5a83..0000000 --- a/exporters/darcs/t/testimport-deleteall.sh +++ /dev/null @@ -1,31 +0,0 @@ -. ./lib.sh - -rm -rf test -mkdir test -cd test -git init -echo a > file -git add file -echo A > file2 -git add file2 -git commit -m a12 -git rm file* -echo b>file3 -git add file3 -git commit -m b -cd .. - -rm -rf test.darcs -mkdir test.darcs -cd test.darcs -darcs init -cd .. -(cd test; git fast-export --progress=2 HEAD) > out -sed -i '/^D file$/d' out -sed -i 's/^D file2$/deleteall/' out -cat out | (cd test.darcs; darcs-fast-import) -if [ $? != 0 ]; then - exit 1 -fi -diff_importgit test -exit $? diff --git a/exporters/darcs/t/testimport-git-incremental.sh b/exporters/darcs/t/testimport-git-incremental.sh deleted file mode 100644 index 6c92880..0000000 --- a/exporters/darcs/t/testimport-git-incremental.sh +++ /dev/null @@ -1,16 +0,0 @@ -. ./lib.sh - -create_git test - -rm -rf test.darcs -mkdir test.darcs -cd test.darcs -darcs init -cd .. -gmark="$(pwd)/test.gfe-marks" -dmark="$(pwd)/test.dfi-marks" -(cd test; git fast-export --export-marks=$gmark HEAD) | (cd test.darcs; darcs-fast-import --export-marks=$dmark) -diff_importgit test || die "initial conversion differs" -upd_file_git test file2 upd_contents -(cd test; git fast-export --export-marks=$gmark --import-marks=$gmark HEAD) | (cd test.darcs; darcs-fast-import --export-marks=$dmark --import-marks=$dmark) -diff_importgit test || die "update differs" diff --git a/exporters/darcs/t/testimport-git-twoway-gd.sh b/exporters/darcs/t/testimport-git-twoway-gd.sh deleted file mode 100644 index 0e0c981..0000000 --- a/exporters/darcs/t/testimport-git-twoway-gd.sh +++ /dev/null @@ -1,34 +0,0 @@ -. ./lib.sh - -create_darcs test - -rm -rf test.git -mkdir test.git -cd test.git -git init -git darcs add upstream ../test -git darcs pull upstream -cd .. -diff_git test || die "initial fetch differs" -upd_file_darcs test file2 upd_contents -cd test.git -git darcs pull upstream -cd .. -diff_git test || die "fetch #1 differs" -upd_file_git test.git file2 upd_contents2 -cd test.git -git darcs push upstream -cd .. -diff_git test || die "push #1 difers" -upd_file_darcs test file2 upd_contents3 -upd_file_darcs test file2 upd_contents32 -cd test.git -git darcs pull upstream -cd .. -diff_git test || die "fetch #2 (multiple commits) differs" -upd_file_git test.git file2 upd_contents4 -upd_file_git test.git file2 upd_contents42 -cd test.git -git darcs push upstream -cd .. -diff_git test || die "push #2 (multiple commits) differs" diff --git a/exporters/darcs/t/testimport-git-twoway.sh b/exporters/darcs/t/testimport-git-twoway.sh deleted file mode 100644 index f9b515a..0000000 --- a/exporters/darcs/t/testimport-git-twoway.sh +++ /dev/null @@ -1,30 +0,0 @@ -. ./lib.sh - -create_git test - -rm -rf test.darcs -mkdir test.darcs -cd test.darcs -darcs init -cd .. -gmark="$(pwd)/test.gmarks" -dmark="$(pwd)/test.dmarks" - -(cd test; git fast-export --export-marks=$gmark HEAD) | (cd test.darcs; darcs-fast-import --export-marks=$dmark) -diff_importgit test || die "initial conversion differs" -upd_file_git test file2 upd_contents -(cd test; git fast-export --export-marks=$gmark --import-marks=$gmark HEAD) | (cd test.darcs; darcs-fast-import --export-marks=$dmark --import-marks=$dmark) -diff_importgit test || die "git -> darcs update #1 differs" -upd_file_darcs test.darcs file2 upd_contents2 -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) -(cd test; git checkout -f) -diff_importgit test || die "darcs -> git update #2 differs" -upd_file_git test file2 upd_contents3 -upd_file_git test file2 upd_contents32 -(cd test; git fast-export --export-marks=$gmark --import-marks=$gmark HEAD) | (cd test.darcs; darcs-fast-import --export-marks=$dmark --import-marks=$dmark) -diff_importgit test || die "git -> darcs update #3 differs" -upd_file_darcs test.darcs file2 upd_contents4 -upd_file_darcs test.darcs file2 upd_contents42 -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) -(cd test; git checkout -f) -diff_importgit test || die "darcs -> git update #4 differs" diff --git a/exporters/darcs/t/testimport-git-x2d.sh b/exporters/darcs/t/testimport-git-x2d.sh deleted file mode 100644 index f3f02a7..0000000 --- a/exporters/darcs/t/testimport-git-x2d.sh +++ /dev/null @@ -1,15 +0,0 @@ -. ./lib.sh - -create_git test - -rm -rf test.darcs -x2d -f git test -diff_importgit test || die "initial conversion differs" -upd_file_git test file2 upd_contents -x2d -f git test -diff_importgit test || die "update differs" -upd_file_git test hungarian.gif "binary to text" -x2d -f git test -diff_importgit test || die "update2 differs" -x2d -f git test -diff_importgit test || die "update3 (noop) differs" diff --git a/exporters/darcs/t/testimport-git.sh b/exporters/darcs/t/testimport-git.sh deleted file mode 100644 index 2e64e62..0000000 --- a/exporters/darcs/t/testimport-git.sh +++ /dev/null @@ -1,15 +0,0 @@ -. ./lib.sh - -create_git test - -rm -rf test.darcs -mkdir test.darcs -cd test.darcs -darcs init -cd .. -(cd test; git fast-export --progress=2 HEAD) | (cd test.darcs; darcs-fast-import) -if [ $? != 0 ]; then - exit 1 -fi -diff_importgit test -exit $? diff --git a/exporters/darcs/t/testimport-gitsymlink.sh b/exporters/darcs/t/testimport-gitsymlink.sh deleted file mode 100644 index 100c583..0000000 --- a/exporters/darcs/t/testimport-gitsymlink.sh +++ /dev/null @@ -1,45 +0,0 @@ -. ./lib.sh - -create_git test -cd test -# add two dirs with the some contents, then remove the second -# and make it a symlink to the first -mkdir dira -echo blabla > dira/file -echo blablabla > dira/file2 -mkdir dirb -touch dirb/file -touch dirb/file2 -git add dira dirb -git commit -a -m "add dira/dirb" -rm -rf dirb -ln -s dira dirb -git add dirb -git commit -a -m "change a dir to a symlink" -cd .. - -rm -rf test.darcs -mkdir test.darcs -cd test.darcs -darcs init -cd .. -(cd test; git fast-export --progress=2 HEAD) | (cd test.darcs; darcs-fast-import) -# we *do* want this to fail, but with error code 2. that means that we -# detected that symlinks are not supported and the user does not get a -# meaningless exception -if [ $? != 2 ]; then - exit 1 -fi - -# now try with the symhack option -rm -rf test.darcs -mkdir test.darcs -cd test.darcs -darcs init -cd .. -(cd test; git fast-export --progress=2 HEAD) | (cd test.darcs; darcs-fast-import --symhack) -if [ $? != 0 ]; then - exit 1 -fi -diff_importgit test -exit $? diff --git a/exporters/darcs/t/testimport-hg-x2d.sh b/exporters/darcs/t/testimport-hg-x2d.sh deleted file mode 100644 index a1d7d62..0000000 --- a/exporters/darcs/t/testimport-hg-x2d.sh +++ /dev/null @@ -1,15 +0,0 @@ -. ./lib.sh - -create_hg test - -rm -rf test.darcs -x2d -f hg test -diff_importhg test || die "initial conversion differs" -upd_file_hg test file2 upd_contents -x2d -f hg test -diff_importhg test || die "update differs" -upd_file_hg test hungarian.gif "binary to text" -x2d -f hg test -diff_importhg test || die "update2 differs" -x2d -f hg test -diff_importhg test || die "update3 (noop) differs" diff --git a/exporters/darcs/t/testimport-hg.sh b/exporters/darcs/t/testimport-hg.sh deleted file mode 100644 index 7f6d215..0000000 --- a/exporters/darcs/t/testimport-hg.sh +++ /dev/null @@ -1,15 +0,0 @@ -. ./lib.sh - -create_hg test - -rm -rf test.darcs -mkdir test.darcs -cd test.darcs -darcs init -cd .. -(cd test; $pypath/bzrlib/plugins/fastimport/exporters/hg-fast-export.py -r .) | (cd test.darcs; darcs-fast-import) -if [ $? != 0 ]; then - exit 1 -fi -diff_importhg test -exit $? diff --git a/exporters/darcs/t/testimport-rename.sh b/exporters/darcs/t/testimport-rename.sh deleted file mode 100644 index c6fa29f..0000000 --- a/exporters/darcs/t/testimport-rename.sh +++ /dev/null @@ -1,25 +0,0 @@ -. ./lib.sh - -rm -rf test -mkdir test -cd test -git init -echo a > file -git add file -git commit -m a1 -git mv file file2 -git commit -m b -cd .. - -rm -rf test.darcs -mkdir test.darcs -cd test.darcs -darcs init -cd .. -(cd test; git fast-export -M HEAD) > out -cat out | (cd test.darcs; darcs-fast-import) -if [ $? != 0 ]; then - exit 1 -fi -diff_importgit test -exit $? diff --git a/exporters/darcs/x2d b/exporters/darcs/x2d deleted file mode 100755 index ea4bdbd..0000000 --- a/exporters/darcs/x2d +++ /dev/null @@ -1,125 +0,0 @@ -#!/bin/sh -# -# x2d - convert git, bzr or hg repos to darcs using fast-export -# -# Copyright (c) 2008 by Miklos Vajna <vmiklos@frugalware.org> -# -# This program is free software; you can redistribute it and/or modify -# it under the terms of the GNU General Public License as published by -# the Free Software Foundation; either version 2 of the License, or -# (at your option) any later version. -# -# This program is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -# GNU General Public License for more details. -# -# You should have received a copy of the GNU General Public License -# along with this program. If not, see <http://www.gnu.org/licenses/>. -# - -usage() -{ - echo "Usage: x2d -f format repo" -} - -die() -{ - echo "$@" - usage - exit 1 -} - -check_up_to_date() -{ - upstreamnum=$(darcs show repo|grep 'Num Patches'|sed 's/.*: //') - if [ "$upstreamnum" = "$(cd $origin; eval $*)" ]; then - echo "No remote changes to pull!" - exit 0 - fi -} - -case $1 in - -h|--help) - usage - exit 0 - ;; - -f) - format="$2" - shift 2 - ;; -esac - -[ -n "$format" ] || die "Source format is not given!" - -case $format in - git|bzr|hg) - ;; - *) - die "The requested source format is not yet supported!" - ;; -esac - -common_opts="" -while [ -n "$2" ] -do - common_opts="$common_opts $1" - shift 1 -done -origin="$1" -shift 1 - -[ -d "$origin" ] || die "Source repo does not exist!" - -# convert to abspath -cd $origin -origin=$(pwd) - -dmark="$origin.darcs/_darcs/fast-import/dfe-marks" -fmark="$origin.darcs/_darcs/fast-import/ffi-marks" - -mkdir -p $origin.darcs -cd $origin.darcs - -common_opts="$common_opts --logfile $origin.darcs/_darcs/fast-import/log" -pypath="/$(python -c 'from distutils import sysconfig; print sysconfig.get_python_lib()[1:]')/" - -if [ ! -f $dmark ]; then - darcs init - mkdir -p _darcs/fast-import - case $format in - git) - (cd $origin; git fast-export --export-marks=$fmark HEAD) | \ - darcs-fast-import --export-marks=$dmark $common_opts - ;; - bzr) - (cd $origin; bzr fast-export \ - --export-marks=$fmark . ) | darcs-fast-import --export-marks=$dmark $common_opts - ;; - hg) - (cd $origin; $pypath/bzrlib/plugins/fastimport/exporters/hg-fast-export.py -r . ) | \ - darcs-fast-import --export-marks=$dmark $common_opts - esac -else - case $format in - git) - check_up_to_date "git rev-list HEAD |wc -l" - (cd $origin; git fast-export --export-marks=$fmark --import-marks=$fmark HEAD) | \ - darcs-fast-import --export-marks=$dmark --import-marks=$dmark $common_opts - ;; - bzr) - # bzr revno is not good here, because at merges - # it produces less revision than the number we - # have in darcs - check_up_to_date "bzr log --include-merges |grep -c revno:" - (cd $origin; bzr fast-export \ - --export-marks=$fmark --import-marks=$fmark . ) | \ - darcs-fast-import --export-marks=$dmark --import-marks=$dmark $common_opts - ;; - hg) - check_up_to_date 'echo $(($(hg tip --template "{rev}")+1))' - (cd $origin; $pypath/bzrlib/plugins/fastimport/exporters/hg-fast-export.py -r . ) | \ - darcs-fast-import --export-marks=$dmark --import-marks=$dmark $common_opts - ;; - esac -fi diff --git a/exporters/darcs/x2d.txt b/exporters/darcs/x2d.txt deleted file mode 100644 index 25ed6bb..0000000 --- a/exporters/darcs/x2d.txt +++ /dev/null @@ -1,28 +0,0 @@ -= x2d(1) - -== NAME - -x2d - convert git, bzr or hg repos to a darcs one using fast-export - -== SYNOPSIS - -x2d -f <format> [<importoptions>] <otherrepo> - -== DESCRIPTION - -x2d is a wrapper script that just automates doing an initial or -continuing an incremental conversion. All it does is initializing the -target darcs repo, starting darcs-fast-import and the relevant exporter -with the proper switches and pipe the importer's output to the -importer's standard input. - -== OPTIONS - ---help:: - Display usage. - --f <format>:: - Specify the format of the source repo. Currently supported sources are - git, bzr and hg. Incremental conversion is supported for all of them. - -The rest of the options is directly passed to darcs-fast-import. |