Show More
@@ -1,48 +1,48 b'' | |||||
1 | # narrowtemplates.py - added template keywords for narrow clones |
|
1 | # narrowtemplates.py - added template keywords for narrow clones | |
2 | # |
|
2 | # | |
3 | # Copyright 2017 Google, Inc. |
|
3 | # Copyright 2017 Google, Inc. | |
4 | # |
|
4 | # | |
5 | # This software may be used and distributed according to the terms of the |
|
5 | # This software may be used and distributed according to the terms of the | |
6 | # GNU General Public License version 2 or any later version. |
|
6 | # GNU General Public License version 2 or any later version. | |
7 |
|
7 | |||
8 | from __future__ import absolute_import |
|
8 | from __future__ import absolute_import | |
9 |
|
9 | |||
10 | from mercurial import ( |
|
10 | from mercurial import ( | |
11 | registrar, |
|
11 | registrar, | |
12 | revlog, |
|
12 | revlog, | |
13 | ) |
|
13 | ) | |
14 |
|
14 | |||
15 | keywords = {} |
|
15 | keywords = {} | |
16 | templatekeyword = registrar.templatekeyword(keywords) |
|
16 | templatekeyword = registrar.templatekeyword(keywords) | |
17 | revsetpredicate = registrar.revsetpredicate() |
|
17 | revsetpredicate = registrar.revsetpredicate() | |
18 |
|
18 | |||
19 | def _isellipsis(repo, rev): |
|
19 | def _isellipsis(repo, rev): | |
20 | if repo.changelog.flags(rev) & revlog.REVIDX_ELLIPSIS: |
|
20 | if repo.changelog.flags(rev) & revlog.REVIDX_ELLIPSIS: | |
21 | return True |
|
21 | return True | |
22 | return False |
|
22 | return False | |
23 |
|
23 | |||
24 | @templatekeyword('ellipsis', requires={'repo', 'ctx'}) |
|
24 | @templatekeyword('ellipsis', requires={'repo', 'ctx'}) | |
25 | def ellipsis(context, mapping): |
|
25 | def ellipsis(context, mapping): | |
26 | """String. 'ellipsis' if the change is an ellipsis node, else ''.""" |
|
26 | """String. 'ellipsis' if the change is an ellipsis node, else ''.""" | |
27 | repo = context.resource(mapping, 'repo') |
|
27 | repo = context.resource(mapping, 'repo') | |
28 | ctx = context.resource(mapping, 'ctx') |
|
28 | ctx = context.resource(mapping, 'ctx') | |
29 | if _isellipsis(repo, ctx.rev()): |
|
29 | if _isellipsis(repo, ctx.rev()): | |
30 | return 'ellipsis' |
|
30 | return 'ellipsis' | |
31 | return '' |
|
31 | return '' | |
32 |
|
32 | |||
33 | @templatekeyword('outsidenarrow', requires={'repo', 'ctx'}) |
|
33 | @templatekeyword('outsidenarrow', requires={'repo', 'ctx'}) | |
34 | def outsidenarrow(context, mapping): |
|
34 | def outsidenarrow(context, mapping): | |
35 | """String. 'outsidenarrow' if the change affects no tracked files, |
|
35 | """String. 'outsidenarrow' if the change affects no tracked files, | |
36 | else ''.""" |
|
36 | else ''.""" | |
37 | repo = context.resource(mapping, 'repo') |
|
37 | repo = context.resource(mapping, 'repo') | |
38 | ctx = context.resource(mapping, 'ctx') |
|
38 | ctx = context.resource(mapping, 'ctx') | |
39 | m = repo.narrowmatch() |
|
39 | m = repo.narrowmatch() | |
40 | if not m.always(): |
|
40 | if ctx.files() and not m.always(): | |
41 | if not any(m(f) for f in ctx.files()): |
|
41 | if not any(m(f) for f in ctx.files()): | |
42 | return 'outsidenarrow' |
|
42 | return 'outsidenarrow' | |
43 | return '' |
|
43 | return '' | |
44 |
|
44 | |||
45 | @revsetpredicate('ellipsis()') |
|
45 | @revsetpredicate('ellipsis()') | |
46 | def ellipsisrevset(repo, subset, x): |
|
46 | def ellipsisrevset(repo, subset, x): | |
47 | """Changesets that are ellipsis nodes.""" |
|
47 | """Changesets that are ellipsis nodes.""" | |
48 | return subset.filter(lambda r: _isellipsis(repo, r)) |
|
48 | return subset.filter(lambda r: _isellipsis(repo, r)) |
@@ -1,445 +1,449 b'' | |||||
1 | #testcases flat tree |
|
1 | #testcases flat tree | |
2 | #testcases lfs-on lfs-off |
|
2 | #testcases lfs-on lfs-off | |
3 |
|
3 | |||
4 | #if lfs-on |
|
4 | #if lfs-on | |
5 | $ cat >> $HGRCPATH <<EOF |
|
5 | $ cat >> $HGRCPATH <<EOF | |
6 | > [extensions] |
|
6 | > [extensions] | |
7 | > lfs = |
|
7 | > lfs = | |
8 | > EOF |
|
8 | > EOF | |
9 | #endif |
|
9 | #endif | |
10 |
|
10 | |||
11 | $ . "$TESTDIR/narrow-library.sh" |
|
11 | $ . "$TESTDIR/narrow-library.sh" | |
12 |
|
12 | |||
13 | #if tree |
|
13 | #if tree | |
14 | $ cat << EOF >> $HGRCPATH |
|
14 | $ cat << EOF >> $HGRCPATH | |
15 | > [experimental] |
|
15 | > [experimental] | |
16 | > treemanifest = 1 |
|
16 | > treemanifest = 1 | |
17 | > EOF |
|
17 | > EOF | |
18 | #endif |
|
18 | #endif | |
19 |
|
19 | |||
20 | $ hg init master |
|
20 | $ hg init master | |
21 | $ cd master |
|
21 | $ cd master | |
22 | $ cat >> .hg/hgrc <<EOF |
|
22 | $ cat >> .hg/hgrc <<EOF | |
23 | > [narrow] |
|
23 | > [narrow] | |
24 | > serveellipses=True |
|
24 | > serveellipses=True | |
25 | > EOF |
|
25 | > EOF | |
26 | $ for x in `$TESTDIR/seq.py 0 10` |
|
26 | $ for x in `$TESTDIR/seq.py 0 10` | |
27 | > do |
|
27 | > do | |
28 | > mkdir d$x |
|
28 | > mkdir d$x | |
29 | > echo $x > d$x/f |
|
29 | > echo $x > d$x/f | |
30 | > hg add d$x/f |
|
30 | > hg add d$x/f | |
31 | > hg commit -m "add d$x/f" |
|
31 | > hg commit -m "add d$x/f" | |
32 | > done |
|
32 | > done | |
33 | $ hg log -T "{rev}: {desc}\n" |
|
33 | $ hg log -T "{rev}: {desc}\n" | |
34 | 10: add d10/f |
|
34 | 10: add d10/f | |
35 | 9: add d9/f |
|
35 | 9: add d9/f | |
36 | 8: add d8/f |
|
36 | 8: add d8/f | |
37 | 7: add d7/f |
|
37 | 7: add d7/f | |
38 | 6: add d6/f |
|
38 | 6: add d6/f | |
39 | 5: add d5/f |
|
39 | 5: add d5/f | |
40 | 4: add d4/f |
|
40 | 4: add d4/f | |
41 | 3: add d3/f |
|
41 | 3: add d3/f | |
42 | 2: add d2/f |
|
42 | 2: add d2/f | |
43 | 1: add d1/f |
|
43 | 1: add d1/f | |
44 | 0: add d0/f |
|
44 | 0: add d0/f | |
45 | $ cd .. |
|
45 | $ cd .. | |
46 |
|
46 | |||
47 | Error if '.' or '..' are in the directory to track. |
|
47 | Error if '.' or '..' are in the directory to track. | |
48 | $ hg clone --narrow ssh://user@dummy/master foo --include ./asdf |
|
48 | $ hg clone --narrow ssh://user@dummy/master foo --include ./asdf | |
49 | abort: "." and ".." are not allowed in narrowspec paths |
|
49 | abort: "." and ".." are not allowed in narrowspec paths | |
50 | [255] |
|
50 | [255] | |
51 | $ hg clone --narrow ssh://user@dummy/master foo --include asdf/.. |
|
51 | $ hg clone --narrow ssh://user@dummy/master foo --include asdf/.. | |
52 | abort: "." and ".." are not allowed in narrowspec paths |
|
52 | abort: "." and ".." are not allowed in narrowspec paths | |
53 | [255] |
|
53 | [255] | |
54 | $ hg clone --narrow ssh://user@dummy/master foo --include a/./c |
|
54 | $ hg clone --narrow ssh://user@dummy/master foo --include a/./c | |
55 | abort: "." and ".." are not allowed in narrowspec paths |
|
55 | abort: "." and ".." are not allowed in narrowspec paths | |
56 | [255] |
|
56 | [255] | |
57 |
|
57 | |||
58 | Names with '.' in them are OK. |
|
58 | Names with '.' in them are OK. | |
59 | $ hg clone --narrow ssh://user@dummy/master should-work --include a/.b/c |
|
59 | $ hg clone --narrow ssh://user@dummy/master should-work --include a/.b/c | |
60 | requesting all changes |
|
60 | requesting all changes | |
61 | adding changesets |
|
61 | adding changesets | |
62 | adding manifests |
|
62 | adding manifests | |
63 | adding file changes |
|
63 | adding file changes | |
64 | added 1 changesets with 0 changes to 0 files |
|
64 | added 1 changesets with 0 changes to 0 files | |
65 | new changesets * (glob) |
|
65 | new changesets * (glob) | |
66 | updating to branch default |
|
66 | updating to branch default | |
67 | 0 files updated, 0 files merged, 0 files removed, 0 files unresolved |
|
67 | 0 files updated, 0 files merged, 0 files removed, 0 files unresolved | |
68 |
|
68 | |||
69 | Test repo with local changes |
|
69 | Test repo with local changes | |
70 | $ hg clone --narrow ssh://user@dummy/master narrow-local-changes --include d0 --include d3 --include d6 |
|
70 | $ hg clone --narrow ssh://user@dummy/master narrow-local-changes --include d0 --include d3 --include d6 | |
71 | requesting all changes |
|
71 | requesting all changes | |
72 | adding changesets |
|
72 | adding changesets | |
73 | adding manifests |
|
73 | adding manifests | |
74 | adding file changes |
|
74 | adding file changes | |
75 | added 6 changesets with 3 changes to 3 files |
|
75 | added 6 changesets with 3 changes to 3 files | |
76 | new changesets *:* (glob) |
|
76 | new changesets *:* (glob) | |
77 | updating to branch default |
|
77 | updating to branch default | |
78 | 3 files updated, 0 files merged, 0 files removed, 0 files unresolved |
|
78 | 3 files updated, 0 files merged, 0 files removed, 0 files unresolved | |
79 | $ cd narrow-local-changes |
|
79 | $ cd narrow-local-changes | |
80 | $ cat >> $HGRCPATH << EOF |
|
80 | $ cat >> $HGRCPATH << EOF | |
81 | > [experimental] |
|
81 | > [experimental] | |
82 | > evolution=createmarkers |
|
82 | > evolution=createmarkers | |
83 | > EOF |
|
83 | > EOF | |
84 | $ echo local change >> d0/f |
|
84 | $ echo local change >> d0/f | |
85 | $ hg ci -m 'local change to d0' |
|
85 | $ hg ci -m 'local change to d0' | |
86 | $ hg co '.^' |
|
86 | $ hg co '.^' | |
87 | 1 files updated, 0 files merged, 0 files removed, 0 files unresolved |
|
87 | 1 files updated, 0 files merged, 0 files removed, 0 files unresolved | |
88 | $ echo local change >> d3/f |
|
88 | $ echo local change >> d3/f | |
89 | $ hg ci -m 'local hidden change to d3' |
|
89 | $ hg ci -m 'local hidden change to d3' | |
90 | created new head |
|
90 | created new head | |
91 | $ hg ci --amend -m 'local change to d3' |
|
91 | $ hg ci --amend -m 'local change to d3' | |
92 | $ hg tracked --removeinclude d0 |
|
92 | $ hg tracked --removeinclude d0 | |
93 | comparing with ssh://user@dummy/master |
|
93 | comparing with ssh://user@dummy/master | |
94 | searching for changes |
|
94 | searching for changes | |
95 | looking for local changes to affected paths |
|
95 | looking for local changes to affected paths | |
96 | The following changeset(s) or their ancestors have local changes not on the remote: |
|
96 | The following changeset(s) or their ancestors have local changes not on the remote: | |
97 | * (glob) |
|
97 | * (glob) | |
98 | abort: local changes found |
|
98 | abort: local changes found | |
99 | (use --force-delete-local-changes to ignore) |
|
99 | (use --force-delete-local-changes to ignore) | |
100 | [255] |
|
100 | [255] | |
101 | Check that nothing was removed by the failed attempts |
|
101 | Check that nothing was removed by the failed attempts | |
102 | $ hg tracked |
|
102 | $ hg tracked | |
103 | I path:d0 |
|
103 | I path:d0 | |
104 | I path:d3 |
|
104 | I path:d3 | |
105 | I path:d6 |
|
105 | I path:d6 | |
106 | $ hg files |
|
106 | $ hg files | |
107 | d0/f |
|
107 | d0/f | |
108 | d3/f |
|
108 | d3/f | |
109 | d6/f |
|
109 | d6/f | |
110 | $ find * |
|
110 | $ find * | |
111 | d0 |
|
111 | d0 | |
112 | d0/f |
|
112 | d0/f | |
113 | d3 |
|
113 | d3 | |
114 | d3/f |
|
114 | d3/f | |
115 | d6 |
|
115 | d6 | |
116 | d6/f |
|
116 | d6/f | |
117 | $ hg verify -q |
|
117 | $ hg verify -q | |
118 | Force deletion of local changes |
|
118 | Force deletion of local changes | |
119 | $ hg log -T "{rev}: {desc} {outsidenarrow}\n" |
|
119 | $ hg log -T "{rev}: {desc} {outsidenarrow}\n" | |
120 | 8: local change to d3 |
|
120 | 8: local change to d3 | |
121 | 6: local change to d0 |
|
121 | 6: local change to d0 | |
122 | 5: add d10/f outsidenarrow |
|
122 | 5: add d10/f outsidenarrow | |
123 | 4: add d6/f |
|
123 | 4: add d6/f | |
124 | 3: add d5/f outsidenarrow |
|
124 | 3: add d5/f outsidenarrow | |
125 | 2: add d3/f |
|
125 | 2: add d3/f | |
126 | 1: add d2/f outsidenarrow |
|
126 | 1: add d2/f outsidenarrow | |
127 | 0: add d0/f |
|
127 | 0: add d0/f | |
128 | $ hg tracked --removeinclude d0 --force-delete-local-changes |
|
128 | $ hg tracked --removeinclude d0 --force-delete-local-changes | |
129 | comparing with ssh://user@dummy/master |
|
129 | comparing with ssh://user@dummy/master | |
130 | searching for changes |
|
130 | searching for changes | |
131 | looking for local changes to affected paths |
|
131 | looking for local changes to affected paths | |
132 | The following changeset(s) or their ancestors have local changes not on the remote: |
|
132 | The following changeset(s) or their ancestors have local changes not on the remote: | |
133 | * (glob) |
|
133 | * (glob) | |
134 | saved backup bundle to $TESTTMP/narrow-local-changes/.hg/strip-backup/*-narrow.hg (glob) |
|
134 | saved backup bundle to $TESTTMP/narrow-local-changes/.hg/strip-backup/*-narrow.hg (glob) | |
135 | deleting data/d0/f.i (reporevlogstore !) |
|
135 | deleting data/d0/f.i (reporevlogstore !) | |
136 | deleting meta/d0/00manifest.i (tree !) |
|
136 | deleting meta/d0/00manifest.i (tree !) | |
137 | deleting data/d0/f/362fef284ce2ca02aecc8de6d5e8a1c3af0556fe (reposimplestore !) |
|
137 | deleting data/d0/f/362fef284ce2ca02aecc8de6d5e8a1c3af0556fe (reposimplestore !) | |
138 | deleting data/d0/f/4374b5650fc5ae54ac857c0f0381971fdde376f7 (reposimplestore !) |
|
138 | deleting data/d0/f/4374b5650fc5ae54ac857c0f0381971fdde376f7 (reposimplestore !) | |
139 | deleting data/d0/f/index (reposimplestore !) |
|
139 | deleting data/d0/f/index (reposimplestore !) | |
140 |
|
140 | |||
141 | $ hg log -T "{rev}: {desc} {outsidenarrow}\n" |
|
141 | $ hg log -T "{rev}: {desc} {outsidenarrow}\n" | |
142 | 7: local change to d3 |
|
142 | 7: local change to d3 | |
143 | 5: add d10/f outsidenarrow |
|
143 | 5: add d10/f outsidenarrow | |
144 | 4: add d6/f |
|
144 | 4: add d6/f | |
145 | 3: add d5/f outsidenarrow |
|
145 | 3: add d5/f outsidenarrow | |
146 | 2: add d3/f |
|
146 | 2: add d3/f | |
147 | 1: add d2/f outsidenarrow |
|
147 | 1: add d2/f outsidenarrow | |
148 | 0: add d0/f outsidenarrow |
|
148 | 0: add d0/f outsidenarrow | |
149 | Can restore stripped local changes after widening |
|
149 | Can restore stripped local changes after widening | |
150 | $ hg tracked --addinclude d0 -q |
|
150 | $ hg tracked --addinclude d0 -q | |
151 | $ hg unbundle .hg/strip-backup/*-narrow.hg -q |
|
151 | $ hg unbundle .hg/strip-backup/*-narrow.hg -q | |
152 | $ hg --hidden co -r 'desc("local change to d0")' -q |
|
152 | $ hg --hidden co -r 'desc("local change to d0")' -q | |
153 | $ cat d0/f |
|
153 | $ cat d0/f | |
154 | 0 |
|
154 | 0 | |
155 | local change |
|
155 | local change | |
156 | Pruned commits affecting removed paths should not prevent narrowing |
|
156 | Pruned commits affecting removed paths should not prevent narrowing | |
157 | $ hg co '.^' |
|
157 | $ hg co '.^' | |
158 | 1 files updated, 0 files merged, 0 files removed, 0 files unresolved |
|
158 | 1 files updated, 0 files merged, 0 files removed, 0 files unresolved | |
159 | $ hg debugobsolete `hg log -T '{node}' -r 'desc("local change to d0")'` |
|
159 | $ hg debugobsolete `hg log -T '{node}' -r 'desc("local change to d0")'` | |
160 | obsoleted 1 changesets |
|
160 | obsoleted 1 changesets | |
161 | $ hg tracked --removeinclude d0 |
|
161 | $ hg tracked --removeinclude d0 | |
162 | comparing with ssh://user@dummy/master |
|
162 | comparing with ssh://user@dummy/master | |
163 | searching for changes |
|
163 | searching for changes | |
164 | looking for local changes to affected paths |
|
164 | looking for local changes to affected paths | |
165 | saved backup bundle to $TESTTMP/narrow-local-changes/.hg/strip-backup/*-narrow.hg (glob) |
|
165 | saved backup bundle to $TESTTMP/narrow-local-changes/.hg/strip-backup/*-narrow.hg (glob) | |
166 | deleting data/d0/f.i (reporevlogstore !) |
|
166 | deleting data/d0/f.i (reporevlogstore !) | |
167 | deleting meta/d0/00manifest.i (tree !) |
|
167 | deleting meta/d0/00manifest.i (tree !) | |
168 | deleting data/d0/f/362fef284ce2ca02aecc8de6d5e8a1c3af0556fe (reposimplestore !) |
|
168 | deleting data/d0/f/362fef284ce2ca02aecc8de6d5e8a1c3af0556fe (reposimplestore !) | |
169 | deleting data/d0/f/4374b5650fc5ae54ac857c0f0381971fdde376f7 (reposimplestore !) |
|
169 | deleting data/d0/f/4374b5650fc5ae54ac857c0f0381971fdde376f7 (reposimplestore !) | |
170 | deleting data/d0/f/index (reposimplestore !) |
|
170 | deleting data/d0/f/index (reposimplestore !) | |
171 |
|
171 | |||
172 | Updates off of stripped commit if necessary |
|
172 | Updates off of stripped commit if necessary | |
173 | $ hg co -r 'desc("local change to d3")' -q |
|
173 | $ hg co -r 'desc("local change to d3")' -q | |
174 | $ echo local change >> d6/f |
|
174 | $ echo local change >> d6/f | |
175 | $ hg ci -m 'local change to d6' |
|
175 | $ hg ci -m 'local change to d6' | |
176 | $ hg tracked --removeinclude d3 --force-delete-local-changes |
|
176 | $ hg tracked --removeinclude d3 --force-delete-local-changes | |
177 | comparing with ssh://user@dummy/master |
|
177 | comparing with ssh://user@dummy/master | |
178 | searching for changes |
|
178 | searching for changes | |
179 | looking for local changes to affected paths |
|
179 | looking for local changes to affected paths | |
180 | The following changeset(s) or their ancestors have local changes not on the remote: |
|
180 | The following changeset(s) or their ancestors have local changes not on the remote: | |
181 | * (glob) |
|
181 | * (glob) | |
182 | * (glob) |
|
182 | * (glob) | |
183 | 2 files updated, 0 files merged, 0 files removed, 0 files unresolved |
|
183 | 2 files updated, 0 files merged, 0 files removed, 0 files unresolved | |
184 | saved backup bundle to $TESTTMP/narrow-local-changes/.hg/strip-backup/*-narrow.hg (glob) |
|
184 | saved backup bundle to $TESTTMP/narrow-local-changes/.hg/strip-backup/*-narrow.hg (glob) | |
185 | deleting data/d3/f.i (reporevlogstore !) |
|
185 | deleting data/d3/f.i (reporevlogstore !) | |
186 | deleting meta/d3/00manifest.i (tree !) |
|
186 | deleting meta/d3/00manifest.i (tree !) | |
187 | deleting data/d3/f/2661d26c649684b482d10f91960cc3db683c38b4 (reposimplestore !) |
|
187 | deleting data/d3/f/2661d26c649684b482d10f91960cc3db683c38b4 (reposimplestore !) | |
188 | deleting data/d3/f/99fa7136105a15e2045ce3d9152e4837c5349e4d (reposimplestore !) |
|
188 | deleting data/d3/f/99fa7136105a15e2045ce3d9152e4837c5349e4d (reposimplestore !) | |
189 | deleting data/d3/f/index (reposimplestore !) |
|
189 | deleting data/d3/f/index (reposimplestore !) | |
190 | $ hg log -T '{desc}\n' -r . |
|
190 | $ hg log -T '{desc}\n' -r . | |
191 | add d10/f |
|
191 | add d10/f | |
192 | Updates to nullid if necessary |
|
192 | Updates to nullid if necessary | |
193 | $ hg tracked --addinclude d3 -q |
|
193 | $ hg tracked --addinclude d3 -q | |
194 | $ hg co null -q |
|
194 | $ hg co null -q | |
195 | $ mkdir d3 |
|
195 | $ mkdir d3 | |
196 | $ echo local change > d3/f |
|
196 | $ echo local change > d3/f | |
197 | $ hg add d3/f |
|
197 | $ hg add d3/f | |
198 | $ hg ci -m 'local change to d3' |
|
198 | $ hg ci -m 'local change to d3' | |
199 | created new head |
|
199 | created new head | |
200 | $ hg tracked --removeinclude d3 --force-delete-local-changes |
|
200 | $ hg tracked --removeinclude d3 --force-delete-local-changes | |
201 | comparing with ssh://user@dummy/master |
|
201 | comparing with ssh://user@dummy/master | |
202 | searching for changes |
|
202 | searching for changes | |
203 | looking for local changes to affected paths |
|
203 | looking for local changes to affected paths | |
204 | The following changeset(s) or their ancestors have local changes not on the remote: |
|
204 | The following changeset(s) or their ancestors have local changes not on the remote: | |
205 | * (glob) |
|
205 | * (glob) | |
206 | 0 files updated, 0 files merged, 1 files removed, 0 files unresolved |
|
206 | 0 files updated, 0 files merged, 1 files removed, 0 files unresolved | |
207 | saved backup bundle to $TESTTMP/narrow-local-changes/.hg/strip-backup/*-narrow.hg (glob) |
|
207 | saved backup bundle to $TESTTMP/narrow-local-changes/.hg/strip-backup/*-narrow.hg (glob) | |
208 | deleting data/d3/f.i (reporevlogstore !) |
|
208 | deleting data/d3/f.i (reporevlogstore !) | |
209 | deleting meta/d3/00manifest.i (tree !) |
|
209 | deleting meta/d3/00manifest.i (tree !) | |
210 | deleting data/d3/f/2661d26c649684b482d10f91960cc3db683c38b4 (reposimplestore !) |
|
210 | deleting data/d3/f/2661d26c649684b482d10f91960cc3db683c38b4 (reposimplestore !) | |
211 | deleting data/d3/f/5ce0767945cbdbca3b924bb9fbf5143f72ab40ac (reposimplestore !) |
|
211 | deleting data/d3/f/5ce0767945cbdbca3b924bb9fbf5143f72ab40ac (reposimplestore !) | |
212 | deleting data/d3/f/index (reposimplestore !) |
|
212 | deleting data/d3/f/index (reposimplestore !) | |
213 | $ hg id |
|
213 | $ hg id | |
214 | 000000000000 |
|
214 | 000000000000 | |
215 | $ cd .. |
|
215 | $ cd .. | |
216 |
|
216 | |||
217 | Narrowing doesn't resurrect old commits (unlike what regular `hg strip` does) |
|
217 | Narrowing doesn't resurrect old commits (unlike what regular `hg strip` does) | |
218 | $ hg clone --narrow ssh://user@dummy/master narrow-obsmarkers --include d0 --include d3 -q |
|
218 | $ hg clone --narrow ssh://user@dummy/master narrow-obsmarkers --include d0 --include d3 -q | |
219 | $ cd narrow-obsmarkers |
|
219 | $ cd narrow-obsmarkers | |
220 | $ echo a >> d0/f2 |
|
220 | $ echo a >> d0/f2 | |
221 | $ hg add d0/f2 |
|
221 | $ hg add d0/f2 | |
222 | $ hg ci -m 'modify d0/' |
|
222 | $ hg ci -m 'modify d0/' | |
223 | $ echo a >> d3/f2 |
|
223 | $ echo a >> d3/f2 | |
224 | $ hg add d3/f2 |
|
224 | $ hg add d3/f2 | |
225 | $ hg commit --amend -m 'modify d0/ and d3/' |
|
225 | $ hg commit --amend -m 'modify d0/ and d3/' | |
226 | $ hg log -T "{rev}: {desc}\n" |
|
226 | $ hg log -T "{rev}: {desc}\n" | |
227 | 5: modify d0/ and d3/ |
|
227 | 5: modify d0/ and d3/ | |
228 | 3: add d10/f |
|
228 | 3: add d10/f | |
229 | 2: add d3/f |
|
229 | 2: add d3/f | |
230 | 1: add d2/f |
|
230 | 1: add d2/f | |
231 | 0: add d0/f |
|
231 | 0: add d0/f | |
232 | $ hg tracked --removeinclude d3 --force-delete-local-changes -q |
|
232 | $ hg tracked --removeinclude d3 --force-delete-local-changes -q | |
233 | $ hg log -T "{rev}: {desc}\n" |
|
233 | $ hg log -T "{rev}: {desc}\n" | |
234 | 3: add d10/f |
|
234 | 3: add d10/f | |
235 | 2: add d3/f |
|
235 | 2: add d3/f | |
236 | 1: add d2/f |
|
236 | 1: add d2/f | |
237 | 0: add d0/f |
|
237 | 0: add d0/f | |
238 | $ cd .. |
|
238 | $ cd .. | |
239 |
|
239 | |||
240 | Widening doesn't lose bookmarks |
|
240 | Widening doesn't lose bookmarks | |
241 | $ hg clone --narrow ssh://user@dummy/master widen-bookmarks --include d0 -q |
|
241 | $ hg clone --narrow ssh://user@dummy/master widen-bookmarks --include d0 -q | |
242 | $ cd widen-bookmarks |
|
242 | $ cd widen-bookmarks | |
243 | $ hg bookmark my-bookmark |
|
243 | $ hg bookmark my-bookmark | |
244 | $ hg log -T "{rev}: {desc} {bookmarks}\n" |
|
244 | $ hg log -T "{rev}: {desc} {bookmarks}\n" | |
245 | 1: add d10/f my-bookmark |
|
245 | 1: add d10/f my-bookmark | |
246 | 0: add d0/f |
|
246 | 0: add d0/f | |
247 | $ hg tracked --addinclude d3 -q |
|
247 | $ hg tracked --addinclude d3 -q | |
248 | $ hg log -T "{rev}: {desc} {bookmarks}\n" |
|
248 | $ hg log -T "{rev}: {desc} {bookmarks}\n" | |
249 | 3: add d10/f my-bookmark |
|
249 | 3: add d10/f my-bookmark | |
250 | 2: add d3/f |
|
250 | 2: add d3/f | |
251 | 1: add d2/f |
|
251 | 1: add d2/f | |
252 | 0: add d0/f |
|
252 | 0: add d0/f | |
253 | $ cd .. |
|
253 | $ cd .. | |
254 |
|
254 | |||
255 | Can remove last include, making repo empty |
|
255 | Can remove last include, making repo empty | |
256 | $ hg clone --narrow ssh://user@dummy/master narrow-empty --include d0 -r 5 |
|
256 | $ hg clone --narrow ssh://user@dummy/master narrow-empty --include d0 -r 5 | |
257 | adding changesets |
|
257 | adding changesets | |
258 | adding manifests |
|
258 | adding manifests | |
259 | adding file changes |
|
259 | adding file changes | |
260 | added 2 changesets with 1 changes to 1 files |
|
260 | added 2 changesets with 1 changes to 1 files | |
261 | new changesets *:* (glob) |
|
261 | new changesets *:* (glob) | |
262 | updating to branch default |
|
262 | updating to branch default | |
263 | 1 files updated, 0 files merged, 0 files removed, 0 files unresolved |
|
263 | 1 files updated, 0 files merged, 0 files removed, 0 files unresolved | |
264 | $ cd narrow-empty |
|
264 | $ cd narrow-empty | |
265 | $ hg tracked --removeinclude d0 |
|
265 | $ hg tracked --removeinclude d0 | |
266 | comparing with ssh://user@dummy/master |
|
266 | comparing with ssh://user@dummy/master | |
267 | searching for changes |
|
267 | searching for changes | |
268 | looking for local changes to affected paths |
|
268 | looking for local changes to affected paths | |
269 | deleting data/d0/f.i (reporevlogstore !) |
|
269 | deleting data/d0/f.i (reporevlogstore !) | |
270 | deleting meta/d0/00manifest.i (tree !) |
|
270 | deleting meta/d0/00manifest.i (tree !) | |
271 | deleting data/d0/f/362fef284ce2ca02aecc8de6d5e8a1c3af0556fe (reposimplestore !) |
|
271 | deleting data/d0/f/362fef284ce2ca02aecc8de6d5e8a1c3af0556fe (reposimplestore !) | |
272 | deleting data/d0/f/index (reposimplestore !) |
|
272 | deleting data/d0/f/index (reposimplestore !) | |
273 | $ hg tracked |
|
273 | $ hg tracked | |
274 | $ hg files |
|
274 | $ hg files | |
275 | [1] |
|
275 | [1] | |
276 | $ test -d d0 |
|
276 | $ test -d d0 | |
277 | [1] |
|
277 | [1] | |
278 | Do some work in the empty clone |
|
278 | Do some work in the empty clone | |
279 | $ hg diff --change . |
|
279 | $ hg diff --change . | |
280 | $ hg branch foo |
|
280 | $ hg branch foo | |
281 | marked working directory as branch foo |
|
281 | marked working directory as branch foo | |
282 | (branches are permanent and global, did you want a bookmark?) |
|
282 | (branches are permanent and global, did you want a bookmark?) | |
283 | $ hg ci -m empty |
|
283 | $ hg ci -m empty | |
|
284 | $ hg log -T "{rev}: {desc} {outsidenarrow}\n" | |||
|
285 | 2: empty | |||
|
286 | 1: add d5/f outsidenarrow | |||
|
287 | 0: add d0/f outsidenarrow | |||
284 | $ hg pull -q |
|
288 | $ hg pull -q | |
285 | Can widen the empty clone |
|
289 | Can widen the empty clone | |
286 | $ hg tracked --addinclude d0 |
|
290 | $ hg tracked --addinclude d0 | |
287 | comparing with ssh://user@dummy/master |
|
291 | comparing with ssh://user@dummy/master | |
288 | searching for changes |
|
292 | searching for changes | |
289 | no changes found |
|
293 | no changes found | |
290 | saved backup bundle to $TESTTMP/narrow-empty/.hg/strip-backup/*-widen.hg (glob) |
|
294 | saved backup bundle to $TESTTMP/narrow-empty/.hg/strip-backup/*-widen.hg (glob) | |
291 | adding changesets |
|
295 | adding changesets | |
292 | adding manifests |
|
296 | adding manifests | |
293 | adding file changes |
|
297 | adding file changes | |
294 | added 3 changesets with 1 changes to 1 files |
|
298 | added 3 changesets with 1 changes to 1 files | |
295 | new changesets *:* (glob) |
|
299 | new changesets *:* (glob) | |
296 | $ hg tracked |
|
300 | $ hg tracked | |
297 | I path:d0 |
|
301 | I path:d0 | |
298 | $ hg files |
|
302 | $ hg files | |
299 | d0/f |
|
303 | d0/f | |
300 | $ find * |
|
304 | $ find * | |
301 | d0 |
|
305 | d0 | |
302 | d0/f |
|
306 | d0/f | |
303 | $ cd .. |
|
307 | $ cd .. | |
304 |
|
308 | |||
305 | TODO(martinvonz): test including e.g. d3/g and then removing it once |
|
309 | TODO(martinvonz): test including e.g. d3/g and then removing it once | |
306 | https://bitbucket.org/Google/narrowhg/issues/6 is fixed |
|
310 | https://bitbucket.org/Google/narrowhg/issues/6 is fixed | |
307 |
|
311 | |||
308 | $ hg clone --narrow ssh://user@dummy/master narrow --include d0 --include d3 --include d6 --include d9 |
|
312 | $ hg clone --narrow ssh://user@dummy/master narrow --include d0 --include d3 --include d6 --include d9 | |
309 | requesting all changes |
|
313 | requesting all changes | |
310 | adding changesets |
|
314 | adding changesets | |
311 | adding manifests |
|
315 | adding manifests | |
312 | adding file changes |
|
316 | adding file changes | |
313 | added 8 changesets with 4 changes to 4 files |
|
317 | added 8 changesets with 4 changes to 4 files | |
314 | new changesets *:* (glob) |
|
318 | new changesets *:* (glob) | |
315 | updating to branch default |
|
319 | updating to branch default | |
316 | 4 files updated, 0 files merged, 0 files removed, 0 files unresolved |
|
320 | 4 files updated, 0 files merged, 0 files removed, 0 files unresolved | |
317 | $ cd narrow |
|
321 | $ cd narrow | |
318 | $ hg tracked |
|
322 | $ hg tracked | |
319 | I path:d0 |
|
323 | I path:d0 | |
320 | I path:d3 |
|
324 | I path:d3 | |
321 | I path:d6 |
|
325 | I path:d6 | |
322 | I path:d9 |
|
326 | I path:d9 | |
323 | $ hg tracked --removeinclude d6 |
|
327 | $ hg tracked --removeinclude d6 | |
324 | comparing with ssh://user@dummy/master |
|
328 | comparing with ssh://user@dummy/master | |
325 | searching for changes |
|
329 | searching for changes | |
326 | looking for local changes to affected paths |
|
330 | looking for local changes to affected paths | |
327 | deleting data/d6/f.i (reporevlogstore !) |
|
331 | deleting data/d6/f.i (reporevlogstore !) | |
328 | deleting meta/d6/00manifest.i (tree !) |
|
332 | deleting meta/d6/00manifest.i (tree !) | |
329 | deleting data/d6/f/7339d30678f451ac8c3f38753beeb4cf2e1655c7 (reposimplestore !) |
|
333 | deleting data/d6/f/7339d30678f451ac8c3f38753beeb4cf2e1655c7 (reposimplestore !) | |
330 | deleting data/d6/f/index (reposimplestore !) |
|
334 | deleting data/d6/f/index (reposimplestore !) | |
331 | $ hg tracked |
|
335 | $ hg tracked | |
332 | I path:d0 |
|
336 | I path:d0 | |
333 | I path:d3 |
|
337 | I path:d3 | |
334 | I path:d9 |
|
338 | I path:d9 | |
335 | #if repofncache |
|
339 | #if repofncache | |
336 | $ hg debugrebuildfncache |
|
340 | $ hg debugrebuildfncache | |
337 | fncache already up to date |
|
341 | fncache already up to date | |
338 | #endif |
|
342 | #endif | |
339 | $ find * |
|
343 | $ find * | |
340 | d0 |
|
344 | d0 | |
341 | d0/f |
|
345 | d0/f | |
342 | d3 |
|
346 | d3 | |
343 | d3/f |
|
347 | d3/f | |
344 | d9 |
|
348 | d9 | |
345 | d9/f |
|
349 | d9/f | |
346 | $ hg verify -q |
|
350 | $ hg verify -q | |
347 | $ hg tracked --addexclude d3/f |
|
351 | $ hg tracked --addexclude d3/f | |
348 | comparing with ssh://user@dummy/master |
|
352 | comparing with ssh://user@dummy/master | |
349 | searching for changes |
|
353 | searching for changes | |
350 | looking for local changes to affected paths |
|
354 | looking for local changes to affected paths | |
351 | deleting data/d3/f.i (reporevlogstore !) |
|
355 | deleting data/d3/f.i (reporevlogstore !) | |
352 | deleting data/d3/f/2661d26c649684b482d10f91960cc3db683c38b4 (reposimplestore !) |
|
356 | deleting data/d3/f/2661d26c649684b482d10f91960cc3db683c38b4 (reposimplestore !) | |
353 | deleting data/d3/f/index (reposimplestore !) |
|
357 | deleting data/d3/f/index (reposimplestore !) | |
354 | $ hg tracked |
|
358 | $ hg tracked | |
355 | I path:d0 |
|
359 | I path:d0 | |
356 | I path:d3 |
|
360 | I path:d3 | |
357 | I path:d9 |
|
361 | I path:d9 | |
358 | X path:d3/f |
|
362 | X path:d3/f | |
359 | #if repofncache |
|
363 | #if repofncache | |
360 | $ hg debugrebuildfncache |
|
364 | $ hg debugrebuildfncache | |
361 | fncache already up to date |
|
365 | fncache already up to date | |
362 | #endif |
|
366 | #endif | |
363 | $ find * |
|
367 | $ find * | |
364 | d0 |
|
368 | d0 | |
365 | d0/f |
|
369 | d0/f | |
366 | d9 |
|
370 | d9 | |
367 | d9/f |
|
371 | d9/f | |
368 | $ hg verify -q |
|
372 | $ hg verify -q | |
369 | $ hg tracked --addexclude d0 |
|
373 | $ hg tracked --addexclude d0 | |
370 | comparing with ssh://user@dummy/master |
|
374 | comparing with ssh://user@dummy/master | |
371 | searching for changes |
|
375 | searching for changes | |
372 | looking for local changes to affected paths |
|
376 | looking for local changes to affected paths | |
373 | deleting data/d0/f.i (reporevlogstore !) |
|
377 | deleting data/d0/f.i (reporevlogstore !) | |
374 | deleting meta/d0/00manifest.i (tree !) |
|
378 | deleting meta/d0/00manifest.i (tree !) | |
375 | deleting data/d0/f/362fef284ce2ca02aecc8de6d5e8a1c3af0556fe (reposimplestore !) |
|
379 | deleting data/d0/f/362fef284ce2ca02aecc8de6d5e8a1c3af0556fe (reposimplestore !) | |
376 | deleting data/d0/f/index (reposimplestore !) |
|
380 | deleting data/d0/f/index (reposimplestore !) | |
377 | $ hg tracked |
|
381 | $ hg tracked | |
378 | I path:d3 |
|
382 | I path:d3 | |
379 | I path:d9 |
|
383 | I path:d9 | |
380 | X path:d0 |
|
384 | X path:d0 | |
381 | X path:d3/f |
|
385 | X path:d3/f | |
382 | #if repofncache |
|
386 | #if repofncache | |
383 | $ hg debugrebuildfncache |
|
387 | $ hg debugrebuildfncache | |
384 | fncache already up to date |
|
388 | fncache already up to date | |
385 | #endif |
|
389 | #endif | |
386 | $ find * |
|
390 | $ find * | |
387 | d9 |
|
391 | d9 | |
388 | d9/f |
|
392 | d9/f | |
389 |
|
393 | |||
390 | Make a 15 of changes to d9 to test the path without --verbose |
|
394 | Make a 15 of changes to d9 to test the path without --verbose | |
391 | (Note: using regexes instead of "* (glob)" because if the test fails, it |
|
395 | (Note: using regexes instead of "* (glob)" because if the test fails, it | |
392 | produces more sensible diffs) |
|
396 | produces more sensible diffs) | |
393 | $ hg tracked |
|
397 | $ hg tracked | |
394 | I path:d3 |
|
398 | I path:d3 | |
395 | I path:d9 |
|
399 | I path:d9 | |
396 | X path:d0 |
|
400 | X path:d0 | |
397 | X path:d3/f |
|
401 | X path:d3/f | |
398 | $ for x in `$TESTDIR/seq.py 1 15` |
|
402 | $ for x in `$TESTDIR/seq.py 1 15` | |
399 | > do |
|
403 | > do | |
400 | > echo local change >> d9/f |
|
404 | > echo local change >> d9/f | |
401 | > hg commit -m "change $x to d9/f" |
|
405 | > hg commit -m "change $x to d9/f" | |
402 | > done |
|
406 | > done | |
403 | $ hg tracked --removeinclude d9 |
|
407 | $ hg tracked --removeinclude d9 | |
404 | comparing with ssh://user@dummy/master |
|
408 | comparing with ssh://user@dummy/master | |
405 | searching for changes |
|
409 | searching for changes | |
406 | looking for local changes to affected paths |
|
410 | looking for local changes to affected paths | |
407 | The following changeset(s) or their ancestors have local changes not on the remote: |
|
411 | The following changeset(s) or their ancestors have local changes not on the remote: | |
408 | ^[0-9a-f]{12}$ (re) |
|
412 | ^[0-9a-f]{12}$ (re) | |
409 | ^[0-9a-f]{12}$ (re) |
|
413 | ^[0-9a-f]{12}$ (re) | |
410 | ^[0-9a-f]{12}$ (re) |
|
414 | ^[0-9a-f]{12}$ (re) | |
411 | ^[0-9a-f]{12}$ (re) |
|
415 | ^[0-9a-f]{12}$ (re) | |
412 | ^[0-9a-f]{12}$ (re) |
|
416 | ^[0-9a-f]{12}$ (re) | |
413 | ^[0-9a-f]{12}$ (re) |
|
417 | ^[0-9a-f]{12}$ (re) | |
414 | ^[0-9a-f]{12}$ (re) |
|
418 | ^[0-9a-f]{12}$ (re) | |
415 | ^[0-9a-f]{12}$ (re) |
|
419 | ^[0-9a-f]{12}$ (re) | |
416 | ^[0-9a-f]{12}$ (re) |
|
420 | ^[0-9a-f]{12}$ (re) | |
417 | ^[0-9a-f]{12}$ (re) |
|
421 | ^[0-9a-f]{12}$ (re) | |
418 | ...and 5 more, use --verbose to list all |
|
422 | ...and 5 more, use --verbose to list all | |
419 | abort: local changes found |
|
423 | abort: local changes found | |
420 | (use --force-delete-local-changes to ignore) |
|
424 | (use --force-delete-local-changes to ignore) | |
421 | [255] |
|
425 | [255] | |
422 | Now test it *with* verbose. |
|
426 | Now test it *with* verbose. | |
423 | $ hg tracked --removeinclude d9 --verbose |
|
427 | $ hg tracked --removeinclude d9 --verbose | |
424 | comparing with ssh://user@dummy/master |
|
428 | comparing with ssh://user@dummy/master | |
425 | searching for changes |
|
429 | searching for changes | |
426 | looking for local changes to affected paths |
|
430 | looking for local changes to affected paths | |
427 | The following changeset(s) or their ancestors have local changes not on the remote: |
|
431 | The following changeset(s) or their ancestors have local changes not on the remote: | |
428 | ^[0-9a-f]{12}$ (re) |
|
432 | ^[0-9a-f]{12}$ (re) | |
429 | ^[0-9a-f]{12}$ (re) |
|
433 | ^[0-9a-f]{12}$ (re) | |
430 | ^[0-9a-f]{12}$ (re) |
|
434 | ^[0-9a-f]{12}$ (re) | |
431 | ^[0-9a-f]{12}$ (re) |
|
435 | ^[0-9a-f]{12}$ (re) | |
432 | ^[0-9a-f]{12}$ (re) |
|
436 | ^[0-9a-f]{12}$ (re) | |
433 | ^[0-9a-f]{12}$ (re) |
|
437 | ^[0-9a-f]{12}$ (re) | |
434 | ^[0-9a-f]{12}$ (re) |
|
438 | ^[0-9a-f]{12}$ (re) | |
435 | ^[0-9a-f]{12}$ (re) |
|
439 | ^[0-9a-f]{12}$ (re) | |
436 | ^[0-9a-f]{12}$ (re) |
|
440 | ^[0-9a-f]{12}$ (re) | |
437 | ^[0-9a-f]{12}$ (re) |
|
441 | ^[0-9a-f]{12}$ (re) | |
438 | ^[0-9a-f]{12}$ (re) |
|
442 | ^[0-9a-f]{12}$ (re) | |
439 | ^[0-9a-f]{12}$ (re) |
|
443 | ^[0-9a-f]{12}$ (re) | |
440 | ^[0-9a-f]{12}$ (re) |
|
444 | ^[0-9a-f]{12}$ (re) | |
441 | ^[0-9a-f]{12}$ (re) |
|
445 | ^[0-9a-f]{12}$ (re) | |
442 | ^[0-9a-f]{12}$ (re) |
|
446 | ^[0-9a-f]{12}$ (re) | |
443 | abort: local changes found |
|
447 | abort: local changes found | |
444 | (use --force-delete-local-changes to ignore) |
|
448 | (use --force-delete-local-changes to ignore) | |
445 | [255] |
|
449 | [255] |
General Comments 0
You need to be logged in to leave comments.
Login now