henrik
henrik

Reputation: 1618

Is it possible to find top 10 changed file of type in perforce

In software maintenance the quality of a class can be hinted by looking at the number of changes that this file has gone through over time.

Is it possible to list top files with most revisions in perforce, given a specific file type, eg. java-file.

I've found the p4 filelog command, but the output that I want is a bit different:

# rank    filename          revisions
-------------------------------------
1         BuggyFile1.java   63       
2         BuggyFile2.java   37       
3         BuggyFile3.java   15       
4         BuggyFile4.java   14       
... aso

Any ideas how to get hold of such list?

Note: My project depot contains 15 000+ files

Upvotes: 0

Views: 162

Answers (1)

Samwise
Samwise

Reputation: 71454

Use p4 files to get the list of files and revisions, reformat the output to put the revision first, and then sort by revision in descending order:

% p4 -Ztag -F "%rev% %depotFile%" files //....java | sort -rn
63 BuggyFile1.java
37 BuggyFile2.java
15 BuggyFile3.java
14 BuggyFile4.javaj

With a little more scripting you can get it in the exact format you describe, but hopefully that simple command gives you a good starting point.

Upvotes: 3

Related Questions