A truly linear file history
Bob Hood
bhood2 at comcast.net
Tue Oct 22 14:37:47 UTC 2013
This is a log mining question.
I'm amusing myself by writing a utility that does a Subversion-like "blame"
mechanism for a Mercurial repository. I have it working, but I'm running into
a problem with the "hg log" command. I cannot seem to find the right
combination of command-line options to produce a fully linear file history,
running from the point of introduction (initial check-in) up to the
last/latest change. This is required in order to faithfully reconstruct the
current state of the file.
The command line I'm using is:
hg log -r "0:tip" -v -p -b default -b trunk <file>
(Note that, since we migrated from a Subversion repository to Mercurial, some
files in our repository have their complete history dating back to that SCM,
so I need to include the Subversion branch where a file might have originated
("trunk") in order to get back to the point of introduction.)
I'm running into what appear to be "gaps" in the file history. For example,
in one revision I have the introduction of a block of code in its diff:
+ for plist_filename in [ 'proj1/Info.plist',
+ 'proj2/Info.plist',
+ 'proj3/Info.plist',
+ 'proj4/Info.plist',
+ 'proj5/Info.plist',
+ 'proj6/Info.plist'
+ ]:
but then in the next delta, I have the "undocumented" introduction of new
lines to this same block:
for plist_filename in [ 'proj1/Info.plist',
'proj2/Info.plist',
'proj3/Info.plist',
+ 'proj8/Info.plist',
* 'proj10/Info.plist',**
** 'proj11**/**Info.plist',**
* - 'proj4/Info.plist',
'proj5/Info.plist',
'proj6/Info.plist'
]:
Note the two middle lines (in bold in HTML viewers). These just "magically"
appeared between revisions. I'm assuming there was some kind of merge that
added them in, but that isn't being listed in this linear log. I noticed that
this particular delta has a "parent:" tag:
changeset: 23426:17fc48a06ae4
parent: 23424:5183dd4183d3
but when I try to bring up a log for it ("hg log -r 23424"), it is empty, so
it doesn't seem like something I can pursue to fill in these gaps.
I know I'm missing something here, because there can't just be this kind of
disconnected fragmentation of a file's lineage. Is it possible to produce an
end-to-end linear history of a Mercurial file using a single command line as
I'm attempting, or do I need to "scoop in" these diversions using additional
processing?
Thanks for your insights, or any URL links that can properly edumacate me. ;)
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.mercurial-scm.org/pipermail/mercurial/attachments/20131022/9221d2ca/attachment-0002.html>
More information about the Mercurial
mailing list