139 |
139 |
140 def _clonesparsecmd(orig, ui, repo, *args, **opts): |
140 def _clonesparsecmd(orig, ui, repo, *args, **opts): |
141 include_pat = opts.get(r'include') |
141 include_pat = opts.get(r'include') |
142 exclude_pat = opts.get(r'exclude') |
142 exclude_pat = opts.get(r'exclude') |
143 enableprofile_pat = opts.get(r'enable_profile') |
143 enableprofile_pat = opts.get(r'enable_profile') |
|
144 narrow_pat = opts.get(r'narrow') |
144 include = exclude = enableprofile = False |
145 include = exclude = enableprofile = False |
145 if include_pat: |
146 if include_pat: |
146 pat = include_pat |
147 pat = include_pat |
147 include = True |
148 include = True |
148 if exclude_pat: |
149 if exclude_pat: |
151 if enableprofile_pat: |
152 if enableprofile_pat: |
152 pat = enableprofile_pat |
153 pat = enableprofile_pat |
153 enableprofile = True |
154 enableprofile = True |
154 if sum([include, exclude, enableprofile]) > 1: |
155 if sum([include, exclude, enableprofile]) > 1: |
155 raise error.Abort(_("too many flags specified.")) |
156 raise error.Abort(_("too many flags specified.")) |
156 if include or exclude or enableprofile: |
157 # if --narrow is passed, it means they are includes and excludes for narrow |
|
158 # clone |
|
159 if not narrow_pat and (include or exclude or enableprofile): |
157 def clonesparse(orig, self, node, overwrite, *args, **kwargs): |
160 def clonesparse(orig, self, node, overwrite, *args, **kwargs): |
158 sparse.updateconfig(self.unfiltered(), pat, {}, include=include, |
161 sparse.updateconfig(self.unfiltered(), pat, {}, include=include, |
159 exclude=exclude, enableprofile=enableprofile, |
162 exclude=exclude, enableprofile=enableprofile, |
160 usereporootpaths=True) |
163 usereporootpaths=True) |
161 return orig(self, node, overwrite, *args, **kwargs) |
164 return orig(self, node, overwrite, *args, **kwargs) |