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

Fix initial commit implementation #534

Merged
merged 2 commits into from
Oct 3, 2022
Merged

Conversation

sbkok
Copy link
Collaborator

@sbkok sbkok commented Sep 26, 2022

There were two issues with the previous implementation:

  1. Fix detecting changes upon update properly

    Why?

    CodeCommit has a limit of 100 files per commit.

    To workaround this limit, the implementation walked across all the files
    and split it into chunks of 99 files. However, when one of those chunks would
    not have any changes, it would raise an exception that was handled at the
    incorrect level. Causing it to abort the creation of the PR all together.
    Even when there were changes in another chunk.

    What?

    Fixed handling the "no changes in this chunk" error at the chunk level.
    So it will only skip that chunk and continue with the next.

    Maintaining a list of commits that were created, and if any were, it will open
    the pull request.

    Additionally, the initial commit code had a lot of repetitive code.
    This got refactored as well.

    Since there are two initial_commit.py functions, the changes had to be applied
    twice.

  2. Add support for paginating differences in initial commit

    Why?

    Before, we were only matching against the first page of differences.
    This could result in files being deleted erroneously if the repository went
    through a large change such as an update that touches almost all files.

    What?

    Added support for paginating the differences and updated the tests to cover
    these.


By submitting this pull request, I confirm that you can use, modify, copy, and
redistribute this contribution, under the terms of your choice.

@sbkok sbkok added the bug Something isn't working label Sep 26, 2022
@sbkok sbkok added this to the v3.2.0 milestone Sep 26, 2022
**Why?**

CodeCommit has a limit of 100 files per commit.

To workaround this limit, the implementation walked across all the files
and split it into chunks of 99 files. However, when one of those chunks would
not have any changes, it would raise an exception that was handled at the
incorrect level. Causing it to abort the creation of the PR all together.
Even when there were changes in another chunk.

**What?**

Fixed handling the "no changes in this chunk" error at the chunk level.
So it will only skip that chunk and continue with the next.

Maintaining a list of commits that were created, and if any were, it will open
the pull request.

Additionally, the initial commit code had a lot of repetitive code.
This got refactored as well.

Since there are two initial_commit.py functions, the changes had to be applied
twice.
**Why?**

Before, we were only matching against the first page of differences.
This could result in files being deleted erroneously if the repository went
through a large change such as an update that touches almost all files.

**What?**

Added support for paginating the differences and updated the tests to cover
these.
@sbkok sbkok force-pushed the fix/initial-commit branch from e80495e to 8ecab67 Compare September 26, 2022 17:07
@StewartW StewartW merged commit fffe524 into awslabs:master Oct 3, 2022
@sbkok sbkok deleted the fix/initial-commit branch December 22, 2022 12:53
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants