Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP

Loading…

File contents replaced from another file, repo on RPi out of sync now #143

Closed
wbphelps opened this Issue · 13 comments

2 participants

@wbphelps

I was happily working on a file named "test1.py". It had nearly 300 lines of code in it. After running it sucessfully, I switched to "test1bb.py", a test case I wrote days ago to test something else. I made a couple of changes, did a save, and ran it. Then when I switched back to "test1.py", it now has the same contents as "test1bb.py" !!! As you can probably guess, I was pretty freaked out. A check on BitBucket shows that the file is still OK there, and that was a big relief.

I've restarted my browser (Chrome) and rebooted the RPi, and it still shows the wrong version of this file. How do I get it in sync with BitBucket again?

I tried copying the file from BitBucket and pasting it into a new file in WebIDE. Works, sort of, but the indents are a mess.

Is there anything you need to look at that might help figure out what the bug is?

William

@jwcooper
Owner

Sorry for the nasty bug! This is the first report of this type we've had; I'll see if I can reproduce it, thanks for the steps in your report.

You may just want to reset your local repository to your remote repository state. This will wipe out any local changes that aren't in bitbucket, so double check everything you want is out there. Open the terminal, and navigate to the root of your repository:

Assuming my-pi-projects repository:
cd /usr/share/adafruit/webide/repositories/my-pi-projects
git fetch origin
git reset --hard origin/master

@wbphelps

I was able to fetch just the one file and get it back, thanks.

I tried to for a bit to reproduce this bug but was not able to. I'm wondering if it might be related to losing the connection to the RPi. The WebIDE doesn't seem to handle this very well, it just stops responding. If the network were busy for a period, and I clicked on a different file, and then the network freed up again, might the IDE save the wrong file?

@wbphelps

This is getting a little more scary now. I've been working for hours now on one project. Making updates, saving, added a new file to the folder. Decided to go look at the repo on Bitbucket. No updates since yesterday. How does that happen? There were no errors. Save updated my RPi but apparently did not sync to bitbucket??? YIKES!

@jwcooper
Owner

I'm guessing your git repo is not in sync with the remote bitbucket repo now due to the earlier error. Open the terminal at the root of your repository, and type "git status". It may output errors. You can also manually type: "git push origin master" to see if that errors out as well. I'd backup your code at the very least, just to be sure before tinkering with the repository.

I've got a few ideas to prevent this from happening in the future, but it's tricky to cover all edge cases (like a network issue at a specific moment, if that was indeed the case here). We're hoping to have all this locked down by the time we roll out the beta!

@wbphelps

There is indeed an error:

webide@wmpi /usr/share/adafruit/webide/repositories/my-pi-projects $ git status

error: object file .git/objects/26/f26f8bc5e7326b2675ec17ad5ba36ea7484de1 is empty

fatal: loose object 26f26f8bc5e7326b2675ec17ad5ba36ea7484de1 (stored in .git/objects/26/f26f8bc5e7326b2675ec17ad5ba36ea7484de1) is corrupt

I've just done a backup of the contents on the RPi to a usb flash drive and to my NAS. Should I delete and reinstall? I need to update to the latest version of WebIDE anyway. What do you suggest?

@jwcooper
Owner

You can just repair your repo (you'll lose any local changes, ensure your backup is good!):
cd /usr/share/adafruit/webide/repositories/my-pi-projects
git fetch origin
git reset --hard origin/master
git status

Update the WebIDE with the updater, if possible. What version of the WebIDE are you running?

@wbphelps

WebIDE v0.3.2 - where do I find the updater? (sorry)

@jwcooper
Owner

Oh, that's the current latest version. I'd expect 0.3.3 to come out maybe later this week, or early next week. Once it goes live, you'll see a link in the upper right of the WebIDE to update.

@wbphelps

Can't do git fetch origin -
webide@wmpi /usr/share/adafruit/webide/repositories/my-pi-projects $ git fetch origin
error: object file .git/objects/26/f26f8bc5e7326b2675ec17ad5ba36ea7484de1 is empty
fatal: loose object 26f26f8bc5e7326b2675ec17ad5ba36ea7484de1 (stored in .git/objects/26/f26f8bc5e7326b2675ec17ad5ba36ea7484de1) is corrupt

@jwcooper
Owner
@wbphelps

OK, it's all back in sync now. Thank you for your excellent help and for this great tool. You've been busy!

@jwcooper
Owner

Great news, glad to help! :)

I'm going to leave this open as an issue I'll fix.

@jwcooper
Owner

I've added in much more error handling, so you should know right away if a file isn't getting pushed out to bitbucket. This will be part of 0.3.7.

@jwcooper jwcooper closed this
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Something went wrong with that request. Please try again.