all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
* git-1.8.2 support pulling from and pushing to a bzr branch
@ 2013-04-13 20:02 Jonas Bernoulli
  2013-04-13 22:22 ` John Wiegley
  0 siblings, 1 reply; 12+ messages in thread
From: Jonas Bernoulli @ 2013-04-13 20:02 UTC (permalink / raw)
  To: Emacs Developement List

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:
    <snip>
    $ 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 <jonas@bernoul.li> 1365882997 +0200
    committer Jonas Bernoulli <jonas@bernoul.li> 1365882997 +0200
    
    from bzr%
    $ git cat-file -p HEAD~1
    tree 4b825dc642cb6eb9a060e54bf8d69288fbee4904
    parent 70f6af8a56ea7744de514d1e80b9a97ef75fc94b
    author Jonas Bernoulli <jonas@bernoul.li> 1365882997 +0200
    committer Jonas Bernoulli <jonas@bernoul.li> 1365882997 +0200
    
    from git
    $ git cat-file -p git-remote-bzr/master~2
    tree 4b825dc642cb6eb9a060e54bf8d69288fbee4904
    author Jonas Bernoulli <jonas@bernoul.li> 1365882997 +0200
    committer Jonas Bernoulli <jonas@bernoul.li> 1365882997 +0200
    
    from bzr
    $ git cat-file -p git-remote-bzr/master~1
    tree 4b825dc642cb6eb9a060e54bf8d69288fbee4904
    parent 36d4ef499813359d492162ed6a53d28cdfb9aa35
    author Jonas Bernoulli <jonas@bernoul.li> 1365882997 +0200
    committer Jonas Bernoulli <jonas@bernoul.li> 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 <jonas@bernoul.li> 1365882997 +0200
     committer Jonas Bernoulli <jonas@bernoul.li> 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 <jonas@bernoul.li>
     Date:   Sat Apr 13 21:56:37 2013 +0200



^ permalink raw reply	[flat|nested] 12+ messages in thread

end of thread, other threads:[~2013-05-01  6:16 UTC | newest]

Thread overview: 12+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2013-04-13 20:02 git-1.8.2 support pulling from and pushing to a bzr branch Jonas Bernoulli
2013-04-13 22:22 ` John Wiegley
2013-04-15 15:42   ` Γιώργος Κεραμίδας
2013-04-15 19:06     ` David Engster
2013-04-16 16:30       ` Giorgos Keramidas
2013-04-16 17:18   ` Julien Danjou
2013-04-18 18:53     ` joakim
2013-04-18 18:57       ` David Engster
2013-04-19  5:55         ` joakim
2013-04-20 19:01           ` joakim
2013-04-30 10:24             ` joakim
2013-05-01  6:16               ` Felipe Contreras

Code repositories for project(s) associated with this external index

	https://git.savannah.gnu.org/cgit/emacs.git
	https://git.savannah.gnu.org/cgit/emacs/org-mode.git

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.