Skip to content

Create a new remote bzr branch when it doesn't exist on push #8

@dequis

Description

@dequis

When pushing, if the remote bzr branch does not exist, this error appears:

$ git push bzr-dequis bzr-test
Traceback (most recent call last):
  File "/home/dx/bin/git-remote-bzr", line 981, in <module>
    sys.exit(main(sys.argv))
  File "/home/dx/bin/git-remote-bzr", line 967, in main
    do_export(parser)
  File "/home/dx/bin/git-remote-bzr", line 682, in do_export
    branch = get_remote_branch(name)
  File "/home/dx/bin/git-remote-bzr", line 787, in get_remote_branch
    remote_branch = bzrlib.branch.Branch.open(branches[name],
KeyError: 'bzr-test'
error: failed to push some refs to 'bzr::bzr+ssh://dequis.org/home/dx/web/bzr/bitlbee'

I tried patching it, my (failed) attempt is at dequis@7365028 - a bit hacky (getting url from sys.argv[2]) and doesn't really work, other than creating an empty branch that can't get pushed to, while never reporting any errors on "git push":

$ git push bzr-dequis bzr-test
To bzr::bzr+ssh://dequis.org/home/dx/web/bzr/bitlbee
   bf4be5b..bf4be5b  bzr-test -> bzr-test

That short commit hash is my current HEAD commit. It shows this exact same output every time, even if the remote doesn't exist or after running it twice in a row.

The bzr log output in the bzr-test directory in the remote repo is empty.

The bzr log output in .git/bzr/bzr-dequis/clone/bzr-test shows 1046 revisions, the last one being HEAD.

I have no idea what I'm doing.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions