Show More
@@ -49,3 +49,4 b' 195dbd1cef0c2f9f8bcf4ea303238105f716bda3' | |||
|
49 | 49 | 6344043924497cd06d781d9014c66802285072e4 0 iD8DBQBPALgmywK+sNU5EO8RAlfhAJ9nYOdWnhfVDHYtDTJAyJtXBAQS9wCgnefoSQt7QABkbGxM+Q85UYEBuD0= |
|
50 | 50 | db33555eafeaf9df1e18950e29439eaa706d399b 0 iD8DBQBPGdzxywK+sNU5EO8RAppkAJ9jOXhUVE/97CPgiMA0pMGiIYnesQCfengAszcBiSiKGugiI8Okc9ghU+Y= |
|
51 | 51 | 2aa5b51f310fb3befd26bed99c02267f5c12c734 0 iD8DBQBPKZ9bywK+sNU5EO8RAt1TAJ45r1eJ0YqSkInzrrayg4TVCh0SnQCgm0GA/Ua74jnnDwVQ60lAwROuz1Q= |
|
52 | 53e2cd303ecf8ca7c7eeebd785c34e5ed6b0f4a4 0 iD8DBQBPT/fvywK+sNU5EO8RAnfYAKCn7d0vwqIb100YfWm1F7nFD5B+FACeM02YHpQLSNsztrBCObtqcnfod7Q= |
@@ -61,3 +61,4 b' 195dbd1cef0c2f9f8bcf4ea303238105f716bda3' | |||
|
61 | 61 | 6344043924497cd06d781d9014c66802285072e4 2.0.2 |
|
62 | 62 | db33555eafeaf9df1e18950e29439eaa706d399b 2.1-rc |
|
63 | 63 | 2aa5b51f310fb3befd26bed99c02267f5c12c734 2.1 |
|
64 | 53e2cd303ecf8ca7c7eeebd785c34e5ed6b0f4a4 2.1.1 |
@@ -14,6 +14,17 b' import cStringIO' | |||
|
14 | 14 | |
|
15 | 15 | _format = ">cllll" |
|
16 | 16 | propertycache = util.propertycache |
|
17 | filecache = scmutil.filecache | |
|
18 | ||
|
19 | class repocache(filecache): | |
|
20 | """filecache for files in .hg/""" | |
|
21 | def join(self, obj, fname): | |
|
22 | return obj._opener.join(fname) | |
|
23 | ||
|
24 | class rootcache(filecache): | |
|
25 | """filecache for files in the repository root""" | |
|
26 | def join(self, obj, fname): | |
|
27 | return obj._join(fname) | |
|
17 | 28 | |
|
18 | 29 | def _finddirs(path): |
|
19 | 30 | pos = path.rfind('/') |
@@ -52,6 +63,7 b' class dirstate(object):' | |||
|
52 | 63 | self._dirtypl = False |
|
53 | 64 | self._lastnormaltime = 0 |
|
54 | 65 | self._ui = ui |
|
66 | self._filecache = {} | |
|
55 | 67 | |
|
56 | 68 | @propertycache |
|
57 | 69 | def _map(self): |
@@ -77,7 +89,7 b' class dirstate(object):' | |||
|
77 | 89 | f['.'] = '.' # prevents useless util.fspath() invocation |
|
78 | 90 | return f |
|
79 | 91 | |
|
80 | @propertycache | |
|
92 | @repocache('branch') | |
|
81 | 93 | def _branch(self): |
|
82 | 94 | try: |
|
83 | 95 | return self._opener.read("branch").strip() or "default" |
@@ -113,7 +125,7 b' class dirstate(object):' | |||
|
113 | 125 | def dirs(self): |
|
114 | 126 | return self._dirs |
|
115 | 127 | |
|
116 | @propertycache | |
|
128 | @rootcache('.hgignore') | |
|
117 | 129 | def _ignore(self): |
|
118 | 130 | files = [self._join('.hgignore')] |
|
119 | 131 | for name, path in self._ui.configitems("ui"): |
@@ -19,6 +19,11 b' import weakref, errno, os, time, inspect' | |||
|
19 | 19 | propertycache = util.propertycache |
|
20 | 20 | filecache = scmutil.filecache |
|
21 | 21 | |
|
22 | class storecache(filecache): | |
|
23 | """filecache for files in the store""" | |
|
24 | def join(self, obj, fname): | |
|
25 | return obj.sjoin(fname) | |
|
26 | ||
|
22 | 27 | class localrepository(repo.repository): |
|
23 | 28 | capabilities = set(('lookup', 'changegroupsubset', 'branchmap', 'pushkey', |
|
24 | 29 | 'known', 'getbundle')) |
@@ -176,7 +181,7 b' class localrepository(repo.repository):' | |||
|
176 | 181 | def _writebookmarks(self, marks): |
|
177 | 182 | bookmarks.write(self) |
|
178 | 183 | |
|
179 |
@ |
|
|
184 | @storecache('phaseroots') | |
|
180 | 185 | def _phaseroots(self): |
|
181 | 186 | self._dirtyphases = False |
|
182 | 187 | phaseroots = phases.readroots(self) |
@@ -195,7 +200,7 b' class localrepository(repo.repository):' | |||
|
195 | 200 | cache[rev] = phase |
|
196 | 201 | return cache |
|
197 | 202 | |
|
198 |
@ |
|
|
203 | @storecache('00changelog.i') | |
|
199 | 204 | def changelog(self): |
|
200 | 205 | c = changelog.changelog(self.sopener) |
|
201 | 206 | if 'HG_PENDING' in os.environ: |
@@ -204,7 +209,7 b' class localrepository(repo.repository):' | |||
|
204 | 209 | c.readpending('00changelog.i.a') |
|
205 | 210 | return c |
|
206 | 211 | |
|
207 |
@ |
|
|
212 | @storecache('00manifest.i') | |
|
208 | 213 | def manifest(self): |
|
209 | 214 | return manifest.manifest(self.sopener) |
|
210 | 215 | |
@@ -896,10 +901,13 b' class localrepository(repo.repository):' | |||
|
896 | 901 | rereads the dirstate. Use dirstate.invalidate() if you want to |
|
897 | 902 | explicitly read the dirstate again (i.e. restoring it to a previous |
|
898 | 903 | known good state).''' |
|
899 | try: | |
|
904 | if 'dirstate' in self.__dict__: | |
|
905 | for k in self.dirstate._filecache: | |
|
906 | try: | |
|
907 | delattr(self.dirstate, k) | |
|
908 | except AttributeError: | |
|
909 | pass | |
|
900 | 910 | delattr(self, 'dirstate') |
|
901 | except AttributeError: | |
|
902 | pass | |
|
903 | 911 | |
|
904 | 912 | def invalidate(self): |
|
905 | 913 | for k in self._filecache: |
@@ -211,7 +211,7 b' class opener(abstractopener):' | |||
|
211 | 211 | if r: |
|
212 | 212 | raise util.Abort("%s: %r" % (r, path)) |
|
213 | 213 | self.auditor(path) |
|
214 |
f = |
|
|
214 | f = self.join(path) | |
|
215 | 215 | |
|
216 | 216 | if not text and "b" not in mode: |
|
217 | 217 | mode += "b" # for that other OS |
@@ -255,7 +255,7 b' class opener(abstractopener):' | |||
|
255 | 255 | |
|
256 | 256 | def symlink(self, src, dst): |
|
257 | 257 | self.auditor(dst) |
|
258 |
linkname = |
|
|
258 | linkname = self.join(dst) | |
|
259 | 259 | try: |
|
260 | 260 | os.unlink(linkname) |
|
261 | 261 | except OSError: |
@@ -280,6 +280,9 b' class opener(abstractopener):' | |||
|
280 | 280 | def audit(self, path): |
|
281 | 281 | self.auditor(path) |
|
282 | 282 | |
|
283 | def join(self, path): | |
|
284 | return os.path.join(self.base, path) | |
|
285 | ||
|
283 | 286 | class filteropener(abstractopener): |
|
284 | 287 | '''Wrapper opener for filtering filenames with a function.''' |
|
285 | 288 | |
@@ -804,9 +807,17 b' class filecache(object):' | |||
|
804 | 807 | to tell us if a file has been replaced. If it can't, we fallback to |
|
805 | 808 | recreating the object on every call (essentially the same behaviour as |
|
806 | 809 | propertycache).''' |
|
807 |
def __init__(self, path |
|
|
810 | def __init__(self, path): | |
|
808 | 811 | self.path = path |
|
809 | self.instore = instore | |
|
812 | ||
|
813 | def join(self, obj, fname): | |
|
814 | """Used to compute the runtime path of the cached file. | |
|
815 | ||
|
816 | Users should subclass filecache and provide their own version of this | |
|
817 | function to call the appropriate join function on 'obj' (an instance | |
|
818 | of the class that its member function was decorated). | |
|
819 | """ | |
|
820 | return obj.join(fname) | |
|
810 | 821 | |
|
811 | 822 | def __call__(self, func): |
|
812 | 823 | self.func = func |
@@ -824,7 +835,7 b' class filecache(object):' | |||
|
824 | 835 | if entry.changed(): |
|
825 | 836 | entry.obj = self.func(obj) |
|
826 | 837 | else: |
|
827 |
path = self. |
|
|
838 | path = self.join(obj, self.path) | |
|
828 | 839 | |
|
829 | 840 | # We stat -before- creating the object so our cache doesn't lie if |
|
830 | 841 | # a writer modified between the time we read and stat |
@@ -212,6 +212,27 b' def rollback(server):' | |||
|
212 | 212 | runcommand(server, ['rollback']) |
|
213 | 213 | runcommand(server, ['phase', '-r', '.']) |
|
214 | 214 | |
|
215 | def branch(server): | |
|
216 | readchannel(server) | |
|
217 | runcommand(server, ['branch']) | |
|
218 | os.system('hg branch foo') | |
|
219 | runcommand(server, ['branch']) | |
|
220 | os.system('hg branch default') | |
|
221 | ||
|
222 | def hgignore(server): | |
|
223 | readchannel(server) | |
|
224 | f = open('.hgignore', 'ab') | |
|
225 | f.write('') | |
|
226 | f.close() | |
|
227 | runcommand(server, ['commit', '-Am.']) | |
|
228 | f = open('ignored-file', 'ab') | |
|
229 | f.write('') | |
|
230 | f.close() | |
|
231 | f = open('.hgignore', 'ab') | |
|
232 | f.write('ignored-file') | |
|
233 | f.close() | |
|
234 | runcommand(server, ['status', '-i', '-u']) | |
|
235 | ||
|
215 | 236 | if __name__ == '__main__': |
|
216 | 237 | os.system('hg init') |
|
217 | 238 | |
@@ -232,3 +253,5 b" if __name__ == '__main__':" | |||
|
232 | 253 | check(tagscache) |
|
233 | 254 | check(setphase) |
|
234 | 255 | check(rollback) |
|
256 | check(branch) | |
|
257 | check(hgignore) |
@@ -145,3 +145,21 b' repository tip rolled back to revision 3' | |||
|
145 | 145 | working directory now based on revision 3 |
|
146 | 146 | runcommand phase -r . |
|
147 | 147 | 3: public |
|
148 | ||
|
149 | testing branch: | |
|
150 | ||
|
151 | runcommand branch | |
|
152 | default | |
|
153 | marked working directory as branch foo | |
|
154 | (branches are permanent and global, did you want a bookmark?) | |
|
155 | runcommand branch | |
|
156 | foo | |
|
157 | marked working directory as branch default | |
|
158 | (branches are permanent and global, did you want a bookmark?) | |
|
159 | ||
|
160 | testing hgignore: | |
|
161 | ||
|
162 | runcommand commit -Am. | |
|
163 | adding .hgignore | |
|
164 | runcommand status -i -u | |
|
165 | I ignored-file |
General Comments 0
You need to be logged in to leave comments.
Login now