Replacing old block with new one. #165

Merged
merged 1 commit into from Feb 24, 2014

Projects

None yet

2 participants

@swistak
Contributor
swistak commented Feb 17, 2014

When the old block with database schema is already present in file, but was moved around (eg. pushed to the bottom of documentation block), instead of rewriting the file, replace old schema info with new one in the same place.

@ctran ctran merged commit 54a99db into ctran:develop Feb 24, 2014

1 check failed

default The Travis CI build failed
Details
@ctran
Owner
ctran commented Feb 24, 2014

This seems to break an existing behavior. Can you take a look at the test result (first failure)?

https://travis-ci.org/ctran/annotate_models/builds/19500252

@swistak
Contributor
swistak commented Feb 24, 2014

Yea, just noticed it fails. I'll take a look in some free time, but from the quick glance, test fails becouse functionality changed. Not sure how to resolve it.

My change is that if the block moved in comments (my use case is to put schema info at the top of the class but at the end of comment block) it should be replaced in-place. The test checks if after changing settings location of Schema block moves from top-to-bottom, but it won't move since it's replaced in-place.

What do you think should be behaviour here? should old comments still be relaced in-place and new ones put on the bottom (once located comments do not move), or changing setting should move the comment block from top to bottom?

@ctran
Owner
ctran commented Feb 26, 2014

Your use case makes sense but I think most people would expect that it should honor the specified position. This reminds me of #119.

Maybe changing the setting should only move the block if "-p after --force" is specified?
This may already be an existing behavior.

@swistak
Contributor
swistak commented Feb 26, 2014

@ctran Seems sensible. I'll test it and adjust the test case and/or documentation.

@ctran
Owner
ctran commented Feb 26, 2014

I have a working version and will check it in soon.

@ctran ctran added bug feature and removed bug labels Feb 26, 2014
@ctran ctran added this to the 2.6.2 milestone Feb 26, 2014
@ctran ctran self-assigned this Feb 26, 2014
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment