playcanvas / playcanvas-sync

Real-time synchronization of files between PlayCanvas and your local machine
https://playcanvas.com/
MIT License
75 stars 18 forks source link

Cannot recognize diff #53

Closed PhongVu07 closed 2 years ago

PhongVu07 commented 2 years ago

Hi, I was able to call pcsync pushAll to get all the files, however after any update, both pcwatch and pcsync diffAll cannot recognize the changes.

Am I missing something?

yaustar commented 2 years ago

This is usually because there's some issue with the config files.

Can you post the contents of your config file(s) please without the API key?

PhongVu07 commented 2 years ago

I did try to sync with a new branch but it does not help as well. This is my config:

{
    "PLAYCANVAS_BRANCH_ID": "0b1e2a6c-43c2-467b-ab6c-7185c53b506c",
    "PLAYCANVAS_PROJECT_ID": 954395,
    "PLAYCANVAS_TARGET_DIR": <path-to-code>,
    "PLAYCANVAS_API_KEY": <api-key>,
    "PLAYCANVAS_BAD_FILE_REG": "^\\.|~$",
    "PLAYCANVAS_BAD_FOLDER_REG": "\\."
}

It basically the example config @yaustar

yaustar commented 2 years ago

Is this in ~/.pcconfig file that is in the home directory? If so, I can't see anything that looks wrong off hand. Can you share thie PLAYCANVAS_TARGET_DIR please?

PhongVu07 commented 2 years ago

@yaustar The path is sure correct because I am able to pull. This is it: /Users/phongvu/Desktop/spacefalcon/html-game/src

yaustar commented 2 years ago

Since this is windows, it's recommended to have the full path C:/Users/phongvu/Desktop/spacefalcon/html-game/src

Try that to see if that helps.

Can you also add PLAYCANVAS_VERBOSE: 1 to the config as that gives more information in the console

PhongVu07 commented 2 years ago

I actually use Mac. With PLAYCANVAS_VERBOSE: 1 I see that the change is detected, however everything is marked as SHOULD APPLY TO REMOTE: NO, even if I make big changes like updating condition

yaustar commented 2 years ago

I've tried using your config with a project of my own:

{
    "PLAYCANVAS_BRANCH_ID": "cd74bb38-62eb-4496-a2e6-7e10cab2daf4",
    "PLAYCANVAS_PROJECT_ID": 721733,
    "PLAYCANVAS_API_KEY": "",
    "PLAYCANVAS_TARGET_DIR": "/Users/syau/Snapchat/Dev/n-test-3",
    "PLAYCANVAS_BAD_FILE_REG": "^\\.|~$",
    "PLAYCANVAS_BAD_FOLDER_REG": "\\."
}

And was able to push successfully:

syau@XXXXXXXXX ~ % pcsync pullAll
---- Remote Files Missing on Local ----
Bitmoji Library/Scripts/bitmoji-3d.js
Bitmoji Library/Scripts/bitmoji-loader.js
Bitmoji Library/Scripts/default-glb-asset-loader.js
Bitmoji Library/Scripts/glb-converted-assets.js
Bitmoji Library/Scripts/log.js
Bitmoji Library/Scripts/proxy-bitmoji-3d-loader.js
Bitmoji Library/Scripts/spinner.js
Bitmoji Library/Scripts/utils.js
_Game/Scripts/npc-ui-controller.js
_Game/Scripts/play-anim-trigger-button.js
_Game/Scripts/random-anim-start.js
Proceed? [y/n] y
Created _Game
Created _Game/Scripts
Created Bitmoji Library
Created Bitmoji Library/Scripts
Created Bitmoji Library/Scripts/bitmoji-3d.js
Created Bitmoji Library/Scripts/default-glb-asset-loader.js
Created Bitmoji Library/Scripts/spinner.js
Created Bitmoji Library/Scripts/log.js
Created _Game/Scripts/npc-ui-controller.js
Created Bitmoji Library/Scripts/glb-converted-assets.js
Created _Game/Scripts/play-anim-trigger-button.js
Created _Game/Scripts/random-anim-start.js
Created Bitmoji Library/Scripts/utils.js
Created Bitmoji Library/Scripts/bitmoji-loader.js
Created Bitmoji Library/Scripts/proxy-bitmoji-3d-loader.js
syau@XXXXXXXXX ~ % code /Users/syau/Snapchat/Dev/n-test-3
syau@XXXXXXXXX ~ % pcsync diffAll
---- Files that Differ ----
_Game/Scripts/play-anim-trigger-button.js
syau@XXXXXXXXX ~ % pcsync pushAll
---- Files that Differ ----
_Game/Scripts/play-anim-trigger-button.js
Proceed? [y/n] y
Updated _Game/Scripts/play-anim-trigger-button.js
syau@XXXXXXXXX ~ %
yaustar commented 2 years ago

If you can post what your console output says with VERBOSE, that could help.

Does this happen only for this project or other projects as well?

PhongVu07 commented 2 years ago

Yeah I forked a new one and same result, here's the log:

EVENT:
{
  action: 'ACTION_MODIFIED',
  itemName: 'demoloadbalancing.js',
  fullPath: '/Users/phongvu/Desktop/spacefalcon/html-game/src/Scripts/Multiplayer/demoloadbalancing.js',
  remotePath: 'Scripts/Multiplayer/demoloadbalancing.js',
  isFile: true,
  isDirectory: false,
  modTime: 1664884367304,
  hash: 'e1138da9e8523c1d78a03090c46990be',
  pathArray: [ 'Scripts', 'Multiplayer', 'demoloadbalancing.js' ],
  parentFull: '/Users/phongvu/Desktop/spacefalcon/html-game/src/Scripts/Multiplayer',
  parentRemote: 'Scripts/Multiplayer'
}
SHOULD APPLY TO REMOTE: NO
------------------
yaustar commented 2 years ago

If you forked a project like this one: https://playcanvas.com/project/841793/overview/animation-without-state-graph does it still happen?

Unfortunately, if I can't reproduce the issue on my end, I can't really advise further.

PhongVu07 commented 2 years ago

Another hint is that if I run pcsync diff <remote-file-path>, the change is detected. But no change detected with pcsync diffAll

PhongVu07 commented 2 years ago

It was because pcignore.txt file! Everything works after deleting it. I only listed .git in that file, maybe I understand the purpose of that file incorrectly?

yaustar commented 2 years ago

Good catch! The pcignore file is used by the Editor during merges. The merge process in the Editor will ignore changes on files that match the patterns in pcignore

What pcsync will do as well, is only sync files that don't match the patterns in pcignore.

The idea was that if you were using pcsync and an external code source repo (like Git), you would already be merging code on the external source repo and be syncing that to the Editor. Therefore, you don't need the Editor source control to merge those files.

It's not a common workflow pattern these days but before we had merge issues with large text files in 2020/2021