Differences between revisions 2 and 3
Revision 2 as of 2010-04-28 17:17:52
Size: 1038
Editor: mpm
Comment:
Revision 3 as of 2010-04-28 18:29:46
Size: 1250
Editor: mpm
Comment:
Deletions are marked like this. Additions are marked like this.
Line 12: Line 12:
If you need to iterate across file revisions in a "changelog-compatible" order, it may often be sufficient to do the following:

{{{
visit = range(len(fl)).sort(key=fl.linkrev)
for r in visit:
    ...
}}}

Crossed Linkrevs

When working with filelogs (and manifest logs), it is important to be aware that file revisions may not necessarily appear in an order that corresponds to the changelog. In other words, filelogs may contain "crossed linkrevs". Consider:

  • filerevs created with the same content and same parents have the same hash
  • newly-created identical files are a common instance of such
  • pull will fix up linkrevs when doing a pull where the linked rev is not included (ie on a parallel branch)
  • the file revisions come across in their original order, so an old file revision can be fixed up to point to a new cset
  • the next linkrev will probably "cross" it by pointing to an earlier revision

The filelog graph itself will continue to be topologically sorted (all ancestors before descendants) as will the changelog graph, but the orderings may be different. Thus, you cannot for instance assume that if you find a filelog with linkrev x, you have found all filelogs with linkrev < x.

If you need to iterate across file revisions in a "changelog-compatible" order, it may often be sufficient to do the following:

visit = range(len(fl)).sort(key=fl.linkrev)
for r in visit:
    ...

CategoryInternals

CrossedLinkrevs (last edited 2012-10-25 21:30:54 by mpm)