Skip to content

Commit

Permalink
Add helper commands for repository processing
Browse files Browse the repository at this point in the history
  • Loading branch information
asherikov committed Aug 10, 2024
1 parent ef2070e commit 74b3909
Show file tree
Hide file tree
Showing 4 changed files with 234 additions and 33 deletions.
13 changes: 13 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ test_type:
@${MAKE} wrap_test TEST=test_scrape
@${MAKE} wrap_test TEST=test_merge
@${MAKE} wrap_test TEST=test_set_version
@${MAKE} wrap_test TEST=test_branch

wrap_test:
@echo ""
Expand Down Expand Up @@ -63,6 +64,18 @@ test_set_version:
${WSHANDLER} -t ${TYPE} --root tests/update/ set_version_by_url https://github.com/asherikov/qpmad.git master
${WSHANDLER} -t ${TYPE} --root tests/update/ set_version_by_name qpmad_tag 1.3.0

test_branch:
${WSHANDLER} -t ${TYPE} --root tests/update/ clean
${WSHANDLER} -t ${TYPE} --root tests/update/ update
${WSHANDLER} -t ${TYPE} --root tests/update/ branch show
rm -Rf tests/update/staticoma_master/README.md
${WSHANDLER} -t ${TYPE} --root tests/update/ branch new as_remove_readme
env GIT_AUTHOR_NAME="Your Name" GIT_AUTHOR_EMAIL="you@example.com" GIT_COMMITTER_NAME="Your Name" GIT_COMMITTER_EMAIL="you@example.com" ${WSHANDLER} -t ${TYPE} --root tests/update/ commit "Remove README.md"
${WSHANDLER} -t ${TYPE} --root tests/update/ branch switch as_remove_readme
${WSHANDLER} -t ${TYPE} --root tests/update/ status
${WSHANDLER} -t ${TYPE} --root tests/update/ branch merge as_remove_readme master
${WSHANDLER} -t ${TYPE} --root tests/update/ set_version_by_name staticoma_master master

shellcheck:
shellcheck wshandler

Expand Down
38 changes: 25 additions & 13 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,19 +2,19 @@ Introduction
============

`wshandler` is a workspace management utility similar to
https://github.com/dirk-thomas/vcstool and discontinued
https://github.com/vcstools/wstool. A workspace is a directory containing a set
<https://github.com/dirk-thomas/vcstool> and discontinued
<https://github.com/vcstools/wstool>. A workspace is a directory containing a set
of packages (typically git repositories) under development, see
https://docs.ros.org/en/foxy/Tutorials/Beginner-Client-Libraries/Creating-A-Workspace/Creating-A-Workspace.html
or http://wiki.ros.org/catkin/workspaces for more information.
<https://docs.ros.org/en/foxy/Tutorials/Beginner-Client-Libraries/Creating-A-Workspace/Creating-A-Workspace.html>
or <http://wiki.ros.org/catkin/workspaces for more information>.

Key features:
- `wshandler` mimics `wstool`'s 'stateful' workflow dropped in `vcstool`, e.g.,
it is easy to keep track of your local changes with respect to the upstream;
- `wshandler` is implemented using `bash` and `yq` (https://github.com/mikefarah/yq);
- `wshandler` is implemented using `bash` and `yq` (<https://github.com/mikefarah/yq>);
- currently supported package sources: `git`;
- supported repository list formats: `repos` (default) and `rosinstall`
(https://docs.ros.org/en/independent/api/rosinstall/html/rosinstall_file_format.html)
(<https://docs.ros.org/en/independent/api/rosinstall/html/rosinstall_file_format.html>)


Installation
Expand All @@ -41,7 +41,7 @@ Common arguments:
-t|--type rosinstall|repos {repos}
-i|--indent 1|2|3... {4}
-k|--keep-going {false}
Commands:
List commands:
status
[-j|--jobs <NUM_THREADS> {1}] [-p|--policy {default}|shallow|rebase] update
[-j|--jobs <NUM_THREADS> {1}] clean
Expand All @@ -52,6 +52,16 @@ Commands:
remove <NAME>
remove_by_url <URL>
[-p|--policy {keep}|replace] merge <FILENAME>
Repository commands:
[-j|--jobs <NUM_THREADS> {1}] [-s|-source {git}] foreach '<COMMAND>'
prune
push
branch show ['<GREP_PATTERN>']
branch new <BRANCH_NAME>
branch delete <BRANCH_NAME>
branch switch <BRANCH_NAME>
branch merge <BRANCH_NAME> <TARGET_BRANCH {main}>
commit '<MESSAGE>'
Installation commands:
install_test_deps
[-p|--policy {skip_yq}|snap|download] install <BIN_PATH {~/bin}>
Expand All @@ -62,11 +72,13 @@ Examples

- `wshandler status`
```
>>> wshandler status .../wshandler/tests/scrape/: git sources ---
name version (hash) actual version repository
---- -------------- -------------- ----------
qpmad master (53edb8a) heads/master-0-g53edb8a https://github.com/asherikov/qpmad.git
staticoma master (06e8628) heads/master-0-g06e8628 https://github.com/asherikov/staticoma.git
>>> wshandler status .../ccws/src/: git sources ---
Flags: H - version hash mismatch, M - uncommited changes
name version actual version HM repository
---- ------- -------------- -- ----------
ariles pkg_ws_2 tags/ws-2.3.1-0-ge2748ad4 https://github.com/asherikov/ariles.git
intrometry main tags/0.1.0-0-ga033cd5-dirty M https://github.com/asherikov/intrometry.git
thread_supervisor master tags/1.1.0-0-gbbf8a09 https://github.com/asherikov/thread_supervisor.git
<<< wshandler status .../wshandler/tests/scrape/: git sources ---
<<< wshandler status .../ccws/src/: git sources ---
```
8 changes: 4 additions & 4 deletions tests/update/.rosinstall
Original file line number Diff line number Diff line change
@@ -1,10 +1,6 @@
- git:
local-name: staticoma
uri: https://github.com/asherikov/staticoma.git
- git:
local-name: staticoma_master
uri: https://github.com/asherikov/staticoma.git
version: master
- git:
local-name: staticoma_commit
uri: https://github.com/asherikov/staticoma.git
Expand All @@ -17,3 +13,7 @@
local-name: qpmad_tag
uri: https://github.com/asherikov/qpmad.git
version: 1.3.0
- git:
local-name: staticoma_master
uri: https://github.com/asherikov/staticoma.git
version: master
Loading

0 comments on commit 74b3909

Please sign in to comment.