Skip to content

Conversation

@alanag13
Copy link
Contributor

Implements the ability to use multiple checkpoints for a single profile.

This is a breaking change -- -i will no longer work, and has been replaced with -c (--use-checkpoint), which accepts a string name for the checkpoint.

clear-checkpoint will also no longer work since it now requires a checkpoint name to be passed to it.

Notes:

  • In the final refactoring, we want checkpoint clear <name> (rather than clear checkpoint <name> and checkpoint list commands. I did not implement those here since that work would be completely undone by the click refactor anyway, but their backends are in place (CursorStore.get_all_cursors has basically everything needed for that)

  • One issue that I'm aware of :because we keep this info on the file system now, it matters what you name your profile and/or checkpoint. For example if you name one ../../etc/password, we would end up trying to write to that file, which would be pretty bad, but I'm making a separate work item for that to be handled on its own.

@alanag13 alanag13 requested review from antazoey, kiran-chaudhary and timabrmsn and removed request for timabrmsn June 26, 2020 21:37
from code42cli.util import get_user_project_path


class Cursor(object):
Copy link
Contributor Author

Choose a reason for hiding this comment

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

This file contains the bulk of the change, most of the rest is formatting and renaming things / making the cli param pass a string instead of being a bool, etc

@alanag13
Copy link
Contributor Author

The amount of formatting changes in this PR tells me that stuff is getting committed without using black, so getting that wired in a check to happen with PRs will be good, otherwise it's going to result in them creating unneeded extra noise like this.

@@ -0,0 +1,175 @@
from os import path
Copy link
Contributor Author

@alanag13 alanag13 Jun 26, 2020

Choose a reason for hiding this comment

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

These are the new tests, the rest changed what the parameter name was and to support string vs bool, etc.

Copy link
Contributor

@timabrmsn timabrmsn left a comment

Choose a reason for hiding this comment

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

LGTM


@property
def value(self):
with (open(self._location)) as checkpoint:
Copy link
Contributor

Choose a reason for hiding this comment

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

Is there a reason for the parens around the open func? I've never seen that done before.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

nope, the reason you haven't seen it before is probably because it's totally unnecessary

@alanag13 alanag13 merged commit ba832b3 into master Jun 29, 2020
@antazoey antazoey deleted the feature/INTEG-1064-multi-checkpoint branch September 2, 2020 19:51
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.

3 participants