Mercurial > hg
comparison mercurial/localrepo.py @ 17070:ad0d6c2b3279
obsolete: introduction of obsolete markers
Markers are stored as binary records in a log structured file in
.hg/store/obsstore.
author | Pierre-Yves.David@ens-lyon.org |
---|---|
date | Thu, 07 Jun 2012 19:07:39 +0200 |
parents | c8eda7bbdcab |
children | 28ed1c4511ce |
comparison
equal
deleted
inserted
replaced
17069:2b1c78674230 | 17070:ad0d6c2b3279 |
---|---|
5 # This software may be used and distributed according to the terms of the | 5 # This software may be used and distributed according to the terms of the |
6 # GNU General Public License version 2 or any later version. | 6 # GNU General Public License version 2 or any later version. |
7 | 7 |
8 from node import bin, hex, nullid, nullrev, short | 8 from node import bin, hex, nullid, nullrev, short |
9 from i18n import _ | 9 from i18n import _ |
10 import repo, changegroup, subrepo, discovery, pushkey | 10 import repo, changegroup, subrepo, discovery, pushkey, obsolete |
11 import changelog, dirstate, filelog, manifest, context, bookmarks, phases | 11 import changelog, dirstate, filelog, manifest, context, bookmarks, phases |
12 import lock, transaction, store, encoding | 12 import lock, transaction, store, encoding |
13 import scmutil, util, extensions, hook, error, revset | 13 import scmutil, util, extensions, hook, error, revset |
14 import match as matchmod | 14 import match as matchmod |
15 import merge as mergemod | 15 import merge as mergemod |
190 | 190 |
191 @storecache('phaseroots') | 191 @storecache('phaseroots') |
192 def _phasecache(self): | 192 def _phasecache(self): |
193 return phases.phasecache(self, self._phasedefaults) | 193 return phases.phasecache(self, self._phasedefaults) |
194 | 194 |
195 @storecache('obsstore') | |
196 def obsstore(self): | |
197 store = obsolete.obsstore() | |
198 data = self.sopener.tryread('obsstore') | |
199 if data: | |
200 store.loadmarkers(data) | |
201 return store | |
202 | |
195 @storecache('00changelog.i') | 203 @storecache('00changelog.i') |
196 def changelog(self): | 204 def changelog(self): |
197 c = changelog.changelog(self.sopener) | 205 c = changelog.changelog(self.sopener) |
198 if 'HG_PENDING' in os.environ: | 206 if 'HG_PENDING' in os.environ: |
199 p = os.environ['HG_PENDING'] | 207 p = os.environ['HG_PENDING'] |
981 | 989 |
982 def unlock(): | 990 def unlock(): |
983 self.store.write() | 991 self.store.write() |
984 if '_phasecache' in vars(self): | 992 if '_phasecache' in vars(self): |
985 self._phasecache.write() | 993 self._phasecache.write() |
994 if 'obsstore' in vars(self) and self.obsstore._new: | |
995 # XXX: transaction logic should be used here. But for | |
996 # now rewriting the whole file is good enough. | |
997 f = self.sopener('obsstore', 'wb', atomictemp=True) | |
998 try: | |
999 self.obsstore.flushmarkers(f) | |
1000 f.close() | |
1001 except: # re-raises | |
1002 f.discard() | |
1003 raise | |
986 for k, ce in self._filecache.items(): | 1004 for k, ce in self._filecache.items(): |
987 if k == 'dirstate': | 1005 if k == 'dirstate': |
988 continue | 1006 continue |
989 ce.refresh() | 1007 ce.refresh() |
990 | 1008 |