Commit Graph

1999 Commits

Author SHA1 Message Date
Augie Fackler
1bdc1915c7 python3: another 3 tests whitelisted 2017-09-16 11:33:16 -04:00
Martin von Zweigbergk
78fb62643c 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
2017-09-06 08:22:54 -07:00
Jun Wu
8909822786 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
2017-09-01 12:13:17 -07:00
Jun Wu
70db4ce38e 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
2017-08-24 18:00:23 -07:00
Jun Wu
ada59ccd75 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
2017-09-01 16:44:30 -07:00
Jun Wu
e4fdb2e534 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
2017-09-01 15:47:32 -07:00
Phil Cohen
28052d0586 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
2017-09-01 11:52:20 -07:00
Phil Cohen
62cb8c7754 simplemerge: remove unused filtereddata parameter
Differential Revision: https://phab.mercurial-scm.org/D603
2017-09-01 10:35:43 -07:00
Jun Wu
56e365cc2f import-checker: allow relative import a module being checked
This would make the checker more friendly for 3rd-party code. For example,

In remotefilelog/x.py, it may have:

    from . import shallowutils

That could trigger "relative import of stdlib module" if
"remotefilelog" was installed in the system. If the module being checked
conflicts with the system module, it makes sense to not treat that module as
system module. This patch makes it so.

Differential Revision: https://phab.mercurial-scm.org/D552
2017-08-28 13:43:25 -07:00
Augie Fackler
e45ed2be45 python3: whitelist another 5 passing tests found with the ratchet script 2017-08-22 20:25:08 -04:00
Augie Fackler
48dbe73629 python3: replace sorted(<dict>.iterkeys()) with sorted(<dict>) 2017-08-22 20:06:58 -04:00
Augie Fackler
169f5af21b contrib: add test-check-module-imports.t to the Python 3 whitelist
This has the benefit of also catching most (if not all!) old-style
print statements and except statements.
2017-08-22 17:16:13 -04:00
Jun Wu
e80bc134f5 phabsend: show associated Differential Revisions with --confirm
Often people running `phabsend --confirm` just want to check whether a
commit will trigger a creation of new Differential Revision, or update an
existing one. This patch implements that. The `--confirm` message was
changed to use node instead of revision number to be consistent with what
`phabsend` outputs.

An example output looks like:

  D487 - a80f447973a0 test-extension: enable demandimport explicitly
  D494 - cf440ea6e47e test-casecollision-merge: fix the test
  NEW - 0a6b97147128 phabsend: polish the docstring a bit
  Send the above changes to https://phab.mercurial-scm.org/ (yn)?

Differential Revision: https://phab.mercurial-scm.org/D514
2017-08-24 17:44:08 -07:00
Jun Wu
6ce8fb7684 phabsend: print the actual URL with --confirm
Sometimes people have multiple Phabricator endpoints set in multiple repos.
It seems better for `--confirm` to prompt about the Phabricator endpoint
patches being sent to.

Differential Revision: https://phab.mercurial-scm.org/D513
2017-08-24 17:31:33 -07:00
Jun Wu
edfba89554 phabsend: detect patch change with larger context
Previously phabsend has an optimization that will skip uploading a diff if
the patch (with context line number = 1) remains unchanged. That could be
confusing:

  Aug 24 15:52:28 <martinvonz> phillco: something is wrong with phabricator'your patches/
  Aug 24 15:52:45 <martinvonz> ... with phabricator's view of your patches again
  Aug 24 15:53:38 <martinvonz> if i phabread D388 and then D399, i get a version of filemerge.py with "a, b, c" somewhere on line 344, which is not what phabricator shows for D399
  Aug 24 15:53:51 <martinvonz> junw: maybe that's more for you ^

Fix that by checking context with 32767 lines, which is the same as what
will be actually sent.

Differential Revision: https://phab.mercurial-scm.org/D512
2017-08-24 17:25:18 -07:00
Jun Wu
3969533711 phabsend: make --amend the default
The local tag feature was intended to make `phabsend` closer to `email`
workflow. But its experience is not great in multiple ways:

  - after rebase, obsoleted changesets are still visible because of tags
  - without obsstore, the association information will get lost
  - even with obsstore, things could go wrong with graft, export+import
  - no easy way to tell which Differential Revision a commit is associated

Therefore make `--amend` the default. People wanting the old behavior can
use `--no-amend`.

Differential Revision: https://phab.mercurial-scm.org/D511
2017-08-24 16:52:28 -07:00
Jun Wu
e2464e037c phabsend: polish the docstring a bit
Differential Revision: https://phab.mercurial-scm.org/D510
2017-08-24 17:26:10 -07:00
Yuya Nishihara
a22ffac20b encoding: add function to test if a str consists of ASCII characters
Most strings are ASCII. Let's optimize for it.

Using uint64_t is slightly faster than uint32_t on 64bit system, but there
isn't huge difference.
2017-04-23 12:59:42 +09:00
Augie Fackler
8db7f3946c contrib: make import-checker agree more with run-tests about heredocpy
run-tests.py and import-checker.py take wholly different approaches to
.t-tests, and the result was that they had different notions about
when a Python heredoc had ended, leading to conflicts. This resolves
part of the issue, and the rest I can deal with by tweaking the one
offending test file.
2017-08-22 16:37:06 -04:00
Augie Fackler
32bec6bdb1 contrib: add bzrlib to list of packages from which we import symbols
Helps some tests pass the import checker.
2017-08-22 15:28:54 -04:00
Augie Fackler
aad2b05113 contrib: allow symbol imports from hgclient for tests 2017-08-22 14:25:06 -04:00
Phil Cohen
8c03c90982 simplemerge: stop accepting, and passing, file parameters
Differential Revision: https://phab.mercurial-scm.org/D381
2017-08-24 21:30:51 -07:00
Phil Cohen
cf2a7b8d40 contrib: make simplemerge script pass context-like objects
`simplemerge()` will soon require context-like objects to work. Create a simple
context-like object that wraps the requested files and can be passed to the new
API.

Differential Revision: https://phab.mercurial-scm.org/D378
2017-08-24 21:30:37 -07:00
Augie Fackler
e5f807b019 contrib: always treat importlib.* as stdlib 2017-08-22 16:02:57 -04:00
Augie Fackler
455b926bc2 simplemerge: update to conform with modern import conventions 2017-08-22 14:13:13 -04:00
Augie Fackler
77ae4c9284 contrib: inform import checker that __builtin__ is a thing 2017-08-22 14:12:37 -04:00
Augie Fackler
ec8689fc6d contrib: allow importing "symbols" from mercurial 2017-08-22 14:12:21 -04:00
Augie Fackler
edacb19438 hgperf: update to conform with import style checks 2017-08-22 14:12:03 -04:00
Augie Fackler
3990642074 contrib: update hg-ssh to conform with import style checks 2017-08-22 14:11:48 -04:00
Augie Fackler
ed0ae6fd2e contrib: have import-checker work mostly with native strings for mod names
Module names are a bit awkward to deal with portably otherwise.
2017-08-22 12:59:21 -04:00
Augie Fackler
bfabad4e98 python3: whitelist test-imports-checker.t, which now passes 2017-08-22 11:00:46 -04:00
Augie Fackler
f7c4bd058e contrib: make import checker always think in terms of bytes
The doctests now do some regrettable things, but they'll always work
since we're dealing with ASCII module names etc.
2017-08-22 12:58:28 -04:00
Augie Fackler
4ece1bb8b2 contrib: work around some modules not existing on Py3 in import checker 2017-08-22 10:58:29 -04:00
Augie Fackler
4927f52889 undumprevlog: update to valid Python 3 syntax
I didn't do anything to ensure correctness here, just enough to avoid
tracebacks in the import checker, which uses the native ast module to
try and parse all our Python files.
2017-08-22 12:58:51 -04:00
Augie Fackler
837cc32717 python3: whitelist another *13* tests that now pass
Differential Revision: https://phab.mercurial-scm.org/D302
2017-07-27 00:00:15 -04:00
Augie Fackler
ac44b37ecd python3: whitelist four more passing tests
Differential Revision: https://phab.mercurial-scm.org/D298
2017-07-26 23:33:26 -04:00
Jun Wu
88987c3640 phabricator: add phabupdate command to update status in batch
Changing status (accept, etc) on the webpage is not very convenient -
currently there is no way to accept (or abandon etc.) a stack using a single
click or command.

This patch adds a `phabupdate` command that could be used to change status
in batch. It also supports `--comment` which will write a comment on the
last revision, which is similar to what we do using emails.

Differential Revision: https://phab.mercurial-scm.org/D127
2017-07-18 02:05:19 -07:00
Jun Wu
2891bb4274 phabricator: add status to revision query language
This patch adds status words (ex. `abandoned`, `accepted`, `needsreview`,
`needsrevision`, `closed`) to the revision query language so people can
select revision in a more flexible way.

Test Plan:
Try something like `phabread ':2 & accepted'`, `phabread ':105 - closed` and
make sure they have desired outputs.

Differential Revision: https://phab.mercurial-scm.org/D126
2017-07-18 01:34:55 -07:00
Jun Wu
99c3ae0727 phabricator: add a small language to query Differential Revisions
Previously, `phabread` can only be used to read a single patch, or a single
stack of patches. In the future, we want to have more complex queries like
filtering with status (open, accepted, closed, etc), or maybe more complex
like filtering by reviewers etc. The command line flag approach won't scale
with that.

Besides, we might want to have other commands to update Differential
Revision status in batch, like accepting a stack using a single command.

Therefore, this patch adds a small language. It has basic set operations:
`&`, `+`, `-` and an ancestor operator to support `--stack`.

Test Plan:
Try querying this Phabricator instance:

  hg phabread 1+2 # 1, 2
  hg phabread D2+D1 # 2, 1
  hg phabread ':118-115+:2-1' # 114, 116, 117, 118, 2
  hg phabread '((:118-(D115+117)))&:117' # 114, 116
  hg phabread ':2&:117' --debug # differential.query is called only once

Make sure the output is expected and prefetch works.

Differential Revision: https://phab.mercurial-scm.org/D125
2017-07-17 23:19:11 -07:00
Jun Wu
3cee5f17d5 phabricator: change "readpatch" to be more flexible
Previously, `readpatch` and `querydrev` take a same `params` and `stack`
parameters. This patch changes `readpatch` so it takes the output of
`querydrev`, not the input of `querydrev`. This makes the code more
flexible and cleaner.

Differential Revision: https://phab.mercurial-scm.org/D124
2017-07-17 23:14:06 -07:00
Jun Wu
d1076977f0 phabricator: add --amend option to phabsend
Previously `hg phabsend` was imitating `hg email` and won't mutate
changesets. That works fine with reviewer-push workflow, reviewers run
`phabread`, `import`.

However, it does not work well with author-push workflow. Namely, the author
needs to run extra commands to get the right commit message, and remove the
local tag after push.

This patch solves those issues by adding the `--amend` option, so local
changesets will have the right commit message, and tags become unnecessary.

Test Plan:
Given the following DAG:

  o  17
  o  16
  | o  15
  | @  14
  |/
  o  13
  o  12

Run `hg phabsend '(13::)-17'  --amend`, check the new DAG looks like:


  o  21
  | o  20
  | @  19
  |/
  o  18
  | o  17
  | x  16
  | x  13
  |/
  o  12

And commit messages are updated to contain the `Differential Revision` lines.
Use `phabread` to make sure Phabricator has the amended node recorded.

Also check `phabsend .` followed by a `phabsend . --amend`, the commit
message will be updated and the tag will be removed.

Differential Revision: https://phab.mercurial-scm.org/D122
2017-08-04 12:39:29 -07:00
Jun Wu
618efa1b1e phabricator: remove an unnecessary writediffproperties call
This was introduced by D229. Thanks Yuya for finding it!

Differential Revision: https://phab.mercurial-scm.org/D366
2017-08-12 21:40:48 -07:00
Augie Fackler
9a0febea27 merge with stable 2017-08-10 14:23:41 -04:00
Mathias De Maré
cafe7e372c chg: define _GNU_SOURCE to allow CentOS 5 compilation
Without this flag, compilation fails with:
 hgclient.c: In function 'hgc_open':
 hgclient.c:466: error: 'O_DIRECTORY' undeclared (first use in this function)
 hgclient.c:466: error: (Each undeclared identifier is reported only once
 hgclient.c:466: error: for each function it appears in.)

Differential Revision: https://phab.mercurial-scm.org/D260
2017-08-07 13:40:36 +02:00
Mathias De Maré
744ba88ca3 centos5: use vault urls
CentOS 5 has reached end-of-life. A working build for it is still
possible using 'vault.centos.org'.

Differential Revision: https://phab.mercurial-scm.org/D261
2017-08-07 13:38:25 +02:00
Boris Feld
d88d8d1c9e obsutil: rename allprecursors into allpredecessors
Use util.nouideprecwarn because obsstore doesn't have easy access to an ui
object.

The renaming is done according to
https://www.mercurial-scm.org/wiki/CEDVocabulary.

Differential Revision: https://phab.mercurial-scm.org/D247
2017-08-02 19:49:57 +02:00
Jun Wu
51be9cd3a9 phabricator: convert unicode to binary when writing patches
This is a quick fix to make `hg phabread D189` work.

It seems we might want to replace all `r''` to `u''`, and add more
`encoding.*to*` to be more explicit when interacting with `json` module.

Differential Revision: https://phab.mercurial-scm.org/D192
2017-07-27 12:03:01 -07:00
Mathias De Maré
1ebe02c078 docker: pass proxy arguments to docker process
Building in Docker when behind a proxy requires passing the proxy variables.

Differential Revision: https://phab.mercurial-scm.org/D190
2017-07-27 13:44:15 +02:00
Mathias De Maré
30343f1379 makefile: build on CentOS 6 with a Python 2.7
Differential Revision: https://phab.mercurial-scm.org/D189
2017-07-27 14:15:26 +02:00
Augie Fackler
437f1cb3c5 osx: new script for generating OS X package versions
If you're shipping prerelease or rc packages using Munki, you'll
eventually discover that Munki's version comparison logic is not as
good as pip's. In theory we should be able to fix Munki, but it seems
entirely reasonable to produce version strings that sort reasonably
under these conditions. Since the requried logic not brief, add a new
script and some tests of that logic.

A followup change will wire this into the Makefile.
2017-07-24 20:38:09 -04:00