changeset 2779:663094f5595b

mq: make queue.unapplied useful as api
author Vadim Gelfer <vadim.gelfer@gmail.com>
date Wed, 02 Aug 2006 21:06:12 -0700
parents 871ca5b9d348
children ae726521717c
files hgext/mq.py
diffstat 1 files changed, 5 insertions(+), 6 deletions(-) [+]
line wrap: on
line diff
--- a/hgext/mq.py	Wed Aug 02 09:29:17 2006 +0200
+++ b/hgext/mq.py	Wed Aug 02 21:06:12 2006 -0700
@@ -921,10 +921,7 @@
             start = self.series_end()
         else:
             start = self.series.index(patch) + 1
-        for p in self.series[start:]:
-            if self.ui.verbose:
-                self.ui.write("%d " % self.series.index(p))
-            self.ui.write("%s\n" % p)
+        return [(i, self.series[i]) for i in xrange(start, len(self.series))]
 
     def qseries(self, repo, missing=None, summary=False):
         start = self.series_end()
@@ -1173,8 +1170,10 @@
 
 def unapplied(ui, repo, patch=None, **opts):
     """print the patches not yet applied"""
-    repo.mq.unapplied(repo, patch)
-    return 0
+    for i, p in repo.mq.unapplied(repo, patch):
+        if ui.verbose:
+            ui.write("%d " % i)
+        ui.write("%s\n" % p)
 
 def qimport(ui, repo, *filename, **opts):
     """import a patch"""