In TortoiseSVN on Windows, is there any utility that allows a user to search for text within the repo? - tortoisesvn

In TortoiseSVN on Windows, is there any utility that allows a user to search for a text string through the repo? We store a bunch of reporting SQL in SVN and would like to expedite the task of impact analysis on reports when corresponding names change etc. Not sure if all the code is within one repo or not?

If you have Cygwin installed, you can use grep to search all files in a directory.
Open up a Cygwin terminal, and change into your svn directory.
cd /cygdrive/c/pathtoSVNrepo
Then use the following command to search all files in the directory.
grep -REHni searchString .
Replace 'searchString' with your text that you would like to search for. Note that this can also be a regular expression.
The command will produce output in the format: fileName:lineNumber: lineWithMatchingText
Example output:
If you're only interseted in which files contain the string, just an 'l' to the options.
grep -REHnil searchString .

You can use OpenGrok. You will have to connect it to your svn server, but it works great in our company.

Related

How to search only in currently open files in vscode?

I usually work on larger projects with many files that would contain the search query. So I would open the files I want to modify and do a find/replace across all currently opened files. Can this be done in vs code?
The feature I'm looking for is implemented in Notepad++, but I'd prefer not to have to switch editors for this task.
For me somehow it works just by typing ./ in the files to exclude field.
The ability to search only in the open editors is in the Stable Build v1.55.
As you can see, the icon is at the end of the files to include input so you will have to have that showing (click the three dots ... just below the search options if files to include is not already showing).
"Search: target particular set of files #20530" located here: https://github.com/Microsoft/vscode/issues/20530
Is tracking a search "scope" such as "all open files".
Hit Ctrl + Shift + F and enable the icon at the end of the 'file to include' text field
I don't think there's a way to do this. You can make a feature request on github. I think an extension could do it though.
There is a checkbox for this in the "files to include" field since version 1.55 (march 2021).
The answer was already mentioned (and accepted above) indeed typing ./ in the files to exclude box of the search window will allow you to only search in open files.
However the response mentioned that he was unsure why this worked. VSCode allows you to exclude all files in a directory by writing the directory in the exclude box. The directory . is the directory where VSCode is opened ie the root directory. The filter ./ excludes all files in the VSCodes root directory so all files are excluded. However opened files ignore any exclude filter. So if you exclude all files only the opened files will be searched.
The best way to find something you are searching for within a specific file in vs code would be:
Ctrl + p then pressing # on the search bar.
It will give you a list of all functions on the file, which makes it easier to track something down.
As an alternative to using Visual Studio Code itself, you can just search the file contents within the folder where unsaved files open in Visual Studio Code are located. This would be in one of these locations depending on which OS you are running:
Linux: /tmp/ (someone else running Linux can verify this)
macOS: ~/Library/Application\ Support/Code/Backups/
Windows: %APPDATA%\Code\User\
This extension is what I use for this purpose.
You may need to change the keybinding if there is a conflict.

Getting an SVN version of a certain file

I would like to present in my GUI the SVN version of a certain file added to the project without hard-coding it each time I change something in the file and re-upload it to the SVN.
Is there a way to do that?
You need to use Subversion keywords, expressed as subversion properties on the file using the svn:keywords property. You'd set svn:keywords to Revision or Id to solve your problem. (Note that this solution updates data in the file, which is exposed when viewing or editing the file. It may or may not be shown an any particular GUI which is not a file editor.)
For more information on svn:keywords check out Special Keywords
For TortoiseSVN, right-button the file, pick TortoiseSVN, Properties, new, Keywords, and check the ones you want applied to the file.
Then, in the file, insert (in comments) the special strings $Revision$, $Id$, $Author$, etc. and Subversion will convert those into the actual data when the file is committed. Then, upon checkout, the data will appear and will be updated on the next commit.
If
your GUI can communicate with repository (i.e data is Working Copy or
you know filename-URL relation)
and
Production system has SVN-client
you can for any file-type get file-revision dynamically
svn ls -v URL (first column) or svn info URL ("Last Changed Rev" string)

Adding a current project to SVN but ignoring certain file types

I currently have a project which I want to add to SVN but I don't want to version certain file types. (e.g. .png) or a folder (images).
I know there's the svn:ignore, but this will not work if there's no .svn file in the directory which I'm trying to perform the ignore operation. I get the following errors :
property 'svn:ignore' set on '.'
svn: 'common' is not under version control
I'm looking for someone to inform me as to how to do this or direct me in the right place.
Any time I'm trying this, its like I have to add the file/directory to svn using 'svn add' and then run the ignore. I've a lot of directories and I'm looking to do this recursively also.
Is there a simple way to do this?
Set global-ignores in Subversion configuration file (normally found on Linux at ~/.subversion/config). See the manual for more info.

How do I search historic mercurial file content?

I've found an issue in my code where something used to be specified, but is no longer, so I want to search for a particular string through the history of the repository.
Is there a way to do this in TortoiseHg? I know it would take a while, but it'd take me longer...
If you don't mind working with Mercurial via the command line, there's hg grep. It's probably exposed somewhere in the TortoiseHg Workbench, but I don't know.
Menu "View" -> "Search". This will open the search pane which you can use to search for strings inside your
working copy, all history, specific revision
with inclusion file patterns
and exclusion file patterns

Search a Batch of Files for a Line of Text

I have a Mercurial Repository for a code project and I want to search all of the files, in all directories and sub-directories, for a given string. What is the best method, or program to do so?
I can conduct this search in Ubuntu Linux or a Windows environment.
Probably best to just do a checkout of the repository and use grepWin on windows, or grep on Linux.
For a simple search in the working copy, I would also use the normal grep program (I'm on Linux).
But if you want to search the history for a string, then note that Mercurial also has a hg grep function. That can be handy if you want to see when a given function, say, was introduced or removed.
If TortoiseHg is installed Search History is available in Windows Explorer context menu.

Resources