##// END OF EJS Templates
scmutil: update cached copy when filecached attribute is assigned (issue3263)...
Idan Kamara -
r16115:236bb604 stable
parent child Browse files
Show More
@@ -803,6 +803,10 b' class filecache(object):'
803 return self
803 return self
804
804
805 def __get__(self, obj, type=None):
805 def __get__(self, obj, type=None):
806 # do we need to check if the file changed?
807 if self.name in obj.__dict__:
808 return obj.__dict__[self.name]
809
806 entry = obj._filecache.get(self.name)
810 entry = obj._filecache.get(self.name)
807
811
808 if entry:
812 if entry:
@@ -818,5 +822,16 b' class filecache(object):'
818
822
819 obj._filecache[self.name] = entry
823 obj._filecache[self.name] = entry
820
824
821 setattr(obj, self.name, entry.obj)
825 obj.__dict__[self.name] = entry.obj
822 return entry.obj
826 return entry.obj
827
828 def __set__(self, obj, value):
829 if self.name in obj._filecache:
830 obj._filecache[self.name].obj = value # update cached copy
831 obj.__dict__[self.name] = value # update copy returned by obj.x
832
833 def __delete__(self, obj):
834 try:
835 del obj.__dict__[self.name]
836 except KeyError:
837 raise AttributeError, self.name
@@ -112,6 +112,7 b' class statichttprepository(localrepo.loc'
112 self.spath = self.store.path
112 self.spath = self.store.path
113 self.sopener = self.store.opener
113 self.sopener = self.store.opener
114 self.sjoin = self.store.join
114 self.sjoin = self.store.join
115 self._filecache = {}
115
116
116 self.manifest = manifest.manifest(self.sopener)
117 self.manifest = manifest.manifest(self.sopener)
117 self.changelog = changelog.changelog(self.sopener)
118 self.changelog = changelog.changelog(self.sopener)
@@ -122,7 +123,6 b' class statichttprepository(localrepo.loc'
122 self.encodepats = None
123 self.encodepats = None
123 self.decodepats = None
124 self.decodepats = None
124 self.capabilities.difference_update(["pushkey"])
125 self.capabilities.difference_update(["pushkey"])
125 self._filecache = {}
126
126
127 def url(self):
127 def url(self):
128 return self._url
128 return self._url
@@ -181,6 +181,13 b' def bookmarks(server):'
181 os.system('hg upd bm1 -q')
181 os.system('hg upd bm1 -q')
182 runcommand(server, ['bookmarks'])
182 runcommand(server, ['bookmarks'])
183
183
184 runcommand(server, ['bookmarks', 'bm3'])
185 f = open('a', 'ab')
186 f.write('a\n')
187 f.close()
188 runcommand(server, ['commit', '-Amm'])
189 runcommand(server, ['bookmarks'])
190
184 def tagscache(server):
191 def tagscache(server):
185 readchannel(server)
192 readchannel(server)
186 runcommand(server, ['id', '-t', '-r', '0'])
193 runcommand(server, ['id', '-t', '-r', '0'])
@@ -114,6 +114,12 b' no bookmarks set'
114 runcommand bookmarks
114 runcommand bookmarks
115 * bm1 1:d3a0a68be6de
115 * bm1 1:d3a0a68be6de
116 bm2 1:d3a0a68be6de
116 bm2 1:d3a0a68be6de
117 runcommand bookmarks bm3
118 runcommand commit -Amm
119 runcommand bookmarks
120 bm1 1:d3a0a68be6de
121 bm2 1:d3a0a68be6de
122 * bm3 2:aef17e88f5f0
117
123
118 testing tagscache:
124 testing tagscache:
119
125
@@ -125,6 +131,6 b' foo'
125 testing setphase:
131 testing setphase:
126
132
127 runcommand phase -r .
133 runcommand phase -r .
128 2: draft
134 3: draft
129 runcommand phase -r .
135 runcommand phase -r .
130 2: public
136 3: public
General Comments 0
You need to be logged in to leave comments. Login now