Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Make Repository a context manager, use decorators for wrapping withs #830

Merged
merged 1 commit into from
Apr 3, 2016

Conversation

enkore
Copy link
Contributor

@enkore enkore commented Apr 3, 2016

Backported from #777 to 1.0-maint

(Remote)Repository.close() is not a public API anymore, but a private
API. It shall not be used from within other classes than Repository
or it's tests. The proper way is to use a context manager now. However,
for RPC/Remote compatibility with Borg 1.0 it is kept and unchanged.

Repositories are not opened by __init__ now anymore, it is done
by binding it to a context manager. (This SHOULD be compatible both ways
with remote, since opening the repo is handled by a RepositoryServer method)

Decorators @with_repository() and @with_archive simplify
context manager handling and remove unnecessary indentation.

Backported to 1.0-maint
@codecov-io
Copy link

Current coverage is 82.89%

Merging #830 into 1.0-maint will increase coverage by +0.19% as of 6f2c6ca

@@            1.0-maint    #830   diff @@
=========================================
  Files              14      14       
  Stmts            4100    4105     +5
  Branches          714     722     +8
  Methods             0       0       
=========================================
+ Hit              3391    3403    +12
  Partial           206     206       
+ Missed            503     496     -7

Review entire Coverage Diff as of 6f2c6ca


Uncovered Suggestions

  1. +0.37% via borg/helpers.py#848...862
  2. +0.30% via borg/upgrader.py#316...327
  3. +0.27% via borg/archiver.py#618...628
  4. See 7 more...

Powered by Codecov. Updated on successful CI builds.

@ThomasWaldmann ThomasWaldmann merged commit fc10ac0 into borgbackup:1.0-maint Apr 3, 2016
@ThomasWaldmann ThomasWaldmann added this to the 1.0.1 - fixes milestone Apr 3, 2016
@enkore enkore deleted the feature/1.0ctxmng branch April 3, 2016 15:37
@enkore enkore mentioned this pull request Apr 9, 2016
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants