VCSGit.cs 1.2 KB

12345678910111213141516171819202122232425262728293031323334353637383940
  1. 
  2. namespace GitMerge
  3. {
  4. using UnityEngine;
  5. public class VCSGit : VCS
  6. {
  7. protected override string GetDefaultPath()
  8. {
  9. if (Application.platform == RuntimePlatform.WindowsEditor)
  10. {
  11. return @"C:\Program Files (x86)\Git\bin\git.exe";
  12. }
  13. return @"/usr/bin/git";
  14. }
  15. protected override string EditorPrefsKey()
  16. {
  17. return "GitMerge_git";
  18. }
  19. public override void CheckoutOurs(string path)
  20. {
  21. GetAbsoluteFolderPathAndFilename(path, out var absoluteFolderPath, out var filename);
  22. Execute("checkout --ours \"" + filename + "\"", absoluteFolderPath);
  23. }
  24. public override void CheckoutTheirs(string path)
  25. {
  26. GetAbsoluteFolderPathAndFilename(path, out var absoluteFolderPath, out var filename);
  27. Execute("checkout --theirs \"" + filename + "\"", absoluteFolderPath);
  28. }
  29. public override void MarkAsMerged(string path)
  30. {
  31. GetAbsoluteFolderPathAndFilename(path, out var absoluteFolderPath, out var filename);
  32. Execute("add \"" + filename + "\"", absoluteFolderPath);
  33. }
  34. }
  35. }