Fix bug #345.
authorBrendan Cully <brendan@kublai.com>
Fri, 18 Aug 2006 10:05:44 -0700
changeset 2931 0843bd53dcff
parent 2930 af71034aac90
child 2932 d77022db1bca
Fix bug #345. The last hit for a file might have been before the last window, so we can't clear copies. To reduce the load, we only store real copy entries instead of storing hashes for every revision.
mercurial/commands.py
--- a/mercurial/commands.py	Wed Aug 16 11:03:45 2006 -0700
+++ b/mercurial/commands.py	Fri Aug 18 10:05:44 2006 -0700
@@ -1526,7 +1526,6 @@
         if st == 'window':
             incrementing = rev
             matches.clear()
-            copies.clear()
         elif st == 'add':
             change = repo.changelog.read(repo.lookup(str(rev)))
             mf = repo.manifest.read(change[0])
@@ -1535,20 +1534,19 @@
                 if fn in skip:
                     continue
                 fstate.setdefault(fn, {})
-                copies.setdefault(rev, {})
                 try:
                     grepbody(fn, rev, getfile(fn).read(mf[fn]))
                     if follow:
                         copied = getfile(fn).renamed(mf[fn])
                         if copied:
-                            copies[rev][fn] = copied[0]
+                            copies.setdefault(rev, {})[fn] = copied[0]
                 except KeyError:
                     pass
         elif st == 'iter':
             states = matches[rev].items()
             states.sort()
             for fn, m in states:
-                copy = copies[rev].get(fn)
+                copy = copies.get(rev, {}).get(fn)
                 if fn in skip:
                     if copy:
                         skip[copy] = True
@@ -1571,7 +1569,7 @@
         for fn, state in fstate:
             if fn in skip:
                 continue
-            if fn not in copies[prev[fn]]:
+            if fn not in copies.get(prev[fn], {}):
                 display(fn, rev, {}, state)
     return (count == 0 and 1) or 0