diff --git a/hgext/mq.py b/hgext/mq.py --- a/hgext/mq.py +++ b/hgext/mq.py @@ -1289,6 +1289,21 @@ def diff(ui, repo, *files, **opts): 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 @@ cmdtable = { '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'), diff --git a/tests/test-mq.out b/tests/test-mq.out --- a/tests/test-mq.out +++ b/tests/test-mq.out @@ -29,6 +29,7 @@ list of commands (use "hg help -v mq" to 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