Details
Details
- Reviewers
durin42 martinvonz - Group Reviewers
hg-reviewers
Diff Detail
Diff Detail
- Repository
- rHG Mercurial
- Branch
- default
- Lint
No Linters Available - Unit
No Unit Test Coverage
| durin42 | |
| martinvonz |
| hg-reviewers |
| No Linters Available |
| No Unit Test Coverage |
✅ refresh by Heptapod after a successful CI run (🐙 💚)
| Path | Packages | |||
|---|---|---|---|---|
| M | hgext/narrow/narrowwirepeer.py (6 lines) | |||
| M | tests/test-narrow-acl.t (36 lines) |
| Commit | Parents | Author | Summary | Date |
|---|---|---|---|---|
| 38ef5c85be4a | 10b9f11daf15 | Sandu Turcan | Tue, May 3, 9:44 PM |
| # narrowwirepeer.py - passes narrow spec with unbundle command | # narrowwirepeer.py - passes narrow spec with unbundle command | ||||
| # | # | ||||
| # Copyright 2017 Google, Inc. | # Copyright 2017 Google, Inc. | ||||
| # | # | ||||
| # This software may be used and distributed according to the terms of the | # This software may be used and distributed according to the terms of the | ||||
| # GNU General Public License version 2 or any later version. | # GNU General Public License version 2 or any later version. | ||||
| from mercurial import ( | from mercurial import ( | ||||
| bundle2, | bundle2, | ||||
| error, | error, | ||||
| exchange, | |||||
| extensions, | extensions, | ||||
| hg, | hg, | ||||
| narrowspec, | narrowspec, | ||||
| wireprototypes, | wireprototypes, | ||||
| wireprotov1peer, | wireprotov1peer, | ||||
| wireprotov1server, | wireprotov1server, | ||||
| ) | ) | ||||
| def splitpaths(data): | def splitpaths(data): | ||||
| # work around ''.split(',') => [''] | # work around ''.split(',') => [''] | ||||
| return data.split(b',') if data else [] | return data.split(b',') if data else [] | ||||
| oldincludes = splitpaths(oldincludes) | oldincludes = splitpaths(oldincludes) | ||||
| newincludes = splitpaths(newincludes) | newincludes = splitpaths(newincludes) | ||||
| oldexcludes = splitpaths(oldexcludes) | oldexcludes = splitpaths(oldexcludes) | ||||
| newexcludes = splitpaths(newexcludes) | newexcludes = splitpaths(newexcludes) | ||||
| # enforce narrow acl if set | |||||
| if repo.ui.has_section(exchange._NARROWACL_SECTION): | |||||
| exchange.applynarrowacl(repo, 'includepats': newincludes) | |||||
| # validate the patterns | # validate the patterns | ||||
| narrowspec.validatepatterns(set(oldincludes)) | narrowspec.validatepatterns(set(oldincludes)) | ||||
| narrowspec.validatepatterns(set(newincludes)) | narrowspec.validatepatterns(set(newincludes)) | ||||
| narrowspec.validatepatterns(set(oldexcludes)) | narrowspec.validatepatterns(set(oldexcludes)) | ||||
| narrowspec.validatepatterns(set(newexcludes)) | narrowspec.validatepatterns(set(newexcludes)) | ||||
| common = wireprototypes.decodelist(commonheads) | common = wireprototypes.decodelist(commonheads) | ||||
| known = wireprototypes.decodelist(known) | known = wireprototypes.decodelist(known) | ||||
| Requirements should contain narrowhg | Requirements should contain narrowhg | ||||
| $ hg debugrequires -R narrowclone1 | grep narrowhg | $ hg debugrequires -R narrowclone1 | grep narrowhg | ||||
| narrowhg-experimental | narrowhg-experimental | ||||
| NarrowHG should track f1 and f2 | NarrowHG should track f1 and f2 | ||||
| $ hg -R narrowclone1 tracked | $ hg -R narrowclone1 tracked | ||||
| I path:f1 | I path:f1 | ||||
| I path:f2 | I path:f2 | ||||
| Narrow should not be able to widen to include f3 | |||||
| $ hg -R narrowclone1 tracked --addinclude f3 | |||||
| comparing with http://localhost:$HGPORT1/ | |||||
| searching for changes | |||||
| abort: The following includes are not accessible for test: ['path:f3'] | |||||
| [255] | |||||
| $ ls -A -1 narrowclone1 | sort | |||||
| .hg | |||||
| f1 | |||||
| f2 | |||||
| $ hg -R narrowclone1 tracked | |||||
| I path:f1 | |||||
| I path:f2 | |||||
| Narrow should allow widen to include f2 | |||||
| $ hg -R narrowclone1 tracked --removeinclude f2 > /dev/null | |||||
| $ hg -R narrowclone1 tracked | |||||
| I path:f1 | |||||
| $ ls -A -1 narrowclone1 | sort | |||||
| .hg | |||||
| f1 | |||||
| $ hg -R narrowclone1 tracked --addinclude f2 | |||||
| comparing with http://localhost:$HGPORT1/ | |||||
| searching for changes | |||||
| adding changesets | |||||
| adding manifests | |||||
| adding file changes | |||||
| added 0 changesets with 1 changes to 1 files | |||||
| $ hg -R narrowclone1 tracked | |||||
| I path:f1 | |||||
| I path:f2 | |||||
| $ ls -A -1 narrowclone1 | sort | |||||
| .hg | |||||
| f1 | |||||
| f2 | |||||