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

Add --max-snapshots option #35

Merged
merged 14 commits into from
Mar 13, 2016
Merged

Add --max-snapshots option #35

merged 14 commits into from
Mar 13, 2016

Conversation

seanh
Copy link
Owner

@seanh seanh commented Feb 20, 2016

No description provided.

@seanh
Copy link
Owner Author

seanh commented Feb 20, 2016

@Lightjohn Thanks for your pull request, it works! I've done a few small fixes to it on this branch:

  • Fixed some tests that got broken
  • Fixed some bugs in handling exceptions (actually I think these were pre-existing bugs with nothing to do with your code, but I discovered them while testing your code)
  • Added a user-friendly message when --max-snapshots is too low
  • Some minor PEP8 and lint fixes: wrapping long lines, putting spaces around arithmetic operators
  • Renamed InconsistentArguments to InconsistentArgumentsError, I think it's conventional for exception class names to end in Error and it also matches the existing exception class names in snapshotter

There's a couple more things that I'd like to fix before merging this. I'll add comments to them inline in this pull request. Could you pull this branch into your branch, make these fixes, then push to your original branch?

I'd also like to add tests for the new --max-snapshots option, if you're not sure how to do that then I can write them.

@@ -378,6 +394,13 @@ def snapshot(source, dest, debug=False, min_snapshots=3, extra_args=None):
"""
date = _datetime()
user, host, snapshots_root = _parse_path(dest)
if max_snapshots > -1 and max_snapshots - min_snapshots < 0:
Copy link
Owner Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Could ...and max_snapshots - min_snapshots < 0 just be and max_snapshots < min_snapshots?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I was thinking about that but I think both ways are good, I can't see counter example at this point.

@Lightjohn
Copy link
Contributor

OK for me as it's cross version (that what not the case for sys.maxint). I add it and made some tests and it should be good.

@seanh
Copy link
Owner Author

seanh commented Feb 23, 2016

Hey John, I got really busy, I promise I'll get back to you on this when I can

@Lightjohn
Copy link
Contributor

No problem, take your times. I have the code and it's working so no
problems for me :)

Le 23/02/2016 12:46, Sean Hammond a écrit :

Hey John, I got really busy, I promise I'll get back to you on this
when I can


Reply to this email directly or view it on GitHub
#35 (comment).

seanh added a commit that referenced this pull request Mar 13, 2016
@seanh seanh merged commit 237e8ad into master Mar 13, 2016
@seanh seanh deleted the add-max-snapshots-option branch March 13, 2016 14:16
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.

2 participants