git/list[1] front-page[2] threads[3] people[4] search[5] about
 

Re: Finding file revisions

From
Daniel Barkalow <barkalow@iabervon.org>
Date
Apr 28, 2005, 16:08 UTC
Message-ID
<Pine.LNX.4.21.0504281147500.30848-100000@iabervon.org>
In-Reply-To
<200504271251.00635.mason@suse.com>
On Wed, 27 Apr 2005, Chris Mason wrote:
> 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:

What is the answer supposed to be in the presence of merges? It seems like you shouldn't report the merge that brought in the change, but rather (assuming it's available) the changeset that originally made it.

That is:
go through the history tree:
  if a commit has a parent with a different version:
    if it also has a parent with the same version as the child, ignore the
      different parent(s) and enqueue the same parent(s)
    otherwise, report it (for a single head, it's the original change; for
      a merge, it merged two changes to the file)
  otherwise, enqueue all the parents

Sorting by time is probably not useful, because there must be some source of the current version, and all paths going back, after ignoring versions that were replaced by it in a merge, must go back to that source, so depth-first search is fastest. (If there are multiple possible solutions, then it means that multiple people applied the same patch, and any of them should do).

This should be easy in C, but difficult in something that isn't generating the history info itself.

	-Daniel
*This .sig left intentionally blank*
Previous: Thomas GleixnerNext: Chris Mason
Message 24 of 25 in “Finding file revisions”
  1. Chris MasonApr 27, 2005
  2. Linus TorvaldsApr 27, 2005
  3. Chris MasonApr 27, 2005
  4. Linus TorvaldsApr 27, 2005
  5. Chris MasonApr 27, 2005
  6. Simon FowlerApr 28, 2005
  7. Chris MasonApr 28, 2005
  8. Simon FowlerApr 28, 2005
  9. Chris MasonApr 28, 2005
  10. Kay SieversApr 28, 2005
  11. Tony LuckApr 28, 2005
  12. Thomas GlanzmannApr 28, 2005
  13. Kay SieversApr 28, 2005
  14. Chris MasonApr 28, 2005
  15. Linus TorvaldsApr 28, 2005
  16. Kay SieversApr 28, 2005
  17. Linus TorvaldsApr 28, 2005
  18. Chris MasonApr 28, 2005
  19. David WoodhouseApr 28, 2005
  20. David WoodhouseApr 28, 2005
  21. Thomas GleixnerApr 27, 2005
  22. Linus TorvaldsApr 28, 2005
  23. Thomas GleixnerApr 28, 2005
  24. Daniel BarkalowApr 28, 2005
  25. Chris MasonApr 28, 2005

Read the whole thread, see it on lore, or plain text.

$ cat FOOTERMessages come from the public archive at lore.kernel.org/git, fetched every hour. The front page is chosen and written each morning by an AI editor and can be wrong; the threads themselves are the record. About and API. For agents: an MCP server at https://gitlist.dev/mcp, and any thread, story or person page as Markdown by adding .md to its URL (or sending Accept: text/markdown). Details in /llms.txt.