[PATCH 2 of 2] qseries: add --edit option for editing .hg/patches/series

Mads Kiilerich mads at kiilerich.com
Wed Apr 28 18:27:44 CDT 2010


# HG changeset patch
# User Mads Kiilerich <mads at kiilerich.com>
# Date 1272496832 -7200
# Node ID 7d1aa76c8dc7e36e94c66c8fcf14b1a3f0ed0b91
# Parent  b2096a6e1d57b1c1161da46a7f9f072c33dc4add
qseries: add --edit option for editing .hg/patches/series

Users should never touch any files in .hg - with .hg/patches/series being an
exception for some common operations - such as reordering patches.

This introduces an option to edit the series, and we can thus again tell the
users that they should never touch any files in .hg.

diff --git a/hgext/mq.py b/hgext/mq.py
--- a/hgext/mq.py
+++ b/hgext/mq.py
@@ -1413,7 +1413,13 @@
         return unapplied
 
     def qseries(self, repo, missing=None, start=0, length=None, status=None,
-                summary=False):
+                summary=False, edit=False):
+        if edit:
+            edited = repo.ui.edit('\n'.join(self.full_series), '')
+            self.full_series = edited.splitlines()
+            self.parse_series()
+            self.series_dirty = True
+            return
         def displayname(pfx, patchname, state):
             if pfx:
                 self.ui.write(pfx)
@@ -1923,7 +1929,9 @@
 
 def series(ui, repo, **opts):
     """print the entire series file"""
-    repo.mq.qseries(repo, missing=opts['missing'], summary=opts['summary'])
+    repo.mq.qseries(repo, missing=opts['missing'], summary=opts['summary'],
+        edit=opts['edit'])
+    repo.mq.save_dirty()
     return 0
 
 def top(ui, repo, **opts):
@@ -2794,8 +2802,9 @@
     "qseries":
         (series,
          [('m', 'missing', None, _('print patches not in series')),
+          ('e', 'edit', None, _('edit series file manually')),
          ] + seriesopts,
-         _('hg qseries [-ms]')),
+         _('hg qseries [-mes]')),
     "strip":
         (strip,
          [('f', 'force', None, _('force removal with local changes')),


More information about the Mercurial-devel mailing list