Patchwork [05,of,13,sparse,V2] sparse: rename command to debugsparse

login
register
mail settings
Submitter Gregory Szorc
Date July 6, 2017, 7:36 p.m.
Message ID <a772c2781b074d61f518.1499369791@ubuntu-vm-main>
Download mbox | patch
Permalink /patch/22034/
State Accepted
Headers show

Comments

Gregory Szorc - July 6, 2017, 7:36 p.m.
# HG changeset patch
# User Gregory Szorc <gregory.szorc@gmail.com>
# Date 1498930167 25200
#      Sat Jul 01 10:29:27 2017 -0700
# Node ID a772c2781b074d61f518ccf415291ab2091b0048
# Parent  452ec637b490dc1a7137777a4adbb84a9301bed5
sparse: rename command to debugsparse

Sparse checkout is still highly experimental and not protected
by BC guarantees yet. We also haven't had a discussion on the UX.

To discourage use, we rename the sparse command to debugsparse.

Patch

diff --git a/hgext/sparse.py b/hgext/sparse.py
--- a/hgext/sparse.py
+++ b/hgext/sparse.py
@@ -335,7 +335,7 @@  def _setupdirstate(ui):
 
     # Prevent adding files that are outside the sparse checkout
     editfuncs = ['normal', 'add', 'normallookup', 'copy', 'remove', 'merge']
-    hint = _('include file with `hg sparse --include <pattern>` or use ' +
+    hint = _('include file with `hg debugsparse --include <pattern>` or use ' +
              '`hg add -s <file>` to include file directory while adding')
     for func in editfuncs:
         def _wrapper(orig, self, *args):
@@ -622,7 +622,7 @@  def _wraprepo(ui, repo):
     repo.signaturecache = {}
     repo.__class__ = SparseRepo
 
-@command('^sparse', [
+@command('^debugsparse', [
     ('I', 'include', False, _('include files in the sparse checkout')),
     ('X', 'exclude', False, _('exclude files in the sparse checkout')),
     ('d', 'delete', False, _('delete an include/exclude rule')),
@@ -635,7 +635,7 @@  def _wraprepo(ui, repo):
     ('', 'reset', False, _('makes the repo full again')),
     ] + commands.templateopts,
     _('[--OPTION] PATTERN...'))
-def sparse(ui, repo, *pats, **opts):
+def debugsparse(ui, repo, *pats, **opts):
     """make the current checkout sparse, or edit the existing checkout
 
     The sparse command is used to make the current checkout sparse.
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
@@ -27,10 +27,10 @@  test sparse
 
 Clear rules when there are includes
 
-  $ hg sparse --include *.py
+  $ hg debugsparse --include *.py
   $ ls
   data.py
-  $ hg sparse --clear-rules
+  $ hg debugsparse --clear-rules
   $ ls
   base.sparse
   data.py
@@ -40,12 +40,12 @@  Clear rules when there are includes
 
 Clear rules when there are excludes
 
-  $ hg sparse --exclude *.sparse
+  $ hg debugsparse --exclude *.sparse
   $ ls
   data.py
   index.html
   readme.txt
-  $ hg sparse --clear-rules
+  $ hg debugsparse --clear-rules
   $ ls
   base.sparse
   data.py
@@ -55,18 +55,18 @@  Clear rules when there are excludes
 
 Clearing rules should not alter profiles
 
-  $ hg sparse --enable-profile webpage.sparse
+  $ hg debugsparse --enable-profile webpage.sparse
   $ ls
   base.sparse
   index.html
   webpage.sparse
-  $ hg sparse --include *.py
+  $ hg debugsparse --include *.py
   $ ls
   base.sparse
   data.py
   index.html
   webpage.sparse
-  $ hg sparse --clear-rules
+  $ hg debugsparse --clear-rules
   $ ls
   base.sparse
   index.html
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
@@ -31,11 +31,11 @@  Import a rules file against a 'blank' sp
   > [include]
   > *.py
   > EOF
-  $ hg sparse --import-rules $TESTTMP/rules_to_import
+  $ hg debugsparse --import-rules $TESTTMP/rules_to_import
   $ ls
   data.py
 
-  $ hg sparse --reset
+  $ hg debugsparse --reset
   $ rm .hg/sparse
 
   $ cat > $TESTTMP/rules_to_import <<EOF
@@ -43,19 +43,19 @@  Import a rules file against a 'blank' sp
   > [include]
   > *.py
   > EOF
-  $ hg sparse --import-rules $TESTTMP/rules_to_import
+  $ hg debugsparse --import-rules $TESTTMP/rules_to_import
   $ ls
   base.sparse
   data.py
   webpage.sparse
 
-  $ hg sparse --reset
+  $ hg debugsparse --reset
   $ rm .hg/sparse
 
 Start against an existing profile; rules *already active* should be ignored
 
-  $ hg sparse --enable-profile webpage.sparse
-  $ hg sparse --include *.py
+  $ hg debugsparse --enable-profile webpage.sparse
+  $ hg debugsparse --include *.py
   $ cat > $TESTTMP/rules_to_import <<EOF
   > %include base.sparse
   > [include]
@@ -64,7 +64,7 @@  Start against an existing profile; rules
   > [exclude]
   > *.py
   > EOF
-  $ hg sparse --import-rules $TESTTMP/rules_to_import
+  $ hg debugsparse --import-rules $TESTTMP/rules_to_import
   $ ls
   base.sparse
   index.html
@@ -78,7 +78,7 @@  Start against an existing profile; rules
   [exclude]
   *.py
 
-  $ hg sparse --reset
+  $ hg debugsparse --reset
   $ rm .hg/sparse
 
 Same tests, with -Tjson enabled to output summaries
@@ -87,7 +87,7 @@  Same tests, with -Tjson enabled to outpu
   > [include]
   > *.py
   > EOF
-  $ hg sparse --import-rules $TESTTMP/rules_to_import -Tjson
+  $ hg debugsparse --import-rules $TESTTMP/rules_to_import -Tjson
   [
    {
     "exclude_rules_added": 0,
@@ -99,7 +99,7 @@  Same tests, with -Tjson enabled to outpu
    }
   ]
 
-  $ hg sparse --reset
+  $ hg debugsparse --reset
   $ rm .hg/sparse
 
   $ cat > $TESTTMP/rules_to_import <<EOF
@@ -107,7 +107,7 @@  Same tests, with -Tjson enabled to outpu
   > [include]
   > *.py
   > EOF
-  $ hg sparse --import-rules $TESTTMP/rules_to_import -Tjson
+  $ hg debugsparse --import-rules $TESTTMP/rules_to_import -Tjson
   [
    {
     "exclude_rules_added": 0,
@@ -119,11 +119,11 @@  Same tests, with -Tjson enabled to outpu
    }
   ]
 
-  $ hg sparse --reset
+  $ hg debugsparse --reset
   $ rm .hg/sparse
 
-  $ hg sparse --enable-profile webpage.sparse
-  $ hg sparse --include *.py
+  $ hg debugsparse --enable-profile webpage.sparse
+  $ hg debugsparse --include *.py
   $ cat > $TESTTMP/rules_to_import <<EOF
   > %include base.sparse
   > [include]
@@ -132,7 +132,7 @@  Same tests, with -Tjson enabled to outpu
   > [exclude]
   > *.py
   > EOF
-  $ hg sparse --import-rules $TESTTMP/rules_to_import -Tjson
+  $ hg debugsparse --import-rules $TESTTMP/rules_to_import -Tjson
   [
    {
     "exclude_rules_added": 1,
@@ -166,7 +166,7 @@  If importing results in no new rules bei
   > [include]
   > *.py
   > EOF
-  $ hg sparse --import-rules $TESTTMP/rules_to_import
+  $ hg debugsparse --import-rules $TESTTMP/rules_to_import
 
 If an exception is raised during refresh, restore the existing rules again.
 
@@ -174,7 +174,7 @@  If an exception is raised during refresh
   > [exclude]
   > *.html
   > EOF
-  $ hg sparse --import-rules $TESTTMP/rules_to_import
+  $ hg debugsparse --import-rules $TESTTMP/rules_to_import
   abort: sparse._refresh called!
   [255]
   $ cat .hg/sparse
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
@@ -19,7 +19,7 @@  test merging things outside of the spars
   $ hg commit -m 'feature - bar2'
 
   $ hg update -q default
-  $ hg sparse --exclude 'bar**'
+  $ hg debugsparse --exclude 'bar**'
 
   $ hg merge feature
   temporarily included 1 file(s) in the sparse checkout for merging
@@ -55,7 +55,7 @@  copy
   $ hg ci -Aqm 'add branchonly'
 
   $ hg up -q default
-  $ hg sparse -X branchonly
+  $ hg debugsparse -X branchonly
   $ hg merge feature
   temporarily included 2 file(s) in the sparse checkout for merging
   2 files updated, 0 files merged, 0 files removed, 0 files unresolved
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
@@ -25,11 +25,11 @@  test sparse
   > EOF
   $ hg ci -Aqm 'initial'
 
-  $ hg sparse --include '*.sparse'
+  $ hg debugsparse --include '*.sparse'
 
 Verify enabling a single profile works
 
-  $ hg sparse --enable-profile webpage.sparse
+  $ hg debugsparse --enable-profile webpage.sparse
   $ ls
   backend.sparse
   index.html
@@ -37,7 +37,7 @@  Verify enabling a single profile works
 
 Verify enabling two profiles works
 
-  $ hg sparse --enable-profile backend.sparse
+  $ hg debugsparse --enable-profile backend.sparse
   $ ls
   backend.sparse
   data.py
@@ -46,7 +46,7 @@  Verify enabling two profiles works
 
 Verify disabling a profile works
 
-  $ hg sparse --disable-profile webpage.sparse
+  $ hg debugsparse --disable-profile webpage.sparse
   $ ls
   backend.sparse
   data.py
@@ -220,11 +220,11 @@  Test checking out a commit that does not
 warning message can be suppressed by setting missingwarning = false in
 [sparse] section of your config:
 
-  $ hg sparse --reset
+  $ hg debugsparse --reset
   $ hg rm *.sparse
   $ hg commit -m "delete profiles"
   $ hg up -q ".^"
-  $ hg sparse --enable-profile backend.sparse
+  $ hg debugsparse --enable-profile backend.sparse
   $ ls
   index.html
   readme.txt
@@ -235,14 +235,14 @@  warning message can be suppressed by set
   data.py
   index.html
   readme.txt
-  $ hg sparse --disable-profile backend.sparse | grep warning
+  $ hg debugsparse --disable-profile backend.sparse | grep warning
   warning: sparse profile 'backend.sparse' not found in rev bfcb76de99cc - ignoring it
   [1]
   $ cat >> .hg/hgrc <<EOF
   > [sparse]
   > missingwarning = false
   > EOF
-  $ hg sparse --enable-profile backend.sparse
+  $ hg debugsparse --enable-profile backend.sparse
 
   $ cd ..
 
@@ -265,7 +265,7 @@  Test file permissions changing across a 
   > EOF
   $ hg commit -qm 'update profile'
   $ hg up -q 0
-  $ hg sparse --enable-profile .hgsparse
+  $ hg debugsparse --enable-profile .hgsparse
   $ hg up -q 2
   $ ls -l b
   -rwxr-xr-x* b (glob)
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
@@ -21,7 +21,7 @@  test sparse with --verbose and -T json
 Verify basic --include and --reset
 
   $ hg up -q 0
-  $ hg sparse --include 'hide' -Tjson
+  $ hg debugsparse --include 'hide' -Tjson
   [
    {
     "exclude_rules_added": 0,
@@ -32,14 +32,14 @@  Verify basic --include and --reset
     "profiles_added": 0
    }
   ]
-  $ hg sparse --clear-rules
-  $ hg sparse --include 'hide' --verbose
+  $ hg debugsparse --clear-rules
+  $ hg debugsparse --include 'hide' --verbose
   removing show
   Profile # change: 0
   Include rule # change: 1
   Exclude rule # change: 0
 
-  $ hg sparse --reset -Tjson
+  $ hg debugsparse --reset -Tjson
   [
    {
     "exclude_rules_added": 0,
@@ -50,8 +50,8 @@  Verify basic --include and --reset
     "profiles_added": 0
    }
   ]
-  $ hg sparse --include 'hide'
-  $ hg sparse --reset --verbose
+  $ hg debugsparse --include 'hide'
+  $ hg debugsparse --reset --verbose
   getting show
   Profile # change: 0
   Include rule # change: -1
@@ -59,9 +59,9 @@  Verify basic --include and --reset
 
 Verifying that problematic files still allow us to see the deltas when forcing:
 
-  $ hg sparse --include 'show*'
+  $ hg debugsparse --include 'show*'
   $ touch hide
-  $ hg sparse --delete 'show*' --force -Tjson
+  $ hg debugsparse --delete 'show*' --force -Tjson
   pending changes to 'hide'
   [
    {
@@ -73,9 +73,9 @@  Verifying that problematic files still a
     "profiles_added": 0
    }
   ]
-  $ hg sparse --include 'show*' --force
+  $ hg debugsparse --include 'show*' --force
   pending changes to 'hide'
-  $ hg sparse --delete 'show*' --force --verbose
+  $ hg debugsparse --delete 'show*' --force --verbose
   pending changes to 'hide'
   Profile # change: 0
   Include rule # change: -1
diff --git a/tests/test-sparse.t b/tests/test-sparse.t
--- a/tests/test-sparse.t
+++ b/tests/test-sparse.t
@@ -21,17 +21,17 @@  test sparse
 Verify basic --include
 
   $ hg up -q 0
-  $ hg sparse --include 'hide'
+  $ hg debugsparse --include 'hide'
   $ ls
   hide
 
 Absolute paths outside the repo should just be rejected
 
-  $ hg sparse --include /foo/bar
+  $ hg debugsparse --include /foo/bar
   warning: paths cannot start with /, ignoring: ['/foo/bar']
-  $ hg sparse --include '$TESTTMP/myrepo/hide'
+  $ hg debugsparse --include '$TESTTMP/myrepo/hide'
 
-  $ hg sparse --include '/root'
+  $ hg debugsparse --include '/root'
   warning: paths cannot start with /, ignoring: ['/root']
 
 Verify commiting while sparse includes other files
@@ -46,7 +46,7 @@  Verify commiting while sparse includes o
 
 Verify --reset brings files back
 
-  $ hg sparse --reset
+  $ hg debugsparse --reset
   $ ls
   hide
   show
@@ -55,12 +55,12 @@  Verify --reset brings files back
   $ cat show
   a
 
-Verify 'hg sparse' default output
+Verify 'hg debugsparse' default output
 
   $ hg up -q null
-  $ hg sparse --include 'show*'
+  $ hg debugsparse --include 'show*'
 
-  $ hg sparse
+  $ hg debugsparse
   [include]
   show*
   [exclude]
@@ -89,19 +89,19 @@  Adding an excluded file should fail
 
   $ hg add hide3
   abort: cannot add 'hide3' - it is outside the sparse checkout
-  (include file with `hg sparse --include <pattern>` or use `hg add -s <file>` to include file directory while adding)
+  (include file with `hg debugsparse --include <pattern>` or use `hg add -s <file>` to include file directory while adding)
   [255]
 
 Verify deleting sparseness while a file has changes fails
 
-  $ hg sparse --delete 'show*'
+  $ hg debugsparse --delete 'show*'
   pending changes to 'hide'
   abort: cannot change sparseness due to pending changes (delete the files or use --force to bring them back dirty)
   [255]
 
 Verify deleting sparseness with --force brings back files
 
-  $ hg sparse --delete -f 'show*'
+  $ hg debugsparse --delete -f 'show*'
   pending changes to 'hide'
   $ ls
   hide
@@ -116,14 +116,14 @@  Verify deleting sparseness with --force 
 
 Verify editing sparseness fails if pending changes
 
-  $ hg sparse --include 'show*'
+  $ hg debugsparse --include 'show*'
   pending changes to 'hide'
   abort: could not update sparseness due to pending changes
   [255]
 
 Verify adding sparseness hides files
 
-  $ hg sparse --exclude -f 'hide*'
+  $ hg debugsparse --exclude -f 'hide*'
   pending changes to 'hide'
   $ ls
   hide
@@ -149,7 +149,7 @@  Verify rebase temporarily includes exclu
   unresolved conflicts (see hg resolve, then hg rebase --continue)
   [1]
 
-  $ hg sparse
+  $ hg debugsparse
   [include]
   
   [exclude]
@@ -186,7 +186,7 @@  Verify merge fails if merging excluded f
   0 files updated, 0 files merged, 0 files removed, 1 files unresolved
   use 'hg resolve' to retry unresolved file merges or 'hg update -C .' to abandon
   [1]
-  $ hg sparse
+  $ hg debugsparse
   [include]
   
   [exclude]
@@ -198,7 +198,7 @@  Verify merge fails if merging excluded f
   $ hg up -C .
   cleaned up 1 temporarily added file(s) from the sparse checkout
   1 files updated, 0 files merged, 0 files removed, 0 files unresolved
-  $ hg sparse
+  $ hg debugsparse
   [include]
   
   [exclude]
@@ -208,7 +208,7 @@  Verify merge fails if merging excluded f
 Verify strip -k resets dirstate correctly
 
   $ hg status
-  $ hg sparse
+  $ hg debugsparse
   [include]
   
   [exclude]
@@ -246,15 +246,15 @@  Test status on a file in a subdir
 
   $ mkdir -p dir1/dir2
   $ touch dir1/dir2/file
-  $ hg sparse -I dir1/dir2
+  $ hg debugsparse -I dir1/dir2
   $ hg status
   ? dir1/dir2/file
 
 Test that add -s adds dirs to sparse profile
 
-  $ hg sparse --reset
-  $ hg sparse --include empty
-  $ hg sparse
+  $ hg debugsparse --reset
+  $ hg debugsparse --include empty
+  $ hg debugsparse
   [include]
   empty
   [exclude]
@@ -266,13 +266,13 @@  Test that add -s adds dirs to sparse pro
   $ touch add/bar
   $ hg add add/foo
   abort: cannot add 'add/foo' - it is outside the sparse checkout
-  (include file with `hg sparse --include <pattern>` or use `hg add -s <file>` to include file directory while adding)
+  (include file with `hg debugsparse --include <pattern>` or use `hg add -s <file>` to include file directory while adding)
   [255]
   $ hg add -s add/foo
   $ hg st
   A add/foo
   ? add/bar
-  $ hg sparse
+  $ hg debugsparse
   [include]
   add
   empty
@@ -284,7 +284,7 @@  Test that add -s adds dirs to sparse pro
   $ hg st
   A add/bar
   A add/foo
-  $ hg sparse
+  $ hg debugsparse
   [include]
   add
   empty
@@ -316,7 +316,7 @@  Test debugrebuilddirstate
   $ hg add included excluded
   $ hg commit -m 'a commit' -q
   $ cp .hg/dirstate ../dirstateboth
-  $ hg sparse -X excluded
+  $ hg debugsparse -X excluded
   $ cp ../dirstateboth .hg/dirstate
   $ hg debugrebuilddirstate
   $ hg debugdirstate
@@ -324,11 +324,11 @@  Test debugrebuilddirstate
 
 Test debugdirstate --minimal where file is in the parent manifest but not the
 dirstate
-  $ hg sparse -X included
+  $ hg debugsparse -X included
   $ hg debugdirstate
   $ cp .hg/dirstate ../dirstateallexcluded
-  $ hg sparse --reset
-  $ hg sparse -X excluded
+  $ hg debugsparse --reset
+  $ hg debugsparse -X excluded
   $ cp ../dirstateallexcluded .hg/dirstate
   $ touch includedadded
   $ hg add includedadded
@@ -350,7 +350,7 @@  manifest
   $ cp .hg/dirstate ../moreexcluded
   $ hg forget excludednomanifest
   $ rm excludednomanifest
-  $ hg sparse -X excludednomanifest
+  $ hg debugsparse -X excludednomanifest
   $ cp ../moreexcluded .hg/dirstate
   $ hg manifest
   excluded