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 subdirectory option #193

Merged
merged 1 commit into from
May 27, 2020
Merged

Add subdirectory option #193

merged 1 commit into from
May 27, 2020

Conversation

pawamoy
Copy link
Contributor

@pawamoy pawamoy commented Apr 26, 2020

Well, this required less code than I thought! I guess I could add more tests, particularly when updating a project.

TODO:

  • docs
  • test when updating

Fixes #183

@pawamoy
Copy link
Contributor Author

pawamoy commented May 3, 2020

It would be great if you could review and merge #192 so I can rebase before adding documentation for this feature!

copier/cli.py Outdated Show resolved Hide resolved
Copy link
Member

@yajo yajo left a comment

Choose a reason for hiding this comment

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

One use case that worries me enough is the update-diff one.

I see you have a small test about it, but could you copy some test such as tests.test_updatediff.test_commit_hooks_respected and adapt it to test complexities introduced here? Some of them:

  1. Template in v1 doesn't have a _subdirectory; in v2 it moves all things into a subdir and adds that key to copier.yml. Some files change. Downstream project has evolved too. Does that work as expected?
  2. Template in v3 changes from one subdirectory to another. Some file evolves also. Subproject evolves separately. Subproject is updated. Does that work as expected?

Seeing the code, I guess the tests should just go OK as it is, but I want to make sure, as it's the flagship feature of Copier.

copier/cli.py Outdated Show resolved Hide resolved
tests/test_subdirectory.py Outdated Show resolved Hide resolved
@yajo
Copy link
Member

yajo commented May 7, 2020

This should be a WIP until #198 is fixed IMHO.

@pawamoy pawamoy mentioned this pull request May 11, 2020
8 tasks
@pawamoy
Copy link
Contributor Author

pawamoy commented May 18, 2020

  1. Template in v1 doesn't have a _subdirectory; in v2 it moves all things into a subdir and adds that key to copier.yml. Some files change. Downstream project has evolved too. Does that work as expected?
  2. Template in v3 changes from one subdirectory to another. Some file evolves also. Subproject evolves separately. Subproject is updated. Does that work as expected?

These are great remarks, thank you for having taken the time to think about this. I'll add tests to make sure what you listed is working as expected 🙂

@pawamoy
Copy link
Contributor Author

pawamoy commented May 19, 2020

I've added two big tests with comments 🙂 Let me know what you think!

Copy link
Member

@yajo yajo left a comment

Choose a reason for hiding this comment

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

Some comments. Looks good overall, thanks for your hard work!

README.md Outdated Show resolved Hide resolved
README.md Outdated Show resolved Hide resolved
tests/test_copy.py Outdated Show resolved Hide resolved
tests/test_subdirectory.py Show resolved Hide resolved
tests/test_subdirectory.py Show resolved Hide resolved
tests/test_subdirectory.py Show resolved Hide resolved
tests/test_subdirectory.py Show resolved Hide resolved
tests/test_subdirectory.py Show resolved Hide resolved
tests/test_subdirectory.py Outdated Show resolved Hide resolved
@yajo yajo self-assigned this May 20, 2020
Co-authored-by: Jairo Llopis <Yajo@users.noreply.github.com>
@pawamoy
Copy link
Contributor Author

pawamoy commented May 26, 2020

Hey @yajo, not sure if you were waiting for me to comment, but I implemented the changes you suggested 🙂

If you just couldn't find the time to review it, then please ignore this comment, there is absolutely nothing urgent here!

@yajo yajo added this to the v3.2.0 milestone May 27, 2020
@yajo yajo merged commit 2f087bd into copier-org:master May 27, 2020
@yajo
Copy link
Member

yajo commented May 27, 2020

Yes, I was waiting. Thanks for your contribution!

@pawamoy
Copy link
Contributor Author

pawamoy commented Jun 2, 2020

Would it be possible for you to release a new version with this feature @yajo? That would be great 🙂

@yajo
Copy link
Member

yajo commented Jun 3, 2020

Oh yes, I was hoping to have time to put more features, but I've been lacking time lately.

Let me release.

@micheelengronne
Copy link

micheelengronne commented Feb 5, 2021

The _subdirectory parameter does not seem to be respected when doing copier update.

I put it in my .copier-answers.yml but copier wants to remove it and fetch the repository root anyway.

Here is the top of my .copier-answers.yml file:

# Changes here will be overwritten by Copier
_commit: 95b5471
_src_path: ../../coppint
_subdirectory: main

I added manually the subdirectory line but it is not recognized.

@yajo
Copy link
Member

yajo commented Feb 5, 2021

@yajo
Copy link
Member

yajo commented Feb 6, 2021

Hi there @micheelengronne, according to your comments I guess that you're having some trouble understanding what this option does and how Copier updates your subprojects.

If you want, you can open up a new discussion explaining your use case so you can get better help from the community. This thread was finished long ago and is not the best place to get further support.

@micheelengronne
Copy link

Sorry @yajo Indeed, I read too fast that part of the doc. I altered my code accordingly and I will open a new issue with my ideas and a snippet.

@micheelengronne
Copy link

I will delete my previous comments. They are totally out of subject.

@pawamoy pawamoy deleted the feat-add-subdirectory-option branch April 2, 2024 10:43
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Use a subdirectory
3 participants