diff mercurial/localrepo.py @ 1550:ccb9b62de892

add a -r/--rev option to heads to show only heads descendant from rev
author Benoit Boissinot <benoit.boissinot@ens-lyon.org>
date Wed, 16 Nov 2005 12:08:25 +0100
parents 27077812fffb
children e793cbc8be00
line wrap: on
line diff
--- a/mercurial/localrepo.py	Tue Nov 15 20:35:10 2005 +0100
+++ b/mercurial/localrepo.py	Wed Nov 16 12:08:25 2005 +0100
@@ -613,8 +613,12 @@
                 self.dirstate.update([dest], "a")
             self.dirstate.copy(source, dest)
 
-    def heads(self):
-        return self.changelog.heads()
+    def heads(self, start=nullid):
+        heads = self.changelog.heads(start)
+        # sort the output in rev descending order
+        heads = [(-self.changelog.rev(h), h) for h in heads]
+        heads.sort()
+        return [n for (r, n) in heads]
 
     # branchlookup returns a dict giving a list of branches for
     # each head.  A branch is defined as the tag of a node or