Searching for a Blame - xcode

I'm trying to find some changes I made to some code within a project. This is a team project having multiple contributors.
Is it possible to search for a particular blame within Xcode?
It would be easier for me to search via blame than to remember a particular file and line number.

Inside Xcode, open the left side menu and navigate to Source Control Navigator. You can also do this using the keyboard shortcut cmd2
In there, select the branch you're working on.
In the text box in the top right corner, start typing your version control username and press:
Author:{your-username}
This will show you all commits you have pushed to the repository. You can select a commit to see which files were changed and access the respective files directly from there.

Related

How to remove notations in xcode appearing after filename?

I'm getting text like A,M,? etc after filename in Xcode. This seems to appear after setting up project on SVN. How to remove this one?
They are source control markers
A = added
M = modified
? = not added
If you dont want them there dont create your project with source control on. Make sure the circled box isnt ticked.
Creating anything other than a discardable project without source control is going to make you sad one day.
Learn about Source Control and use it if you are serious about development.
These notations basically tells you about project's files current condition at SVN or server that is hosting your code repository and your local repository. For instance, if you add a new file/class/anything you will see 'A', if you do changes in a file you will see 'M'.
If you still want to remove these words in XCode go to :
file > source control > commit
a window will appear that shows the the changes you have done in files & press commit button. After that these words will be removed.
But wait, before doing anything read about "source control".
Atleast read about these things:
Revisions
Commits
Updates

Xcode 4.x adding new Project to a Workspace

One would think that adding a project to a Workspace in Xcode would be intuitive.
1) But when you add a new project it is added within the existing project - It must be a bug, or is there actually a reason.
2) How do you add a project then (ctr + right click et.)
You could use the plus (+) button on the lower left corner of Xcode IDE to add a new project to a workspace. You must have first a blank workspace, which you could use the menu (New/Workspaces with short cuts ^%N).
To morning I spend some time doing what you asked to. so here are the steps (you can skip if you already have followed some).
Create a new blank work space
Add a project to it by clicking File->Add new files to "Your workSpace" or "command+option+A"
Choose your project folder Or yourproject.xcodeproj file
Just let the indexing finish properly, and congratulations you have added a new project to your xcode work space successfully.
Note: Make sure that project which you are adding is not already opened, Xcode get lil sensitive about that and doesn't show files tree in workspace in that case.
My answer pertains to XCode 5, but should pertain to XCode 4 as well.
In typical Apple fashion, they have given you multiple ways to do the almost the same thing. Very confusing and annoying. There are three ways, and only one way pertains to the original posters question:
(1) Use File --> Add Files to ...
Problem with this, is that it will only add files to workspace if NO project has been selected.
Problem with THAT, is that once you select a project, there is no way I know of to unselect it.
(2) Use the "+" in the lower-left corner.
Problem with that, it is equivalent to using the pull down menu (#1 above)
(3) Right click in the left pane (in an empty area), and you will see "Add files to "
This is the only right way to do it, as it guarantees that the file will be added to the workspace, and not any selected project.
Try all three methods after selecting an existing project, and you will see what I mean.
Based on my previous experience with XCode, Apple will take about 10 more years to fix this sort of thing.
One would think that adding a project to a Workspace in Xcode would be
intuitive.
Of course not, this is Apple, only usable for certain experts...
1) But when you add a new project it is added within the existing project -
It must be a bug, or is there actually a reason
You did miss the drop down selection list "Add to:" in the last of three dialog pages, the place where the location of the .xcodeproj file is specified. There you can select the Workspace you are currently using. So simply use "File" "New..." "Project...", give it a name and select from templates, and NEVER intuitiveley double click on the directory where to place the project file, but be sure to adjust the selection drop down list to your currently open workspace. Of course this choice is never preselected.

How can I see the change log of a directory with TFS?

I'm interested in seeing the latest changes that landed to a solution with TFS (I'm using Visual Studio). However, I can't seem to find the option: using View History on a solution or project brings up the history of the file itself. Am I missing something?
If you right click on folder the containing a solution in the Source Control Explorer window you'll see all changesets. It's obvious but I had to ask for it too. I am using TFS2010/VS2010.
Edit
Here are the steps:
Team/Connect to Team Foundation Server / select Team Project/ in Team Explorer dblclick on Source Control and in Source Control Explore right click folder containing your solution select View History and here you are.
The View History command will list you all the changesets where the file/directory was changed (add/move/content changed, deleted, etc.).
So if you do a View History on a .sln or .csproj file you'll see only the changes that were made inside the file's content, not on the "Visual Studio Item" and its related item.
To sum up, the View History command is only a File System history, there's not a smarter logic out there.
EDIT
The only way to know what changed inside a solution or project is to do a View History on the common denominator (i.e. the directory that contains everything you want to view history). But it'll still be a File System kind of History.
There's not Logical History for Solution and Projects in Visual Studio. For instance you can't know what files where added to a given project your viewing the history from two given versions. Or what projects were added/removed in the solution.
All the pieces are there (because all the changes are stored in the .csproj or .sln), but the feature itself that parses the content and retrieve the logic you want to see doesn't exist. (by the way, it's a great feature and I agree it should be there).
Bottom line: TFS/Visual Studio gives you two history system:
Based on the source control/file system, by displaying changesets.
Based on the source control/file system, by displaying labels.
That's all...
Right click on folder in solution explorer, and choose View History. Then you can see all the Changesets listed that apply to that directory. Then right click a particular changeset and choose Changeset details... to see what changes occurred in that changeset.

TFS 2010: Seeing and comparing changes after getting latest

When I get latest from TFS source control, I don't see the changes made to my workspace.
I know I can go to the Output window and see the changes, but this is just a text list with no context actions.
What I really want is to see a list of changes, with the ability to right-click a file and see differences straight away.
Is there a better, alternative way to see changes like this after getting latest?
Sounds like using the command line tool tf.exe with folderdiff command would achieve what you need.
Use the folderdiff command to display
and compare a visual representation of
the differences between files in two
server folders, in a server folder and
a local folder, or in two local
folders.
From the header toolbar click the "Find Chengsets" option (it is between History and Branch options), it will open a dialog box, on that fill your required attributes and click Find button on that dialog box.

How easy is it to roll back a file that has been checked-in in TFS?

I've (apparently) checked-in (added) a file that shouldn't have been added to a branch. I need to revert this, but since then, 20 or so changesets have been added to the repository.
I'm used to working with Subversion, where it's only a few clicks and it's out. How easy is it in TFS?
TFS is a pain to use in general (personal and biased opinion). Here's a how-to article from Microsoft on how to proceed to revert changes back (warning: more than a few clicks away).
As given in that article, the steps to revert to a prior version of (a) file(s) are:
In Source Control Explorer, right-click the file whose changeset you want to roll back, and then click Get specific version on the
context menu.
In the Get dialog box, select the prior version of the file, and then click Get. For more information, see How to: Retrieve
Old Versions of Files from
Changesets.
After this file is in your workspace, right-click the file, and then click Check Out for Edit on the context menu.
Right-click the file again, and then click Check In Pending Changes.
In the Check In - Source Files dialog box, select the file, and then click Check in.
The Resolve Conflicts dialog box appears.
Click Resolve to open the Resolve version conflict dialog box.
Select Discard server changes.
Click OK.
NOTE: To review your decision before discarding the server changes, you can click Compare to view the server and local copies
simultaneously.
In the Resolve Conflicts dialog box, click Close.
In Source Control Explorer, right-click the file, and then click Check In Pending Changes.
In the Check In - Source Files dialog box, click Check in.
As #Darin has posted, you can simply Get the state of the previous version/changeset onto your PC and then check it in as a new version, thus undoing the effect of the check in. This is dead easy and can be done from the GUI, but does involve a fair bit of faffing around.
If you're happy to use the command line, you can also command TFS to rollback the changeset for you. This does all the "work" of the above option, leaving you with a changeset in your pending changes that will undo the checkin's effect, but hopefully with a bit less effort.
If it is added by mistake, you don't want to roll back. Instead, you want to tf destroy (from the command line) that file in each of the branches.
TFS can be a bear to work with if you add a file, delete it, then re-add a new file with the same name. It makes merging much more difficult.

Resources