|
For the PowerShell
users out there, the following function (tfgrep) will
search from the current directory on down for the specified string: function tfgrepItem([string]$item,
[string]$pattern) { if (test-path
$item -Type Container) { $origDir =
get-location set-location
$item "--> $item" $items = $(tf
dir $item | tail +2) for ($ndx = 0; $ndx -lt ($items.Length - 2); $ndx++) { $leafItem
= $items[$ndx] if ($leafItem.Trim() -eq "")
{ continue } if ($leafItem[0] -eq "$") { $leafItem
= $leafItem.Substring(1) } tfgrepItem $item\$leafItem
$pattern } set-location $origDir } else { $ext = [System.IO.Path]::GetExtension($item) # You could
use "tf properties" and look at file type
to see # if it is
binary but this slows down the script considerably. if ($ext -notmatch
"^(dll)|(exe)|(lib)|(png)|(bmp)|(ico)|(jpg)|(jpeg)|(msi)|(msm)$") { select-string
-Fullname $item -Pattern $pattern -CaseSensitive | foreach
{ "{0}:{1} {2}" -f $_.Filename, $_.LineNumber, $_.Line.Trim() } } } } function tfgrep([string]$pattern) { if ($args.Length -ne 1) { "`nusage: tfgrep
<pattern>`n" return } if ($(tf dir 2>&1) -match "Unable to
determine*") { "`nThe dir `"$(get-location)`" is not mapped
to a Team Foundation project.`n" return } "Searching source in:" tfgrepItem
$(get-location) $pattern } -- From:
[EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf Of DUNN,Matthew Thanks
for your advice William, Get Latest it is :) Cheers, Matt --- From:
[EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf Of William Bartholomew Matthew, tf
history only allows you to query history and state type properties, not the
contents of the files. I don’t believe there is any equivalent of the
“Find in Files”… Don’t forget that VSS wasn’t
client/server, so to do the “Find in Files” it was actually getting
each of the files and then searching it anyway… At least with TFS it will
only get files that aren’t already in your workspace, so simply do a
“Get Latest” and use the file searching application of your choice
(such as Visual Studio).
EVOLVE 2007 - Connect. Learn. Empower. TechnologyOne
has been providing comprehensive and deeply integrated enterprise business
software solutions for over 20 years. The company develops, markets, sells, implements
and supports its own world class, fully integrated software solutions including
Financials, HR & Payroll, Supply Chain, Business Intelligence, Budgeting,
Performance Planning, Property, Student Management and Works & Assets. The
company's solution suite is based on leading edge, state of the art technology
and backed up by a substantial research and development program to ensure it
continues to provide its clients with long term security. CONFIDENTIALITY
AND LIABILITY STATEMENT TechnologyOne's
entire liability will be limited to re-supplying the material enclosed. No
other warranties are provided. TechnologyOne accepts no liability for any
damage caused by this email or its attachments due to viruses, interference,
interception corruption or unauthorised access. The
information transmitted in this email is only for the recipient referred in
this email and may contain confidential and/or privileged material. If you are
not the intended recipient (or responsible for delivery of the message to such
person), you may not copy or deliver this message to anyone. In such case any
use of, copying, review, retransmission, dissemination or other use of, or
taking of any action in reliance upon, this information by persons or entities
other than the intended recipient is prohibited. If you received this in error,
please contact the sender immediately, destroy all copies of this information
and remove the material from the system. Please also contact the sender if you
have any doubts about the authenticity of this email. TechnologyOne is not
responsible for any changes made to a document other than those made by our
company or for the effect of the changes on the documents meaning. Opinions,
conclusions and other information in this message that do not relate to the
official business of the company shall be understood as neither given nor
endorsed by it. This email (including any attachments) may also contain
computer viruses or other defects. We use virus scanning software but exclude
all liability for viruses or similar in any attachment. OUR COMMITMENT AGAINST SPAM If
you would prefer not to receive further messages from this sender, please
forward their email to [EMAIL PROTECTED].
We are against the sending of unsolicited email (SPAM) and have made every
effort within our organisation to discourage and prohibit the sending of spam.
If you believe that you have been spammed please email
[EMAIL PROTECTED] to report your complaint. From:
[EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf Of DUNN,Matthew Hello All, Is there a way to query TFS for files containing
a string (regex would be better) without retrieving the complete source tree to
my local workstation? I'm looking for the equivalent of the Find in Files
feature in VSS. The following article refers to achieving this
using the tf history command, however, I'm unsure as to how this can be done: http://blogs.msdn.com/vstsue/archive/2006/08/31/733757.aspx
Thanks, Notice: The information
contained in this email message and any attached files may be confidential
information, and may also be the subject of legal professional privilege. If
you are not the intended recipient any use, disclosure or copying of this email
is unauthorised. If you received this email in error, please notify the DEWR
Service Desk and delete all copies of this transmission together with any
attachments. OzTFS.com - to unsubscribe
from this list, send a message back to the list with 'unsubscribe' as the
subject. Powered by mailenable.com - List managed by www.readify.net OzTFS.com - to unsubscribe from this list, send a message back to the list with 'unsubscribe' as the subject. Powered by mailenable.com - List managed by www.readify.net |
Title: Querying TFS for Files Containing a String
- [OzTFS] Querying TFS for Files Containing a String DUNN,Matthew
- RE: [OzTFS] Querying TFS for Files Containing a S... William Bartholomew
- RE: [OzTFS] Querying TFS for Files Containing a S... DUNN,Matthew
- RE: [OzTFS] Querying TFS for Files Containing a S... keith_hill
