diff mercurial/revlog.py @ 221:2bfe525ef6ca

Beginning of multi-head support -----BEGIN PGP SIGNED MESSAGE----- Hash: SHA1 Beginning of multi-head support Add revlog.heads() Add heads command to list changeset heads manifest hash: 50df6fffe59a40c19782e2c77c8077db026fde67 -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.4.0 (GNU/Linux) iD8DBQFCn7tFywK+sNU5EO8RAusWAJ9EojIxgqEEt8VZd5S+5Laj8tHV+ACfWLb5 TC7AnsoFGg50jAWF0EsofDA= =nzyH -----END PGP SIGNATURE-----
author mpm@selenic.com
date Thu, 02 Jun 2005 18:07:01 -0800
parents 0a37e9c8ad6c
children ccbcc4d76f81
line wrap: on
line diff
--- a/mercurial/revlog.py	Thu Jun 02 17:39:29 2005 -0800
+++ b/mercurial/revlog.py	Thu Jun 02 18:07:01 2005 -0800
@@ -156,6 +156,17 @@
     def end(self, rev): return self.start(rev) + self.length(rev)
     def base(self, rev): return self.index[rev][2]
 
+    def heads(self):
+        p = {}
+        h = []
+        for r in range(self.count() - 1, 0, -1):
+            n = self.node(r)
+            if n not in p:
+                h.append(n)
+            for pn in self.parents(n):
+                p[pn] = 1
+        return h
+    
     def lookup(self, id):
         try:
             rev = int(id)