Mercurial > hg-stable
comparison tests/test-narrow-share.t @ 41046:ce0bc2952e2a
narrow: detect if narrowspec was changed in a different share
With this commit, `hg share` should be usable with narrow
repos. Design explained on
https://www.mercurial-scm.org/wiki/NarrowSharePlan
I was running into cache invalidation problems when updating the
narrowspec. After spending a day trying to figure out a good solution,
I resorted to just assigning repo.narrowpats and repo._narrowmatch
after invalidating them.
Differential Revision: https://phab.mercurial-scm.org/D5278
author | Martin von Zweigbergk <martinvonz@google.com> |
---|---|
date | Fri, 21 Dec 2018 10:13:49 -0800 |
parents | 7db1619af061 |
children | 3227923979a1 |
comparison
equal
deleted
inserted
replaced
41045:7db1619af061 | 41046:ce0bc2952e2a |
---|---|
73 deleting meta/d1/00manifest.i (tree !) | 73 deleting meta/d1/00manifest.i (tree !) |
74 deleting meta/d3/00manifest.i (tree !) | 74 deleting meta/d3/00manifest.i (tree !) |
75 deleting meta/d5/00manifest.i (tree !) | 75 deleting meta/d5/00manifest.i (tree !) |
76 $ hg -R main tracked | 76 $ hg -R main tracked |
77 I path:d7 | 77 I path:d7 |
78 $ hg -R main files | |
79 abort: working copy's narrowspec is stale | |
80 (run 'hg tracked --update-working-copy') | |
81 [255] | |
82 $ hg -R main tracked --update-working-copy | |
83 not deleting possibly dirty file d3/f | |
84 not deleting possibly dirty file d3/g | |
85 not deleting possibly dirty file d5/f | |
78 # d1/f, d3/f, d3/g and d5/f should no longer be reported | 86 # d1/f, d3/f, d3/g and d5/f should no longer be reported |
79 $ hg -R main files | 87 $ hg -R main files |
80 main/d7/f | 88 main/d7/f |
81 # d1/f should no longer be there, d3/f should be since it was dirty, d3/g should be there since | 89 # d1/f should no longer be there, d3/f should be since it was dirty, d3/g should be there since |
82 # it was added, and d5/f should be since we couldn't be sure it was clean | 90 # it was added, and d5/f should be since we couldn't be sure it was clean |
83 $ find main/d* -type f | sort | 91 $ find main/d* -type f | sort |
84 main/d1/f | |
85 main/d3/f | 92 main/d3/f |
86 main/d3/g | 93 main/d3/g |
87 main/d5/f | 94 main/d5/f |
88 main/d7/f | 95 main/d7/f |
89 | 96 |
100 share/d7/f | 107 share/d7/f |
101 $ hg -R main tracked | 108 $ hg -R main tracked |
102 I path:d1 | 109 I path:d1 |
103 I path:d3 | 110 I path:d3 |
104 I path:d7 | 111 I path:d7 |
112 $ hg -R main files | |
113 abort: working copy's narrowspec is stale | |
114 (run 'hg tracked --update-working-copy') | |
115 [255] | |
116 $ hg -R main tracked --update-working-copy | |
105 # d1/f, d3/f should be back | 117 # d1/f, d3/f should be back |
106 $ hg -R main files | 118 $ hg -R main files |
107 main/d1/f | 119 main/d1/f |
108 main/d3/f | 120 main/d3/f |
109 main/d3/g | |
110 main/d7/f | 121 main/d7/f |
111 # d3/f should be modified (not clobbered by the widening), and d3/g should be untracked | 122 # d3/f should be modified (not clobbered by the widening), and d3/g should be untracked |
112 $ hg -R main st --all | 123 $ hg -R main st --all |
113 M d3/f | 124 M d3/f |
114 A d3/g | 125 ? d3/g |
115 C d1/f | 126 C d1/f |
116 C d7/f | 127 C d7/f |
117 | 128 |
118 We should also be able to unshare without breaking everything: | 129 We should also be able to unshare without breaking everything: |
119 | 130 |
128 checking directory manifests (tree !) | 139 checking directory manifests (tree !) |
129 crosschecking files in changesets and manifests | 140 crosschecking files in changesets and manifests |
130 checking files | 141 checking files |
131 checked 11 changesets with 3 changes to 3 files | 142 checked 11 changesets with 3 changes to 3 files |
132 $ cd .. | 143 $ cd .. |
144 | |
145 Dirstate should be left alone when upgrading from version of hg that didn't support narrow+share | |
146 | |
147 $ hg share main share-upgrade | |
148 updating working directory | |
149 3 files updated, 0 files merged, 0 files removed, 0 files unresolved | |
150 $ cd share-upgrade | |
151 $ echo x >> d1/f | |
152 $ echo y >> d3/g | |
153 $ hg add d3/g | |
154 $ hg rm d7/f | |
155 $ hg st | |
156 M d1/f | |
157 A d3/g | |
158 R d7/f | |
159 Make it look like a repo from before narrow+share was supported | |
160 $ rm .hg/narrowspec.dirstate | |
161 $ hg st | |
162 abort: working copy's narrowspec is stale | |
163 (run 'hg tracked --update-working-copy') | |
164 [255] | |
165 $ hg tracked --update-working-copy | |
166 $ hg st | |
167 M d1/f | |
168 A d3/g | |
169 R d7/f | |
170 $ cd .. |