Commit Graph

19675 Commits

Author SHA1 Message Date
Gregory Szorc
031707bc8e hgweb: remove extra </div>
This was accidentally added in ec5656459cd5.

Differential Revision: https://phab.mercurial-scm.org/D880
2017-10-01 14:02:47 +01:00
Siddharth Agarwal
518409a5b2 changelog: use attrs instead of namedtuple
See http://www.attrs.org/en/stable/why.html#namedtuples for why attrs are
better than namedtuples.

Differential Revision: https://phab.mercurial-scm.org/D868
2017-10-01 03:24:20 -07:00
Siddharth Agarwal
d801d9577c thirdparty: vendor attrs
The attrs package allows defining namedtuple-like classes with no weird
behavior and no runtime performance cost.

This patch vendors in attrs 17.2.0.

# no-check-commit

Differential Revision: https://phab.mercurial-scm.org/D867
2017-10-01 04:14:16 -07:00
Siddharth Agarwal
b969fc3979 python3: don't byte mangle third-party packages
Third-party packages are already expected to be dual-version clean.

Differential Revision: https://phab.mercurial-scm.org/D871
2017-10-01 04:04:18 -07:00
Gregory Szorc
e47e446ff1 commands: rename clone --uncompressed to --stream and document
--uncompressed isn't a very good name and its description in the
help documentation isn't very useful. We refer to this concept as
"stream clones" in a number of places. I think it makes sense to
change the user-facing argument to use the mode --stream. So this
commit does that.

We keep --uncompressed around for backwards compatibility.

While we're here, we overhaul the help docs for streaming clones
to be somewhat useful.

All tests have been updated to reflect the new preferred --stream
argument. A test for backwards compatibility of --uncompressed has
been added.

.. bc::

   `hg clone --stream` should now be used instead of --uncompressed.

   --uncompressed is marked as deprecated and is an alias for --stream.
   There is no schedule for elimination of --uncompressed.

Differential Revision: https://phab.mercurial-scm.org/D864
2017-10-01 11:29:20 +01:00
Gregory Szorc
21e2f0ca5a commands: remove suggestion to clone via cp -al
This was added in 021454637716 in 2006. This may be possible but it
seems like a bad idea to even suggest it.

Differential Revision: https://phab.mercurial-scm.org/D863
2017-10-01 10:17:11 +01:00
Gregory Szorc
28b7db089e hgweb: add HTML elements to control whitespace settings for annotate
Building on top of the new URL query string arguments to control
whitespace settings for annotate, this commit adds HTML checkboxes
reflecting the values of these arguments to the paper and gitweb
themes.

The actual diff settings are now exported to the templating layer.
The HTML templates add these as data-* attributes so they are
accessible to the DOM.

A new <form> with various <input> elements is added. The <form>
is initially hidden via CSS. A shared JavaScript function (which
runs after the <form> has been rendered but before the annotate
HTML (because annotate HTML could take a while to load and we want
the form to render quickly) takes care of setting the checked state
of each box from the data-* attributes. It also registers an event
handler to modify the URL and refresh the page whenever the checkbox
state is changed.

I'm using the URLSearchParams interface to perform URL manipulation.
https://developer.mozilla.org/en-US/docs/Web/API/URLSearchParams tells
me this may not be supported on older web browsers. Yes, apparently
the web API didn't have a standard API to parse and format query
strings until recently. Hence the check for the presence of this
feature in the JavaScript. If the browser doesn't support the
feature, the <form> will remain hidden and behavior will like it
currently is. We could polyfill this feature or implement our own
query string parsing. But I'm lazy and this could be done as a
follow-up if people miss it.

We could certainly expand this feature to support more diff options
(such as lines of context). That's why the potentially reusable code
is stored in a reusable place. It is also certainly possible to
add diff controls to other pages that display diffs. But since
Mozillians are making noise about controlling which revisions
annotate shows, I figured I'd start there.

.. feature::

   Control whitespace settings for annotation on hgweb

   /annotate URLs on hgweb now accept query string arguments to
   influence how whitespace changes impact results.

   The arguments "ignorews," "ignorewsamount," "ignorewseol," and
   "ignoreblanklines" now have the same meaning as their [annotate]
   config section counterparts. Any provided setting overrides the
   server default.

   HTML checkboxes have been added to the paper and gitweb themes
   to expose current whitespace settings and to easily modify the
   current view.

Differential Revision: https://phab.mercurial-scm.org/D850
2017-09-30 09:01:36 +01:00
Gregory Szorc
0ed01b356d hgweb: query string arguments to control whitespace for annotate
This feature should hopefully be pretty straightforward. We simply
examine some query string arguments to feed into the diff options.

The function to obtain the diff options has been factored into its
own generic function to facilitate an upcoming change to the HTML
interface and to enable diff settings to be controlled via the same
query string arguments on other web commands.

The test output for "ignoreblanklines" didn't change. I'm not sure
why. Our test coverage for --ignore-blank-lines isn't great and I
can't figure out how to make this diff setting do anything meaningful.
On a very brief examination of the code, it is possible the setting
doesn't work because it is operating at the line level and blank lines
detection needs to examine multiple lines. But I'm not an expert in
this code, so I'm not sure.

Differential Revision: https://phab.mercurial-scm.org/D849
2017-09-30 09:08:01 +01:00
Boris Feld
980fc3e8a0 obsolete: clean createmarkers part about operation
I will add another experiment in createmarkers, add a comment and some blank
lines for aesthetic sake.

Differential Revision: https://phab.mercurial-scm.org/D532
2017-07-06 14:46:07 +02:00
Augie Fackler
f33ab87734 posix: replace superfluous pass statement with explicit return 2017-09-30 07:45:18 -04:00
Augie Fackler
a7f25c02bf subrepo: remove superfluous pass statements 2017-09-30 07:45:51 -04:00
Augie Fackler
c01b8ec959 registrar: remove superfluous pass statements 2017-09-30 07:45:41 -04:00
Augie Fackler
67c46dd503 patch: remove superfluous pass statements 2017-09-30 07:45:07 -04:00
Augie Fackler
158a3fa960 obsolete: remove superfluous pass statements 2017-09-30 07:44:55 -04:00
Augie Fackler
8001b8c677 match: remove superfluous pass statements 2017-09-30 07:44:45 -04:00
Augie Fackler
bd4e5e07d7 localrepo: remove superfluous pass statements 2017-09-30 07:44:34 -04:00
Augie Fackler
3519ee0e52 hgweb: remove superfluous pass statements 2017-09-30 07:44:20 -04:00
Augie Fackler
3ae868f45f formatter: remove superfluous pass statements 2017-09-30 07:44:08 -04:00
Augie Fackler
c4411f7b18 exchange: remove superfluous pass statements 2017-09-30 07:43:53 -04:00
Augie Fackler
74971085d5 commandserver: remove superfluous pass statements 2017-09-30 07:43:40 -04:00
Augie Fackler
b6ffc23eeb cmdutil: remove superfluous pass statements 2017-09-30 07:43:26 -04:00
Augie Fackler
e20b31e798 byterange: remove superfluous pass statements 2017-09-30 07:43:11 -04:00
Augie Fackler
6164c3ecf5 branchmap: remove superfluous pass statements 2017-09-30 07:42:59 -04:00
Martin von Zweigbergk
25360ba00c merge with stable 2017-09-30 07:52:48 -07:00
Yuya Nishihara
183298cb9f copytrace: use ctx.mutable() instead of adhoc constant of non-public phases 2017-09-22 22:45:02 +09:00
Boris Feld
76b0c9eaa7 exchange: fix test for remote support of binary phases
If the remote do not support phases, the "get" call will return None. We
change that default return to empty tuple to fix the membership testing.

This was a bug in the initial series. Thanks to yuja for catching this.
2017-09-30 10:09:29 +01:00
Gregory Szorc
23c7474f57 exchange: perform stream clone with clone bundle with --uncompressed
Previously, `hg clone --uncompressed` would always clone from the
origin server, even if a streaming clone bundle were available.

With this change, we invoke the clone bundle mechanism before the
stream clone mechanism, giving clone bundles the opportunity to
handle --uncompressed (which is mapped to pullop.streamclonepreferred).

The clone bundle filtering code now filters out entries that aren't
stream clones when a stream clone is requested. If a stream clone
clone bundle entry is present, it will be used. Otherwise, the client
will fall back to a server-based streaming clone.

.. feature::

   `hg clone --uncompressed` uses clone bundles when possible

Differential Revision: https://phab.mercurial-scm.org/D833
2017-09-28 15:24:54 +01:00
Yuya Nishihara
e9abfd594c py3: work around bytes/unicode divergence in parsedate() 2017-09-27 19:27:41 +09:00
Yuya Nishihara
e00ce9d712 py3: replace bytes[n] with slicing in checkwinfilename() 2017-09-27 19:13:43 +09:00
Yuya Nishihara
4bacb6f2e6 py3: manually escape control character to be embedded in win filename error 2017-09-27 19:11:28 +09:00
Yuya Nishihara
e896c6e733 py3: remove use of str() in hgwebdir
'%d' can't be used here since port may be either integer or byte string.
2017-09-27 19:04:32 +09:00
Jun Wu
36348a7c83 config: use copy-on-write to improve copy performance
Previously, chg's `verify` call could take 30+ms loading and checking new
config files. With one socket redirection, that adds up to around 70ms,
which is a lot for fast commands (ex. `bookmark --hidden`).

When investigating closer, A lot of time was spent on actually spent on ui
copying, which is mainly about `config.config` and `dict` copying.

This patch makes that 20x faster by adopting copy-on-write. The
copy-on-write is performed at config section level.

Before:

  In [1]: %timeit ui.copy()
  100 loops, best of 3: 2.32 ms per loop

After:

  In [1]: %timeit ui.copy()
  10000 loops, best of 3: 128 us per loop

2ms may look not that bad, but it adds up pretty quickly with multiple
calls. A typical chg run may call it 4 times, which is about 10ms.

Differential Revision: https://phab.mercurial-scm.org/D808
2017-09-27 18:07:48 -07:00
Pulkit Goyal
eecf1e98ad py3: use pycompat.bytestr instead of str
Differential Revision: https://phab.mercurial-scm.org/D855
2017-09-30 15:48:08 +05:30
Pulkit Goyal
2c8e44b5f7 py3: explicitly convert dict.keys() and dict.items() into a list
Differential Revision: https://phab.mercurial-scm.org/D853
2017-09-30 15:45:15 +05:30
Pulkit Goyal
cc54c3026e py3: use '%d' instead of '%s' for integers
Differential Revision: https://phab.mercurial-scm.org/D856
2017-09-30 18:02:53 +05:30
Pulkit Goyal
64c3d74820 py3: use pycompat.strkwargs() before passing a dict as keyword argument
Differential Revision: https://phab.mercurial-scm.org/D854
2017-09-30 15:46:36 +05:30
Pulkit Goyal
9c599401c3 py3: return False early while checking whether None is a key in lazymanifest
In this patch we returns False early if we are trying to check whether None is a
key in lazymanifest. The reason I added a diff is that on Python 3, it goes into
the lazy manifest code an returns a TypeError. I checked with Durham that
whether None can be a possible key in lazymanifest and he said "no". So it's
safe to have this if statement.

This fixes `hg merge` on Python 3.

Differential Revision: https://phab.mercurial-scm.org/D852
2017-09-30 05:22:22 +05:30
Martin von Zweigbergk
22ecef9ff9 dirstate: use keyword arguments to clarify status()'s callers
The arguments are especially non-obvious because the order is
different from dirstate.walk().

Differential Revision: https://phab.mercurial-scm.org/D847
2017-09-29 14:49:05 -07:00
Martin von Zweigbergk
38828a858a dirstate: use keyword arguments to clarify walk()'s callers
The arguments are especially non-obvious because the order is
different from dirstate.status().

Differential Revision: https://phab.mercurial-scm.org/D846
2017-09-29 14:19:36 -07:00
Jun Wu
4129970972 rebase: move bookmarks with --keep (issue5682)
This is a regression caused by 80d53a39fbcc. We have documented the behavior
in rebase help:

    Rebase will destroy original commits unless you use "--keep". It will
    also move your bookmarks (even if you do).

So let's restore the old behavior.

It is done by changing `scmutil.cleanupnodes` to accept more information so
a node could have different "movement destination" from "successors". It
also helps simplifying the callsite as a side effect - the special bookmark
movement logic in rebase is removed.

Differential Revision: https://phab.mercurial-scm.org/D727
2017-09-18 10:54:00 -07:00
Martin von Zweigbergk
4af5345130 cleanupnodes: rename "mapping" to "replacements"
The next patch will pass in overrides for bookmark moves, which is a
mapping itself, so let's rename "mapping" to "replacements" to
distinguish them better.

Differential Revision: https://phab.mercurial-scm.org/D749
2017-09-20 09:32:26 -07:00
Martin von Zweigbergk
5e9148e31d cleanupnodes: separate out bookmark destination calculation from actual update
We will soon want to pass in overrides for bookmark movements and this
will make that patch simpler. I also think this makes the code easier
to follow regardless of the later patch.

Differential Revision: https://phab.mercurial-scm.org/D748
2017-09-20 09:10:43 -07:00
Mark Thomas
6fc38713f5 ui: check for progress singleton when clearing progress bar (issue5684)
A combination of wrapping `ui` and progress bars interrupted by exceptions can
lead to the progress bar not being cleared when the exception error is printed.
This results in corrupted-looking output like this:

```
updating [===============================>                        ] 1/2u
nresolved conflicts (see hg resolve, then hg rebase --continue)
```

This is because in `ui._progclear`, we only check the local reference to the
progress bar, not whether or not there is an instance of the singleton.  When a
progress bar is interrupted by an exception, the exception printing in
`scmutil.callcatch` uses the original instance of the `ui` object, not the
wrapped copy that has `_progbar` set.

When consider whether or not to clear the progress bar, check for the existence
of the singleton, rather than just whether or not we have a local reference to
it.

Differential Revision: https://phab.mercurial-scm.org/D743
2017-09-20 09:55:52 -07:00
Boris Feld
7035ea8d86 hgwebdir: read 'web.template' untrusted
The 'hgweb_mod.py' version of this read it untrusted. For consistency we align
the two versions of this code.
2017-09-15 18:57:50 +02:00
Durham Goode
ea5a821949 ssh: fix flakey ssh errors on BSD systems
This is a trivial backport of 9f516a26a962 performed by
augie@google.com, but the change is still really Durham's not mine, so
I [augie] am leaving him as the author.
2017-09-11 15:59:18 -07:00
Martin von Zweigbergk
01e8a04410 repair: preserve phase also when not using generaldelta (issue5678)
It seems like we used to pick the oldest possible version of the
changegroup to use for bundles created by the repair module (used
e.g. by "hg strip" and for temporary bundles by "hg rebase"). I tried
to preserve that behavior when I created the changegroup.safeversion()
method in 77f74106b264 (changegroup: introduce safeversion(),
2016-01-19).

However, we have recently chagned our minds and decided that these
commands are only used locally and downgrades are unlikely. That
decicion allowed us to start adding obsmarker and phase information to
these bundles. However, as the bug report shows, it means we get
different behavior e.g. when generaldelta is not enabled (because when
it was enabled, it forced us to use bundle2). The commit that actually
caused the reported bug was 26d535788092 (strip: include phases in
bundle (BC), 2017-06-15).

So, since we now depend on having more information in the bundles,
let's make sure we instead pick the newest possible changegroup
version.

Differential Revision: https://phab.mercurial-scm.org/D715
2017-09-14 11:16:57 -07:00
Matt Harbison
19d34e4d32 debugssl: allow a URL to be specified without a local repository
This was the original intent, but I bungled the logic.  Otherwise if there is a
certificate chain issue, the repository can't be cloned in order for there to be
a repo object.  I think I missed this case because I was inside of a Mercurial
clone as I was originally developing and testing this.
2017-08-29 16:38:10 -04:00
Durham Goode
5a20b12a39 dirstate: move parents source of truth to dirstatemap
As part of moving dirstate storage to its own class, let's move the source of
truth for the dirstate parents to dirstatemap. This requires that dirstate._pl
no longer be a cache, and that all sets go through dirstatemap.setparents.

Differential Revision: https://phab.mercurial-scm.org/D759
2017-09-26 03:56:20 -07:00
Durham Goode
2f94dc7bc7 dirstate: move parent reading to the dirstatemap class
As part of moving dirstate storage logic to a separate class, let's move the
function that reads the parents from the file. This will allow extensions to
write dirstate's that store the parents in other ways.

Differential Revision: https://phab.mercurial-scm.org/D758
2017-09-26 03:56:20 -07:00
Durham Goode
deed83f53e dirstate: move opendirstatefile to dirstatemap
As part of moving the dirstate storage logic to another class, let's move
opendirstatefile to dirstatemap. This will allow extensions to replace the
pending abstraction.

Future patches will move the consumers of _opendirstatefile into dirstatemap as
well.

Differential Revision: https://phab.mercurial-scm.org/D757
2017-09-26 03:56:20 -07:00