##// END OF EJS Templates
branchmap: allow to use cache of subset...
Pierre-Yves David -
r18234:a55b0688 default
parent child Browse files
Show More
@@ -7,7 +7,7 b''
7
7
8 from node import bin, hex, nullid, nullrev
8 from node import bin, hex, nullid, nullrev
9 import encoding
9 import encoding
10 import util
10 import util, repoview
11
11
12 def _filename(repo):
12 def _filename(repo):
13 """name of a branchcache file for a given repo or repoview"""
13 """name of a branchcache file for a given repo or repoview"""
@@ -63,16 +63,24 b' def updatecache(repo):'
63 filtername = repo.filtername
63 filtername = repo.filtername
64 partial = repo._branchcaches.get(filtername)
64 partial = repo._branchcaches.get(filtername)
65
65
66 revs = []
66 if partial is None or not partial.validfor(repo):
67 if partial is None or not partial.validfor(repo):
67 partial = read(repo)
68 partial = read(repo)
68 if partial is None:
69 if partial is None:
69 partial = branchcache()
70 subsetname = repoview.subsettable.get(filtername)
70
71 if subsetname is None:
71 revs = list(cl.revs(start=partial.tiprev +1))
72 partial = branchcache()
73 else:
74 subset = repo.filtered(subsetname)
75 partial = subset.branchmap().copy()
76 extrarevs = subset.changelog.filteredrevs - cl.filteredrevs
77 revs.extend(r for r in extrarevs if r <= partial.tiprev)
78 revs.extend(cl.revs(start=partial.tiprev + 1))
72 if revs:
79 if revs:
73 ctxgen = (repo[r] for r in revs)
80 ctxgen = (repo[r] for r in revs)
74 partial.update(repo, ctxgen)
81 partial.update(repo, ctxgen)
75 partial.write(repo)
82 partial.write(repo)
83 assert partial.validfor(repo)
76 repo._branchcaches[repo.filtername] = partial
84 repo._branchcaches[repo.filtername] = partial
77
85
78 class branchcache(dict):
86 class branchcache(dict):
@@ -140,6 +140,7 b' Extension disabled for lack of acl.sourc'
140 query 1; heads
140 query 1; heads
141 searching for changes
141 searching for changes
142 all remote heads known locally
142 all remote heads known locally
143 invalid branchheads cache (unserved): tip differs
143 listing keys for "bookmarks"
144 listing keys for "bookmarks"
144 3 changesets found
145 3 changesets found
145 list of changesets:
146 list of changesets:
@@ -201,6 +202,7 b' No [acl.allow]/[acl.deny]'
201 query 1; heads
202 query 1; heads
202 searching for changes
203 searching for changes
203 all remote heads known locally
204 all remote heads known locally
205 invalid branchheads cache (unserved): tip differs
204 listing keys for "bookmarks"
206 listing keys for "bookmarks"
205 3 changesets found
207 3 changesets found
206 list of changesets:
208 list of changesets:
@@ -272,6 +274,7 b' Empty [acl.allow]'
272 query 1; heads
274 query 1; heads
273 searching for changes
275 searching for changes
274 all remote heads known locally
276 all remote heads known locally
277 invalid branchheads cache (unserved): tip differs
275 listing keys for "bookmarks"
278 listing keys for "bookmarks"
276 3 changesets found
279 3 changesets found
277 list of changesets:
280 list of changesets:
@@ -770,6 +773,7 b' wilma can change files with a .txt exten'
770 query 1; heads
773 query 1; heads
771 searching for changes
774 searching for changes
772 all remote heads known locally
775 all remote heads known locally
776 invalid branchheads cache (unserved): tip differs
773 listing keys for "bookmarks"
777 listing keys for "bookmarks"
774 3 changesets found
778 3 changesets found
775 list of changesets:
779 list of changesets:
@@ -1087,6 +1091,7 b' fred is always allowed'
1087 query 1; heads
1091 query 1; heads
1088 searching for changes
1092 searching for changes
1089 all remote heads known locally
1093 all remote heads known locally
1094 invalid branchheads cache (unserved): tip differs
1090 listing keys for "bookmarks"
1095 listing keys for "bookmarks"
1091 3 changesets found
1096 3 changesets found
1092 list of changesets:
1097 list of changesets:
@@ -1162,6 +1167,7 b' no one is allowed inside foo/Bar/'
1162 query 1; heads
1167 query 1; heads
1163 searching for changes
1168 searching for changes
1164 all remote heads known locally
1169 all remote heads known locally
1170 invalid branchheads cache (unserved): tip differs
1165 listing keys for "bookmarks"
1171 listing keys for "bookmarks"
1166 3 changesets found
1172 3 changesets found
1167 list of changesets:
1173 list of changesets:
@@ -1313,6 +1319,7 b' OS-level groups'
1313 query 1; heads
1319 query 1; heads
1314 searching for changes
1320 searching for changes
1315 all remote heads known locally
1321 all remote heads known locally
1322 invalid branchheads cache (unserved): tip differs
1316 listing keys for "bookmarks"
1323 listing keys for "bookmarks"
1317 3 changesets found
1324 3 changesets found
1318 list of changesets:
1325 list of changesets:
@@ -1510,6 +1517,7 b' Branch acl deny test'
1510 query 1; heads
1517 query 1; heads
1511 searching for changes
1518 searching for changes
1512 all remote heads known locally
1519 all remote heads known locally
1520 invalid branchheads cache (unserved): tip differs
1513 listing keys for "bookmarks"
1521 listing keys for "bookmarks"
1514 4 changesets found
1522 4 changesets found
1515 list of changesets:
1523 list of changesets:
@@ -1821,6 +1829,7 b' push foobar into the remote'
1821 query 1; heads
1829 query 1; heads
1822 searching for changes
1830 searching for changes
1823 all remote heads known locally
1831 all remote heads known locally
1832 invalid branchheads cache (unserved): tip differs
1824 listing keys for "bookmarks"
1833 listing keys for "bookmarks"
1825 4 changesets found
1834 4 changesets found
1826 list of changesets:
1835 list of changesets:
@@ -1908,6 +1917,7 b' Branch acl conflicting deny'
1908 query 1; heads
1917 query 1; heads
1909 searching for changes
1918 searching for changes
1910 all remote heads known locally
1919 all remote heads known locally
1920 invalid branchheads cache (unserved): tip differs
1911 listing keys for "bookmarks"
1921 listing keys for "bookmarks"
1912 4 changesets found
1922 4 changesets found
1913 list of changesets:
1923 list of changesets:
@@ -2063,6 +2073,7 b' Non-astro users must be denied'
2063 query 1; heads
2073 query 1; heads
2064 searching for changes
2074 searching for changes
2065 all remote heads known locally
2075 all remote heads known locally
2076 invalid branchheads cache (unserved): tip differs
2066 listing keys for "bookmarks"
2077 listing keys for "bookmarks"
2067 4 changesets found
2078 4 changesets found
2068 list of changesets:
2079 list of changesets:
@@ -70,7 +70,7 b' Non store repo:'
70 .hg/00changelog.i
70 .hg/00changelog.i
71 .hg/00manifest.i
71 .hg/00manifest.i
72 .hg/cache
72 .hg/cache
73 .hg/cache/branchheads
73 .hg/cache/branchheads-unserved
74 .hg/data
74 .hg/data
75 .hg/data/tst.d.hg
75 .hg/data/tst.d.hg
76 .hg/data/tst.d.hg/foo.i
76 .hg/data/tst.d.hg/foo.i
@@ -98,7 +98,7 b' Non fncache repo:'
98 .hg
98 .hg
99 .hg/00changelog.i
99 .hg/00changelog.i
100 .hg/cache
100 .hg/cache
101 .hg/cache/branchheads
101 .hg/cache/branchheads-unserved
102 .hg/dirstate
102 .hg/dirstate
103 .hg/last-message.txt
103 .hg/last-message.txt
104 .hg/requires
104 .hg/requires
@@ -196,7 +196,7 b' r4 has hardlinks in the working dir (not'
196 $ nlinksdir r4
196 $ nlinksdir r4
197 2 r4/.hg/00changelog.i
197 2 r4/.hg/00changelog.i
198 2 r4/.hg/branch
198 2 r4/.hg/branch
199 2 r4/.hg/cache/branchheads
199 2 r4/.hg/cache/branchheads-unserved
200 2 r4/.hg/dirstate
200 2 r4/.hg/dirstate
201 2 r4/.hg/hgrc
201 2 r4/.hg/hgrc
202 2 r4/.hg/last-message.txt
202 2 r4/.hg/last-message.txt
@@ -226,7 +226,7 b' Update back to revision 11 in r4 should '
226 $ nlinksdir r4
226 $ nlinksdir r4
227 2 r4/.hg/00changelog.i
227 2 r4/.hg/00changelog.i
228 1 r4/.hg/branch
228 1 r4/.hg/branch
229 2 r4/.hg/cache/branchheads
229 2 r4/.hg/cache/branchheads-unserved
230 1 r4/.hg/dirstate
230 1 r4/.hg/dirstate
231 2 r4/.hg/hgrc
231 2 r4/.hg/hgrc
232 2 r4/.hg/last-message.txt
232 2 r4/.hg/last-message.txt
@@ -66,7 +66,7 b' new directories are setgid'
66 00700 ./.hg/
66 00700 ./.hg/
67 00600 ./.hg/00changelog.i
67 00600 ./.hg/00changelog.i
68 00770 ./.hg/cache/
68 00770 ./.hg/cache/
69 00660 ./.hg/cache/branchheads
69 00660 ./.hg/cache/branchheads-unserved
70 00660 ./.hg/dirstate
70 00660 ./.hg/dirstate
71 00660 ./.hg/last-message.txt
71 00660 ./.hg/last-message.txt
72 00600 ./.hg/requires
72 00600 ./.hg/requires
@@ -111,7 +111,7 b' group can still write everything'
111 00770 ../push/.hg/
111 00770 ../push/.hg/
112 00660 ../push/.hg/00changelog.i
112 00660 ../push/.hg/00changelog.i
113 00770 ../push/.hg/cache/
113 00770 ../push/.hg/cache/
114 00660 ../push/.hg/cache/branchheads
114 00660 ../push/.hg/cache/branchheads-unserved
115 00660 ../push/.hg/requires
115 00660 ../push/.hg/requires
116 00770 ../push/.hg/store/
116 00770 ../push/.hg/store/
117 00660 ../push/.hg/store/00changelog.i
117 00660 ../push/.hg/store/00changelog.i
@@ -747,7 +747,9 b' Interrupted commit should not change sta'
747 Commit with multi-line message and custom expansion
747 Commit with multi-line message and custom expansion
748
748
749 $ hg --debug commit -l log -d '2 0' -u 'User Name <user@example.com>'
749 $ hg --debug commit -l log -d '2 0' -u 'User Name <user@example.com>'
750 invalid branchheads cache: tip differs
750 a
751 a
752 invalid branchheads cache: tip differs
751 overwriting a expanding keywords
753 overwriting a expanding keywords
752 committed changeset 2:bb948857c743469b22bbf51f7ec8112279ca5d83
754 committed changeset 2:bb948857c743469b22bbf51f7ec8112279ca5d83
753 $ rm log
755 $ rm log
@@ -789,6 +791,8 b' remove with status checks'
789 $ hg debugrebuildstate
791 $ hg debugrebuildstate
790 $ hg remove a
792 $ hg remove a
791 $ hg --debug commit -m rma
793 $ hg --debug commit -m rma
794 invalid branchheads cache: tip differs
795 invalid branchheads cache: tip differs
792 committed changeset 3:d14c712653769de926994cf7fbb06c8fbd68f012
796 committed changeset 3:d14c712653769de926994cf7fbb06c8fbd68f012
793 $ hg status
797 $ hg status
794 ? c
798 ? c
@@ -899,8 +903,10 b' kwexpand x/a should abort'
899 [255]
903 [255]
900 $ cd x
904 $ cd x
901 $ hg --debug commit -m xa -d '3 0' -u 'User Name <user@example.com>'
905 $ hg --debug commit -m xa -d '3 0' -u 'User Name <user@example.com>'
906 invalid branchheads cache: tip differs
902 x/a
907 x/a
903 x/a: copy a:779c764182ce5d43e2b1eb66ce06d7b47bfe342e
908 x/a: copy a:779c764182ce5d43e2b1eb66ce06d7b47bfe342e
909 invalid branchheads cache: tip differs
904 overwriting x/a expanding keywords
910 overwriting x/a expanding keywords
905 committed changeset 3:b4560182a3f9a358179fd2d835c15e9da379c1e4
911 committed changeset 3:b4560182a3f9a358179fd2d835c15e9da379c1e4
906 $ cat a
912 $ cat a
@@ -1,5 +1,15 b''
1 $ branchcache=.hg/cache/branchheads
1 $ branchcache=.hg/cache/branchheads
2
2
3 $ listbranchcaches() {
4 > for f in .hg/cache/branchheads*;
5 > do echo === $f ===;
6 > cat $f;
7 > done;
8 > }
9 $ purgebranchcaches() {
10 > rm .hg/cache/branchheads*
11 > }
12
3 $ hg init t
13 $ hg init t
4 $ cd t
14 $ cd t
5
15
@@ -112,7 +122,7 b' Test for invalid branch cache:'
112 repository tip rolled back to revision 4 (undo commit)
122 repository tip rolled back to revision 4 (undo commit)
113 working directory now based on revisions 4 and 3
123 working directory now based on revisions 4 and 3
114
124
115 $ cp $branchcache .hg/bc-invalid
125 $ cp ${branchcache}-unserved .hg/bc-invalid
116
126
117 $ hg log -r foo
127 $ hg log -r foo
118 changeset: 4:adf1a74a7f7b
128 changeset: 4:adf1a74a7f7b
@@ -142,13 +152,16 b' Test for invalid branch cache:'
142 modify a branch
152 modify a branch
143
153
144
154
145 $ rm $branchcache
155 $ purgebranchcaches
146 $ echo corrupted > $branchcache
156 $ echo corrupted > $branchcache
147
157
148 $ hg log -qr foo
158 $ hg log -qr foo
149 4:adf1a74a7f7b
159 4:adf1a74a7f7b
150
160
151 $ cat $branchcache
161 $ listbranchcaches
162 === .hg/cache/branchheads ===
163 corrupted
164 === .hg/cache/branchheads-unserved ===
152 adf1a74a7f7b4cd193d12992f5d0d6a004ed21d6 4
165 adf1a74a7f7b4cd193d12992f5d0d6a004ed21d6 4
153 1c28f494dae69a2f8fc815059d257eccf3fcfe75 default
166 1c28f494dae69a2f8fc815059d257eccf3fcfe75 default
154 adf1a74a7f7b4cd193d12992f5d0d6a004ed21d6 foo
167 adf1a74a7f7b4cd193d12992f5d0d6a004ed21d6 foo
@@ -162,7 +175,8 b' Pushing just rev 0:'
162
175
163 $ hg push -qr 0 ../target
176 $ hg push -qr 0 ../target
164
177
165 $ cat ../target/$branchcache
178 $ (cd ../target/; listbranchcaches)
179 === .hg/cache/branchheads-unserved ===
166 db01e8ea3388fd3c7c94e1436ea2bd6a53d581c5 0
180 db01e8ea3388fd3c7c94e1436ea2bd6a53d581c5 0
167 db01e8ea3388fd3c7c94e1436ea2bd6a53d581c5 default
181 db01e8ea3388fd3c7c94e1436ea2bd6a53d581c5 default
168
182
@@ -170,7 +184,8 b' Pushing everything:'
170
184
171 $ hg push -qf ../target
185 $ hg push -qf ../target
172
186
173 $ cat ../target/$branchcache
187 $ (cd ../target/; listbranchcaches)
188 === .hg/cache/branchheads-unserved ===
174 adf1a74a7f7b4cd193d12992f5d0d6a004ed21d6 4
189 adf1a74a7f7b4cd193d12992f5d0d6a004ed21d6 4
175 1c28f494dae69a2f8fc815059d257eccf3fcfe75 default
190 1c28f494dae69a2f8fc815059d257eccf3fcfe75 default
176 adf1a74a7f7b4cd193d12992f5d0d6a004ed21d6 foo
191 adf1a74a7f7b4cd193d12992f5d0d6a004ed21d6 foo
@@ -62,6 +62,7 b' A_1 have two direct and divergent succes'
62 $ newcase direct
62 $ newcase direct
63 $ hg debugobsolete `getid A_0` `getid A_1`
63 $ hg debugobsolete `getid A_0` `getid A_1`
64 $ hg debugobsolete `getid A_0` `getid A_2`
64 $ hg debugobsolete `getid A_0` `getid A_2`
65 invalid branchheads cache (unserved): tip differs
65 $ hg log -G --hidden
66 $ hg log -G --hidden
66 o 3:392fd25390da A_2
67 o 3:392fd25390da A_2
67 |
68 |
@@ -103,6 +104,7 b' indirect divergence with known changeset'
103 $ newcase indirect_known
104 $ newcase indirect_known
104 $ hg debugobsolete `getid A_0` `getid A_1`
105 $ hg debugobsolete `getid A_0` `getid A_1`
105 $ hg debugobsolete `getid A_0` `getid A_2`
106 $ hg debugobsolete `getid A_0` `getid A_2`
107 invalid branchheads cache (unserved): tip differs
106 $ mkcommit A_3
108 $ mkcommit A_3
107 created new head
109 created new head
108 $ hg debugobsolete `getid A_2` `getid A_3`
110 $ hg debugobsolete `getid A_2` `getid A_3`
@@ -141,6 +143,7 b' indirect divergence with known changeset'
141 $ newcase indirect_unknown
143 $ newcase indirect_unknown
142 $ hg debugobsolete `getid A_0` aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa
144 $ hg debugobsolete `getid A_0` aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa
143 $ hg debugobsolete aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa `getid A_1`
145 $ hg debugobsolete aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa `getid A_1`
146 invalid branchheads cache (unserved): tip differs
144 $ hg debugobsolete `getid A_0` `getid A_2`
147 $ hg debugobsolete `getid A_0` `getid A_2`
145 $ hg log -G --hidden
148 $ hg log -G --hidden
146 o 3:392fd25390da A_2
149 o 3:392fd25390da A_2
@@ -172,6 +175,7 b' do not take unknown node in account if t'
172 $ newcase final-unknown
175 $ newcase final-unknown
173 $ hg debugobsolete `getid A_0` `getid A_1`
176 $ hg debugobsolete `getid A_0` `getid A_1`
174 $ hg debugobsolete `getid A_1` `getid A_2`
177 $ hg debugobsolete `getid A_1` `getid A_2`
178 invalid branchheads cache (unserved): tip differs
175 $ hg debugobsolete `getid A_0` bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb
179 $ hg debugobsolete `getid A_0` bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb
176 $ hg debugobsolete bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb cccccccccccccccccccccccccccccccccccccccc
180 $ hg debugobsolete bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb cccccccccccccccccccccccccccccccccccccccc
177 $ hg debugobsolete `getid A_1` dddddddddddddddddddddddddddddddddddddddd
181 $ hg debugobsolete `getid A_1` dddddddddddddddddddddddddddddddddddddddd
@@ -188,6 +192,7 b' divergence that converge again is not di'
188 $ newcase converged_divergence
192 $ newcase converged_divergence
189 $ hg debugobsolete `getid A_0` `getid A_1`
193 $ hg debugobsolete `getid A_0` `getid A_1`
190 $ hg debugobsolete `getid A_0` `getid A_2`
194 $ hg debugobsolete `getid A_0` `getid A_2`
195 invalid branchheads cache (unserved): tip differs
191 $ mkcommit A_3
196 $ mkcommit A_3
192 created new head
197 created new head
193 $ hg debugobsolete `getid A_1` `getid A_3`
198 $ hg debugobsolete `getid A_1` `getid A_3`
@@ -434,6 +439,7 b' successors-set. (report [A,B] not [A] + '
434 $ newcase subset
439 $ newcase subset
435 $ hg debugobsolete `getid A_0` `getid A_2`
440 $ hg debugobsolete `getid A_0` `getid A_2`
436 $ hg debugobsolete `getid A_0` `getid A_1` `getid A_2`
441 $ hg debugobsolete `getid A_0` `getid A_1` `getid A_2`
442 invalid branchheads cache (unserved): tip differs
437 $ hg debugsuccessorssets 'desc('A_0')'
443 $ hg debugsuccessorssets 'desc('A_0')'
438 007dc284c1f8
444 007dc284c1f8
439 82623d38b9ba 392fd25390da
445 82623d38b9ba 392fd25390da
@@ -274,7 +274,7 b' also, the parent of a node that is a chi'
274 7:c65502d4178782309ce0574c5ae6ee9485a9bafa default
274 7:c65502d4178782309ce0574c5ae6ee9485a9bafa default
275 6:c772a8b2dc17629cec88a19d09c926c4814b12c7 default
275 6:c772a8b2dc17629cec88a19d09c926c4814b12c7 default
276
276
277 $ cat $TESTTMP/b2/.hg/cache/branchheads
277 $ cat $TESTTMP/b2/.hg/cache/branchheads-unserved
278 c65502d4178782309ce0574c5ae6ee9485a9bafa 7
278 c65502d4178782309ce0574c5ae6ee9485a9bafa 7
279 c772a8b2dc17629cec88a19d09c926c4814b12c7 default
279 c772a8b2dc17629cec88a19d09c926c4814b12c7 default
280 c65502d4178782309ce0574c5ae6ee9485a9bafa default
280 c65502d4178782309ce0574c5ae6ee9485a9bafa default
General Comments 0
You need to be logged in to leave comments. Login now