IBM Synergy: Get all source code files with certain pattern in their content

199 Views Asked by At

Is it possible to use ccm query in order to get all versions of a source code file which contain a certain pattern?

For example, I would like to know in which versions of SourceCode.c contain references to a function Foo().

1

There are 1 best solutions below

0
aghast On

In general, no. In practice, mostly.

The source code is not stored in the database. As a result, you cannot simply query for arbitrary text matches.

However, the source is stored in the cache area on the server. You can use whatever text tools you want to search in that area, and mapping from source to objectid is trivial.

However-however, only the "cached" versions are stored this way. If you are regularly running clean-cache, or if you simply have a lot of versions, you will find that older code, and/or code that is in unused versions, is not in the cache. So you can "mostly" find the matches, but you will technically miss some versions that you probably don't care about anyway.

However-however-however, you can force file's source to be in the cache by ccm cat <object-descriptor>, so you can get around even that if you want.

However-however-however-however, that will tend to fill up your cache pretty quick, so you should either avoid doing that, or write a script that will clean up after itself while searching.