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 34074
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 34073
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 34072
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 34071
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 34070
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 34069
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 34068
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 34067
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 34066
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 34065
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 34064
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
Thu, 24 Aug 2017 18:00:23 -0700 phabricator: standardize colors
Jun Wu <quark@fb.com> [Thu, 24 Aug 2017 18:00:23 -0700] rev 34063
phabricator: standardize colors Previously, the `--confirm` text could have colors but the main `phabsend` does not. This patch adjusts the main command so it also has colors. A default color table was added so the colors are visible by default. Differential Revision: https://phab.mercurial-scm.org/D515
Fri, 01 Sep 2017 14:00:13 -0700 wireproto: do not abort after successful lookup
Kyle Lippincott <spectral@google.com> [Fri, 01 Sep 2017 14:00:13 -0700] rev 34062
wireproto: do not abort after successful lookup As far as I can tell, this interface originally used 'return' here, so the "fallthrough" to self._abort made sense. When it was switched to 'yield' this didn't make sense, but doesn't impact most uses because the 'plain' wrapper in peer.py's 'batchable' decorator only attempts to yield two items (args and value). When using iterbatch, however, it attempts to verify that the @batchable generators only emit 2 results, by expecting a StopIteration when attempting to access a third. Differential Revision: https://phab.mercurial-scm.org/D608
Fri, 01 Sep 2017 16:44:30 -0700 check-code: forbid "\S" in egrep regular expression
Jun Wu <quark@fb.com> [Fri, 01 Sep 2017 16:44:30 -0700] rev 34061
check-code: forbid "\S" in egrep regular expression BSD `egrep` does not like it. So let's forbid it. Differential Revision: https://phab.mercurial-scm.org/D610
Fri, 01 Sep 2017 15:47:32 -0700 check-code: forbid using bash in shebang
Jun Wu <quark@fb.com> [Fri, 01 Sep 2017 15:47:32 -0700] rev 34060
check-code: forbid using bash in shebang Some platforms (ex. FreeBSD) do not have `bash` by default. Therefore it should not be used in test scripts. Differential Revision: https://phab.mercurial-scm.org/D609
Fri, 01 Sep 2017 12:34:34 -0700 amend: add tests for amending only some files from commit to be amended
Saurabh Singh <singhsrb@fb.com> [Fri, 01 Sep 2017 12:34:34 -0700] rev 34059
amend: add tests for amending only some files from commit to be amended We do not have robust enough tests for scenarios where only some files in a changeset are amended. This presents an interesting scenario because the working copy could have modified versions of the remaining files in the pre-amend changeset. Therefore, I have added some tests to ensure that amend behaves as expected in these scenarios. Test Plan: Ensured that the test "test-commit-amend.t" passes. Differential Revision: https://phab.mercurial-scm.org/D596
Sat, 02 Sep 2017 21:49:45 +0900 test-editor-filename: fix portability of fake editor command
Yuya Nishihara <yuya@tcha.org> [Sat, 02 Sep 2017 21:49:45 +0900] rev 34058
test-editor-filename: fix portability of fake editor command - /bin/bash doesn't exist on FreeBSD - edit is executed by cmd.exe on Windows
Fri, 01 Sep 2017 12:34:36 -0700 amend: moving first assignment of newid closer to its use
Saurabh Singh <singhsrb@fb.com> [Fri, 01 Sep 2017 12:34:36 -0700] rev 34057
amend: moving first assignment of newid closer to its use newid was needlessly further away from where its intended to be used leading to bad readability. This commit moves it to address the same. The end goal is to remove the redundant commit in the amend code path and this commit takes care of cleaning up some unrelated code before that change. Test Plan: ran the test suite Differential Revision: https://phab.mercurial-scm.org/D597
Thu, 31 Aug 2017 18:35:39 -0700 amend: rectify comment
Saurabh Singh <singhsrb@fb.com> [Thu, 31 Aug 2017 18:35:39 -0700] rev 34056
amend: rectify comment Comment was ambiguous as there can be two parents of a changeset in mercurial. This commit fixes the comment to clarify that the first parent is being considered. Test Plan: ran the test suite Differential Revision: https://phab.mercurial-scm.org/D595
Fri, 01 Sep 2017 15:08:54 -0700 amend: removing redundant if condition
Saurabh Singh <singhsrb@fb.com> [Fri, 01 Sep 2017 15:08:54 -0700] rev 34055
amend: removing redundant if condition There is needless checking for the new commit hash not being equal to the old commit hash. This condition will always be true at this point in the code path and thus, can be removed safely. This commit removes the redundant condition. Test Plan: ran the test suite. Differential Revision: https://phab.mercurial-scm.org/D594
Fri, 01 Sep 2017 20:28:26 +0000 editor: file created for diff action should have .diff suffix
Michael Bolin <mbolin@fb.com> [Fri, 01 Sep 2017 20:28:26 +0000] rev 34054
editor: file created for diff action should have .diff suffix This is a follow-up to https://phab.mercurial-scm.org/D464 (6e6452bc441d) that introduced the new file extension behavior. It erroneously changed `.diff` to `.diff.hg.txt`. Test Plan: Verified `make tests` passes, particularly `test-editor-filename.t`. Differential Revision: https://phab.mercurial-scm.org/D607
Fri, 01 Sep 2017 11:13:55 -0700 test-amend: match output using conditional test case name
Jun Wu <quark@fb.com> [Fri, 01 Sep 2017 11:13:55 -0700] rev 34053
test-amend: match output using conditional test case name D466 (6cc8f848b4c3) allows output to be conditionally matched by test name. This patch changes test-amend.t to use that feature, instead of duplicating `hg amend` command or use `-q` to silence its output. Differential Revision: https://phab.mercurial-scm.org/D601
Thu, 31 Aug 2017 19:40:15 -0700 util: use set for reserved Windows filenames
Gregory Szorc <gregory.szorc@gmail.com> [Thu, 31 Aug 2017 19:40:15 -0700] rev 34052
util: use set for reserved Windows filenames Previously, we were performing membership testing against a list. Change it to a set for a minor perf win. While we're at it, explode the assignment in place so less work is needed at module import time. Differential Revision: https://phab.mercurial-scm.org/D600
Fri, 01 Sep 2017 11:52:20 -0700 context: add arbitraryfilectx, which can represent files outside the workdir
Phil Cohen <phillco@fb.com> [Fri, 01 Sep 2017 11:52:20 -0700] rev 34051
context: add arbitraryfilectx, which can represent files outside the workdir Move it from contrib/simplemerge so it can be re-used in the future. Differential Revision: https://phab.mercurial-scm.org/D604
(0) -30000 -10000 -3000 -1000 -300 -100 -50 -24 +24 +50 +100 +300 +1000 +3000 +10000 tip