Problems Using Snapshots in Xcode 5 Mac - xcode

A couple of people have asked a similar question, the last one a year ago, with no solution (Here and here), so I thought I'd try it again.
I've created snapshots in Xcode 5.1 on a few occasions before making significant code changes. When I go to restore them, I've seen a couple of different behaviors:
There's one file that changed. Xcode shows me the before and after diffs, and I say OK, and click on Restore. The result, nothing's changed.
Same as one, except in this case there are multiple files that have changed. It shows me one, and it looks good. So I click Restore. It doesn't show me any of the other files diffs that have changed, and it doesn't prompt me to be sure I don't want to look at them. After the fact, I've surmised that I need to click on each changed files in order to accept the changes. But still, there's only one Restore button, which dismissed the window. In any case, none of the files have been restored to their former state. If I try to restore from that same snapshot again (naively thinking I could try to retrieve the other changed files), it tells me that the current state and the snapshot are the same.
If I export the changes to another directory, then I do get the reverted files. It's when I do a File->Restore Snapshot where I get no results.
I've taken to manually creating zip archives of the source so I can recover the files manually.
I don't have any Source Control in use in Xcode so far. It seems I should do that if only to do periodic commits on my own.
Do other people use snapshots successfully? Has anyone else experienced this behavior in Xcode 5?
Thanks much for your help. I've yet to get any response on the Apple Developers Forum on the topic :(
-Eric

Related

Restoring an Xcode commit that was never pushed to Github

This is a question that I posted, and then after much digging finally resolved myself. There is actually quite a bit on this subject both on this forum and elsewhere, but it usually requires some familiarity with Terminal. I am going to describe the problem I faced and then describe step-by-step in detail (at a beginner's level) how to resolve the issue in Terminal.
In short, I checked out a previously committed version of my app in Xcode, which - because it was a version from several weeks prior - did not contain my most recent commits. In other words, I had no access to any of the commits that contained my most recent work. They had all disappeared.
My commits and pushes had not stored in GitHub because presumably some time before this I had accidentally selected my main folder as the destination for my commits, rather than one of the two branches I created. So I had absolutely no access to my work. By all appearances I pretty much had to start from scratch.
After much hand wringing, teeth gnashing, and hours of scouring the webs, I finally uncovered the solution. But it takes a bit of understanding about Terminal to make it work. So after several more hours of learning Terminal, I finally successfully restored all of my work.
For any of you who are new to coding (as I am), and who have no experience with Terminal, I will provide detailed instructions on how to resolve this issue if you encounter it in the answer below.
Open Terminal to prompt to your Xcode project. The easiest way to do this is to find your project in Finder, which will have a .xcodeproj extension, and then right click it.
Select New Terminal at Folder.
At this point, a terminal window will pop up. From here, enter the following: git reflog
Press Enter
This will populate a list of all the commits stored in your Xcode project. Each commit is identified by an alphanumeric code (the one I restored was 1a7ea33, for example).
Note the alphanumeric code of the commit you wish to restore.
After this, enter the following: git checkout -b NewBranch 1a1a1a1 (where "NewBranch" is whatever name you decide to name your new branch, and "1a1a1a1" is your alphanumeric code from steps 5 and 6).
Press Enter.
That's it. Close Terminal and open your Xcode project as normal. You will notice the restored commit in the folder you just named in Terminal.
Hopefully no one will ever need this, but if by chance someone does I hope it helps.

When merging changes in the MSVS2013 IDE, is there a log of what occurred?

I pressed Alt-E which I mistakenly thought was Merge Changes In Merge Tool, however, that was actually Keep Local Version. Is there a way to go back? Is there a way to find out what was merged, as in what file? Ugh! :(
I have completely stopped working in case I erase something of importance.
I'm using MSVS 2013 Professional.
Here's another possible approach.
If you know what version of the code you started with before you started making your current batch of changes, you can grab a copy of your local workspace files. Then Undo all your Pending Changes. Then delete all the files in your local workspace (in Windows explorer). Then do a Get Specific Version to get back the old version of the files from where you started, then copy-paste in your updated files from your backup copy. Then do a Get Latest. This should retrigger the Merge process.
I don't know a great answer to this problem, but I do know one thing you can do (I hope you don't have a massive amount of pending changes, or this will get tedious).
The problem is that TFS thinks you have now merged the server changes (other devs changes) into your workspace, even though you told it to basically toss them. If you try to check-in now it will blow away other developers changes in TFS.
What you can do is go through each file in your pending changes window, and do a Compare With Latest Version. This will show you the differences between your local file, and the file in TFS. You will notice two types of differences:
the changes you made which you can just skip past.
Changes that other devs made and are on the server, these differences will show up as though you have deleted/undone that code locally
For the changes that other devs made, you will have to manually reapply them in your local workspace before you check-in.

SVN multiple developer working on single file at same time

Actually I have faced this issue many time during working with SVN. Most of the time I am working with VSS for source control but since last couple of months working with SVN.
We are using tortoise and AnkhSVN with VS 2010.
In our team there are 5-6 people and some of them are working on same file at a time. Now when somebody commit , we have seen that some other developer changes get vanished and Sometime we get some line with version number. This thing get consume lots of time and we have to resolve conflict and all.
Please provide information so we can avoid such issues.
If two developers are working on the same file and make changes to the same are of code, then you have to manually resolve this conflict. There is no way to avoid it, no matter which version control you use.
The version control cannot know what the correct code is, so it requires a human intervention.
There is no way around this, other than preventing the users from working on the same code. this is done in svn by locking the file.
Each developer must svn update before svn commit. Between the update and commit, the developer must do a full, clean build and run all tests to make sure their code still works after merging in all other developer's changes into their copy.
You can set svn:needs-lock on files or folders that need to be locked before making changes, they'll be forced to check for locks. When you will try to edit a file, you will be required to lock it first. And when it is already locked by someone else, they you get an error message, preventing you from making any changes. This can be done in Tortoise SVN in Properties -> Advanced

XCode - Any way to recover code after "Discard Changes"?

I inadvertantly did a very stupid thing last night. I have been working on an iPad project for a couple of months and (even more stupidly) do not have a backup. By right-clicking on the project in XCODE, I mistakenly clicked "Discard Changes"
(stupidity reigns again) I did not have any commits since the initial and when I did the Discard Changes, it seems that it went all the way back to the initial commit, which if I am looking at things correctly looks like each file is as it was the very first time it was saved.
My question is: Is there a way to recover my work? Is it in the .git directory? Is a copy stored elsewhere? or as a last resort, any chance to recover some of the source text with an un-delete utility?
Thanks,
Bob
For little clarification.. one can put back files from the trash as discard changes sends the file in the trash
Answer copied from How to undo xcode discard all changes if not committed
Quit Xcode.
Open the file you wish to bring back your lost changes to using TextEdit.
Go to File -> Revert To -> Browse All Versions...
Scroll through the available versions. Hopefully you will have many available to choose from.
Select a version and hit Restore.
Follow 1-5 for all necessary files.
Launch Xcode. You should now see the M next to these files in Project Navigator indicating they include uncommited changes (the changes you previously discarded).
Completely new files you may have created and were discarded can be found in the Trash.
Also a small piece of advice. If you are in need to discard changes, prefer using Source Control -> Discard Changes by right clicking on files in the Project Navigator, instead of Discard All Changes which might give you all kinds of trouble.
Have a nice day. :)
Well luck was on my side after all. As it turns out, when I did the Source Control > Discard Changes operation, it did not make any changes to the source code save in my project directory. I was able to start a new project and added the files back in. Once I did that I was able to compile and run my project in the simulator just as it was before the incident. I now have a backup as well as committed the changes in git.
You have a hope of fetching this code if you "pushed" & committed your prior-to-discarded changes into your local git repository. Or if you're using MacOS's included Time Machine or some other automated backup solution.
Aside from that, you might be hosed.
If you're on Lion or later, you may have Time Machine backups even if you don't have an external drive. As of Lion, Time Machine will take 'local snapshots' of files; this is how they support the "Versions" feature that lets you go back to previous versions of your files.
If you didn't have Time Machine turned on, though... you may be out of luck.

SourceSafe: Can it recover deleted files?

Question: Today I worked with MS Visual Sourcesafe, that is to say Microsoft's Sourcecode destruction system, which has never ever saved anything, but already destroyed much.
Today I had one more of those nasty destructive episodes:
I was working on a reporting service report (*.rdl xml files).
I was modifiying a report, so I created a copy and modified it.
The original being named FILENAME.rdl
My modified copy being named FILENAME2.rdl
I finished, saved. Checked in.
It was all correct.
I switched offline, continued to work.
Later on, I deleted filename.rdl, and renamed filename2.rdl to filename.rdl
I continued working for the rest of the day offline.
In the evening I checked in, and filename2.rdl reappeared.
I thought it had copied the old version back, so I deleted filename.rdl (from local computer and sourcesafe, via the delete keyboard button in the visual studio treeview) and wanted to rename filename2.rdl again to filename.rdl.
When I tried, I realized that filename2.rdl was just an entry that appeared in the treevieww, but not on disk... It was in that very momement that I realized that I now have a problem...
I looked in the recycle bin, but nothing there.
I tried 5 different undelete programms, and shadow copy explorer [to find out that non C drive data - such as the data partition e - is not backed up by the shadow copy service automatically...], but no luck. The file is gone.
Is it possible to still retrieve the file from sourcesafe, or does it get permanently removed when one presses the delete button in VisualStudio treeview and clicks OK on deleting it from file & sourcesafe ?
So far I found this one:
http://support.microsoft.com/?scid=kb;en-us;244019&x=11&y=7
but from that it is unclear whether the file is gone.
The problem is if it isn't there, I should redo the about one hour work this evening, because tomorrow will be a busy day.
There are 2 levels of Delete in SourceSafe. When you delete the file, if you check the "Destroy permanently" option, the file will not be recoverable. Otherwise, you can go to the Properties of its parent project and recover it later.
If it's not stored under some different version or branch of your code, I think you're out of luck.
Regardless, however: you estimate this is one hour's worth of work. You already (presumably) spend some amount of time (probably an hour or two) trying to get the file back. Are you not now at the point where, even if VSS has a way to get your file back for you, you'd be better served just rebuilding it?
Short answer - definitely NO!
It can't! I tried.
But it overwrote the recreated report with a completely wrong recovered version...
Fortunately, I've forseen this, and made a backup copy of the recreated report for this case.
So I didn't spend that one hour of recreating the report in vain.
This program should be forbidden, with noncompliance to this prohibition being subject to the death penalty.

Resources