changeset 2747:0016fc748f61

Add command qheader to display the header of a given patch.
author Brendan Cully <brendan@kublai.com>
date Mon, 31 Jul 2006 18:39:31 -0700
parents 0503eb5c0a33
children 752b9475a700
files hgext/mq.py tests/test-mq.out
diffstat 2 files changed, 18 insertions(+), 0 deletions(-) [+]
line wrap: on
line diff
--- a/hgext/mq.py	Mon Jul 31 17:55:43 2006 -0700
+++ b/hgext/mq.py	Mon Jul 31 18:39:31 2006 -0700
@@ -1289,6 +1289,21 @@
     repo.mq.diff(repo, list(files))
     return 0
 
+def header(ui, repo, patch=None):
+    """Print the header of the topmost or specified patch"""
+    q = repo.mq
+
+    if patch:
+        patch = q.lookup(patch)
+    else:
+        if not q.applied:
+            ui.write('No patches applied\n')
+            return
+        patch = q.lookup('qtip')
+    message = repo.mq.readheaders(patch)[0]
+
+    ui.write('\n'.join(message) + '\n')
+
 def lastsavename(path):
     (dir, base) = os.path.split(path)
     names = os.listdir(dir)
@@ -1447,6 +1462,8 @@
          'hg qcommit [OPTION]... [FILE]...'),
     "^qdiff": (diff, [], 'hg qdiff [FILE]...'),
     "qdelete": (delete, [], 'hg qdelete PATCH'),
+    'qheader': (header, [],
+                _('hg qheader [PATCH]')),
     "^qimport":
         (qimport,
          [('e', 'existing', None, 'import file in patch dir'),
--- a/tests/test-mq.out	Mon Jul 31 17:55:43 2006 -0700
+++ b/tests/test-mq.out	Mon Jul 31 18:39:31 2006 -0700
@@ -29,6 +29,7 @@
  qcommit      commit changes in the queue repository
  qdelete      remove a patch from the series file
  qdiff        diff of the current patch
+ qheader      Print the header of the topmost or specified patch
  qimport      import a patch
  qinit        init a new queue repository
  qnew         create a new patch