I'm wondering how I search history in TFS 2005 for any changeset that contains a change (diff) between the file and it's previous version with the word "foobar" in it.
In other words, and more specifically, I want to find the changeset that removed a subscription to an event. Clearly the change won't be in the class raising the event, and because the event subscription is now gone, I don't know where it used to be.
I can probably narrow this down to a few hundred files, but viewing their individual history and then performing a difference on each seems excessive. The TF history command, even in detailed view, only shows me file names.
tf history /format:detailed *.* /noprompt /stopafter:1
Is there an undocumented uber-detailed output that shows a diff of each file with it's previous version?
You can't do this in TFS 2005. You would have to write a program that retrieved the history for the chosen file and for each changeset in the history of the file, it would have to retrieve the version in the changeset and the previous version, and diff the two to determine the changes made and compare them with the text change sought.
Related
On one of our builds we are kicking off some automated process which is checking out and checking in some files automatically.
This all works rather well, but at this time we are running the checkin command which looks like the following
tf.exe checkin /force /comment:"foo" /noprompt /bypass /override:"bar"
All of the files with a Pending status will get checked in.
I'd like to make this script a bit more specific and only checkin the files (2 in total) which we actually change during the build, so we know for sure no files will get checked in 'by accident'.
I've already seen we can specify a single filename with the checkin command, but doing so we will get 2 different changesets in TFS, instead of 1. We would really like to have 1 changeset, containing both changed files as the changes belong to eachother.
Any ideas on how to approach this?
Minor addition / Short term solution
For the moment I've solved our 'problem' by specifying the folder where our modified files are located, which kind of looks like this
tf.exe checkin "/my/folder/location/" /recurse /force /comment:"foo" /noprompt /bypass /override:"bar"
Note the folder location and the /recurse parameter added.
You simply separate the files by spaces:
tf.exe checkin file1.ext file2.ext /force /Comment:"foo" /noprompt /bypass /override:"bar"
The documentation is not clear about this point but it might be a general specification of an itemspec that it can be multiple items.
See similar question about checkout: Is there a way to check-out multiple files from various folders in TFS in a single operation
As mentioned by others you might run into problems with the command line being longer than the system supports, in which case you might need to look at other solutions.
cmd.exe has a limit on how long a command can be. Using the version control API, or simply 'tf checkin /i' (no arguments) is likely to be a better choice than passing lots of long filenames.
It's normal if a file becomes automatically checked out due to a change, and if ultimately the contents of the file are changed back to it's original state. At that point you would see the message about identical contents upon comparison. You could also use tfpt uu /noget /r * command to ignore Files which are identical to the originals. You'll need to have TFS Power Tools installed for this to work. Note: there is no TFS Power tool 2017.
For more details please refer below two links:
Visual Studio TFS shows unchanged files in the list of pending changes
Can TFS Pending Changes show files that are truly changed like SourceGear Vault?
Using tf shelvesets, I get a list of all the the shelvesets I've created.
The problem is, they are sorted alphabetically.
Is there any way to use tf to get a list of shelvesets sorted by creation date? I want to be able to easily see the (few) most recent shelvesets I've made, as I have accumulated quite a few now, and am usually (not always) only interesting in the recently created ones.
The version as reported by tf: Team Foundation Version Control Tool, Version 15.117.26727.0
Edit: If this isn't possible with tf, I am open to alternatives that I can run from a terminal.
Update
You should be able to simply type in your user name in the Find Shelvesets window and hit Enter in Visual Studio. The result is automatically sorted by creation time. The recently created ones display at the top of the list.
Another option is using some third-party tool such as Team Foundation Sidekicks. There is a Shelveset Sidekick application , could easily filter the shelveset as you need.
It's not able to use tf shelvesets command to sort the shelveset. And unlike a changeset, a shelveset is a non-versioned entity. You need to print all info and use regex to search or some other tool to sort yourself.
tf shelvesets /format:detailed > log.txt
Detailed displays the shelveset name, owner, and comment in addition to a list of associated work items and any check-in notes.
There has also been a related user voice to better find/filter shelvesets and on backlog :
Shelveset search improvement
https://visualstudio.uservoice.com/forums/330519-visual-studio-team-services/suggestions/2037731-shelveset-search-improvement
Is it possible to view history and compare with shelvesets? We are investigating the possibility of using shelvesets instead of check-ins. From our initial investigation it seems we cannot view history like we do for check-ins.
We are using Visual Studio 2010/TFS 2010.
From http://msdn.microsoft.com/en-us/library/ms181403(v=vs.90).aspx
Section: The Difference Between Changesets and Shelvesets:
Unlike a changeset, a shelveset is a non-versioned entity. If you or another user unshelve the items of which a shelveset consists, edit several files, and reshelve the shelveset, Team Foundation does not create a new version of the items for future comparison and maintains no record of who revised the items, when, or in what manner. The original shelveset is completely replaced.
So, no, you can't review history. I am unsure on methods of comparing shelvesets. You should also read that entire section (The Difference Between Changesets and Shelvesets) as each item in it is a strong argument to not use shelvesets in the place of changesets.
I also cannot think of any reason why using shelvesets instead of changesets would be desirable, maybe you can list the reasons why you all were exploring this path. Just think about not being able to track changes, that alone should be a deal breaker (of course, shelvesets not even being versioned should just about do it)..
Like it says on the link posted by dugas, shelvesets are built more for...well, shelving things. For example, on the project I am working on right now, I did a shelveset for some refactoring changes I was in the middle of because something unrelated broke and I needed the code back to the original non error-filled version. I also use it for when I'm in the middle of attempting something and want to have a backup but I don't want to check in code just yet.
There's no versioning on shelvesets, but it is possible to compare code in a workspace, to the code in a shelveset, without pulling the shelveset files.
Pull the versions of files you want to compare the shelveset contents to, into a workspace
open the solution in that workspace
File >> Source Control >> Unshelve Pending Changes...
find the desired shelveset and bring up its details
On each file in the Shelveset Details window, you can right-click and select Compare >> With Workspace Version...
TFS will pull the shelveset file to a temporary location, show the diff, and then (?) clean up the temp file after you're done.
You'll be comparing the shelveset file contents, to the contents of the files on the local disk in this workspace. If changes were made to both files, the compare won't be able to tell and will indicate all those changes. However, you can compare the selveset version to its original (Compare >> With Unmodified Version..), to see all the changes that were made just to the shelveset file. You can also find out the changeset that was the base for the shelveset file (Properties..), and see what changes were added to the workspace version since that common base changeset.
There's no tree compare though, and this may require the TFS power tools to work.
P.S> I don't recomment trying to use shelvesets in place of checkins like this. If there's one thing I've learned over the years, it's not to fight Microsoft's designed-in workflows -- you do things their way, or you find a different tool. Microsoft doesn't intend you to use shelvesets this way (they want you to use changesets and a branch), and if you try, you'll constantly be fighting Microsoft's designed-in workflow.
You can use shelvesets for peer code-review before committing them to the repository ... and also for parking commits before going through a gated build process.
They are not suitable for anything other than "quick shelving" of work - use branching if you want to have multiple parallel work streams.
In TFS2010 each build is associated with a label by the build server.
Our SCM management wants to see all the changesets and related workitems between two labels. Mostly those labels are builds that have a build quality "Released". This way all changes between two delivered builds can be reported.
How is this done in TFS 2010 ?
I don't think you want to use the label, I think you want to use the date/time of the build(s). Labels are easily mutable and don't necessarily represent a point in time. Assuming you have the datetimes of the builds, you can use the TF.EXE command line to generate this.
For example:
tf.exe history /server:http://tfs:8080 "$/ProjectName/src" /version:D2010-09-12T11:30~D2010-09-29T11:30 /recursive /noprompt /brief
The /version: parameter is one of the keys here. This should be after the time of your first build and up to and including the time of the second build.
if you use /format:detailed, you'll get a listing of all files that changed in each of the changesets as well. This can be a lot of data. You'll probably want to redirect the output > output.txt if you do this.
UPDATE
As mentioned, you can, in fact, determine the changes between two labels. However, if these labels have moved, your results may be compromised.
tf.exe history /server:http://tfs:8080 "$/ProjectName/src" /version:LMain-CI_20100831.6~LMain-CI_20100927.1 /recursive /noprompt /brief
I would still recommend using the dates instead of the labels. I believe the results you receive from that approach probably more closely match your requirements.
UPDATE 2
I just noticed you're using TFS 2010. You will probably have to change the /server: parameter to point to the appropriate collection. Use TF.EXE history /? to get the list of parameters, but the change would be to use /collection:TeamProjectCollectionUrl
tf history /server:"http://tfsserver:8080/tfs/DefaultCollection" "$/project root/Dir/SubDir" /recursive /noprompt /format:detailed /version:"L1.1.66.0~L1.1.67.0"
Notice L prefix in version option.
I need to have several changesets rolled-up into a single list of changed files, so that I can code-review the collective differences (from an initial changeset, up through an arbitrary ending changeset), rather than reviewing all changes through the individual intervening changesets.
I'm using VS 2k8. What is the easiest way to accomplish this?
The answer is to open a Visual Studio explorer window, and type this:
tf folderdiff "$/MyStuffInSource;C88986~C91716" /recursive
That causes a window to open that shows the added, removed, changed files - and allows diffs to be launched on the individual files. Superb!!