Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Upload/Download Conflicts #396

Open
fgallardograzio opened this issue Sep 17, 2017 · 14 comments
Open

Upload/Download Conflicts #396

fgallardograzio opened this issue Sep 17, 2017 · 14 comments

Comments

@fgallardograzio
Copy link

First of all: Thank you! You've developed a really awesome, must-have tool!

Now, straight to my problem.
I want to keep settings synced between 2 PCs, but I'm always getting "conflicts" when downloading because the extension thinks my local settings have diverged from the gist (when IMO that's not the case, of course).

I keep getting errors like this:

Failed to save 'settings.json': The content on disk is newer. Click on Compare to compare your version with the one on disk.

Or even like this:

Failed to save 'syncSummary.txt': The content on disk is newer. Click on Compare to compare your version with the one on disk.

No matter what I change I always get those conflicts, even if it's just one line in settings.json (although that means at least two/three, since we have the ever changing "sync.lastUpload" and/or "sync.lastDownload" in that file).

For example, I follow this steps:

PC1:
  Sync: Download

PC2:
  Sync: Download

Now both PCs should be in sync.

PC1:
  Change one line in `settings.json`.
  Sync: Upload

PC2:
  Sync: Download
  ** Conflict **

When doing the initial sync, I've tried having forceDownload both set to false, and set to true, doing the whole flow every time. Same result.

If this is something you've never experienced or heard of, I'd be willing to try with fresh installs and share the full sync history along with each change I've made and command I've run.

However!

I think version control is way out of the scope of this extension.
Perhaps there's a fundamental problem with the following suggestion that I'm not seeing, but IMHO this extension should only care about gathering config files and pulling/pushing them to the provided gist.
Every gist is a git repository, so we've got every version control feature we need right there, we just need to leverage git's features.

There's no need for the extension to reinvent version control with the gist's cloudSetting's lastUpload timestamp, comparing that with all of the local settings' lastUpload and lastDownload values and whatever.
No need to manually implement safe/force download and safe/force upload (Issue #350). Git already does all of that, and it does it well.

I'd love to further discuss this and help code it if you want.

Thanks!


Visual Studio Code Version : 1.16.1
Code Settings Sync Version : 2.8.3
Operating System : Linx Mint 18
Occurs On: Upload and Download
Proxy Enabled: No

@borekb
Copy link

borekb commented Sep 18, 2017

Incidentally, I was thinking about this over the weekend as well. I think that using version control is a great suggestion and Gists API has the GET /gists/:id/commits endpoint that could possibly be used for that. I don't have a full understanding of the codebase so am not sure if there are any real-world issues with this approach but it certainly sounds good to me.

BTW, I often get the Failed to save 'settings.json': The content on disk is newer. Click on Compare to compare your version with the one on disk. message when settings.json is open in VSCode. Just closing it might help.

@Jeff-Lewis
Copy link

With the following settings, I get a conflict error writing to the syncSummary.txt I think every time.

"sync.autoDownload": true,
"sync.autoUpload": true,
"sync.forceDownload": false,
"sync.quietSync": false,

(For this, code-settings-sync should write the Sync Summary text out to it's own Output Window.)

Is there any reason why %AppData%\Code\User\ couldn't be a local git repo?

In JetBrains IDEs, WebStorm, PhpStorm, etc, the Settings Sync plug-in uses a git repo. Although the plugin manages the settings git repo in a separate folder from the IDE's actual config files. It then applies changes in the IDE's config files to/from the local git repo and push/pulls.

It gives the user only three manual control options:
image

Alternatively, you can configure the Sync Settings Plugin to Auto Sync, where it automatically commits/pushes on exit and pull/merges on start.

There are ~29K code hits in GitHub for Intelli/IDE Settings Repositories. It works fairly well.

@cosmoKenney
Copy link

I've got the same problem. 3 machines, and I cannot get the settings completely downloaded on my second machine.

@cosmoKenney
Copy link

cosmoKenney commented Oct 3, 2017

Should I create a new issue for my problem? It's pretty much the same thing as above, I'm getting merge errors in the user settings file, on the machines I'm trying to download to. The extensions are installed and other files seem to be pulled down okay. Is there a gitter for this?

@shanalikhan
Copy link
Owner

shanalikhan commented Oct 4, 2017

Failed to save 'settings.json': The content on disk is newer. Click on Compare to compare your version with the one on disk.

What you can do is to close the files that is going to sync. I will add function to let code close the settings file that will be overwritten.
In background complete new file is written but somehow the code editor doesnt update the contents allows file to have conflicts.
User often gets error in either syncSummary or settings file.

I will check the commits in Gist api.

@Jeff-Lewis
Regarding the Default Sync using Git repo will require major change. You can open new issue and we will see it later on on adding option for git repo like gist but i dont currently have plans to integrate it until v3.0

There are alot of feature request are opened already, and currently i'm working on changing the extension code in order to write tests in future and add sync using file like gists

@IssueHuntBot
Copy link

@IssueHunt has funded $80.00 to this issue.


@omendezmorales
Copy link

Hi @shanalikhan ,
I succeeded in uploading my settings from machine A. However when I try to download into Machine B, I get the following error message:

Sync : Invalid / Expired GitHub Token. Please generate new token with scopes mentioned in readme. Exception Logged in Console.

A question that I have is whether when prompted to enter the token name, it should be the GUID itself, or the human-readable name we give in the github user interface (e.g. code-settings-sync)
I've tried a couple of times to re-generate the token, but when I repeat the download command in VS code, I'm not asked for the token name, and thus I don't know how to proceed further :-| can you please help me? thanks in advance,

@auxves
Copy link
Contributor

auxves commented Apr 18, 2019

@omendezmorales Open the command palette and go to >Sync : Advanced Options -> Edit extension local settings and paste your token into the token part.

it should be the GUID itself

That is impossible. You can't just get a token by name or any other id. You need the actual token to do anything with the GitHub API.

@shanalikhan
Copy link
Owner

@fgallardograzio , @borekb
Auto Upload / Download has very much improved since that time.
Also syncSummary.txt is now replaced by Code Output Window. Settings have UI.

Are you guys still facing this error?

@octogonz
Copy link

octogonz commented Jul 13, 2019

@shanalikhan I need to know when my settings are changing. I'm not sure I would want it to happen automatically in the background. For example, what if I need to temporarily change a setting, but then later I want to revert to the server's version?

It seems like there should be 3 commands:

  • "Sync": Compares the local settings against the server. Performs Upload if the local settings have changed (since the last sync). Performs Download if the server has changed. Reports a merge conflict error if both have changed.
  • "Upload": Overwrites the server settings, replacing them with the local settings.
  • "Download": Overwrites the local settings, replacing them with the server settings.

I'm new to using Settings Sync, but if I understand right does not support the "Sync" command, as I've defined it here. Is that correct?

@shanalikhan
Copy link
Owner

shanalikhan commented Jul 15, 2019

@octogonz

Nice catch. Yes it doesnt support this functionality, let me see how we can introduce this in upcoming versions.

@arnohovhannisyan we might want to add new sync function in those refactoring PR so we can improve the sync for GitHub Gist and Git

@allenyllee
Copy link

Hi @shanalikhan , I have a similar problem.

Suppose I have 2 PCs, called "HOME-PC" and "WORK-PC", both have VScode opened. When I worked on WORK-PC, change some settings and upload (by auto-upload), I have no way to notify HOME-PC to do the download (because auto-download only trigger on vscode startup).

I think the auto-download function should polling the gist repo every 5 mins to detect changes, if there are changes, then just download it. Maybe It can integrated to the "Sync" function which @octogonz had mentioned.

@shanalikhan
Copy link
Owner

@allenyllee
The problem you both have mentioned is out of scope for this issue.
Can you open new issue detailing the scenarios so we can look into later on.

@allenyllee
Copy link

@shanalikhan
new issue #984

@shanalikhan shanalikhan unpinned this issue Apr 19, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

10 participants