D5479: sparse: don't enable on clone if it was a narrow clone

2019-01-09 Thread pulkit (Pulkit Goyal)
This revision was automatically updated to reflect the committed changes.
Closed by commit rHG8eaf693b1409: sparse: don't enable on clone if it was 
a narrow clone (authored by pulkit, committed by ).

REPOSITORY
  rHG Mercurial

CHANGES SINCE LAST UPDATE
  https://phab.mercurial-scm.org/D5479?vs=12973&id=13101

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

AFFECTED FILES
  hgext/sparse.py
  tests/test-narrow-sparse.t

CHANGE DETAILS

diff --git a/tests/test-narrow-sparse.t b/tests/test-narrow-sparse.t
--- a/tests/test-narrow-sparse.t
+++ b/tests/test-narrow-sparse.t
@@ -52,14 +52,12 @@
   $ hg files
   inside/f
 
-XXX: we should not have sparse enabled
-  $ cat .hg/sparse
-  [include]
-  inside/f
+XXX: we should have a flag in `hg debugsparse` to list the sparse profile
+  $ test -f .hg/sparse
+  [1]
 
   $ cat .hg/requires
   dotencode
-  exp-sparse
   fncache
   generaldelta
   narrowhg-experimental
diff --git a/hgext/sparse.py b/hgext/sparse.py
--- a/hgext/sparse.py
+++ b/hgext/sparse.py
@@ -141,6 +141,7 @@
 include_pat = opts.get(r'include')
 exclude_pat = opts.get(r'exclude')
 enableprofile_pat = opts.get(r'enable_profile')
+narrow_pat = opts.get(r'narrow')
 include = exclude = enableprofile = False
 if include_pat:
 pat = include_pat
@@ -153,7 +154,9 @@
 enableprofile = True
 if sum([include, exclude, enableprofile]) > 1:
 raise error.Abort(_("too many flags specified."))
-if include or exclude or enableprofile:
+# if --narrow is passed, it means they are includes and excludes for narrow
+# clone
+if not narrow_pat and (include or exclude or enableprofile):
 def clonesparse(orig, self, node, overwrite, *args, **kwargs):
 sparse.updateconfig(self.unfiltered(), pat, {}, include=include,
 exclude=exclude, enableprofile=enableprofile,



To: pulkit, durin42, #hg-reviewers
Cc: mercurial-devel
___
Mercurial-devel mailing list
Mercurial-devel@mercurial-scm.org
https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel


D5479: sparse: don't enable on clone if it was a narrow clone

2018-12-24 Thread pulkit (Pulkit Goyal)
pulkit created this revision.
Herald added a reviewer: durin42.
Herald added a subscriber: mercurial-devel.
Herald added a reviewer: hg-reviewers.

REVISION SUMMARY
  When both sparse and narrow extensions are enabled and we do a narrow clone,
  sparse enables itself because it reads --include flag and thinks that user is
  trying to do a sparse clone.
  
  This patch changes that behavior, and now if both extensions are enabled and
  user passes `--narrow`, then the includes and excludes won't be considered as
  part of sparse profile.

REPOSITORY
  rHG Mercurial

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

AFFECTED FILES
  hgext/sparse.py
  tests/test-narrow-sparse.t

CHANGE DETAILS

diff --git a/tests/test-narrow-sparse.t b/tests/test-narrow-sparse.t
--- a/tests/test-narrow-sparse.t
+++ b/tests/test-narrow-sparse.t
@@ -52,14 +52,12 @@
   $ hg files
   inside/f
 
-XXX: we should not have sparse enabled
-  $ cat .hg/sparse
-  [include]
-  inside/f
+XXX: we should have a flag in `hg debugsparse` to list the sparse profile
+  $ test -f .hg/sparse
+  [1]
 
   $ cat .hg/requires
   dotencode
-  exp-sparse
   fncache
   generaldelta
   narrowhg-experimental
diff --git a/hgext/sparse.py b/hgext/sparse.py
--- a/hgext/sparse.py
+++ b/hgext/sparse.py
@@ -141,6 +141,7 @@
 include_pat = opts.get(r'include')
 exclude_pat = opts.get(r'exclude')
 enableprofile_pat = opts.get(r'enable_profile')
+narrow_pat = opts.get(r'narrow')
 include = exclude = enableprofile = False
 if include_pat:
 pat = include_pat
@@ -153,7 +154,9 @@
 enableprofile = True
 if sum([include, exclude, enableprofile]) > 1:
 raise error.Abort(_("too many flags specified."))
-if include or exclude or enableprofile:
+# if --narrow is passed, it means they are includes and excludes for narrow
+# clone
+if not narrow_pat and (include or exclude or enableprofile):
 def clonesparse(orig, self, node, overwrite, *args, **kwargs):
 sparse.updateconfig(self.unfiltered(), pat, {}, include=include,
 exclude=exclude, enableprofile=enableprofile,



To: pulkit, durin42, #hg-reviewers
Cc: mercurial-devel
___
Mercurial-devel mailing list
Mercurial-devel@mercurial-scm.org
https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel