Skip to content

ail-and-colleagues/git_rhino_ghx

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

88 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

git_rhino_ghx

test project of version control for rhinoceros grasshopper.

ghx_diff.py

: Create a difference-indicated .ghx by specifying branches and a filename.

usage: ghx_diff.py [-h] -p PATH_TO_REPO -t TARGET -l LEFT_BRANCH -r RIGHT_BRANCH [-i]
optional arguments:
  -h, --help            show this help message and exit
  -p PATH_TO_REPO, --path_to_repo PATH_TO_REPO
                        path to a repository
  -t TARGET, --target TARGET
                        target .ghx file
  -l LEFT_BRANCH, --left_branch LEFT_BRANCH
                        left branch
  -r RIGHT_BRANCH, --right_branch RIGHT_BRANCH
                        right branch
  -i, --ignore_positon  ignore component position changes

ファイル名(.ghx)と前(left)・後(right)のブランチ名を指定すると次図のような差分:diffの表現された.ghxを {target_file_name}({left_branch_name}_to_{right_branch_name})_diff.ghxとして出力します。 conflictした.ghxを比較する際に便利だと思われる。
image

Assumed Workflow

  1. create a new branch: dev_something.
    git checkout -b dev_something
  2. do something in target_file.ghx.
  3. stage target_file.ghx.
    git add target_file.ghx
  4. commit changes.
    git commit -m "add something"
  5. switch to the main branch.
    git checkout main
  6. try to merge.
    git merge dev_something
  7. solve conflicts using ghx_diff.py in the main branch (if causes conflicts).
  8. adopt the main branch and discard dev_something using --ours.
    git checkout --ours target_file.ghx
  9. stage target_file.ghx.
    git add target_file.ghx
  10. commit.
    git merge --continue
  11. remove dev_something**
    git branch -d dev_something

ghx_to_dot.py

: Create a network-like graph by parsing .ghx.

usage: ghx_to_dot.py [-h] -t TARGET [-a] [-i]
optional arguments:
  -h, --help            show this help message and exit
  -t TARGET, --target TARGET
                        target .ghx file
  -a, --add_hash        add hash to node
  -i, --ignore_positon  ignore component position changes

アルゴリズムの構成をネットワークのようなグラフで表し.pngで保存します。.ghxが大凡どのような処理であったかGithub上で確認できます。コンポーネントのhashなんかを付記しても便利だと思われる。
image

links

Version control (grasshopper forum)
https://www.grasshopper3d.com/forum/topics/version-control