Patchwork [1,of,2,standalone-strip] mq: extract strip as a standalone extension (issue3824)

mail settings
Submitter Pierre-Yves David
Date Sept. 26, 2013, 12:14 a.m.
Message ID <>
Download mbox | patch
Permalink /patch/2642/
State Superseded
Headers show


Pierre-Yves David - Sept. 26, 2013, 12:14 a.m.
On 09/26/2013 12:04 AM, Kevin Bullock wrote:
> On 25 Sep 2013, at 4:53 PM, wrote:
>> # HG changeset patch
>> # User Pierre-Yves David<>
>> # Date 1380144102 -7200
>> #      Wed Sep 25 23:21:42 2013 +0200
>> # Node ID f2d6590c1873f5d9fbd903a2ea467a19de4d4c13
>> # Parent  72982741c525e1d0b06096bc7eafc780a4f2274f
>> mq: extract strip as a standalone extension (issue3824)
>> Strip now lives in its own extension. The extension is surprisingly called `strip`.
>> The `mq` extension force the use of the strip extension when its enabled. This
>> is both necessary for backward compatibility (people expect `mq` to comes with strip) and
>> become some utility function used by `mq` are now in the strip extension.
> Per Augie's suggestion, can we see this as several patches, each moving a single function over into the new extension?

We could, but I'm not so much convinced of the benefit. More than 70% of 
the new extension content is the strip commands.

If that help you sleep, here is the diff between the mq extension 
(before extraction) and the new extension


--- /hgext/ (in parent)
+++ hgext/
@@ -1,2901 +1,18 @@ 
-# - patch queues for mercurial
-# Copyright 2005, 2006 Chris Mason <>
-# This software may be used and distributed according to the terms of the
-# GNU General Public License version 2 or any later version.
-'''manage a stack of patches
-This extension lets you work with a stack of patches in a Mercurial
-repository. It manages two stacks of patches - all known patches, and
-applied patches (subset of known patches).
-Known patches are represented as patch files in the .hg/patches
-directory. Applied patches are both patch files and changesets.
-Common tasks (use :hg:`help command` for more details)::
-  create new patch                          qnew
-  import existing patch                     qimport
-  print patch series                        qseries
-  print applied patches                     qapplied
-  add known patch to applied stack          qpush
-  remove patch from applied stack           qpop
-  refresh contents of top applied patch     qrefresh
-By default, mq will automatically use git patches when required to
-avoid losing file mode changes, copy records, binary files or empty
-files creations or deletions. This behaviour can be configured with::
-  [mq]
-  git = auto/keep/yes/no
-If set to 'keep', mq will obey the [diff] section configuration while
-preserving existing git patches upon qrefresh. If set to 'yes' or
-'no', mq will override the [diff] section and always generate git or
-regular patches, possibly losing data in the second case.
-It may be desirable for mq changesets to be kept in the secret phase (see
-:hg:`help phases`), which can be enabled with the following setting::
-  [mq]
-  secret = True
-You will by default be managing a patch queue named "patches". You can
-create other, independent patch queues with the :hg:`qqueue` command.
-If the working directory contains uncommitted files, qpush, qpop and
-qgoto abort immediately. If -f/--force is used, the changes are
-discarded. Setting::
-  [mq]
-  keepchanges = True
-make them behave as if --keep-changes were passed, and non-conflicting
-local changes will be tolerated and preserved. If incompatible options
-such as -f/--force or --exact are passed, this setting is ignored.
+"""This extension contains the strip commands.

+This extensions allows to strip changesets and all their descendants 
from the
+repository. See the command help for details.
  from mercurial.i18n import _
-from mercurial.node import bin, hex, short, nullid, nullrev
+from mercurial.node import nullid
  from mercurial.lock import release
-from mercurial import commands, cmdutil, hg, scmutil, util, revset
-from mercurial import repair, extensions, error, phases, bookmarks
-from mercurial import patch as patchmod
-from mercurial import localrepo
-from mercurial import subrepo
-import os, re, errno, shutil
-commands.norepo += " qclone"
-seriesopts = [('s', 'summary', None, _('print first line of patch 
+from mercurial import cmdutil, hg, scmutil, util
+from mercurial import repair, bookmarks

  cmdtable = {}
  command = cmdutil.command(cmdtable)
  testedwith = 'internal'

-# Patch names looks like unix-file names.
-# They must be joinable with queue directory and result in the patch path.
-normname = util.normpath

[… hundred of removed lines …]

-        q.savedirty()
-    return 0
  def checksubstate(repo, baserev=None):
      '''return list of subrepos at a different revision than substate.
      Abort if any subrepos have uncommitted changes.'''
@@ -3098,534 +215,3 @@ 
      strip(ui, repo, revs, backup=backup, update=update, 

      return 0
-         [('n', 'none', None, _('disable all guards')),

[… hundred of removed lines …]

Mercurial-devel mailing list