# HG changeset patch # User Benoit Boissinot # Date 1266782367 -3600 # Node ID bae9bb09166b934ef78d48e379914ae6e70af627 # Parent 3a69afd6987e6c477b75ccf232625606b333bf99 strip: invalidate all caches after stripping (fixes issue1951) test thanks to Stefano Tortarolo diff -r 3a69afd6987e -r bae9bb09166b mercurial/localrepo.py --- a/mercurial/localrepo.py Thu Feb 25 14:35:21 2010 +0100 +++ b/mercurial/localrepo.py Sun Feb 21 20:59:27 2010 +0100 @@ -622,16 +622,19 @@ finally: release(lock, wlock) - def invalidate(self): - for a in "changelog manifest".split(): - if a in self.__dict__: - delattr(self, a) + def invalidatecaches(self): self._tags = None self._tagtypes = None self.nodetagscache = None self._branchcache = None # in UTF-8 self._branchcachetip = None + def invalidate(self): + for a in "changelog manifest".split(): + if a in self.__dict__: + delattr(self, a) + self.invalidatecaches() + def _lock(self, lockname, wait, releasefn, acquirefn, desc): try: l = lock.lock(lockname, 0, releasefn, desc=desc) @@ -957,7 +960,7 @@ # head, refresh the tag cache, then immediately add a new head. # But I think doing it this way is necessary for the "instant # tag cache retrieval" case to work. - tags_.findglobaltags(self.ui, self, {}, {}) + self.invalidatecaches() def walk(self, match, node=None): ''' diff -r 3a69afd6987e -r bae9bb09166b tests/test-rebase-cache --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/tests/test-rebase-cache Sun Feb 21 20:59:27 2010 +0100 @@ -0,0 +1,104 @@ +#!/bin/sh + +createrepo() { + rm -rf repo + hg init repo + cd repo + + echo "a" > a + hg commit -d '0 0' -A -m 'A' + + hg branch branch1 + hg commit -d '1 0' -m 'Branch1' + + echo "b" > b + hg commit -A -d '2 0' -m 'B' + + hg up 0 + hg branch branch2 + hg commit -d '3 0' -m 'Branch2' + + echo "c" > C + hg commit -A -d '4 0' -m 'C' + + hg up 2 + hg branch -f branch2 + echo "d" > d + hg commit -A -d '5 0' -m 'D' + + echo "e" > e + hg commit -A -d '6 0' -m 'E' + + hg update default + + hg branch branch3 + hg commit -d '7 0' -m 'Branch3' + + echo "f" > f + hg commit -A -d '8 0' -m 'F' +} + +echo +createrepo > /dev/null 2>&1 +hg --config extensions.hgext.graphlog= glog --template '{rev}:{node|short} {desc} branch: {branches}\n' + +echo +echo '% Branches' +hg branches + +echo +echo '% Heads' +hg heads --template '{rev}:{node|short} {desc} branch: {branches}\n' + +echo +echo '% Rebase part of branch2 (5-6) onto branch3 (8)' +hg --config extensions.hgext.rebase= rebase --detach -s 5 -d 8 2>&1 | sed 's/\(saving bundle to \).*/\1/' + +echo +echo '% Branches' +hg branches + +echo +echo '% Heads' +hg heads --template '{rev}:{node|short} {desc} branch: {branches}\n' + +echo +hg --config extensions.hgext.graphlog= glog --template '{rev}:{node|short} {desc} branch: {branches}\n' + +echo +echo '% Rebase head of branch3 (8) onto branch2 (6)' +createrepo > /dev/null 2>&1 +hg --config extensions.hgext.graphlog= glog --template '{rev}:{node|short} {desc} branch: {branches}\n' + +hg --config extensions.hgext.rebase= rebase --detach -s 8 -d 6 2>&1 | sed 's/\(saving bundle to \).*/\1/' + +echo +echo '% Branches' +hg branches + +echo +echo '% Heads' +hg heads --template '{rev}:{node|short} {desc} branch: {branches}\n' + +echo +hg --config extensions.hgext.graphlog= glog --template '{rev}:{node|short} {desc} branch: {branches}\n' +hg verify -q + +echo +echo '% Rebase entire branch3 (7-8) onto branch2 (6)' +createrepo > /dev/null 2>&1 +hg --config extensions.hgext.graphlog= glog --template '{rev}:{node|short} {desc} branch: {branches}\n' + +hg --config extensions.hgext.rebase= rebase --detach -s 7 -d 6 2>&1 | sed 's/\(saving bundle to \).*/\1/' + +echo +echo '% Branches' +hg branches + +echo +echo '% Heads' +hg heads --template '{rev}:{node|short} {desc} branch: {branches}\n' + +echo +hg --config extensions.hgext.graphlog= glog --template '{rev}:{node|short} {desc} branch: {branches}\n' +hg verify -q diff -r 3a69afd6987e -r bae9bb09166b tests/test-rebase-cache.out --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/tests/test-rebase-cache.out Sun Feb 21 20:59:27 2010 +0100 @@ -0,0 +1,186 @@ + +@ 8:c11d5b3e9c00 F branch: branch3 +| +o 7:33c9da881988 Branch3 branch: branch3 +| +| o 6:0e4064ab11a3 E branch: branch2 +| | +| o 5:5ac035cb5d8f D branch: branch2 +| | +| | o 4:8e66061486ee C branch: branch2 +| | | ++---o 3:99567862abbe Branch2 branch: branch2 +| | +| o 2:65a26a4d12f6 B branch: branch1 +| | +| o 1:0f3f3010ee16 Branch1 branch: branch1 +|/ +o 0:1994f17a630e A branch: + + +% Branches +branch3 8:c11d5b3e9c00 +branch2 6:0e4064ab11a3 +branch1 2:65a26a4d12f6 (inactive) +default 0:1994f17a630e (inactive) + +% Heads +8:c11d5b3e9c00 F branch: branch3 +6:0e4064ab11a3 E branch: branch2 +4:8e66061486ee C branch: branch2 +2:65a26a4d12f6 B branch: branch1 +0:1994f17a630e A branch: + +% Rebase part of branch2 (5-6) onto branch3 (8) +saving bundle to +adding branch +adding changesets +adding manifests +adding file changes +added 4 changesets with 3 changes to 3 files (+1 heads) +rebase completed + +% Branches +branch3 8:c9bfa9beb84e +branch2 4:8e66061486ee +branch1 2:65a26a4d12f6 +default 0:1994f17a630e (inactive) + +% Heads +8:c9bfa9beb84e E branch: branch3 +4:8e66061486ee C branch: branch2 +2:65a26a4d12f6 B branch: branch1 +0:1994f17a630e A branch: + +@ 8:c9bfa9beb84e E branch: branch3 +| +o 7:bf9037384081 D branch: branch3 +| +o 6:c11d5b3e9c00 F branch: branch3 +| +o 5:33c9da881988 Branch3 branch: branch3 +| +| o 4:8e66061486ee C branch: branch2 +| | +| o 3:99567862abbe Branch2 branch: branch2 +|/ +| o 2:65a26a4d12f6 B branch: branch1 +| | +| o 1:0f3f3010ee16 Branch1 branch: branch1 +|/ +o 0:1994f17a630e A branch: + + +% Rebase head of branch3 (8) onto branch2 (6) +@ 8:c11d5b3e9c00 F branch: branch3 +| +o 7:33c9da881988 Branch3 branch: branch3 +| +| o 6:0e4064ab11a3 E branch: branch2 +| | +| o 5:5ac035cb5d8f D branch: branch2 +| | +| | o 4:8e66061486ee C branch: branch2 +| | | ++---o 3:99567862abbe Branch2 branch: branch2 +| | +| o 2:65a26a4d12f6 B branch: branch1 +| | +| o 1:0f3f3010ee16 Branch1 branch: branch1 +|/ +o 0:1994f17a630e A branch: + +saving bundle to +adding branch +adding changesets +adding manifests +adding file changes +added 1 changesets with 1 changes to 1 files +rebase completed + +% Branches +branch2 8:b44d3024f247 +branch3 7:33c9da881988 +branch1 2:65a26a4d12f6 (inactive) +default 0:1994f17a630e (inactive) + +% Heads +8:b44d3024f247 F branch: branch2 +7:33c9da881988 Branch3 branch: branch3 +4:8e66061486ee C branch: branch2 +2:65a26a4d12f6 B branch: branch1 +0:1994f17a630e A branch: + +@ 8:b44d3024f247 F branch: branch2 +| +| o 7:33c9da881988 Branch3 branch: branch3 +| | +o | 6:0e4064ab11a3 E branch: branch2 +| | +o | 5:5ac035cb5d8f D branch: branch2 +| | +| | o 4:8e66061486ee C branch: branch2 +| | | +| | o 3:99567862abbe Branch2 branch: branch2 +| |/ +o | 2:65a26a4d12f6 B branch: branch1 +| | +o | 1:0f3f3010ee16 Branch1 branch: branch1 +|/ +o 0:1994f17a630e A branch: + + +% Rebase entire branch3 (7-8) onto branch2 (6) +@ 8:c11d5b3e9c00 F branch: branch3 +| +o 7:33c9da881988 Branch3 branch: branch3 +| +| o 6:0e4064ab11a3 E branch: branch2 +| | +| o 5:5ac035cb5d8f D branch: branch2 +| | +| | o 4:8e66061486ee C branch: branch2 +| | | ++---o 3:99567862abbe Branch2 branch: branch2 +| | +| o 2:65a26a4d12f6 B branch: branch1 +| | +| o 1:0f3f3010ee16 Branch1 branch: branch1 +|/ +o 0:1994f17a630e A branch: + +saving bundle to +adding branch +adding changesets +adding manifests +adding file changes +added 1 changesets with 1 changes to 1 files +rebase completed + +% Branches +branch2 7:b44d3024f247 +branch1 2:65a26a4d12f6 (inactive) +default 0:1994f17a630e (inactive) + +% Heads +7:b44d3024f247 F branch: branch2 +4:8e66061486ee C branch: branch2 +2:65a26a4d12f6 B branch: branch1 +0:1994f17a630e A branch: + +@ 7:b44d3024f247 F branch: branch2 +| +o 6:0e4064ab11a3 E branch: branch2 +| +o 5:5ac035cb5d8f D branch: branch2 +| +| o 4:8e66061486ee C branch: branch2 +| | +| o 3:99567862abbe Branch2 branch: branch2 +| | +o | 2:65a26a4d12f6 B branch: branch1 +| | +o | 1:0f3f3010ee16 Branch1 branch: branch1 +|/ +o 0:1994f17a630e A branch: +