diff options
author | Miklos Vajna <vmiklos@frugalware.org> | 2010-06-28 01:21:13 +0200 |
---|---|---|
committer | Miklos Vajna <vmiklos@frugalware.org> | 2010-06-28 01:21:13 +0200 |
commit | 6d3739e08b242fc28ab5a01f34be1897e7407f85 (patch) | |
tree | 9f1c8981b3bdd72fa14573d7026be196b390590b /exporters | |
parent | b62f2c999c49cd67eba1910ffb34d033fc464c23 (diff) | |
download | bzr-fastimport-6d3739e08b242fc28ab5a01f34be1897e7407f85.tar.gz |
darcs-fast-import: don't fail for first empty commit
Diffstat (limited to 'exporters')
-rw-r--r-- | exporters/darcs/TODO | 2 | ||||
-rwxr-xr-x | exporters/darcs/darcs-fast-import | 9 | ||||
-rw-r--r-- | exporters/darcs/t/lib.sh | 1 |
3 files changed, 12 insertions, 0 deletions
diff --git a/exporters/darcs/TODO b/exporters/darcs/TODO index 2f199d1..c6892c8 100644 --- a/exporters/darcs/TODO +++ b/exporters/darcs/TODO @@ -4,3 +4,5 @@ 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/darcs-fast-import b/exporters/darcs/darcs-fast-import index 75116a7..c50ab90 100755 --- a/exporters/darcs/darcs-fast-import +++ b/exporters/darcs/darcs-fast-import @@ -186,24 +186,29 @@ class Handler: 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] @@ -231,6 +236,7 @@ class Handler: adds.append(path) if path not in self.files: self.files.append(path) + change = True else: self.unread_line = True break @@ -238,6 +244,9 @@ class Handler: if not len(self.line): break + if not change: + # darcs does not support empty commits + return for i in adds: self.invoke_add(i) sock = subprocess.Popen(["darcs", "record", "--ignore-times", "-a", "--pipe"], stdin=subprocess.PIPE, stdout=subprocess.PIPE) diff --git a/exporters/darcs/t/lib.sh b/exporters/darcs/t/lib.sh index c0f30c2..095f9ef 100644 --- a/exporters/darcs/t/lib.sh +++ b/exporters/darcs/t/lib.sh @@ -191,6 +191,7 @@ create_git() 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 |