Pulkit Goyal <7895pulkit@gmail.com> [Sat, 17 Dec 2016 20:24:46 +0530] rev 30616
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 30615
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 30614
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 30613
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 30612
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 30611
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 30610
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 30609
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 30608
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 30607
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 30606
strutil: drop module which no longer be used
Yuya Nishihara <yuya@tcha.org> [Sun, 16 Oct 2016 16:58:43 +0900] rev 30605
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 30604
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 30603
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 30602
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 30601
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 30600
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 30599
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 30598
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 30597
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 30596
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 30595
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 30594
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 30593
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 30592
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 30591
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 30590
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 30589
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 30588
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 30587
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 30586
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 30585
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 30584
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 30583
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 30582
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 30581
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 30580
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 30579
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 30578
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 30577
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 30576
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 30575
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 30574
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 30573
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 30572
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 30571
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 30570
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.
Pulkit Goyal <7895pulkit@gmail.com> [Wed, 30 Nov 2016 23:51:11 +0530] rev 30569
py3: avoid use of basestring
"In this case, result is a source variable of a list to be returned, it
shouldn't be unicode. Hence we can use bytes instead of basestring here." -Yuya
Pulkit Goyal <7895pulkit@gmail.com> [Wed, 30 Nov 2016 23:38:50 +0530] rev 30568
py3: use unicodes in __slots__
__slots__ in Python 3 accepts only unicodes and there is no harm using
unicodes in __slots__. So just adding u'' is fine. Previous occurences of this
problem are treated the same way.
Mateusz Kwapich <mitrandir@fb.com> [Mon, 21 Nov 2016 08:09:41 -0800] rev 30567
memctx: allow the metadataonlyctx thats reusing the manifest node
When we have a lot of files writing a new manifest revision can be expensive.
This commit adds a possibility for memctx to reuse a manifest from a different
commit. This can be beneficial for commands that are creating metadata changes
without any actual files changed like "hg metaedit" in evolve extension.
I will send the change for evolve that leverages this once this is accepted.
Mateusz Kwapich <mitrandir@fb.com> [Thu, 17 Nov 2016 10:59:15 -0800] rev 30566
localrepo: make it possible to reuse manifest when commiting context
This makes the commit function understand the context that's reusing manifest.
Mateusz Kwapich <mitrandir@fb.com> [Thu, 17 Nov 2016 10:59:15 -0800] rev 30565
manifest: expose the parents() method
Gregory Szorc <gregory.szorc@gmail.com> [Mon, 28 Nov 2016 21:07:51 -0800] rev 30564
httppeer: assign Vary request header last
In preparation for adding another value to it in a subsequent patch.
While I was here, I added some empty lines because walls of text
are hard to read.
Gregory Szorc <gregory.szorc@gmail.com> [Mon, 28 Nov 2016 20:46:42 -0800] rev 30563
wireproto: only advertise HTTP-specific capabilities to HTTP peers (BC)
Previously, the capabilities list was protocol agnostic and we
advertised the same capabilities list to all clients, regardless of
transport protocol.
A few capabilities are specific to HTTP. I see no good reason why we
should advertise them to SSH clients. So this patch limits their
advertisement to HTTP clients.
This patch is BC, but SSH clients shouldn't be using the removed
capabilities so there should be no impact.
Gregory Szorc <gregory.szorc@gmail.com> [Mon, 28 Nov 2016 20:46:59 -0800] rev 30562
protocol: declare transport protocol name
We add an attribute to the HTTP and SSH protocol implementations
identifying the transport so future patches can conditionally
expose capabilities on a per-transport basis.
Mads Kiilerich <madski@unity3d.com> [Wed, 16 Nov 2016 19:45:35 +0100] rev 30561
bdiff: early pruning of common prefix before doing expensive computations
It seems quite common that files don't change completely. New lines are often
pretty much appended, and modifications will often only change a small section
of the file which on average will be in the middle.
There can thus be a big win by pruning a common prefix before starting the more
expensive search for longest common substrings.
Worst case, it will scan through a long sequence of similar bytes without
encountering a newline. Splitlines will then have to do the same again ...
twice for each side. If similar lines are found, splitlines will save the
double iteration and hashing of the lines ... plus there will be less lines to
find common substrings in.
This change might in some cases make the algorith pick shorter or less optimal
common substrings. We can't have the cake and eat it.
This make hg --time bundle --base null -r 4.0 go from 14.5 to 15 s - a 3%
increase.
On mozilla-unified:
perfbdiff -m
3041e4d59df2
! wall 0.053088 comb 0.060000 user 0.060000 sys 0.000000 (best of 100) to
! wall 0.024618 comb 0.020000 user 0.020000 sys 0.000000 (best of 116)
perfbdiff
0e9928989e9c --alldata --count 10
! wall 0.702075 comb 0.700000 user 0.700000 sys 0.000000 (best of 15) to
! wall 0.579235 comb 0.580000 user 0.580000 sys 0.000000 (best of 18)
Yuya Nishihara <yuya@tcha.org> [Sat, 22 Oct 2016 15:02:11 +0900] rev 30560
formatter: add overview of API and example as doctest
Yuya Nishihara <yuya@tcha.org> [Sat, 22 Oct 2016 14:35:10 +0900] rev 30559
ui: factor out ui.load() to create a ui without loading configs (API)
This allows us to write doctests depending on a ui object, but not on global
configs.
ui.load() is a class method so we can do wsgiui.load(). All ui() calls but
for doctests are replaced with ui.load(). Some of them could be changed to
not load configs later.
Anton Shestakov <av6@dwimlabs.net> [Thu, 08 Dec 2016 23:59:36 +0800] rev 30558
hgweb: add missing slash to file log url in rss style
Jun Wu <quark@fb.com> [Wed, 30 Nov 2016 19:23:04 +0000] rev 30557
check-code: add a rule to forbid "cp -r"
See the commit message of the previous patch for the reason. In short,
according to the current POSIX standard, "-r" is "removed", and "-R" is the
current standard way to do "copy file hierarchies".