Closed ahktenzero closed 11 years ago
I'm investigating this issue, but in the latest code I'm getting a different error than what you reported in issue #35.
DEBUG: initializing
DEBUG: fetching remote 'origin' 'lp:~felipec/+junk/test'
Updating bzr branches
Cloning branch 'master'
Traceback (most recent call last):
File "/home/felipec/bin/git-remote-bzr", line 972, in <module>
sys.exit(main(sys.argv))
File "/home/felipec/bin/git-remote-bzr", line 952, in main
do_list(parser)
File "/home/felipec/bin/git-remote-bzr", line 771, in do_list
branch = get_remote_branch(master_branch)
File "/home/felipec/bin/git-remote-bzr", line 808, in get_remote_branch
branch = clone(branch_path, remote_branch)
File "/home/felipec/bin/git-remote-bzr", line 789, in clone
repo = bdir.find_repository()
File "/usr/lib/python2.7/site-packages/bzrlib/bzrdir.py", line 574, in find_repository
raise errors.NoRepositoryPresent(self)
bzrlib.errors.NoRepositoryPresent: No repository present: "file:///tmp/test-git/.git/bzr/origin/clone/master/"
fatal: Reading from helper 'git-remote-bzr' failed
Ah, the second time I do it I get the same error you reported.
This seems to do the trick:
--- a/contrib/remote-helpers/git-remote-bzr
+++ b/contrib/remote-helpers/git-remote-bzr
@@ -785,7 +785,10 @@ def do_list(parser):
print
def clone(path, remote_branch):
- bdir = bzrlib.bzrdir.BzrDir.create(path)
+ try:
+ bdir = bzrlib.bzrdir.BzrDir.create(path)
+ except bzrlib.errors.AlreadyControlDirError:
+ bdir = bzrlib.bzrdir.BzrDir.open(path)
repo = bdir.find_repository()
repo.fetch(remote_branch.repository)
return remote_branch.sprout(bdir, repository=repo)
@@ -860,6 +863,13 @@ def get_repo(url, alias):
clone_path = os.path.join(dirname, 'clone')
if not os.path.exists(clone_path):
os.mkdir(clone_path)
+ else:
+ # check and remove old organization
+ try:
+ bdir = bzrlib.bzrdir.BzrDir.open(clone_path)
+ bdir.destroy_repository()
+ except bzrlib.errors.NoRepositoryPresent:
+ pass
info('Updating bzr branches')
That diff fixes the problem with pulling in repos created with 1.8.2 but it seems to have broken pulling in the ones I cloned with the latest version, I get
DEBUG: initializing
DEBUG: fetching remote 'origin' 'http://code.bitlbee.org/bitlbee/'
Traceback (most recent call last):
File "/usr/lib/git-core/git-remote-bzr", line 982, in <module>
sys.exit(main(sys.argv))
File "/usr/lib/git-core/git-remote-bzr", line 952, in main
repo = get_repo(url, alias)
File "/usr/lib/git-core/git-remote-bzr", line 869, in get_repo
bdir = bzrlib.bzrdir.BzrDir.open(clone_path)
File "/usr/lib/python2.7/dist-packages/bzrlib/controldir.py", line 689, in open
_unsupported=_unsupported)
File "/usr/lib/python2.7/dist-packages/bzrlib/controldir.py", line 718, in open_from_transport
find_format, transport, redirected)
File "/usr/lib/python2.7/dist-packages/bzrlib/transport/__init__.py", line 1719, in do_catching_redirections
return action(transport)
File "/usr/lib/python2.7/dist-packages/bzrlib/controldir.py", line 706, in find_format
probers=probers)
File "/usr/lib/python2.7/dist-packages/bzrlib/controldir.py", line 1155, in find_format
raise errors.NotBranchError(path=transport.base)
bzrlib.errors.NotBranchError: Not a branch: "/home/ahktenzero/src/apps/bitlbee/.git/bzr/origin/clone/".
when I try to pull. If I remove the diff it works.
Right, then this in addition:
--- contrib/remote-helpers/git-remote-bzr 2013-05-13 19:19:07.308241475 -0500
+++ /home/felipec/bin/git-remote-bzr 2013-05-13 19:46:39.028285706 -0500
@@ -868,7 +868,7 @@
try:
bdir = bzrlib.bzrdir.BzrDir.open(clone_path)
bdir.destroy_repository()
- except bzrlib.errors.NoRepositoryPresent:
+ except (bzrlib.errors.NoRepositoryPresent, bzrlib.errors.NotBranchError):
pass
info('Updating bzr branches')
Thanks, that's fixed it.
All right, I pushed the fix 1aea34a.
I did a git bisect between 1.8.2 and HEAD, running git pull in a clone of the CEDET bzr repo. Results are below