Wed, 06 Sep 2017 16:17:04 -0700 rebase: remove unnecessary '.unfiltered()' calls
Jun Wu <quark@fb.com> [Wed, 06 Sep 2017 16:17:04 -0700] rev 34110
rebase: remove unnecessary '.unfiltered()' calls Now we have a clear centric place to control whether `rbsrt.repo` is unfiltered or not, we can drop `unfiltered()` in other places. Differential Revision: https://phab.mercurial-scm.org/D645
Wed, 06 Sep 2017 16:13:04 -0700 rebase: remove complex unhiding code
Jun Wu <quark@fb.com> [Wed, 06 Sep 2017 16:13:04 -0700] rev 34109
rebase: remove complex unhiding code This is similar to Martin von Zweigbergk's previous patch [1]. Previous patches are adding more `.unfiltered()` to the rebase code. So I wonder: are we playing whack-a-mole regarding on `unfiltered()` in rebase? Thinking about it, I believe most of the rebase code *should* just use an unfiltered repo. The only exception is before we figuring out a `rebasestate`. This patch makes it so. See added comment in code for why that's more reasonable. This would make the code base cleaner (not mangling the `repo` object), faster (no need to invalidate caches), simpler (less LOC), less error-prone (no need to think about what to unhide, ex. should we unhide wdir p2? how about destinations?), and future proof (other code may change visibility in an unexpected way, ex. directaccess may make the destination only visible when it's in "--dest" revset tree). [1]: https://www.mercurial-scm.org/pipermail/mercurial-devel/2017-March/094277.html Differential Revision: https://phab.mercurial-scm.org/D644
Wed, 06 Sep 2017 15:23:19 -0700 rebase: use unfiltered repo when loading state
Jun Wu <quark@fb.com> [Wed, 06 Sep 2017 15:23:19 -0700] rev 34108
rebase: use unfiltered repo when loading state Before this patch, `rebase --abort` may fail to do the cleanup: $ hg rebase --abort rebase aborted (no revision is removed, only broken state is cleared) The added test case makes sure `--abort` works in this case. Differential Revision: https://phab.mercurial-scm.org/D643
Wed, 06 Sep 2017 12:40:00 -0700 rebase: do not crash rebasing merge with a parent having hidden successor
Jun Wu <quark@fb.com> [Wed, 06 Sep 2017 12:40:00 -0700] rev 34107
rebase: do not crash rebasing merge with a parent having hidden successor The added test will crash with previous code. Differential Revision: https://phab.mercurial-scm.org/D640
Wed, 06 Sep 2017 18:33:55 -0700 changegroup: fix to allow empty manifest parts
Durham Goode <durham@fb.com> [Wed, 06 Sep 2017 18:33:55 -0700] rev 34106
changegroup: fix to allow empty manifest parts The current chunk reading algorithm relied on counting the number of empty chunks and comparing it to the number of chunk lists it expected (1 list of files for cg1 and cg2, and 1 list of files + 1 list of trees for cg3). This implicitly assumed that both the changelog part and the manifestlog part were never empty (since them being empty would cause it to count it as one list being done, and screw up the count). In our treemanifest code, the manifest section could be empty, so we need to handle that case. This patches refactors that code to be more explicit about how it counts the expected parts. Differential Revision: https://phab.mercurial-scm.org/D646
Tue, 05 Sep 2017 15:18:45 -0700 wrapcommand: use functools.partial
Jun Wu <quark@fb.com> [Tue, 05 Sep 2017 15:18:45 -0700] rev 34105
wrapcommand: use functools.partial Like the previous patch, this helps remove noises in traceback. Practically, this removes another 6 lines in `rebase -s . -d .` traceback in my setup: .... File "hg/mercurial/util.py", line 1118, in check return func(*args, **kwargs) -File "hg/mercurial/extensions.py", line 331, in closure - return func(*(args + a), **kw) File "hg/mercurial/util.py", line 1118, in check return func(*args, **kwargs) File "fb-hgext/hgext3rd/fbhistedit.py", line 283, in _rebase return orig(ui, repo, **opts) File "hg/mercurial/util.py", line 1118, in check return func(*args, **kwargs) -File "hg/mercurial/extensions.py", line 331, in closure - return func(*(args + a), **kw) File "hg/mercurial/util.py", line 1118, in check return func(*args, **kwargs) File "remotenames.py", line 633, in exrebasecmd ret = orig(ui, repo, **opts) File "hg/mercurial/util.py", line 1118, in check return func(*args, **kwargs) -File "hg/mercurial/extensions.py", line 331, in closure - return func(*(args + a), **kw) File "hg/mercurial/util.py", line 1118, in check return func(*args, **kwargs) File "fb-hgext/hgext3rd/fbamend/__init__.py", line 453, in wraprebase return orig(ui, repo, **opts) File "hg/mercurial/util.py", line 1118, in check return func(*args, **kwargs) .... Differential Revision: https://phab.mercurial-scm.org/D633
Tue, 05 Sep 2017 13:37:36 -0700 wrapfunction: use functools.partial if possible
Jun Wu <quark@fb.com> [Tue, 05 Sep 2017 13:37:36 -0700] rev 34104
wrapfunction: use functools.partial if possible Every `extensions.bind` call inserts a frame in traceback: ... in closure return func(*(args + a), **kw) which makes traceback noisy. The Python stdlib has a `functools.partial` which is backed by C code and does not pollute traceback. However it does not support instancemethod and sets `args` attribute which could be problematic for alias handling. This patch makes `wrapfunction` use `functools.partial` if we are wrapping a function directly exported by a module (so it's impossible to be a class or instance method), and special handles `wrapfunction` results so alias handling code could handle `args` just fine. As an example, `hg rebase -s . -d . --traceback` got 6 lines removed in my setup: File "hg/mercurial/dispatch.py", line 898, in _dispatch cmdpats, cmdoptions) -File "hg/mercurial/extensions.py", line 333, in closure - return func(*(args + a), **kw) File "hg/hgext/journal.py", line 84, in runcommand return orig(lui, repo, cmd, fullargs, *args) -File "hg/mercurial/extensions.py", line 333, in closure - return func(*(args + a), **kw) File "fb-hgext/hgext3rd/fbamend/hiddenoverride.py", line 119, in runcommand result = orig(lui, repo, cmd, fullargs, *args) File "hg/mercurial/dispatch.py", line 660, in runcommand ret = _runcommand(ui, options, cmd, d) -File "hg/mercurial/extensions.py", line 333, in closure - return func(*(args + a), **kw) File "hg/hgext/pager.py", line 69, in pagecmd return orig(ui, options, cmd, cmdfunc) .... Differential Revision: https://phab.mercurial-scm.org/D632
Fri, 01 Sep 2017 12:34:36 -0700 cmdutil: remove redundant commitfunc parameter in amend (API)
Saurabh Singh <singhsrb@fb.com> [Fri, 01 Sep 2017 12:34:36 -0700] rev 34103
cmdutil: remove redundant commitfunc parameter in amend (API) Since the redundant commit during the amend has been been removed, there is no need for commit callback function in amend now. Therefore, this commit removes the unused parameter "commmitfunc" which was being used for this purpose. Test Plan: Ensured that all the tests pass Differential Revision: https://phab.mercurial-scm.org/D635
Fri, 01 Sep 2017 12:34:36 -0700 cmdutil: remove the redundant commit during amend
Saurabh Singh <singhsrb@fb.com> [Fri, 01 Sep 2017 12:34:36 -0700] rev 34102
cmdutil: remove the redundant commit during amend There was an extra commit made during the amend operation to track the changes to the working copy. However, this logic was written a long time back and newer API's make this extra commit redundant. Therefore, I am removing the extra commit. After this change, I noticed that - Execution time of the cmdutil.amend improved by over 40%. - Execution time of "hg commit --amend" improved by over 20%. Test Plan: I ensured that the all the hg tests passed after the change. I had to fix a few tests which were aware of the extra commit made during the amend. Differential Revision: https://phab.mercurial-scm.org/D636
Wed, 06 Sep 2017 12:56:19 -0700 checknlink: rename file object from 'fd' to 'fp'
Jun Wu <quark@fb.com> [Wed, 06 Sep 2017 12:56:19 -0700] rev 34101
checknlink: rename file object from 'fd' to 'fp' Make it clear that `fp` (`file` object) is different from `fd` (low-level file descriptor number). Differential Revision: https://phab.mercurial-scm.org/D642
Tue, 05 Sep 2017 15:06:45 -0700 cleanup: rename "matchfn" to "match" where obviously a matcher
Martin von Zweigbergk <martinvonz@google.com> [Tue, 05 Sep 2017 15:06:45 -0700] rev 34100
cleanup: rename "matchfn" to "match" where obviously a matcher We usually call matchers either "match" or "m" and reserve "matchfn" for functions. Differential Revision: https://phab.mercurial-scm.org/D641
Wed, 06 Sep 2017 08:22:54 -0700 check-code: fix incorrect capitalization in camelcase regex
Martin von Zweigbergk <martinvonz@google.com> [Wed, 06 Sep 2017 08:22:54 -0700] rev 34099
check-code: fix incorrect capitalization in camelcase regex This was found internally at Google as part of a monorepo-wide cleanup. Differential Revision: https://phab.mercurial-scm.org/D637
Wed, 06 Sep 2017 10:41:13 -0700 amend: use context manager for config override
Martin von Zweigbergk <martinvonz@google.com> [Wed, 06 Sep 2017 10:41:13 -0700] rev 34098
amend: use context manager for config override Differential Revision: https://phab.mercurial-scm.org/D639
Wed, 06 Sep 2017 10:42:02 -0700 amend: delete dead assignment to "newid"
Martin von Zweigbergk <martinvonz@google.com> [Wed, 06 Sep 2017 10:42:02 -0700] rev 34097
amend: delete dead assignment to "newid" Differential Revision: https://phab.mercurial-scm.org/D638
Fri, 01 Sep 2017 17:09:53 -0700 checknlink: use a random temp file name for checking
Jun Wu <quark@fb.com> [Fri, 01 Sep 2017 17:09:53 -0700] rev 34096
checknlink: use a random temp file name for checking Previously, if `.hg/store/00manifest.d.hgtmp1` exists, hg will copy the entire `00manifest.d` every time when appending new manifest revisions. That could happen if Mercurial or the machine crashed when `.hgtmp1` was just created but not deleted yet. This patch changes the fixed name to a random generated name. To be consistent with D468, `~` suffix was used. Differential Revision: https://phab.mercurial-scm.org/D611
Sun, 03 Sep 2017 02:34:01 +0530 copytrace: move the default copytracing algorithm in a new function
Pulkit Goyal <7895pulkit@gmail.com> [Sun, 03 Sep 2017 02:34:01 +0530] rev 34095
copytrace: move the default copytracing algorithm in a new function We are going to introduce a new fast heuristic based copytracing algorithm, so lets make mergecopies the function which decides which algorithm to go with and then calls the related function. While I was here, I add a line in test-copy-move-merge.t saying its a test related to the full copytracing algorithm. Differential Revision: https://phab.mercurial-scm.org/D622
Sun, 03 Sep 2017 01:52:19 +0530 copytrace: replace experimental.disablecopytrace config with copytrace (BC)
Pulkit Goyal <7895pulkit@gmail.com> [Sun, 03 Sep 2017 01:52:19 +0530] rev 34094
copytrace: replace experimental.disablecopytrace config with copytrace (BC) This patch replaces experimental.disablecopytrace with experimental.copytrace. Since the words does not means the same, the default value is also changed. Now experimental.copytrace defaults to 'on'. The new value is not boolean value as we will be now having two different algorithms (current one and heuristics one to be imported from fbext) so we need this to be have more options than booleans. The old config option is not kept is completely replaced as that was under experimental and we don't gurantee BC to experimental things. .. bc:: The config option for copytrace `experimental.disablecopytrace` is now replaced with `experimental.copytrace` which defaults to `on`. If you need to turn off copytracing, add `[experimental] copytrace = off` to your config. Differential Revision: https://phab.mercurial-scm.org/D621
Tue, 05 Sep 2017 12:04:02 -0700 filemerge: use fctx.write() in the internal:dump tool, instead of copy
Phil Cohen <phillco@fb.com> [Tue, 05 Sep 2017 12:04:02 -0700] rev 34093
filemerge: use fctx.write() in the internal:dump tool, instead of copy This is slower but allows this tool to work with the "deferred writes" milestone of in-memory merge. The performance hit is not too noticiable since this only used for the :dump merge tool during a conflict. Differential Revision: https://phab.mercurial-scm.org/D617
Thu, 31 Aug 2017 22:39:10 -0700 largefiles: remove unused assignments from wrapfunction()
Martin von Zweigbergk <martinvonz@google.com> [Thu, 31 Aug 2017 22:39:10 -0700] rev 34092
largefiles: remove unused assignments from wrapfunction() The return values from wrapfunction() were never used here. Using the value is also a little tricky and wrappedfunction() should be preferred, so let's just delete the assignments. There's also a bunch of return values from wrapcommand() being assigned to a variable here, but at least that value can be (and is used after some of the assignments). Differential Revision: https://phab.mercurial-scm.org/D618
Thu, 31 Aug 2017 18:24:08 +0300 branches: correctly show inactive multiheaded branches
the31k <the31k@thethirty.one> [Thu, 31 Aug 2017 18:24:08 +0300] rev 34091
branches: correctly show inactive multiheaded branches Issue being fixed here: `hg branches` incorrectly renders inactive multiheaded branches as active if they have closed heads. Example: ``` $ hg log --template '{rev}:{node|short} "{desc}" ({branch}) [parents: {parents}]\n' 4:2e2fa7af8357 "merge" (default) [parents: 0:c94e548c8c7d 3:7be622ae5832 ] 3:7be622ae5832 "2" (somebranch) [parents: 1:81c1d9458987 ] 2:be82cf30409c "close" (somebranch) [parents: ] 1:81c1d9458987 "1" (somebranch) [parents: ] 0:c94e548c8c7d "initial" (default) [parents: ] $ hg branches default 4:2e2fa7af8357 somebranch 3:7be622ae5832 ``` Branch `somebranch` have two heads, the 1st one being closed (rev 2) and the other one being merged into default (rev 3). This branch should be shown as inactive one. This happens because we intersect branch heads with repo heads to check branch activity. In this case intersection in a set with one node (rev 2). This head is closed but the branch is marked as active nevertheless. Fix is to check branch activity by intersecting only open heads set. Fixed output: ``` $ hg branches default 4:2e2fa7af8357 somebranch 3:7be622ae5832 (inactive) ``` Relevant tests for multihead branches added to test-branches suite. Implentation note about adding `iteropen` method: At first I have tried to modify `iterbranches` is such a way that it would filter out closed heads itself. For example it could have `closed=False` parameter. But in this case we would have to filter closed tips as well. Reasoning in terms of `hg branches` we actually are not allowed to do this. Also, we need to do heads filtering only if tip is not closed itself. But if it is - we are ok to skip filtering, because branch is already known to be inactive. So we can't implement heads filtering in `iterbranches` in elegant way, because we will end up with something like `closed_heads=False` or even `closed_heads_is_tip_is_open`. Finally I decided to move this logic to the `branches` function, adding `iteropen` helper method. Differential Revision: https://phab.mercurial-scm.org/D583
Sun, 03 Sep 2017 21:17:25 +0900 parser: stabilize output of prettyformat() by using byte-safe repr()
Yuya Nishihara <yuya@tcha.org> [Sun, 03 Sep 2017 21:17:25 +0900] rev 34090
parser: stabilize output of prettyformat() by using byte-safe repr() The format of leaf nodes is slightly changed so they look more similar to internal nodes.
Sun, 03 Sep 2017 17:51:23 +0900 py3: fix repr(util.url) to return system string
Yuya Nishihara <yuya@tcha.org> [Sun, 03 Sep 2017 17:51:23 +0900] rev 34089
py3: fix repr(util.url) to return system string This is required on Python 3.
Sun, 03 Sep 2017 17:37:17 +0900 py3: use bytes[n:n + 1] to get bytes in templater._parsetemplate()
Yuya Nishihara <yuya@tcha.org> [Sun, 03 Sep 2017 17:37:17 +0900] rev 34088
py3: use bytes[n:n + 1] to get bytes in templater._parsetemplate()
Sun, 03 Sep 2017 17:14:53 +0900 py3: fix type of attribute name in smartset.py
Yuya Nishihara <yuya@tcha.org> [Sun, 03 Sep 2017 17:14:53 +0900] rev 34087
py3: fix type of attribute name in smartset.py
Sun, 03 Sep 2017 17:03:23 +0900 py3: fix mixed bytes/unicode in revsetlang._aliassyminitletters
Yuya Nishihara <yuya@tcha.org> [Sun, 03 Sep 2017 17:03:23 +0900] rev 34086
py3: fix mixed bytes/unicode in revsetlang._aliassyminitletters
Sun, 03 Sep 2017 15:01:23 +0900 py3: fix type of regex literals in subrepo.py
Yuya Nishihara <yuya@tcha.org> [Sun, 03 Sep 2017 15:01:23 +0900] rev 34085
py3: fix type of regex literals in subrepo.py
Sun, 03 Sep 2017 16:19:20 +0900 py3: replace bytes[n] with bytes[n:n + 1] in patch.py where needed
Yuya Nishihara <yuya@tcha.org> [Sun, 03 Sep 2017 16:19:20 +0900] rev 34084
py3: replace bytes[n] with bytes[n:n + 1] in patch.py where needed
Sun, 03 Sep 2017 16:12:15 +0900 py3: fix type of regex literals in patch.py
Yuya Nishihara <yuya@tcha.org> [Sun, 03 Sep 2017 16:12:15 +0900] rev 34083
py3: fix type of regex literals in patch.py
Mon, 28 Aug 2017 14:49:00 -0700 revset: optimize "draft() & ::x" pattern
Jun Wu <quark@fb.com> [Mon, 28 Aug 2017 14:49:00 -0700] rev 34082
revset: optimize "draft() & ::x" pattern The `draft() & ::x` type query could be common for selecting one or more draft feature branches being worked on. Before this patch, `::x` may travel through the changelog DAG for a long distance until it gets a smaller revision number than `min(draft())`. It could be very slow on long changelog with distant (in terms of revision numbers) drafts. This patch adds a fast path for this situation, and will stop traveling the changelog DAG once `::x` hits a non-draft revision. The fast path also works for `secret()` and `not public()`. To measure the performance difference, I used drawdag to create a repo that emulates distant drafts: DRAFT4 | DRAFT3 # draft / PUBLIC9999 # public | PUBLIC9998 | . DRAFT2 . | . DRAFT1 # draft | / PUBLIC0001 # public And measured the performance using the repo: (BEFORE) $ hg perfrevset 'draft() & ::(DRAFT2+DRAFT4)' ! wall 0.017132 comb 0.010000 user 0.010000 sys 0.000000 (best of 156) $ hg perfrevset 'draft() & ::(all())' ! wall 0.024221 comb 0.030000 user 0.030000 sys 0.000000 (best of 113) (AFTER) $ hg perfrevset 'draft() & ::(DRAFT2+DRAFT4)' ! wall 0.000243 comb 0.000000 user 0.000000 sys 0.000000 (best of 9303) $ hg perfrevset 'draft() & ::(all())' ! wall 0.004319 comb 0.000000 user 0.000000 sys 0.000000 (best of 655) Differential Revision: https://phab.mercurial-scm.org/D441
Fri, 01 Sep 2017 12:13:17 -0700 phabricator: add a config to use curl for communication
Jun Wu <quark@fb.com> [Fri, 01 Sep 2017 12:13:17 -0700] rev 34081
phabricator: add a config to use curl for communication Not sure why, but I got `phabsend` hang on work network pretty frequently. The traceback indicates it hangs at `_sslobj.do_handshake()`: File "mercurial/sslutil.py", line 404, in wrapsocket sslsocket = sslcontext.wrap_socket(sock, server_hostname=serverhostname) File "/usr/lib/python2.7/ssl.py", line 363, in wrap_socket _context=self) File "/usr/lib/python2.7/ssl.py", line 611, in __init__ self.do_handshake() File "/usr/lib/python2.7/ssl.py", line 840, in do_handshake self._sslobj.do_handshake() I had tried adding `timeout` in various places but they seem not effective. It seems easier to just allow shelling out to `curl` with retry and timeout flags. This could also be helpful for people with an older Python installed without modern security (SNI). Differential Revision: https://phab.mercurial-scm.org/D605
(0) -30000 -10000 -3000 -1000 -300 -100 -50 -30 +30 +50 +100 +300 +1000 +3000 +10000 tip