changeset 33293:c9cbf4de27ba

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.
author Gregory Szorc <gregory.szorc@gmail.com>
date Sat, 01 Jul 2017 10:29:27 -0700
parents 1e9fd2c35ae3
children a5921ad2eb99
files hgext/sparse.py tests/test-sparse-clear.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
diffstat 7 files changed, 77 insertions(+), 77 deletions(-) [+]
line wrap: on
line diff
--- a/hgext/sparse.py	Thu Jul 06 10:54:23 2017 -0700
+++ b/hgext/sparse.py	Sat Jul 01 10:29:27 2017 -0700
@@ -335,7 +335,7 @@
 
     # 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 @@
     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 @@
     ('', '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.
--- a/tests/test-sparse-clear.t	Thu Jul 06 10:54:23 2017 -0700
+++ b/tests/test-sparse-clear.t	Sat Jul 01 10:29:27 2017 -0700
@@ -27,10 +27,10 @@
 
 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 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 @@
 
 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
--- a/tests/test-sparse-import.t	Thu Jul 06 10:54:23 2017 -0700
+++ b/tests/test-sparse-import.t	Sat Jul 01 10:29:27 2017 -0700
@@ -31,11 +31,11 @@
   > [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 @@
   > [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 @@
   > [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 @@
   [exclude]
   *.py
 
-  $ hg sparse --reset
+  $ hg debugsparse --reset
   $ rm .hg/sparse
 
 Same tests, with -Tjson enabled to output summaries
@@ -87,7 +87,7 @@
   > [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 @@
    }
   ]
 
-  $ hg sparse --reset
+  $ hg debugsparse --reset
   $ rm .hg/sparse
 
   $ cat > $TESTTMP/rules_to_import <<EOF
@@ -107,7 +107,7 @@
   > [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 @@
    }
   ]
 
-  $ 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 @@
   > [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 @@
   > [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 @@
   > [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
--- a/tests/test-sparse-merges.t	Thu Jul 06 10:54:23 2017 -0700
+++ b/tests/test-sparse-merges.t	Sat Jul 01 10:29:27 2017 -0700
@@ -19,7 +19,7 @@
   $ 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 @@
   $ 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
--- a/tests/test-sparse-profiles.t	Thu Jul 06 10:54:23 2017 -0700
+++ b/tests/test-sparse-profiles.t	Sat Jul 01 10:29:27 2017 -0700
@@ -25,11 +25,11 @@
   > 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 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 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 @@
 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 @@
   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 @@
   > 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)
--- a/tests/test-sparse-verbose-json.t	Thu Jul 06 10:54:23 2017 -0700
+++ b/tests/test-sparse-verbose-json.t	Sat Jul 01 10:29:27 2017 -0700
@@ -21,7 +21,7 @@
 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 @@
     "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 @@
     "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 @@
 
 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 @@
     "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
--- a/tests/test-sparse.t	Thu Jul 06 10:54:23 2017 -0700
+++ b/tests/test-sparse.t	Sat Jul 01 10:29:27 2017 -0700
@@ -21,17 +21,17 @@
 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 --reset brings files back
 
-  $ hg sparse --reset
+  $ hg debugsparse --reset
   $ ls
   hide
   show
@@ -55,12 +55,12 @@
   $ 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 @@
 
   $ 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 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 @@
   unresolved conflicts (see hg resolve, then hg rebase --continue)
   [1]
 
-  $ hg sparse
+  $ hg debugsparse
   [include]
   
   [exclude]
@@ -186,7 +186,7 @@
   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 @@
   $ 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 strip -k resets dirstate correctly
 
   $ hg status
-  $ hg sparse
+  $ hg debugsparse
   [include]
   
   [exclude]
@@ -246,15 +246,15 @@
 
   $ 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 @@
   $ 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 @@
   $ hg st
   A add/bar
   A add/foo
-  $ hg sparse
+  $ hg debugsparse
   [include]
   add
   empty
@@ -316,7 +316,7 @@
   $ 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 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 @@
   $ cp .hg/dirstate ../moreexcluded
   $ hg forget excludednomanifest
   $ rm excludednomanifest
-  $ hg sparse -X excludednomanifest
+  $ hg debugsparse -X excludednomanifest
   $ cp ../moreexcluded .hg/dirstate
   $ hg manifest
   excluded