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

removing auto-commits from subversion and adding some docstrings #155

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

jvanasco
Copy link
Contributor

First off- this seems to work on subversion and git but DEFINITELY needs a review by others.

There is one broken element that I don't know how to address.

In blackbox_deregister_file https://github.com/jvanasco/blackbox/blob/9e232bd1a115824e3adb2348e330eed8e82890bd/bin/blackbox_deregister_file#L28

it is possible that line 28 vcs_remove "$encrypted_file" will fail under 2 circumstances because subversion wants a --force argument

  • scenario 1: blackbox has added the file to it's tracked files, and subversion has marked it for ADD, but has not committed yet.
  • scenario 2: the file was altered (ie, re-encrypted with a new key) before a deletion is requested

When that happens, the shell script exits with the subversion error message.

I don't know enough shell scripting to catch that and notify the user.

@TomOnTime
Copy link
Collaborator

Re: Line 28: Don't know subversion well enough to make a firm suggestion maybe one of these would work:

a. Have vcs_remove_svn always use --force. (seems unsafe)
b. Add a vcs_unregister function that is like vcs_remove but vcs_unregister_subversion adds --force
c. Have vcs_remove_svn run the code as normal but if there is an error, try again with --force. (seems odd to do it that way)

@jvanasco
Copy link
Contributor Author

using --force in an automated tool is generally not a good idea. aside from being slightly dangerous, you can end up creating a tree conflict which can be a pain to resolve.

I think the best approach would be to somehow catch the error and notify the user on how to handle this manually.

I'm terrible in bash, so I'll use Python to describe:

Right now this is the behavior:

remove_filename_from_cryptlist
vcs_remove "$encrypted_file"
# basically, we exit above on the failure
exit 1
vcs_notice "$unencrypted_file"

and I'd like to try and handle it like this:

try:
    remove_filename_from_cryptlist
    vcs_remove "$encrypted_file"
    vcs_notice "$unencrypted_file"
except vcs_remove_error:
    echo "there is a conflict. you must manually deregister as follows:"
    echo "instructions"
    exit 

is there any way in bash to catch an error like that?

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