Mon, 05 Oct 2015 16:28:12 -0700 util.chunkbuffer: special case reading everything
Gregory Szorc <gregory.szorc@gmail.com> [Mon, 05 Oct 2015 16:28:12 -0700] rev 26478
util.chunkbuffer: special case reading everything The new code results in simpler logic within the while loop. It is also faster since we avoid performing operations on the queue and buf collections. However, there shouldn't be any super hot loops for this since the whole point of chunkbuffer is to avoid reading large amounts of data at once. This does, however, make it easier to optimize chunkbuffer in a subsequent patch.
Mon, 05 Oct 2015 07:13:35 +0200 revert: add reference to backout
Mathias De Maré <mathias.demare@gmail.com> [Mon, 05 Oct 2015 07:13:35 +0200] rev 26477
revert: add reference to backout
Mon, 05 Oct 2015 07:11:48 +0200 backout: add reference to revert
Mathias De Maré <mathias.demare@gmail.com> [Mon, 05 Oct 2015 07:11:48 +0200] rev 26476
backout: add reference to revert
Fri, 25 Sep 2015 12:39:23 -0700 localrepo: allow wlock to be inherited
Siddharth Agarwal <sid0@fb.com> [Fri, 25 Sep 2015 12:39:23 -0700] rev 26475
localrepo: allow wlock to be inherited This is part of a series that will allow locks to be inherited by subprocesses in limited circumstances. When allowed, the parent process will pass down requisite information to the child process by way of this environment variable.
Sun, 04 Oct 2015 20:04:44 -0700 lock.release: don't call postrelease functions for inherited locks
Siddharth Agarwal <sid0@fb.com> [Sun, 04 Oct 2015 20:04:44 -0700] rev 26474
lock.release: don't call postrelease functions for inherited locks Review feedback from Pierre-Yves David. The postrelease functions typically assume the lock is not held at all.
Sun, 04 Oct 2015 20:02:50 -0700 lock: turn prepinherit/reacquire into a single context manager
Siddharth Agarwal <sid0@fb.com> [Sun, 04 Oct 2015 20:02:50 -0700] rev 26473
lock: turn prepinherit/reacquire into a single context manager Review feedback from Pierre-Yves David. This makes the overall code cleaner and less error-prone, and makes a previously explicitly checked error state impossible.
Sun, 04 Oct 2015 19:28:43 -0700 localrepo: add a note about parentenvvar
Siddharth Agarwal <sid0@fb.com> [Sun, 04 Oct 2015 19:28:43 -0700] rev 26472
localrepo: add a note about parentenvvar Review feedback from Pierre-Yves David.
Sun, 04 Oct 2015 12:11:44 -0700 exchange: add "streaming all changes" to bundle2 pulling
Gregory Szorc <gregory.szorc@gmail.com> [Sun, 04 Oct 2015 12:11:44 -0700] rev 26471
exchange: add "streaming all changes" to bundle2 pulling This is the beginning of client-side support for performing a stream clone using bundle2. The main bundle2 pull function checks whether to perform a streaming clone and outputs a message if so. While we have a duplicate message, it seems easier to have all the bundle2 console writing in one location and in an easy-to-read conditional block.
Sun, 04 Oct 2015 12:07:01 -0700 streamclone: move "streaming all changes" message location
Gregory Szorc <gregory.szorc@gmail.com> [Sun, 04 Oct 2015 12:07:01 -0700] rev 26470
streamclone: move "streaming all changes" message location Previously, the message was printed after we requested and started processing the remote stream. This seems like something that we should do before calling out to the remote. Moving it also makes it easier to deal with the bundle2 implementation.
Sun, 04 Oct 2015 19:06:06 -0700 streamclone: move payload header generation into own function
Gregory Szorc <gregory.szorc@gmail.com> [Sun, 04 Oct 2015 19:06:06 -0700] rev 26469
streamclone: move payload header generation into own function The stream clone data over the wire protocol contains a header line indicating total file count and data size. In bundle2, this metadata can be captured by a part parameter and doesn't need to be in the body. In preparation for bundle2, have generatev1() return the raw metadata and move the header generation to its own function.
Sun, 04 Oct 2015 18:44:46 -0700 streamclone: move payload header line consumption
Gregory Szorc <gregory.szorc@gmail.com> [Sun, 04 Oct 2015 18:44:46 -0700] rev 26468
streamclone: move payload header line consumption bundle2 parts have parameters. These are a logical place for "header" data such as the file count and payload size of stream clone data. In preparation for supporting stream clones with bundle2, move the consumption of the header line from the payload into maybeperformlegacystreamclone(). Note: the header line is still being emitted by generatev1(). This will be addressed in a subsequent patch.
Sun, 04 Oct 2015 18:35:19 -0700 streamclone: teach canperformstreamclone to be bundle2 aware
Gregory Szorc <gregory.szorc@gmail.com> [Sun, 04 Oct 2015 18:35:19 -0700] rev 26467
streamclone: teach canperformstreamclone to be bundle2 aware We add an argument to canperformstreamclone() to return False if a bundle2 stream clone is available. This will enable the legacy stream clone step to no-op when a bundle2 stream clone is supported. The commented code will be made active when bundle2 supports streaming clone. This patch does foreshadow the introduction of the "stream" bundle2 capability and its "v1" sub-capability. The bundle2 capability mirrors the existing "stream" capability and is needed so clients know whether a server explicitly supports streaming clones over bundle2 (servers up to this point support bundle2 without streaming clone support). The sub-capability will denote which data formats and variations are supported. Currently, the value "v1" denotes the existing streaming clone data format, which I intend to reuse inside a bundle2 part. My intent is to eventually introduce alternate data formats that can be produced and consumed more efficiently. Having a sub-capability means we don't need to introduce a new top-level bundle2 capability when new formats are introduced. This doesn't really have any implications beyond making the capabilities namespace more organized.
Sun, 04 Oct 2015 11:50:42 -0700 streamclone: refactor canperformstreamclone to accept a pullop
Gregory Szorc <gregory.szorc@gmail.com> [Sun, 04 Oct 2015 11:50:42 -0700] rev 26466
streamclone: refactor canperformstreamclone to accept a pullop This isn't strictly necessary. But a lot of pull functionality accepts a pulloperation so extra state can be added easily. It also enables extensions to perform more powerful things.
Sun, 04 Oct 2015 12:03:30 -0700 exchange: expose bundle2 availability on pulloperation
Gregory Szorc <gregory.szorc@gmail.com> [Sun, 04 Oct 2015 12:03:30 -0700] rev 26465
exchange: expose bundle2 availability on pulloperation Like the previous patch, the value is cached and will prevent a function level import in streamclone.py.
Sun, 04 Oct 2015 18:31:53 -0700 exchange: expose bundle2 capabilities on pulloperation
Gregory Szorc <gregory.szorc@gmail.com> [Sun, 04 Oct 2015 18:31:53 -0700] rev 26464
exchange: expose bundle2 capabilities on pulloperation This adds a cache and makes accessing the capabilities slightly simpler, as you don't need to directly go through the bundle2 module. This will also help prevent a function-level import in streamclone.py. This patch arguably isn't necessary. But I think it makes things slightly nicer.
Sun, 04 Oct 2015 21:33:29 +0900 keyword: make restrict mode False while updating files for rollback
FUJIWARA Katsunori <foozy@lares.dti.ne.jp> [Sun, 04 Oct 2015 21:33:29 +0900] rev 26463
keyword: make restrict mode False while updating files for rollback This is a preparation for using 'repo.rollback()' instead of aborting a current running transaction for "shelve" and "unshelve". Before this patch, updating files as a part of 'repo.rollback()' overridden by keyword extension always follows 'restrict' mode of the command currently executed. "merge", "unshelve" and so on should be 'restrict'-ed, because keyword expansion may cause unexpected conflicts at merging while these commands. But, if 'repo.rollback()' is invoked while executing 'restrict'-ed commands, modified files in the working directory are marked as "CLEAN" unexpectedly by code path below: # 'lookup' below is True at updating modified files for rollback kwcmd = self.restrict and lookup # kwexpand/kwshrink : if kwcmd: self.repo.dirstate.normal(f) On the other hand, "rollback" command isn't 'restrict'-ed, because rollbacking itself doesn't imply merging. Therefore, disabling 'restrict' mode while updating files as a part of 'repo.rollback()' regardless of current 'restrict' mode should be reasonable.
Sun, 04 Oct 2015 11:34:28 -0700 streamclone: rename and document maybeperformstreamclone()
Gregory Szorc <gregory.szorc@gmail.com> [Sun, 04 Oct 2015 11:34:28 -0700] rev 26462
streamclone: rename and document maybeperformstreamclone() Upcoming patches will introduce bundle2 based streaming clones. Add "legacy" to the function name and add a docstring clarifying the intent of the function.
Sun, 04 Oct 2015 11:27:10 -0700 streamclone: move applyremotedata() into maybeperformstreamclone()
Gregory Szorc <gregory.szorc@gmail.com> [Sun, 04 Oct 2015 11:27:10 -0700] rev 26461
streamclone: move applyremotedata() into maybeperformstreamclone() Future work around stream cloning will be implemented in a bundle2 world. This code will only be used in the legacy code path and doesn't need to be abstracted or extensible.
Sat, 03 Oct 2015 09:53:56 -0700 branchmap: move branch cache code out of streamclone.py
Gregory Szorc <gregory.szorc@gmail.com> [Sat, 03 Oct 2015 09:53:56 -0700] rev 26460
branchmap: move branch cache code out of streamclone.py This is low-level branch map and cache manipulation code. It deserves to live next to similar code in branchmap.py. Moving it also paves the road for multiple consumers, such as a bundle2 part handler that receives branch mappings from a remote. This is largely a mechanical move, with only variable names and indentation being changed.
Fri, 02 Oct 2015 23:08:15 -0700 streamclone: move streamin() into maybeperformstreamclone()
Gregory Szorc <gregory.szorc@gmail.com> [Fri, 02 Oct 2015 23:08:15 -0700] rev 26459
streamclone: move streamin() into maybeperformstreamclone() streamin() only had a single consumer. And it always only ever will because it is strongly coupled with the current, soon-to-be-superseded-by-bundle2 functionality. The return value has been dropped because nobody was using it.
Sun, 04 Oct 2015 11:20:52 -0700 streamclone: refactor maybeperformstreamclone to take a pullop
Gregory Szorc <gregory.szorc@gmail.com> [Sun, 04 Oct 2015 11:20:52 -0700] rev 26458
streamclone: refactor maybeperformstreamclone to take a pullop Just like all the other pull steps. Consistency is good. This seems a little excessive right now since maybeperformstreamclone is such a short function. This will be addressed in a subsequent patch.
Sun, 04 Oct 2015 11:17:43 -0700 demandimport: replace more references to _demandmod instances
Gregory Szorc <gregory.szorc@gmail.com> [Sun, 04 Oct 2015 11:17:43 -0700] rev 26457
demandimport: replace more references to _demandmod instances _demandmod instances may be referenced by multiple importing modules. Before this patch, the _demandmod instance only maintained a reference to its first consumer when using the "from X import Y" syntax. This is because we only created a single _demandmod instance (attached to the parent X module). If multiple modules A and B performed "from X import Y", we'd produce a single _demandmod instance "demandmod" with the following references: X.Y = <demandmod> A.Y = <demandmod> B.Y = <demandmod> The locals from the first consumer (A) would be stored in <demandmod1>. When <demandmod1> was loaded, we'd look at the locals for the first consumer and replace the symbol, if necessary. This resulted in state: X.Y = <module> A.Y = <module> B.Y = <demandmod> B's reference to Y wasn't updated and was still using the proxy object because we just didn't record that B had a reference to <demandmod> that needed updating! With this patch, we add support for tracking which modules in addition to the initial importer have a reference to the _demandmod instance and we replace those references at module load time. In the case of posix.py, this fixes an issue where the "encoding" module was being proxied, resulting in hundreds of thousands of __getattribute__ lookups on the _demandmod instance during dirstate operations on mozilla-central, speeding up execution by many milliseconds. There are likely several other operation that benefit from this change as well. The new mechanism isn't perfect: references in locals (not globals) may likely linger. So, if there is an import inside a function and a symbol from that module is used in a hot loop, we could have unwanted overhead from proxying through _demandmod. Non-global imports are discouraged anyway. So hopefully this isn't a big deal in practice. We could potentially deploy a code checker that bans use of attribute lookups of function-level-imported modules inside loops. This deficiency in theory could be avoided by storing the set of globals and locals dicts to update in the _demandmod instance. However, I tried this and it didn't work. One reason is that some globals are _demandmod instances. We could work around this, but it's a bit more work. There also might be other module import foo at play. The solution as implemented is better than what we had and IMO is good enough for the time being. It's worth noting that this sub-optimal behavior was made worse by the introduction of absolute_import and its recommended "from . import X" syntax for importing modules from the "mercurial" package. If we ever wrote performance tests, measuring the amount of module imports and __getattribute__ proxy calls through _demandmod instances would be something I'd have it check.
Sun, 04 Oct 2015 10:36:54 -0700 demandimport: refactor processfromitem
Gregory Szorc <gregory.szorc@gmail.com> [Sun, 04 Oct 2015 10:36:54 -0700] rev 26456
demandimport: refactor processfromitem This will match the next patch smaller and easier to read.
Sat, 03 Oct 2015 15:30:17 -0700 demandimport: consolidate code for processing items in fromlist
Gregory Szorc <gregory.szorc@gmail.com> [Sat, 03 Oct 2015 15:30:17 -0700] rev 26455
demandimport: consolidate code for processing items in fromlist This code was mostly duplicated. An upcoming patch will add more complexity, making the duplication harder to justify. Consolidate the code.
Sat, 03 Oct 2015 15:16:33 +0900 pager: recreate stdout to make it line-buffered
Yuya Nishihara <yuya@tcha.org> [Sat, 03 Oct 2015 15:16:33 +0900] rev 26454
pager: recreate stdout to make it line-buffered We want to see partial command results as soon as possible. But the buffering mode of stdout (= pager's stdin) was set to fully-buffered because it isn't associated with a tty. So, this patch recreates new stdout object to force its buffering mode. Because two file objects are associated with the same stdout fd and their destructors will call close(), one of them must be closed carefully. Python expects that the stdout fd never be closed even after sys.stdout.close() [1], but newstdout has no such hack. So this patch calls newstdout.close() immediately before duplicating the original stdout fd to sys.stdout. operation sys.stdout newstdout fd --------------------- ---------- --------- -------- newstdout.close() open closed closed os.dup2(stdoutfd, ..) open closed open del sys.stdout closed closed open [1] [1]: https://hg.python.org/cpython/file/v2.7.10/Python/sysmodule.c#l1391
Sat, 03 Oct 2015 18:48:21 +0900 pager: rename variables of backup fds
Yuya Nishihara <yuya@tcha.org> [Sat, 03 Oct 2015 18:48:21 +0900] rev 26453
pager: rename variables of backup fds The next patch will add backup file objects, so the original variable names would be confusing.
Sat, 03 Oct 2015 15:02:52 +0900 pager: inline _pagersubprocess() into _runpager()
Yuya Nishihara <yuya@tcha.org> [Sat, 03 Oct 2015 15:02:52 +0900] rev 26452
pager: inline _pagersubprocess() into _runpager() We don't need _pagersubprocess() because the fork version was removed at 59d794154e8d.
Sat, 03 Oct 2015 23:10:40 +0900 ui: send traceback of devel warning to appropriate output stream
Yuya Nishihara <yuya@tcha.org> [Sat, 03 Oct 2015 23:10:40 +0900] rev 26451
ui: send traceback of devel warning to appropriate output stream If ui.ferr is a command-server channel, traceback should be written to it.
Sat, 03 Oct 2015 14:57:24 +0900 util.system: compare fileno to see if it needs stdout redirection
Yuya Nishihara <yuya@tcha.org> [Sat, 03 Oct 2015 14:57:24 +0900] rev 26450
util.system: compare fileno to see if it needs stdout redirection Future patches will reopen stdout to be line-buffered, so sys.stdout may be different object than sys.__stdout__.
Fri, 02 Oct 2015 23:04:52 -0700 exchange: move stream clone logic into pull code path
Gregory Szorc <gregory.szorc@gmail.com> [Fri, 02 Oct 2015 23:04:52 -0700] rev 26449
exchange: move stream clone logic into pull code path Stream clones are a special case of clones. Clones are a special case of pull. Most of the logic for deciding what to do at pull time is in exchange.py. It makes sense for the stream clone determination to live there as well. This patch moves the calling of the stream clone code into pull(). The checks in streamclone.canperformstreamclone() ensure that we don't perform a stream clone unless it is possible. A future patch will convert maybeperformstreamclone() to accept a pullop to make it consistent with everything else in pull(). It will also grow some functionality (in case you doubted the necessity of a 4 line function).
(0) -10000 -3000 -1000 -300 -100 -50 -30 +30 +50 +100 +300 +1000 +3000 +10000 tip