sapling/mercurial
Gregory Szorc ae8cb885e7 changelog: load pending file directly
When changelogs are written, a copy of the index (or inline revlog)
may be written to an 00changelog.i.a file to facilitate hooks and
other processes having access to the pending data before it is
finalized.

The way it works today, the localrepo class loads the changelog
like normal. Then, if it detects a pending transaction, it asks
the changelog class to load a pending changelog. The changelog
class looks for a 00changelog.i.a file. If it exists, it is
loaded and internal data structures on the new revlog class are
copied to the original instance.

The existing mechanism is inefficient because it loads 2 revlog
files. The index, node map, and chunk cache for 00changelog.i
are thrown away and replaced by those for 00changelog.i.a.

The existing mechanism is also brittle because it is a layering
violation to access the data structures being accessed. For example,
the code copies the "chunk cache" because for inline revlogs
this cache contains the raw revision chunks and allows the original
changelog/revlog instance to access revision data for these pending
revisions. This whole behavior of course relies on the revlog
constructor reading the entirety of an inline revlog into memory
and caching it. That's why it is brittle. (I discovered all this
as part of modifying behavior of the chunk cache.)

This patch streamlines the loading of a pending 00changelog.i.a
revlog by doing it directly in the changelog constructor if told
to do so. When this code path is active, we no longer load the
00changelog.i file at all.

The only negative outcome I see from this change is if loading
00changelog.i was somehow facilitating a role. But I can't imagine
what that would be because we throw away its data (the index data
structures are replaced and inline revision data is replaced via
the chunk cache) and since 00changelog.i.a is a copy of
00changelog.i, file content should be identical, so there should
be no meaninful file integrity checking at play. I think this was
all just sub-optimal code.
2017-05-13 16:26:43 -07:00
..
cext policy: add "cext" package which will host CPython extension modules 2016-08-12 11:06:14 +09:00
cffi setup: move cffi stuff to mercurial/cffi 2016-11-09 22:08:30 +00:00
default.d mergetools.rc: find OSX FileMerge in the new location inside Xcode 4.3 2015-10-16 11:37:34 +02:00
help help: clarify that colons are allowed in fingerprints values 2017-05-11 00:02:32 -07:00
hgweb hgweb: do not show "descending" link in followlines UI for filelog heads 2017-04-24 10:32:15 +02:00
httpclient httpclient: update to 54868ef054d2 of httpplus 2016-06-27 11:53:50 -04:00
pure lazymanifest: write a more efficient, pypy friendly version of lazymanifest 2016-09-12 13:37:14 +02:00
templates hgweb: change text of followlines links to "older / newer" 2017-04-24 10:48:07 +02:00
__init__.py py3: add pycompat.unicode and add it to importer 2017-04-07 23:35:51 +05:30
ancestor.py cleanup: use set literals 2017-02-10 16:56:29 -08:00
archival.py py3: remove use of *L syntax 2016-09-01 02:29:46 +05:30
base85.c base85: fix comparison of an int and a long 2015-08-21 14:29:42 -04:00
bdiff_module.c bdiff: include util.h 2016-10-13 13:27:14 +02:00
bdiff.c bdiff: split bdiff into cpy-aware and cpy-agnostic part 2016-07-13 10:46:26 +02:00
bdiff.h bdiff: split bdiff into cpy-aware and cpy-agnostic part 2016-07-13 10:46:26 +02:00
bitmanipulation.h internals: move the bitmanipulation routines into its own file 2016-06-06 13:08:13 +02:00
bookmarks.py bookmarks: abort 'push -B .' when no active bookmark 2016-06-13 23:50:26 +02:00
branchmap.py branchmap: remove use of buffer() to support Python 2.6 2017-05-13 11:58:08 -07:00
bundle2.py bundle: add optional 'tagsfnodecache' data to on disk bundle (issue5543) 2017-05-05 17:31:15 +02:00
bundlerepo.py bundlerepo: fix raw handling in revision() 2017-04-06 17:45:47 -07:00
byterange.py pycompat: switch to util.urlreq/util.urlerr for py3 compat 2016-04-06 23:22:12 +00:00
changegroup.py changegroup: add bundlecaps back 2017-05-15 09:35:27 -07:00
changelog.py changelog: load pending file directly 2017-05-13 16:26:43 -07:00
chgserver.py chgserver: more explicit about sensitive environ variables 2017-05-10 11:55:22 -07:00
cmdutil.py py3: convert kwargs' keys to str using pycompat.strkwargs 2017-05-04 00:24:21 +05:30
color.py color: special case 'always' in 'ui.color' 2017-05-02 20:19:09 +02:00
commands.py merge with stable 2017-05-12 11:20:25 -07:00
commandserver.py commandserver: move printbanner logic to bindsocket 2017-04-30 11:21:05 -07:00
compat.h compat: define ssize_t as int on 32bit Windows, silences C4142 warning 2016-07-15 23:54:56 +09:00
config.py ui: move configlist parser to config.py 2017-03-17 09:19:56 -07:00
context.py filectx: add an overlayfilectx class 2017-05-09 20:23:21 -07:00
copies.py cleanup: use set literals 2017-02-10 16:56:29 -08:00
crecord.py crecord: avoid setting non-existing SIGTSTP signal on windows (issue5512) 2017-04-06 11:28:25 +02:00
dagparser.py error: get Abort from 'error' instead of 'util' 2015-10-08 12:55:45 -07:00
dagutil.py dagutil: use absolute_import 2015-08-08 19:04:09 -07:00
debugcommands.py caches: introduce a 'debugupdatecaches' command 2017-05-02 21:35:06 +02:00
demandimport.py windows: add win32com.shell to demandimport ignore list 2017-04-14 12:34:26 -07:00
destutil.py update: use single quotes in use warning 2016-09-02 21:49:33 +00:00
diffhelpers.c diffhelpers: fix botched return statement from e48d70075d8a 2015-01-28 13:34:20 -05:00
dirs.c dirs: use PyVarObject_HEAD_INIT 2016-10-13 13:14:14 +02:00
dirstate.py dirstate: fix debug.dirstate.delaywrite to use the new "now" after sleeping 2016-10-18 16:52:35 +02:00
dirstateguard.py dirstateguard: move to new module so I can break some layering violations 2016-11-21 21:29:32 -05:00
discovery.py discovery: prevent crash caused by prune marker having no parent data 2017-04-19 23:10:05 +09:00
dispatch.py freeze: merge default into stable for 4.2 code freeze 2017-04-18 12:24:34 -04:00
dummycert.pem ssl: on OS X, use a dummy cert to trick Python/OpenSSL to use system CA certs 2014-09-26 02:19:48 +02:00
encoding.py encoding: remove workaround for locale.getpreferredencoding() 2017-05-13 11:20:51 -07:00
error.py error: rename RichIOError to PeerTransportError 2017-04-16 11:12:37 -07:00
exchange.py changegroup: add bundlecaps back 2017-05-15 09:35:27 -07:00
exewrapper.c exewrapper: add .dll to LoadLibrary() argument 2016-04-27 09:23:39 -07:00
extensions.py cleanup: use set literals 2017-02-10 16:56:29 -08:00
fancyopts.py cleanup: use set literals 2017-02-10 16:56:29 -08:00
filelog.py filelog: fix parsemeta docstring 2017-05-02 22:39:14 -07:00
filemerge.py filemerge: add internal merge tool to dump files forcibly 2017-05-13 03:31:42 +09:00
fileset.py cleanup: use set literals 2017-02-10 16:56:29 -08:00
formatter.py templatekw: add public function to wrap a dict by _hybrid object 2017-04-05 22:28:09 +09:00
graphmod.py py3: use list of bytes rather than bytestring while extending bytes into lists 2017-05-04 04:38:20 +05:30
hbisect.py bisect: move check_state into the bisect module 2016-08-24 04:25:20 +02:00
help.py help: explain how to access subtopics in internals 2017-04-19 17:04:22 -07:00
hg.py py3: replace str() with bytes() 2017-04-07 13:46:35 +05:30
hook.py hook: add hook name information to external hook 2017-03-31 11:53:56 +02:00
httpconnection.py httpconnection: allow a global auth.cookiefile config entry 2017-03-09 22:35:10 -08:00
httppeer.py httppeer: unify hint message for PeerTransportError 2017-05-01 05:52:36 +09:00
i18n.py i18n: make the locale directory name the same string type as the datapath 2016-10-08 05:26:18 -04:00
keepalive.py keepalive: send HTTP request headers in a deterministic order 2017-04-13 18:04:38 -07:00
localrepo.py changelog: load pending file directly 2017-05-13 16:26:43 -07:00
lock.py lock: avoid unintentional lock acquisition at failure of readlock 2017-05-01 19:59:13 +09:00
lsprof.py lsprof: use print function 2016-01-02 11:40:53 -08:00
lsprofcalltree.py lsprofcalltree: use print function 2016-01-02 11:45:29 -08:00
mail.py mail: remove code to support < Python 2.7 2017-05-13 11:12:44 -07:00
manifest.c manifest: use PyVarObject_HEAD_INIT 2016-10-13 13:17:23 +02:00
manifest.py treemanifest: allow manifestrevlog to take an explicit treemanifest arg 2017-05-09 13:56:46 -07:00
match.py cleanup: use set literals 2017-02-10 16:56:29 -08:00
mdiff.py mdiff: add a hunkinrange helper function 2017-04-01 12:24:59 +02:00
merge.py merge: use repo.wvfs.setflags() instead of util.setflags() 2017-05-11 18:38:43 -07:00
mergeutil.py checkunresolved: move to new package to help avoid import cycles 2016-11-21 21:31:45 -05:00
minirst.py help: search section of help topic by translated section name correctly 2016-05-13 07:19:59 +09:00
mpatch_module.c mpatch: raise MemoryError instead of mpatchError if lalloc() failed 2016-08-07 10:06:56 +09:00
mpatch.c internals: move the bitmanipulation routines into its own file 2016-06-06 13:08:13 +02:00
mpatch.h mpatch: raise MemoryError instead of mpatchError if lalloc() failed 2016-08-07 10:06:56 +09:00
namespaces.py cleanup: use set literals 2017-02-10 16:56:29 -08:00
node.py cleanup: use set literals 2017-02-10 16:56:29 -08:00
obsolete.py obsolete: use 2 argument form of enumerate() 2017-05-13 11:42:42 -07:00
osutil.c osutil: use PyLongObject on Python 3 for listdir_slot 2016-10-09 13:47:46 +02:00
parser.py parser: preserve order of keyword arguments 2017-04-09 11:58:27 +09:00
parsers.c parsers: avoid PySliceObject cast on Python 3 2016-10-13 13:34:53 +02:00
patch.py record: update help message to use operation instead of "record" (issue5432) 2017-04-24 17:13:24 +02:00
pathencode.c pathencode: use assert() for PyBytes_Check() 2016-10-13 21:42:11 +02:00
pathutil.py util: rename checkcase() to fscasesensitive() (API) 2016-08-30 09:22:53 -07:00
peer.py py3: convert to next() function 2016-05-16 21:30:53 +00:00
phases.py phases: emit phases to pushkey protocol in deterministic order 2017-04-13 22:12:04 -07:00
policy.py policy: relax the default for in-place build 2017-04-26 23:02:43 +09:00
posix.py cleanup: use set literals 2017-02-10 16:56:29 -08:00
profiling.py py3: replace pycompat.getenv with encoding.environ.get 2017-01-15 13:17:05 +05:30
progress.py progress: retry ferr.flush() and .write() on EINTR (issue5532) 2017-04-13 22:31:17 +09:00
pushkey.py pushkey: use absolute_import 2015-08-08 19:57:27 -07:00
pvec.py base85: proxy through util module 2017-04-26 21:56:47 +09:00
pycompat.py pycompat: verify sys.argv exists before forwarding it (issue5493) 2017-03-07 13:24:24 -05:00
rcutil.py pager: use less as a fallback on Unix 2017-04-28 20:51:14 +09:00
registrar.py templater: add support for keyword arguments 2017-04-03 21:22:39 +09:00
repair.py repair: use rawvfs when copying extra store files 2017-04-08 11:36:39 -07:00
repoview.py cleanup: replace uses of util.(md5|sha1|sha256|sha512) with hashlib.\1 2016-06-10 00:12:33 -04:00
revlog.py flagprocessor: add a fast path when flags is 0 2017-05-10 16:17:58 -07:00
revset.py revset: add i18n comments to error messages for followlines predicate 2017-05-01 05:52:36 +09:00
revsetlang.py revsetlang: add a getboolean helper function 2017-04-15 11:26:09 +02:00
scmposix.py pager: use less as a fallback on Unix 2017-04-28 20:51:14 +09:00
scmutil.py scmutil: make simplekeyvaluefile able to have a non-key-value first line 2017-05-11 08:49:33 -07:00
scmwindows.py pager: use less as a fallback on Unix 2017-04-28 20:51:14 +09:00
server.py serve: add support for Mercurial subrepositories 2017-04-15 18:05:40 -04:00
setdiscovery.py cleanup: use set literals 2017-02-10 16:56:29 -08:00
similar.py similar: remove caching from the module level 2017-01-13 11:42:36 -08:00
simplemerge.py simplemerge: move conflict warning message to filemerge 2015-10-09 13:54:52 -07:00
smartset.py py3: use raw strings while accessing class.__dict__ 2017-04-28 01:13:07 +05:30
sshpeer.py sshpeer: try harder to snag stderr when stdout closes unexpectedly 2017-04-13 16:09:40 -04:00
sshserver.py wireproto: compress data from a generator 2016-10-16 11:10:21 -07:00
sslutil.py sslutil: tweak the legacy [hostfingerprints] warning message 2017-05-10 23:49:37 -07:00
statichttprepo.py manifest: make manifestlog a storecache 2016-10-18 17:33:39 -07:00
statprof.py cleanup: use set literals 2017-02-10 16:56:29 -08:00
store.py store: py26 compat, don't use a dict comprehension 2016-10-09 12:58:22 +02:00
streamclone.py clone: warn when streaming was requested but couldn't be performed 2017-05-08 20:01:06 -07:00
subrepo.py subrepo: move prompts out of the if (issue5505) 2017-03-20 04:36:55 -07:00
tagmerge.py tagmerge: use 'wvfs' instead of 'wfile' 2017-03-15 00:28:58 -07:00
tags.py track-tags: write all tag changes to a file 2017-03-28 10:15:02 +02:00
templatefilters.py templatefilters: fix crash by string formatting of '{x|splitlines}' 2017-04-15 10:51:17 +09:00
templatekw.py templatekw: factor out showdict() helper 2017-04-05 21:57:05 +09:00
templater.py templatekw: have showlist() take mapping dict with no **kwargs expansion (API) 2017-04-05 21:47:34 +09:00
transaction.py transaction: introduce "changes" dictionary to precisely track updates 2017-05-02 18:31:18 +02:00
treediscovery.py error: get Abort from 'error' instead of 'util' 2015-10-08 12:55:45 -07:00
txnutil.py txnutil: factor out the logic to read file in according to HG_PENDING 2017-02-21 01:20:59 +09:00
ui.py pager: drop the support for 'pager.enable=<bool>' 2017-05-02 17:18:13 +02:00
unionrepo.py revlog: add 'raw' argument to revision and _addrevision 2017-01-05 17:16:07 +00:00
upgrade.py upgrade: register all format variants in a list 2017-04-12 16:48:13 +02:00
url.py url: support auth.cookiesfile for adding cookies to HTTP requests 2017-03-09 22:40:52 -08:00
util.h parsers: move PyInt aliasing out of util.h 2016-10-09 13:50:53 +02:00
util.py py3: convert date and format arguments str before passing in time.strptime 2017-05-06 04:51:25 +05:30
verify.py verify: add a config option to skip certain flag processors 2017-05-14 09:38:06 -07:00
vfs.py osutil: proxy through util (and platform) modules (API) 2017-04-26 22:26:28 +09:00
win32.py py3: use pycompat.getcwd instead of os.getcwd 2016-12-22 01:54:17 +05:30
windows.py windows: add context manager support to mixedfilemodewrapper 2017-04-11 21:38:11 -04:00
wireproto.py clone: add a server-side option to disable full getbundles (pull-based clones) 2017-05-11 10:50:05 -07:00
worker.py worker: propagate exit code to main process 2017-04-15 13:27:44 +09:00