IEEERobotics / bot

Robot code for 2014.
BSD 2-Clause "Simplified" License
17 stars 10 forks source link

Determine projects to extract #131

Open dfarrell07 opened 10 years ago

dfarrell07 commented 10 years ago

Quite a few parts of our codebase could be extracted and converted to stand-alone open source projects. They could then be consumed by future robots, or the community in general. We need to select projects to extract and figure out the best ways to do so.

dfarrell07 commented 10 years ago

Suggestions so far:

What else?

R00ney commented 10 years ago

Since these abstractions seem (to my untrained eye), to only leave pilot and some glue logic, it would probably be reasonable to have the "central" repo be named more simply as 2015 "Bot Name" controller, or some such.

dfarrell07 commented 10 years ago

it would probably be reasonable to have the "central" repo be named more simply as 2015 "Bot Name" controller, or some such.

What about bot for the current project, and then rename old projects to bot<year>. So, once we get setup with a new repo, it's called bot and this one is called bot2014.

Alternatively, we can come up with a better name for the codebase.

dfarrell07 commented 10 years ago

I'm going to try extracting a simple project first, to get a feel for how this should be done. Something like color_sensor.py. Thoughts on that new repo's structure:

README.md
LICENSE.txt
__init__.py
setup.py
config.yaml
color_sensor.py
lib/
--lib.py
tests/
--test_color_sensor.py
logs/

How should pybbb fit into all of this? It's a dependency of color_sensor.py. I guess I need to take a look at the details of setup.py, maybe use the install_requires key. Any info on this would be helpful, @napratin and @jschornick.

dfarrell07 commented 10 years ago

Mostly dumping this here as a note to myself. So far, this command seems to refactor history to create a repo for color_sensor.py:

[~/robot/bot]$ git filter-branch --index-filter "git rm --cached -qr -- . && git reset -q -- ./lib/lib.py ./lib/tests/test_lib.py ./README.md ./LICENSE.txt config.yaml hardware/color_sensor.py hardware/tests/color_sensor.py logs .gitignore __init__.py lib/__init__.py hardware/__init__.py hardware/tests/__init__.py pybbb setup.py simulator" 
Rewrite bcdd735dc501b4334eacdf23029ffe684f06db77 (1016/1016)
Ref 'refs/heads/master' was rewritten
[~/robot/bot]$ ls                                                                                    [master] 18:48:04
config.yaml  hardware  __init__.py  lib  LICENSE.txt  logs  pybbb  README.md  setup.py  simulator
dfarrell07 commented 10 years ago

Initial stab at a color sensor library.

Known issues:

git filter-branch --index-filter "git rm --cached -qr -- . && git reset -q -- ./lib/lib.py ./lib/tests/test_lib.py ./README.md ./LICENSE.txt config.yaml hardware/color_sensor.py hardware/tests/color_sensor.py logs .gitignore __init__.py lib/__init__.py hardware/__init__.py hardware/tests/__init__.py pybbb setup.py simulator .gitmodules"
git mv hardware/color_sensor.py .
git mv hardware/tests/ .
<lots of minor cleanup of unused code>
dfarrell07 commented 10 years ago

Shows 1016 commits, which is the right number for the full bot repo, but I expected ones that have nothing to do with the code in that repo to be nuked.

I fixed this by using commands of this type:

git filter-branch --force --index-filter 'git rm --cached -r --ignore-unmatch <files to remove>' --prune-empty --tag-name-filter cat -- --all

PyTCS3472 is now in reasonable shape. I need to revisit its install process, its README and the TODOs noted above.

dfarrell07 commented 10 years ago

For the sake of documentation, these two commands work well to extract a small number of files from a repo:

# I'm extracting lib, in this example
git filter-branch --subdirectory-filter lib --prune-empty -- --all        
git filter-branch --force --index-filter 'git rm --cached -r --ignore-unmatch messages.py' --prune-empty --tag-name-filter cat -- --all

Previous attempts left commits for which the relevant files no longer exist to be deleted.

R00ney commented 10 years ago

Wow. Can't even imagine the research necessary to put together commands with that many options attached. Nice work.