Commit Graph

34279 Commits

Author SHA1 Message Date
Gregory Szorc
1e024e0e3a cext: move braces for control statements to same line
This seems to be the prevailing style in the code by a wide margin.

Differential Revision: https://phab.mercurial-scm.org/D907
2017-10-02 19:02:43 +01:00
Saurabh Singh
786710798c registrar: fixing typo in comment
I was just going through the module and noticed the typo. This commit
fixes 'onfalure' -> 'onfailure'.

Differential Revision: https://phab.mercurial-scm.org/D906
2017-10-02 19:17:04 +01:00
Alex Gaynor
dd422bc1d6 style: never put multiple statements on one line
Differential Revision: https://phab.mercurial-scm.org/D905
2017-09-29 15:49:20 +00:00
Siddharth Agarwal
ba2d76cf38 annotate: mark lines affected by skip-annotate with *
This is to prevent weird surprises from happening with skips being attributed
to the wrong changeset.

.. feature::

   `hg annotate --skip` now prints a `*` on lines with skipped revisions

Differential Revision: https://phab.mercurial-scm.org/D900
2017-10-02 18:18:57 +01:00
Siddharth Agarwal
45633c900e annotate: track whether a particular annotation was the result of a skip
We're going to expose this information in the UI in an upcoming patch.

Differential Revision: https://phab.mercurial-scm.org/D899
2017-10-02 02:34:47 -07:00
Siddharth Agarwal
ca691a7bec annotate: introduce attr for storing per-line annotate data
We're going to extend this a bit -- at first by simply adding whether this was
a skipped child. We're well on our way to outgrowing tuples, though -- adding
more and more fields to tuples becomes annoying very quickly.

Differential Revision: https://phab.mercurial-scm.org/D898
2017-10-02 02:34:47 -07:00
Siddharth Agarwal
26ea4c9f32 context: rename local 'attr' to 'attr_'
In the next diff we're going to import mercurial.thirdparty.attr, and pyflakes
complains about this if this rename isn't done.

Differential Revision: https://phab.mercurial-scm.org/D897
2017-10-02 02:34:47 -07:00
Siddharth Agarwal
87602d16ba annotate: move annotatepair unit tests to a separate file
In upcoming patches the output is going to be significantly longer than it is
today, and doctests don't allow wrapping the output.

Differential Revision: https://phab.mercurial-scm.org/D896
2017-10-02 02:34:47 -07:00
Siddharth Agarwal
3a77727405 check-code: allow an exception for camelcase where required
unittest has a `maxDiff` parameter which has to be set to `None` in order for
large enough failure diffs to be displayed. Add a comment to disable the
camelcase check for `self.maxDiff = None` lines.

Differential Revision: https://phab.mercurial-scm.org/D895
2017-10-02 02:34:47 -07:00
Augie Fackler
5912fbc099 url: use native strings for header values
Differential Revision: https://phab.mercurial-scm.org/D889
2017-10-01 12:16:34 -04:00
Augie Fackler
3d427e2c85 keepalive: python 3 portability tweaks
Differential Revision: https://phab.mercurial-scm.org/D888
2017-10-01 12:15:53 -04:00
Augie Fackler
c388df1839 httppasswordmgrdbproxy: specify exact arguments
We only ever call these functions in a single way, so let's just
actually specify them. We need to do some string/bytes encoding
dancing here for Python 3, so it'll help to know what arguments we
need to convert.

# no-check-commit because I'm modifying functions that check-commit
does not like.

Differential Revision: https://phab.mercurial-scm.org/D885
2017-10-01 07:29:51 -04:00
Yuya Nishihara
b12606055b formatter: fix default list/dict generator to be evaluated more than once
Before, _hybrid.gen must be a generator which could be consumed only once.
It was okay in templatekw.py since template keywords are functions which
create temporary hybrid objects, but the formatter doesn't work in that way.

To work around the issue, this patch makes _hybrid.gen optionally be a
function returning a generator.

Thanks to Pulkit for finding this issue.
2017-10-01 08:37:04 +01:00
Yuya Nishihara
d852dda377 doctest: drop hack to run py2/3 tests selectively
All doctests pass on Python 3.
2017-09-27 21:38:48 +09:00
muxator
a9aa7ba9de docker: try to follow the best practices for writing Dockerfiles
Merged multiple RUN instructions and sorted the arguments alphabetically
Reference: https://docs.docker.com/engine/userguide/eng-image/dockerfile_best-practices/
2017-10-01 01:02:22 +02:00
Boris Feld
42fd0705ec effectflag: document effect flag
Differential Revision: https://phab.mercurial-scm.org/D542
2017-08-24 18:40:30 +02:00
Boris Feld
0f13d1fb7b effectflag: detect when diff changed
Store in effect flag when the diff changed between the predecessor and
its successors.

Comparing the diff is not easy because we do not want to incorrectly detect a
2017-07-06 15:00:07 +02:00
Boris Feld
183e19c0fb effectflag: detect when meta changed
Store in effect flag when the meta changed between the predecessor and its
successors. We blacklisted some known meta that would always changed when
another flag change. For example rebase would always add a meta rebase-source
while the effect flag parents will already detect this situation.

It can happens with various hg commands.

Differential Revision: https://phab.mercurial-scm.org/D540
2017-07-06 14:58:44 +02:00
Boris Feld
cfcad75689 effectflag: detect when parents changed
Store in effect flag when the parents changed between the predecessor and
its successors.

It can happens with "hg rebase" or "hg grab".

Differential Revision: https://phab.mercurial-scm.org/D539
2017-07-06 14:56:16 +02:00
Boris Feld
fbe68ab2ed effectflag: detect when branch changed
Store in effect flag when the branch changed between the predecessor and
its successors.

It can happens with "hg branch" + "hg commit --amend", "hg branch" + "hg
amend" or "histedit".

Differential Revision: https://phab.mercurial-scm.org/D538
2017-07-06 14:55:12 +02:00
Boris Feld
bd49de9658 effectflag: detect when date changed
Store in effect flag when the date changed between the predecessor and
its successors.

It can happens with "hg commit --amend -d", "hg amend -d" or "histedit".

Differential Revision: https://phab.mercurial-scm.org/D537
2017-07-06 14:54:22 +02:00
Boris Feld
dbe4674ce5 effectflag: detect when user changed
Store in effect flag when the user changed between the predecessor and its
successors.

It can happens with "hg commit --amend -u" or "histedit".

Differential Revision: https://phab.mercurial-scm.org/D536
2017-07-06 14:53:48 +02:00
Boris Feld
802a17caef effectflag: detect when description changed
Store in effect flag when the description changed between the predecessor and
its successors.

It can happens with "hg commit --amend -e", "hg amend -e" or "histedit".

Differential Revision: https://phab.mercurial-scm.org/D535
2017-07-06 14:52:34 +02:00
Boris Feld
8d98ff8200 tests: add tests for effect flags
Add all the tests in this patch, it makes the patch quite big but will clarify
the following patches impact on tests.

Differential Revision: https://phab.mercurial-scm.org/D534
2017-07-06 14:51:08 +02:00
Boris Feld
f17532cf73 effectflag: store an empty effect flag for the moment
The idea behind effect flag is to store additional information in obs-markers
about what changed between a changeset and its successor(s). It's a low-level
information that comes without guarantees.

This information can be computed a posteriori, but only if we have all
changesets locally. This is not the case with distributed workflows where you
work with several people or on several computers (eg: laptop + build server).

Storing the effect-flag as a bitfield has several advantages:

- It's compact, we are using one byte per obs-marker at most for the effect-
  flag.
- It's compoundable, the obsfate log approach needs to display evolve history
  that could spans several obs-markers. Computing the effect-flag between a
  changeset and its grand-grand-grand-successor is simple thanks to the
  bitfield.

The effect-flag design has also some limitations:

- Evolving a changeset and reverting these changes just after would lead to
  two obs-markers with the same effect-flag without information that the first
  and third changesets are the same.

The effect-flag current design is a trade-off between compactness and
usefulness.

Storing this information helps commands to display a more complete and
understandable evolve history. For example, obslog (an Evolve command) use it
to improve its output:

x  62206adfd571 (34302) obscache: skip updating outdated obscache...
|    rewritten(parent) by Matthieu Laneuville <matthieu.laneuville@octobus...
|    rewritten(content) by Boris Feld <boris.feld@octobus.net>

The effect flag is stored in obs-markers metadata while we iterate on the
information we want to store. We plan to extend the existing obsmarkers
bit-field when the effect flag design will be stabilized.

It's different from the CommitCustody concept, effect-flag are not signed and
can be forged. It's also different from the operation metadata as the command
name (for example: amend) could alter a changeset in different ways (changing
the content with hg amend, changing the description with hg amend -e, changing
the user with hg amend -U). Also it's compatible with every custom command
that writes obs-markers without needing to be updated.

The effect-flag is placed behind an experimental flag set to off by default.

Hook the saving of effect flag in create markers, but store only an empty one
for the moment, I will refine the values in effect flag in following patches.

For more information, see:

  https://www.mercurial-scm.org/wiki/ChangesetEvolutionDevel#Record_types_of_operation

Differential Revision: https://phab.mercurial-scm.org/D533
2017-07-06 14:50:17 +02:00
Boris Feld
533f8e99c5 configitems: register the 'profiling.type' config 2017-06-30 03:44:00 +02:00
Boris Feld
7fee69a49c configitems: register the 'profiling.showmin' config 2017-06-30 03:43:57 +02:00
Boris Feld
c2d0e63222 configitems: register the 'profiling.showmax' config 2017-06-30 03:43:56 +02:00
Boris Feld
ebdb3dfa7a configitems: register the 'profiling.output' config 2017-06-30 03:43:55 +02:00
Simon Whitaker
a83744bf9c dirstate: implement __len__ on dirstatemap (issue5695)
Differential Revision: https://phab.mercurial-scm.org/D884
2017-10-01 16:46:02 +01:00
Simon Whitaker
194133f6f9 obsmarker: crash more helpfully when metadata fields are >255bytes (issue5681)
Various mutators fail when attempting to write obsmarkers with
metadata fields longer than 255 bytes, since the length of
mwetadata fields is stored in u8s. This change raises a more
helpful error in such circumstances.

Differential Revision: https://phab.mercurial-scm.org/D865
2017-10-01 12:54:35 +01:00
Kyle Lippincott
ad7885baee deb: build and install chg
Differential Revision: https://phab.mercurial-scm.org/D883
2017-10-01 03:31:32 -07:00
Kyle Lippincott
c371483a5d deb: install zsh completions to /usr/share/zsh/vendor-completions
This location is used by debian (and ubuntu) to store completions provided by
other deb packages.  The default fpath appears to have this before any of the
zsh-provided instances of the completions, so this should take precedence.

Differential Revision: https://phab.mercurial-scm.org/D882
2017-10-01 02:53:10 -07:00
Rishabh Madan
1fad4ceba7 releasenotes: display release notes when no filename is specified
If the filename is not specified while using --rev, the notes for the specified
revs will just be displayed on screen.

Differential Revision: https://phab.mercurial-scm.org/D877
2017-10-01 14:37:50 +01:00
Gregory Szorc
348ce9ed24 hgweb: use parsebool for parsing diff query string options
Differential Revision: https://phab.mercurial-scm.org/D875
2017-10-01 12:29:33 +01:00
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
Kyle Lippincott
a9ec21ac02 tests: add "have" check for dpkg builddeps
Differential Revision: https://phab.mercurial-scm.org/D879
2017-10-01 05:21:32 -07:00
Kyle Lippincott
158e7288d2 tests: expect parsers.so in cext, parsers.py in pure (test-debian-packages)
Differential Revision: https://phab.mercurial-scm.org/D878
2017-10-01 04:37:56 -07:00
Kyle Lippincott
8b9d729ef1 hghave: check for debuild being installed as well
Differential Revision: https://phab.mercurial-scm.org/D874
2017-10-01 04:10:01 -07: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
Siddharth Agarwal
4247de0b07 tests: disable lints on mercurial/thirdparty
In the next patch, this directory will be used to vendor in some third-party
code.

Differential Revision: https://phab.mercurial-scm.org/D866
2017-10-01 03:24:19 -07:00
Kyle Lippincott
cfad578e95 hghave: fix dpkg --version check to work on recent dpkg versions
Differential Revision: https://phab.mercurial-scm.org/D869
2017-10-01 03:48:28 -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
Gregory Szorc
354d865ae5 tests: add tests for hgweb annotate output
In preparation for adding features to modify whitespace settings.

Differential Revision: https://phab.mercurial-scm.org/D848
2017-09-30 09:07:00 +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