diff mercurial/patch.py @ 7090:7b5c063b0b94

diff: pass contexts to status Allow status() to take contexts as well as nodes. This lets us avoid unpacking manifests multiple times and intelligently unpack manifests in revision order. Also, we can avoid unpacking manifests at all when there are no changes in the working directory.
author Matt Mackall <mpm@selenic.com>
date Sun, 12 Oct 2008 15:21:08 -0500
parents 63b5f4c73c98
children 4674706b5b95
line wrap: on
line diff
--- a/mercurial/patch.py	Sun Oct 12 15:21:08 2008 -0500
+++ b/mercurial/patch.py	Sun Oct 12 15:21:08 2008 -0500
@@ -1174,21 +1174,18 @@
             flcache[f] = flctx._filelog
         return flctx
 
-    # reading the data for node1 early allows it to play nicely
-    # with repo.status and the revlog cache.
     ctx1 = repo[node1]
-    # force manifest reading
-    man1 = ctx1.manifest()
-    date1 = util.datestr(ctx1.date())
+    ctx2 = repo[node2]
 
     if not changes:
-        changes = repo.status(node1, node2, match=match)
+        changes = repo.status(ctx1, ctx2, match=match)
     modified, added, removed = changes[:3]
 
     if not modified and not added and not removed:
         return
 
-    ctx2 = repo[node2]
+    date1 = util.datestr(ctx1.date())
+    man1 = ctx1.manifest()
 
     if repo.ui.quiet:
         r = None