various questions regarding push to git

Asked by tarsius on 2011-03-08

I am trying out bzr-git using the bzr-git repository.

I can't push to a local git repository:

    $ git init /tmp/bzr-git_git
    $ bzr dpush /tmp/bzr-git_git
    bzr: ERROR: Not a branch: "/tmp/bzr-git_git/".

From what I have read here this is not actually possible. Or is there some way to rewrite the path so that bzr-git can *push to it without having to start a git server?

I can *push to github, but get an (apparently non-fatal) error:

    $ bzr dpush git+ssh://<email address hidden>/tarsius/atest.git
    bzr: ERROR: The file id "____init____.py" is not present in the tree <bzrlib.inventory.CHKInventory object at 0x27e2590>.

from https://bugs.launchpad.net/bzr-git/+bug/719238
>push is only supported when experimental mappings are enabled.

How do I do that. What bad things will happen if I do? Can I then push to a local git repository?

Assuming that there is some way to *push to a local git repository: can the bzr and git branch/repo share the working tree similar to hg-git?

Is there any documentation available - beyond "bzr-git is... get it from..."? ;)

Question information

Language:
English Edit question
Status:
Expired
For:
Bazaar Git Plugin Edit question
Assignee:
No assignee Edit question
Last query:
2011-03-09
Last reply:
2011-03-24
Jelmer Vernooij (jelmer) said : #1

On Tue, 2011-03-08 at 14:05 +0000, tarsius wrote:
> New question #148313 on Bazaar Git Plugin:
> https://answers.launchpad.net/bzr-git/+question/148313
>
> I am trying out bzr-git using the bzr-git repository.
>
> I can't push to a local git repository:
>
> $ git init /tmp/bzr-git_git
> $ bzr dpush /tmp/bzr-git_git
> bzr: ERROR: Not a branch: "/tmp/bzr-git_git/".
dpush doesn't create branches yet, it only updates existing branches
(unlike "bzr push"). Try something like this:
git init /tmp/bzr-git_git
bzr init /tmp/bzr-git_git
bzr dpush /tmp/bzr-git_git

I realize it's a bit weird. "git init" creates a repository, "bzr init"
creates a branch.

See also bug https://bugs.launchpad.net/bzr/+bug/731336

> >From what I have read here this is not actually possible. Or is there some way to rewrite the path so that bzr-git can *push to it without having to start a git server?
>
> I can *push to github, but get an (apparently non-fatal) error:
>
> $ bzr dpush git+ssh://<email address hidden>/tarsius/atest.git
> bzr: ERROR: The file id "____init____.py" is not present in the tree <bzrlib.inventory.CHKInventory object at 0x27e2590>.
>
> from https://bugs.launchpad.net/bzr-git/+bug/719238
> >push is only supported when experimental mappings are enabled.
> How do I do that. What bad things will happen if I do? Can I then push to a local git repository?
When using "bzr push" rather than "bzr dpush" you risk (and likely are
to) losing the bzr-specific metadata that is pushed by bzr-git. In other
words, "bzr pull" may give "Diverged branches" in the future when
pulling from a branch and your history (from the point where you started
using "bzr push") will look as though it has completely diverged.

> Assuming that there is some way to *push to a local git repository: can the bzr and git branch/repo share the working tree similar to hg-git?
No, we don't support anything like that although you can of course keep a bare git repository around with a copy of the branch, updated with dpush.

> Is there any documentation available - beyond "bzr-git is... get it from..."? ;)
There is "bzr help git". I'm not sure what else there is to document,
for most things the regular bzr documentation should be adequate.

Cheers,

Jelmer

tarsius (tarsius) said : #2

That doesn't work for me:

$ git init /tmp/bzr-git_git
Initialized empty Git repository in /tmp/bzr-git_git/.git/
$ bzr init /tmp/bzr-git_git
Created a standalone tree (format: 2a)
$ bzr dpush /tmp/bzr-git_git
bzr: ERROR: Not a branch: "/tmp/".

This is more than a bit weird. I want to push to the *git* repository in /tmp/bzr-git_git why do I have to create a bazaar branch their?! I am able to push to a git repository which does not contain a bazaar branch and no history. I tested with a git repository one github. So I know I can push to a git repository which has not been touched by bzr. So I really don't understand why I have initialize a *git* repository with *bzr*. Remotely I can't do that and it works. So the question remains "how do I push to a local *GIT* repository?

> In other words, "bzr pull" may give "Diverged branches" in the future when pulling from a branch and your history (from the point where you started using "bzr push") will look as though it has completely diverged.

Again I can't make any sense of this. I am pushing to a *git* repository how does *bzr* store additional information in a *git* repository on *github*? I quess you can sneak in such information using git-notes or something similar. Is this being done? Or is it being stored in the *git* commit message?

Wouldn't it make much more sense to store this kind of information in the *bzr* repository instead of the remote *git* repository which might be owned by someone else who does not appreciate if people push "additional metadata" which after all is not required by *git*?

>> Assuming that there is some way to *push to a local git repository: can the bzr and git branch/repo share the working tree similar to hg-git?
> No, we don't support anything like that although you can of course keep a bare git repository around with a copy of the branch, updated with dpush.

The instructions you provided at the top (thought they don't work) actually look like they are supposed to do exactly that.

Jelmer Vernooij (jelmer) said : #3

On Tue, 2011-03-08 at 16:22 +0000, tarsius wrote:
> Question #148313 on Bazaar Git Plugin changed:
> https://answers.launchpad.net/bzr-git/+question/148313
>
> Status: Answered => Open
>
> tarsius is still having a problem:
> That doesn't work for me:
>
> $ git init /tmp/bzr-git_git
> Initialized empty Git repository in /tmp/bzr-git_git/.git/
> $ bzr init /tmp/bzr-git_git
> Created a standalone tree (format: 2a)
> $ bzr dpush /tmp/bzr-git_git
> bzr: ERROR: Not a branch: "/tmp/".
>
> This is more than a bit weird. I want to push to the *git* repository in
> /tmp/bzr-git_git why do I have to create a bazaar branch their?!
"bzr init" creates /a/ branch, it doesn't have to be a Bazaar branch.

> I am
> able to push to a git repository which does not contain a bazaar branch
> and no history. I tested with a git repository one github. So I know I
> can push to a git repository which has not been touched by bzr. So I
> really don't understand why I have initialize a *git* repository with
> *bzr*. Remotely I can't do that and it works. So the question remains
> "how do I push to a local *GIT* repository?
Do you have bzr-git installed? "bzr plugins" should list it. What
version of bzr-git and Dulwich are you using?

When I run that sequence of commands here:
charis:~/tmp% git init /tmp/bzr-git_git
Initialized empty Git repository in /tmp/bzr-git_git/.git/
charis:~/tmp% bzr init /tmp/bzr-git_git
Created a standalone tree (format: git)
charis:~/tmp% bzr dpush /tmp/bzr-git_git
Pushed up to revision
4.

> > In other words, "bzr pull" may give "Diverged branches" in the future
> when pulling from a branch and your history (from the point where you
> started using "bzr push") will look as though it has completely
> diverged.
>
> Again I can't make any sense of this. I am pushing to a *git* repository
> how does *bzr* store additional information in a *git* repository on
> *github*? I quess you can sneak in such information using git-notes or
> something similar. Is this being done? Or is it being stored in the
> *git* commit message?
Yes, that's what "bzr push" does. Older versions of bzr-git store that
information in git commit messages, newer versions will store it in notes.

"bzr dpush" doesn't store any of this additional data.

> Wouldn't it make much more sense to store this kind of information in
> the *bzr* repository instead of the remote *git* repository which might
> be owned by someone else who does not appreciate if people push
> "additional metadata" which after all is not required by *git*?
If you don't want that additional data, use "bzr dpush". That's exactly
what it's for.

> >> Assuming that there is some way to *push to a local git repository: can the bzr and git branch/repo share the working tree similar to hg-git?
> > No, we don't support anything like that although you can of course keep a bare git repository around with a copy of the branch, updated with dpush

tarsius (tarsius) said : #4

I am using bzr-git-0.5.4 with dulwich-0.7.0

`bzr init' does not create a tree with in git format.
so I tried `bzr init --format=git'

    $ git init bzr-git_git
    Initialized empty Git repository in /tmp/bh/bzr-git_git/.git/
    $ bzr init --format=git bzr-git_git
    bzr: ERROR: Already a branch: "bzr-git_git".

which failed. But without running `git init' first it does work.

    $ rm bzr-git_git -rf
    $ bzr init --format=git bzr-git_git
    Created a standalone tree (format: git)

However `bzr dpush' still shows an error while successfully pushing to git.

    $ bzr dpush ../bzr-git_git
    bzr: ERROR: The file id "____init____.py" is not present in the tree <bzrlib.inventory.CHKInventory object at 0x6f9da10>.

Thanks for you help!

Launchpad Janitor (janitor) said : #5

This question was expired because it remained in the 'Open' state without activity for the last 15 days.

ybdjkfd (ybdjkfd) said : #6

The following worked for me directly in Ubuntu 12.10:

  $ mkdir website.git
  $ cd website.git
  $ bzr init --format=git

  $ cd ../bazaar-website/
  $ bzr dpush ../website.git

Using bzr log in the Bazaar repo and git log in the Git repo produced the equivalent output for each DVCS.

Jelmer Vernooij (jelmer) said : #7

On Wed, 1 May, 2013 at 11:16 PM, ybdjkfd
<email address hidden> wrote:
> Question #148313 on Bazaar Git Plugin changed:
> https://answers.launchpad.net/bzr-git/+question/148313
>
> ybdjkfd posted a new comment:
> The following worked for me directly in Ubuntu 12.10:
>
> $ mkdir website.git
> $ cd website.git
> $ bzr init --format=git
>
> $ cd ../bazaar-website/
> $ bzr dpush ../website.git
>
> Using bzr log in the Bazaar repo and git log in the Git repo produced
> the equivalent output for each DVCS.
>
That doesn't say much. The revision ids and other metadata are not
visible in log output.

The point is that if you run "bzr branch website.git bazaar-website-2"
that the contents in bazaar-website and bazaar-website-2 have diverged
if you originally pushed from bzr to git with dpush.

ybdjkfd (ybdjkfd) said : #8

I see the issue of branching and divergence, but help me understand about revision ids and metadata comparison between the two logs. They both contain the git commit SHA-1 checksum, and following the steps you did to branch from even the git dpush, I got the original revision numbers back. They seem very much the same to me:

------>
  $ git log (from website.git which was created using the steps previously noted in #6)
commit 7f9175d3bc1dd4bdeb0a5bb1529b4e8ff95c7233
Author: Me <email address hidden>
Date: Thu Mar 14 17:23:30 2013 -0700

   some-file.txt some commit message about it.

commit ebc1ce20aa993a5caa335a49e3212942bec4dab7
Author: Me <email address hidden>
Date: Thu Mar 14 17:15:44 2013 -0700

    Backup update. See diff.

------>
  $ bzr log (in the original bazaar-website)

------------------------------------------------------------
revno: 128
git commit: 7f9175d3bc1dd4bdeb0a5bb1529b4e8ff95c7233
committer: Me <email address hidden>
timestamp: Thu 2013-03-14 17:23:30 -0700
message:
   some-file.txt some commit message about it.
------------------------------------------------------------
revno: 127
git commit: ebc1ce20aa993a5caa335a49e3212942bec4dab7
committer: Me <email address hidden>
timestamp: Thu 2013-03-14 17:15:44 -0700
message:
  Backup update. See diff.

----->
  $ cd website.git
  $ bzr branch ./ ../website.bzr # Now a new branch from the git area
  $ cd ../website.bzr
  $ bzr log

------------------------------------------------------------
revno: 128
git commit: 7f9175d3bc1dd4bdeb0a5bb1529b4e8ff95c7233
committer: Me <email address hidden>
timestamp: Thu 2013-03-14 17:23:30 -0700
message:
   some-file.txt some commit message about it.
------------------------------------------------------------
revno: 127
git commit: ebc1ce20aa993a5caa335a49e3212942bec4dab7
committer: Me <email address hidden>
timestamp: Thu 2013-03-14 17:15:44 -0700
message:
  Backup update. See diff.

Jelmer Vernooij (jelmer) said : #9

Note that "bzr dpush" changes the *local* bzr branch from which you push as well. If you don't want to have the local branch changed, specify --no-rebase to "bzr dpush".