Patchwork D6987: strip: move strip extension to core

login
register
mail settings
Submitter phabricator
Date Oct. 6, 2019, 5:59 p.m.
Message ID <86f7ae50aea71a99945b1b2f93dc7446@localhost.localdomain>
Download mbox | patch
Permalink /patch/42038/
State Not Applicable
Headers show

Comments

phabricator - Oct. 6, 2019, 5:59 p.m.
navaneeth.suresh updated this revision to Diff 16914.

REPOSITORY
  rHG Mercurial

CHANGES SINCE LAST UPDATE
  https://phab.mercurial-scm.org/D6987?vs=16856&id=16914

CHANGES SINCE LAST ACTION
  https://phab.mercurial-scm.org/D6987/new/

REVISION DETAIL
  https://phab.mercurial-scm.org/D6987

AFFECTED FILES
  hgext/mq.py
  hgext/strip.py
  mercurial/debugcommands.py
  mercurial/strip.py
  tests/remotefilelog-library.sh
  tests/test-backout.t
  tests/test-blackbox.t
  tests/test-bookmarks-pushpull.t
  tests/test-bookmarks-strip.t
  tests/test-bookmarks.t
  tests/test-branches.t
  tests/test-bundle-phases.t
  tests/test-commandserver.t
  tests/test-completion.t
  tests/test-convert-filemap.t
  tests/test-convert-svn-sink.t
  tests/test-copy-move-merge.t
  tests/test-debugcommands.t
  tests/test-debugstrip.t
  tests/test-exchange-obsmarkers-case-D1.t
  tests/test-exchange-obsmarkers-case-D2.t
  tests/test-exchange-obsmarkers-case-D3.t
  tests/test-extension.t
  tests/test-flagprocessor.t
  tests/test-generaldelta.t
  tests/test-graft.t
  tests/test-help.t
  tests/test-hgweb-bundle.t
  tests/test-histedit-arguments.t
  tests/test-histedit-edit.t
  tests/test-histedit-obsolete.t
  tests/test-hook.t
  tests/test-import-bypass.t
  tests/test-import-merge.t
  tests/test-import.t
  tests/test-keyword.t
  tests/test-lfs.t
  tests/test-mq-qpush-exact.t
  tests/test-mq.t
  tests/test-narrow-strip.t
  tests/test-obsolete-changeset-exchange.t
  tests/test-obsolete.t
  tests/test-phase-archived.t
  tests/test-phases-exchange.t
  tests/test-phases.t
  tests/test-pull-update.t
  tests/test-push-http.t
  tests/test-push.t
  tests/test-rebase-abort.t
  tests/test-rebase-cache.t
  tests/test-rebase-collapse.t
  tests/test-rebase-inmemory.t
  tests/test-remotefilelog-bgprefetch.t
  tests/test-remotefilelog-bundles.t
  tests/test-remotefilelog-linknodes.t
  tests/test-remotefilelog-local.t
  tests/test-remotefilelog-prefetch.t
  tests/test-remotefilelog-push-pull.t
  tests/test-remotefilelog-repack-fast.t
  tests/test-remotefilelog-repack.t
  tests/test-remotefilelog-sparse.t
  tests/test-repair-strip.t
  tests/test-shelve.t
  tests/test-shelve2.t
  tests/test-single-head.t
  tests/test-sparse-clear.t
  tests/test-sparse-clone.t
  tests/test-sparse-fsmonitor.t
  tests/test-sparse-import.t
  tests/test-sparse-merges.t
  tests/test-sparse-profiles.t
  tests/test-sparse-verbose-json.t
  tests/test-sparse.t
  tests/test-ssh-proto-unbundle.t
  tests/test-strip.t
  tests/test-subrepo-missing.t
  tests/test-subrepo.t
  tests/test-tags.t
  tests/test-template-map.t
  tests/test-transplant.t
  tests/test-treemanifest.t
  tests/testlib/exchange-obsmarker-util.sh
  tests/testlib/push-checkheads-util.sh

CHANGE DETAILS




To: navaneeth.suresh, durin42, #hg-reviewers
Cc: mjpieters, mercurial-devel

Patch

diff --git a/tests/testlib/push-checkheads-util.sh b/tests/testlib/push-checkheads-util.sh
--- a/tests/testlib/push-checkheads-util.sh
+++ b/tests/testlib/push-checkheads-util.sh
@@ -9,10 +9,6 @@ 
 # non publishing server
 publish=False
 
-[extensions]
-# we need to strip some changeset for some test cases
-strip=
-
 [experimental]
 # enable evolution
 evolution=all
diff --git a/tests/testlib/exchange-obsmarker-util.sh b/tests/testlib/exchange-obsmarker-util.sh
--- a/tests/testlib/exchange-obsmarker-util.sh
+++ b/tests/testlib/exchange-obsmarker-util.sh
@@ -28,10 +28,6 @@ 
 # enable evolution
 evolution=true
 
-[extensions]
-# we need to strip some changeset for some test cases
-hgext.strip=
-
 [devel]
 strip-obsmarkers = no
 
diff --git a/tests/test-treemanifest.t b/tests/test-treemanifest.t
--- a/tests/test-treemanifest.t
+++ b/tests/test-treemanifest.t
@@ -316,7 +316,7 @@ 
 
   $ hg st --change tip
   M dir1/a
-  $ hg --config extensions.strip= strip tip
+  $ hg debugstrip tip
   1 files updated, 0 files merged, 0 files removed, 0 files unresolved
   saved backup bundle to $TESTTMP/repo-mixed/.hg/strip-backup/51cfd7b1e13b-78a2f3ed-backup.hg
   $ hg debugindex --dir dir1
@@ -343,7 +343,7 @@ 
   added 1 changesets with 1 changes to 1 files
   new changesets 51cfd7b1e13b (1 drafts)
   (run 'hg update' to get a working copy)
-  $ hg --config extensions.strip= strip tip
+  $ hg debugstrip tip
   saved backup bundle to $TESTTMP/repo-mixed/.hg/strip-backup/*-backup.hg (glob)
   $ hg unbundle -q .hg/strip-backup/*
   $ hg debugindex --dir dir1
@@ -897,4 +897,4 @@ 
   $ hg log -r 'tip + tip^' -T '{manifest}\n'
   1:678d3574b88c
   1:678d3574b88c
-  $ hg --config extensions.strip= strip -r . -q
+  $ hg debugstrip -r . -q
diff --git a/tests/test-transplant.t b/tests/test-transplant.t
--- a/tests/test-transplant.t
+++ b/tests/test-transplant.t
@@ -647,7 +647,7 @@ 
 
 test "--merge" causing pull from source repository on local host
 
-  $ hg --config extensions.mq= -q strip 2
+  $ hg --config extensions.mq= -q debugstrip 2
   $ hg transplant -s ../t --merge tip
   searching for changes
   searching for changes
@@ -660,7 +660,7 @@ 
 
 test interactive transplant
 
-  $ hg --config extensions.strip= -q strip 0
+  $ hg -q debugstrip 0
   $ hg -R ../t log -G --template "{rev}:{node|short}"
   @  4:a53251cdf717
   |
diff --git a/tests/test-template-map.t b/tests/test-template-map.t
--- a/tests/test-template-map.t
+++ b/tests/test-template-map.t
@@ -294,7 +294,7 @@ 
 Remove commit with empty commit message, so as to not pollute further
 tests.
 
-  $ hg --config extensions.strip= strip -q .
+  $ hg debugstrip -q .
 
 Revision with no copies (used to print a traceback):
 
diff --git a/tests/test-tags.t b/tests/test-tags.t
--- a/tests/test-tags.t
+++ b/tests/test-tags.t
@@ -407,7 +407,7 @@ 
   $ f --size .hg/cache/hgtagsfnodes1
   .hg/cache/hgtagsfnodes1: size=168
 
-  $ hg -q --config extensions.strip= strip -r 6 --no-backup
+  $ hg -q debugstrip -r 6 --no-backup
 #endif
 
 Stripping doesn't truncate the tags cache until new data is available
@@ -420,7 +420,7 @@ 
   $ f --size .hg/cache/hgtagsfnodes1
   .hg/cache/hgtagsfnodes1: size=144
 
-  $ hg -q --config extensions.strip= strip -r 5 --no-backup
+  $ hg -q debugstrip -r 5 --no-backup
   $ hg tags
   tip                                4:0c192d7d5e6b
   bar                                1:78391a272241
@@ -452,7 +452,7 @@ 
   $ f --size .hg/cache/hgtagsfnodes1
   .hg/cache/hgtagsfnodes1: size=144
 
-  $ hg -q --config extensions.strip= strip -r 5 --no-backup
+  $ hg -q debugstrip -r 5 --no-backup
 
 Test tag removal:
 
@@ -541,7 +541,7 @@ 
 
 Strip 1: expose an old head:
 
-  $ hg --config extensions.mq= strip 5
+  $ hg --config extensions.mq= debugstrip 5
   saved backup bundle to $TESTTMP/t3/.hg/strip-backup/*-backup.hg (glob)
   $ hg tags                  # partly stale cache
   tip                                5:735c3ca72986
@@ -552,7 +552,7 @@ 
 
 Strip 2: destroy whole branch, no old head exposed
 
-  $ hg --config extensions.mq= strip 4
+  $ hg --config extensions.mq= debugstrip 4
   saved backup bundle to $TESTTMP/t3/.hg/strip-backup/*-backup.hg (glob)
   $ hg tags                  # partly stale
   tip                                4:735c3ca72986
diff --git a/tests/test-subrepo.t b/tests/test-subrepo.t
--- a/tests/test-subrepo.t
+++ b/tests/test-subrepo.t
@@ -465,11 +465,7 @@ 
 
   $ hg co -C 10
   2 files updated, 0 files merged, 0 files removed, 0 files unresolved
-  $ cat >> $HGRCPATH <<EOF
-  > [extensions]
-  > strip=
-  > EOF
-  $ hg strip -r 11:15
+  $ hg debugstrip -r 11:15
   saved backup bundle to $TESTTMP/t/.hg/strip-backup/*-backup.hg (glob)
 
 clone
diff --git a/tests/test-subrepo-missing.t b/tests/test-subrepo-missing.t
--- a/tests/test-subrepo-missing.t
+++ b/tests/test-subrepo-missing.t
@@ -108,7 +108,7 @@ 
 verify will warn if locked-in subrepo revisions are hidden or missing
 
   $ hg ci -m "amended subrepo (again)"
-  $ hg --config extensions.strip= --hidden strip -R subrepo -qr 'tip' --config devel.strip-obsmarkers=no
+  $ hg --hidden debugstrip -R subrepo -qr 'tip' --config devel.strip-obsmarkers=no
   $ hg verify
   checking changesets
   checking manifests
diff --git a/tests/test-ssh-proto-unbundle.t b/tests/test-ssh-proto-unbundle.t
--- a/tests/test-ssh-proto-unbundle.t
+++ b/tests/test-ssh-proto-unbundle.t
@@ -11,13 +11,13 @@ 
   >   tip=`hg log -r tip -T '{node}'`
   >   echo "${commands}" | hg --verbose debugwireproto --localssh --noreadstderr
   >   if [ -n "$1" ]; then
-  >       hg --config extensions.strip= strip --no-backup -r "all() - ::${tip}"
+  >       hg debugstrip --no-backup -r "all() - ::${tip}"
   >   fi
   >   echo ""
   >   echo 'testing ssh2'
   >   echo "${commands}" | HGRCPATH=$TESTTMP/hgrc-sshv2 hg --verbose debugwireproto --localssh --noreadstderr
   >   if [ -n "$1" ]; then
-  >       hg --config extensions.strip= strip --no-backup -r "all() - ::${tip}"
+  >       hg debugstrip --no-backup -r "all() - ::${tip}"
   >   fi
   > }
 
diff --git a/tests/test-sparse.t b/tests/test-sparse.t
--- a/tests/test-sparse.t
+++ b/tests/test-sparse.t
@@ -5,7 +5,6 @@ 
   $ cat > .hg/hgrc <<EOF
   > [extensions]
   > sparse=
-  > strip=
   > EOF
 
   $ echo a > show
@@ -260,7 +259,7 @@ 
    show2 |  1 +
    4 files changed, 4 insertions(+), 2 deletions(-)
   
-  $ hg strip -r . -k
+  $ hg debugstrip -r . -k
   saved backup bundle to $TESTTMP/myrepo/.hg/strip-backup/39278f7c08a9-ce59e002-backup.hg
   $ hg status
   M show
diff --git a/tests/test-sparse-verbose-json.t b/tests/test-sparse-verbose-json.t
--- a/tests/test-sparse-verbose-json.t
+++ b/tests/test-sparse-verbose-json.t
@@ -5,7 +5,6 @@ 
   $ cat > .hg/hgrc <<EOF
   > [extensions]
   > sparse=
-  > strip=
   > EOF
 
   $ echo a > show
diff --git a/tests/test-sparse-profiles.t b/tests/test-sparse-profiles.t
--- a/tests/test-sparse-profiles.t
+++ b/tests/test-sparse-profiles.t
@@ -6,7 +6,6 @@ 
   > [extensions]
   > sparse=
   > purge=
-  > strip=
   > rebase=
   > EOF
 
@@ -167,7 +166,7 @@ 
 
 Verify stripping refreshes dirstate
 
-  $ hg strip -q -r .
+  $ hg debugstrip -q -r .
   $ ls
   backend.sparse
   index.html
diff --git a/tests/test-sparse-merges.t b/tests/test-sparse-merges.t
--- a/tests/test-sparse-merges.t
+++ b/tests/test-sparse-merges.t
@@ -49,7 +49,7 @@ 
 Test merging things outside of the sparse checkout that are not in the working
 copy
 
-  $ hg strip -q -r . --config extensions.strip=
+  $ hg debugstrip -q -r .
   $ hg up -q feature
   $ touch branchonly
   $ hg ci -Aqm 'add branchonly'
diff --git a/tests/test-sparse-import.t b/tests/test-sparse-import.t
--- a/tests/test-sparse-import.t
+++ b/tests/test-sparse-import.t
@@ -6,7 +6,6 @@ 
   > [extensions]
   > sparse=
   > purge=
-  > strip=
   > rebase=
   > EOF
 
diff --git a/tests/test-sparse-fsmonitor.t b/tests/test-sparse-fsmonitor.t
--- a/tests/test-sparse-fsmonitor.t
+++ b/tests/test-sparse-fsmonitor.t
@@ -9,7 +9,6 @@ 
   $ cat > .hg/hgrc <<EOF
   > [extensions]
   > sparse=
-  > strip=
   > EOF
 
 Test fsmonitor integration (if available)
diff --git a/tests/test-sparse-clone.t b/tests/test-sparse-clone.t
--- a/tests/test-sparse-clone.t
+++ b/tests/test-sparse-clone.t
@@ -7,7 +7,6 @@ 
   > [extensions]
   > sparse=
   > purge=
-  > strip=
   > rebase=
   > EOF
 
diff --git a/tests/test-sparse-clear.t b/tests/test-sparse-clear.t
--- a/tests/test-sparse-clear.t
+++ b/tests/test-sparse-clear.t
@@ -6,7 +6,6 @@ 
   > [extensions]
   > sparse=
   > purge=
-  > strip=
   > rebase=
   > EOF
 
diff --git a/tests/test-single-head.t b/tests/test-single-head.t
--- a/tests/test-single-head.t
+++ b/tests/test-single-head.t
@@ -197,7 +197,7 @@ 
 
 actual stripping
 
-  $ hg strip --config extensions.strip= --rev 'desc("c_dH0")'
+  $ hg debugstrip --rev 'desc("c_dH0")'
   saved backup bundle to $TESTTMP/client/.hg/strip-backup/fe47ea669cea-a41bf5a9-backup.hg
 
 Test that closing heads are ignored by default
diff --git a/tests/test-shelve2.t b/tests/test-shelve2.t
--- a/tests/test-shelve2.t
+++ b/tests/test-shelve2.t
@@ -868,7 +868,7 @@ 
 
   $ cat .hg/shelved/default.shelve
   node=82e0cb9893247d12667017593ce1e5655860f1ac
-  $ hg strip --hidden --rev 82e0cb989324 --no-backup
+  $ hg debugstrip --hidden --rev 82e0cb989324 --no-backup
   $ rm .hg/shelved/default.shelve
   $ hg unshelve
   unshelving change 'default'
diff --git a/tests/test-shelve.t b/tests/test-shelve.t
--- a/tests/test-shelve.t
+++ b/tests/test-shelve.t
@@ -149,7 +149,7 @@ 
 cleaning the branches made for name checking tests
 
   $ hg up default -q
-  $ hg strip e9177275307e+6a6d231f43d+882bae7c62c2 -q
+  $ hg debugstrip e9177275307e+6a6d231f43d+882bae7c62c2 -q
 
 create an mq patch - shelving should work fine with a patch applied
 
diff --git a/tests/test-repair-strip.t b/tests/test-repair-strip.t
--- a/tests/test-repair-strip.t
+++ b/tests/test-repair-strip.t
@@ -15,7 +15,7 @@ 
   >   echo % before update $1, strip $2
   >   hg parents
   >   chmod -$3 $4
-  >   hg strip $2 2>&1 | sed 's/\(bundle\).*/\1/' | sed 's/Permission denied.*\.hg\/store\/\(.*\)/Permission denied \.hg\/store\/\1/'
+  >   hg debugstrip $2 2>&1 | sed 's/\(bundle\).*/\1/' | sed 's/Permission denied.*\.hg\/store\/\(.*\)/Permission denied \.hg\/store\/\1/'
   >   echo % after update $1, strip $2
   >   chmod +$3 $4
   >   hg verify
diff --git a/tests/test-remotefilelog-sparse.t b/tests/test-remotefilelog-sparse.t
--- a/tests/test-remotefilelog-sparse.t
+++ b/tests/test-remotefilelog-sparse.t
@@ -46,7 +46,7 @@ 
 # prefetch sparse only on pull when configured
 
   $ printf "[remotefilelog]\npullprefetch=bookmark()\n" >> .hg/hgrc
-  $ hg strip tip
+  $ hg debugstrip tip
   saved backup bundle to $TESTTMP/shallow/.hg/strip-backup/876b1317060d-b2e91d8d-backup.hg (glob)
 
   $ hg debugsparse --delete z
diff --git a/tests/test-remotefilelog-repack.t b/tests/test-remotefilelog-repack.t
--- a/tests/test-remotefilelog-repack.t
+++ b/tests/test-remotefilelog-repack.t
@@ -249,10 +249,10 @@ 
   Node          P1 Node       P2 Node       Link Node     Copy From
   577959738234  1bb2e6237e03  000000000000  c7faf2fc439a  x
   21f46f2721e7  000000000000  000000000000  d6868642b790  
-  $ hg strip -r '.^'
+  $ hg debugstrip -r '.^'
   1 files updated, 0 files merged, 1 files removed, 0 files unresolved
   saved backup bundle to $TESTTMP/shallow/.hg/strip-backup/609547eda446-b26b56a8-backup.hg (glob)
-  $ hg -R ../master strip -r '.^'
+  $ hg -R ../master debugstrip -r '.^'
   1 files updated, 0 files merged, 1 files removed, 0 files unresolved
   saved backup bundle to $TESTTMP/master/.hg/strip-backup/609547eda446-b26b56a8-backup.hg (glob)
 
diff --git a/tests/test-remotefilelog-repack-fast.t b/tests/test-remotefilelog-repack-fast.t
--- a/tests/test-remotefilelog-repack-fast.t
+++ b/tests/test-remotefilelog-repack-fast.t
@@ -239,10 +239,10 @@ 
   Node          P1 Node       P2 Node       Link Node     Copy From
   577959738234  1bb2e6237e03  000000000000  c7faf2fc439a  x
   21f46f2721e7  000000000000  000000000000  d6868642b790  
-  $ hg strip -r '.^'
+  $ hg debugstrip -r '.^'
   1 files updated, 0 files merged, 1 files removed, 0 files unresolved
   saved backup bundle to $TESTTMP/shallow/.hg/strip-backup/609547eda446-b26b56a8-backup.hg (glob)
-  $ hg -R ../master strip -r '.^'
+  $ hg -R ../master debugstrip -r '.^'
   1 files updated, 0 files merged, 1 files removed, 0 files unresolved
   saved backup bundle to $TESTTMP/master/.hg/strip-backup/609547eda446-b26b56a8-backup.hg (glob)
 
diff --git a/tests/test-remotefilelog-push-pull.t b/tests/test-remotefilelog-push-pull.t
--- a/tests/test-remotefilelog-push-pull.t
+++ b/tests/test-remotefilelog-push-pull.t
@@ -78,7 +78,7 @@ 
 
 # pull from shallow to shallow (ssh)
 
-  $ hg strip -r 1
+  $ hg debugstrip -r 1
   saved backup bundle to $TESTTMP/shallow2/.hg/strip-backup/d34c38483be9-89d325c9-backup.hg (glob)
   $ hg pull ssh://user@dummy/$TESTTMP/shallow --config remotefilelog.cachepath=${CACHEDIR}2
   pulling from ssh://user@dummy/$TESTTMP/shallow
@@ -96,8 +96,8 @@ 
   $ cat z
   z
 
-  $ hg -R ../shallow strip -qr 3
-  $ hg strip -qr 3
+  $ hg -R ../shallow debugstrip -qr 3
+  $ hg debugstrip -qr 3
   $ cd ..
 
 # push from shallow to shallow
diff --git a/tests/test-remotefilelog-prefetch.t b/tests/test-remotefilelog-prefetch.t
--- a/tests/test-remotefilelog-prefetch.t
+++ b/tests/test-remotefilelog-prefetch.t
@@ -84,7 +84,7 @@ 
 # prefetch on pull when configured
 
   $ printf "[remotefilelog]\npullprefetch=bookmark()\n" >> .hg/hgrc
-  $ hg strip tip
+  $ hg debugstrip tip
   saved backup bundle to $TESTTMP/shallow/.hg/strip-backup/109c3a557a73-3f43405e-backup.hg (glob)
 
   $ clearcache
@@ -106,7 +106,7 @@ 
 
 # prefetch only fetches changes not in working copy
 
-  $ hg strip tip
+  $ hg debugstrip tip
   1 files updated, 0 files merged, 1 files removed, 0 files unresolved
   saved backup bundle to $TESTTMP/shallow/.hg/strip-backup/109c3a557a73-3f43405e-backup.hg (glob)
   1 files fetched over 1 fetches - (1 misses, 0.00% hit ratio) over *s (glob)
@@ -131,7 +131,7 @@ 
 
   $ hg prefetch -r 'all()'
   2 files fetched over 1 fetches - (2 misses, 0.00% hit ratio) over *s (glob)
-  $ hg strip -q -r 0
+  $ hg debugstrip -q -r 0
   $ echo x > x
   $ echo z > z
   $ hg commit -qAm x
@@ -142,7 +142,7 @@ 
 # prefetch server versions, even if local versions are available
 
   $ clearcache
-  $ hg strip -q tip
+  $ hg debugstrip -q tip
   $ hg pull
   pulling from ssh://user@dummy/master
   searching for changes
diff --git a/tests/test-remotefilelog-local.t b/tests/test-remotefilelog-local.t
--- a/tests/test-remotefilelog-local.t
+++ b/tests/test-remotefilelog-local.t
@@ -83,7 +83,7 @@ 
 
 # restore state for future tests
 
-  $ hg -q strip .
+  $ hg -q debugstrip .
   $ hg -q up tip
 
 # rebase
@@ -113,7 +113,7 @@ 
 
   $ clearcache
   $ hg debugrebuilddirstate # fixes dirstate non-determinism
-  $ hg strip -r .
+  $ hg debugstrip -r .
   2 files updated, 0 files merged, 1 files removed, 0 files unresolved
   saved backup bundle to $TESTTMP/shallow/.hg/strip-backup/19edf50f4de7-df3d0f74-backup.hg (glob)
   4 files fetched over 2 fetches - (4 misses, 0.00% hit ratio) over *s (glob)
@@ -189,7 +189,7 @@ 
   3 files updated, 0 files merged, 0 files removed, 0 files unresolved
   (branch merge, don't forget to commit)
   $ hg commit -m merge
-  $ hg strip -q -r ".^"
+  $ hg debugstrip -q -r ".^"
 
 # commit without producing new node
 
diff --git a/tests/test-remotefilelog-linknodes.t b/tests/test-remotefilelog-linknodes.t
--- a/tests/test-remotefilelog-linknodes.t
+++ b/tests/test-remotefilelog-linknodes.t
@@ -100,7 +100,7 @@ 
 # system cache has invalid linknode, but .hg/store/data has valid
 
   $ cd shallow
-  $ hg strip -r 1 -q
+  $ hg debugstrip -r 1 -q
   $ rm -rf .hg/store/data/*
   $ echo x >> x
   $ hg commit -Aqm xx_local
diff --git a/tests/test-remotefilelog-bundles.t b/tests/test-remotefilelog-bundles.t
--- a/tests/test-remotefilelog-bundles.t
+++ b/tests/test-remotefilelog-bundles.t
@@ -23,7 +23,7 @@ 
 
 Unbundling a shallow bundle
 
-  $ hg strip -r 66ee28d0328c
+  $ hg debugstrip -r 66ee28d0328c
   1 files updated, 0 files merged, 0 files removed, 0 files unresolved
   saved backup bundle to $TESTTMP/shallow/.hg/strip-backup/66ee28d0328c-3d7aafd1-backup.hg (glob)
   1 files fetched over 1 fetches - (1 misses, 0.00% hit ratio) over *s (glob)
@@ -39,7 +39,7 @@ 
 
   $ hg -R ../master bundle -r 66ee28d0328c:: --base "66ee28d0328c^" ../fullbundle.hg
   2 changesets found
-  $ hg strip -r 66ee28d0328c
+  $ hg debugstrip -r 66ee28d0328c
   saved backup bundle to $TESTTMP/shallow/.hg/strip-backup/66ee28d0328c-3d7aafd1-backup.hg (glob)
   $ hg unbundle ../fullbundle.hg
   adding changesets
@@ -51,7 +51,7 @@ 
 
 Pulling from a shallow bundle
 
-  $ hg strip -r 66ee28d0328c
+  $ hg debugstrip -r 66ee28d0328c
   saved backup bundle to $TESTTMP/shallow/.hg/strip-backup/66ee28d0328c-3d7aafd1-backup.hg (glob)
   $ hg pull -r 66ee28d0328c .hg/strip-backup/66ee28d0328c-3d7aafd1-backup.hg
   pulling from .hg/strip-backup/66ee28d0328c-3d7aafd1-backup.hg
@@ -65,7 +65,7 @@ 
 
 Pulling from a full bundle
 
-  $ hg strip -r 66ee28d0328c
+  $ hg debugstrip -r 66ee28d0328c
   saved backup bundle to $TESTTMP/shallow/.hg/strip-backup/66ee28d0328c-b6ee89e7-backup.hg (glob)
   $ hg pull -r 66ee28d0328c ../fullbundle.hg
   pulling from ../fullbundle.hg
diff --git a/tests/test-remotefilelog-bgprefetch.t b/tests/test-remotefilelog-bgprefetch.t
--- a/tests/test-remotefilelog-bgprefetch.t
+++ b/tests/test-remotefilelog-bgprefetch.t
@@ -63,7 +63,7 @@ 
   > pullprefetch=bookmark()
   > backgroundprefetch=True
   > EOF
-  $ hg strip tip
+  $ hg debugstrip tip
   saved backup bundle to $TESTTMP/shallow/.hg/strip-backup/6b4b6f66ef8c-b4b8bdaf-backup.hg (glob)
 
   $ clearcache
@@ -92,7 +92,7 @@ 
   > [remotefilelog]
   > backgroundrepack=True
   > EOF
-  $ hg strip tip
+  $ hg debugstrip tip
   saved backup bundle to $TESTTMP/shallow/.hg/strip-backup/6b4b6f66ef8c-b4b8bdaf-backup.hg (glob)
 
   $ clearcache
diff --git a/tests/test-rebase-inmemory.t b/tests/test-rebase-inmemory.t
--- a/tests/test-rebase-inmemory.t
+++ b/tests/test-rebase-inmemory.t
@@ -6,7 +6,6 @@ 
   > amend=
   > rebase=
   > debugdrawdag=$TESTDIR/drawdag.py
-  > strip=
   > [rebase]
   > experimental.inmemory=1
   > [diff]
@@ -517,7 +516,7 @@ 
   $ cd ..
   $ hg clone repo3 repo4 -q
   $ cd repo4
-  $ hg strip 7 -q
+  $ hg debugstrip 7 -q
   $ hg log -G --template "{rev}:{short(node)} {person(author)}\n{firstline(desc)} {topic}\n\n"
   @  6:baf10c5166d4 test
   |  g
diff --git a/tests/test-rebase-collapse.t b/tests/test-rebase-collapse.t
--- a/tests/test-rebase-collapse.t
+++ b/tests/test-rebase-collapse.t
@@ -249,7 +249,7 @@ 
   575c4b5ec114d64b681d33f8792853568bfb2b2c o default
   64e264db77f061f16d9132b70c5a58e2461fb630 o default
 
-  $ hg strip 4
+  $ hg debugstrip 4
   saved backup bundle to $TESTTMP/branch-heads/.hg/strip-backup/4e4f9194f9f1-5ec4b5e6-backup.hg
 
   $ cat $TESTTMP/branch-heads/.hg/cache/branch2-served
@@ -641,7 +641,7 @@ 
   2:dc0947a82db884575bb76ea10ac97b08536bfa03 default: C
   1:112478962961147124edd43549aedd1a335e44bf default: B
 
-  $ hg strip C
+  $ hg debugstrip C
   saved backup bundle to $TESTTMP/f/.hg/strip-backup/dc0947a82db8-d21b92a4-backup.hg
 
   $ hg tglog
diff --git a/tests/test-rebase-cache.t b/tests/test-rebase-cache.t
--- a/tests/test-rebase-cache.t
+++ b/tests/test-rebase-cache.t
@@ -268,7 +268,7 @@ 
 Stripping multiple branches in one go bypasses the fast-case code to
 update the branch cache.
 
-  $ hg strip 2
+  $ hg debugstrip 2
   0 files updated, 0 files merged, 4 files removed, 0 files unresolved
   saved backup bundle to $TESTTMP/a3/.hg/strip-backup/0a03079c47fd-11b7c407-backup.hg
 
@@ -327,7 +327,7 @@ 
   2: 'A' branch1
   1: 'branch2' branch2
 
-  $ hg strip 2
+  $ hg debugstrip 2
   0 files updated, 0 files merged, 1 files removed, 0 files unresolved
   saved backup bundle to $TESTTMP/a3/b/.hg/strip-backup/a5b4b27ed7b4-a3b6984e-backup.hg
 
@@ -372,14 +372,14 @@ 
   o  0: 'A'
   
 
-  $ hg strip 3 4
+  $ hg debugstrip 3 4
   0 files updated, 0 files merged, 2 files removed, 0 files unresolved
   saved backup bundle to $TESTTMP/a3/c/.hg/strip-backup/67a385d4e6f2-b9243789-backup.hg
 
   $ hg theads
   2: 'C' 
 
-  $ hg strip 2 1
+  $ hg debugstrip 2 1
   0 files updated, 0 files merged, 2 files removed, 0 files unresolved
   saved backup bundle to $TESTTMP/a3/c/.hg/strip-backup/6c81ed0049f8-a687065f-backup.hg
 
diff --git a/tests/test-rebase-abort.t b/tests/test-rebase-abort.t
--- a/tests/test-rebase-abort.t
+++ b/tests/test-rebase-abort.t
@@ -167,7 +167,7 @@ 
 
   $ mv .hg/rebasestate .hg/rebasestate.back
   $ hg update --quiet --clean 2
-  $ hg --config extensions.mq= strip --quiet "destination()"
+  $ hg --config extensions.mq= debugstrip --quiet "destination()"
   $ mv .hg/rebasestate.back .hg/rebasestate
 
   $ hg continue
diff --git a/tests/test-push.t b/tests/test-push.t
--- a/tests/test-push.t
+++ b/tests/test-push.t
@@ -291,8 +291,8 @@ 
   wlock: free
   added 1 changesets with 1 changes to 1 files
 
-  $ hg --cwd 1 --config extensions.strip= strip tip -q
-  $ hg --cwd 2 --config extensions.strip= strip tip -q
+  $ hg --cwd 1 debugstrip tip -q
+  $ hg --cwd 2 debugstrip tip -q
   $ hg --cwd 3 push ../2 # bundle2+
   pushing to ../2
   searching for changes
diff --git a/tests/test-push-http.t b/tests/test-push-http.t
--- a/tests/test-push-http.t
+++ b/tests/test-push-http.t
@@ -370,7 +370,7 @@ 
   % serve errors
 #endif
 
-  $ hg --config extensions.strip= strip -r 1:
+  $ hg debugstrip -r 1:
   saved backup bundle to $TESTTMP/test/.hg/strip-backup/ba677d0156c1-eea704d7-backup.hg
 
 Now do a variant of the above, except on a non-publishing repository
@@ -483,7 +483,7 @@ 
   % serve errors
 #endif
 
-  $ hg --config extensions.strip= strip -r 1:
+  $ hg debugstrip -r 1:
   saved backup bundle to $TESTTMP/test/.hg/strip-backup/ba677d0156c1-eea704d7-backup.hg
 
 #if bundle2
diff --git a/tests/test-pull-update.t b/tests/test-pull-update.t
--- a/tests/test-pull-update.t
+++ b/tests/test-pull-update.t
@@ -30,7 +30,7 @@ 
   1 local changesets published
   abort: uncommitted changes
   [255]
-  $ hg --config extensions.strip= strip --no-backup tip
+  $ hg debugstrip --no-backup tip
   $ hg co -qC tip
 
 Should not update to the other topological branch:
diff --git a/tests/test-phases.t b/tests/test-phases.t
--- a/tests/test-phases.t
+++ b/tests/test-phases.t
@@ -255,7 +255,7 @@ 
 
 
 Restore condition prior extra insertion.
-  $ hg -q --config extensions.mq= strip .
+  $ hg -q --config extensions.mq= debugstrip .
   $ hg up -q 7
   $ cd ..
 
diff --git a/tests/test-phases-exchange.t b/tests/test-phases-exchange.t
--- a/tests/test-phases-exchange.t
+++ b/tests/test-phases-exchange.t
@@ -836,7 +836,7 @@ 
 
 (reset some stat on remote repo to avoid confusing other tests)
 
-  $ hg -R ../alpha --config extensions.strip= strip --no-backup 967b449fbc94
+  $ hg -R ../alpha debugstrip --no-backup 967b449fbc94
   0 files updated, 0 files merged, 1 files removed, 0 files unresolved
   $ hg phase --force --draft b740e3e5c05d 967b449fbc94
   test-debug-phase: move rev 8: 0 -> 1
diff --git a/tests/test-phase-archived.t b/tests/test-phase-archived.t
--- a/tests/test-phase-archived.t
+++ b/tests/test-phase-archived.t
@@ -5,8 +5,6 @@ 
   $ cat << EOF >> $HGRCPATH
   > [format]
   > internal-phase=yes
-  > [extensions]
-  > strip=
   > [experimental]
   > EOF
 
@@ -35,7 +33,7 @@ 
      date:        Thu Jan 01 00:00:00 1970 +0000
      summary:     root
   
-  $ hg strip --soft --rev '.'
+  $ hg debugstrip --soft --rev '.'
   1 files updated, 0 files merged, 0 files removed, 0 files unresolved
   saved backup bundle to $TESTTMP/repo/.hg/strip-backup/883aadbbf309-efc55adc-backup.hg
   $ hg log -G
diff --git a/tests/test-obsolete.t b/tests/test-obsolete.t
--- a/tests/test-obsolete.t
+++ b/tests/test-obsolete.t
@@ -1297,7 +1297,7 @@ 
   tiptag                             2:323a9c3ddd91
   tip                                2:323a9c3ddd91
   visible                            1:29f0c6921ddd
-  $ hg --config extensions.strip= strip -r tip --no-backup
+  $ hg debugstrip -r tip --no-backup
   0 files updated, 0 files merged, 1 files removed, 0 files unresolved
   $ hg tags
   visible                            1:29f0c6921ddd
@@ -1522,7 +1522,7 @@ 
   o  0:a78f55e5508c (draft) [ ] 0
   
 
-  $ hg strip --hidden -r 2 --config extensions.strip= --config devel.strip-obsmarkers=no
+  $ hg debugstrip --hidden -r 2 --config devel.strip-obsmarkers=no
   saved backup bundle to $TESTTMP/tmpe/issue4845/.hg/strip-backup/e008cf283490-ede36964-backup.hg
   $ hg debugobsolete
   e008cf2834908e5d6b0f792a9d4b0e2272260fb8 b0551702f918510f01ae838ab03a463054c67b46 0 (Thu Jan 01 00:00:00 1970 +0000) {'ef1': '8', 'operation': 'amend', 'user': 'test'}
@@ -1573,7 +1573,7 @@ 
 
 Testing that strip remove markers:
 
-  $ hg strip -r 1 --config extensions.strip=
+  $ hg debugstrip -r 1
   0 files updated, 0 files merged, 2 files removed, 0 files unresolved
   saved backup bundle to $TESTTMP/tmpe/issue4845/.hg/strip-backup/e016b03fd86f-65ede734-backup.hg
   $ hg debugobsolete
@@ -1681,7 +1681,7 @@ 
   $ hg bundle -r . --base .~1 ../bundle-2.hg
   1 changesets found
   $ getid .
-  $ hg --config extensions.strip= strip -r .
+  $ hg debugstrip -r .
   0 files updated, 0 files merged, 1 files removed, 0 files unresolved
   saved backup bundle to $TESTTMP/tmpe/issue4845/doindexrev/.hg/strip-backup/9bc153528424-ee80edd4-backup.hg
   $ hg debugobsolete 9bc153528424ea266d13e57f9ff0d799dfe61e4b
diff --git a/tests/test-obsolete-changeset-exchange.t b/tests/test-obsolete-changeset-exchange.t
--- a/tests/test-obsolete-changeset-exchange.t
+++ b/tests/test-obsolete-changeset-exchange.t
@@ -64,7 +64,7 @@ 
   $ hg phase --draft --force f89bcc95eba5
   $ hg phase -R ../other --draft --force f89bcc95eba5
   $ hg commit --amend -m "A''"
-  $ hg --hidden --config extensions.mq= strip  --no-backup f89bcc95eba5
+  $ hg --hidden --config extensions.mq= debugstrip  --no-backup f89bcc95eba5
   $ hg pull ../other
   pulling from ../other
   searching for changes
@@ -80,7 +80,7 @@ 
 
   $ hg bundle --hidden --rev f89bcc95eba5 --base "f89bcc95eba5^" ../f89bcc95eba5.hg
   1 changesets found
-  $ hg --hidden --config extensions.mq= strip --no-backup f89bcc95eba5
+  $ hg --hidden --config extensions.mq= debugstrip --no-backup f89bcc95eba5
   $ hg unbundle ../f89bcc95eba5.hg
   adding changesets
   adding manifests
diff --git a/tests/test-narrow-strip.t b/tests/test-narrow-strip.t
--- a/tests/test-narrow-strip.t
+++ b/tests/test-narrow-strip.t
@@ -54,17 +54,13 @@ 
   updating to branch default
   1 files updated, 0 files merged, 0 files removed, 0 files unresolved
   $ cd narrow
-  $ cat >> $HGRCPATH <<EOF
-  > [extensions]
-  > strip=
-  > EOF
 
 Can strip and recover changesets affecting only files within narrow spec
 
   $ hg co -r 'desc("modify inside")'
   1 files updated, 0 files merged, 0 files removed, 0 files unresolved
   $ rm -f .hg/strip-backup/*-backup.hg
-  $ hg strip .
+  $ hg debugstrip .
   1 files updated, 0 files merged, 0 files removed, 0 files unresolved
   saved backup bundle to $TESTTMP/narrow/.hg/strip-backup/*-backup.hg (glob)
   $ hg unbundle .hg/strip-backup/*-backup.hg
@@ -93,7 +89,7 @@ 
   outside\x00255c2627ebdd3c7dcaa6945246f9b9f02bd45a09t (esc) (tree !)
 
   $ rm -f .hg/strip-backup/*-backup.hg
-  $ hg strip .
+  $ hg debugstrip .
   0 files updated, 0 files merged, 0 files removed, 0 files unresolved
   saved backup bundle to $TESTTMP/narrow/.hg/strip-backup/*-backup.hg (glob)
   $ hg unbundle .hg/strip-backup/*-backup.hg
@@ -121,7 +117,7 @@ 
   $ hg co -r 'desc("modify inside")'
   1 files updated, 0 files merged, 0 files removed, 0 files unresolved
   $ rm .hg/strip-backup/*-backup.hg
-  $ hg strip .
+  $ hg debugstrip .
   1 files updated, 0 files merged, 0 files removed, 0 files unresolved
   saved backup bundle to $TESTTMP/narrow/.hg/strip-backup/*-backup.hg (glob)
 #if repobundlerepo
@@ -136,7 +132,7 @@ 
   (run 'hg heads' to see heads, 'hg merge' to merge)
 
   $ rm .hg/strip-backup/*-backup.hg
-  $ hg strip 0
+  $ hg debugstrip 0
   0 files updated, 0 files merged, 1 files removed, 0 files unresolved
   saved backup bundle to $TESTTMP/narrow/.hg/strip-backup/*-backup.hg (glob)
 
diff --git a/tests/test-mq.t b/tests/test-mq.t
--- a/tests/test-mq.t
+++ b/tests/test-mq.t
@@ -792,7 +792,7 @@ 
   $ echo x>x
   $ hg ci -Ama
   adding x
-  $ hg strip tip
+  $ hg debugstrip tip
   0 files updated, 0 files merged, 1 files removed, 0 files unresolved
   saved backup bundle to $TESTTMP/b/.hg/strip-backup/*-backup.hg (glob)
   $ hg unbundle .hg/strip-backup/*
@@ -810,13 +810,13 @@ 
   1 files updated, 0 files merged, 0 files removed, 0 files unresolved
   $ echo y>y
   $ hg add y
-  $ hg strip tip
+  $ hg debugstrip tip
   abort: uncommitted changes
   [255]
 
 --force strip with local changes
 
-  $ hg strip -f tip
+  $ hg debugstrip -f tip
   0 files updated, 0 files merged, 1 files removed, 0 files unresolved
   saved backup bundle to $TESTTMP/b/.hg/strip-backup/770eb8fce608-0ddcae0f-backup.hg
   $ cd ..
@@ -917,7 +917,7 @@ 
   $ hg qpop
   popping bar
   now at: foo
-  $ hg strip -qn tip
+  $ hg debugstrip -qn tip
   $ hg tip
   changeset:   0:cb9a9f314b8b
   tag:         tip
@@ -1217,7 +1217,7 @@ 
   date:        Thu Jan 01 00:00:00 1970 +0000
   summary:     add foo
   
-  $ hg strip 1
+  $ hg debugstrip 1
   1 files updated, 0 files merged, 0 files removed, 0 files unresolved
   saved backup bundle to $TESTTMP/strip/.hg/strip-backup/*-backup.hg (glob)
   $ checkundo strip
diff --git a/tests/test-mq-qpush-exact.t b/tests/test-mq-qpush-exact.t
--- a/tests/test-mq-qpush-exact.t
+++ b/tests/test-mq-qpush-exact.t
@@ -27,7 +27,7 @@ 
   $ hg add fp0
   $ hg ci -m p0 -d "0 0"
   $ hg export -r. > p0
-  $ hg strip -qn .
+  $ hg debugstrip -qn .
   $ hg qimport p0
   adding p0 to series file
   $ hg qpush
diff --git a/tests/test-lfs.t b/tests/test-lfs.t
--- a/tests/test-lfs.t
+++ b/tests/test-lfs.t
@@ -419,7 +419,7 @@ 
        * (changelog) (glob)
        * (manifests) (glob)
       * a (glob)
-  $ hg --config extensions.strip= strip -r 2 --no-backup --force -q
+  $ hg debugstrip -r 2 --no-backup --force -q
   $ hg -R bundle.hg log -p -T '{rev} {desc}\n' a
   5 branching
   diff --git a/a b/a
diff --git a/tests/test-keyword.t b/tests/test-keyword.t
--- a/tests/test-keyword.t
+++ b/tests/test-keyword.t
@@ -228,7 +228,7 @@ 
   $ hg status -A --rev 3:4 i
   C i
 
-  $ hg -q strip --no-backup 2
+  $ hg -q debugstrip --no-backup 2
 
 Test hook execution
 
@@ -585,7 +585,7 @@ 
   $ head -1 a
   expand $Id: a,v 67d8c481a6be 1970/01/01 00:00:15 test $
 
-  $ hg -q strip --no-backup tip
+  $ hg -q debugstrip --no-backup tip
 
 Test patch queue repo
 
diff --git a/tests/test-import.t b/tests/test-import.t
--- a/tests/test-import.t
+++ b/tests/test-import.t
@@ -121,7 +121,7 @@ 
   d8804f3f5396d800812f579c8452796a5993bdb2
   $ hg --cwd b export -o ../empty-log.diff .
   $ hg --cwd b update -q -C ".^1"
-  $ hg --cwd b --config extensions.strip= strip -q tip
+  $ hg --cwd b debugstrip -q tip
   $ HGEDITOR=cat hg --cwd b import --exact ../empty-log.diff
   applying ../empty-log.diff
   $ hg --cwd b tip -T "{node}\n"
@@ -467,7 +467,7 @@ 
   parent: 1
 
   $ hg --cwd b update -q -C 0
-  $ hg --cwd b --config extensions.strip= strip -q 1
+  $ hg --cwd b debugstrip -q 1
 
 Test visibility of in-memory dirstate changes inside transaction to
 external process
diff --git a/tests/test-import-merge.t b/tests/test-import-merge.t
--- a/tests/test-import-merge.t
+++ b/tests/test-import-merge.t
@@ -65,7 +65,7 @@ 
   $ tipparents
   1:540395c44225 changea
   3:102a90ea7b4a addb
-  $ hg strip --no-backup tip
+  $ hg debugstrip --no-backup tip
   0 files updated, 0 files merged, 1 files removed, 0 files unresolved
 
 Test without --exact and diff.p1 != workingdir.p1
@@ -78,7 +78,7 @@ 
   (use --exact to import the patch as a merge)
   $ tipparents
   2:890ecaa90481 addc
-  $ hg strip --no-backup tip
+  $ hg debugstrip --no-backup tip
   0 files updated, 0 files merged, 1 files removed, 0 files unresolved
 
 Test with --exact
@@ -89,7 +89,7 @@ 
   $ tipparents
   1:540395c44225 changea
   3:102a90ea7b4a addb
-  $ hg strip --no-backup tip
+  $ hg debugstrip --no-backup tip
   0 files updated, 0 files merged, 1 files removed, 0 files unresolved
 
 Test with --bypass and diff.p1 == workingdir.p1
@@ -101,7 +101,7 @@ 
   $ tipparents
   1:540395c44225 changea
   3:102a90ea7b4a addb
-  $ hg strip --no-backup tip
+  $ hg debugstrip --no-backup tip
 
 Test with --bypass and diff.p1 != workingdir.p1
 
@@ -113,7 +113,7 @@ 
   (use --exact to import the patch as a merge)
   $ tipparents
   2:890ecaa90481 addc
-  $ hg strip --no-backup tip
+  $ hg debugstrip --no-backup tip
 
 Test with --bypass and --exact
 
@@ -122,7 +122,7 @@ 
   $ tipparents
   1:540395c44225 changea
   3:102a90ea7b4a addb
-  $ hg strip --no-backup tip
+  $ hg debugstrip --no-backup tip
 
   $ cd ..
 
diff --git a/tests/test-import-bypass.t b/tests/test-import-bypass.t
--- a/tests/test-import-bypass.t
+++ b/tests/test-import-bypass.t
@@ -183,7 +183,7 @@ 
   @@ -1,1 +1,2 @@
    cc
   +cc
-  $ hg -q --config extensions.strip= strip .
+  $ hg -q debugstrip .
 
 Test unsupported combinations
 
@@ -323,7 +323,7 @@ 
   1b77bc7d1db9f0e7f1716d515b630516ab386c89
   $ hg export -o ../empty-log.diff .
   $ hg update -q -C ".^1"
-  $ hg --config extensions.strip= strip -q tip
+  $ hg debugstrip -q tip
   $ HGEDITOR=cat hg import --exact --bypass ../empty-log.diff
   applying ../empty-log.diff
   $ hg tip -T "{node}\n"
diff --git a/tests/test-hook.t b/tests/test-hook.t
--- a/tests/test-hook.t
+++ b/tests/test-hook.t
@@ -1251,7 +1251,7 @@ 
   > [hooks]
   > pretxnclose.error = exit 1
   > EOF
-  $ hg strip -r 0 --config extensions.strip=
+  $ hg debugstrip -r 0
   0 files updated, 0 files merged, 1 files removed, 0 files unresolved
   saved backup bundle to * (glob)
   transaction abort!
diff --git a/tests/test-histedit-obsolete.t b/tests/test-histedit-obsolete.t
--- a/tests/test-histedit-obsolete.t
+++ b/tests/test-histedit-obsolete.t
@@ -79,7 +79,7 @@ 
   ? plan
   $ hg commit --amend -X . -m XXXXXX
   $ hg commit --amend -X . -m b2
-  $ hg --hidden --config extensions.strip= strip 'desc(XXXXXX)' --no-backup
+  $ hg --hidden debugstrip 'desc(XXXXXX)' --no-backup
   $ hg histedit --continue
   $ hg log -G
   @  8:273c1f3b8626 c
diff --git a/tests/test-histedit-edit.t b/tests/test-histedit-edit.t
--- a/tests/test-histedit-edit.t
+++ b/tests/test-histedit-edit.t
@@ -3,7 +3,6 @@ 
   $ cat >> $HGRCPATH <<EOF
   > [extensions]
   > histedit=
-  > strip=
   > mockmakedate = $TESTDIR/mockmakedate.py
   > EOF
 
@@ -139,7 +138,7 @@ 
   [255]
 
 Try to delete necessary commit
-  $ hg strip -r 652413b
+  $ hg debugstrip -r 652413b
   abort: histedit in progress, can't strip 652413bf663e
   [255]
 
@@ -209,7 +208,7 @@ 
   (hg histedit --continue to resume)
 
   $ mv .hg/histedit-state .hg/histedit-state.bak
-  $ hg strip -q -r b5f70786f9b0
+  $ hg debugstrip -q -r b5f70786f9b0
   $ mv .hg/histedit-state.bak .hg/histedit-state
   $ hg histedit --abort
   adding changesets
diff --git a/tests/test-histedit-arguments.t b/tests/test-histedit-arguments.t
--- a/tests/test-histedit-arguments.t
+++ b/tests/test-histedit-arguments.t
@@ -175,7 +175,7 @@ 
   ~
 
   $ hg unbundle -q $TESTTMP/foo/.hg/strip-backup/08d98a8350f3-02594089-histedit.hg
-  $ hg strip -q -r f5ed --config extensions.strip=
+  $ hg debugstrip -q -r f5ed
   $ hg up -q 08d98a8350f3
 
 Test that missing revisions are detected
@@ -330,7 +330,7 @@ 
 
 Test --continue with --keep
 
-  $ hg strip -q -r . --config extensions.strip=
+  $ hg debugstrip -q -r .
   $ hg histedit '.^' -q --keep --commands - << EOF
   > edit eb57da33312f 2 three
   > pick f3cfcca30c44 4 x
diff --git a/tests/test-hgweb-bundle.t b/tests/test-hgweb-bundle.t
--- a/tests/test-hgweb-bundle.t
+++ b/tests/test-hgweb-bundle.t
@@ -2,10 +2,6 @@ 
 
   $ hg init server
   $ cd server
-  $ cat >> .hg/hgrc << EOF
-  > [extensions]
-  > strip=
-  > EOF
 
   $ echo 1 > foo
   $ hg commit -A -m 'first'
@@ -16,7 +12,7 @@ 
 
 Produce a bundle to use
 
-  $ hg strip -r 1
+  $ hg debugstrip -r 1
   0 files updated, 0 files merged, 1 files removed, 0 files unresolved
   saved backup bundle to $TESTTMP/server/.hg/strip-backup/ed602e697e0f-cc9fff6a-backup.hg
 
diff --git a/tests/test-help.t b/tests/test-help.t
--- a/tests/test-help.t
+++ b/tests/test-help.t
@@ -1051,6 +1051,7 @@ 
    debugsidedata
                  dump the side data for a cl/manifest/file revision
    debugssl      test a secure connection to a server
+   debugstrip    strip changesets and all their descendants from the repository
    debugsub      (no help text available)
    debugsuccessorssets
                  show set of successors for revision
diff --git a/tests/test-graft.t b/tests/test-graft.t
--- a/tests/test-graft.t
+++ b/tests/test-graft.t
@@ -64,7 +64,7 @@ 
   $ hg st --change .
   M d
 
-  $ hg -q strip . --config extensions.strip=
+  $ hg -q debugstrip .
 
 Test --base for collapsing changesets 2 and 3, thus getting both b and c
 
@@ -78,7 +78,7 @@ 
   A c
   R a
 
-  $ hg -q strip . --config extensions.strip=
+  $ hg -q debugstrip .
 
 Specifying child as --base revision fails safely (perhaps slightly confusing, but consistent)
 
@@ -307,7 +307,7 @@ 
   $ echo c >> e
   $ hg ci -mtest
 
-  $ hg strip . --config extensions.strip=
+  $ hg debugstrip .
   1 files updated, 0 files merged, 0 files removed, 0 files unresolved
   saved backup bundle to $TESTTMP/a/.hg/strip-backup/*-backup.hg (glob)
 
@@ -877,7 +877,7 @@ 
 
   $ hg up -qC 7
   $ hg tag -l -r 13 tmp
-  $ hg --config extensions.strip= strip 2
+  $ hg debugstrip 2
   saved backup bundle to $TESTTMP/a/.hg/strip-backup/5c095ad7e90f-d323a1e4-backup.hg
   $ hg graft tmp
   skipping already grafted revision 8:7a4785234d87 (2:ef0ef43d49e7 also has unknown origin 5c095ad7e90f)
diff --git a/tests/test-generaldelta.t b/tests/test-generaldelta.t
--- a/tests/test-generaldelta.t
+++ b/tests/test-generaldelta.t
@@ -146,7 +146,7 @@ 
         1       1        2        0    prev         61         86        120   1.39535       120         0    0.00000
         2       1        2        0      p2         62        301        121   0.40199       182        61    0.50413
 
-  $ hg strip -q -r . --config extensions.strip=
+  $ hg debugstrip -q -r .
 
 - Verify aggressive merge uses p2 (commit 0) as delta parent
   $ hg up -q -C 1
@@ -159,7 +159,7 @@ 
         2       1        2        0      p2         62        301        121   0.40199       182        61    0.50413
 
 Test that strip bundle use bundle2
-  $ hg --config extensions.strip= strip .
+  $ hg debugstrip .
   0 files updated, 0 files merged, 5 files removed, 0 files unresolved
   saved backup bundle to $TESTTMP/aggressive/.hg/strip-backup/1c5d4dc9a8b8-6c68e60c-backup.hg
   $ hg debugbundle .hg/strip-backup/*
diff --git a/tests/test-flagprocessor.t b/tests/test-flagprocessor.t
--- a/tests/test-flagprocessor.t
+++ b/tests/test-flagprocessor.t
@@ -242,7 +242,7 @@ 
 #if repobundlerepo
   $ hg bundle --base 1 bundle.hg
   4 changesets found
-  $ hg --config extensions.strip= strip -r 2 --no-backup --force -q
+  $ hg debugstrip -r 2 --no-backup --force -q
   $ hg -R bundle.hg log --stat -T '{rev} {desc}\n' base64
   5 branching
    base64 |  2 +-
diff --git a/tests/test-extension.t b/tests/test-extension.t
--- a/tests/test-extension.t
+++ b/tests/test-extension.t
@@ -1019,7 +1019,7 @@ 
 #if no-extraextensions
   $ hg debugextensions
   mq
-  strip
+  strip (untested!)
 #endif
 
 For extensions, which name matches one of its commands, help
@@ -1546,7 +1546,7 @@ 
   $ echo 'getversion = lambda: b"1.twentythree"' >> throw.py
   $ rm -f throw.pyc throw.pyo
   $ rm -Rf __pycache__
-  $ hg version -v --config extensions.throw=throw.py --config extensions.strip=
+  $ hg version -v --config extensions.throw=throw.py
   Mercurial Distributed SCM (version *) (glob)
   (see https://mercurial-scm.org for more information)
   
@@ -1557,15 +1557,13 @@ 
   Enabled extensions:
   
     throw  external  1.twentythree
-    strip  internal  
 
   $ hg version -q --config extensions.throw=throw.py
   Mercurial Distributed SCM (version *) (glob)
 
 Test template output:
 
-  $ hg version --config extensions.strip= -T'{extensions}'
-  strip
+  $ hg version -T'{extensions}'
 
 Test JSON output of version:
 
@@ -1585,20 +1583,19 @@ 
    }
   ]
 
-  $ hg version --config extensions.strip= -Tjson
+  $ hg version -Tjson
   [
    {
-    "extensions": [{"bundled": true, "name": "strip", "ver": null}],
+    "extensions": [],
     "ver": "*" (glob)
    }
   ]
 
 Test template output of version:
 
-  $ hg version --config extensions.throw=throw.py --config extensions.strip= \
+  $ hg version --config extensions.throw=throw.py \
   > -T'{extensions % "{name}  {pad(ver, 16)}  ({if(bundled, "internal", "external")})\n"}'
   throw  1.twentythree     (external)
-  strip                    (internal)
 
 Refuse to load extensions with minimum version requirements
 
@@ -1679,7 +1676,7 @@ 
   dudu (untested!)
   mq
   reposetuptest (untested!)
-  strip
+  strip (untested!)
 #endif
 
   $ hg clone -U src clone-dst1
diff --git a/tests/test-exchange-obsmarkers-case-D3.t b/tests/test-exchange-obsmarkers-case-D3.t
--- a/tests/test-exchange-obsmarkers-case-D3.t
+++ b/tests/test-exchange-obsmarkers-case-D3.t
@@ -62,7 +62,7 @@ 
   $ hg prune -d '0 0' .
   1 new obsolescence markers
   obsoleted 1 changesets
-  $ hg strip --hidden -q 'desc(A1)'
+  $ hg debugstrip --hidden -q 'desc(A1)'
   $ hg log -G --hidden
   @  35b183996678 (draft): B
   |
diff --git a/tests/test-exchange-obsmarkers-case-D2.t b/tests/test-exchange-obsmarkers-case-D2.t
--- a/tests/test-exchange-obsmarkers-case-D2.t
+++ b/tests/test-exchange-obsmarkers-case-D2.t
@@ -59,7 +59,7 @@ 
   $ hg prune --date '0 0' .
   1 new obsolescence markers
   obsoleted 1 changesets
-  $ hg strip --hidden -q 'desc(A1)'
+  $ hg debugstrip --hidden -q 'desc(A1)'
   $ hg log -G --hidden
   x  28b51eb45704 (draft): A0
   |
diff --git a/tests/test-exchange-obsmarkers-case-D1.t b/tests/test-exchange-obsmarkers-case-D1.t
--- a/tests/test-exchange-obsmarkers-case-D1.t
+++ b/tests/test-exchange-obsmarkers-case-D1.t
@@ -67,7 +67,7 @@ 
   $ hg prune -d '0 0' 'desc(B)'
   1 new obsolescence markers
   obsoleted 1 changesets
-  $ hg strip --hidden -q 'desc(A0)'
+  $ hg debugstrip --hidden -q 'desc(A0)'
   $ hg log -G --hidden
   @  e5ea8f9c7314 (draft): A1
   |
diff --git a/tests/test-strip.t b/tests/test-strip.t
--- a/tests/test-strip.t
+++ b/tests/test-strip.t
@@ -882,7 +882,7 @@ 
 
 check strip behavior
 
-  $ hg --config extensions.strip= strip 'desc(commitD)' --debug
+  $ hg strip 'desc(commitD)' --debug
   resolving manifests
    branchmerge: False, force: True, partial: False
    ancestor: d8db9d137221+, local: d8db9d137221+, remote: eca11cf91c71
diff --git a/tests/test-strip.t b/tests/test-debugstrip.t
copy from tests/test-strip.t
copy to tests/test-debugstrip.t
--- a/tests/test-strip.t
+++ b/tests/test-debugstrip.t
@@ -1,5 +1,4 @@ 
   $ echo "[extensions]" >> $HGRCPATH
-  $ echo "strip=" >> $HGRCPATH
   $ echo "drawdag=$TESTDIR/drawdag.py" >> $HGRCPATH
 
   $ restore() {
@@ -8,10 +7,10 @@ 
   > }
   $ teststrip() {
   >     hg up -C $1
-  >     echo % before update $1, strip $2
+  >     echo % before update $1, debugstrip $2
   >     hg log -G -T '{rev}:{node}'
-  >     hg --traceback strip $2
-  >     echo % after update $1, strip $2
+  >     hg --traceback debugstrip $2
+  >     echo % after update $1, debugstrip $2
   >     hg log -G -T '{rev}:{node}'
   >     restore
   > }
@@ -69,7 +68,7 @@ 
 
   $ teststrip 4 4
   0 files updated, 0 files merged, 0 files removed, 0 files unresolved
-  % before update 4, strip 4
+  % before update 4, debugstrip 4
   @  4:443431ffac4f5b5a19b0b6c298a21b7ba736bcce
   |
   o  3:65bd5f99a4a376cdea23a1153f07856b0d881d64
@@ -82,7 +81,7 @@ 
   
   1 files updated, 0 files merged, 0 files removed, 0 files unresolved
   saved backup bundle to $TESTTMP/test/.hg/strip-backup/*-backup.hg (glob)
-  % after update 4, strip 4
+  % after update 4, debugstrip 4
   @  3:65bd5f99a4a376cdea23a1153f07856b0d881d64
   |
   | o  2:264128213d290d868c54642d13aeaa3675551a78
@@ -93,7 +92,7 @@ 
   
   $ teststrip 4 3
   1 files updated, 0 files merged, 0 files removed, 0 files unresolved
-  % before update 4, strip 3
+  % before update 4, debugstrip 3
   @  4:443431ffac4f5b5a19b0b6c298a21b7ba736bcce
   |
   o  3:65bd5f99a4a376cdea23a1153f07856b0d881d64
@@ -106,7 +105,7 @@ 
   
   1 files updated, 0 files merged, 0 files removed, 0 files unresolved
   saved backup bundle to $TESTTMP/test/.hg/strip-backup/*-backup.hg (glob)
-  % after update 4, strip 3
+  % after update 4, debugstrip 3
   o  2:264128213d290d868c54642d13aeaa3675551a78
   |
   @  1:ef3a871183d7199c541cc140218298bbfcc6c28a
@@ -115,7 +114,7 @@ 
   
   $ teststrip 1 4
   0 files updated, 0 files merged, 0 files removed, 0 files unresolved
-  % before update 1, strip 4
+  % before update 1, debugstrip 4
   o  4:443431ffac4f5b5a19b0b6c298a21b7ba736bcce
   |
   o  3:65bd5f99a4a376cdea23a1153f07856b0d881d64
@@ -127,7 +126,7 @@ 
   o  0:9ab35a2d17cb64271241ea881efcc19dd953215b
   
   saved backup bundle to $TESTTMP/test/.hg/strip-backup/*-backup.hg (glob)
-  % after update 1, strip 4
+  % after update 1, debugstrip 4
   o  3:65bd5f99a4a376cdea23a1153f07856b0d881d64
   |
   | o  2:264128213d290d868c54642d13aeaa3675551a78
@@ -138,7 +137,7 @@ 
   
   $ teststrip 4 2
   1 files updated, 0 files merged, 0 files removed, 0 files unresolved
-  % before update 4, strip 2
+  % before update 4, debugstrip 2
   @  4:443431ffac4f5b5a19b0b6c298a21b7ba736bcce
   |
   o  3:65bd5f99a4a376cdea23a1153f07856b0d881d64
@@ -150,7 +149,7 @@ 
   o  0:9ab35a2d17cb64271241ea881efcc19dd953215b
   
   saved backup bundle to $TESTTMP/test/.hg/strip-backup/*-backup.hg (glob)
-  % after update 4, strip 2
+  % after update 4, debugstrip 2
   @  3:443431ffac4f5b5a19b0b6c298a21b7ba736bcce
   |
   o  2:65bd5f99a4a376cdea23a1153f07856b0d881d64
@@ -161,7 +160,7 @@ 
   
   $ teststrip 4 1
   1 files updated, 0 files merged, 0 files removed, 0 files unresolved
-  % before update 4, strip 1
+  % before update 4, debugstrip 1
   @  4:264128213d290d868c54642d13aeaa3675551a78
   |
   | o  3:443431ffac4f5b5a19b0b6c298a21b7ba736bcce
@@ -174,12 +173,12 @@ 
   
   1 files updated, 0 files merged, 0 files removed, 0 files unresolved
   saved backup bundle to $TESTTMP/test/.hg/strip-backup/*-backup.hg (glob)
-  % after update 4, strip 1
+  % after update 4, debugstrip 1
   @  0:9ab35a2d17cb64271241ea881efcc19dd953215b
   
   $ teststrip null 4
   0 files updated, 0 files merged, 1 files removed, 0 files unresolved
-  % before update null, strip 4
+  % before update null, debugstrip 4
   o  4:264128213d290d868c54642d13aeaa3675551a78
   |
   | o  3:443431ffac4f5b5a19b0b6c298a21b7ba736bcce
@@ -191,7 +190,7 @@ 
   o  0:9ab35a2d17cb64271241ea881efcc19dd953215b
   
   saved backup bundle to $TESTTMP/test/.hg/strip-backup/*-backup.hg (glob)
-  % after update null, strip 4
+  % after update null, debugstrip 4
   o  3:443431ffac4f5b5a19b0b6c298a21b7ba736bcce
   |
   o  2:65bd5f99a4a376cdea23a1153f07856b0d881d64
@@ -240,7 +239,7 @@ 
   summary:     c
   
 
-  $ hg --traceback strip 4
+  $ hg --traceback debugstrip 4
   1 files updated, 0 files merged, 0 files removed, 0 files unresolved
   saved backup bundle to $TESTTMP/test/.hg/strip-backup/264128213d29-0b39d6bf-backup.hg
   $ hg parents
@@ -314,12 +313,12 @@ 
   summary:     c
   
 ##strip not allowed with merge in progress
-  $ hg strip 4
+  $ hg debugstrip 4
   abort: outstanding uncommitted merge
   (use 'hg commit' or 'hg merge --abort')
   [255]
 ##strip allowed --force with merge in progress
-  $ hg strip 4 --force
+  $ hg debugstrip 4 --force
   1 files updated, 0 files merged, 0 files removed, 0 files unresolved
   saved backup bundle to $TESTTMP/test/.hg/strip-backup/*-backup.hg (glob)
 
@@ -368,7 +367,7 @@ 
 
 2 is parent of 3, only one strip should happen
 
-  $ hg strip "roots(2)" 3
+  $ hg debugstrip "roots(2)" 3
   saved backup bundle to $TESTTMP/test/.hg/strip-backup/*-backup.hg (glob)
   $ hg log -G
   @  changeset:   2:264128213d29
@@ -418,7 +417,7 @@ 
   
 Failed hook while applying "saveheads" bundle.
 
-  $ hg strip 2 --config hooks.pretxnchangegroup.bad=false
+  $ hg debugstrip 2 --config hooks.pretxnchangegroup.bad=false
   1 files updated, 0 files merged, 0 files removed, 0 files unresolved
   saved backup bundle to $TESTTMP/test/.hg/strip-backup/*-backup.hg (glob)
   transaction abort!
@@ -460,7 +459,7 @@ 
 
 2 different branches: 2 strips
 
-  $ hg strip 2 4
+  $ hg debugstrip 2 4
   saved backup bundle to $TESTTMP/test/.hg/strip-backup/*-backup.hg (glob)
   $ hg log -G
   o  changeset:   2:65bd5f99a4a3
@@ -483,7 +482,7 @@ 
 
 2 different branches and a common ancestor: 1 strip
 
-  $ hg strip 1 "2|4"
+  $ hg debugstrip 1 "2|4"
   1 files updated, 0 files merged, 0 files removed, 0 files unresolved
   saved backup bundle to $TESTTMP/test/.hg/strip-backup/*-backup.hg (glob)
   $ restore
@@ -498,7 +497,7 @@ 
   data/bar.i
 #endif
 
-  $ hg strip tip
+  $ hg debugstrip tip
   0 files updated, 0 files merged, 1 files removed, 0 files unresolved
   saved backup bundle to $TESTTMP/test/.hg/strip-backup/*-backup.hg (glob)
 #if repofncache
@@ -508,13 +507,13 @@ 
 
 stripping an empty revset
 
-  $ hg strip "1 and not 1"
+  $ hg debugstrip "1 and not 1"
   abort: empty revision set
   [255]
 
 remove branchy history for qimport tests
 
-  $ hg strip 3
+  $ hg debugstrip 3
   saved backup bundle to $TESTTMP/test/.hg/strip-backup/*-backup.hg (glob)
 
 
@@ -536,7 +535,7 @@ 
 
 stripping revision in queue
 
-  $ hg strip 3
+  $ hg debugstrip 3
   1 files updated, 0 files merged, 0 files removed, 0 files unresolved
   saved backup bundle to $TESTTMP/test/.hg/strip-backup/*-backup.hg (glob)
 
@@ -547,7 +546,7 @@ 
 
 stripping ancestor of queue
 
-  $ hg strip 1
+  $ hg debugstrip 1
   1 files updated, 0 files merged, 0 files removed, 0 files unresolved
   saved backup bundle to $TESTTMP/test/.hg/strip-backup/*-backup.hg (glob)
 
@@ -592,10 +591,10 @@ 
   mq:     3 unapplied
 
   $ echo c > b
-  $ hg strip tip
+  $ hg debugstrip tip
   abort: uncommitted changes
   [255]
-  $ hg strip tip --keep
+  $ hg debugstrip tip --keep
   saved backup bundle to $TESTTMP/test/.hg/strip-backup/*-backup.hg (glob)
   $ hg log --graph
   @  changeset:   0:9ab35a2d17cb
@@ -632,7 +631,7 @@ 
   $ hg rm bar
   $ hg commit -mc
   $ hg status
-  $ hg strip --keep tip
+  $ hg debugstrip --keep tip
   saved backup bundle to $TESTTMP/test/.hg/strip-backup/*-backup.hg (glob)
   $ hg status
   ! bar
@@ -646,7 +645,7 @@ 
   $ hg status
   $ echo b > b
   $ echo d > d
-  $ hg strip --keep tip
+  $ hg debugstrip --keep tip
   saved backup bundle to $TESTTMP/test/.hg/strip-backup/*-backup.hg (glob)
   $ hg status
   M b
@@ -659,7 +658,7 @@ 
   $ hg commit -mc
   $ hg rm c
   $ hg commit -mc
-  $ hg strip --keep '.^' -q
+  $ hg debugstrip --keep '.^' -q
   $ cd ..
 
 stripping many nodes on a complex graph (issue3299)
@@ -667,10 +666,10 @@ 
   $ hg init issue3299
   $ cd issue3299
   $ hg debugbuilddag '@a.:a@b.:b.:x<a@a.:a<b@b.:b<a@a.:a'
-  $ hg strip 'not ancestors(x)'
+  $ hg debugstrip 'not ancestors(x)'
   saved backup bundle to $TESTTMP/issue3299/.hg/strip-backup/*-backup.hg (glob)
 
-test hg strip -B bookmark
+test hg debugstrip -B bookmark
 
   $ cd ..
   $ hg init bookmarks
@@ -687,11 +686,11 @@ 
   $ hg up -C todelete
   0 files updated, 0 files merged, 0 files removed, 0 files unresolved
   (activating bookmark todelete)
-  $ hg strip -B nostrip
+  $ hg debugstrip -B nostrip
   bookmark 'nostrip' deleted
   abort: empty revision set
   [255]
-  $ hg strip -B todelete
+  $ hg debugstrip -B todelete
   0 files updated, 0 files merged, 0 files removed, 0 files unresolved
   saved backup bundle to $TESTTMP/bookmarks/.hg/strip-backup/*-backup.hg (glob)
   bookmark 'todelete' deleted
@@ -707,7 +706,7 @@ 
      multipledelete2           12:b4594d867745
      singlenode1               13:43227190fef8
      singlenode2               13:43227190fef8
-  $ hg strip -B multipledelete1 -B multipledelete2
+  $ hg debugstrip -B multipledelete1 -B multipledelete2
   saved backup bundle to $TESTTMP/bookmarks/.hg/strip-backup/e46a4836065c-89ec65c2-backup.hg
   bookmark 'multipledelete1' deleted
   bookmark 'multipledelete2' deleted
@@ -717,23 +716,23 @@ 
   $ hg id -ir b4594d867745
   abort: unknown revision 'b4594d867745'!
   [255]
-  $ hg strip -B singlenode1 -B singlenode2
+  $ hg debugstrip -B singlenode1 -B singlenode2
   saved backup bundle to $TESTTMP/bookmarks/.hg/strip-backup/43227190fef8-8da858f2-backup.hg
   bookmark 'singlenode1' deleted
   bookmark 'singlenode2' deleted
   $ hg id -ir 43227190fef8
   abort: unknown revision '43227190fef8'!
   [255]
-  $ hg strip -B unknownbookmark
+  $ hg debugstrip -B unknownbookmark
   abort: bookmark 'unknownbookmark' not found
   [255]
-  $ hg strip -B unknownbookmark1 -B unknownbookmark2
+  $ hg debugstrip -B unknownbookmark1 -B unknownbookmark2
   abort: bookmark 'unknownbookmark1,unknownbookmark2' not found
   [255]
-  $ hg strip -B delete -B unknownbookmark
+  $ hg debugstrip -B delete -B unknownbookmark
   abort: bookmark 'unknownbookmark' not found
   [255]
-  $ hg strip -B delete
+  $ hg debugstrip -B delete
   saved backup bundle to $TESTTMP/bookmarks/.hg/strip-backup/*-backup.hg (glob)
   bookmark 'delete' deleted
   $ hg id -ir 6:2702dd0c91e7
@@ -744,7 +743,7 @@ 
   (activating bookmark B)
   $ echo a > a
   $ hg add a
-  $ hg strip -B B
+  $ hg debugstrip -B B
   abort: uncommitted changes
   [255]
   $ hg bookmarks
@@ -752,14 +751,12 @@ 
 
 Make sure no one adds back a -b option:
 
-  $ hg strip -b tip
-  hg strip: option -b not recognized
+  $ hg debugstrip -b tip
+  hg debugstrip: option -b not recognized
   hg strip [-k] [-f] [-B bookmark] [-r] REV...
   
   strip changesets and all their descendants from the repository
   
-  (use 'hg help -e strip' to show help for the strip extension)
-  
   options ([+] can be repeated):
   
    -r --rev REV [+]           strip specified revision (optional, can specify
@@ -771,7 +768,7 @@ 
    -B --bookmark BOOKMARK [+] remove revs only reachable from given bookmark
       --mq                    operate on patch repository
   
-  (use 'hg strip -h' to show more help)
+  (use 'hg debugstrip -h' to show more help)
   [255]
 
   $ cd ..
@@ -784,14 +781,14 @@ 
   $ hg commit -Aqm a
   $ touch b
   $ hg commit -Aqm b
-  $ hg strip -r 0
+  $ hg debugstrip -r 0
   0 files updated, 0 files merged, 2 files removed, 0 files unresolved
   saved backup bundle to $TESTTMP/doublebundle/.hg/strip-backup/3903775176ed-e68910bd-backup.hg
   $ ls .hg/strip-backup
   3903775176ed-e68910bd-backup.hg
 #if repobundlerepo
   $ hg pull -q -r 3903775176ed .hg/strip-backup/3903775176ed-e68910bd-backup.hg
-  $ hg strip -r 0
+  $ hg debugstrip -r 0
   saved backup bundle to $TESTTMP/doublebundle/.hg/strip-backup/3903775176ed-54390173-backup.hg
   $ ls .hg/strip-backup
   3903775176ed-54390173-backup.hg
@@ -882,7 +879,7 @@ 
 
 check strip behavior
 
-  $ hg --config extensions.strip= strip 'desc(commitD)' --debug
+  $ hg debugstrip 'desc(commitD)' --debug
   resolving manifests
    branchmerge: False, force: True, partial: False
    ancestor: d8db9d137221+, local: d8db9d137221+, remote: eca11cf91c71
@@ -972,7 +969,7 @@ 
   $ hg add l
   $ hg commit -m commitL
   $ hg book -r tip blah
-  $ hg strip ".^" --config extensions.crash=$TESTTMP/stripstalephasecache.py
+  $ hg debugstrip ".^" --config extensions.crash=$TESTTMP/stripstalephasecache.py
   0 files updated, 0 files merged, 2 files removed, 0 files unresolved
   saved backup bundle to $TESTTMP/issue4736/.hg/strip-backup/8f0b4384875c-4fa10deb-backup.hg
   $ hg up -C 1
@@ -993,7 +990,7 @@ 
   >             return tr
   >     repo.__class__ = crashstriprepo
   > EOF
-  $ hg strip tip --config extensions.crash=$TESTTMP/crashstrip.py
+  $ hg debugstrip tip --config extensions.crash=$TESTTMP/crashstrip.py
   saved backup bundle to $TESTTMP/issue4736/.hg/strip-backup/5c51d8d6557d-70daef06-backup.hg
   strip failed, backup bundle stored in '$TESTTMP/issue4736/.hg/strip-backup/5c51d8d6557d-70daef06-backup.hg'
   abort: boom
@@ -1060,7 +1057,7 @@ 
      summary:     commitA
   
 
-  $ hg strip --force -r 35358f982181
+  $ hg debugstrip --force -r 35358f982181
   0 files updated, 0 files merged, 1 files removed, 0 files unresolved
   saved backup bundle to $TESTTMP/issue4736/.hg/strip-backup/35358f982181-50d992d4-backup.hg
   $ hg log -G
@@ -1137,7 +1134,7 @@ 
      summary:     commitA
   
 
-  $ hg strip -r 35358f982181
+  $ hg debugstrip -r 35358f982181
   0 files updated, 0 files merged, 1 files removed, 0 files unresolved
   saved backup bundle to $TESTTMP/issue4736/.hg/strip-backup/35358f982181-a6f020aa-backup.hg
   $ hg log -G
@@ -1173,7 +1170,7 @@ 
   new changesets 35358f982181:4cf5e92caec2 (2 drafts)
   1 files updated, 0 files merged, 0 files removed, 0 files unresolved
 
-  $ hg strip -k -r 35358f982181
+  $ hg debugstrip -k -r 35358f982181
   saved backup bundle to $TESTTMP/issue4736/.hg/strip-backup/35358f982181-a6f020aa-backup.hg
   $ hg log -G
   @  changeset:   3:f62c6c09b707
@@ -1386,7 +1383,7 @@ 
   $ hg ci --amend -m a2
   $ hg debugobsolete
   cb9a9f314b8b07ba71012fcdbc544b5a4d82ff5b 489bac576828490c0bb8d45eac9e5e172e4ec0a8 0 (Thu Jan 01 00:00:00 1970 +0000) {'ef1': '1', 'operation': 'amend', 'user': 'test'}
-  $ hg strip .
+  $ hg debugstrip .
   0 files updated, 0 files merged, 1 files removed, 0 files unresolved
   saved backup bundle to $TESTTMP/issue5678/.hg/strip-backup/489bac576828-bef27e14-backup.hg
   $ hg unbundle -q .hg/strip-backup/*
diff --git a/tests/test-debugcommands.t b/tests/test-debugcommands.t
--- a/tests/test-debugcommands.t
+++ b/tests/test-debugcommands.t
@@ -370,7 +370,7 @@ 
   9 1
   10 2
   11 1
-  $ hg --config extensions.strip= strip --no-backup -r 1
+  $ hg debugstrip --no-backup -r 1
   1 files updated, 0 files merged, 0 files removed, 0 files unresolved
 
 Test max chain len
diff --git a/tests/test-copy-move-merge.t b/tests/test-copy-move-merge.t
--- a/tests/test-copy-move-merge.t
+++ b/tests/test-copy-move-merge.t
@@ -79,7 +79,7 @@ 
 
 - next verify copy metadata is lost when disabled
 
-  $ hg strip -r . --config extensions.strip=
+  $ hg debugstrip -r .
   2 files updated, 0 files merged, 0 files removed, 0 files unresolved
   saved backup bundle to $TESTTMP/t/.hg/strip-backup/550bd84c0cd3-fc575957-backup.hg
   $ hg up -qC 2
diff --git a/tests/test-convert-svn-sink.t b/tests/test-convert-svn-sink.t
--- a/tests/test-convert-svn-sink.t
+++ b/tests/test-convert-svn-sink.t
@@ -255,7 +255,7 @@ 
 
   $ hg --cwd a up 5
   0 files updated, 0 files merged, 1 files removed, 0 files unresolved
-  $ hg --cwd a --config extensions.strip= strip -r 6
+  $ hg --cwd a debugstrip -r 6
   saved backup bundle to $TESTTMP/a/.hg/strip-backup/bd4f7b7a7067-ed505e42-backup.hg
 
 #endif
diff --git a/tests/test-convert-filemap.t b/tests/test-convert-filemap.t
--- a/tests/test-convert-filemap.t
+++ b/tests/test-convert-filemap.t
@@ -670,7 +670,7 @@ 
   
 
   $ cd namedbranch
-  $ hg --config extensions.mq= strip tip
+  $ hg --config extensions.mq= debugstrip tip
   1 files updated, 0 files merged, 0 files removed, 0 files unresolved
   saved backup bundle to $TESTTMP/namedbranch/.hg/strip-backup/73899bcbe45c-92adf160-backup.hg
   $ hg up foo
diff --git a/tests/test-completion.t b/tests/test-completion.t
--- a/tests/test-completion.t
+++ b/tests/test-completion.t
@@ -126,6 +126,7 @@ 
   debugsetparents
   debugsidedata
   debugssl
+  debugstrip
   debugsub
   debugsuccessorssets
   debugtemplate
@@ -308,6 +309,7 @@ 
   debugsetparents: 
   debugsidedata: changelog, manifest, dir
   debugssl: 
+  debugstrip: rev, force, no-backup, nobackup, , keep, bookmark, soft
   debugsub: rev
   debugsuccessorssets: closest
   debugtemplate: rev, define
diff --git a/tests/test-commandserver.t b/tests/test-commandserver.t
--- a/tests/test-commandserver.t
+++ b/tests/test-commandserver.t
@@ -441,7 +441,7 @@ 
   ...     # load _phasecache._phaserevs and _phasesets
   ...     runcommand(server, [b'log', b'-qr', b'draft()'])
   ...     # strip cached revisions by another process
-  ...     os.system('hg --config extensions.strip= strip -q 5')
+  ...     os.system('hg debugstrip -q 5')
   ...     # shouldn't abort by "unknown revision '6'"
   ...     runcommand(server, [b'log', b'-qr', b'draft()'])
   ...     bprint(b'')
@@ -475,7 +475,7 @@ 
   ...     runcommand(server, [b'phase', b'.'], outfilter=sep)
   ... 
   ...     # strip 1::4 outside server
-  ...     os.system('hg -q --config extensions.mq= strip 1')
+  ...     os.system('hg -q --config extensions.mq= debugstrip 1')
   ... 
   ...     # shouldn't raise "7966c8e3734d: no node!"
   ...     runcommand(server, [b'branches'])
diff --git a/tests/test-bundle-phases.t b/tests/test-bundle-phases.t
--- a/tests/test-bundle-phases.t
+++ b/tests/test-bundle-phases.t
@@ -2,7 +2,6 @@ 
   > [experimental]
   > bundle-phases=yes
   > [extensions]
-  > strip=
   > drawdag=$TESTDIR/drawdag.py
   > EOF
 
@@ -45,7 +44,7 @@ 
   cache:rev-branch-cache -- {} (mandatory: False)
   phase-heads -- {} (mandatory: True)
       26805aba1e600a82e93661149f2313866a221a7b draft
-  $ hg strip --no-backup C
+  $ hg debugstrip --no-backup C
   $ hg unbundle -q bundle
   $ rm bundle
   $ hg log -G -T '{desc} {phase}\n'
@@ -62,7 +61,7 @@ 
 Root revision's phase is preserved
   $ hg bundle -a bundle
   5 changesets found
-  $ hg strip --no-backup A
+  $ hg debugstrip --no-backup A
   $ hg unbundle -q bundle
   $ rm bundle
   $ hg log -G -T '{desc} {phase}\n'
@@ -80,7 +79,7 @@ 
   $ hg phase --public E
   $ hg bundle -a bundle
   5 changesets found
-  $ hg strip --no-backup A
+  $ hg debugstrip --no-backup A
   $ hg unbundle -q bundle
   $ rm bundle
   $ hg log -G -T '{desc} {phase}\n'
@@ -98,7 +97,7 @@ 
   $ hg phase --secret --force D
   $ hg bundle -a bundle
   5 changesets found
-  $ hg strip --no-backup A
+  $ hg debugstrip --no-backup A
   $ hg unbundle -q bundle
   $ rm bundle
   $ hg log -G -T '{desc} {phase}\n'
@@ -116,7 +115,7 @@ 
   $ hg phase --draft --force B
   $ hg bundle --base B -r E bundle
   3 changesets found
-  $ hg strip --no-backup C
+  $ hg debugstrip --no-backup C
   $ hg phase --public B
   $ hg unbundle -q bundle
   $ rm bundle
@@ -134,7 +133,7 @@ 
 Phase of ancestors of stripped node get advanced to accommodate child
   $ hg bundle --base B -r E bundle
   3 changesets found
-  $ hg strip --no-backup C
+  $ hg debugstrip --no-backup C
   $ hg phase --force --secret B
   $ hg unbundle -q bundle
   $ rm bundle
@@ -172,7 +171,7 @@ 
   o  A public
   
 Unbundling change in the middle of a stack does not affect later changes
-  $ hg strip --no-backup E
+  $ hg debugstrip --no-backup E
   $ hg phase --secret --force D
   $ hg log -G -T '{desc} {phase}\n'
   o  D secret
@@ -238,7 +237,7 @@ 
   phase-heads -- {} (mandatory: True)
       dc0947a82db884575bb76ea10ac97b08536bfa03 public
       03ca77807e919db8807c3749086dc36fb478cac0 draft
-  $ hg strip --no-backup A
+  $ hg debugstrip --no-backup A
   $ hg unbundle -q bundle
   $ rm bundle
   $ hg log -G -T '{node|short} {desc} {phase}\n'
diff --git a/tests/test-branches.t b/tests/test-branches.t
--- a/tests/test-branches.t
+++ b/tests/test-branches.t
@@ -860,7 +860,7 @@ 
   0090: c9 14 c9 9f 00 00 00 06 cd 21 a8 0b 80 00 00 05 |.........!......|
 cache is updated/truncated when stripping - it is thus very hard to get in a
 situation where the cache is out of sync and the hash check detects it
-  $ hg --config extensions.strip= strip -r tip --nob
+  $ hg debugstrip -r tip --nob
   $ f --size .hg/cache/rbc-revs*
   .hg/cache/rbc-revs-v1: size=152
 
diff --git a/tests/test-bookmarks.t b/tests/test-bookmarks.t
--- a/tests/test-bookmarks.t
+++ b/tests/test-bookmarks.t
@@ -882,7 +882,7 @@ 
   1 files updated, 0 files merged, 1 files removed, 0 files unresolved
   (leaving bookmark should-end-on-two)
   $ hg book four
-  $ hg --config extensions.mq= strip 3
+  $ hg --config extensions.mq= debugstrip 3
   saved backup bundle to * (glob)
 should-end-on-two should end up pointing to revision 2, as that's the
 tipmost surviving ancestor of the stripped revision.
diff --git a/tests/test-bookmarks-strip.t b/tests/test-bookmarks-strip.t
--- a/tests/test-bookmarks-strip.t
+++ b/tests/test-bookmarks-strip.t
@@ -55,7 +55,7 @@ 
 
 strip to revision 1
 
-  $ hg strip 1
+  $ hg debugstrip 1
   saved backup bundle to $TESTTMP/.hg/strip-backup/*-backup.hg (glob)
 
 list bookmarks
diff --git a/tests/test-bookmarks-pushpull.t b/tests/test-bookmarks-pushpull.t
--- a/tests/test-bookmarks-pushpull.t
+++ b/tests/test-bookmarks-pushpull.t
@@ -904,7 +904,7 @@ 
   $ hg -R repo1 bookmarks -f -r 2 ADV_ON_REPO1
   $ hg -R repo1 bookmarks -f -r 3 DIFF_ADV_ON_REPO1
   $ hg -R repo1 bookmarks -f -r 3 DIFF_DIVERGED
-  $ hg -R repo1 -q --config extensions.mq= strip 4
+  $ hg -R repo1 -q --config extensions.mq= debugstrip 4
   $ hg -R repo1 log -G --template '{node|short} ({bookmarks})'
   o  6100d3090acf (DIFF_ADV_ON_REPO1 DIFF_DIVERGED)
   |
@@ -921,7 +921,7 @@ 
   $ hg -R repo2 bookmarks -f -r 2 DIVERGED
   $ hg -R repo2 bookmarks -f -r 4 DIFF_ADV_ON_REPO2
   $ hg -R repo2 bookmarks -f -r 4 DIFF_DIVERGED
-  $ hg -R repo2 -q --config extensions.mq= strip 3
+  $ hg -R repo2 -q --config extensions.mq= debugstrip 3
   $ hg -R repo2 log -G --template '{node|short} ({bookmarks})'
   o  e7bd5218ca15 (DIFF_ADV_ON_REPO2 DIFF_DIVERGED)
   |
diff --git a/tests/test-blackbox.t b/tests/test-blackbox.t
--- a/tests/test-blackbox.t
+++ b/tests/test-blackbox.t
@@ -180,15 +180,15 @@ 
   $ hg commit -Amd
   adding d
   created new head
-  $ hg strip tip
+  $ hg debugstrip tip
   0 files updated, 0 files merged, 1 files removed, 0 files unresolved
   saved backup bundle to $TESTTMP/blackboxtest2/.hg/strip-backup/*-backup.hg (glob)
   $ hg blackbox -l 6
-  1970/01/01 00:00:00 bob @73f6ee326b27d820b0472f1a825e3a50f3dc489b (5000)> strip tip
+  1970/01/01 00:00:00 bob @73f6ee326b27d820b0472f1a825e3a50f3dc489b (5000)> debugstrip tip
   1970/01/01 00:00:00 bob @6563da9dcf87b1949716e38ff3e3dfaa3198eb06 (5000)> saved backup bundle to $TESTTMP/blackboxtest2/.hg/strip-backup/73f6ee326b27-7612e004-backup.hg
   1970/01/01 00:00:00 bob @6563da9dcf87b1949716e38ff3e3dfaa3198eb06 (5000)> updated branch cache (base) in * seconds (glob)
   1970/01/01 00:00:00 bob @6563da9dcf87b1949716e38ff3e3dfaa3198eb06 (5000)> wrote branch cache (base) with 1 labels and 2 nodes
-  1970/01/01 00:00:00 bob @6563da9dcf87b1949716e38ff3e3dfaa3198eb06 (5000)> strip tip exited 0 after * seconds (glob)
+  1970/01/01 00:00:00 bob @6563da9dcf87b1949716e38ff3e3dfaa3198eb06 (5000)> debugstrip tip exited 0 after * seconds (glob)
   1970/01/01 00:00:00 bob @6563da9dcf87b1949716e38ff3e3dfaa3198eb06 (5000)> blackbox -l 6
 
 extension and python hooks - use the eol extension for a pythonhook
diff --git a/tests/test-backout.t b/tests/test-backout.t
--- a/tests/test-backout.t
+++ b/tests/test-backout.t
@@ -279,7 +279,7 @@ 
 == test visibility to external preupdate hook
 
   $ hg update -q -C 2
-  $ hg --config extensions.strip= strip 3
+  $ hg debugstrip 3
   saved backup bundle to * (glob)
 
   $ cat >> .hg/hgrc <<EOF
@@ -316,7 +316,7 @@ 
 == test visibility to external update hook
 
   $ hg update -q -C 2
-  $ hg --config extensions.strip= strip 3
+  $ hg debugstrip 3
   saved backup bundle to * (glob)
 
   $ cat >> .hg/hgrc <<EOF
diff --git a/tests/remotefilelog-library.sh b/tests/remotefilelog-library.sh
--- a/tests/remotefilelog-library.sh
+++ b/tests/remotefilelog-library.sh
@@ -6,7 +6,6 @@ 
 [extensions]
 remotefilelog=
 rebase=
-strip=
 [ui]
 ssh=python "$TESTDIR/dummyssh"
 [server]
diff --git a/hgext/strip.py b/mercurial/strip.py
copy from hgext/strip.py
copy to mercurial/strip.py
--- a/hgext/strip.py
+++ b/mercurial/strip.py
@@ -5,26 +5,19 @@ 
 """
 from __future__ import absolute_import
 
-from mercurial.i18n import _
-from mercurial import (
+from .i18n import _
+from . import (
     bookmarks as bookmarksmod,
     cmdutil,
-    error,
     hg,
     lock as lockmod,
-    merge,
     node as nodemod,
-    pycompat,
-    registrar,
     repair,
-    scmutil,
     util,
 )
 nullid = nodemod.nullid
 release = lockmod.release
 
-cmdtable = {}
-command = registrar.command(cmdtable)
 # Note for extension authors: ONLY specify testedwith = 'ships-with-hg-core' for
 # extensions which SHIP WITH MERCURIAL. Non-mainline extensions should
 # be specifying the version(s) of Mercurial they are tested with, or
@@ -40,7 +33,7 @@ 
         cmdutil.checkunfinished(repo, skipmerge=True)
     return s
 
-def _findupdatetarget(repo, nodes):
+def findupdatetarget(repo, nodes):
     unode, p2 = repo.changelog.parents(nodes[0])
     currentbranch = repo[None].branch()
 
@@ -64,7 +57,7 @@ 
 
         if update:
             checklocalchanges(repo, force=force)
-            urev = _findupdatetarget(repo, revs)
+            urev = findupdatetarget(repo, revs)
             hg.clean(repo, urev)
             repo.dirstate.write(repo.currenttransaction())
 
@@ -81,150 +74,3 @@ 
                 repomarks.applychanges(repo, tr, [(b, None) for b in bookmarks])
             for bookmark in sorted(bookmarks):
                 ui.write(_("bookmark '%s' deleted\n") % bookmark)
-
-@command("strip",
-         [
-          ('r', 'rev', [], _('strip specified revision (optional, '
-                               'can specify revisions without this '
-                               'option)'), _('REV')),
-          ('f', 'force', None, _('force removal of changesets, discard '
-                                 'uncommitted changes (no backup)')),
-          ('', 'no-backup', None, _('do not save backup bundle')),
-          ('', 'nobackup', None, _('do not save backup bundle '
-                                   '(DEPRECATED)')),
-          ('n', '', None, _('ignored  (DEPRECATED)')),
-          ('k', 'keep', None, _("do not modify working directory during "
-                                "strip")),
-          ('B', 'bookmark', [], _("remove revs only reachable from given"
-                                  " bookmark"), _('BOOKMARK')),
-          ('', 'soft', None,
-          _("simply drop changesets from visible history (EXPERIMENTAL)")),
-         ],
-          _('hg strip [-k] [-f] [-B bookmark] [-r] REV...'),
-          helpcategory=command.CATEGORY_MAINTENANCE)
-def stripcmd(ui, repo, *revs, **opts):
-    """strip changesets and all their descendants from the repository
-
-    The strip command removes the specified changesets and all their
-    descendants. If the working directory has uncommitted changes, the
-    operation is aborted unless the --force flag is supplied, in which
-    case changes will be discarded.
-
-    If a parent of the working directory is stripped, then the working
-    directory will automatically be updated to the most recent
-    available ancestor of the stripped parent after the operation
-    completes.
-
-    Any stripped changesets are stored in ``.hg/strip-backup`` as a
-    bundle (see :hg:`help bundle` and :hg:`help unbundle`). They can
-    be restored by running :hg:`unbundle .hg/strip-backup/BUNDLE`,
-    where BUNDLE is the bundle file created by the strip. Note that
-    the local revision numbers will in general be different after the
-    restore.
-
-    Use the --no-backup option to discard the backup bundle once the
-    operation completes.
-
-    Strip is not a history-rewriting operation and can be used on
-    changesets in the public phase. But if the stripped changesets have
-    been pushed to a remote repository you will likely pull them again.
-
-    Return 0 on success.
-    """
-    opts = pycompat.byteskwargs(opts)
-    backup = True
-    if opts.get('no_backup') or opts.get('nobackup'):
-        backup = False
-
-    cl = repo.changelog
-    revs = list(revs) + opts.get('rev')
-    revs = set(scmutil.revrange(repo, revs))
-
-    with repo.wlock():
-        bookmarks = set(opts.get('bookmark'))
-        if bookmarks:
-            repomarks = repo._bookmarks
-            if not bookmarks.issubset(repomarks):
-                raise error.Abort(_("bookmark '%s' not found") %
-                    ','.join(sorted(bookmarks - set(repomarks.keys()))))
-
-            # If the requested bookmark is not the only one pointing to a
-            # a revision we have to only delete the bookmark and not strip
-            # anything. revsets cannot detect that case.
-            nodetobookmarks = {}
-            for mark, node in repomarks.iteritems():
-                nodetobookmarks.setdefault(node, []).append(mark)
-            for marks in nodetobookmarks.values():
-                if bookmarks.issuperset(marks):
-                    rsrevs = scmutil.bookmarkrevs(repo, marks[0])
-                    revs.update(set(rsrevs))
-            if not revs:
-                with repo.lock(), repo.transaction('bookmark') as tr:
-                    bmchanges = [(b, None) for b in bookmarks]
-                    repomarks.applychanges(repo, tr, bmchanges)
-                for bookmark in sorted(bookmarks):
-                    ui.write(_("bookmark '%s' deleted\n") % bookmark)
-
-        if not revs:
-            raise error.Abort(_('empty revision set'))
-
-        descendants = set(cl.descendants(revs))
-        strippedrevs = revs.union(descendants)
-        roots = revs.difference(descendants)
-
-        # if one of the wdir parent is stripped we'll need
-        # to update away to an earlier revision
-        update = any(p != nullid and cl.rev(p) in strippedrevs
-                     for p in repo.dirstate.parents())
-
-        rootnodes = set(cl.node(r) for r in roots)
-
-        q = getattr(repo, 'mq', None)
-        if q is not None and q.applied:
-            # refresh queue state if we're about to strip
-            # applied patches
-            if cl.rev(repo.lookup('qtip')) in strippedrevs:
-                q.applieddirty = True
-                start = 0
-                end = len(q.applied)
-                for i, statusentry in enumerate(q.applied):
-                    if statusentry.node in rootnodes:
-                        # if one of the stripped roots is an applied
-                        # patch, only part of the queue is stripped
-                        start = i
-                        break
-                del q.applied[start:end]
-                q.savedirty()
-
-        revs = sorted(rootnodes)
-        if update and opts.get('keep'):
-            urev = _findupdatetarget(repo, revs)
-            uctx = repo[urev]
-
-            # only reset the dirstate for files that would actually change
-            # between the working context and uctx
-            descendantrevs = repo.revs(b"%d::.", uctx.rev())
-            changedfiles = []
-            for rev in descendantrevs:
-                # blindly reset the files, regardless of what actually changed
-                changedfiles.extend(repo[rev].files())
-
-            # reset files that only changed in the dirstate too
-            dirstate = repo.dirstate
-            dirchanges = [f for f in dirstate if dirstate[f] != 'n']
-            changedfiles.extend(dirchanges)
-
-            repo.dirstate.rebuild(urev, uctx.manifest(), changedfiles)
-            repo.dirstate.write(repo.currenttransaction())
-
-            # clear resolve state
-            merge.mergestate.clean(repo, repo['.'].node())
-
-            update = False
-
-
-        strip(ui, repo, revs, backup=backup, update=update,
-              force=opts.get('force'), bookmarks=bookmarks,
-              soft=opts['soft'])
-
-    return 0
diff --git a/mercurial/debugcommands.py b/mercurial/debugcommands.py
--- a/mercurial/debugcommands.py
+++ b/mercurial/debugcommands.py
@@ -70,6 +70,7 @@ 
     sshpeer,
     sslutil,
     streamclone,
+    strip as stripmod,
     templater,
     treediscovery,
     upgrade,
@@ -2726,6 +2727,150 @@ 
     finally:
         s.close()
 
+@command("debugstrip",
+    [
+     ('r', 'rev', [], _('strip specified revision (optional, can specify '
+                        'revisions without this option)'), _('REV')),
+     ('f', 'force', None, _('force removal of changesets, discard uncommitted'
+                            ' changes (no backup)')),
+     ('', 'no-backup', None, _('do not save backup bundle')),
+     ('', 'nobackup', None, _('do not save backup bundle (DEPRECATED)')),
+     ('n', '', None, _('ignored  (DEPRECATED)')),
+     ('k', 'keep', None, _("do not modify working directory during strip")),
+     ('B', 'bookmark', [], _("remove revs only reachable from given bookmark"),
+                           _('BOOKMARK')),
+     ('', 'soft', None,
+     _("simply drop changesets from visible history (EXPERIMENTAL)")),
+    ],
+    _('hg strip [-k] [-f] [-B bookmark] [-r] REV...'),
+    helpcategory=command.CATEGORY_MAINTENANCE)
+def debugstrip(ui, repo, *revs, **opts):
+    """strip changesets and all their descendants from the repository
+
+    The strip command removes the specified changesets and all their
+    descendants. If the working directory has uncommitted changes, the
+    operation is aborted unless the --force flag is supplied, in which
+    case changes will be discarded.
+
+    If a parent of the working directory is stripped, then the working
+    directory will automatically be updated to the most recent
+    available ancestor of the stripped parent after the operation
+    completes.
+
+    Any stripped changesets are stored in ``.hg/strip-backup`` as a
+    bundle (see :hg:`help bundle` and :hg:`help unbundle`). They can
+    be restored by running :hg:`unbundle .hg/strip-backup/BUNDLE`,
+    where BUNDLE is the bundle file created by the strip. Note that
+    the local revision numbers will in general be different after the
+    restore.
+
+    Use the --no-backup option to discard the backup bundle once the
+    operation completes.
+
+    Strip is not a history-rewriting operation and can be used on
+    changesets in the public phase. But if the stripped changesets have
+    been pushed to a remote repository you will likely pull them again.
+
+    Return 0 on success.
+    """
+    opts = pycompat.byteskwargs(opts)
+    backup = True
+    if opts.get('no_backup') or opts.get('nobackup'):
+        backup = False
+
+    cl = repo.changelog
+    revs = list(revs) + opts.get('rev')
+    revs = set(scmutil.revrange(repo, revs))
+
+    with repo.wlock():
+        bookmarks = set(opts.get('bookmark'))
+        if bookmarks:
+            repomarks = repo._bookmarks
+            if not bookmarks.issubset(repomarks):
+                raise error.Abort(_("bookmark '%s' not found") %
+                    ','.join(sorted(bookmarks - set(repomarks.keys()))))
+
+            # If the requested bookmark is not the only one pointing to a
+            # a revision we have to only delete the bookmark and not strip
+            # anything. revsets cannot detect that case.
+            nodetobookmarks = {}
+            for mark, node in repomarks.iteritems():
+                nodetobookmarks.setdefault(node, []).append(mark)
+            for marks in nodetobookmarks.values():
+                if bookmarks.issuperset(marks):
+                    rsrevs = scmutil.bookmarkrevs(repo, marks[0])
+                    revs.update(set(rsrevs))
+            if not revs:
+                with repo.lock(), repo.transaction('bookmark') as tr:
+                    bmchanges = [(b, None) for b in bookmarks]
+                    repomarks.applychanges(repo, tr, bmchanges)
+                for bookmark in sorted(bookmarks):
+                    ui.write(_("bookmark '%s' deleted\n") % bookmark)
+
+        if not revs:
+            raise error.Abort(_('empty revision set'))
+
+        descendants = set(cl.descendants(revs))
+        strippedrevs = revs.union(descendants)
+        roots = revs.difference(descendants)
+
+        # if one of the wdir parent is stripped we'll need
+        # to update away to an earlier revision
+        update = any(p != nullid and cl.rev(p) in strippedrevs
+                     for p in repo.dirstate.parents())
+
+        rootnodes = set(cl.node(r) for r in roots)
+
+        q = getattr(repo, 'mq', None)
+        if q is not None and q.applied:
+            # refresh queue state if we're about to strip
+            # applied patches
+            if cl.rev(repo.lookup('qtip')) in strippedrevs:
+                q.applieddirty = True
+                start = 0
+                end = len(q.applied)
+                for i, statusentry in enumerate(q.applied):
+                    if statusentry.node in rootnodes:
+                        # if one of the stripped roots is an applied
+                        # patch, only part of the queue is stripped
+                        start = i
+                        break
+                del q.applied[start:end]
+                q.savedirty()
+
+        revs = sorted(rootnodes)
+        if update and opts.get('keep'):
+            urev = stripmod.findupdatetarget(repo, revs)
+            uctx = repo[urev]
+
+            # only reset the dirstate for files that would actually change
+            # between the working context and uctx
+            descendantrevs = repo.revs(b"%d::.", uctx.rev())
+            changedfiles = []
+            for rev in descendantrevs:
+                # blindly reset the files, regardless of what actually changed
+                changedfiles.extend(repo[rev].files())
+
+            # reset files that only changed in the dirstate too
+            dirstate = repo.dirstate
+            dirchanges = [f for f in dirstate if dirstate[f] != 'n']
+            changedfiles.extend(dirchanges)
+
+            repo.dirstate.rebuild(urev, uctx.manifest(), changedfiles)
+            repo.dirstate.write(repo.currenttransaction())
+
+            # clear resolve state
+            mergemod.mergestate.clean(repo, repo['.'].node())
+
+            update = False
+
+
+        stripmod.strip(ui, repo, revs, backup=backup, update=update,
+                       force=opts.get('force'), bookmarks=bookmarks,
+                       soft=opts['soft'])
+
+    return 0
+
 @command('debugsub',
     [('r', 'rev', '',
      _('revision to check'), _('REV'))],
diff --git a/hgext/strip.py b/hgext/strip.py
--- a/hgext/strip.py
+++ b/hgext/strip.py
@@ -1,107 +1,42 @@ 
 """strip changesets and their descendants from history
 
-This extension allows you to strip changesets and all their descendants from the
-repository. See the command help for details.
+strip extension has been renamed to debugstrip and moved to core. However,
+this extension is to preserve the old `strip` name forusers that are used
+to that.
 """
+
 from __future__ import absolute_import
-
 from mercurial.i18n import _
+from mercurial.node import nullid
 from mercurial import (
-    bookmarks as bookmarksmod,
-    cmdutil,
     error,
-    hg,
-    lock as lockmod,
-    merge,
-    node as nodemod,
+    merge as mergemod,
     pycompat,
     registrar,
-    repair,
     scmutil,
-    util,
+    strip as stripmod,
 )
-nullid = nodemod.nullid
-release = lockmod.release
 
 cmdtable = {}
 command = registrar.command(cmdtable)
-# Note for extension authors: ONLY specify testedwith = 'ships-with-hg-core' for
-# extensions which SHIP WITH MERCURIAL. Non-mainline extensions should
-# be specifying the version(s) of Mercurial they are tested with, or
-# leave the attribute unspecified.
-testedwith = 'ships-with-hg-core'
-
-def checklocalchanges(repo, force=False):
-    s = repo.status()
-    if not force:
-        cmdutil.checkunfinished(repo)
-        cmdutil.bailifchanged(repo)
-    else:
-        cmdutil.checkunfinished(repo, skipmerge=True)
-    return s
-
-def _findupdatetarget(repo, nodes):
-    unode, p2 = repo.changelog.parents(nodes[0])
-    currentbranch = repo[None].branch()
-
-    if (util.safehasattr(repo, 'mq') and p2 != nullid
-        and p2 in [x.node for x in repo.mq.applied]):
-        unode = p2
-    elif currentbranch != repo[unode].branch():
-        pwdir = 'parents(wdir())'
-        revset = 'max(((parents(%ln::%r) + %r) - %ln::%r) and branch(%s))'
-        branchtarget = repo.revs(revset, nodes, pwdir, pwdir, nodes, pwdir,
-                                 currentbranch)
-        if branchtarget:
-            cl = repo.changelog
-            unode = cl.node(branchtarget.first())
-
-    return unode
-
-def strip(ui, repo, revs, update=True, backup=True, force=None, bookmarks=None,
-          soft=False):
-    with repo.wlock(), repo.lock():
-
-        if update:
-            checklocalchanges(repo, force=force)
-            urev = _findupdatetarget(repo, revs)
-            hg.clean(repo, urev)
-            repo.dirstate.write(repo.currenttransaction())
-
-        if soft:
-            repair.softstrip(ui, repo, revs, backup)
-        else:
-            repair.strip(ui, repo, revs, backup)
-
-        repomarks = repo._bookmarks
-        if bookmarks:
-            with repo.transaction('strip') as tr:
-                if repo._activebookmark in bookmarks:
-                    bookmarksmod.deactivate(repo)
-                repomarks.applychanges(repo, tr, [(b, None) for b in bookmarks])
-            for bookmark in sorted(bookmarks):
-                ui.write(_("bookmark '%s' deleted\n") % bookmark)
 
 @command("strip",
-         [
-          ('r', 'rev', [], _('strip specified revision (optional, '
-                               'can specify revisions without this '
-                               'option)'), _('REV')),
-          ('f', 'force', None, _('force removal of changesets, discard '
-                                 'uncommitted changes (no backup)')),
-          ('', 'no-backup', None, _('do not save backup bundle')),
-          ('', 'nobackup', None, _('do not save backup bundle '
-                                   '(DEPRECATED)')),
-          ('n', '', None, _('ignored  (DEPRECATED)')),
-          ('k', 'keep', None, _("do not modify working directory during "
-                                "strip")),
-          ('B', 'bookmark', [], _("remove revs only reachable from given"
-                                  " bookmark"), _('BOOKMARK')),
-          ('', 'soft', None,
-          _("simply drop changesets from visible history (EXPERIMENTAL)")),
-         ],
-          _('hg strip [-k] [-f] [-B bookmark] [-r] REV...'),
-          helpcategory=command.CATEGORY_MAINTENANCE)
+    [
+     ('r', 'rev', [], _('strip specified revision (optional, can specify '
+                        'revisions without this option)'), _('REV')),
+     ('f', 'force', None, _('force removal of changesets, discard uncommitted'
+                            ' changes (no backup)')),
+     ('', 'no-backup', None, _('do not save backup bundle')),
+     ('', 'nobackup', None, _('do not save backup bundle (DEPRECATED)')),
+     ('n', '', None, _('ignored  (DEPRECATED)')),
+     ('k', 'keep', None, _("do not modify working directory during strip")),
+     ('B', 'bookmark', [], _("remove revs only reachable from given bookmark"),
+                           _('BOOKMARK')),
+     ('', 'soft', None,
+     _("simply drop changesets from visible history (EXPERIMENTAL)")),
+    ],
+    _('hg strip [-k] [-f] [-B bookmark] [-r] REV...'),
+    helpcategory=command.CATEGORY_MAINTENANCE)
 def stripcmd(ui, repo, *revs, **opts):
     """strip changesets and all their descendants from the repository
 
@@ -198,7 +133,7 @@ 
 
         revs = sorted(rootnodes)
         if update and opts.get('keep'):
-            urev = _findupdatetarget(repo, revs)
+            urev = stripmod.findupdatetarget(repo, revs)
             uctx = repo[urev]
 
             # only reset the dirstate for files that would actually change
@@ -218,13 +153,13 @@ 
             repo.dirstate.write(repo.currenttransaction())
 
             # clear resolve state
-            merge.mergestate.clean(repo, repo['.'].node())
+            mergemod.mergestate.clean(repo, repo['.'].node())
 
             update = False
 
 
-        strip(ui, repo, revs, backup=backup, update=update,
-              force=opts.get('force'), bookmarks=bookmarks,
-              soft=opts['soft'])
+        stripmod.strip(ui, repo, revs, backup=backup, update=update,
+                       force=opts.get('force'), bookmarks=bookmarks,
+                       soft=opts['soft'])
 
     return 0
diff --git a/hgext/mq.py b/hgext/mq.py
--- a/hgext/mq.py
+++ b/hgext/mq.py
@@ -94,6 +94,7 @@ 
     revsetlang,
     scmutil,
     smartset,
+    strip as stripmod,
     subrepoutil,
     util,
     vfs as vfsmod,
@@ -130,20 +131,7 @@ 
     default=False,
 )
 
-# force load strip extension formerly included in mq and import some utility
-try:
-    stripext = extensions.find('strip')
-except KeyError:
-    # note: load is lazy so we could avoid the try-except,
-    # but I (marmoute) prefer this explicit code.
-    class dummyui(object):
-        def debug(self, msg):
-            pass
-        def log(self, event, msgfmt, *msgargs, **opts):
-            pass
-    stripext = extensions.load(dummyui(), 'strip', '')
-
-strip = stripext.strip
+strip = stripmod.strip
 
 def checksubstate(repo, baserev=None):
     '''return list of subrepos at a different revision than substate.