Commits

Benoit Boissinot committed 1906432

port to the latest mercurial API (future 1.1)

Comments (0)

Files changed (1)

 import textwrap
 import time
 import mercurial.commands
+import mercurial.cmdutil
 
 
 class RevNode(object):
     def read_nodes(self):
         """Read the nodes of the changelog"""
         changelog = self.repo.changelog
-        cnt = changelog.count()
-        self.nodes = [ changelog.node(i) for i in xrange(cnt) ]
+        self.nodes = [ changelog.node(i) for i in self.repo ]
         self._cache = {}
         self.authors = []
         self.branches =[]
             return self.single_diff( parents[0], node2, files )
 
     def single_diff( self, node1, node2, files ):
-        out = StringIO()
-        patch.diff( self.repo, node1=node1,
-                    node2=node2, files=files, fp=out )
-        return out.getvalue()
+        m = mercurial.cmdutil.matchfiles( self.repo, files )
+        p = patch.diff( self.repo, node1=node1, node2=node2, match=m )
+        return '\n'.join(p)
 
     def merge_diff( self, parents, node2, files ):
         s = ""
         return s
 
     def count( self ):
-        return self.repo.changelog.count()
+        return len(self.repo)
 
     def get_ops( self, udiff ):
         hunk = None