emacs-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

git-1.8.2 support pulling from and pushing to a bzr branch


From: Jonas Bernoulli
Subject: git-1.8.2 support pulling from and pushing to a bzr branch
Date: Sat, 13 Apr 2013 22:02:06 +0200
User-agent: mu4e 0.9.9.5-dev6; emacs 24.3.1

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



reply via email to

[Prev in Thread] Current Thread [Next in Thread]