LoginSignup
16
15

More than 5 years have passed since last update.

UnityYamlMerge

Last updated at Posted at 2015-05-27

UnityYamlMergeの設定

導入

設定方法

  • 以下のページなどを参考にしつつ各種VCSツールに設定する。

    • Unity - Manual: Smart Merge
    • gitの場合は .git/config や ${HOME}/.gitconfig に以下の設定をする。
      (UnityYAMLMergeへのパスは適時設定してください)

      [merge]
          tool = unityyamlmerge
      [mergetool "unityyamlmerge"]
          trustExitCode = false
          cmd = "/Applications/Unity/Unity.app/Contents/Tools/UnityYAMLMerge" merge -p "$BASE" "$REMOTE" "$LOCAL" "$MERGED"
      
  • マージしきれなかった場合のfallbackツールを設定する。

    • レポジトリルートディレクトリに "auto" という名前のファイルを配置
    • UnityYAMLMergeと同じディレクトリにあるmergespecfile.txtというファイル に設定例が記載されています。
    • 行頭の*はファイルタイプ指定(未検証)なので省略不可
    • UnityYamlMergeのオプションの--fallbackで指定することも可能?(未調査)

      • e.g. echo '* use "/Applications/p4merge.app/Contents/MacOS/p4merge" "%b" "%l" "%r" "%d"' > auto

        置き換え前のマーカー 内容 意訳
        %l is replaced with the path of you local version ローカルバージョン(--ours)
        %r is replaced with the path of the incoming remote version マージ対象のバージョン(--theirs)
        %b is replaced with the common base version マージ対象のベースバージョン
        %d is replaced with a path where the result should be written to コンフリクト発生中のファイル(?) 編集対象

使用方法

  • マージ作業などでコンフリクトを発生させます。
    both modified: Assets/TestScene.unity
  • コンフリクト解消のためにUnityYAMLMergeを起動させます。
    git mergetool
  • コンフリクトが解消できた場合は以下の表示が出るので、そのままyを押下します。
Normal merge conflict for 'Assets/TestScene.unity':
  {local}: modified file
  {remote}: modified file
Conflicts:
Conflict handling:
Assets/cube.unity seems unchanged.
Was the merge successful? [y/n] 
  • コンフリクトを解消できなかった場合は、autoファイルで指定されているマージツールが起動するのでマージを解消します。
    • この際は上記の[y/n]の確認は表示されません。
    • ただし、マージツールがエラーコードで終了した場合は確認されます。

vimdiffの場合の設定(書きかけ)

  • コンフリクト解消が難しい場合
    • :cq でエラーコード終了させましょう。
    • :q でそのまま終了してしまうと、マージ成功として処理されてしまいます。
  • autoの内容
    • 編集対象のファイルが空のままで表示される
      * use "/usr/local/bin/vimdiff" -c "wincmd J" "%d" "%l" "%b" "%r"
  • 参考
16
15
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
16
15