From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Jonas Bernoulli Newsgroups: gmane.emacs.devel Subject: git-1.8.2 support pulling from and pushing to a bzr branch Date: Sat, 13 Apr 2013 22:02:06 +0200 Message-ID: <87vc7qurlt.fsf@bernoul.li> NNTP-Posting-Host: plane.gmane.org Mime-Version: 1.0 Content-Type: text/plain X-Trace: ger.gmane.org 1365883336 7660 80.91.229.3 (13 Apr 2013 20:02:16 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Sat, 13 Apr 2013 20:02:16 +0000 (UTC) To: "Emacs Developement List" Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Sat Apr 13 22:02:20 2013 Return-path: Envelope-to: ged-emacs-devel@m.gmane.org Original-Received: from lists.gnu.org ([208.118.235.17]) by plane.gmane.org with esmtp (Exim 4.69) (envelope-from ) id 1UR6eR-0005gl-HW for ged-emacs-devel@m.gmane.org; Sat, 13 Apr 2013 22:02:19 +0200 Original-Received: from localhost ([::1]:55636 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1UR6eR-0003YH-5w for ged-emacs-devel@m.gmane.org; Sat, 13 Apr 2013 16:02:19 -0400 Original-Received: from eggs.gnu.org ([208.118.235.92]:48027) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1UR6eL-0003Y4-Vo for emacs-devel@gnu.org; Sat, 13 Apr 2013 16:02:17 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1UR6eJ-0005cL-4f for emacs-devel@gnu.org; Sat, 13 Apr 2013 16:02:13 -0400 Original-Received: from mail-ea0-x22b.google.com ([2a00:1450:4013:c01::22b]:44723) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1UR6eI-0005cD-Qi for emacs-devel@gnu.org; Sat, 13 Apr 2013 16:02:11 -0400 Original-Received: by mail-ea0-f171.google.com with SMTP id b15so1646062eae.30 for ; Sat, 13 Apr 2013 13:02:09 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=x-received:sender:from:to:subject:user-agent:date:message-id :mime-version:content-type; bh=d3Pa6QTNu3HiqGjhgIXxd9GJ6sdEj+HqaO5Cp79AEdA=; b=rVzZ/PKffYhu54yYhFueuqJxXDMBQ4URRNDLYnVQEh7jhnIYPhjAuQybhTCBSVCA19 hq2VD2kAhbKPCwk6RkpK5FXlmgS3MsfERACx42pms5hwjFBonamxp2TetnhdFEQgPpk4 +kGb+AO2+JRGM1E6OlFioH+RgrtR81kxbAGt5WNOvtjmDr3U4/mHNBm7RSn0YCwfxT0M 2vFrRCzkWso76lzLx33bkO2ZzKer5/ZkNz8kJWYwbI15eXwNWGRT1UbJztqCa6lkHqge 2Tdj2jFza7Z0A5M0Q9tOs+W5LmrstMm3qhy4i1pQvZd0em/VE2E3r5vssZ659bfLZjYC Ql1A== X-Received: by 10.14.175.134 with SMTP id z6mr402601eel.15.1365883329822; Sat, 13 Apr 2013 13:02:09 -0700 (PDT) Original-Received: from lem (178-83-148-119.dynamic.hispeed.ch. [178.83.148.119]) by mx.google.com with ESMTPS id f47sm18030983eep.13.2013.04.13.13.02.08 (version=TLSv1.2 cipher=RC4-SHA bits=128/128); Sat, 13 Apr 2013 13:02:08 -0700 (PDT) User-agent: mu4e 0.9.9.5-dev6; emacs 24.3.1 X-detected-operating-system: by eggs.gnu.org: Error: Malformed IPv6 address (bad octet value). X-Received-From: 2a00:1450:4013:c01::22b X-BeenThere: emacs-devel@gnu.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: "Emacs development discussions." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Original-Sender: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Xref: news.gmane.org gmane.emacs.devel:158885 Archived-At: Hello List git-1.8.2, released in March, supports pulling from and pushing to bzr branches. This should make it possible to contribute to Emacs using git without ever having to touch bzr directly. Also read-only users won't be affected by the git mirrors lagging behind anymore - they can just pull themselves. I was able to clone the Emacs trunk in about an hour. Cloning the Cedet trunk also succeeded. The fast-{import,export} scripts used previously were no longer able to do so. There are two small problems: (1) Only bzr branches can be cloned, not complete repositories. So multiple remotes have to be added to track a complete repository. (2) When pushing to a bzr branch 'git push' always claims that a new branch is being created. And then there is a big problem: The commit hashes are not identical to those from fast-{export,import}. The problem is that bzr saves commit messages without a trailing newline while git saves them with a trailing newline; and neither bzr-fast-export nor git-fast-import take care of adding that missing newline. While it is _possible_ in git to create a commit message without a trailing newline using the plumbing command git-commit-tree, commits created with git-commit do end with a newline. A commit created in bzr using "the normal way" should result in a git commit that also looks like it was created in git "the normal way". Therefor when translating a commit from bzr to git the correct thing to do is to append a newline. I hope that despite this issue we can recreate the "official" git mirror using the new transparent importer. This will inconvenient users in the short term but I think it is better to get this over with now. Best regards, Jonas Ps: A little demo: $ bzr init /tmp/demo/bzr Created a standalone tree (format: 2a) $ cd /tmp/demo/bzr $ bzr commit --unchanged -m "from bzr" Committing to: /tmp/demo/bzr/ Committed revision 1. $ git clone bzr::file:///tmp/demo/bzr /tmp/demo/git Cloning into '/tmp/demo/git'... $ cd /tmp/demo/git $ git commit --allow-empty -m "from git" [master af354dd] from git $ git push origin master All changes applied successfully. To bzr::file:///tmp/demo/bzr * [new branch] master -> master $ cd - /tmp/demo/bzr $ bzr commit --unchanged -m "from bzr again" Committing to: /tmp/demo/bzr/ Committed revision 3. $ bzr log --line 3: Jonas Bernoulli 2013-04-13 from bzr again 2: Jonas Bernoulli 2013-04-13 from git 1: Jonas Bernoulli 2013-04-13 from bzr $ cd - /tmp/demo/git $ git pull From bzr::file:///tmp/demo/bzr af354dd..c8a556c master -> origin/master Updating af354dd..c8a556c Fast-forward $ git log --oneline c8a556c from bzr again af354dd from git 36d4ef4 from bzr Pps: And now the difference between the new and old importer: $ git init /tmp/demo/git_fast-import Initialized empty Git repository in /tmp/demo/git_fast-import/.git/ $ cd /tmp/demo/git_fast-import $ bzr fast-export ../bzr | git fast-import 21:56:37 Calculating the revisions to include ... 21:56:37 Starting export of 3 revisions ... 21:56:37 Exported 3 revisions in 0:00:00 git-fast-import statistics: $ git remote add git-remote-bzr ../git $ git fetch git-remote-bzr warning: no common commits remote: Counting objects: 4, done. remote: Compressing objects: 100% (3/3), done. remote: Total 4 (delta 2), reused 2 (delta 0) Unpacking objects: 100% (4/4), done. From ../git * [new branch] master -> git-remote-bzr/master $ git cat-file -p HEAD~2 tree 4b825dc642cb6eb9a060e54bf8d69288fbee4904 author Jonas Bernoulli 1365882997 +0200 committer Jonas Bernoulli 1365882997 +0200 from bzr% $ git cat-file -p HEAD~1 tree 4b825dc642cb6eb9a060e54bf8d69288fbee4904 parent 70f6af8a56ea7744de514d1e80b9a97ef75fc94b author Jonas Bernoulli 1365882997 +0200 committer Jonas Bernoulli 1365882997 +0200 from git $ git cat-file -p git-remote-bzr/master~2 tree 4b825dc642cb6eb9a060e54bf8d69288fbee4904 author Jonas Bernoulli 1365882997 +0200 committer Jonas Bernoulli 1365882997 +0200 from bzr $ git cat-file -p git-remote-bzr/master~1 tree 4b825dc642cb6eb9a060e54bf8d69288fbee4904 parent 36d4ef499813359d492162ed6a53d28cdfb9aa35 author Jonas Bernoulli 1365882997 +0200 committer Jonas Bernoulli 1365882997 +0200 from git $ git cat-file -p HEAD~2 > a $ git cat-file -p git-remote-bzr/master~2 > b $ diff -u a b --- a 2013-04-13 21:56:37.866995633 +0200 +++ b 2013-04-13 21:57:32.690996992 +0200 @@ -2,4 +2,4 @@ author Jonas Bernoulli 1365882997 +0200 committer Jonas Bernoulli 1365882997 +0200 -from bzr \ No newline at end of file +from bzr 1 $ git show HEAD~2 > a $ git show git-remote-bzr/master~2 > b $ diff -u a b --- a 2013-04-13 21:57:32.698996994 +0200 +++ b 2013-04-13 21:57:32.706996994 +0200 @@ -1,4 +1,4 @@ -commit 70f6af8a56ea7744de514d1e80b9a97ef75fc94b +commit 36d4ef499813359d492162ed6a53d28cdfb9aa35 Author: Jonas Bernoulli Date: Sat Apr 13 21:56:37 2013 +0200