Coder Social home page Coder Social logo

Comments (7)

felipec avatar felipec commented on August 25, 2024

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

from git.

felipec avatar felipec commented on August 25, 2024

Ah, the second time I do it I get the same error you reported.

from git.

felipec avatar felipec commented on August 25, 2024

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')

from git.

ahktenzero avatar ahktenzero commented on August 25, 2024

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.

from git.

felipec avatar felipec commented on August 25, 2024

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')

from git.

ahktenzero avatar ahktenzero commented on August 25, 2024

Thanks, that's fixed it.

from git.

felipec avatar felipec commented on August 25, 2024

All right, I pushed the fix 1aea34a.

from git.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.