Commit Graph

18321 Commits

Author SHA1 Message Date
Pulkit Goyal
438ffed247 py3: use list of bytes rather than bytestring while extending bytes into lists
Python 2:

>>> ls = []
>>> ls.extend(b'abc')
>>> ls
['a', 'b', 'c']

Python 3:

>>> ls = []
>>> ls.extend(b'abc')
>>> ls
[97, 98, 99]

So to make sure things work fine in Py3, this patch does:

>>> ls = []
>>> ls.extend([b'a', b'b', b'c'])
>>> ls
[b'a', b'b', b'c']

After this `hg log -G` works!
2017-05-04 04:38:20 +05:30
Pulkit Goyal
9b8ba742a1 py3: use pycompat.byteskwargs to converts kwargs to bytes
baseformatter._item must contain both keys and values in bytes. So to make
sure that, we convert the opts back to bytes.
2017-05-04 01:12:14 +05:30
Pulkit Goyal
a52d872f30 py3: make adefaults keys str to be compatible with getattr
getattr passes a str value of the attribute to be looked and keys in adefaults
dict are bytes which resulted in AttributeError. This patch abuses r'' to
make the keys str.
2017-05-04 00:44:53 +05:30
Pulkit Goyal
c103b5a583 py3: abuse r'' to access keys in keyword arguments 2017-05-03 15:41:28 +05:30
Pulkit Goyal
ea140325b7 py3: use pycompat.bytechr instead of chr 2017-05-03 15:37:51 +05:30
Pulkit Goyal
b69219d4a1 py3: use %d to format integers into bytestrings 2017-05-05 01:41:54 +05:30
Pulkit Goyal
485ee65947 py3: use pycompat.bytestr instead of bytes 2017-05-05 01:26:49 +05:30
Pulkit Goyal
7b5053db1f py3: slice over bytes to prevent getting ascii values 2017-05-05 01:26:13 +05:30
Pulkit Goyal
0df2c78a07 py3: use encoding.unitolocal instead of .encode(encoding.encoding) 2017-04-08 11:02:37 +05:30
Durham Goode
4f79467143 rebase: use matcher to optimize manifestmerge
The old merge code would call manifestmerge and calculate the complete diff
between the source to the destination. In many cases, like rebase, the vast
majority of differences between the source and destination are irrelevant
because they are differences between the destination and the common ancestor
only, and therefore don't affect the merge. Since most actions are 'keep', all
the effort to compute them is wasted.

Instead, let's compute the difference between the source and the common ancestor
and only perform the diff of those files against the merge destination. When
using treemanifest, this lets us avoid loading almost the entire tree when
rebasing from a very old ancestor. This speeds up rebase of an old stack of 27
commits by 20x.

In mozilla-central, without treemanifest, when rebasing a commit from
default~100000 to default, this speeds up the manifestmerge step from 2.6s to
1.2s.  However, the additional diff adds an overhead to all manifestmerge calls,
especially for flat manifests. When rebasing a commit from default~1 to default
it appears to add 100ms in mozilla-central. While we could put this optimization
behind a flag, I think the fact that it makes merge O(number of changes being
applied) instead of O(number of changes between X and Y) justifies it.
2017-05-03 10:43:59 -07:00
Martin von Zweigbergk
feebdd58e5 changegroup: delete unused 'bundlecaps' argument (API) 2017-05-02 23:47:10 -07:00
Martin von Zweigbergk
dfa0866489 localrepo: reuse exchange.bundle2requested()
It seems like localrepo.getbundle() is trying to do the same thing, so
let's just call the method. That way we get the same condition as
there (matching any "HG2" prefix, not only "HG20").
2017-05-03 10:33:26 -07:00
Pulkit Goyal
9039b3baeb py3: use raw strings while accessing class.__dict__
The keys of class.__dict__ are unicodes on Python 3.
2017-04-28 01:13:07 +05:30
Pulkit Goyal
5e026b2f2b py3: handle opts correctly for hg add
opts in add command were passed again to cmdutil.add() as kwargs so we need
to convert them again to str. Intstead we convert them to bytes when passing
scmutil.match(). Opts handling is also corrected for all the functions which
are called from cmdutil.add().
2017-04-25 01:52:30 +05:30
Pulkit Goyal
524f812ff5 py3: handle opts correctly for rollback
dryrun and force are just check for None, the value is not used. So its better
to leave opts as unicodes as that wont harm us.
2017-04-24 04:32:04 +05:30
Pulkit Goyal
6458308e66 py3: handle opts correctly for unbundle
There is just a check whether the value is None or not. So even having
optupdate as unicodes won't harm us.
2017-04-21 15:04:32 +05:30
Pulkit Goyal
deceb69003 py3: convert opts to bytes in cmdutil.dorecord()
commands.commit() calls cmdutil.dorecord() where opts are passed as unicodes
being keyword arguments. This patch converts them back to bytes as they are
required.
2017-04-21 02:20:46 +05:30
Pulkit Goyal
bcae1e9ab7 py3: make sure opts are passed and used correctly in help command
opts are converted back to bytes in help.help_() where they are used.
Before that it's ensured that we have a bytes value for keep variable.
2017-04-28 00:49:30 +05:30
Pulkit Goyal
13bba2b158 py3: handle opts uniformly in commands.py
Since keyword arguments can't be bytes on Python 3, we converted then to
unicodes before passing into different command functions. We need to adopt a
certain pattern to convert opts back to bytes. Following are some of the
functions which are called from inside these command functions and should
always be feeded bytes to follow the right behaviour.

ui.fomattter()
scmutil.match()
patch.diffallopts()
hg.peer()
cmdutil.{show_changeset|copy|graphrevs|checkunsupportedflag}
server.{createservice|runservice}

There are few commands which are left out where opts is again passed to a
function as keyword arguments or converting opts back to bytes is kind of
not necessary. Those are cat, revert, help, unbundle and rollback. Following
patches will deal with them. This patch apart from these five commands,
convert opts back to bytes for rest of the commands.

This fixes a lot of things which are hidden like --git works now. Similarly
more flags of commands which run on Python 3 currently get fixed.
2017-05-03 15:25:06 +05:30
Augie Fackler
ec67fe37fb merge with stable 2017-05-04 00:26:55 -04:00
Matt Harbison
8f2d75af2f help: call out specific replacement configuration settings
As an aside, I'm having trouble parsing the help text meaning for HG when it is
unset or empty.  How can it be the frozen name or searched if it is empty?
2017-05-03 22:56:53 -04:00
Matt Harbison
44c7a911a4 help: spelling fixes 2017-05-03 22:07:47 -04:00
Matt Harbison
f50de2183a help: attempt to clarify that pager usage is not output length based
This may be too subtle of a change to get the point across, but when I first
read the original text, I thought maybe the pager would only be invoked if
writing more than a screenful.  The distinction between this and a pager that
simply exits after printing less than a screenful is important on Windows, given
the inability of `more` to color output.
2017-05-03 22:05:23 -04:00
Matt Harbison
ed8a9665e2 help: document color/pager pitfalls on Windows
Even though I figured this out a few weeks ago, I was initially puzzled where
the color went when I upgraded to 4.2 on a different Windows machine.  Let's
point users reading the help into the right direction.

I wonder if we should be even more explicit about cmd.exe/MSYS/pager/color
interplay, but at least all of the breadcrumbs are here (I think).
2017-05-03 21:58:11 -04:00
Jun Wu
58df20579d webcommands: use fctx.isbinary 2017-05-03 18:04:43 -07:00
Jun Wu
04c3104f68 annotate: use fctx.isbinary 2017-05-03 18:03:38 -07:00
Jun Wu
6e4fd814fb fileset: use fctx.isbinary instead of util.binary(fctx.data())
filectx provides "isbinary" to test if the data is binary. Let's use it.

This enables other filectx implementations (like LFS) to override the
isbinary test.
2017-05-03 18:02:00 -07:00
Siddharth Agarwal
d28bc68b23 internals: document that "branches" is a legacy wire command
Modern clients use a different discovery mechanism.
2017-05-03 14:07:14 -07:00
Durham Goode
5566fd666f match: make subinclude construction lazy
The matcher subinclude functionality allows us to have .hgignore files that
include subdirectory hgignore files. Today it parses the entire repo at once,
even if we only need to test a file in one subdirectory. This patch makes the
subinclude tree creation lazy, which speeds up matcher creation significantly in
large repos with very large trees of ignore patterns.
2017-05-03 10:30:57 -07:00
Martin von Zweigbergk
971305ce1d bisect: allow resetting with unfinished graft/rebase/etc
"hg bisect --reset" just deletes the state file (it doesn't move back
to the starting point like rebase does); it can not conflict with an
ongoing rebase etc.

checkunfinished() has this documentation:

  It's probably good to check this right before bailifchanged().

So that's where I moved it.
2017-05-03 09:09:44 -07:00
Pierre-Yves David
a5a7702af1 pager: drop the support for 'pager.enable=<bool>'
This option was never released except for a release candidate. Dropping
compatibility with this option will free the 'pager.enable' config option for
other usage in the future.
2017-05-02 17:18:13 +02:00
Pierre-Yves David
bf9fa9e05b pager: rename 'pager.enable' to 'ui.paginate'
This aligns with what we do for color (see cea7a760c58d). Pager is a central
enough notion that having the master config in the [ui] section makes senses. It
will helps with consistency, discoverability. It will also help having a simple
and clear example hgrc mentioning pager.

The previous form of the option had never been released in a non-rc version but
we keep it around for convenience. If both are set, 'ui.pager' take priority.
2017-05-01 16:36:50 +02:00
Pierre-Yves David
f6556e7dce color: special case 'always' in 'ui.color'
This lift the confusing case, where 'ui.color=always' would actually not always
use color.
2017-05-02 20:19:09 +02:00
Pierre-Yves David
9b05154b04 color: turn 'ui.color' into a boolean (auto or off)
Previously, 'ui.color=yes' meant "always show color", While
"ui.color=auto" meant "use color automatically when it appears
sensible".

This feels problematic to some people because if an administrator has
disabled color with "ui.color=off", and a user turn it back  on using
"color=on", it will get surprised (because it breaks their output when
redirected to a file.) This patch changes ui.color=true to only move the
default value of --color from "never" to "auto".

I'm not really in favor of this changes as I suspect the above case will
be pretty rare and I would rather keep the logic simpler. However, I'm
providing this patch to help the 4.2 release in the case were others
decide to make this changes.

Users that want to force colors without specifying --color on the
command line can use the 'ui.formatted' config knob, which had to be
enabled in a handful of tests for this patch.

Nice summary table (credit: Augie Fackler)

That is, before this patch:

+--------------------+--------------------+--------------------+
|                    | not a tty          | a tty              |
|                    | --color not set    | --color not set    |
|                    |                    |                    |
+--------------------+--------------------+--------------------+
| [ui]               |                    |                    |
| color (not set)    | no color           | no color           |
|                    |                    |                    |
+--------------------+--------------------+--------------------+
| [ui]               |                    |                    |
| color = auto       | no color           | color              |
|                    |                    |                    |
+--------------------+--------------------+--------------------+
| [ui]               |                    |                    |
| color = yes        | *color*            | color              |
|                    |                    |                    |
+--------------------+--------------------+--------------------+
| [ui]               |                    |                    |
| color = no         | no color           | no color           |
|                    |                    |                    |
+--------------------+--------------------+--------------------+
(if --color is specified, it always clobbers the setting in [ui])

and after this patch:

+--------------------+--------------------+--------------------+
|                    | not a tty          | a tty              |
|                    | --color not set    | --color not set    |
|                    |                    |                    |
+--------------------+--------------------+--------------------+
| [ui]               |                    |                    |
| color (not set)    | no color           | no color           |
|                    |                    |                    |
+--------------------+--------------------+--------------------+
| [ui]               |                    |                    |
| color = auto       | no color           | color              |
|                    |                    |                    |
+--------------------+--------------------+--------------------+
| [ui]               |                    |                    |
| color = yes        | *no color*         | color              |
|                    |                    |                    |
+--------------------+--------------------+--------------------+
| [ui]               |                    |                    |
| color = no         | no color           | no color           |
|                    |                    |                    |
+--------------------+--------------------+--------------------+
(if --color is specified, it always clobbers the setting in [ui])
2017-05-02 20:01:54 +02:00
Pierre-Yves David
28b8d7eb26 pager: document the 'pager.enable' option
The 'config' helps was missing help about pager enabling/disabling.
2017-05-01 16:43:43 +02:00
Pierre-Yves David
50e449e083 pager: advertise the config option in the default hgrc
Same as for 'ui.color', this is a critical part of the UI and we want user to
find this config knob easily.
2017-05-01 18:07:23 +02:00
Pierre-Yves David
ba569a8325 pager: document the 'pager' config section
There as a 'hg help pager' section but the 'hg help config.pager' was missing.
2017-05-01 16:52:11 +02:00
Pierre-Yves David
0600a78b19 config: drop pager from the recommended extension
The extension is deprecated, we should having exposing it to users.
2017-05-01 15:51:57 +02:00
Pierre-Yves David
c674366f10 config: use "churn" as an example extension
"Churn" is not the useful example we have, but this is the one used in
'hg help config.extensions'. As we need something to replace the deprecated
'pager' extension in the example config, we are adding 'churn'.
2017-05-01 15:51:47 +02:00
Pulkit Goyal
fb9e5b4f21 py3: use %d instead of %s for integers
dispatch._runcatch() always returns an integer value.
2017-04-21 01:13:18 +05:30
Pulkit Goyal
cb5518387e py3: make posix.getuser return a bytes 2017-04-21 00:53:38 +05:30
Pulkit Goyal
ce6291f190 py3: replace str with bytes in isinstance() 2017-04-20 19:57:16 +05:30
Pulkit Goyal
c5fa590c26 py3: use pycompat.bytestr() instead of str()
This is because str() on python 3 return unicodes
2017-04-27 09:49:57 +05:30
Pulkit Goyal
ba8a84e565 py3: alias long to int on Python 3 2017-04-20 19:51:37 +05:30
Jun Wu
3c7a9be1c9 filelog: fix parsemeta docstring
40c4e7d0117e changed the return type of filelog.parsemeta but forgot to
update its docstring.
2017-05-02 22:39:14 -07:00
Martin von Zweigbergk
eb6e7c0205 util: remove doc of long gone 'targetsize' argument
Gone since 89c808398d69 (chunkbuffer: removed unused method and arg,
2007-10-11).
2017-05-02 10:20:44 -07:00
Pierre-Yves David
95ea84f11b cleanup: drop the deprecated 'localrepo._link' method
This was deprecated in favor of 'localrepo.wvfs.islink'. We can now drop it for the
future 4.3.
2017-05-02 02:05:39 +02:00
Pierre-Yves David
258c50d8f2 cleanup: drop the deprecated 'localrepo.wfile' method
This was deprecated in favor of 'localrepo.wvfs.join'. We can now drop it for the
future 4.3.
2017-05-02 02:04:55 +02:00
Pierre-Yves David
511036e5cd cleanup: drop the deprecated 'localrepo.join' method
This was deprecated in favor of 'localrepo.vfs.join'. We can now drop it for the
future 4.3.
2017-05-02 02:03:56 +02:00
Pierre-Yves David
18be67b624 cleanup: drop the deprecated 'localrepo.tag' method
This was deprecated in favor of 'mercurial.tags.tag'. We can now drop it for the
future 4.3.
2017-05-02 02:03:04 +02:00