Viewing the contents of previous commits in Xcode - ios

In Xcode when I go to Organizer -> Repositories I can see the list of
all the commits I've made sorted by dates.
For any commit, I can expand the viewing area by clicking the disclosure triangle to the
left.
This shows me the list of file that were
added/modified/deleted in that commit.
I can click any file in his
view to open the versions editor and view the diferences from my
working copy.
Now here's what I'd like to do: I'd like to do is view the contents of files that I deleted in this commit. Is there a way I can view them from within Xcode? It looks like one can only see which files were modified and what those modifications were. There seems to be no way to view contents of deleted files.
Can someone prove me wrong?

I don't know GIT, for Subversion the situation is as follows.
Deleted files are handled differently in Subversion and thus most clients have trouble getting information about them, so does XCode. The only way I see is to use the command line. You need to know at which revision the file was deleted. Let's say this number is 101, so at 100 it existed yet.
Open a terminal and type:
svn log https://myserver/myrepos/mypath/DeletedFile.m#100
svn cat https://myserver/myrepos/mypath/DeletedFile.m#100
You can even perform diffs. To compare revisions 85 and 90:
svn diff -r 85:90 https://myserver/myrepos/mypath/DeletedFile.m#100

Related

'.pbxproj' file is missing in commits list

currently building a project clone and push all the changes to my github account step by step.
And i always used to see 'Twitter.xcodeproj/project.pbxproj' checked together with modified .swift files.
However, i don't see it now. I've reopened and did some additional changes to the code, but still nothing.
Is that ok, if it's not pushed?
And how do i get it back to normal if it's not?
The list you are looking at is generated by git status. Well, git status does not include any files that didn't change. So you should not expect to see project.pbxproj in the list unless you did something that would change it (like making a new code file and adding it to your project). Merely editing your existing code wouldn't change it, so it doesn't appear.
(In a way, this is a case of the classic confusion as to what git status means. Beginners often think that it's a list of your files, or a list of the files that will go into this commit. It isn't. A commit always contains all your files. But git doesn't bother to list them in the git status, because that could be an unnecessarily huge list. There are ways to find out what's in the commit, but the screen you are displaying is not how to do it.)
TL;DR Don't worry, be happy.

Add files to each branch in TFS

I have 55 branches in various locations. For example $/Repo/Trunk, $/Repo/Branches/branchNames, $/Repo/Features/branchNames, etc. I want to add some files to every branch. I scripted a copy and paste to put the files in the subfolder under each branch where I'd like to add them.
I then navigated to C:\TFS\Repo (my workspace for Repo) and searched for NewFile. Windows explorer brought up a list showing the 500 new files I'd just added across the 50 branch folders. I highlighted all of them, right-clicked, chose Team Foundation Server -> Add.
Here's my problem: it only added ten of them. I don't want to go back and redo that process, making sure to deselect everything I've already added (because if it's selected, the 'Add' option is disabled), and repeat this process 50 times. I also tried a script that will recursively search for files starting with NewFile and add them but it only added 300 of them (not sure why).
Am I missing something or is there no easy way for me to add all these files at once?
It sounds like you are using the File Explorer extension. Add the files via the Source Control Explorer in TFS. Right click on the root folder for the branches and choose Add Items to Folder. The dialog will show all files that could be added (including subfolders) and you can include/exclude as necessary.
This method will break the branching model for those files. After checkin there will be no branch relationship between the files and they will never merge.
You need to add the Files to one of the branches and merge them through the branch structure.
Ideally you would add them to your MAIN/TRUNK/MASTER and then merge that out to all of your DEV and FEATURE branches. You are unlikely to want to do this for RELEASE but I can imagine senarios where this would be necessary.

check out TFS at a specific change set

I'm using TFS and VS 2012 and my project is in a broken state and I can't figure out why. I'd like to go back to a previous version of my solution when I know it worked and make changes on that working version. However, when I choose to check out a specific changeset, it seems to me like it's only changing the files that were changed in that changeset. When I use git and check out a revision, my code looks exactly like it did at that revision. Files that didn't yet exist at that revision are removed, files that did exist have contents as they were at that revision, etc. But I can't seem to do the same in TFS. I can't figure out how to get all of the files (and only the files) in the state that they existed when a particular changeset was checked in. Am I missing something? Any help REALLY appreciated.
Try using the Advanced option when you right click on a solution or folder in Source Control:
Then when the dialog appears, check both check boxes so the version you have is overwritten with the specific version you want by selecting Changeset from the ddl and entering the changeset you are after...
This should overwrite the existing solution files with the specific version.
If you have trouble doing it over top of existing files, delete the source on your local machine first and get the specific version after that.
A changeset is just the files checked in at one time, not a snapshot of the whole system. You want to use labels for that. A label will mark all the files in their present state, just as you describe Git doing.
Find the changeset you want and "Get This Version" to only get the changed files.
Manually check out each file for edit in Source Control Explorer to match the changeset.
Now the previous changeset's edits can be checked in.
NOTE: This is MUCH quicker than getting the entire repo using "Get Specific Version."

gitx(L): view files that need committing

In gitx(L), is it possible to view all the files that need to be committed?
For example, it would be handy to have a pane that shows the list of files that have changes. However, I can't seem to see one.
Any suggestions?
You can find this list in the staging dialog, accessible from the upper left corner. You'll see the classic Git commit, with a list of changed or untracked files, and the ability to stage and commit them.

TFS 2010: history lost after moving a folder

In order to clean up my project structure, I moved a folder into another (new) folder through the TFS Power Tools Shell-Extension (Rename/Move).
After checking the history at the new place, the move is the only entry. (I tried one folder up, down, even on single files in the moved folder.. same result.)
I had also put on some labels on versions of the folder before the move, since there were some important states of the code I wanted to get back to.
So.. what went wrong, and how can I either get the history or at least find out the label names again and check out those versions?
Turns out it is pretty easy.
In Visual Studio 2010, go to Tools->Options. There you can find the option to show "deleted" items (roughly in the middle of the dialog box). The old folder got deleted during the move - it will be displayed again after activating that option. (They will be kind of grayed with a red cross.)
Labels seem to have disappeared, though, so I had to go by version.
In the Source Explorer you have the normal operations again - like View History or Get.
DISCLAIMER: For reference of everyone that gets here, this answer is not fixing #Andreas problem, just giving some context on why this happens and offering a couple of workarounds.
Seems that losing history when moving folders in TFS 2010 is not a bug, is a "feature". (still happening in TFS2012. From this MSDN link you can read official Microsoft answer:
Thanks for the feedback here. The previous comment about this being by design is correct, and there is an option on the command line. In the UI, history of folders is recursive - always. This is because most of the time, users care about the history of the contents of the folder. Files on the other hand dont have the concept of recursive history - you always see the history for the file itself. Now, from the command line, there is an option to show recursive history (/r) and if you run tf history on a folder without the recursive option, you'll see the changes to the folder itself. This would include changes such as a rename for the folder itself.
Workaround to get history once lost: As you can see there, you have a workaround using tf history.
Workaround to avoid losing history: If you want to avoid losing history in folders instead of using move feature, you can use TFS Integration tool to migrate code from one folder to other preserving history, migrating from $/TFSCode/FolderA to $/TFSCode/FolderB. It is a little bit overkill but if the history is pretty important for you is much better than looking for it in deleted folders
It is true that the folder history is lost, but the individual file history is actually not lost. It is hidden under the little "expand me" arrow at the far left on a file history line. Expand it on the oldest history entry for a file, or anywhere you see it, and you will see history of that individual file also from an old location that no longer exists.
At the top of History window you can edit Source location, put the old name and get the full history before it has been moved.
Also, is good to mention that you can get the full history back by moving/rename the branch back to the old location/name.

Resources