diff mercurial/cmdutil.py @ 12972:7916a84c0758 stable

log: fix log -rREV FILE when REV isnt the last filerev (issue2492) Regression from 99cafcae25d9. That previous commit is not supposed to affect log calls without --follow, so we step out of this codepath if follow is not True, and it's enough to fix the regression. When --follow is given, we fix the issue by taking into account changesets that have a rev > maxrev to build the filegraph: even if those files are not included in the final result, it's still needed to walk correctly the graph from the end of the filelog to minrev, to track accurately renames.
author Nicolas Dumazet <nicdumz.commits@gmail.com>
date Thu, 11 Nov 2010 02:10:37 +0900
parents 15390d1a3cfc
children 6e0a9f9227bd
line wrap: on
line diff
--- a/mercurial/cmdutil.py	Thu Nov 11 02:05:02 2010 +0900
+++ b/mercurial/cmdutil.py	Thu Nov 11 02:10:37 2010 +0900
@@ -1180,11 +1180,20 @@
 
             # iterate from latest to oldest revision
             for rev, flparentlinkrevs, copied in filerevgen(filelog, last):
-                if rev > maxrev or rev not in ancestors:
-                    continue
-                # XXX insert 1327 fix here
-                if flparentlinkrevs:
-                    ancestors.update(flparentlinkrevs)
+                if not follow:
+                    if rev > maxrev:
+                        continue
+                else:
+                    # Note that last might not be the first interesting
+                    # rev to us:
+                    # if the file has been changed after maxrev, we'll
+                    # have linkrev(last) > maxrev, and we still need
+                    # to explore the file graph
+                    if rev not in ancestors:
+                        continue
+                    # XXX insert 1327 fix here
+                    if flparentlinkrevs:
+                        ancestors.update(flparentlinkrevs)
 
                 fncache.setdefault(rev, []).append(file_)
                 wanted.add(rev)