Feed Advanced Search

Tue, Mar 19

Kwan added a comment to D6082: phabricator: add a `--branch` flag to `hg phabsend`.
In D6082#89656, @pulkit wrote:
In D6082#88981, @Kwan wrote:
In D6082#88851, @pulkit wrote:

@mharbison72 thanks for tips on adding test. Will add tests in next iteration.

I found that Differentials do have a branch field, maybe we can use that? https://secure.phabricator.com/source/phabricator/browse/master/src/applications/differential/customfield/DifferentialBranchField.php

Seems worth a shot. I don’t know anything about it, but presumably this would be rendered specially in the web UI, like the test plan, etc. That sounds better than as a follow up comment. It also seems natural enough that maybe it can be done unconditionally, instead of needing the argument.

Yeah, it shows in the Diff Detail pane, like here. Unfortunately I think it can be only set when using the creatediff endpoint, which is what I had to change my fork to do (though I could be wrong, the conduit docs are too sparse to be sure).

Last night I tried different endpoints and looks like creatediff is the only one which can be used to set the branch. I have asked on their discourse https://discourse.phabricator-community.org/t/conduit-api-to-set-branch-of-a-differential/2521.

Talking about creatediff, can it be used instead of createrawdiff? It it's possible can you paste the changes you did your fork, maybe we need the exact same changes.

Tue, Mar 19, 8:22 AM

Sat, Mar 16

Kwan closed D6114: py3: add test-phabricator.py to python3-whitelist.
Sat, Mar 16, 9:39 PM
Kwan committed rHG7c86caee3323: py3: add test-phabricator.py to python3-whitelist.
py3: add test-phabricator.py to python3-whitelist
Sat, Mar 16, 9:39 PM
Kwan committed rHG51ba9fbcca52: py3: use pycompat.byteskwargs on opts in phabricator.py.
py3: use pycompat.byteskwargs on opts in phabricator.py
Sat, Mar 16, 9:39 PM
Kwan closed D6113: py3: convert to/from bytes/unicode for json.(dump|load)s in debugcallconduit.
Sat, Mar 16, 9:39 PM
Kwan committed rHG99e00e5c4746: py3: convert to/from bytes/unicode for json.(dump|load)s in debugcallconduit.
py3: convert to/from bytes/unicode for json.(dump|load)s in debugcallconduit
Sat, Mar 16, 9:39 PM
Kwan closed D6107: py3: use pycompat.byteskwargs on opts in phabricator.py.
Sat, Mar 16, 9:39 PM
Kwan updated the diff for D6113: py3: convert to/from bytes/unicode for json.(dump|load)s in debugcallconduit.

Make compatible with Py3.5, separate comments about json functions so they are more readable.

Sat, Mar 16, 7:54 AM
Kwan updated the diff for D6107: py3: use pycompat.byteskwargs on opts in phabricator.py.

Switch to using pycompat.byteskwargs.

Sat, Mar 16, 7:52 AM

Fri, Mar 15

Kwan closed D6103: py3: use pycompat.iterbytestr to convert memoryview slice to bytestring before passing to itertools.takewhile.
Fri, Mar 15, 10:40 PM
Kwan committed rHGe7b84ffb06d9: py3: use pycompat.iterbytestr to convert memoryview slice to bytestring.
py3: use pycompat.iterbytestr to convert memoryview slice to bytestring
Fri, Mar 15, 10:40 PM

Thu, Mar 14

Kwan added a comment to D6103: py3: use pycompat.iterbytestr to convert memoryview slice to bytestring before passing to itertools.takewhile.
In D6103#88988, @yuja wrote:

Queued most of the patches in this series, thanks.

-        symbol = b''.join(itertools.takewhile(lambda ch: ch not in special,
-                                              view[pos:]))
+        symbol = b''.join(pycompat.iterbytestr(itertools.takewhile(
+            lambda ch: ch not in special,
+            view[pos:]

It's probably better to apply iterbytestr() to view[pos:] so ch is
always a byte string.

Thu, Mar 14, 11:41 AM
Kwan updated the diff for D6103: py3: use pycompat.iterbytestr to convert memoryview slice to bytestring before passing to itertools.takewhile.
Thu, Mar 14, 11:40 AM
Kwan added a comment to D6107: py3: use pycompat.byteskwargs on opts in phabricator.py.
In D6107#88990, @yuja wrote:

pycompat.byteskwargs() can be used instead.

Thu, Mar 14, 11:40 AM
Kwan added a comment to D6113: py3: convert to/from bytes/unicode for json.(dump|load)s in debugcallconduit.
In D6113#88992, @yuja wrote:
-    params = json.loads(ui.fin.read())
-    result = callconduit(repo, name, params)
-    s = json.dumps(result, sort_keys=True, indent=2, separators=(b',', b': '))
-    ui.write(b'%s\n' % s)
+    # json.(load|dump)s only returns/accepts unicode strings
+    params = pycompat.rapply(lambda x:
+        encoding.unitolocal(x) if isinstance(x, pycompat.unicode) else x,
+        json.loads(ui.fin.read())
+    )

Perhaps, the input data has to be converted to unicode. IIRC old Python 3
versions don't accept bytes.

Ah, yeah you're right, it only started accepting bytes in 3.6.

In D6113#88992, @yuja wrote:
+    result = pycompat.rapply(lambda x:
+        encoding.unifromlocal(x) if isinstance(x, bytes) else x,
+        callconduit(repo, name, params)
+    )
+    s = json.dumps(result, sort_keys=True, indent=2, separators=(u',', u': '))
+    ui.write(b'%s\n' % encoding.unitolocal(s))

Maybe we can use templatefilters.json() to dump internal (i.e. no unicode)
dict.

Ah, we can indeed (thanks for the pointer), with one caveat: the formatting.
The existing output is nicely formatted for human readability, with each entry on a new line and indented appropriately. templatefilters.json() isn't capable of that.
Do we mind losing that? It's also tested for in test-phabricator.t. Compare before:

{
  "cursor": {
    "after": null,
    "before": null,
    "limit": 100,
    "order": null
  },
  "data": [],
  "maps": {},
  "query": {
    "queryKey": null
  }
}

After:

{"cursor": {"after": null, "before": null, "limit": 100, "order": null}, "data": [], "maps": {}, "query": {"queryKey": null}}
Thu, Mar 14, 11:18 AM

Sat, Mar 9

Kwan committed rHG16d050678047: py3: use r'' for group name arguments to MatchObjects in phabricator.py.
py3: use r'' for group name arguments to MatchObjects in phabricator.py
Sat, Mar 9, 8:50 PM
Kwan committed rHG634b56b54e7c: py3: use %d instead of %s when formatting an int into a byte string.
py3: use %d instead of %s when formatting an int into a byte string
Sat, Mar 9, 8:50 PM
Kwan committed rHG2b21c7fbb3a1: py3: use % instead of .format() on a bytestring.
py3: use % instead of .format() on a bytestring
Sat, Mar 9, 8:50 PM
Kwan closed D6112: py3: use % instead of .format() on a bytestring.
Sat, Mar 9, 8:50 PM
Kwan closed D6110: py3: use %d instead of %s when formatting an int into a byte string.
Sat, Mar 9, 8:50 PM
Kwan closed D6111: py3: use r'' for group name arguments to MatchObjects in phabricator.py.
Sat, Mar 9, 8:50 PM
Kwan closed D6044: phabricator: convert conduit response JSON unicode to bytes inside callconduit.
Sat, Mar 9, 8:50 PM
Kwan committed rHG8fd19a7b4ed6: py3: only pass unicode to json.dumps in writediffproperties.
py3: only pass unicode to json.dumps in writediffproperties
Sat, Mar 9, 8:50 PM
Kwan committed rHGa98dabdb5a7b: py3: convert URL to str before passing it to request.
py3: convert URL to str before passing it to request
Sat, Mar 9, 8:50 PM
Kwan committed rHG59bae59b7498: py3: fix a few "dict keys as str instead of bytes" issues in phabricator.py.
py3: fix a few "dict keys as str instead of bytes" issues in phabricator.py
Sat, Mar 9, 8:50 PM
Kwan closed D6109: py3: only pass unicode to json.dumps in writediffproperties.
Sat, Mar 9, 8:50 PM
Kwan closed D6108: py3: fix a few "dict keys as str instead of bytes" issues in phabricator.py.
Sat, Mar 9, 8:50 PM
Kwan closed D6106: py3: convert URL to str before passing it to request.
Sat, Mar 9, 8:50 PM
Kwan closed D6105: py3: convert indexes into bytes when enumerating lists in urlencodenested.
Sat, Mar 9, 8:50 PM
Kwan closed D6104: py3: don't try and format a bare dict into a byte string in callconduit.
Sat, Mar 9, 8:50 PM
Kwan committed rHG47125193bad0: py3: convert indexes into bytes when enumerating lists in urlencodenested.
py3: convert indexes into bytes when enumerating lists in urlencodenested
Sat, Mar 9, 8:50 PM
Kwan committed rHG9a8c7c17d816: py3: don't try and format a bare dict into a byte string in callconduit.
py3: don't try and format a bare dict into a byte string in callconduit
Sat, Mar 9, 8:50 PM
Kwan closed D6102: py3: use fsencode for the vcr recording paths and strings for the custom_patches arguments.
Sat, Mar 9, 8:50 PM
Kwan committed rHG2bad8f92cebf: py3: use fsencode for vcr recording paths and strings for custom_patches args.
py3: use fsencode for vcr recording paths and strings for custom_patches args
Sat, Mar 9, 8:50 PM
Kwan committed rHGc340a8ac7ef3: phabricator: convert conduit response JSON unicode to bytes inside callconduit.
phabricator: convert conduit response JSON unicode to bytes inside callconduit
Sat, Mar 9, 8:50 PM
Kwan added a comment to D6082: phabricator: add a `--branch` flag to `hg phabsend`.
In D6082#88851, @pulkit wrote:

@mharbison72 thanks for tips on adding test. Will add tests in next iteration.

I found that Differentials do have a branch field, maybe we can use that? https://secure.phabricator.com/source/phabricator/browse/master/src/applications/differential/customfield/DifferentialBranchField.php

Seems worth a shot. I don’t know anything about it, but presumably this would be rendered specially in the web UI, like the test plan, etc. That sounds better than as a follow up comment. It also seems natural enough that maybe it can be done unconditionally, instead of needing the argument.

Sat, Mar 9, 11:48 AM

Fri, Mar 8

Kwan created D6114: py3: add test-phabricator.py to python3-whitelist.
Fri, Mar 8, 10:01 PM
Kwan created D6113: py3: convert to/from bytes/unicode for json.(dump|load)s in debugcallconduit.
Fri, Mar 8, 10:01 PM
Kwan added a dependent revision for D6113: py3: convert to/from bytes/unicode for json.(dump|load)s in debugcallconduit: D6114: py3: add test-phabricator.py to python3-whitelist.
Fri, Mar 8, 10:01 PM
Kwan added a dependent revision for D6112: py3: use % instead of .format() on a bytestring: D6113: py3: convert to/from bytes/unicode for json.(dump|load)s in debugcallconduit.
Fri, Mar 8, 10:01 PM
Kwan created D6112: py3: use % instead of .format() on a bytestring.
Fri, Mar 8, 10:01 PM
Kwan added a dependent revision for D6111: py3: use r'' for group name arguments to MatchObjects in phabricator.py: D6112: py3: use % instead of .format() on a bytestring.
Fri, Mar 8, 10:01 PM
Kwan created D6111: py3: use r'' for group name arguments to MatchObjects in phabricator.py.
Fri, Mar 8, 10:01 PM
Kwan created D6110: py3: use %d instead of %s when formatting an int into a byte string.
Fri, Mar 8, 10:01 PM
Kwan created D6109: py3: only pass unicode to json.dumps in writediffproperties.
Fri, Mar 8, 10:01 PM
Kwan added a dependent revision for D6109: py3: only pass unicode to json.dumps in writediffproperties: D6110: py3: use %d instead of %s when formatting an int into a byte string.
Fri, Mar 8, 10:01 PM
Kwan added a dependent revision for D6108: py3: fix a few "dict keys as str instead of bytes" issues in phabricator.py: D6109: py3: only pass unicode to json.dumps in writediffproperties.
Fri, Mar 8, 10:01 PM
Kwan created D6108: py3: fix a few "dict keys as str instead of bytes" issues in phabricator.py.
Fri, Mar 8, 10:01 PM
Kwan created D6107: py3: use pycompat.byteskwargs on opts in phabricator.py.
Fri, Mar 8, 10:01 PM
Kwan created D6106: py3: convert URL to str before passing it to request.
Fri, Mar 8, 10:01 PM
Kwan added a dependent revision for D6106: py3: convert URL to str before passing it to request: D6107: py3: use pycompat.byteskwargs on opts in phabricator.py.
Fri, Mar 8, 10:01 PM
Kwan created D6105: py3: convert indexes into bytes when enumerating lists in urlencodenested.
Fri, Mar 8, 10:01 PM
Kwan updated the diff for D6044: phabricator: convert conduit response JSON unicode to bytes inside callconduit.
Fri, Mar 8, 10:01 PM
Kwan created D6104: py3: don't try and format a bare dict into a byte string in callconduit.
Fri, Mar 8, 10:01 PM
Kwan added a dependent revision for D6105: py3: convert indexes into bytes when enumerating lists in urlencodenested: D6106: py3: convert URL to str before passing it to request.
Fri, Mar 8, 10:01 PM
Kwan added a dependent revision for D6104: py3: don't try and format a bare dict into a byte string in callconduit: D6105: py3: convert indexes into bytes when enumerating lists in urlencodenested.
Fri, Mar 8, 10:01 PM
Kwan added a dependent revision for D6103: py3: use pycompat.iterbytestr to convert memoryview slice to bytestring before passing to itertools.takewhile: D6104: py3: don't try and format a bare dict into a byte string in callconduit.
Fri, Mar 8, 10:00 PM
Kwan created D6103: py3: use pycompat.iterbytestr to convert memoryview slice to bytestring before passing to itertools.takewhile.
Fri, Mar 8, 10:00 PM
Kwan added a dependent revision for D6102: py3: use fsencode for the vcr recording paths and strings for the custom_patches arguments: D6103: py3: use pycompat.iterbytestr to convert memoryview slice to bytestring before passing to itertools.takewhile.
Fri, Mar 8, 10:00 PM
Kwan created D6102: py3: use fsencode for the vcr recording paths and strings for the custom_patches arguments.
Fri, Mar 8, 10:00 PM
Kwan added a dependent revision for D6044: phabricator: convert conduit response JSON unicode to bytes inside callconduit: D6102: py3: use fsencode for the vcr recording paths and strings for the custom_patches arguments.
Fri, Mar 8, 10:00 PM

Wed, Mar 6

Kwan removed a reviewer for D6075: [RFC] transplant: append log to commit message before running filter: hg-reviewers.
Wed, Mar 6, 8:08 AM
Kwan abandoned D6075: [RFC] transplant: append log to commit message before running filter.

Urgh, never mind, just realised I missed the existence of HGREVISION in the documentation.

Wed, Mar 6, 8:08 AM

Tue, Mar 5

Kwan created D6075: [RFC] transplant: append log to commit message before running filter.
Tue, Mar 5, 6:35 AM

Mon, Mar 4

Kwan added a comment to D6044: phabricator: convert conduit response JSON unicode to bytes inside callconduit.
In D6044#88262, @yuja wrote:
  • parsed = json.loads(body) + parsed = pycompat.rapply(lambda x: encoding.unitolocal(x) + if isinstance(x, unicode) else x, json.loads(body))

s/unicode/pycompat.unicode/

Thanks, done.

Perhaps some of r'' would have to be changed to b'' since dict keys
are now byte strings. See the wiki page for our Py3 hacks.

https://www.mercurial-scm.org/wiki/Python3

Mon, Mar 4, 12:12 PM

Sat, Mar 2

Kwan updated the diff for D6044: phabricator: convert conduit response JSON unicode to bytes inside callconduit.
Sat, Mar 2, 8:09 PM
Kwan updated the diff for D6044: phabricator: convert conduit response JSON unicode to bytes inside callconduit.
Sat, Mar 2, 7:25 PM
Kwan abandoned D6055: create beta for phabricator test.
Sat, Mar 2, 7:16 PM
Kwan removed a reviewer for D6055: create beta for phabricator test: hg-reviewers.
Sat, Mar 2, 7:16 PM
Kwan abandoned D6054: create alpha for phabricator test €.
Sat, Mar 2, 7:16 PM
Kwan removed a reviewer for D6054: create alpha for phabricator test €: hg-reviewers.
Sat, Mar 2, 7:16 PM
Kwan created D6055: create beta for phabricator test.
Sat, Mar 2, 7:12 PM
Kwan added a dependent revision for D6054: create alpha for phabricator test €: D6055: create beta for phabricator test.
Sat, Mar 2, 7:12 PM
Kwan updated the diff for D6054: create alpha for phabricator test €.
Sat, Mar 2, 7:12 PM
Kwan created D6054: create alpha for phabricator test €.
Sat, Mar 2, 7:12 PM
Kwan added a comment to D6044: phabricator: convert conduit response JSON unicode to bytes inside callconduit.

Okay, making progress on the test now, just need to figure out how to update the vcr files cleanly.
Slightly complicated by the fact that there was a small error in the original creation of the phabsend-update-alpha-create-beta.json recording. It must have been made after the updated diff for alpha was already on here, because it hasn't recorded the alpha update, since the query reported the diff to already be the updated version.

Sat, Mar 2, 6:08 PM
Kwan added a comment to D6044: phabricator: convert conduit response JSON unicode to bytes inside callconduit.

Apologies for the lack of a test, but I can't seem to write one that works. Either the test harness isn't capable of tests with unicode in them, or I don't know how to represent it in the test files in such a way that works.

Sat, Mar 2, 1:55 PM
Kwan created D6044: phabricator: convert conduit response JSON unicode to bytes inside callconduit.
Sat, Mar 2, 1:51 PM