Commit Graph

29161 Commits

Author SHA1 Message Date
Denis Laxalde
2acd032eb6 hgweb: display blamed revision once per block in annotate view
I.e. when a revision blames a block of source lines, only display the
revision link on the first line of the block (this is identified by the
"blockhead" key in annotate context).

This addresses item "Visual grouping of changesets" of the blame improvements
plan (https://www.mercurial-scm.org/wiki/BlamePlan) which states: "Typically
there are block of lines all attributed to the same revision. Instead of
rendering the revision/changeset for every line, we could only render it once
per block."
2016-06-07 12:10:01 +02:00
Denis Laxalde
c4ddd5ce73 hgweb: highlight data of the current revision in annotate view
* Distinguish the /annotate/<revision>/<file>#<linenumber> link when it would
  lead to the current page (i.e. <revision> is the current revision) (style it
  gray and undecorated). This indicates more clearly that this is a "dead-end"
  in blame navigation.

* Display lines changed in current revision in green.
2016-06-02 16:26:50 +02:00
Martijn Pieters
1df88133b7 bashcompletion: show available command-line switches for aliases
When auto-completing hg commands, aliases are listed, but not the available
switches for an alias, because `HGPLAIN=1` filters these out. Add a
`HGPLAINEXCEPT=alias` exception to resolve this.

We make heavy use of aliases that drive hg log with custom revsets, sorting and
the -G switch, but want our users to be able to auto-complete any additional
command-line switches.
2016-06-21 17:15:51 +01:00
Pulkit Goyal
04a26c4980 py3: shift from __future__ import absolute import to beginning (issue5269) 2016-06-20 23:31:45 +05:30
liscju
ccdb8ddd17 pull: add help information about pulling active bookmark 2016-06-20 23:24:55 +02:00
Laura Médioni
077969174b templates: add support for search webcommand in json style 2016-06-10 10:31:42 +02:00
Laura Médioni
d95b4f5e78 templates: add support for summary webcommand in json style
Change summary webcommand to yield each element of the shortlog instead of the
entire list.

This makes generated json more readable since each entry can be formatted
separately, instead of returning all the shortlog content in a single string.
2016-06-06 15:14:11 +02:00
Laura Médioni
ed3df019a8 templates: add support for filerevision webcommand in json style 2016-06-03 12:32:42 +02:00
Laura Médioni
f9a14da931 templates: add support for filelog webcommand in json style
Modify changelistentry structure to also deliver phase and branch data and use
either 'parents' or 'allparents' depending on what is defined in the view, in
order to reuse it in filelog structure.
2016-06-03 11:28:22 +02:00
liscju
1ab6bdda49 largefiles: make cloning not ask two times about password (issue4883)
Before this commit url.opener overwritten stored password
for connection with given url/user even when
new password for given connection was not filled. This
commit makes opener overwrites saved authentication only
when it contains password.
2016-06-09 12:41:57 +02:00
liscju
ade9d0fabe url: remember http password database in ui object
This makes http password database stored in ui object.
It allows reusing authentication information when we
use this database for creating password manager for
the new connection.
2016-06-09 11:41:36 +02:00
liscju
caed6f4913 url: extract password database from password manager
So far password manager was keeping authentication information so opening
new connection and creating new password manager made all saved authentication
information lost.

This commit separates password manager and password database to make it
possible to reuse saved authentication information.

This commit violates code checker because it adds add_password method (name
with underscore) to passwordmgr object to provide method required by urllib2.
2016-06-05 23:36:23 +02:00
liscju
767e27633e bookmarks: add 'hg pull -B .' for pulling the active bookmark (issue5258) 2016-06-01 22:58:57 +02:00
FUJIWARA Katsunori
84bc1a274c demandimport: delay loading for "from a import b" with absolute_import
Before this patch, "from a import b" doesn't delay loading module "b",
if absolute_import is enabled, even though "from . import b" does.

For example:

  - it is assumed that extension X has "from P import M" for module M
    under package P with absolute_import feature

  - if importing module M is already delayed before loading extension
    X, loading module M in extension X is delayed until actually
    referring

    util, cmdutil, scmutil or so of Mercurial itself should be
    imported by "from . import M" style before loading extension X

  - otherwise, module M is loaded immediately at loading extension X,
    even if extension X itself isn't used at that "hg" command invocation

    Some minor modules (e.g. filemerge or so) of Mercurial itself
    aren't imported by "from . import M" style before loading
    extension X. And of course, external libraries aren't, too.

This might cause startup performance problem of hg command, because
many bundled extensions already enable absolute_import feature.

To delay loading module for "from a import b" with absolute_import
feature, this patch does below in "from a (or .a) import b" with
absolute_import case:

  1. import root module of "name" by system built-in __import__
     (referred as _origimport)

  2. recurse down the module chain for hierarchical "name"

     This logic can be shared with non absolute_import
     case. Therefore, this patch also centralizes it into chainmodules().

  3. and fall through to process elements in "fromlist" for the leaf
     module of "name"

     Processing elements in "fromlist" is executed in the code path
     after "if _pypy: .... else: ..." clause. Therefore, this patch
     replaces "if _pypy:" with "elif _pypy:" to share it.

At faecf59a4184 introducing original "work around" for "from a import
b" case, elements in "fromlist" were imported with "level=level". But
"level" might be grater than 1 (e.g. level=2 in "from .. import b"
case) at demandimport() invocation, and importing direct sub-module in
"fromlist" with level grater than 1 causes unexpected result.

IMHO, this seems main reason of "errors for unknown reason" described
in faecf59a4184, and we don't have to worry about it, because this
issue was already fixed by 2711f50242cf.

This is reason why this patch removes "errors for unknown reasons"
comment.
2016-06-19 02:17:33 +09:00
FUJIWARA Katsunori
f32b1f4b1c import-checker: increase portability for python 2.6.x
Before this patch, fromlocalfunc() assumes that "module" attribute of
ast.ImportFrom is None for "from . import a", and Python 2.7.x
satisfies this assumption.

On the other hand, with Python 2.6.x, "module" attribute of
ast.ImportFrom is an empty string for "from . import a", and this
causes failure of test-check-module-imports.t.
2016-06-19 02:15:09 +09:00
Martijn Pieters
d908f2c8dc scmutil: allow access to filecache descriptor on class
To make it easier to patch the wrapped function, make it possible to access the
filecache descriptor directly on the class (rather than have to use
ClassObject.__dict__['attributename']). Returning `self` when the first
argument to `__get__` is `None` makes the descriptor behave the same way
`property` objects do.
2016-06-17 20:06:09 +01:00
Kostia Balytskyi
305d79a43c rebase: do not abort if all changesets have equivalents in the destination 2016-06-17 16:59:08 +01:00
Martin von Zweigbergk
6612ed3d4a changegroup: don't send empty subdirectory manifest groups
When grafting/rebasing, it is common for multiple changesets to make
the same change to a subdirectory. When writing the revlog for the
directory, the revlog code already takes care of not writing the entry
again. In 3eb9fa4180d3 (changegroup: prune subdirectory dirlogs too,
2016-02-12), I added the corresponding code in changegroup (not
sending entries the client already has), but I forgot to avoid sending
the entire changegroup if no nodes remained in the pruned
set. Although that's harmless besides the wasted network traffic, the
receiving side was checking for it (copied from the changegroup code
for handling files). This resulted in the client crashing with:

  abort: received dir revlog group is empty

Fix by simply not emitting a changegroup for the directory if there
were no changes is it. This matches how files are handled.
2016-06-16 15:15:33 -07:00
Yuya Nishihara
36bce4885c chg: ignore SIGINT while waiting pager termination
Otherwise the terminal would be left with unclean state. This is what
ea9ab1ca7e38 does.
2016-06-15 23:49:56 +09:00
Yuya Nishihara
ca4a132300 chg: reset signal handlers to default before waiting pager
Our signal handlers forward signals to the server process, but it will
disappear soon after hgc_close(). So we should unregister handlers before
hgc_close(). Otherwise chg would abort due to kill(perrpid, sig) failure.

The problem is spotted by SIGWINCH while waiting pager termination.
2016-06-15 23:32:00 +09:00
FUJIWARA Katsunori
d7b7f8358b doc: describe detail about checkambig optional argument
This is followup for patches below, which add checkambig argument to
existing function.

  - 6508a36c1e44
  - ccbeace526ad
  - 936ec05504bf
  - a9a2d0013b68
2016-06-13 05:11:56 +09:00
Yuya Nishihara
bed8e170aa ui: provide official way to reset internal state per command
This will allow us to clear in-memory password storage per runcommand().

I've updated commandserver to call resetstate() of both ui and repo.ui because
they may have different states in theory.
2016-06-12 14:07:26 +09:00
Yuya Nishihara
1c12bcd4ad revset: extract function that validates sort() arguments
This function will be used in _optimize() to get rid of noop sort() call while
validating its arguments.
2016-06-11 10:17:49 +09:00
Yuya Nishihara
2ddc948200 revset: build dict of extra sort options before evaluating set
Prepares for extracting a function that only validates sort options.
2016-06-15 21:26:45 +09:00
Yuya Nishihara
1ee4615445 revset: build list of (key, reverse) pairs before sorting
Prepares for extracting a function that only validates sort options.
2016-06-11 10:15:40 +09:00
Yuya Nishihara
4659949bd1 revset: fix crash on empty sort key
Make it noop as before ddf6bfe09ab2. We could change it to an error, but
allowing empty key makes some sense for scripting that builds a key string
programmatically.
2016-06-15 20:37:24 +09:00
Kostia Balytskyi
82f69b2833 rebase: move local variable 'targetancestors' to the RR class 2016-06-13 22:41:45 +01:00
Kostia Balytskyi
e83111af7f rebase: move local variable 'skipped' to the RR class 2016-06-13 22:40:59 +01:00
Kostia Balytskyi
648a368d05 rebase: move local variable 'target' to the RR class 2016-06-13 22:38:54 +01:00
Kostia Balytskyi
e11f6bcd12 rebase: introduce a rebaseruntime (RR) class
rebaseruntime is a class that will in future contain all of the state
necessary to perform rebase operation and have pieces of rebase logic as
its methods.

This commit introduces the class and moves the following local variables to
be its fields:
- originalwd
- external
- state
- activebookmark
2016-06-13 22:36:13 +01:00
Jun Wu
18674dc0d2 chg: change default connect timeout to 60 seconds
As discussed at
https://www.mercurial-scm.org/pipermail/mercurial-devel/2016-June/085290.html

The default 10-second timeout is not enough if the machine is overloaded.
Let's increase it to 60 seconds.
2016-06-15 21:36:31 +01:00
Durham Goode
78417c606d tests: increase test-https malform error glob
The recently introduced (fd348a6ace5a157c) test around malformed pem files hard
codes an error message which doesn't appear to be cross platform agnostic. On
our machines (centos6 if it matters) the test output differs:

-  abort: error: unknown error* (glob)
+  abort: error: _ssl.c:330: error:00000000:lib(0):func(0):reason(0)

This patch increases the glob to cover the entire error message.
2016-06-14 18:14:42 -07:00
liscju
1d5b38f7bf largefiles: make storefactory._openstore public
In storefactory opening store is the main functionality,
so it shouldn't be marked as private with underscore.
2016-06-14 11:21:41 +02:00
liscju
d19dfc8664 bookmarks: abort 'push -B .' when no active bookmark 2016-06-13 23:50:26 +02:00
FUJIWARA Katsunori
f06844e1ef transaction: avoid ambiguity of file stat at restoring from backup
In some cases below, copying from backup is used to restore original
contents of a file, which is backuped via addfilegenerator(). If
copying keeps ctime, mtime and size of a file, restoring is
overlooked, and old contents cached before restoring isn't invalidated
as expected.

  - failure of transaction (from '.hg/journal.backup.*')
  - rollback of previous transaction (from '.hg/undo.backup.*')

To avoid ambiguity of file stat at restoring, this patch invokes
util.copyfile() with checkambig=True.

This patch is a part of "Exact Cache Validation Plan":

    https://www.mercurial-scm.org/wiki/ExactCacheValidationPlan
2016-06-13 05:11:56 +09:00
FUJIWARA Katsunori
dbfbc278c8 localrepo: make restoring from backup at rollback avoid ambiguity of file stat
Rollback of previous transaction restores contents of files below by
renaming from 'undo.*' file. If renaming keeps ctime, mtime and size
of a file, restoring is overlooked, and old contents cached before
restoring isn't invalidated as expected.

  - .hg/bookmarks
  - .hg/phaseroots

To avoid ambiguity of file stat at restoring, this patch invokes
vfs.rename() with checkambig=True.

BTW, .hg/dirstate is also restored at rollback. But it is restored by
dirstate.restorebackup(), and previous patch already made it invoke
vfs.rename() with checkambig=True.

This patch is a part of "Exact Cache Validation Plan":

    https://www.mercurial-scm.org/wiki/ExactCacheValidationPlan
2016-06-13 05:11:56 +09:00
FUJIWARA Katsunori
19907e427c dirstate: make restoring from backup avoid ambiguity of file stat
File .hg/dirstate is restored by renaming from backup in failure
inside scopes below. If renaming keeps ctime, mtime and size of a
file, restoring is overlooked, and old contents cached before
restoring isn't invalidated as expected.

  - dirstateguard scope (from '.hg/dirstate.SUFFIX')
  - transaction scope (from '.hg/journal.dirstate')

To avoid ambiguity of file stat at restoring, this patch invokes
vfs.rename() with checkambig=True.

This patch is a part of "Exact Cache Validation Plan":

    https://www.mercurial-scm.org/wiki/ExactCacheValidationPlan
2016-06-13 05:11:56 +09:00
Denis Laxalde
b3d7ea5cb8 tests: drop a duplicated instruction 2016-06-11 20:59:49 +02:00
Matt Mackall
3eee63391d merge with stable 2016-06-14 14:52:58 -05:00
Martijn Pieters
6cc53d84c9 revset: add new topographical sort
Sort revisions in reverse revision order but grouped by topographical branches.
Visualised as a graph, instead of:

  o  4
  |
  | o  3
  | |
  | o  2
  | |
  o |  1
  |/
  o  0

revisions on a 'main' branch are emitted before 'side' branches:

  o  4
  |
  o  1
  |
  | o  3
  | |
  | o  2
  |/
  o  0

where what constitutes a 'main' branch is configurable, so the sort could also
result in:

  o  3
  |
  o  2
  |
  | o  4
  | |
  | o  1
  |/
  o  0

This sort was already available as an experimental option in the graphmod
module, from which it is now removed.

This sort is best used with hg log -G:

  $ hg log -G "sort(all(), topo)"
2016-06-13 18:20:00 +01:00
Martijn Pieters
57bf8caf56 revset: move groupbranchiter over from graphmod
This move is to prepare the adaptation of this function into a toposort
predicate.
2016-06-13 18:20:00 +01:00
Martijn Pieters
ffccd3fc81 revset: record if a set is in topographical order
A later revision adds actual topographical sorting. Recording if a set is in
this order allows hg log -G to avoid re-sorting the revset.
2016-06-14 11:05:36 +01:00
Jun Wu
eacf673970 chg: make timeout adjustable
Before this patch, chg will give up when it cannot connect to the new server
within 10 seconds. If the host has high load during that time, 10 seconds
is not enough.

This patch makes it adjustable using the CHGTIMEOUT environment variable.
2016-06-13 21:30:14 +01:00
Jun Wu
7c2dd6af83 chg: exec pager in child process
Before this patch, chg uses the old pager behavior (pre 55f6f7fb60d2), which
executes pager in the main process. The user will see the exit code of the
pager, instead of the hg command.

Like 55f6f7fb60d2, this patch fixes the behavior by executing the pager in
the child process, and wait for it at the end of the main process.
2016-06-11 20:25:49 +01:00
Jun Wu
46d9d1e26c tests: move chg pager test to test-pager.t
The test is valid for both hg and chg. Since we are adding another chg-related
pager test, let's put them together.
2016-06-13 13:16:17 +01:00
Augie Fackler
493fe9d7a6 util: drop local aliases for md5, sha1, sha256, and sha512
This used to be needed to paper over hashlib not being in all Pythons
we support, but that's not a problem anymore, so we can simplify
things a little bit.
2016-06-10 00:13:23 -04:00
Augie Fackler
ad67b99d20 cleanup: replace uses of util.(md5|sha1|sha256|sha512) with hashlib.\1
All versions of Python we support or hope to support make the hash
functions available in the same way under the same name, so we may as
well drop the util forwards.
2016-06-10 00:12:33 -04:00
Augie Fackler
7611181d2a pathencode: use hashlib.sha1 directly instead of indirecting through util 2016-06-10 00:25:07 -04:00
Augie Fackler
9e4f37dc8d revlog: use hashlib.sha1 directly instead of through util
Also remove module-local _sha alias, which was barely used.
2016-06-10 00:10:34 -04:00
Augie Fackler
a829db2256 store: use hashlib.sha1 directly instead of through util
Also remove module-local alias to _sha, since it's not used that much.
2016-06-10 00:10:06 -04:00