Denis Laxalde <denis.laxalde@logilab.fr> [Tue, 03 Jan 2017 10:56:41 +0100] rev 30694
cmdutil: extract a _changesetlabels function out of changeset_printer._show()
There is a common logic in changeset_printer and in the summary command for
labelling a changeset.
This prepares extension of changeset's labels with evolution "troubles"
information that would show up in both log and summary outputs. Ultimately,
both would use this function.
Jun Wu <quark@fb.com> [Mon, 02 Jan 2017 14:57:14 +0000] rev 30693
chg: add procutil.h
This patch adds a formal header procutil.h for procutil.c, and changes
Makefile to build procutil.c independently.
Jun Wu <quark@fb.com> [Mon, 02 Jan 2017 14:43:37 +0000] rev 30692
chg: let procutil maintain its own pagerpid
Previously, chg.c maintains the pagerpid. Let's move it to procutil.c.
Note: chg.c still have a pagerpid to decide whether to call attachio or not.
In the future, attachio may be moved from hgc_open to hgc_runcommand, and
hgc_runcommand handles both pager and attachio so we don't need to run
attachio twice. And chg.c will be free of pagerpid.
Jun Wu <quark@fb.com> [Mon, 02 Jan 2017 14:10:32 +0000] rev 30691
chg: decouple hgclient from setuppager
procutil should not depend on hgclient. This patch makes the pager handling
part independent from hgclient.
Jun Wu <quark@fb.com> [Mon, 02 Jan 2017 14:04:35 +0000] rev 30690
chg: decouple hgclient from setupsignalhandler
procutil should not depend on hgclient. This patch makes the signal handling
part independent from hgclient.
Jun Wu <quark@fb.com> [Mon, 02 Jan 2017 14:02:47 +0000] rev 30689
chg: move signal and pager handling to a separate file
In the future hgclient will deal with pager directly inside runcommand, so
related signal handling stuff needs to be decoupled from chg.c.
The signal handling and pager logic are coupled because we need to forward
SIGPIPE when pager exits. So they are moved together, otherwise a global
variable (pagerpid) is inevitable.
This patch moves related functions from chg.c to procutil.c, which was
marked as copied to maintain annotate history.
The move is done without code modification for easy review, therefore
`#include "procutil.c"` was introduced temporarily.
Gregory Szorc <gregory.szorc@gmail.com> [Wed, 07 Oct 2015 16:02:45 -0700] rev 30688
keepalive: rewrite readline()
The old method was performing string concatenation, which is slower than
collecting raw chunks in a list and joining at the end.
Gregory Szorc <gregory.szorc@gmail.com> [Wed, 07 Oct 2015 15:53:58 -0700] rev 30687
keepalive: remove limit argument from readline()
It is unused and adds complexity.
Gregory Szorc <gregory.szorc@gmail.com> [Wed, 07 Oct 2015 15:33:52 -0700] rev 30686
keepalive: don't concatenate strings when reading chunked transfer
Surprisingly, this didn't appear to speed up HTTP-based stream cloning
on my machine. I suspect this has more to do with the fact we're using
small HTTP chunks and string concatenation overhead isn't so bad.
However, the reasons for this change are solid: we know string
concatenation can be a performance sink.
Gregory Szorc <gregory.szorc@gmail.com> [Mon, 26 Dec 2016 12:11:29 -0700] rev 30685
exchange: use rich class for sorting clone bundle entries
Python 3 removed the "cmp" argument from sorted(). Custom sorting in
Python 3 must be implemented with the dunder comparison methods on
types and/or with a "key" function.
This patch converts our custom "cmp" function to a custom type.
The implementation is very similar to functools.cmp_to_key(). However,
cmp_to_key() doesn't exist in Python 2, so we can't use it.
This was the only use of the "cmp" argument to sorted() in the code
base.
Jun Wu <quark@fb.com> [Mon, 26 Dec 2016 00:02:42 +0000] rev 30684
chg: respect XDG_RUNTIME_DIR
$XDG_RUNTIME_DIR [1] is a better place for user daemons. Let's use it and
fallback to $TMPDIR.
After this patch, chg will try socket paths in the following order:
1. $CHGSOCKNAME
2. $XDG_RUNTIME_DIR/chg/server
3. ${TMPDIR:-tmp}/chg$UID/server
[1]: https://standards.freedesktop.org/basedir-spec/basedir-spec-latest.html
Jun Wu <quark@fb.com> [Sun, 25 Dec 2016 23:49:54 +0000] rev 30683
chg: make "get default sockdir" a separate method
The logic to get a default socket directory will become longer in the next
patch. So let's move it out.
Jun Wu <quark@fb.com> [Sun, 25 Dec 2016 23:32:11 +0000] rev 30682
chg: handle connect failure before errno gets overridden
This patch moves the error handling logic up so that errno after connect
won't be overridden.
Pulkit Goyal <7895pulkit@gmail.com> [Sun, 25 Dec 2016 03:06:55 +0530] rev 30681
py3: have a bytes version of shlex.split()
shlex.split() only accepts unicodes on Python 3. After this patch we will be
using pycompat.shlexsplit(). This patch also replaces existing occurences of
shlex.split with pycompat.shlexsplit.
Jun Wu <quark@fb.com> [Fri, 23 Dec 2016 16:26:40 +0000] rev 30680
chg: support long socket path
This patch replaces UNIX_PATH_MAX (108) with PATH_MAX (4096) so we can have
long unix path.
Jun Wu <quark@fb.com> [Fri, 23 Dec 2016 16:16:44 +0000] rev 30679
chg: remove sockdirfd
See the previous patch for the reason.
Jun Wu <quark@fb.com> [Fri, 23 Dec 2016 16:37:00 +0000] rev 30678
chg: let hgc_open support long path
"sizeof(sun_path)" is too small. Use the chdir trick to support long socket
path, like "mercurial.util.bindunixsocket".
It's useful for cases where TMPDIR is long. Modern OS X rewrites TMPDIR to a
long value. And we probably want to use XDG_RUNTIME_DIR [2] for Linux.
The approach is a bit different from the previous plan, where we will have
hgc_openat and pass cmdserveropts.sockdirfd to it. That's because the
current change is easier: chg has to pass a full path to "hg" as the
"--address" parameter. There is no "--address-basename" or "--address-dirfd"
flags. The next patch will remove "sockdirfd".
Note: It'd be nice if we can use a native "connectat" implementation.
However, that's not available everywhere. Some platform (namely FreeBSD)
does support it, but the implementation has bugs so it cannot be used [2].
[1]: https://standards.freedesktop.org/basedir-spec/basedir-spec-latest.html
[2]: https://www.mercurial-scm.org/pipermail/mercurial-devel/2016-April/082892.html
Augie Fackler <raf@durin42.com> [Sat, 24 Dec 2016 15:38:27 -0500] rev 30677
rebase: un-wrap function signature since it fits in 80 columns
Pulkit Goyal <7895pulkit@gmail.com> [Sun, 25 Dec 2016 02:42:46 +0530] rev 30676
py3: exclude pywatchman from test-check-py3-compat.t
Exclude pywatchman from py3 test. They have already worked on Python 3
compatibility https://github.com/facebook/watchman/pull/247
Pulkit Goyal <7895pulkit@gmail.com> [Sun, 25 Dec 2016 02:34:19 +0530] rev 30675
py3: update test-check-py3-compat.t
This part of test runs only on py3. This change was introduced by 16f4b341288d.
Pulkit Goyal <7895pulkit@gmail.com> [Thu, 22 Dec 2016 19:35:30 +0530] rev 30674
shelve: choose a legal shelve name when no name is passed (issue5112)
Currently if our branch name contains '\' or starts with '.', shelve chooses
an illegal shelve name. This behaviour is not good as it itself is choosing
something which it won't accept further. We can raise errors if user passes
a name which is illegal.
After this patch, if '\' is contained in branch name or bookmark name, it will
be replaced by '_' while choosing a shelve name and if they starts with '.',
the first '.' is replaced by '_'.
Pulkit Goyal <7895pulkit@gmail.com> [Thu, 22 Dec 2016 23:27:32 +0530] rev 30673
shelve: add tests to ensure illegal shelve names are avoided
We avoid '.' as the first letter of shelve name so that we don't create hidden
file. We also avoid slashes in name so that we don't form a new directory
Pulkit Goyal <7895pulkit@gmail.com> [Tue, 20 Dec 2016 00:20:07 +0530] rev 30672
py3: replace sys.executable with pycompat.sysexecutable
sys.executable returns unicodes on Python 3. This patch replaces occurences of
sys.executable with pycompat.sysexecutable.
Pulkit Goyal <7895pulkit@gmail.com> [Tue, 20 Dec 2016 00:02:24 +0530] rev 30671
py3: have bytes version of sys.executable
sys.executable on Python 3 returns unicodes and we want bytes. So this patch
adds a new pycompat.sysexecutable which returns bytes by encoding using
os.fsencode() since it is path variable.
Pulkit Goyal <7895pulkit@gmail.com> [Thu, 22 Dec 2016 01:54:17 +0530] rev 30670
py3: use pycompat.getcwd instead of os.getcwd
Pulkit Goyal <7895pulkit@gmail.com> [Wed, 21 Dec 2016 23:40:38 +0530] rev 30669
py3: use python 3 compatible variables in hgext/fsmontor/__init__.py
Earlier this was left thinking that its part of pywatchman package.
This patch replaces variables os.sep, sys.platform and os.envrion with their
py3 compatible ones.
Pulkit Goyal <7895pulkit@gmail.com> [Wed, 21 Dec 2016 22:42:31 +0530] rev 30668
py3: add warnings in check-code related to py3
We have our own bytes versions of things like, getopt.getopt, os.sep, os.name,
sys.executable, os.environ and few more for python 3 portability. Its better
to come up with warnings if someone breaks the things which we have fixed.
After this patch, check-code will warn us to use our bytes version.
These checks run on mercurial/ and hgext/ and pycompat.py is excluded.
Pulkit Goyal <7895pulkit@gmail.com> [Mon, 19 Dec 2016 02:54:49 +0530] rev 30667
py3: replace os.getenv with pycompat.osgetenv
os.getenv deals with unicodes on Python 3, so we have pycompat.osgetenv to
deal with bytes. This patch replaces occurrences on os.getenv with
pycompat.osgetenv
Pulkit Goyal <7895pulkit@gmail.com> [Mon, 19 Dec 2016 02:35:38 +0530] rev 30666
py3: have bytes version of os.getenv
os.getenv() on python 3 deals with unicodes. If we want to pass bytes. we have
os.getenvb() which deals with bytes. This patch adds up a pycompat.osgetenv
which deals with bytes on both python 2 and 3.
Pulkit Goyal <7895pulkit@gmail.com> [Sat, 24 Dec 2016 01:16:14 +0530] rev 30665
url: remove unnecessary deletion of environ variables while dealing with proxy
Currently we delete proxy environment variables if ui.config contains proxy
values. This is unnecessary because urllib2.ProxyHandler class only reads proxy
from environment it is initialised by None. But url.py never passes None,
so there is no point urllib2 will take environment variables in account.
This also prevents deleting environment variables which is not safe.
This code was introduced while resolving Bug 2451 even it is in one of comments
(sixth one) on bug that we can safely remove this part.
Link to bug : https://bz.mercurial-scm.org/show_bug.cgi?id=2451
Gregory Szorc <gregory.szorc@gmail.com> [Thu, 22 Dec 2016 23:28:35 -0700] rev 30664
convert: add config option to control storing original revision
common.commit.__init__ sets saverev=True by default. The side effect
of this is that the hg sink will always set the "convert_revision"
extras key to the commit being converted.
This patch adds a config option to disable this behavior.
While most consumers will want "convert_revision" to be a) written
b) with the exact Git commit that was converted, some have use cases
that prefer otherwise. In my case, I am performing significant
rewrites of a Git repository *before* it is fed into `hg convert`.
I have to do this because `hg convert` does not easily support the kind
of transform I desire, even with extensions. (For the curious, I am
"linearizing" the history of a GitHub repo by removing merge commits
which add little value to the final history. It isn't easy to do this
during `hg convert` because of Mercurial's file copy/rename metadata
requirements.)
In my scenario, my pre-convert transform stores a "convert_revision"
key in the Git commit object containing the original Git commit ID.
I want this original Git commit ID carried forward to Mercurial. By
disabling the setting of this extra during `hg convert` and copying
the value from the Git commit object, I can have the final
"convert_revision" extra key contain the original Git commit ID. An
added test verifies this exact scenario.
This feature could likely be implemented for other VCS sources. But
until someone needs the feature, I'm inclined to hold off implementing.
Gregory Szorc <gregory.szorc@gmail.com> [Thu, 22 Dec 2016 23:28:11 -0700] rev 30663
convert: add config option to copy extra keys from Git commits
Git commit objects support storing arbitrary key-value metadata. While
there is no user-facing mechanism in Git to record these values, some
tools do record data here.
Currently, `hg convert` only handles the "author," "committer," and
"parent" keys in Git commit objects. All other keys are ignored. This
means that any custom keys are lost when converting Git repos to
Mercurial.
This patch implements support for copying a whitelist of extra keys
from Git commit objects to the "extras" dict of the destination. As
the added tests demonstate, this allows extra metadata to be preserved
during the conversion process.
This patch stops short of converting all metadata to "extras." We could
potentially implement this via `convert.git.extrakeys=*` or similar.
But copying everything by default is a bit dangerous because if Git
adds new keys to commit objects, we could find ourselves copying
things that shouldn't be copied!
This patch also assumes the source key is the same as the destination
key. We could implement support for prefixing the output key to
distinguish it as coming from Git. But until this feature is needed,
I'm inclined to hold off implementing it.
Gregory Szorc <gregory.szorc@gmail.com> [Thu, 22 Dec 2016 09:26:47 -0800] rev 30662
convert: don't use {} as default argument value
This is a common Python gotcha. I'm kinda surprised we don't have a
check-code to detect this :/
Remi Chaintron <remi@fb.com> [Thu, 22 Dec 2016 19:08:38 -0500] rev 30661
documentation: better censor flag documentation
Gregory Szorc <gregory.szorc@gmail.com> [Sat, 24 Dec 2016 10:40:08 -0700] rev 30660
tests: make test-convert-git.t reproducible
For reasons I can't explain, Git's copy detection code was identifying
different source files on OS X and (presumably) Solaris versus Linux
(which the test was originally authored against). This was causing
unstable test output.
Changing the test to use a non-ambiguous source file appears to make
the test stable.
The test was introduced recently in ea3540e66fd8.
Zack Hricz <zphricz@fb.com> [Thu, 22 Dec 2016 11:22:32 -0800] rev 30659
fsmonitor: refresh pywatchman to upstream
Update to upstream to version c77452. The refresh includes fixes to improve
windows compatibility.
There is a minor update to 'test-check-py3-compat.t' as c77452 no longer have
the py3 compatibility issues the previous version had.
# no-check-commit
Zack Hricz <zphricz@fb.com> [Thu, 22 Dec 2016 11:07:59 -0800] rev 30658
tests: exclude bundled pywatchman from test-check-pyflakes
The code under pywatchman used to be excluded from test-check-code and
test-check-pyflakes through the magic string "no-check-code". Now that
test-check-code excludes the pywatchman directory entirely, the directory
should also be excluded from test-check-pyflakes.
Pierre-Yves David <pierre-yves.david@ens-lyon.org> [Fri, 18 Nov 2016 18:18:15 +0100] rev 30657
color: load 'colortable' from extension using an 'extraloader'
Now that we have the '_style' dictionary in core, we can use the clean and
standard 'extraloader' mechanism to load extension's 'colortable'.
color.loadcolortable
Pierre-Yves David <pierre-yves.david@ens-lyon.org> [Fri, 18 Nov 2016 18:09:36 +0100] rev 30656
color: move hgext.color._styles to mercurial.color.style
This is small first step to start moving the color infrastructure into core. The
current code of the color extensions is full of strange and debatable things,
we'll clean it up in the process as having things into core help the cleaning.
Moving _style was the simplest sensible move that is possible. It will also help
cleaning up the extension setup process in a later changesets.
Pierre-Yves David <pierre-yves.david@ens-lyon.org> [Fri, 18 Nov 2016 18:29:19 +0100] rev 30655
color: drop use of the 'global' keyword for '_style'
Using 'global' is usually a bad sign. Here it is used so that one can empty the
content of a dict at the global scope. We '_style.clear()' and drop the global.
Pierre-Yves David <pierre-yves.david@ens-lyon.org> [Fri, 18 Nov 2016 18:27:13 +0100] rev 30654
color: drop use of the 'global' keyword for _terminfo_params
Using 'global' is usually a bad sign. Here it is used so that one can empty the
content of a dict at the global scope. We '_terminfo_params.clear()' and
drop the global.
zphricz <zack.hricz@oculus.com> [Wed, 21 Dec 2016 13:51:34 -0800] rev 30653
fsmonitor: fix exception message scraping
pywatchman.CommandError formats its error message such that
'unable to resolve root' is not a prefix. This change fixes that by
instead just searching for it as a substring.
David Soria Parra <davidsp@fb.com> [Wed, 21 Dec 2016 13:44:15 -0800] rev 30652
tests: add magic string to bypass check-commit
Allow bypassing test-check-commit runs by specifying '# no-check-commit'
in the description. This should be avoided but is useful for upstream
imports such as pywatchman which will cause check-code to fail otherwise.
Gregory Szorc <gregory.szorc@gmail.com> [Sun, 18 Dec 2016 12:53:20 -0800] rev 30651
convert: config option for git rename limit
By default, Git applies rename and copy detection to 400 files. The
diff.renamelimit config option and -l argument to diff commands can
override this.
As part of converting some repositories in the wild, I was hitting
the default limit. Unfortunately, the warnings that Git prints in this
scenario are swallowed because the process running functionality in
common.py redirects stderr to /dev/null by default. This seems like
a bug, but a bug for another day.
This commit establishes a config option to send the rename limit
through to `git diff-tree`. The added tests demonstrate a too-low
rename limit doesn't result in copy metadata being recorded.
Yuya Nishihara <yuya@tcha.org> [Thu, 22 Dec 2016 01:09:45 +0900] rev 30650
chgserver: backout changeset dfb19aed409e (per discussion)
On Wed, 21 Dec 2016 15:39:05 +0000, Jun Wu wrote:
> Actually, patch 1 is unnecessary if we go with the "ui._runpager" approach.
> Maybe someone can drop it without adding too many markers.
Jun Wu <quark@fb.com> [Fri, 16 Dec 2016 14:48:37 +0000] rev 30649
chgserver: override runcommand
Next patches will customize chgserver's runcommand. So let's override it.
The docstring is temporarily missing and will be filled later.
Jun Wu <quark@fb.com> [Fri, 16 Dec 2016 14:46:34 +0000] rev 30648
chgserver: store csystem separately
Previously, the "system" channel is inside the ui object. In the future, chg
will let dispatch to create a new ui object from scratch, to maximize
compatibility. And chgserver will use a "uisetup" like an extension to wrap
ui.system. To be able to do that cleanly, the system channel needs to be
accessed directly.
Pulkit Goyal <7895pulkit@gmail.com> [Mon, 19 Dec 2016 02:26:41 +0530] rev 30647
py3: replace sys.platform with pycompat.sysplatform (part 2 of 2)
Pulkit Goyal <7895pulkit@gmail.com> [Mon, 19 Dec 2016 02:15:24 +0530] rev 30646
py3: replace sys.platform with pycompat.sysplatform (part 1 of 2)
sys.platform returns unicode on python 3 world. Our code base has most of the
things bytes because of the transformer. So we have a bytes version of this as
pycompat.sysplatform. This series of 2 patches replaces occurences of
sys.platform with pycompat.sysplatform.
Pulkit Goyal <7895pulkit@gmail.com> [Mon, 19 Dec 2016 00:28:12 +0530] rev 30645
py3: replace os.name with pycompat.osname (part 2 of 2)
Pulkit Goyal <7895pulkit@gmail.com> [Mon, 19 Dec 2016 00:16:52 +0530] rev 30644
py3: replace os.name with pycompat.osname (part 1 of 2)
os.name returns unicodes on py3 and we have pycompat.osname which returns
bytes. This series of 2 patches will change every ocurrence of os.name with
pycompat.osname.
Pulkit Goyal <7895pulkit@gmail.com> [Sun, 18 Dec 2016 02:08:59 +0530] rev 30643
py3: replace os.environ with encoding.environ (part 5 of 5)
Pulkit Goyal <7895pulkit@gmail.com> [Sun, 18 Dec 2016 02:06:00 +0530] rev 30642
py3: replace os.environ with encoding.environ (part 4 of 5)
Pulkit Goyal <7895pulkit@gmail.com> [Sun, 18 Dec 2016 01:54:36 +0530] rev 30641
py3: replace os.environ with encoding.environ (part 3 of 5)
Pulkit Goyal <7895pulkit@gmail.com> [Sun, 18 Dec 2016 01:46:39 +0530] rev 30640
py3: replace os.environ with encoding.environ (part 2 of 5)
Pulkit Goyal <7895pulkit@gmail.com> [Sun, 18 Dec 2016 01:34:41 +0530] rev 30639
py3: replace os.environ with encoding.environ (part 1 of 5)
os.environ is a dictionary which has string elements on Python 3. We have
encoding.environ which take care of all these things. This is the first patch
of 5 patch series which tend to replace the occurences of os.environ with
encoding.environ as using os.environ will result in unusual behaviour.
David Soria Parra <davidsp@fb.com> [Tue, 20 Dec 2016 20:28:41 -0800] rev 30638
tests: exclude bundled pywatchman from check-code test
pywatchman is imported from upstream and therefore fails to pass
linting. We have added 'no-check-code' manually to every file in the
past. This is cumbersome and modifies upstream sources.
David Soria Parra <davidsp@fb.com> [Tue, 20 Dec 2016 09:23:50 -0800] rev 30637
convert: parse perforce data on-demand
We are using read-only attributes that parse the perforce data on
demand. We are reading the data only once whenever an attribute is
requested and use it throughout the import process. This is equivalent
to the previous behavior, but we are avoiding reading from perforce when
we initialize the object, but instead run it during the actual import
process, when the first attribute is requested (usually getheads(), see
`convertcmd.convert`).
David Soria Parra <davidsp@fb.com> [Tue, 20 Dec 2016 09:23:50 -0800] rev 30636
convert: return calculated values from parse() instead of manpulating state
David Soria Parra <davidsp@fb.com> [Tue, 20 Dec 2016 09:23:50 -0800] rev 30635
convert: move localname state to function scope
David Soria Parra <davidsp@fb.com> [Tue, 20 Dec 2016 09:23:50 -0800] rev 30634
convert: use return value in parse_view() instead of manipulating state
Pierre-Yves David <pierre-yves.david@ens-lyon.org> [Mon, 19 Dec 2016 04:25:18 +0100] rev 30633
changegroup: simplify logic around enabling changegroup 03
There was multiple spot that took care of adding '03' as supported changegroup
version for different condition. We gather them all in one location for
simplicity.
The 'supportedincomingversions' function is now doing nothing, but I kept it
around because it looks like a great hooking point for extension.
(Note that we should probably just get changegroup3 out of experimental now, But
that would be a patch with a much wider scope).
Pierre-Yves David <pierre-yves.david@ens-lyon.org> [Mon, 19 Dec 2016 04:29:33 +0100] rev 30632
changegroup: pass 'repo' to allsupportedversions
In the next changesets, we will introduce more logic directly related to the
repository to decide what version have to be supported. So we now directly pass
the repo object instead of just ui.
Pierre-Yves David <pierre-yves.david@ens-lyon.org> [Mon, 19 Dec 2016 04:31:13 +0100] rev 30631
changegroup: simplify 'allsupportedversions' logic
Discarding '03' to add it back is a bit strange. Instead we only discard it when
needed.
Pulkit Goyal <7895pulkit@gmail.com> [Sun, 18 Dec 2016 01:17:12 +0530] rev 30630
py3: replace os.altsep with pycompat.altsep
All the occurences of os.altsep are replaced with pycompat.altsep which
returns bytes.
Pulkit Goyal <7895pulkit@gmail.com> [Sun, 18 Dec 2016 00:52:05 +0530] rev 30629
py3: have a bytes version of sys.platform
sys.platform returns unicodes on Python 3. This patch adds up
pycompat.sysplatform which returns bytes.
Pulkit Goyal <7895pulkit@gmail.com> [Sun, 18 Dec 2016 00:44:21 +0530] rev 30628
py3: have a bytes version of os.altsep
os.altsep returns unicodes on Python 3. We need a bytes version hence added
pycompat.altsep.
Pulkit Goyal <7895pulkit@gmail.com> [Sat, 17 Dec 2016 23:55:25 +0530] rev 30627
py3: make sure encoding.encoding is a bytes variable
encoding.encoding returns unicodes when locale.getpreferredencoding() is used
to get the preferred encoding. This patch fixes that.
Jun Wu <quark@fb.com> [Mon, 19 Dec 2016 22:15:00 +0000] rev 30626
chg: remove locks
See the previous two patches for the reason. The advantage is a simplified
code base and better throughput when starting multiple servers with multiple
confighashes. The disadvantage is starting multiple servers in parallel with
a single confighash will waste some CPU time, which is probably fine in
common use-cases.
This makes it easier to switch to relative paths to support long unix domain
socket paths.
Jun Wu <quark@fb.com> [Mon, 19 Dec 2016 22:09:49 +0000] rev 30625
chg: start server at a unique address
See the previous patch for motivation. Previously, the server is started at
a globally shared address. This patch appends pid to the address so it
becomes unique.
Note: with Linux pid namespace, the address may be non-unique, but it does
not affect correctness of chg - chg client will receive an redirection and
that's it.
Jun Wu <quark@fb.com> [Mon, 19 Dec 2016 22:07:41 +0000] rev 30624
chgserver: truncate base address at "." for hash address
Previously, the hash address is just appending "-$HASH" to base address.
This patch makes it truncate the basename address at "." before appending
"-$HASH".
This makes it possible to spawn new servers in a racy situation and the
client could be sure the server it connects is the new server just spawned.
This is a step towards removing the lock.
One of the functionalities of the lock is to make sure the connect will
connect to a server it just created:
1. start server --address foo
2. connect to foo # wish "foo" is the server just started
With this change, the client could do:
1. start server --address foo.tmp$PID
2. connect to foo.tmp$PID # is the server just started
(note: if it is not, it does not affect correctness - linux pid
namespace is not a concern here)
3. rename foo.tmp$PID to foo
Another functionality of the lock is to avoid starting multiple servers with
a same confighash in parallel. But that also prevents starting multiple
servers with different confighashes in parallel.
Yuya Nishihara <yuya@tcha.org> [Sun, 23 Oct 2016 17:47:00 +0900] rev 30623
ui: do not translate empty configsource() to 'none' (API)
It should be processed when displaying data, so we can get "source": "" in
JSON output.
Yuya Nishihara <yuya@tcha.org> [Sun, 18 Dec 2016 16:20:04 +0900] rev 30622
convert: remove unused-but-set variable introduced in db9e883566e8
Spotted by pyflakes.
Pulkit Goyal <7895pulkit@gmail.com> [Sat, 17 Dec 2016 20:24:46 +0530] rev 30621
py3: replace os.sep with pycompat.ossep (part 4 of 4)
Pulkit Goyal <7895pulkit@gmail.com> [Sat, 17 Dec 2016 20:14:24 +0530] rev 30620
py3: replace os.sep with pycompat.ossep (part 3 of 4)
Pulkit Goyal <7895pulkit@gmail.com> [Sat, 17 Dec 2016 20:02:50 +0530] rev 30619
py3: replace os.sep with pycompat.ossep (part 2 of 4)
This part also replaces some chunks of os.sep with pycompat.ossep.
Pulkit Goyal <7895pulkit@gmail.com> [Sat, 17 Dec 2016 19:56:30 +0530] rev 30618
py3: replace os.sep with pycompat.ossep (part 1 of 4)
os.sep returns unicodes on Python 3. We have pycompat.ossep which returns
bytes. This patch is a part of 4 patch series which will replace all the
occurrences of os.sep to pycompat.ossep
Pulkit Goyal <7895pulkit@gmail.com> [Sat, 17 Dec 2016 19:47:17 +0530] rev 30617
py3: replace os.pathsep with pycompat.ospathsep
os.pathsep returns unicode on Python 3. We already have pycompat.ospathsep
which return bytes on Python 3. This patch replaces all the occurrences of
os.pathsep in the codebase (excluding tests) to pycompat.ospathsep.
Pulkit Goyal <7895pulkit@gmail.com> [Sat, 17 Dec 2016 19:36:40 +0530] rev 30616
py3: use %d instead of %s for integers
Python 3 returns an error if we use %s as type specifiers for integers.
Martin von Zweigbergk <martinvonz@google.com> [Fri, 16 Dec 2016 09:48:14 -0800] rev 30615
help: make multirevs just an alias for revsets
The multirevs topis seems to be covered well by the revsets topic, so
just make it an alias and remove multirevs.txt.
Jun Wu <quark@fb.com> [Fri, 16 Dec 2016 21:02:39 +0000] rev 30614
context: correct metadataonlyctx's parameter
It's "originalctx", not "path" as Yuya pointed in [1].
[1]: www.mercurial-scm.org/pipermail/mercurial-devel/2016-December/091508.html
Pierre-Yves David <pierre-yves.david@ens-lyon.org> [Mon, 12 Dec 2016 13:32:45 +0100] rev 30613
registrar: raise a programming error on duplicated registering
Previous, registering different object with the same name would silently
overwrite the first value with the second one. We now detect the situation and
raise an error. No extension in test or core had the issues.
Yuya Nishihara <yuya@tcha.org> [Sun, 16 Oct 2016 17:01:41 +0900] rev 30612
py3kcompat: drop unused module
Perhaps this was a predated attempt of Python 3 porting. Python 3.5 supports
%-formatting of bytes.
Yuya Nishihara <yuya@tcha.org> [Sun, 16 Oct 2016 16:59:50 +0900] rev 30611
strutil: drop module which no longer be used
Yuya Nishihara <yuya@tcha.org> [Sun, 16 Oct 2016 16:58:43 +0900] rev 30610
convert: inline strutil.rfindall()
This is the only place where strutil is used. I don't think it's worth to
keep the strutil module, so inline it.
Also, strutil.rfindall() appears to have off-by-one error. 'end = c - 1' is
wrong because 'end' is exclusive.
David Soria Parra <davidsp@fb.com> [Wed, 14 Dec 2016 12:07:23 -0800] rev 30609
convert: return commit objects for revisions in the revmap
Source revision data that exists in the revmap are ignored when pulling
data from Perforce as we consider them already imported. In case where
the `convertcmd.convert` algorithm requests a commit object for such
a revision we are creating it. This is usually the case for parent of
the first imported revision.
David Soria Parra <davidsp@fb.com> [Tue, 13 Dec 2016 21:49:58 -0800] rev 30608
convert: encapsulate commit data fetching and commit object creation
Split fetching the `describe` form from Perforce and the commit object creation
into two functions. This allows us to reuse the commit construction for
revisions passed from a revmap.
David Soria Parra <davidsp@fb.com> [Tue, 13 Dec 2016 21:49:58 -0800] rev 30607
convert: do not provide head revisions if we have no changests to import
Don't set a head revision in cases where we have a revmap but no
changesets to import, as convertcmd.convert() treats them as heads of
to-imported revisions.
David Soria Parra <davidsp@fb.com> [Wed, 14 Dec 2016 01:45:57 -0800] rev 30606
convert: allow passing in a revmap
Implement `common.setrevmap` which is used to pass in a file with existing
revision mappings. This functionality is used by `convertcmd.convert` if it
exists and allows implementors such as the p4 converter to make use of an
existing mapping.
We are using the revmap to abort scanning and the repository for more information
if we already have the revision. This means we are allowing incremental imports
in cases where a revmap is provided.
David Soria Parra <davidsp@fb.com> [Tue, 13 Dec 2016 21:49:58 -0800] rev 30605
convert: use convert_revision for P4 imports
We are using convert_revisions in other importers. In order to unify this
we are also using convert_revision for Perforce in addition to the original
'p4'.
David Soria Parra <davidsp@fb.com> [Wed, 14 Dec 2016 01:45:17 -0800] rev 30604
convert: remove unused dictionaries
self.parent, self.lastbranch and self.tags have never been used.
David Soria Parra <davidsp@fb.com> [Wed, 14 Dec 2016 01:43:47 -0800] rev 30603
convert: self.heads is a list
self.heads is used as a list throughout convert and never a dictionary.
Initialize it correctly to a list.
David Soria Parra <davidsp@fb.com> [Tue, 13 Dec 2016 21:49:58 -0800] rev 30602
convert: don't use long list comprehensions
We are iterating over p4changes. Make the continue condition more clear
and easier to add new conditions in future patches, by removing the list
comprehension and move the condition into the existing for-loop.
Durham Goode <durham@fb.com> [Thu, 15 Dec 2016 11:00:18 -0800] rev 30601
changelog: keep track of file end in appender (issue5444)
Previously, changelog.appender.end() would compute the end of the file by
joining all the current appended data and checking the length. This is an O(n)
operation. e240e914d226 introduced a seek call before every revlog write, which
means we are hitting this O(n) behavior n times, which causes changelog writes
during a pull to be n^2.
In our large repo, this caused pulling 100k commits to go from 17s to 130s. With
this fix, it's back to 17s.
Augie Fackler <augie@google.com> [Thu, 15 Dec 2016 11:14:00 -0500] rev 30600
tests: fix test-bdiff to handle variance between pure and c bdiff code
Obviously we'd rather patch pure to have the same algorithmic win as
the C code, but this is a quick fix for the pure build since pure
isn't wrong, just not as fast as it could be.
Augie Fackler <augie@google.com> [Thu, 15 Dec 2016 11:04:09 -0500] rev 30599
tests: finish updating test-bdiff to unittest (part 4 of 4)
Augie Fackler <augie@google.com> [Thu, 15 Dec 2016 10:56:26 -0500] rev 30598
tests: update more of test-bdiff.py to use unittest (part 3 of 4)
Augie Fackler <augie@google.com> [Thu, 15 Dec 2016 10:50:06 -0500] rev 30597
tests: update more of test-bdiff.py to use unittest (part 2 of 4)
Augie Fackler <augie@google.com> [Thu, 15 Dec 2016 10:10:15 -0500] rev 30596
tests: migrate test-bdiff.py to use unittest (part 1 of 4)
This moves all the test() calls, which were easy and mechanical.
Pierre-Yves David <pierre-yves.david@ens-lyon.org> [Thu, 15 Dec 2016 19:56:48 +0100] rev 30595
import-checker: do not enforce lexical sort accross stdlib/local boundary
Before this change, you could get in a start where the checker would either
complain about importing local module before stdlib one or complain about the
local one being wrongly lexically sorted with the stdlib one.
We detect the boundary and avoid complaining about lexical sort across it.
Stanislau Hlebik <stash@fb.com> [Wed, 14 Dec 2016 09:53:56 -0800] rev 30594
cg1packer: fix `compressed` method
`cg1packer.compressed()` returns True even if `self._type` is 'UN'. This patch
fixes it.
Philippe Pepiot <philippe.pepiot@logilab.fr> [Thu, 15 Dec 2016 12:17:08 +0100] rev 30593
perf: add historical support of ui.load()
ui.load() has been available since d83ca854 and at the time of writing isn't
available on stable branch breaking benchmarking newer stable revisions.
Add historical portability policy note on contrib/benchmarks
Jun Wu <quark@fb.com> [Wed, 14 Dec 2016 02:17:59 +0000] rev 30592
chg: ignore HG_* in confighash
The environment variables `HG_*` are usually used by hooks. Unlike `HGPLAIN`
etc, they do not actually affect hg's behavior. So do not include them in
confighash.
This would avoid spawning an unbound number of chg server processes if
commit hook calls hg frequently.
Pulkit Goyal <7895pulkit@gmail.com> [Tue, 13 Dec 2016 20:53:40 +0530] rev 30591
py3: make keys of keyword arguments strings
keys of keyword arguments on Python 3 has to be string. We are dealing with
bytes in our codebase so the keys are also bytes. Done that using
pycompat.strkwargs().
Also after this patch, `hg version` now runs on Python 3.5. Hurray!
Jun Wu <quark@fb.com> [Mon, 12 Dec 2016 08:01:52 +0000] rev 30590
error: make it clear that ProgrammingError is for mercurial developers
The word "developer" could refer to users - people using hg are likely to be
developers. Add adjectives to make it refer to mercurial developers only.
Remi Chaintron <remi@fb.com> [Tue, 13 Dec 2016 14:21:36 +0000] rev 30589
revlog: merge hash checking subfunctions
This patch factors the behavior of both methods into 'checkhash'.
Stanislau Hlebik <stash@fb.com> [Fri, 09 Dec 2016 03:22:26 -0800] rev 30588
bookmarks: make bookmarks.comparebookmarks accept binary nodes (API)
Binary bookmark format should be used internally. It doesn't make sense to have
optional parameters `srchex` and `dsthex`. This patch removes them. It will
also be useful for `bookmarks` bundle2 part because unnecessary conversions
between hex and bin nodes will be avoided.
Stanislau Hlebik <stash@fb.com> [Tue, 22 Nov 2016 01:33:31 -0800] rev 30587
bookmarks: rename `compare()` to `comparebookmarks()` (API)
Next commit will remove optional parameters from `compare()` function.
Let's rename `compare()` to `comparebookmarks()` to avoid ambiguity from
callers from external extensions.
Gábor Stefanik <gabor.stefanik@nng.com> [Mon, 05 Dec 2016 17:40:01 +0100] rev 30586
graft: support grafting changes to new file in renamed directory (issue5436)
Jun Wu <quark@fb.com> [Mon, 28 Nov 2016 05:45:22 +0000] rev 30585
rebase: calculate ancestors for --base separately (issue5420)
Previously, the --base option only works with a single "branch" - if there
is one changeset in the "--base" revset whose branching point(s) is/are
different from another changeset in the "--base" revset, "rebase" will error
out with:
abort: source is ancestor of destination
This happens if the user has multiple draft branches, and uses "hg rebase -b
'draft()' -d master", for example. The error message looks cryptic to users
who don't know the implementation detail.
This patch changes the logic to calculate the common ancestor for every
"base" changeset separately so we won't (incorrectly) select "source" which
is an ancestor of the destination.
This patch should not change the behavior where all changesets specified by
"--base" have the same branching point(s).
A new situation is: some of the specified changesets could be rebased, while
some couldn't (because they are descendants of the destination, or they do
not share a common ancestor with the destination). The current behavior is
to show "nothing to rebase" and exits with 1.
This patch maintains the current behavior (show "nothing to rebase") even if
part of the "--base" revset could be rebased. A clearer error message may be
"cannot find branching point for X", or "X is a descendant of destination".
The error message issue is tracked by issue5422 separately.
A test is added with all kinds of tricky cases I could think of for now.
Pulkit Goyal <7895pulkit@gmail.com> [Wed, 07 Dec 2016 21:53:03 +0530] rev 30584
py3: utility functions to convert keys of kwargs to bytes/unicodes
Keys of keyword arguments need to be str(unicodes) on Python 3. We have a lot
of function where we pass keyword arguments. Having utility functions to help
converting keys to unicodes before passing and convert back them to bytes once
passed into the function will be helpful. We now have functions named
pycompat.strkwargs(dic) and pycompat.byteskwargs(dic) to help us.
Pulkit Goyal <7895pulkit@gmail.com> [Tue, 06 Dec 2016 06:36:36 +0530] rev 30583
py3: make a bytes version of getopt.getopt()
getopt.getopt() deals with unicodes on Python 3 internally and if bytes
arguments are passed, then it will return TypeError. So we have now
pycompat.getoptb() which takes bytes arguments, convert them to unicode, call
getopt.getopt() and then convert the returned value back to bytes and then
return those value.
All the instances of getopt.getopt() are replaced with pycompat.getoptb().
Jun Wu <quark@fb.com> [Tue, 06 Dec 2016 11:44:49 +0000] rev 30582
parsers: use buffer to store revlog index
Previously, the revlog index passed to parse_index2 must be a "string",
which means we have to read the whole revlog index into memory. This patch
makes the code accept a generic Py_buffer, to be more flexible - it could be
a "string", or anything that implements the buffer interface, like a mmap-ed
region.
Note: ideally we want to remove the "data" field. However, it is still used
in parse_index2:
if (idx->inlined) {
cache = Py_BuildValue("iO", 0, idx->data);
....
}
....
tuple = Py_BuildValue("NN", idx, cache);
....
return tuple;
Its only users are revlogio.parseindex and revlog.__init__:
# revlogio.parseindex
index, cache = parsers.parse_index2(data, inline)
return index, getattr(index, 'nodemap', None), cache
# revlog.__init__
d = self._io.parseindex(indexdata, self._inline)
self.index, nodemap, self._chunkcache = d
Maybe we could move the logic (testing inline and returnning "data" object)
to revlog.py. But that should be a separate patch.
Pulkit Goyal <7895pulkit@gmail.com> [Tue, 06 Dec 2016 06:27:58 +0530] rev 30581
fancyopts: switch from fancyopts.getopt.* to getopt.*
In the next patch, we will be creating a bytes version of getopt.getopt() and
doing that will leave getopt as unused import in fancyopts. So before removing
that there are instances in codebase where instead of importing getopt, we
have used fancyopts.getopt. This patch will switch all those cases so that
the next patch can remove the import of getopt from fancyopts without breaking
things.
Pulkit Goyal <7895pulkit@gmail.com> [Mon, 05 Dec 2016 06:46:51 +0530] rev 30580
py3: use pycompat.fsdecode() to pass to imp.* functions
When we try to pass a bytes argument to a function from imp library, it
returns TypeError as it deals with unicodes internally. So we can't use bytes
with imp.* functions. Hunting through this, I found we were returning bytes
path variable to loadpath() on Python 3.5 (yes most of our codebase is
dealing with bytes on Python 3 especially the path variables). Passing unicode
does not fails the purpose of loding the extensions and a module object is
returned.
Jun Wu <quark@fb.com> [Tue, 06 Dec 2016 17:06:39 +0000] rev 30579
localrepo: use ProgrammingError
This is an example usage of ProgrammingError. Let's start migrating
RuntimeError to ProgrammingError.
The code only runs when devel.all-warnings or devel.check-locks is set, so
it does not affect the end-user experience.
Jun Wu <quark@fb.com> [Tue, 06 Dec 2016 14:57:47 +0000] rev 30578
error: add ProgrammingError
We have requirement to express "this is clearly an error caused by the
programmer". The code base uses RuntimeError for that in some places, not
ideal. So let's add a formal exception for that.
Jun Wu <quark@fb.com> [Mon, 05 Dec 2016 21:36:35 +0000] rev 30577
chgserver: call "load" for new ui objects
After d83ca854fa21, we need to call "ui.load" explicitly to load config
files.
Pulkit Goyal <7895pulkit@gmail.com> [Sun, 04 Dec 2016 23:22:34 +0530] rev 30576
localrepository: remove None as default value of path argument in __init__()
The path variable in localrepository.__init__() has a default value None. So
it gives us a option to create an object to localrespository class without
path variable. But things break if you try to do so. The second line in the
init which will be executed when we try to create a localrepository object
will call os.path.expandvars(path) which returns
TypeError: argument of type 'NoneType' is not iterable
I checked occurrences when it is called and can't find any piece of code
which calls it without path variable. Also if something is calling it, its
should break.
Pulkit Goyal <7895pulkit@gmail.com> [Thu, 01 Dec 2016 13:12:04 +0530] rev 30575
py3: use pycompat.sysstr() in __import__()
__import__() on Python 3 accepts strings which are different from that of
Python 2. Used pycompat.sysstr() to get string accordingly.