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

Use git-source-track to track updates to examples #89

Open
virtuald opened this issue Dec 6, 2023 · 9 comments
Open

Use git-source-track to track updates to examples #89

virtuald opened this issue Dec 6, 2023 · 9 comments

Comments

@virtuald
Copy link
Member

virtuald commented Dec 6, 2023

See https://robotpy.readthedocs.io/en/2019.1.2/dev/porting.html#using-git-source-track

@virtuald
Copy link
Member Author

@fletch3555 I think this would be a useful thing to do since you're reviewing existing examples

@fletch3555
Copy link
Contributor

Oh interesting. A very similar thought crossed my mind the other day, but I didn't realize this tool actually existed. Yeah, I'll take a look.

@fletch3555
Copy link
Contributor

@virtuald, when I run that command, it prepends that line to the file above the shebang. I can submit a PR to change the positioning, but where do we want it instead?

  1. immediately after the shebang?
  2. end of the file?
  3. somewhere else?

I'm partial to end of the file, but not hard-set on anything.

@virtuald
Copy link
Member Author

It can be any line in the file: https://github.com/virtuald/git-source-track/blob/master/git_source_track/cmd.py#L201, it just defaults to the first if there's no validation line.

Previously we did it at the beginning before the copyright line, which I think looks nice. https://github.com/robotpy/mostrobotpy/blob/aabdb769c211f87e74c351478f4778a9fd45df84/subprojects/robotpy-wpilib/wpilib/wpilib/adxl362.py#L1

I think end of file is fine too.

@fletch3555
Copy link
Contributor

fletch3555 commented Dec 22, 2023

Yeah, I'm thinking more the default place it'll create the line if it doesn't exist (which it won't for any of these examples until we start adding it). I'm hoping to avoid having to validate each file, manually move the line, then commit.

I also like it above the copywrite line, but it can't be above the shebang without breaking the ability to just run ./robot.py [args]. That said, none of the files are marked executable at the moment anyway, so I don't know how many people are doing that over python3 robot.py [args]. Perhaps the shebang isn't necessary at all?

Also, putting it in that header (shebang + copyright) breaks the automated header validation.

Either way, end of the file is super easy to implement in cmd.py and bypasses the problem entirely. If you're cool with that, I'll open the PR momentarily.

@virtuald
Copy link
Member Author

virtuald commented Dec 22, 2023

I personally always do ./robot.py :) Some of them used to be marked executable, maybe that broke with your rename?

I think end of file is probably fine for the examples.

@fletch3555
Copy link
Contributor

Some of them used to be marked executable, maybe that broke with your rename?

I only looked at one, so probably just missed it. I can commit them all (the robot.py at least) as executable while I'm at it if you'd like

@fletch3555
Copy link
Contributor

And 💥 goes the dynomite: virtuald/git-source-track#9

@virtuald
Copy link
Member Author

virtuald commented Dec 22, 2023

With git-source-track 0.4, you can use the following .gittrack file:

[git-source-track]
upstream_root = ../allwpilib/wpilibjExamples/src/main/java/edu/wpi/first/wpilibj/examples
upstream_branch = main
upstream_commit = xxx
validation_root = .
default_location = last

For older examples, I think it would make sense to make the upstream commit match 2023, add the annotations, then update allwpilib to 2024 and do the git source-track diff filename to see what changes have happened in the last year, and update any validations.

@virtuald virtuald removed this from 2024 Season Nov 3, 2024
@auscompgeek auscompgeek moved this to Backlog in 2025 Season Jan 1, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
Status: Backlog
Development

No branches or pull requests

2 participants