My iPhone application uses Core Data and a SQLite database; versions are being tracked using SVN. Adding data to the database is not reflected in the application. I make sure I delete the project out of the simulator and that the new database is added as a file to the project. I suspect the data is being cached in another location.
Please note, SVN shows no changes to the database, even when directly edited. Also, if I copy and paste the project to a new folder, delete the hidden svn folders, delete the build folders, edit the DB, delete the project out of the simulator, then compile and run, it works the first time. After that, the data again is cached in some unknown location.
Any ideas where this could be?
UPDATE:
The solution to this was to exit my SVN Client (Versions). I am still unsure of how this affected updates to the DB; I wouldn't think it would block or revert any changes. I am now able to edit and save changes.
Thanks everyone for the help.
Could be more than a couple of things going wrong here. If you have the SQLite DB added to your project by reference, and if you haven't made any code changes, then when you click "Build" you won't see your changed DB resource copied over. Basically, Xcode has long-standing problems sensing when (referenced) resources have changed. Doing a clean build is your nuclear option, as depending on your compilation time, it can take quite a while. A better option is just to delete the .app bundle out of the build directory. This doesn't take as long for Xcode to reconstruct, although if you have a lot of resources, it also can take a while. The best option (the one I use) is to leave a "dummy" file at the root level of the folder included by reference (let's say it's a blank text file), and when I update a resource, I will make a change to the dummy file, undo the change, and hit Save (inside Xcode). This triggers something in Xcode to recursively go through that included directory to see if anything's changed.
All that aside, if you are modifying the DB file, and SVN is telling you that you haven't made changes to it, you have some other problem going on. Simply put, are you certain that the DB file has been added and checked in already to SVN, so SVN knows about it? And are you certain you're editing the same file you're checking in SVN?
Could it be that the database is elsewhere? Have you tried opening the database manually to see if the right records are there?
Related
I suddenly deleted the local repo that contains all of my code. Now all of my code is deleted. I do not know where the deleted files went or any method that can help me to restore all the code.
What I have done, is right click on the repo-name and then select delete
Don't you have any save on a back-up system? Maybe on an external drive or something like that?
Have you checked your trash bin? (If you're on Linux, check ~/.local/share/Trash/files)
Just a little advice: Configure an automatic back-up on an other drive at a fixed time (once a week). That way, even if you loose the latest modifications, you don't loose the whole code.
I have a big problem. One of my coworkers left the company yesterday and one of his projects went into my hands. We work for a company which set up a TFS for us to work together on one big project. He accessed the TFS by using his LiveID. When he left yesterday, he hasn't checked in his new/updated items and I forgot to do it today before I disconnected him and logged in with my account.
So basically I still have the updated solution on my local hard disk. But since my workspace is mapped to another folder, it actually downloaded old versions of our code files.
How can I copy the updated, not-checked-in items into my local workspace folder and check them in?
UPDATE: I have tried changing the local workspace folder by going to File --> Source Control --> Workspaces but I get another error telling me that the folder I'm trying to map (the one used by my ex-coworker) belongs to somebody else.
The easy way would be to log in as him, but a it is a Microsoft ID rather than an AD account you are kind of scuppered there. You o however have the files from disk. If you copy the files from his workspace and drop them over the top of your workspace TFS will detect the adds and edits for you. You will then have to go through and look for any deletes yourself..
a...make sure it builds, run all your unit tests, and then check in.
I had quite a big solution with a lot of code here. Because of some issues with TFS I wanted to create a new 'clean' repository. I removed the mapping to the old repository, and tried creating a new mapping. This resulted in an error that there already was a mapping to my solution. I went to the Source Control Explorer -> Workspaces and deleted the mapping to my solution there. After that I was able to map my new repository to my solution.
But when I checked my hard disk I almost had a heart attack: TFS deleted ALL my code files! The directories and dependencies were still there, but all my project files, my solution file and all of the code was gone!
Please StackOverflow, help me out here! This is a LOT of work that is now gone and I really desperately need it back :(
Edit: I'm currently trying to recover my files with a couple of file recovery tools (like Recuva), but none of them can find any deleted changes. But the files are really gone, Windows search doesn't find them, and they aren't hidden either. Can anyone tell me why this is? Are the files still on my SSD then?
Source control systems like TFS all work along very similar lines. They treat the server's version of the code as "the code" - it's the master copy, and is "owned" by the server. You can then get a copy of the code on your PC (by adding a workspace mapping you tell it where you want it to put this copy). You can make changes to your copy of the code, and then check them in to apply them back to the master version of the code on the server.
So if you change a workspace mapping (e.g. change the location of your copy of the code from folder A to folder B), what you are telling the source control system is "please take away the copy of the code that is in location A, and put it in B". So this is why it deleted all "your" code. It wasn't "your" code, it was a copy of the server's code - you asked it to put it somewhere else on your PC ... so it did.
However, if you had edited any of the code in your workspace, the files would have been checked out, in which case TFS would have known that you had pending changes, and it shouldn't have deleted those files - it should have reported an error as you were trying to change a workspace mapping that included pending changes.
The only way this wouldn't happen is if you manually changed the files to be writable and made changes to them outside of Visual Studio/TFS, so that TFS did not know you had made the changes. If you "secretly" changed some files, TFS may have thought they were unchanged, and therefore permanently deleted them. These files may not show up in file recovery tools because by asking TFS to relocate the workspace you got it to delete the files and then immediately re-get them (into a new folder), which will almost certainly have overwritten the data of the deleted files.
If your changes might have been checked in, then you can find them like this: go to your Team Project in the TFS Source Control view. Right click the Project and choose the "View History" option. This will list all checkins to the project in reverse historical order - if you checked in, then you should see your checkins here. (You can double click any changeset entry in the history to view the list of files that were changed, and if you right click any file you can "Compare..." to see a diff that illustrates exactly what changes were made)
If the changes are not in your checkin history, then I'm afraid you've lost them.
You've probably already learned this, but it's important to learn to use tools like source control properly - they are useful and powerful tools, but they can be dangerous if you don't understand how they work.
If you checked all in before you removed the mapping. The source is almost in the repos. But if not it is already gone sorry :(
Sorry for your loss.
TFS didn't delete anything. You simply never checked it in. If TFS had "deleted" your code, then you would be able to see your code in the history in Source Control Explorer. You would see that there was a changeset with "Delete" operations against your code.
You would then be able to roll back that changeset and get all of your code.
I have a problem!
We are working on an iPhone-app and are using git. The problem is that if someone changes something in the project(adds a file and so on..) and i try to pull that change, I have to merge it.
But the merge isn't painless, I often end up getting a corrupt project file and have to spend quite some time just to fix that.
Does anybody have a solution for this problem?
(Sorry for my crappy English)
Project files are notorious for conflicting. I would enable rerere (stands for "Reuse Recorded Resolution") so that if you have to redo conflict resolutions, you can at least have your decisions cached from the previous time you did them. An excellent write up on rerere is located here: http://progit.org/2010/03/08/rerere.html
If you have the inclination, the better thing to look at is an advanced topic of writing a custom merge driver. See "Defining a custom merge driver" in http://git-scm.com/docs/gitattributes
Hope this helps.
Three important steps:
Cause git to ignore everything in the project file except for the project.pbxproj under the .xcodeproj folder - use .gitignore for this.
before you pull a changed .pbxproj close your project. One of the biggest problems you face is that if you get a new version while Xcode has the project file open it can just save its "current" version over the changed one you want.
merges will sometimes result in spurious data like ">>>>YOURS" or ">>>>THEIRS" merge markers getting included in the project file. If you have to merge do it manually with a tool like filemerge where you can inspect each change and choose whether to include it or not.
If all this fails and you get a corrupted project file anyway
accept the version someone else submitted and redo your own changes, it's almost always easier and the link errors will remind you soon enough.
learn the value of frequent commits.
I have a file I need to move that's already under perforce. Once moved it needs some editing - update the package, etc - appropriate to its new location. Should I submit the move changespec and then reopen it for edit, or can I do this in one go? If so, what is the appropriate sequence of events?
I have done this before in one go, but depending on your build process, I recommend against it. What I generally do is this:
Move the file.
If the move needs a change in order to compile, open it for edit and make those changes.
Submit the changes, telling perforce to reopen the files for editing.
Make the changes for path, etc., that don't cause compile errors but should be updated.
Submit those changes with an appropriate description.
If you want to, however, you could just do all your changes in step (2) above. Perforce might change the flag for the new file from integrate to add, but it still remembers the source path for the file.
Edit: Better method
I realized that I often use a different method, but the idea of "moving" the file distracted me. So, I would recommend these steps instead:
Integrate the file into the new path/name, leaving the previous file there. I am assuming that this won't break your build process.
Submit the new file, checking it out again for edit after submission.
Make the required changes to the new file, and to the project so that you are using the new file.
Submit the edits for the new file.
[Optional] You might need to check through branch specs to see if you need to map the old file into the new one in any branches.
Create a changelist for deleting the old file, and submit it sometime later.
This method allows the edits to be cleanly separated from the rename/move, while never leaving the project in a state that won't compile.
Also, why wait for step 6? Sometimes, especially on bigger projects, you might want to move a file that another person is editing. Perforce will helpfully tell you this. By waiting to delete the file, you allow your coworker(s) to finish the edits and submit without needing to move their work manually. After the edits are submitted, they can be integrated into the new file, and then the old one can be safely deleted.
Submit the move change and then reopen for edit (you could use the reopen option too).
This is much more readable to the user in the change history.
Also, recent versions of Perforce do perform checks for changes to files after resolution. So, there may be complaints editing files after some resolve operations have been completed.
I would say always submit first then edit. It is much cleaner and makes it more obvious whats happening in your repository. Then simply checkout the file in the new location and make whatever changes. This also makes it much more obvious that the changes were made in the new location and to all it to work after renaming.
Yes you can. Simply reopen for edit the branched file (i.e. the new one). In P4Win, there is a context menu for this ("re-open for edit").
"Safely" is probably an important point here. Once you rename or move the file it'll get a revision number of "1" which looks like a new file to your Perforce client. Of course, admins will be able to get its prior history, but if the editing/version history of the file is important to you it's a little harder to get the older revision.
Update: Thanks to Commodore Jaeger and Greg Whitfield for enlightening comments.
This wasn't easy to track down regarding what the One True Answer is, even from Perforce support, so I figured I'd update everyone on what we found:
Perforce stores all versions of every document in its database.
If it's saving your file as type <text> or <ktext> then it stores the diffs of one file version to another and not the entire file.
If you check out a file, make no changes to it, and then re-submit, it will save as a new version with 0 diffs. This is configurable and P4 can be set up to ignore changelist items without any actual diffs. You can force this behavior by selecting "Revert unchanged files..." before you submit a changelist.
Use "Rename/Move..." to move files in P4 so it can track them. Don't copy them using Windows Explorer and then re-add them in P4.
If you use the "Rename/Move..." function from the context menu, the "new" file will show a revision number of "1" as though it were a new file.
However, since P4 saves every function performed on a file, you can actually get to any previous revision (and even recover "deleted" files) with the CLI command p4 filelog -i
If you want to get to the revision history of a moved or renamed file and you're not an admin, you can right-click and select its "Revision Graph" which shows every version of a file even when moved between branches.
According to Perforce support, easier tracking of revision history through branch or folder moves is an oft-requested feature and is in their current roadmap.
Perforce's answer: At the moment, there isn't a way to move/rename/integrate files and still maintain the exact file history.
However, if you were to choose "Integrate..." by right-clicking on the folder that you want to share, the versions of the files of the newly branched folder and underlying files will start from revision #1, but the integration history between the branched folder and underlying files and the original folder and underlying files will remain through which you can trace the revision history of the files.