changeset 32:6a4d8718bee0

Add diffrevs function to compare two nodes
author mpm@selenic.com
date Fri, 06 May 2005 09:09:35 -0800
parents 642058291e74
children 98633e60067c
files mercurial/hg.py
diffstat 1 files changed, 21 insertions(+), 0 deletions(-) [+]
line wrap: on
line diff
--- a/mercurial/hg.py	Thu May 05 15:22:11 2005 -0800
+++ b/mercurial/hg.py	Fri May 06 09:09:35 2005 -0800
@@ -531,6 +531,27 @@
 
         return (changed, added, deleted)
 
+    def diffrevs(self, node1, node2):
+        changed, added = [], [], []
+
+        change = self.changelog.read(node1)
+        mf1 = self.manifest.read(change[0])
+        change = self.changelog.read(revs[1])
+        mf2 = self.manifest.read(change[0])
+
+        for fn in mf2:
+            if mf1.has_key(fn):
+                if mf1[fn] != mf2[fn]:
+                    changed.append(fn)
+                del mf1[fn]
+            else:
+                added.append(fn)
+                
+        deleted = mf1.keys()
+        deleted.sort()
+    
+        return (changed, added, deleted)
+
     def add(self, list):
         self.dircache.taint(list)