Yuya Nishihara <yuya@tcha.org> [Sat, 01 Apr 2017 17:51:56 +0900] rev 35595
revsetlang: fix quoting of %ls string
Before, "'" wasn't escaped appropriately. This also changes the separator
'\0' to '\\0', but that's okay as a string token is unescaped.
Yuya Nishihara <yuya@tcha.org> [Sat, 01 Apr 2017 17:44:07 +0900] rev 35594
revsetlang: catch invalid value passed to formatspec()
The scope of AttributeError is narrowed because it's more likely to be
triggered by mistake.
Yuya Nishihara <yuya@tcha.org> [Sat, 01 Apr 2017 17:28:28 +0900] rev 35593
revsetlang: check incomplete revspec format character
Yuya Nishihara <yuya@tcha.org> [Sat, 01 Apr 2017 17:25:45 +0900] rev 35592
revsetlang: check number of arguments passed to formatspec()
Yuya Nishihara <yuya@tcha.org> [Sat, 01 Apr 2017 17:18:31 +0900] rev 35591
revsetlang: catch invalid format character with %l prefix
listexp() could call argtype() with an invalid format character, but that
wasn't checked before.
Pulkit Goyal <7895pulkit@gmail.com> [Fri, 29 Dec 2017 06:32:17 +0530] rev 35590
py3: add 8 new passing tests to the whitelist
Differential Revision: https://phab.mercurial-scm.org/D1800
Pulkit Goyal <7895pulkit@gmail.com> [Fri, 29 Dec 2017 05:33:36 +0530] rev 35589
py3: use list() to get a list of items using dict.items()
dict.items() on Python 3 returns a generator over the values of the dictionary,
hence we can't delete elements while iterating over dict.items() in Python 3.
Differential Revision: https://phab.mercurial-scm.org/D1799
Pulkit Goyal <7895pulkit@gmail.com> [Fri, 29 Dec 2017 05:31:27 +0530] rev 35588
py3: convert dict keys' to str before passing as kwargs
We have pycompat.strkwargs() which converts the keys of a dict to str and
returns that.
Differential Revision: https://phab.mercurial-scm.org/D1798
Pulkit Goyal <7895pulkit@gmail.com> [Fri, 29 Dec 2017 05:29:57 +0530] rev 35587
py3: make sure we open the file to write in bytes mode
Differential Revision: https://phab.mercurial-scm.org/D1797
Pulkit Goyal <7895pulkit@gmail.com> [Fri, 29 Dec 2017 05:47:17 +0530] rev 35586
py3: don't use dict.iterkeys()
Instead of iterating of dict.iterkeys(), let's iterate of dict as that will be
equivalent and dict.iterkeys() is not present in Python 3.
Differential Revision: https://phab.mercurial-scm.org/D1796
Pulkit Goyal <7895pulkit@gmail.com> [Fri, 29 Dec 2017 05:29:04 +0530] rev 35585
py3: use pycompat.bytestr() instead of str()
Differential Revision: https://phab.mercurial-scm.org/D1795
Pulkit Goyal <7895pulkit@gmail.com> [Fri, 29 Dec 2017 05:28:05 +0530] rev 35584
py3: make regular expressions bytes by prepending b''
Regexes start with r'' and hence transformer skips adding b'' there.
# skip-blame because we are just adding b''
Differential Revision: https://phab.mercurial-scm.org/D1794
Pulkit Goyal <7895pulkit@gmail.com> [Fri, 29 Dec 2017 05:27:00 +0530] rev 35583
py3: slice on bytes instead of indexing
Indexing returns the ascii value on Python 3.
Differential Revision: https://phab.mercurial-scm.org/D1793
Pulkit Goyal <7895pulkit@gmail.com> [Fri, 29 Dec 2017 05:25:27 +0530] rev 35582
py3: use node.hex(h.digest()) instead of h.hexdigest()
hashlib.sha1.hexdigest() returns str on Python 3.
Differential Revision: https://phab.mercurial-scm.org/D1792
Pulkit Goyal <7895pulkit@gmail.com> [Fri, 29 Dec 2017 05:22:06 +0530] rev 35581
tests: make autodiff.py work on Python 3
This patch adds b'' to string literal to make it compatible with in-core Python
3 compatibility.
# skip-blame because we are just adding b''
Differential Revision: https://phab.mercurial-scm.org/D1791
Pulkit Goyal <7895pulkit@gmail.com> [Fri, 29 Dec 2017 03:32:04 +0530] rev 35580
py3: use pycompat.ziplist instead of inbuilt zip
zip just like map on Python 3 returns a generator object instead of list. This
results in error if we try to iterate over the result once we consume it. We
have added pycompat.ziplist which returns a list.
Differential Revision: https://phab.mercurial-scm.org/D1790
Pulkit Goyal <7895pulkit@gmail.com> [Fri, 29 Dec 2017 05:35:57 +0530] rev 35579
py3: use bytes and open() instead of file() in test-diff-upgrade.t
file() is not present in Python 3.
Differential Revision: https://phab.mercurial-scm.org/D1789
Martin von Zweigbergk <martinvonz@google.com> [Wed, 10 Jan 2018 11:02:20 -0800] rev 35578
exchange: use context manager for locks and transaction in unbundle()
Note that the transactionmanager doesn't actually create a transaction
-- that is done the first time .transaction() is called on it (if at
all). Consequently, .close() and .release() won't do anything if no
transaction has been created. This makes it a little unusual, but it
still works as a context manager.
Differential Revision: https://phab.mercurial-scm.org/D1841
Martin von Zweigbergk <martinvonz@google.com> [Wed, 10 Jan 2018 10:49:12 -0800] rev 35577
bookmarks: use context managers for locks and transaction in pushbookmark()
Differential Revision: https://phab.mercurial-scm.org/D1840
Martin von Zweigbergk <martinvonz@google.com> [Wed, 10 Jan 2018 10:47:13 -0800] rev 35576
bookmarks: use context managers for lock and transaction in update()
Differential Revision: https://phab.mercurial-scm.org/D1839
Martin von Zweigbergk <martinvonz@google.com> [Wed, 10 Jan 2018 10:44:21 -0800] rev 35575
phase: use context managers for lock and transaction
Differential Revision: https://phab.mercurial-scm.org/D1838
Martin von Zweigbergk <martinvonz@google.com> [Wed, 10 Jan 2018 10:33:11 -0800] rev 35574
obsolete: use context manager for transaction in pushmarker()
Differential Revision: https://phab.mercurial-scm.org/D1837
Martin von Zweigbergk <martinvonz@google.com> [Wed, 10 Jan 2018 10:32:16 -0800] rev 35573
obsolete: use context manager for lock in pushmarker()
Differential Revision: https://phab.mercurial-scm.org/D1836
Martin von Zweigbergk <martinvonz@google.com> [Wed, 10 Jan 2018 10:30:51 -0800] rev 35572
obsolete: use context manager for transaction in createmarkers()
Differential Revision: https://phab.mercurial-scm.org/D1835
Boris Feld <boris.feld@octobus.net> [Fri, 05 Jan 2018 09:12:08 +0100] rev 35571
visibility: improve the message when accessing filtered obsolete rev
When trying to access filtered revision, it is likely because they have been
obsoleted by an obs-marker. The current message shows how to access the
revision anyway:
abort: hidden revision '13bedc178fce'!
But in the case of an obsoleted revision, the user is likely to want to update
to or use the successor of the revision.
We update the message to display more information about the obsolescence fate
of the revision in the following cases:
abort: hidden revision '13bedc178fce' is pruned!
abort: hidden revision '13bedc178fce' has diverged!
abort: hidden revision '13bedc178fce' was rewritten as X, Y and 2 more!
Differential Revision: https://phab.mercurial-scm.org/D1591
Pulkit Goyal <7895pulkit@gmail.com> [Fri, 29 Dec 2017 03:37:36 +0530] rev 35570
tests: add b'' to string literals where bytes are required
Since we are internally dealing with bytes only, we need to use bytes in the
tests too. This is one of the many patches which will make all the tests
completely use bytes.
# skip-blame because we are just adding b''
Differential Revision: https://phab.mercurial-scm.org/D1788
Gregory Szorc <gregory.szorc@gmail.com> [Wed, 10 Jan 2018 08:53:22 -0800] rev 35569
rust: implementation of `hg`
This commit provides a mostly-working implementation of the
`hg` script in Rust along with scaffolding to support Rust in
the repository.
If you are familiar with Rust, the contents of the added rust/
directory should be pretty straightforward. We create an "hgcli"
package that implements a binary application to run Mercurial.
The output of this package is an "hg" binary.
Our Rust `hg` (henceforth "rhg") essentially is a port of the existing
`hg` Python script. The main difference is the creation of the embedded
CPython interpreter is handled by the binary itself instead of relying
on the shebang. In that sense, rhg is more similar to the "exe wrapper"
we currently use on Windows. However, unlike the exe wrapper, rhg does
not call the `hg` Python script. Instead, it uses the CPython APIs to
import mercurial modules and call appropriate functions. The amount of
code here is surprisingly small.
It is my intent to replace the existing C-based exe wrapper with rhg.
Preferably in the next Mercurial release. This should be achievable -
at least for some Mercurial distributions. The future/timeline for
rhg on other platforms is less clear. We already ship a hg.exe on
Windows. So if we get the quirks with Rust worked out, shipping a
Rust-based hg.exe should hopefully not be too contentious.
Now onto the implementation.
We're using python27-sys and the cpython crates for talking to the
CPython API. We currently don't use too much functionality of the
cpython crate and could have probably cut it out. However, it does
provide a reasonable abstraction over unsafe {} CPython function
calls. While we still have our fair share of those, at least we're
not dealing with too much refcounting, error checking, etc. So I
think the use of the cpython crate is justified. Plus, there is
not-yet-implemented functionality that could benefit from cpython. I
see our use of this crate only increasing.
The cpython and python27-sys crates are not without their issues.
The cpython crate didn't seem to account for the embedding use case
in its design. Instead, it seems to assume that you are building
a Python extension. It is making some questionable decisions around
certain CPython APIs. For example, it insists that
PyEval_ThreadsInitialized() is called and that the Python code
likely isn't the main thread in the underlying application. It
is also missing some functionality that is important for embedded
use cases (such as exporting the path to the Python interpreter
from its build script). After spending several hours trying to
wrangle python27-sys and cpython, I gave up and forked the project
on GitHub. Our Cargo.toml tracks this fork. I'm optimistic that
the upstream project will accept our contributions and we can
eventually unfork.
There is a non-trivial amount of code in our custom Cargo build
script. Our build.rs (which is called as part of building the hgcli
crate):
* Validates that the Python interpreter that was detected by the
python27-sys crate provides a shared library (we only support
shared library linking at this time - although this restriction
could be loosened).
* Validates that the Python is built with UCS-4 support. This ensures
maximum Unicode compatibility.
* Exports variables to the crate build allowing the built crate to e.g.
find the path to the Python interpreter.
The produced rhg should be considered alpha quality. There are several
known deficiencies. Many of these are documented with inline TODOs.
Probably the biggest limitation of rhg is that it assumes it is
running from the ./rust/target/<target> directory of a source
distribution. So, rhg is currently not very practical for real-world
use. But, if you can `cargo build` it, running the binary *should*
yield a working Mercurial CLI.
In order to support using rhg with the test harness, we needed to hack
up run-tests.py so the path to Mercurial's Python files is set properly.
The change is extremely hacky and is only intended to be a stop-gap
until the test harness gains first-class support for installing rhg.
This will likely occur after we support running rhg outside the
source directory.
Despite its officially alpha quality, rhg copes extremely well with
the test harness (at least on Linux). Using
`run-tests.py --with-hg ../rust/target/debug/hg`, I only encounter
the following failures:
* test-run-tests.t -- Warnings emitted about using an unexpected
Mercurial library. This is due to the hacky nature of setting the
Python directory when run-tests.py detected rhg.
* test-devel-warnings.t -- Expected stack trace missing frame for `hg`
(This is expected since we no longer have an `hg` script!)
* test-convert.t -- Test running `$PYTHON "$BINDIR"/hg`, which obviously
assumes `hg` is a Python script.
* test-merge-tools.t -- Same assumption about `hg` being executable with
Python.
* test-http-bad-server.t -- Seeing exit code 255 instead of 1 around
line 358.
* test-blackbox.t -- Exit code 255 instead of 1.
* test-basic.t -- Exit code 255 instead of 1.
It certainly looks like we have a bug around exit code handling. I
don't think it is severe enough to hold up review and landing of this
initial implementation. Perfect is the enemy of good.
Differential Revision: https://phab.mercurial-scm.org/D1581
Matt Harbison <matt_harbison@yahoo.com> [Sun, 07 Jan 2018 15:21:16 -0500] rev 35568
lfs: improve the error message for a missing remote blob
It seems better to print the name known to the user, not the internal file. The
previous code unconditionally set 'p.filename'. That potentially made the
attribute None, and would be printed as such in
_gitlfsremote._checkforservererror() instead of "unknown". Normally, files are
printed relative to CWD, but I don't see a way to get the repo path to make that
adjustment.
The test modified here apparently only runs within Facebook, but a print
statement confirmed the name change. I tried uploading the blob to a different
remote store (so the git server never saw it), and also killing the git server
and removing the blob directory, and removing the 'lfs.db' file. All resulted
in a message:
abort: LFS server claims required objects do not exist:
bdc26931acfb734b142a8d675f205becf27560dc461f501822de13274fe6fc8a!
So I have no idea how to make this test generally runnable.
Matt Harbison <matt_harbison@yahoo.com> [Sun, 07 Jan 2018 15:01:59 -0500] rev 35567
filelog: add the ability to report the user facing name
This will be used by lfs, but is probably generally useful. There are various
bits of code that reverse engineer this from the index or data file names, but
it seems better to just store it. Especially if there's experimenting with
backing storage other than revlog.
Anton Shestakov <av6@dwimlabs.net> [Tue, 19 Dec 2017 20:41:25 +0800] rev 35566
hgweb: make different kinds of commits look differently on /graph
Regular hg log -G uses different symbols for some graph nodes, such as commits
that close branches and hidden commits. It also marks the currently checked out
commit with "@". Since hg serve is sometimes used/recommended as a more visual
alternative to CLI, it makes sense to port these features to hgweb.
"graphnode" includes the style of a particular node and also if it's currently
checked out or not, both at the same time. This is different from hg log -G
(which uses templatekw.showgraphnode), where there's only place for one
character, but hgweb doesn't have this limitation, since it uses <canvas> and
not plain text. I'm using one string of 1 or 2 characters in this patch, it's
not the most self-explanatory format, but it's concise, uses the same
characters as hg log -G, and is internal to hgweb (i.e. not used for
json-graph).
I'm more or less fine with how things look visually, but there's still room for
improvement. Feel free to criticise or point me to good-looking graphs of this
kind for inspiration.