##// END OF EJS Templates
destroyed: drop complex branchcache rebuilt logic...
Pierre-Yves David -
r18395:904b7109 default
parent child Browse files
Show More
@@ -1398,7 +1398,7 b' class localrepository(object):'
1398 self._phasecache.write()
1398 self._phasecache.write()
1399
1399
1400 @unfilteredmethod
1400 @unfilteredmethod
1401 def destroyed(self, newheadnodes=None):
1401 def destroyed(self):
1402 '''Inform the repository that nodes have been destroyed.
1402 '''Inform the repository that nodes have been destroyed.
1403 Intended for use by strip and rollback, so there's a common
1403 Intended for use by strip and rollback, so there's a common
1404 place for anything that has to be done after destroying history.
1404 place for anything that has to be done after destroying history.
@@ -1421,16 +1421,9 b' class localrepository(object):'
1421 self._phasecache.filterunknown(self)
1421 self._phasecache.filterunknown(self)
1422 self._phasecache.write()
1422 self._phasecache.write()
1423
1423
1424 # If we have info, newheadnodes, on how to update the branch cache, do
1424 # update branchcache information likely invalidated by the strip.
1425 # it, Otherwise, since nodes were destroyed, the cache is stale and this
1425 # We rely on branchcache collaboration for this call to be fast
1426 # will be caught the next time it is read.
1426 branchmap.updatecache(self)
1427 if newheadnodes:
1428 cl = self.changelog
1429 revgen = (cl.rev(node) for node in newheadnodes
1430 if cl.hasnode(node))
1431 cache = self._branchcaches[None]
1432 cache.update(self, revgen)
1433 cache.write(self)
1434
1427
1435 # Ensure the persistent tag cache is updated. Doing it now
1428 # Ensure the persistent tag cache is updated. Doing it now
1436 # means that the tag cache only has to worry about destroyed
1429 # means that the tag cache only has to worry about destroyed
@@ -66,17 +66,6 b' def strip(ui, repo, nodelist, backup="al'
66 striplist = [cl.rev(node) for node in nodelist]
66 striplist = [cl.rev(node) for node in nodelist]
67 striprev = min(striplist)
67 striprev = min(striplist)
68
68
69 # Generate set of branches who will have nodes stripped.
70 striprevs = repo.revs("%ld::", striplist)
71 stripbranches = set([repo[rev].branch() for rev in striprevs])
72
73 # Set of potential new heads resulting from the strip. The parents of any
74 # node removed could be a new head because the node to be removed could have
75 # been the only child of the parent.
76 newheadrevs = repo.revs("parents(%ld::) - %ld::", striprevs, striprevs)
77 newheadnodes = set([cl.node(rev) for rev in newheadrevs])
78 newheadbranches = set([repo[rev].branch() for rev in newheadrevs])
79
80 keeppartialbundle = backup == 'strip'
69 keeppartialbundle = backup == 'strip'
81
70
82 # Some revisions with rev > striprev may not be descendants of striprev.
71 # Some revisions with rev > striprev may not be descendants of striprev.
@@ -191,10 +180,4 b' def strip(ui, repo, nodelist, backup="al'
191 % chgrpfile)
180 % chgrpfile)
192 raise
181 raise
193
182
194 if len(stripbranches) == 1 and len(newheadbranches) == 1 \
195 and stripbranches == newheadbranches:
196 repo.destroyed(newheadnodes)
197 else:
198 # Multiple branches involved in strip. Will allow branchcache to become
199 # invalid and later on rebuilt from scratch
200 repo.destroyed()
183 repo.destroyed()
@@ -1527,7 +1527,6 b' Branch acl deny test'
1527 query 1; heads
1527 query 1; heads
1528 searching for changes
1528 searching for changes
1529 all remote heads known locally
1529 all remote heads known locally
1530 invalid branchheads cache (served): tip differs
1531 listing keys for "bookmarks"
1530 listing keys for "bookmarks"
1532 4 changesets found
1531 4 changesets found
1533 list of changesets:
1532 list of changesets:
@@ -1839,7 +1838,6 b' push foobar into the remote'
1839 query 1; heads
1838 query 1; heads
1840 searching for changes
1839 searching for changes
1841 all remote heads known locally
1840 all remote heads known locally
1842 invalid branchheads cache (served): tip differs
1843 listing keys for "bookmarks"
1841 listing keys for "bookmarks"
1844 4 changesets found
1842 4 changesets found
1845 list of changesets:
1843 list of changesets:
@@ -1927,7 +1925,6 b' Branch acl conflicting deny'
1927 query 1; heads
1925 query 1; heads
1928 searching for changes
1926 searching for changes
1929 all remote heads known locally
1927 all remote heads known locally
1930 invalid branchheads cache (served): tip differs
1931 listing keys for "bookmarks"
1928 listing keys for "bookmarks"
1932 4 changesets found
1929 4 changesets found
1933 list of changesets:
1930 list of changesets:
@@ -2083,7 +2080,6 b' Non-astro users must be denied'
2083 query 1; heads
2080 query 1; heads
2084 searching for changes
2081 searching for changes
2085 all remote heads known locally
2082 all remote heads known locally
2086 invalid branchheads cache (served): tip differs
2087 listing keys for "bookmarks"
2083 listing keys for "bookmarks"
2088 4 changesets found
2084 4 changesets found
2089 list of changesets:
2085 list of changesets:
@@ -507,6 +507,7 b' amend'
507 $ hg -q commit -d '14 1' -m 'prepare amend'
507 $ hg -q commit -d '14 1' -m 'prepare amend'
508
508
509 $ hg --debug commit --amend -d '15 1' -m 'amend without changes' | grep keywords
509 $ hg --debug commit --amend -d '15 1' -m 'amend without changes' | grep keywords
510 invalid branchheads cache (served): tip differs
510 overwriting a expanding keywords
511 overwriting a expanding keywords
511 $ hg -q id
512 $ hg -q id
512 67d8c481a6be
513 67d8c481a6be
@@ -45,7 +45,6 b' test updating a symlink'
45 popping updatelink
45 popping updatelink
46 now at: symlink.patch
46 now at: symlink.patch
47 $ hg qpush --debug
47 $ hg qpush --debug
48 invalid branchheads cache (served): tip differs
49 applying updatelink
48 applying updatelink
50 patching file a
49 patching file a
51 a
50 a
@@ -263,9 +263,10 b' Rebase and collapse - E onto H:'
263
263
264
264
265 Test that branchheads cache is updated correctly when doing a strip in which
265 Test that branchheads cache is updated correctly when doing a strip in which
266 the parent of the ancestor node to be stripped does not become a head and
266 the parent of the ancestor node to be stripped does not become a head and also,
267 also, the parent of a node that is a child of the node stripped becomes a head
267 the parent of a node that is a child of the node stripped becomes a head (node
268 (node 3).
268 3). The code is now much simpler and we could just test a simpler scenario
269 We keep it the test this way in case new complexity is injected.
269
270
270 $ hg clone -q -u . b b2
271 $ hg clone -q -u . b b2
271 $ cd b2
272 $ cd b2
@@ -282,7 +283,7 b' also, the parent of a node that is a chi'
282 $ hg strip 4
283 $ hg strip 4
283 saved backup bundle to $TESTTMP/b2/.hg/strip-backup/8a5212ebc852-backup.hg (glob)
284 saved backup bundle to $TESTTMP/b2/.hg/strip-backup/8a5212ebc852-backup.hg (glob)
284
285
285 $ cat $TESTTMP/b2/.hg/cache/branchheads
286 $ cat $TESTTMP/b2/.hg/cache/branchheads-served
286 c65502d4178782309ce0574c5ae6ee9485a9bafa 4
287 c65502d4178782309ce0574c5ae6ee9485a9bafa 4
287 2870ad076e541e714f3c2bc32826b5c6a6e5b040 default
288 2870ad076e541e714f3c2bc32826b5c6a6e5b040 default
288 c65502d4178782309ce0574c5ae6ee9485a9bafa default
289 c65502d4178782309ce0574c5ae6ee9485a9bafa default
General Comments 0
You need to be logged in to leave comments. Login now