Re: Finding file revisions
- From
Linus Torvalds <torvalds@osdl.org>
- Date
- Apr 27, 2005, 17:34 UTC
- Message-ID
- <Pine.LNX.4.58.0504271027460.18901@ppc970.osdl.org>
- In-Reply-To
- <200504271251.00635.mason@suse.com>
On Wed, 27 Apr 2005, Chris Mason wrote:
Show 9 quoted lines
> > I haven't seen a tool yet to find which changeset modified a given file, so > I whipped up something. The basic idea is to: > > for each changeset in rev-list > for each file in diff-tree -r parent changeset > match against desired files > > Is there a faster way?
Yes. Tell "diff-tree" what your desired files are, and it will cut down the amount of work by a _lot_ (because then diff-tree doesn't need to recurse into subdirectories that don't matter).
So you should just do
for each changeset in rev-list do diff-tree -r parent changeset <file-list> ...
instead.
> This will scale pretty badly as the tree grows, but > I usually only want to search back a few months in the history. So, it > might make sense to limit the results by date or commit/tag.
With more history, "rev-list" should do basically the right thing: it will be constant-time for _recent_ commits, and it is linear time in how far back you want to go. Which seems quite reasonable.
And diff-tree is obviously constant-time (and very fast at that, especially if you limit it to just a few files, since then it won't even bother with any other subdirectories).
Linus