Do you need to close a branch? (if so how)

Michael Hudson michael.hudson at canonical.com
Thu Feb 26 05:48:12 GMT 2009


Nicholas Allen wrote:
> Hi,
> 
> In my bzr-email-notifier tool I do the following:
> 
> try:
>                     parent_location = branch.get_parent()
>             	
>                     if not parent_location is None:
>                         parent_branch = Branch.open(parent_location)
>                         branch.pull(parent_branch)
>                 except BzrError, e:
>                     print >>sys.stderr, \
>                             'Could not pull from parent for branch %s:
> %s' % (branch_emailer.path, e)
> 
> 
> Do I need to do something to close the parent branch after I am finished
> with it? I can't find a close method on Branch. I notice that after a
> while I run out of sockets on my server so I guess open is keeping a
> socket open even after the parent branch (which is remote) is no longer
> needed.
> 
> Any help greatly appreciated...

We had this problem with codebrowse (which access branches over HTTP)
and eventually arrived at the same solution as you.  I think there
should probably be a Transport.close() method.

Cheers,
mwh



More information about the bazaar mailing list